Skip to content

Commit

Permalink
Remove the "custom days"
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamadNateqi committed Nov 8, 2023
1 parent 76909a6 commit 8166085
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 32 deletions.
15 changes: 0 additions & 15 deletions assets/js/admin-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,6 @@ jQuery( function( $ ) {
'delay': 200
} );

function toggle_due_date_custom_days_field() {
const due_date_value = $( '#due_date' ).val();
const due_date_custom_days = $( '#due_date_custom_days' );

if ( 'custom' === due_date_value ) {
due_date_custom_days.closest( 'tr' ).show();
} else {
due_date_custom_days.closest( 'tr' ).hide();
}
}

toggle_due_date_custom_days_field();

$( '#due_date' ).change( toggle_due_date_custom_days_field );

//----------> Preview <----------//
// objects
let $previewWrapper = $( '#wpo-wcpdf-preview-wrapper' );
Expand Down
5 changes: 2 additions & 3 deletions includes/documents/abstract-wcpdf-order-document.php
Original file line number Diff line number Diff line change
Expand Up @@ -1379,10 +1379,9 @@ public function get_due_date(): int {
return 0;
}

$due_date_days = ( 'custom' === $this->settings['due_date'] ) ? intval( $this->settings['due_date_custom_days'] ?? 0 ) : absint( $this->settings['due_date'] );
$due_date_days = apply_filters( "wpo_wcpdf_due_date_days", $due_date_days, $this->type, $this );
$due_date_days = apply_filters( "wpo_wcpdf_due_date_days", $this->settings['due_date'], $this->type, $this );

if ( 0 >= $due_date_days ) {
if ( 0 >= intval( $due_date_days ) ) {
return 0;
}

Expand Down
14 changes: 0 additions & 14 deletions includes/documents/class-wcpdf-invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,24 +345,10 @@ public function get_pdf_settings_fields( $option_name ) {
'1' => __( '1 day', 'wpo_wcpdf_pro' ),
'7' => __( '7 days', 'wpo_wcpdf_pro' ),
'30' => __( '30 days', 'wpo_wcpdf_pro' ),
'custom' => __( 'Custom days', 'wpo_wcpdf_pro' ),
) ),
'description' => __( 'Displays a due date below the order data.', 'woocommerce-pdf-invoices-packing-slips' ),
)
),
array(
'type' => 'setting',
'id' => 'due_date_custom_days',
'title' => __( 'Custom due date (days)', 'woocommerce-pdf-invoices-packing-slips' ),
'callback' => 'text_input',
'section' => $this->type,
'args' => array(
'option_name' => $option_name,
'id' => 'due_date_custom_days',
'type' => 'number',
'description' => __( 'Enter the number of days for the due date.', 'woocommerce-pdf-invoices-packing-slips' ),
)
),
array(
'type' => 'setting',
'id' => 'display_number',
Expand Down

0 comments on commit 8166085

Please sign in to comment.