Skip to content

Commit

Permalink
Merge branch 'main' into improved-header-logo-loading
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmigf committed Jun 24, 2024
2 parents a17bf61 + 188a060 commit caa6328
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions includes/class-wcpdf-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ public function __construct() {
add_action( 'wpo_wcpdf_save_document', array( $this, 'wc_webhook_trigger' ), 10, 2 );

add_action( 'wpo_wcpdf_after_order_data', array( $this, 'display_due_date' ), 10, 2 );

add_action( 'wpo_wcpdf_delete_document', array( $this, 'log_document_deletion_to_order_notes' ) );
}

/**
Expand Down Expand Up @@ -1314,6 +1316,22 @@ public function log_document_creation_to_order_notes( $document, $trigger ) {
}
}

/**
* Log document deletion to order notes.
*
* @param object $document
*
* @return void
*/
public function log_document_deletion_to_order_notes( object $document ): void {
if ( ! empty( WPO_WCPDF()->settings->debug_settings['log_to_order_notes'] ) ) {
/* translators: document title */
$message = __( 'PDF %s deleted.', 'woocommerce-pdf-invoices-packing-slips' );
$note = sprintf( $message, $document->get_title() );
$this->log_to_order_notes( $note, $document );
}
}

/**
* Log document printed to order notes
*
Expand Down
2 changes: 1 addition & 1 deletion includes/settings/class-wcpdf-settings-debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ public function init_settings() {
'args' => array(
'option_name' => $option_name,
'id' => 'log_to_order_notes',
'description' => __( 'Log PDF document creation and mark/unmark as printed to order notes.', 'woocommerce-pdf-invoices-packing-slips' ),
'description' => __( 'Log PDF document creation, deletion, and mark/unmark as printed to order notes.', 'woocommerce-pdf-invoices-packing-slips' ),
)
),
array(
Expand Down

0 comments on commit caa6328

Please sign in to comment.