Plugin Directory

Changeset 3409791


Ignore:
Timestamp:
12/03/2025 03:58:14 PM (4 months ago)
Author:
Picaland
Message:

Fix: PMPro - save invoice number from admin

Location:
woopop-electronic-invoice-free/trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • woopop-electronic-invoice-free/trunk/addon/for/cozmos/vendor/composer/installed.php

    r3409599 r3409791  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '7f84459ecbc93c26d19b6b9575450679a754fe01',
     6        'reference' => '24217cb937bdae265d5af7ba50ab51eeb25a9b22',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '7f84459ecbc93c26d19b6b9575450679a754fe01',
     16            'reference' => '24217cb937bdae265d5af7ba50ab51eeb25a9b22',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • woopop-electronic-invoice-free/trunk/addon/for/pmpro/inc/filtersAdmin.php

    r3409381 r3409791  
    174174                'accepted_args' => 1,
    175175            ),
     176
     177            /**
     178             * Allow updating the invoice number from the admin order edit screen.
     179             */
     180            array(
     181                'filter'   => 'pmpro_updated_order',
     182                'callback' => function ( \MemberOrder $order ) {
     183                    if ( ! is_admin() ) {
     184                        return;
     185                    }
     186
     187                    static $processing = false;
     188                    if ( $processing ) {
     189                        return;
     190                    }
     191                    $processing = true;
     192
     193                    // Skip cron/ajax/rest contexts entirely.
     194                    if ( ( function_exists( 'wp_doing_ajax' ) && wp_doing_ajax() )
     195                         || ( defined( 'DOING_CRON' ) && DOING_CRON )
     196                         || ( defined( 'REST_REQUEST' ) && REST_REQUEST )
     197                    ) {
     198                        $processing = false;
     199                        return;
     200                    }
     201
     202                    // Bail if we are not on the PMPro single order edit/save action.
     203                    $requestPage  = isset( $_REQUEST['page'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ) : '';
     204                    $requestNonce = isset( $_REQUEST['pmpro_orders_nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['pmpro_orders_nonce'] ) ) : '';
     205                    // PMPro sometimes uses `id`, sometimes `order`.
     206                    $requestOrderId = isset( $_REQUEST['id'] ) ? absint( wp_unslash( $_REQUEST['id'] ) ) : 0;
     207                    if ( ! $requestOrderId && isset( $_REQUEST['order'] ) ) {
     208                        $requestOrderId = absint( wp_unslash( $_REQUEST['order'] ) );
     209                    }
     210                    if ( ! $requestOrderId && isset( $_REQUEST['_wp_http_referer'] ) ) {
     211                        $refererQuery = wp_parse_url( wp_unslash( $_REQUEST['_wp_http_referer'] ), PHP_URL_QUERY );
     212                        parse_str( (string) $refererQuery, $refererParams );
     213                        if ( isset( $refererParams['order'] ) ) {
     214                            $requestOrderId = absint( $refererParams['order'] );
     215                        } elseif ( isset( $refererParams['id'] ) ) {
     216                            $requestOrderId = absint( $refererParams['id'] );
     217                        }
     218                        if ( ! $requestPage && isset( $refererParams['page'] ) ) {
     219                            $requestPage = sanitize_text_field( $refererParams['page'] );
     220                        }
     221                    }
     222
     223                    // Nonce present but no page param? Assume pmpro-orders only if referer contains it.
     224                    if ( ! $requestPage && $requestNonce && ! empty( $refererParams['page'] ) && 'pmpro-orders' === $refererParams['page'] ) {
     225                        $requestPage = 'pmpro-orders';
     226                    }
     227
     228                    // Fallback to screen check if page param missing.
     229                    if ( ! $requestPage && function_exists( 'get_current_screen' ) ) {
     230                        $currentScreen = get_current_screen();
     231                        if ( $currentScreen && false !== strpos( $currentScreen->id, 'pmpro-orders' ) ) {
     232                            $requestPage = 'pmpro-orders';
     233                        }
     234                    }
     235
     236                    $isOrderEditPage = ( 'pmpro-orders' === $requestPage ) && $requestOrderId === (int) $order->id;
     237                    $nonceIsValid    = $requestNonce && wp_verify_nonce( $requestNonce, 'save' );
     238                    $isSavingAction  = $nonceIsValid;
     239
     240                    if ( ! $isOrderEditPage || ! $isSavingAction ) {
     241                        $processing = false;
     242                        return;
     243                    }
     244
     245                    $orderProvider = \WcElectronInvoice\Providers\OrderQuery::instance()->getProviderOrder( $order->id, 'pmpro' );
     246                    if ( ! ( $orderProvider instanceof POPxPMPro\Providers\Order ) ) {
     247                        $processing = false;
     248                        return;
     249                    }
     250
     251                    $newInvoiceNumber = isset( $_POST['order_number_invoice'] ) ? sanitize_text_field( wp_unslash( $_POST['order_number_invoice'] ) ) : '';
     252                    if ( '' === $newInvoiceNumber ) {
     253                        $processing = false;
     254                        return;
     255                    }
     256
     257                    try {
     258                        $numerationType = $orderProvider->get_billing_choice_type() ?: 'invoice';
     259                        $orderProvider->update_meta( 'order_number_invoice', $newInvoiceNumber );
     260                        \WcElectronInvoice\Functions\setFormattedInvoiceNumber( $orderProvider, $numerationType );
     261                    } finally {
     262                        $processing = false;
     263                    }
     264                },
     265                'priority' => 90,
     266            ),
    176267        ),
    177268        'filter' => array(
  • woopop-electronic-invoice-free/trunk/addon/for/pmpro/inc/filtersAlways.php

    r3409381 r3409791  
    8484                'priority' => 100,
    8585            ),
    86 
    87             /**
    88              * Allow updating the invoice number from the admin order edit screen.
    89              */
    90             array(
    91                 'filter'   => 'pmpro_updated_order',
    92                 'callback' => function ( \MemberOrder $order ) {
    93                     if ( ! is_admin() ) {
    94                         return;
    95                     }
    96 
    97                     static $processing = false;
    98                     if ( $processing ) {
    99                         return;
    100                     }
    101                     $processing = true;
    102 
    103                     // Skip cron/ajax/rest contexts entirely.
    104                     if ( ( function_exists( 'wp_doing_ajax' ) && wp_doing_ajax() )
    105                         || ( defined( 'DOING_CRON' ) && DOING_CRON )
    106                         || ( defined( 'REST_REQUEST' ) && REST_REQUEST )
    107                     ) {
    108                         $processing = false;
    109                         return;
    110                     }
    111 
    112                     // Bail if we are not on the PMPro single order edit/save action.
    113                     $requestPage  = isset( $_REQUEST['page'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ) : '';
    114                     $requestNonce = isset( $_REQUEST['pmpro_orders_nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['pmpro_orders_nonce'] ) ) : '';
    115                     // PMPro sometimes uses `id`, sometimes `order`.
    116                     $requestOrderId = isset( $_REQUEST['id'] ) ? absint( wp_unslash( $_REQUEST['id'] ) ) : 0;
    117                     if ( ! $requestOrderId && isset( $_REQUEST['order'] ) ) {
    118                         $requestOrderId = absint( wp_unslash( $_REQUEST['order'] ) );
    119                     }
    120                     if ( ! $requestOrderId && isset( $_REQUEST['_wp_http_referer'] ) ) {
    121                         $refererQuery = wp_parse_url( wp_unslash( $_REQUEST['_wp_http_referer'] ), PHP_URL_QUERY );
    122                         parse_str( (string) $refererQuery, $refererParams );
    123                         if ( isset( $refererParams['order'] ) ) {
    124                             $requestOrderId = absint( $refererParams['order'] );
    125                         } elseif ( isset( $refererParams['id'] ) ) {
    126                             $requestOrderId = absint( $refererParams['id'] );
    127                         }
    128                         if ( ! $requestPage && isset( $refererParams['page'] ) ) {
    129                             $requestPage = sanitize_text_field( $refererParams['page'] );
    130                         }
    131                     }
    132 
    133                     // Nonce present but no page param? Assume pmpro-orders only if referer contains it.
    134                     if ( ! $requestPage && $requestNonce && ! empty( $refererParams['page'] ) && 'pmpro-orders' === $refererParams['page'] ) {
    135                         $requestPage = 'pmpro-orders';
    136                     }
    137 
    138                     // Fallback to screen check if page param missing.
    139                     if ( ! $requestPage && function_exists( 'get_current_screen' ) ) {
    140                         $currentScreen = get_current_screen();
    141                         if ( $currentScreen && false !== strpos( $currentScreen->id, 'pmpro-orders' ) ) {
    142                             $requestPage = 'pmpro-orders';
    143                         }
    144                     }
    145 
    146                     $isOrderEditPage = ( 'pmpro-orders' === $requestPage ) && $requestOrderId === (int) $order->id;
    147                     $nonceIsValid    = $requestNonce && wp_verify_nonce( $requestNonce, 'save_order' );
    148                     $isSavingAction  = $nonceIsValid;
    149 
    150                     if ( ! $isOrderEditPage || ! $isSavingAction ) {
    151                         $processing = false;
    152                         return;
    153                     }
    154 
    155                     $orderProvider = \WcElectronInvoice\Providers\OrderQuery::instance()->getProviderOrder( $order->id, 'pmpro' );
    156                     if ( ! ( $orderProvider instanceof POPxPMPro\Providers\Order ) ) {
    157                         $processing = false;
    158                         return;
    159                     }
    160 
    161                     $newInvoiceNumber = isset( $_POST['order_number_invoice'] ) ? sanitize_text_field( wp_unslash( $_POST['order_number_invoice'] ) ) : '';
    162                     if ( '' === $newInvoiceNumber ) {
    163                         $processing = false;
    164                         return;
    165                     }
    166 
    167                     try {
    168                         $numerationType = $orderProvider->get_billing_choice_type() ?: 'invoice';
    169                         $orderProvider->update_meta( 'order_number_invoice', $newInvoiceNumber );
    170                         \WcElectronInvoice\Functions\setFormattedInvoiceNumber( $orderProvider, $numerationType );
    171                     } finally {
    172                         $processing = false;
    173                     }
    174                 },
    175                 'priority' => 90,
    176             ),
    17786        ),
    17887        'filter' => array()
  • woopop-electronic-invoice-free/trunk/addon/for/pmpro/vendor/composer/installed.php

    r3409599 r3409791  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '7f84459ecbc93c26d19b6b9575450679a754fe01',
     6        'reference' => '24217cb937bdae265d5af7ba50ab51eeb25a9b22',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '7f84459ecbc93c26d19b6b9575450679a754fe01',
     16            'reference' => '24217cb937bdae265d5af7ba50ab51eeb25a9b22',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • woopop-electronic-invoice-free/trunk/addon/to/aruba/vendor/composer/installed.php

    r3409599 r3409791  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '7f84459ecbc93c26d19b6b9575450679a754fe01',
     6        'reference' => '24217cb937bdae265d5af7ba50ab51eeb25a9b22',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '7f84459ecbc93c26d19b6b9575450679a754fe01',
     16            'reference' => '24217cb937bdae265d5af7ba50ab51eeb25a9b22',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • woopop-electronic-invoice-free/trunk/addon/to/fattureincloud-stock/vendor/composer/installed.php

    r3409599 r3409791  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '7f84459ecbc93c26d19b6b9575450679a754fe01',
     6        'reference' => '24217cb937bdae265d5af7ba50ab51eeb25a9b22',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '7f84459ecbc93c26d19b6b9575450679a754fe01',
     16            'reference' => '24217cb937bdae265d5af7ba50ab51eeb25a9b22',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • woopop-electronic-invoice-free/trunk/addon/to/fattureincloud/vendor/composer/installed.php

    r3409599 r3409791  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '7f84459ecbc93c26d19b6b9575450679a754fe01',
     6        'reference' => '24217cb937bdae265d5af7ba50ab51eeb25a9b22',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '7f84459ecbc93c26d19b6b9575450679a754fe01',
     16            'reference' => '24217cb937bdae265d5af7ba50ab51eeb25a9b22',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • woopop-electronic-invoice-free/trunk/addon/to/sdi-pec/vendor/composer/installed.php

    r3409599 r3409791  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '7f84459ecbc93c26d19b6b9575450679a754fe01',
     6        'reference' => '24217cb937bdae265d5af7ba50ab51eeb25a9b22',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '7f84459ecbc93c26d19b6b9575450679a754fe01',
     16            'reference' => '24217cb937bdae265d5af7ba50ab51eeb25a9b22',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • woopop-electronic-invoice-free/trunk/changelog.txt

    r3409579 r3409791  
     1= 6.5.5 - 03/12/2025 =
     2Fixed: PMPro - save invoice number from admin
     3
    14= 6.5.4 - 03/12/2025 =
    25Fixed: vendor error
  • woopop-electronic-invoice-free/trunk/index.php

    r3409579 r3409791  
    77 * Description: POP automatically configures your e-commerce to comply with European tax regulations. Your e-commerce can generate electronic invoices in XML format and, thanks to our APIs, automatically transmit them to your accounting software and tax authorities.
    88 *
    9  * Version: 6.5.4
     9 * Version: 6.5.5
    1010 * Author: POP
    1111 * Author URI: https://popapi.io/
     
    5252define('WC_EL_INV_NAME', 'POP Electronic Invoice');
    5353define('WC_EL_INV_TEXTDOMAIN', 'el-inv');
    54 define('WC_EL_INV_VERSION', '6.5.4');
     54define('WC_EL_INV_VERSION', '6.5.5');
    5555define('WC_EL_INV_VERSION_CLASS', str_replace('.', '_', WC_EL_INV_VERSION));
    5656define('WC_EL_INV_PLUGIN_DIR', basename(plugin_dir_path(__FILE__)));
  • woopop-electronic-invoice-free/trunk/readme.md

    r3409579 r3409791  
    44* **Requires at least:** 4.6
    55* **Tested up to:** 6.9
    6 * **Stable tag:** 6.5.4
     6* **Stable tag:** 6.5.5
    77* **Requires PHP:** 5.6
    88* **License:** GPLv2 or later
     
    140140## Changelog
    141141== Changelog ==
     142= 6.5.4 - 03/12/2025 =
     143* Fix: PMPro - save invoice number from admin
     144
    142145= 6.5.4 - 03/12/2025 =
    143146* Fix: vendor error
  • woopop-electronic-invoice-free/trunk/readme.txt

    r3409579 r3409791  
    44Requires at least: 4.6
    55Tested up to: 6.9
    6 Stable tag: 6.5.4
     6Stable tag: 6.5.5
    77Requires PHP: 5.6
    88License: GPLv2 or later
     
    120120
    121121== Changelog ==
     122= 6.5.4 - 03/12/2025 =
     123* Fix: PMPro - save invoice number from admin
     124
    122125= 6.5.4 - 03/12/2025 =
    123126* Fix: vendor error
  • woopop-electronic-invoice-free/trunk/vendor/composer/installed.php

    r3409599 r3409791  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '7f84459ecbc93c26d19b6b9575450679a754fe01',
     6        'reference' => '24217cb937bdae265d5af7ba50ab51eeb25a9b22',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '7f84459ecbc93c26d19b6b9575450679a754fe01',
     16            'reference' => '24217cb937bdae265d5af7ba50ab51eeb25a9b22',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.