-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,6 +72,7 @@ public function search_box( $text, $input_id ) { | |
<?php | ||
} | ||
|
||
|
||
/** | ||
* This function renders most of the columns in the list table. | ||
* | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. |
||
$order = $this->get_base_order( wc_get_order( $item->order_id ) ); | ||
if ( ! empty( $order ) ) { | ||
$invoice = wcpdf_get_document( 'invoice', $order ); | ||
$value = $invoice->document_display_date(); | ||
} else { | ||
$value = '<strong>' . __('Unknown', 'woocommerce-pdf-ips-number-tools') .'</strong>'; | ||
} | ||
break; | ||
default: | ||
$value = isset( $item->$column_name ) | ||
? $item->$column_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 commentThe 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:
Therefore, instead of checking for the exact value, you should check if the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think for readable purposes, this line should be moved to |
||
) { | ||
$columns['date_display'] = __( 'Display Invoice Date', 'woocommerce-pdf-ips-number-tools' ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have two spaces after the assignment operator. |
||
} | ||
return apply_filters( 'wpo_wcpdf_number_tools_columns', $columns ); | ||
} | ||
|
||
|
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.