Skip to content

Commit

Permalink
Merge branch 'main' into psr4-strauss-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmigf committed Oct 7, 2024
2 parents 0788e88 + 6d9575d commit a3bff36
Show file tree
Hide file tree
Showing 18 changed files with 1,167 additions and 601 deletions.
5 changes: 5 additions & 0 deletions assets/images/generic_document.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/js/admin-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jQuery( function( $ ) {
'delay': 200
} );

$( '#wpo-wcpdf-preview-wrapper #due_date' ).change( function() {
$( '#wpo-wcpdf-preview-wrapper #due_date' ).on( 'change', function() {
const $due_date_checkbox = $( '#wpo-wcpdf-preview-wrapper #due_date' );
const $due_date_days_input = $( '#wpo-wcpdf-preview-wrapper #due_date_days' );

Expand Down
2 changes: 1 addition & 1 deletion assets/js/admin-script.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion includes/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public function add_listing_actions( $order ) {
foreach ( $documents as $document ) {
$document_title = $document->get_title();
$document_type = $document->get_type();
$icon = ! empty( $document->icon ) ? $document->icon : WPO_WCPDF()->plugin_url() . "/assets/images/generic_document.png";
$icon = ! empty( $document->icon ) ? $document->icon : WPO_WCPDF()->plugin_url() . '/assets/images/generic_document.svg';

if ( $document = wcpdf_get_document( $document_type, $order ) ) {
foreach ( $document->output_formats as $output_format ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/Documents/BulkDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function __construct( $document_type, $order_ids = array() ) {
$this->is_bulk = true;

// output formats (placed after parent construct to override the abstract default)
$this->output_formats = apply_filters( "wpo_wcpdf_{$this->slug}_output_formats", array( 'pdf' ), $this );
$this->output_formats = apply_filters( 'wpo_wcpdf_document_output_formats', array( 'pdf' ), $this );
}

public function exists() {
Expand Down
60 changes: 37 additions & 23 deletions includes/Documents/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@

class Invoice extends OrderDocumentMethods {

public $type;
public $title;
public $icon;
public $output_formats;

/**
* Init/load the order object.
*
Expand All @@ -33,7 +28,7 @@ public function __construct( $order = 0 ) {
parent::__construct( $order );

// output formats (placed after parent construct to override the abstract default)
$this->output_formats = apply_filters( "wpo_wcpdf_{$this->slug}_output_formats", array( 'pdf', 'ubl' ), $this );
$this->output_formats = apply_filters( 'wpo_wcpdf_document_output_formats', array( 'pdf', 'ubl' ), $this );
}

public function use_historical_settings() {
Expand All @@ -51,9 +46,44 @@ public function storing_settings_enabled() {
return apply_filters( 'wpo_wcpdf_document_store_settings', true, $this );
}

/**
* Get the document title
*
* @return string
*/
public function get_title() {
// override/not using $this->title to allow for language switching!
return apply_filters( "wpo_wcpdf_{$this->slug}_title", __( 'Invoice', 'woocommerce-pdf-invoices-packing-slips' ), $this );
return apply_filters( 'wpo_wcpdf_document_title', __( 'Invoice', 'woocommerce-pdf-invoices-packing-slips' ), $this );
}

/**
* Get the document number title
*
* @return string
*/
public function get_number_title() {
// override to allow for language switching!
return apply_filters( 'wpo_wcpdf_document_number_title', __( 'Invoice Number:', 'woocommerce-pdf-invoices-packing-slips' ), $this );
}

/**
* Get the document date title
*
* @return string
*/
public function get_date_title() {
// override to allow for language switching!
return apply_filters( 'wpo_wcpdf_document_date_title', __( 'Invoice Date:', 'woocommerce-pdf-invoices-packing-slips' ), $this );
}

/**
* Get the shipping address title
*
* @return string
*/
public function get_shipping_address_title(): string {
// override to allow for language switching!
return apply_filters( 'wpo_wcpdf_document_shipping_address_title', __( 'Ship To:', 'woocommerce-pdf-invoices-packing-slips' ), $this );
}

public function init() {
Expand Down Expand Up @@ -583,22 +613,6 @@ public function get_ubl_settings_fields( $option_name ) {
return apply_filters( "wpo_wcpdf_{$this->type}_ubl_settings_fields", $settings_fields, $option_name, $this );
}

/**
* 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
Loading

0 comments on commit a3bff36

Please sign in to comment.