-
Notifications
You must be signed in to change notification settings - Fork 0
Display invoice date in invoices table #18
base: main
Are you sure you want to change the base?
Conversation
@@ -150,6 +160,12 @@ public function get_columns() { | |||
if ( ! isset( WPO_WCPDF()->settings->debug_settings['calculate_document_numbers'] ) ) { | |||
unset( $columns['calculated_number'] ); | |||
} | |||
|
|||
if( ! isset( $_GET['table_name'] ) || | |||
( isset( $_GET['table_name'] ) && 'wp_wcpdf_invoice_number' === $_GET['table_name'] ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new column is only displayed for the invoice number store for the current year, but not for past years.
Since v2.11.0, we handle the number stores separated by year (introduced in PR#164). For instance, for a shop that is generating invoices since 2021, you could have these tables in your database:
wp_wcpdf_invoice_number
: Current yearwp_wcpdf_invoice_number_2022
: Invoice numbers from 2022wp_wcpdf_invoice_number_2021
: Invoice numbers from 2021
Therefore, instead of checking for the exact value, you should check if the wp_wcpdf_invoice_number
part is present on the $_GET['table_name']
.
@@ -150,6 +160,12 @@ public function get_columns() { | |||
if ( ! isset( WPO_WCPDF()->settings->debug_settings['calculate_document_numbers'] ) ) { | |||
unset( $columns['calculated_number'] ); | |||
} | |||
|
|||
if( ! isset( $_GET['table_name'] ) || | |||
( isset( $_GET['table_name'] ) && 'wp_wcpdf_invoice_number' === $_GET['table_name'] ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for readable purposes, this line should be moved to :164
, that is, the whole condition in a single line. Also, remember to add a space after the if
statement.
if( ! isset( $_GET['table_name'] ) || | ||
( isset( $_GET['table_name'] ) && 'wp_wcpdf_invoice_number' === $_GET['table_name'] ) | ||
) { | ||
$columns['date_display'] = __( 'Display Invoice Date', 'woocommerce-pdf-ips-number-tools' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have two spaces after the assignment operator.
@@ -121,6 +122,15 @@ public function column_default( $item, $column_name ) { | |||
$value = '<strong>' . __('Unknown', 'woocommerce-pdf-ips-number-tools') .'</strong>'; | |||
} | |||
break; | |||
case 'date_display' : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -72,6 +72,7 @@ public function search_box( $text, $input_id ) { | |||
<?php | |||
} | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that you added this extra line by accident.
Closes #16
Added new column 'Display Invoice Date' only in Invoice table. There is dependent PR in main plugin. We need to merge that before checking this request.