s-packing-slips' ),
'callback' => 'checkbox',
'section' => 'invoice',
'args' => array(
'option_name' => $option_name,
'id' => 'reset_number_yearly',
)
),
array(
'type' => 'setting',
'id' => 'log_number_generation',
'title' => __( 'Log invoice number generation', 'woocommerce-pdf-invoices-packing-slips' ),
'callback' => 'checkbox',
'section' => 'invoice',
'args' => array(
'option_name' => $option_name,
'id' => 'log_number_generation',
'description' => sprintf(
/* translators: here link */
__( 'Enables the invoice number generation logs %s. Helpful for debugging numbering issues.', 'woocommerce-pdf-invoices-packing-slips' ),
''.__( 'here', 'woocommerce-pdf-invoices-packing-slips' ).''
),
)
),
array(
'type' => 'setting',
'id' => 'my_account_buttons',
'title' => __( 'Allow My Account invoice download', 'woocommerce-pdf-invoices-packing-slips' ),
'callback' => 'select',
'section' => 'invoice',
'args' => array(
'option_name' => $option_name,
'id' => 'my_account_buttons',
'options' => array(
'available' => __( 'Only when an invoice is already created/emailed' , 'woocommerce-pdf-invoices-packing-slips' ),
'custom' => __( 'Only for specific order statuses (define below)' , 'woocommerce-pdf-invoices-packing-slips' ),
'always' => __( 'Always' , 'woocommerce-pdf-invoices-packing-slips' ),
'never' => __( 'Never' , 'woocommerce-pdf-invoices-packing-slips' ),
),
'custom' => array(
'type' => 'multiple_checkboxes',
'args' => array(
'option_name' => $option_name,
'id' => 'my_account_restrict',
'fields_callback' => array( $this, 'get_wc_order_status_list' ),
),
),
)
),
array(
'type' => 'setting',
'id' => 'invoice_number_column',
'title' => __( 'Enable invoice number column in the orders list', 'woocommerce-pdf-invoices-packing-slips' ),
'callback' => 'checkbox',
'section' => 'invoice',
'args' => array(
'option_name' => $option_name,
'id' => 'invoice_number_column',
)
),
array(
'type' => 'setting',
'id' => 'invoice_date_column',
'title' => __( 'Enable invoice date column in the orders list', 'woocommerce-pdf-invoices-packing-slips' ),
'callback' => 'checkbox',
'section' => 'invoice',
'args' => array(
'option_name' => $option_name,
'id' => 'invoice_date_column',
)
),
array(
'type' => 'setting',
'id' => 'invoice_number_search',
'title' => __( 'Enable invoice number search in the orders list', 'woocommerce-pdf-invoices-packing-slips' ),
'callback' => 'checkbox',
'section' => 'invoice',
'args' => array(
'option_name' => $option_name,
'id' => 'invoice_number_search',
'description' => __( 'Can potentially slow down the search process.', 'woocommerce-pdf-invoices-packing-slips' ),
)
),
array(
'type' => 'setting',
'id' => 'disable_free',
'title' => __( 'Disable for free orders', 'woocommerce-pdf-invoices-packing-slips' ),
'callback' => 'checkbox',
'section' => 'invoice',
'args' => array(
'option_name' => $option_name,
'id' => 'disable_free',
/* translators: zero number */
'description' => sprintf(__( "Disable document when the order total is %s", 'woocommerce-pdf-invoices-packing-slips' ), function_exists('wc_price') ? wc_price( 0 ) : 0 ),
)
),
array(
'type' => 'setting',
'id' => 'mark_printed',
'title' => __( 'Mark as printed', 'woocommerce-pdf-invoices-packing-slips' ),
'callback' => 'select',
'section' => 'invoice',
'args' => array(
'option_name' => $option_name,
'id' => 'mark_printed',
'options' => array_merge(
[
'manually' => __( 'Manually', 'woocommerce-pdf-invoices-packing-slips' ),
],
apply_filters( 'wpo_wcpdf_document_triggers', [
'single' => __( 'On single order action', 'woocommerce-pdf-invoices-packing-slips' ),
'bulk' => __( 'On bulk order action', 'woocommerce-pdf-invoices-packing-slips' ),
'my_account' => __( 'On my account', 'woocommerce-pdf-invoices-packing-slips' ),
'email_attachment' => __( 'On email attachment', 'woocommerce-pdf-invoices-packing-slips' ),
'document_data' => __( 'On order document data (number and/or date set manually)', 'woocommerce-pdf-invoices-packing-slips' ),
] )
),
'multiple' => true,
'enhanced_select' => true,
'description' => __( 'Allows you to mark the document as printed, manually (in the order page) or automatically (based on the document creation context you have selected).', 'woocommerce-pdf-invoices-packing-slips' ),
)
),
array(
'type' => 'setting',
'id' => 'unmark_printed',
'title' => __( 'Unmark as printed', 'woocommerce-pdf-invoices-packing-slips' ),
'callback' => 'checkbox',
'section' => 'invoice',
'args' => array(
'option_name' => $option_name,
'id' => 'unmark_printed',
'description' => __( 'Adds a link in the order page to allow to remove the printed mark.', 'woocommerce-pdf-invoices-packing-slips' ),
)
),
array(
'type' => 'setting',
'id' => 'use_latest_settings',
'title' => __( 'Always use most current settings', 'woocommerce-pdf-invoices-packing-slips' ),
'callback' => 'checkbox',
'section' => 'invoice',
'args' => array(
'option_name' => $option_name,
'id' => 'use_latest_settings',
'description' => __( "When enabled, the document will always reflect the most current settings (such as footer text, document name, etc.) rather than using historical settings.", 'woocommerce-pdf-invoices-packing-slips' )
. "
"
. __( "Caution: enabling this will also mean that if you change your company name or address in the future, previously generated documents will also be affected.", 'woocommerce-pdf-invoices-packing-slips' ),
)
),
);
// remove/rename some fields when invoice number is controlled externally
if( apply_filters('woocommerce_invoice_number_by_plugin', false) ) {
$remove_settings = array( 'next_invoice_number', 'number_format', 'reset_number_yearly' );
foreach ($settings_fields as $key => $settings_field) {
if (in_array($settings_field['id'], $remove_settings)) {
unset($settings_fields[$key]);
} elseif ( $settings_field['id'] == 'display_number' ) {
// alternate description for invoice number
$invoice_number_desc = __( 'Invoice numbers are created by a third-party extension.', 'woocommerce-pdf-invoices-packing-slips' );
if ( $config_link = apply_filters( 'woocommerce_invoice_number_configuration_link', null ) ) {
/* translators: link */
$invoice_number_desc .= ' '.sprintf(__( 'Configure it here.', 'woocommerce-pdf-invoices-packing-slips' ), esc_attr( $config_link ) );
}
$settings_fields[$key]['args']['description'] = ''.$invoice_number_desc.'';
}
}
}
// allow plugins to alter settings fields
$settings_fields = apply_filters( 'wpo_wcpdf_settings_fields_documents_invoice', $settings_fields, $page, $option_group, $option_name );
WPO_WCPDF()->settings->add_settings_fields( $settings_fields, $page, $option_group, $option_name );
return;
}
/**
* Document number title
*/
public function get_number_title() {
$number_title = __( 'Invoice Number:', 'woocommerce-pdf-invoices-packing-slips' );
return apply_filters( "wpo_wcpdf_{$this->slug}_number_title", $number_title, $this );
}
/**
* Document date title
*/
public function get_date_title() {
$date_title = __( 'Invoice Date:', 'woocommerce-pdf-invoices-packing-slips' );
return apply_filters( "wpo_wcpdf_{$this->slug}_date_title", $date_title, $this );
}
}
endif; // class_exists