Skip to content

Commit

Permalink
Camptix Invoices: Use camptix's get_options() & default option filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
dd32 authored Oct 15, 2024
1 parent 6e43ced commit d3af368
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ function register_tix_invoice() {
);
}

/**
* Define the default values for options.
*/
function ctx_default_options( $options ) {
$options['invoice-vat-number'] = '';

return $options;
}
add_filter( 'camptix_default_options', 'ctx_default_options' );

/**
* Register invoice CPT custom update messages.
*/
Expand Down Expand Up @@ -254,10 +264,11 @@ function ctx_register_invoice_metabox( $post ) {
* @param object $args The args.
*/
function ctx_invoice_metabox_editable( $args ) {
global $camptix;

$order = get_post_meta( $args->ID, 'original_order', true );
$metas = get_post_meta( $args->ID, 'invoice_metas', true );
$opt = get_option( 'camptix_options' );
$opt = $camptix->get_options();
$invoice_vat_number = $opt['invoice-vat-number'] ?? '';

if ( ! is_array( $order ) ) {
Expand All @@ -282,10 +293,11 @@ function ctx_invoice_metabox_editable( $args ) {
* @param object $args The args.
*/
function ctx_invoice_metabox_sent( $args ) {
global $camptix;

$order = get_post_meta( $args->ID, 'original_order', true );
$metas = get_post_meta( $args->ID, 'invoice_metas', true );
$opt = get_option( 'camptix_options' );
$opt = $camptix->get_options();
$invoice_vat_number = $opt['invoice-vat-number'] ?? '';
$txn_id = $metas['transaction_id'] ?? '';

Expand Down

0 comments on commit d3af368

Please sign in to comment.