PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.4.2
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.4.2
2.4.3 2.4.4 2.4.2 2.4.0 2.4.1 2.3.8 2.3.7 2.3.6 2.3.5 2.3.4 2.3.3 2.3.2 2.3.1 2.2.0 2.1.21 2.1.20 2.1.19 2.1.18 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 All 60 releases
← All changes | templates/invoice-templates/legacy.php +117 -30 2.1.21 → 2.4.2 View file →
@@ -3,9 +3,13 @@
3 3 * Legacy Invoice Template
4 4 * Clean, minimalist design with traditional business layout
5 5 */
6 6
7 -$text_settings = \EasyInvoice\Helpers\TemplateTextHelper::getInvoiceTextSettings();
7 +if ( ! defined( 'ABSPATH' ) ) {
8 + exit;
9 +}
10 +$text_settings = \EasyInvoice\Helpers\TemplateTextHelper::forDocument(\EasyInvoice\Helpers\TemplateTextHelper::getInvoiceTextSettings(), $invoice);
11 +$ei_is_credit_note = \EasyInvoice\Helpers\TemplateTextHelper::isCreditNote($invoice);
8 12 $company_info = \EasyInvoice\Helpers\TemplateTextHelper::getCompanyInfo();
9 13 ?>
10 14
11 15 <style>
@@ -256,9 +260,9 @@
256 260 color: #111827;
257 261 font-size: 14px;
258 262 }
259 263
260 -.template-legacy .invoice-grand-total {
264 +.template-legacy .invoice-totals .invoice-grand-total {
261 265 background: #f9fafb;
262 266 border-top: 1px solid #e5e7eb;
263 267 margin-top: 0;
264 268 padding-top: 12px;
@@ -264,9 +268,9 @@
264 268 padding-top: 12px;
265 269 }
266 270
267 271 .template-legacy .invoice-grand-total .invoice-total-label,
268 -.template-legacy .invoice-grand-total .invoice-total-value {
272 +.template-legacy .invoice-totals .invoice-grand-total .invoice-total-value {
269 273 font-weight: 700;
270 274 font-size: 16px;
271 275 color: #111827;
272 276 }
@@ -287,27 +291,78 @@
287 291 .template-legacy .footer-company {
288 292 color: #9ca3af;
289 293 font-size: 13px;
290 294 }
295 +
296 +.template-legacy .terms-section {
297 + margin-top: 20px;
298 + padding: 20px;
299 + background: #f9fafb;
300 + border-radius: 8px;
301 + border-left: 4px solid #e5e7eb;
302 +}
303 +
304 +.template-legacy .terms-section h3 {
305 + font-size: 16px;
306 + font-weight: 600;
307 + color: #374151;
308 + margin-bottom: 12px;
309 + text-transform: uppercase;
310 + letter-spacing: 0.5px;
311 +}
312 +
313 +.template-legacy .terms-content {
314 + color: #6b7280;
315 + font-size: 14px;
316 + line-height: 1.6;
317 +}
318 +
319 +/* Shared polish: numbers line up, numeric headings sit over their figures. */
320 +.template-legacy .invoice-items th + th { text-align: right; }
321 +.template-legacy .invoice-items .item-quantity,
322 +.template-legacy .invoice-items .item-price,
323 +.template-legacy .invoice-items .item-adjust,
324 +.template-legacy .invoice-items .item-total,
325 +.template-legacy .invoice-total-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
326 +.template-legacy .meta-value { white-space: nowrap; }
327 +.template-legacy .invoice-items .item-adjust { text-align: right; }
328 +.template-legacy .client-contact { font-weight: 500; margin-bottom: 0.15em; }
329 +.template-legacy .client-tax-number,
330 +.template-legacy .company-tax-number { margin-top: 0.35em; }
331 +.template-legacy .invoice-items .item-description { white-space: pre-line; }
332 +.template-legacy .document-kind { display: block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-muted, #8a8a8a); font-family: var(--font-family-body, inherit); font-style: normal; margin-bottom: 0.3em; line-height: 1.2; }
333 +
334 +/* Legacy: keeps its ruled grid, with softer rules and the same type size as the other designs. */
335 +.template-legacy .invoice-items th, .template-legacy .invoice-items td { border-color: #e5e7eb !important; }
336 +.template-legacy .invoice-items th { background: #f9fafb; font-size: 12px; letter-spacing: 0.08em; color: #374151; }
337 +.template-legacy .invoice-meta, .template-legacy .meta-item { border-color: #e5e7eb !important; }
338 +.template-legacy .company-name { color: #111827; }
339 +.template-legacy .address-block h2 { font-size: 12px; letter-spacing: 0.12em; color: #6b7280; text-transform: uppercase; }
340 +.template-legacy .terms-section, .template-legacy .description-section { background: transparent; border: 0; border-top: 1px solid #e5e7eb; border-radius: 0; padding: 16px 0 0; }
341 +.template-legacy .terms-section h3 { font-size: 12px; letter-spacing: 0.12em; color: #6b7280; }
342 +.template-legacy .invoice-header { margin-bottom: 24px; }
343 +.template-legacy .invoice-totals .invoice-paid-row .invoice-total-value { color: var(--success-color, #047857); }
344 +.template-legacy .invoice-totals .invoice-balance-due { font-weight: 700; }
345 +.template-legacy .invoice-totals .invoice-balance-due .invoice-total-label { color: inherit; font-weight: 700; }
291 346 </style>
292 347
293 348 <div class="template-legacy">
294 - <!-- Header Section -->
295 349 <div class="invoice-header">
296 350 <div class="company-info">
351 + <?php if (!empty($company_info['logo'])): ?>
297 352 <div class="company-logo">
298 - <?php if (!empty($company_info['logo'])): ?>
299 - <img src="<?php echo esc_url($company_info['logo']); ?>" alt="<?php echo esc_attr($company_info['name']); ?>" class="logo-image">
300 - <?php endif; ?>
353 + <img src="<?php echo esc_url($company_info['logo']); ?>" alt="<?php echo esc_attr($company_info['name']); ?>" class="logo-image" onerror="this.parentNode.parentNode.removeChild(this.parentNode)">
301 354 </div>
355 + <?php endif; ?>
302 356 <div class="company-name"><?php echo esc_html($company_info['name']); ?></div>
303 357 <div class="company-details">
304 - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only'); ?>
358 + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only')); ?>
305 359 </div>
306 360 </div>
307 361
308 362 <div class="invoice-title-section">
309 - <div class="invoice-title"><?php echo esc_html($invoice->getTitle() ?: __('Invoice', 'easy-invoice')); ?></div>
363 + <?php $ei_kind = \EasyInvoice\Helpers\TemplateTextHelper::documentKind($invoice); $ei_title = trim((string) $invoice->getTitle()); ?>
364 + <div class="invoice-title"><?php if ('' !== $ei_title && 0 !== strcasecmp($ei_title, $ei_kind)) : ?><span class="document-kind"><?php echo esc_html($ei_kind); ?></span><?php endif; ?><?php echo esc_html('' !== $ei_title ? $ei_title : $ei_kind); ?></div>
310 365 <div class="invoice-meta">
311 366 <div class="meta-item">
312 367 <span class="meta-label"><?php echo esc_html($text_settings['invoice_number']); ?></span>
313 368 <span class="meta-value"><?php echo esc_html($invoice->getNumber()); ?></span>
@@ -315,37 +370,35 @@
315 370 <div class="meta-item">
316 371 <span class="meta-label"><?php echo esc_html($text_settings['invoice_date']); ?></span>
317 372 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getIssueDate())); ?></span>
318 373 </div>
374 + <?php if (empty($ei_is_credit_note)) : ?>
319 375 <div class="meta-item">
320 376 <span class="meta-label"><?php echo esc_html($text_settings['due_date']); ?></span>
321 377 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getDueDate())); ?></span>
322 378 </div>
379 + <?php endif; ?>
380 + <?php if (empty($ei_is_credit_note)) : ?>
323 381 <div class="meta-item">
324 382 <span class="meta-label"><?php echo esc_html($text_settings['total_due']); ?></span>
325 - <span class="meta-value total-due"><?php echo esc_html($formatter->format($invoice->getTotal())); ?></span>
383 + <span class="meta-value total-due"><?php echo esc_html($formatter->format(\EasyInvoice\Helpers\TemplateTextHelper::amountDue($invoice))); ?></span>
326 384 </div>
385 + <?php endif; ?>
327 386 </div>
328 387 </div>
329 388 </div>
330 389
331 - <!-- Address Section -->
390 + <?php $ei_client_html = \EasyInvoice\Helpers\TemplateTextHelper::generateClientBlock($invoice); if ('' !== $ei_client_html) : ?>
332 391 <div class="address-section">
333 392 <div class="address-block">
334 393 <h2><?php echo esc_html($text_settings['to']); ?></h2>
335 394 <div class="address-content">
336 - <div class="client-name"><?php echo esc_html($invoice->getCustomerName()); ?></div>
337 - <?php if ($invoice->getCustomerAddress()): ?>
338 - <?php echo nl2br(esc_html($invoice->getCustomerAddress())); ?><br>
339 - <?php endif; ?>
340 - <?php if ($invoice->getCustomerEmail()): ?>
341 - <?php echo esc_html($invoice->getCustomerEmail()); ?><br>
342 - <?php endif; ?>
395 + <?php echo wp_kses_post($ei_client_html); ?>
343 396 </div>
344 397 </div>
345 398 </div>
399 + <?php endif; ?>
346 400
347 - <!-- Description Section -->
348 401 <?php if ($invoice->getNotes()): ?>
349 402 <div class="description-section">
350 403 <div class="description-content">
351 404 <?php echo nl2br(esc_html($invoice->getNotes())); ?>
@@ -352,9 +405,18 @@
352 405 </div>
353 406 </div>
354 407 <?php endif; ?>
355 408
356 - <!-- Invoice Items -->
409 + <?php
410 + // The adjustment column appears only when at least one line uses it.
411 + $ei_show_adjust = \EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField();
412 + if ($ei_show_adjust) {
413 + $ei_show_adjust = false;
414 + foreach ($invoice->getItems() as $ei_item) {
415 + if ((float) $ei_item->getAdjustPercentage() != 0.0) { $ei_show_adjust = true; break; }
416 + }
417 + }
418 + ?>
357 419 <table class="invoice-items">
358 420 <thead>
359 421 <tr>
360 422 <th><?php echo esc_html($text_settings['service']); ?></th>
@@ -359,15 +421,18 @@
359 421 <tr>
360 422 <th><?php echo esc_html($text_settings['service']); ?></th>
361 423 <th><?php echo esc_html($text_settings['qty']); ?></th>
362 424 <th><?php echo esc_html($text_settings['rate_price']); ?></th>
363 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
425 + <?php if ($ei_show_adjust): ?>
364 426 <th><?php echo esc_html($text_settings['adjust']); ?> (%)</th>
365 427 <?php endif; ?>
366 - <th><?php echo esc_html($text_settings['total']); ?></th>
428 + <th><?php echo esc_html($text_settings['line_total'] ?? $text_settings['total']); ?></th>
367 429 </tr>
368 430 </thead>
369 431 <tbody>
432 + <?php if (!$invoice->getItems()) : ?>
433 + <tr class="no-items"><td colspan="<?php echo $ei_show_adjust ? 5 : 4; ?>" style="text-align:center;color:#9ca3af;padding:18px;"><?php esc_html_e('No items yet.', 'easy-invoice'); ?></td></tr>
434 + <?php endif; ?>
370 435 <?php foreach ($invoice->getItems() as $item): ?>
371 436 <tr>
372 437 <td class="item-name">
373 438 <div class="item-title"><?php echo esc_html($item->getName()); ?></div>
@@ -376,9 +441,9 @@
376 441 <?php endif; ?>
377 442 </td>
378 443 <td class="item-quantity"><?php echo esc_html($item->getQuantity() ?: '0'); ?></td>
379 444 <td class="item-price"><?php echo esc_html($formatter->format($item->getPrice())); ?></td>
380 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
445 + <?php if ($ei_show_adjust): ?>
381 446 <td class="item-adjust"><?php
382 447 $adjust_percentage = $item->getAdjustPercentage();
383 448 if ($adjust_percentage != 0) {
384 449 echo esc_html($adjust_percentage > 0 ? '+' : '') . esc_html($adjust_percentage) . '%';
@@ -392,17 +457,39 @@
392 457 <?php endforeach; ?>
393 458 </tbody>
394 459 </table>
395 460
396 - <!-- Invoice Totals -->
397 461 <div class="invoice-totals">
398 - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($invoice, $text_settings, $formatter, 'invoice'); ?>
462 + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($invoice, $text_settings, $formatter, 'invoice')); ?>
399 463 </div>
400 464
401 - <!-- Footer -->
465 + <?php
466 + $terms_conditions = empty($ei_is_credit_note) ? ($invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions()) : '';
467 + if ($terms_conditions):
468 + ?>
469 + <div class="terms-section">
470 + <h3><?php esc_html_e('Terms & Conditions', 'easy-invoice'); ?></h3>
471 + <div class="terms-content">
472 + <?php echo wp_kses_post($terms_conditions); ?>
473 + </div>
474 + </div>
475 + <?php endif; ?>
476 +
477 + <?php
478 + /**
479 + * Fires inside the document card, after notes and terms and before the
480 + * footer text: attachments, the signature block, e-invoicing notes. Being
481 + * inside the card, it is part of what "Download as PDF" captures.
482 + *
483 + * @param object $document The invoice model.
484 + * @param string $type 'invoice'.
485 + */
486 + do_action('easy_invoice_document_body_after', $invoice, 'invoice');
487 +
488 + $ei_footer_text = \EasyInvoice\Helpers\TemplateTextHelper::footerText($invoice, 'invoice');
489 + if ('' !== trim(wp_strip_all_tags((string) $ei_footer_text))) :
490 + ?>
402 491 <div class="invoice-footer">
403 - <p>Payment is due within <?php echo esc_html($invoice->getDueDays() ?: 30); ?> days from date of invoice.</p>
404 - <div class="footer-company">
405 - Thanks for choosing <?php echo esc_html($company_info['name']); ?> | <?php echo esc_html($company_info['email'] ?? '[email protected]'); ?>
406 - </div>
492 + <p><?php echo wp_kses_post($ei_footer_text); ?></p>
407 493 </div>
494 + <?php endif; ?>
408 495 </div>