Making WordPress.org

Changeset 8797


Ignore:
Timestamp:
05/15/2019 02:01:37 PM (5 years ago)
Author:
vedjain
Message:

CampTix-Invoices: Hide the VAT table row if no VAT details are present.

Currently Invoices will include the VAT: 0 line in the table even if the plugin is set to not collect VAT numbers.

The attached patch simply hides that row, and only shows it if either of the following conditions are met:

  1. The form is set to accept VAT numbers
  2. The invoice has a VAT number associated with it

While using either of these conditionals individually would suffice, it was simpler to just cover future bases by checking both.

This will aid in the future usage of the plugin outside of the EU.

props dion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/camptix-invoices/includes/views/invoice-template.php

    r8657 r8797  
    184184                    </tr>
    185185                <?php endforeach ?>
    186             <tr>
    187                 <td class="text-right"><?php esc_html_e('VAT', 'wordcamporg'); ?></td>
    188                 <td></td>
    189                 <td></td>
    190                 <td class="text-right">
    191                     <?php echo esc_html( CampTix_Addon_Invoices::format_currency( 0, $camptix_opts['currency'] ) ); ?>
    192                 </td>
    193             </tr>
     186
     187            <?php if ( ! empty( $invoice_metas['vat-number'] ) || ! empty( $camptix_opts['invoice-vat-number'] ) ) : ?>
     188                <tr>
     189                    <td class="text-right"><?php esc_html_e('VAT', 'wordcamporg'); ?></td>
     190                    <td></td>
     191                    <td></td>
     192                    <td class="text-right">
     193                        <?php echo esc_html( CampTix_Addon_Invoices::format_currency( 0, $camptix_opts['currency'] ) ); ?>
     194                    </td>
     195                </tr>
     196            <?php endif; // VAT field ?>
     197
    194198            <tr>
    195199                <td class="text-right"><?php esc_html_e( 'TOTAL', 'wordcamporg' ); ?></td>
Note: See TracChangeset for help on using the changeset viewer.