Skip to content

Commit

Permalink
Tweaks on Credit Note number table
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmigf committed Mar 21, 2024
1 parent 736d81b commit 7a512d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions assets/css/settings-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ table.wcpdf_documents_settings_list td.title {
background-color: #51266b;
}

.wcpdf_advanced_numbers_choose_table .number-refund {
background-color: #2271b1;
}

.wcpdf_document_settings_document_output_formats {
margin-bottom: 30px;
}
Expand Down
12 changes: 8 additions & 4 deletions includes/tables/class-wcpdf-number-store-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,17 @@ public function column_default( $item, $column_name ) {
if ( ! empty( $document_type ) ) {
$document_slug = str_replace( '-', '_', $document_type );
$saved_number = $order->get_meta( "_wcpdf_{$document_slug}_number", true );
$order_id = is_callable( array( $order, 'get_id' ) ) ? $order->get_id() : $item->order_id;

if ( ! empty( $saved_number ) && absint( $saved_number ) === absint( $item->id ) ) {
$value = '<span class="item-number number-doc-type">' . $document_type . '</span>';
} elseif ( 'credit-note' === $document_type && absint( $order_id ) !== absint( $item->order_id ) ) {
$value = sprintf(
'<span class="item-number number-doc-type">%s</span><p style="margin-top:6px;"><span class="item-number number-refund">%s #%s</span></p>',
$document_type,
__( 'refund:', 'woocommerce-pdf-invoices-packing-slips' ),
$item->order_id
);
}
}
break;
Expand All @@ -98,10 +106,6 @@ public function column_default( $item, $column_name ) {
$order_id = is_callable( array( $order, 'get_id' ) ) ? $order->get_id() : $item->order_id;
$url = sprintf( 'post.php?post=%s&action=edit', $order_id );
$value = sprintf( '<a href="%s">#%s</a>', $url, $order_number );

if ( absint( $order_id ) !== absint( $item->order_id ) ) {
$value .= sprintf( ' (%s #%s)', __( 'Refund:', 'woocommerce-pdf-invoices-packing-slips' ), $item->order_id );
}
break;
case 'order_status':
$value = sprintf(
Expand Down

0 comments on commit 7a512d8

Please sign in to comment.