Plugin Directory

Changeset 3481120


Ignore:
Timestamp:
03/12/2026 11:49:10 AM (2 weeks ago)
Author:
nakedcatplugins
Message:

Update to version 8.0 from GitHub

Location:
woo-billing-with-invoicexpress
Files:
72 edited
1 copied

Legend:

Unmodified
Added
Removed
  • woo-billing-with-invoicexpress/tags/8.0/assets/images/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/tags/8.0/assets/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/tags/8.0/assets/js/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/tags/8.0/includes/BaseController.php

    r3369891 r3481120  
    44
    55use Webdados\InvoiceXpressWooCommerce\JsonRequest as JsonRequest;
    6 
    7 /* WooCommerce CRUD ready */
    8 /* JSON API ready */
    9 /* WooCommerce HPOS ready 2023-07-13 */
     6use Webdados\InvoiceXpressWooCommerce\Modules\Vat\VatController as VatController;
    107
    118class BaseController {
     
    300297     *
    301298     * @since 2.1.7
    302      * @param array $invoice_data The invoice data
     299     * @param array  $invoice_data The invoice data
    303300     * @param object $order_object The order
    304301     * @param string $document_type The document type
    305302     */
    306303    public function process_items( $invoice_data, $order_object, $document_type ) {
    307         //Each item
     304        // Each item
    308305        foreach ( $invoice_data['items'] as $key => $item ) {
    309             //Negative values?
     306            // Negative values?
    310307            if (
    311308                $item['unit_price'] < 0
    312309                ||
    313                 ( $item['ixwc']['unit_price'] < 0 && $document_type != 'credit_note' ) //We'll allow on credit notes for now
     310                ( $item['ixwc']['unit_price'] < 0 && $document_type != 'credit_note' ) // We'll allow on credit notes for now
    314311            ) {
    315312                $invoice_data['_prevent']         = true;
    316313                $invoice_data['_prevent_message'] = __( 'InvoiceXpress does not support, and it is not legal, to issue documents with negative items', 'woo-billing-with-invoicexpress' );
    317                 //We can get out now
     314                // We can get out now
    318315                return $invoice_data;
    319316            }
    320             //Partial exemption - WHY? Who's using this?
     317            // Partial exemption - WHY? Who's using this?
    321318            if ( isset( $item['ixwc']['type'] ) ) {
    322                 //Set partial exemption if global exemption is not set - Really? http://contabilistas.info/index.php?topic=8818.0
     319                // Set partial exemption if global exemption is not set - Really? http://contabilistas.info/index.php?topic=8818.0
    323320                if ( empty( $invoice_data['tax_exemption'] ) && apply_filters( 'invoicexpress_woocommerce_partial_exemption', false ) ) {
    324                     switch( $item['ixwc']['type'] ) {
     321                    switch ( $item['ixwc']['type'] ) {
    325322                        case 'item':
    326323                        case 'shipping':
    327324                        case 'fee':
    328325                            if ( isset( $item['tax']['name'] ) && trim( $item['tax']['name'] ) != '' && trim( $item['tax']['name'] ) === get_option( 'hd_wc_ie_plus_exemption_name' ) ) {
    329                                 $exemption = get_option( 'hd_wc_ie_plus_exemption_reason' );
     326                                $exemption                     = get_option( 'hd_wc_ie_plus_exemption_reason' );
    330327                                $invoice_data['tax_exemption'] = apply_filters( 'invoicexpress_woocommerce_partial_exemption_reason', $exemption, $item, $invoice_data, $order_object->get_id(), $document_type );
    331328                                do_action( 'invoicexpress_woocommerce_partial_exemption_applied', $item, $invoice_data, $order_object->get_id(), $document_type );
    332                                 do_action( 'invoicexpress_woocommerce_debug', 'process_items '.$document_type.' set partial exemption ' . $exemption, $order_object );
    333                                 break; //No need to keep going because we can only set one exemption reason per document (Maybe InvoiceXpress should look into that...)
     329                                do_action( 'invoicexpress_woocommerce_debug', 'process_items ' . $document_type . ' set partial exemption ' . $exemption, $order_object );
     330                                break; // No need to keep going because we can only set one exemption reason per document (Maybe InvoiceXpress should look into that...)
    334331                            }
    335332                            break;
     
    338335                    }
    339336                }
    340                 //Other stuff??
    341                 //...
    342             }
    343         }
    344         //Clear our extra information
     337                // Other stuff??
     338                // ...
     339            }
     340        }
     341        // Clear our extra information
    345342        foreach ( $invoice_data['items'] as $key => $item ) {
    346             //Important: Clear our data or InvoiceXpress will throw an error
    347             if ( isset( $item['ixwc'] ) ) unset( $invoice_data['items'][$key]['ixwc'] );
    348         }
    349         //Remove eventual HTML on titles and replace some problematic caracters
    350         $search = array(
     343            // Important: Clear our data or InvoiceXpress will throw an error
     344            if ( isset( $item['ixwc'] ) ) {
     345                unset( $invoice_data['items'][ $key ]['ixwc'] );
     346            }
     347        }
     348        // Remove eventual HTML on titles and replace some problematic caracters
     349        $search  = array(
    351350            '&euro;',
    352351            '&nbsp;',
     
    361360            $invoice_data['items'][ $key ]['description'] = trim( str_replace( $search, $replace, wp_strip_all_tags( $item['description'] ) ) );
    362361        }
    363         //Clear observations if empty - NO https://3.basecamp.com/3078239/buckets/20370269/messages/6022419606#__recording_6031501959
    364         //if ( isset( $invoice_data['observations'] ) ) {
    365         //  $invoice_data['observations'] = trim( $invoice_data['observations'] );
    366         //  if ( empty( $invoice_data['observations'] ) ) {
    367         //      unset( $invoice_data['observations'] );
    368         //  }
    369         //}
     362        // Fix observations
     363        if ( isset( $invoice_data['observations'] ) ) {
     364            $invoice_data['observations'] = trim( preg_replace( '/\s+/', ' ', $invoice_data['observations'] ) );
     365        } else {
     366            $invoice_data['observations'] = '';
     367        }
     368        // Set exemption on the observations
     369        if ( isset( $invoice_data['tax_exemption'] ) && ! empty( $invoice_data['tax_exemption'] ) ) {
     370            $exemption_reasons = VatController::get_exemption_reasons();
     371            if ( ! empty( $invoice_data['observations'] ) ) {
     372                $invoice_data['observations'] .= '
     373';
     374            }
     375            $invoice_data['observations'] .= $exemption_reasons[ $invoice_data['tax_exemption'] ];
     376        }
     377        // Return
    370378        return $invoice_data;
    371379    }
     
    375383     *
    376384     * @since 5.2
    377      * @param array $invoice_data The invoice data
     385     * @param array  $invoice_data The invoice data
    378386     * @param object $order_object The order
    379387     * @param string $document_type The document type
     
    386394    }
    387395
    388     /*
     396    /**
    389397     * Finds the sequence id for the provided document type.
    390398     *
     
    399407        $order_object = wc_get_order( $order_id );
    400408
    401         // VAT MOSS DISABLED 2023
    402         //switch( $document_type ) {
    403         //  case 'vat_moss_invoice':
    404         //  case 'vat_moss_credit_note':
    405         //      $order_sequence_id = get_option( 'hd_wc_ie_plus_vat_moss_sequence' );
    406         //      break;
    407         //  default:
    408                 $order_sequence_id = $order_object->get_meta( '_billing_sequence_id' );
    409                 if ( empty( $order_sequence_id ) ) {
    410                     $order_sequence_id = apply_filters( 'invoicexpress_woocommerce_default_sequence', '', $order_object );
    411                 }
    412                 //VAT MOSS Credit notes - VAT MOSS DISABLED 2023
    413                 //if ( $document_type == 'credit_note' && $order_object->get_meta( 'hd_wc_ie_plus_invoice_type' ) == 'vat_moss_invoice' ) {
    414                 //  $order_sequence_id = get_option( 'hd_wc_ie_plus_vat_moss_sequence' );
    415                 //}
    416         //      break;
    417         //}
    418 
    419         //Get from sequences cache
     409        $order_sequence_id = $order_object->get_meta( '_billing_sequence_id' );
     410        if ( empty( $order_sequence_id ) ) {
     411            $order_sequence_id = apply_filters( 'invoicexpress_woocommerce_default_sequence', '', $order_object );
     412        }
     413
     414        // Get from sequences cache
    420415        $cache = get_option( 'hd_wc_ie_plus_sequences_cache' );
    421416        if ( is_array( $cache ) && count( $cache ) > 0 ) {
    422             if ( isset( $cache[$order_sequence_id]['current_' . $document_type . '_sequence_id'] ) ) {
    423                 //Found in cache
    424                 do_action( 'invoicexpress_woocommerce_debug', 'find_sequence_id ' . $document_type . ' ' . $order_sequence_id . ' ' . $cache[$order_sequence_id]['current_' . $document_type . '_sequence_id'], $order_object );
    425                 return $cache[$order_sequence_id]['current_' . $document_type . '_sequence_id'];
    426             }
    427         }
    428        
     417            if ( isset( $cache[ $order_sequence_id ][ 'current_' . $document_type . '_sequence_id' ] ) ) {
     418                // Found in cache
     419                do_action( 'invoicexpress_woocommerce_debug', 'find_sequence_id ' . $document_type . ' ' . $order_sequence_id . ' ' . $cache[ $order_sequence_id ][ 'current_' . $document_type . '_sequence_id' ], $order_object );
     420                return $cache[ $order_sequence_id ][ 'current_' . $document_type . '_sequence_id' ];
     421            }
     422        }
     423
    429424        return '';
    430425    }
    431426
    432     /*
     427    /**
    433428     * Stores the document as a order note and a custom field
    434429     */
     
    462457        }
    463458
    464         $document_type_name = isset( $this->plugin->type_names[$document_type] ) ? $this->plugin->type_names[$document_type] : $document_type;
    465 
    466         $file_name = $document_type_name.'-'.$order_object->get_meta( 'hd_wc_ie_plus_'.$document_type.'_sequence_number' );
     459        $document_type_name = isset( $this->plugin->type_names[ $document_type ] ) ? $this->plugin->type_names[ $document_type ] : $document_type;
     460
     461        $file_name = $document_type_name.'-'.$order_object->get_meta( 'hd_wc_ie_plus_' . $document_type . '_sequence_number' );
    467462        if ( $prefix = get_option( 'hd_wc_ie_plus_filename_prefix' ) ) {
    468             $file_name = $prefix.'-'.$file_name;
    469         }
    470         $file_name .= '-'.substr( md5( $file_name.time() ), 0, 5 );
    471         $file_name = sanitize_title( $file_name ).'.pdf';
     463            $file_name = $prefix . '-' . $file_name;
     464        }
     465        $file_name .= '-' . substr( md5( $file_name.time() ), 0, 5 );
     466        $file_name = sanitize_title( $file_name ) . '.pdf';
    472467
    473468        $file_name = apply_filters( 'invoicexpress_woocommerce_document_filename', $file_name, $order_object, $document_url, $document_type, $invoicexpress_id, $another_doc );
     
    493488                    __( 'Download %1$s %2$s (%3$s): %4$s.', 'woo-billing-with-invoicexpress' ),
    494489                    $document_type_name,
    495                     $order_object->get_meta( 'hd_wc_ie_plus_'.$document_type.'_sequence_number' ),
     490                    $order_object->get_meta( 'hd_wc_ie_plus_' . $document_type . '_sequence_number' ),
    496491                    __( 'PDF', 'woo-billing-with-invoicexpress' ),
    497492                    sprintf(
     
    504499                    /* translators: %1$s: document name, %2$s: download link */
    505500                    __( 'Problem accessing the %1$s PDF? Download again: %2$s.', 'woo-billing-with-invoicexpress' ),
    506                     $this->plugin->type_names[$document_type],
     501                    $this->plugin->type_names[ $document_type ],
    507502                    sprintf(
    508503                        '<a href="%1$s">%2$s</a>',
     
    513508            );
    514509            $order_object->save();
    515             $order_object->add_order_note( $note );
    516             //Send it
     510            $this->plugin->add_order_note( $order_object, $note );
     511            // Send it
    517512            if ( get_option( 'hd_wc_ie_plus_send_'.$document_type ) ) {
    518                 switch( $document_type ) {
     513                switch ( $document_type ) {
    519514                    case 'transport_guide':
    520515                        $email = get_option( 'hd_wc_ie_plus_transport_guide_email_address' );
     
    525520                }
    526521                if ( ! empty( $email ) ) {
    527                     $attachment = $order_object->get_meta( 'hd_wc_ie_plus_'.$document_type.'_pdf' );
     522                    $attachment = $order_object->get_meta( 'hd_wc_ie_plus_' . $document_type . '_pdf' );
    528523                    do_action( 'invoicexpress_woocommerce_debug', 'storeAndNoteDocument will now send the invoice email', $order_object );
    529524                    $this->send_invoice_email( $email, $invoicexpress_id, $order_object->get_id(), $order_object, $attachment, $document_type );
     
    533528            }
    534529        } else {
    535             do_action( 'invoicexpress_woocommerce_error', 'storeAndNoteDocument '.$this->plugin->type_names[$document_type].' PDF: No document URL', $order_object );
     530            do_action( 'invoicexpress_woocommerce_error', 'storeAndNoteDocument '.$this->plugin->type_names[ $document_type ].' PDF: No document URL', $order_object );
    536531        }
    537532    }
     
    557552            )
    558553        );
    559         $order_object->add_order_note( $note );
     554        $this->plugin->add_order_note( $order_object, $note );
    560555    }
    561556
     
    572567        do_action( 'invoicexpress_woocommerce_before_document_email', $order_object->get_id(), $document_type );
    573568        if ( $this->can_send_non_woocommerce_email( get_option( 'hd_wc_ie_plus_email_method' ), $order_object ) ) {
    574             //Hybrid or InvoiceXpress - with pending processing only for the InvoiceXpress method (not Hybrid)
     569            // Hybrid or InvoiceXpress - with pending processing only for the InvoiceXpress method (not Hybrid)
    575570            do_action( 'invoicexpress_woocommerce_debug', $this->plugin->type_names[ $document_type ].' email method: '.get_option( 'hd_wc_ie_plus_email_method' ), $order_object );
    576571            //Send it
     
    598593
    599594                } else {
    600                     do_action( 'invoicexpress_woocommerce_error', 'getAndSendPDF '.$this->plugin->type_names[$document_type].' PDF: No email address', $order_object );
    601                 }
    602             }
    603             //Note it
     595                    do_action( 'invoicexpress_woocommerce_error', 'getAndSendPDF ' . $this->plugin->type_names[ $document_type ] . ' PDF: No email address', $order_object );
     596                }
     597            }
     598            // Note it
    604599            $note = sprintf(
    605600                /* translators: %1$s: document name, %2$s document number, %3$s: PDF string, %4$s: PDF download link */
    606601                __( 'Download %1$s %2$s (%3$s): %4$s.', 'woo-billing-with-invoicexpress' ),
    607                 $this->plugin->type_names[$document_type],
    608                 $order_object->get_meta( 'hd_wc_ie_plus_'.$document_type.'_sequence_number' ),
     602                $this->plugin->type_names[ $document_type ],
     603                $order_object->get_meta( 'hd_wc_ie_plus_' . $document_type . '_sequence_number' ),
    609604                __( 'PDF', 'woo-billing-with-invoicexpress' ),
    610605                sprintf(
    611606                    '<a target="_blank" href="%1$s">%2$s</a>',
    612                     esc_url( $order_object->get_meta( 'hd_wc_ie_plus_'.$document_type.'_permalink' ) ),
     607                    esc_url( $order_object->get_meta( 'hd_wc_ie_plus_' . $document_type . '_permalink' ) ),
    613608                    __( 'click here', 'woo-billing-with-invoicexpress' )
    614609                )
    615610            );
    616             $order_object->add_order_note( $note );
     611            $this->plugin->add_order_note( $order_object, $note );
    617612            return true;
    618613        } else {
    619             //WooCommerce method - with pending processing
     614            // WooCommerce method - with pending processing
    620615            do_action( 'invoicexpress_woocommerce_debug', 'getAndSendPDF '.$this->plugin->type_names[ $document_type ].' email method: WooCommerce', $order_object );
    621616           
     
    724719                    }
    725720
    726                     do_action( 'invoicexpress_woocommerce_error', 'Get '.$this->plugin->type_names[$document_type].' PDF: '.$error_notice, $order_object );
     721                    do_action( 'invoicexpress_woocommerce_error', 'Get ' . $this->plugin->type_names[ $document_type ] . ' PDF: '.$error_notice, $order_object );
    727722                    $this->noteDocumentFailedPDF( $order_object, $document_type, $order_id_invoicexpress );
    728723                    if ( get_option( 'hd_wc_ie_plus_automatic_email_errors' ) && ( $mode === 'automatic' || $mode === 'scheduled' ) ) {
     
    744739
    745740                $document_url = $return['object']->output->pdfUrl;
    746                 if ( $document_type == 'receipt' && $receipt_count > 1 ) {
     741                if ( $document_type === 'receipt' && $receipt_count > 1 ) {
    747742                    $this->storeAndNoteDocument( $order_object, $document_url, $document_type, $order_id_invoicexpress, '_2' );
    748743                } else {
     
    840835
    841836    private function can_send_non_woocommerce_email( $email_method, $order_object ) {
    842         return get_option( 'hd_wc_ie_plus_email_method' ) != '' && get_option( 'hd_wc_ie_plus_email_method' ) != 'woocommerce' && apply_filters( 'invoicexpress_woocommerce_allow_'.$email_method.'_email', false );
     837        return get_option( 'hd_wc_ie_plus_email_method' ) !== '' && get_option( 'hd_wc_ie_plus_email_method' ) !== 'woocommerce' && apply_filters( 'invoicexpress_woocommerce_allow_' . $email_method . '_email', false );
    843838    }
    844839
     
    870865        $placeholders['{order_date}']    = apply_filters( 'invoicexpress_woocommerce_email_order_date', trim( wc_format_datetime( $order_object->get_date_created() ) ), $order_object );
    871866        $placeholders['{order_number}']  = $this->get_order_number( $order_object );
    872         $placeholders['{customer_name}'] = trim( sprintf(
    873             '%s %s',
    874             $order_object->get_billing_first_name(),
    875             $order_object->get_billing_last_name()
    876         ) );
     867        $placeholders['{customer_name}'] = trim(
     868                sprintf(
     869                '%s %s',
     870                $order_object->get_billing_first_name(),
     871                $order_object->get_billing_last_name()
     872            )
     873        );
    877874
    878875        $subject = $this->plugin->get_translated_option( "hd_wc_ie_plus_{$document_type}_email_subject", null, $order_object );
     
    899896        if ( $this->can_send_non_woocommerce_email( get_option( 'hd_wc_ie_plus_email_method' ), $order_object ) ) {
    900897            do_action( 'invoicexpress_woocommerce_debug', $this->plugin->type_names[ $document_type ].' email method: '.get_option( 'hd_wc_ie_plus_email_method' ), $order_object );
    901             do_action( 'invoicexpress_woocommerce_'.get_option( 'hd_wc_ie_plus_email_method' ).'_email', $document_type, $order_object, $invoicexpress_id, $email, $subject, $heading, $body, $mode );
    902             if ( get_option( 'hd_wc_ie_plus_email_method' ) == 'ix' ) return;
     898            do_action( 'invoicexpress_woocommerce_' . get_option( 'hd_wc_ie_plus_email_method' ) . '_email', $document_type, $order_object, $invoicexpress_id, $email, $subject, $heading, $body, $mode );
     899            if ( get_option( 'hd_wc_ie_plus_email_method' ) === 'ix' ) return;
    903900        } else {
    904901            do_action( 'invoicexpress_woocommerce_debug', 'send_invoice_email '.$this->plugin->type_names[ $document_type ].' email method: WooCommerce', $order_object );
     
    906903
    907904        if ( $attachment_url ) {
    908             $url_explode = explode( '/', $attachment_url );
     905            $url_explode    = explode( '/', $attachment_url );
    909906            $wp_upload_path = wp_upload_dir();
    910907            $plugin_path    = $wp_upload_path['basedir'];
     
    946943        remove_filter( 'wp_mail_content_type', array( $this->plugin, 'set_email_to_html' ) );
    947944
    948         do_action( 'invoicexpress_woocommerce_debug', $this->plugin->type_names[ $document_type ].' email sent: '.( $status ? 'true' : 'false' ), $order_object );
    949         if ( ! $status ) {
    950             $note = sprintf(
    951                 '<strong>%1$s</strong> %2$s',
    952                 __( 'InvoiceXpress error', 'woo-billing-with-invoicexpress' ),
     945        do_action( 'invoicexpress_woocommerce_debug', $this->plugin->type_names[ $document_type ] . ' email sent: ' . ( $status ? 'true' : 'false' ), $order_object );
     946
     947        if ( $status ) {
     948            $note = trim(
    953949                sprintf(
    954                     /* translators: %s: document type */
    955                     __( 'An error occured while sending the %s email', 'woo-billing-with-invoicexpress' ),
    956                     $this->plugin->type_names[ $document_type ]
     950                    /* translators: %1$s: document type, %2$s: email address, %3$s: email method (if hybrid) */
     951                    __( '%1$s sent to %2$s via WooCommerce %3$s', 'woo-billing-with-invoicexpress' ),
     952                    $this->plugin->type_names[ $document_type ],
     953                    $email,
     954                    get_option( 'hd_wc_ie_plus_email_method' ) === 'hybrid' ? __( '(Hybrid method)', 'woo-billing-with-invoicexpress' ) : ''
    957955                )
    958956            );
    959             $order_object->add_order_note( $note );
     957            $this->plugin->add_order_note( $order_object, $note );
     958        } else {
     959            $note = sprintf(
     960                /* translators: %s: document type */
     961                __( 'An error occured while sending the %s email', 'woo-billing-with-invoicexpress' ),
     962                $this->plugin->type_names[ $document_type ]
     963            );
     964            $this->plugin->add_order_note( $order_object, $note, 'error' );
    960965            do_action( 'invoicexpress_woocommerce_error', $note, $order_object );
    961966        }
     
    10421047        );
    10431048
    1044         $note = "<strong>InvoiceXpress:</strong>\n" . $message . ': ' . $message_content;
    1045         $order_object->add_order_note( $note );
     1049        $note = $message . ': ' . $message_content;
     1050        $this->plugin->add_order_note( $order_object, $note );
    10461051    }
    10471052
     
    12251230                            )
    12261231                        );
    1227                         $order_object->add_order_note( $note );
     1232                        $this->plugin->add_order_note( $order_object, $note );
    12281233                        break;
    12291234                }
     
    12501255                    )
    12511256                );
    1252                 $order_object->add_order_note( $note );
     1257                $this->plugin->add_order_note( $order_object, $note );
    12531258            } else {
    12541259                if ( ! $this->getAndSendPDF( $order_object, $document_type, $order_id_invoicexpress, $mode ) ) {
     
    13601365            do_action( 'invoicexpress_woocommerce_error', $error_notice, $order_object );
    13611366        }
    1362         //But we should add it to the order notes anyway
     1367        // But we should add it to the order notes anyway
    13631368        if ( isset( $prevent['message'] ) && trim( $prevent['message'] ) != '' ) {
    1364             $order_object->add_order_note( $prevent['message'] );
     1369            $this->plugin->add_order_note( $order_object, $prevent['message'] );
    13651370        }
    13661371    }
  • woo-billing-with-invoicexpress/tags/8.0/includes/BaseMenu.php

    r3272591 r3481120  
    321321                }
    322322
    323                 //Plugin update
     323                // Plugin update
    324324                if ( $( '.ix_api_version_update' ).length ) {
    325325                   
     
    332332                        var data = {
    333333                            'action': 'hd_invoicexpress_check_update_version',
    334                             'plugin': plugin
     334                            'plugin': plugin,
     335                            'nonce': '<?php echo esc_attr( wp_create_nonce( 'check_update_version_nonce' ) ); ?>'
    335336                        };
    336337                        jQuery.post(ajaxurl, data, function( response ) {
     
    402403                array(
    403404                    'text' => __( 'Pro plugin website', 'woo-billing-with-invoicexpress' ),
    404                     'url'  => __( 'https://invoicewoo.com', 'woo-billing-with-invoicexpress' ),
     405                    'url'  => esc_html_x( 'https://invoicewoo.com', 'Pro plugin website URL', 'woo-billing-with-invoicexpress' ),
    405406                ),
    406407                array(
    407408                    'text' => __( 'Free plugin on WordPress.org', 'woo-billing-with-invoicexpress' ),
    408                     'url'  => __( 'https://wordpress.org/plugins/woo-billing-with-invoicexpress/', 'woo-billing-with-invoicexpress' ),
     409                    'url'  => esc_html_x( 'https://wordpress.org/plugins/woo-billing-with-invoicexpress/', 'Free plugin URL', 'woo-billing-with-invoicexpress' ),
    409410                ),
    410411                array(
    411412                    'text' => __( 'Documentation', 'woo-billing-with-invoicexpress' ),
    412                     'url'  => __( 'https://invoicewoo.com/documentation/', 'woo-billing-with-invoicexpress' ),
     413                    'url'  => esc_html_x( 'https://invoicewoo.com/documentation/', 'Documentation URL', 'woo-billing-with-invoicexpress' ),
    413414                ),
    414415                array(
    415416                    'text' => __( 'Pro plugin technical support', 'woo-billing-with-invoicexpress' ),
    416                     'url'  => __( 'https://invoicewoo.com/documentation/requesting-technical-support/', 'woo-billing-with-invoicexpress' ),
     417                    'url'  => esc_html_x( 'https://invoicewoo.com/documentation/requesting-technical-support/', 'Pro plugin technical support URL', 'woo-billing-with-invoicexpress' ),
    417418                ),
    418419                array(
    419420                    'text' => __( 'Free plugin support forum', 'woo-billing-with-invoicexpress' ),
    420                     'url'  => __( 'https://wordpress.org/support/plugin/woo-billing-with-invoicexpress', 'woo-billing-with-invoicexpress' ),
     421                    'url'  => esc_html_x( 'https://wordpress.org/support/plugin/woo-billing-with-invoicexpress', 'Free plugin support forum URL', 'woo-billing-with-invoicexpress' ),
    421422                ),
    422423            );
  • woo-billing-with-invoicexpress/tags/8.0/includes/BaseSettings.php

    r3331470 r3481120  
    66use Webdados\InvoiceXpressWooCommerce\BaseController as BaseController;
    77use Webdados\InvoiceXpressWooCommerce\JsonRequest as JsonRequest;
    8 
    9 /* WooCommerce CRUD ready */
    10 /* JSON API ready */
    11 /* WooCommerce HPOS ready 2023-07-13 */
    128
    139class BaseSettings {
     
    702698        );
    703699        $json_request = new JsonRequest( $params );
    704         $return = $json_request->getRequest();
     700        $return       = $json_request->getRequest();
    705701        if ( $return['success'] ) {
    706702            $cache_id = '';
  • woo-billing-with-invoicexpress/tags/8.0/includes/ClientChecker.php

    r3037536 r3481120  
    44use Webdados\InvoiceXpressWooCommerce\JsonRequest as JsonRequest;
    55use Webdados\InvoiceXpressWooCommerce\CountryTranslation as CountryTranslation;
    6 
    7 /* WooCommerce CRUD ready */
    8 /* JSON API ready */
    9 /* WooCommerce HPOS ready 2023-07-13 */
    106
    117class ClientChecker {
  • woo-billing-with-invoicexpress/tags/8.0/includes/Menu/Menu.php

    r2938248 r3481120  
    33namespace Webdados\InvoiceXpressWooCommerce\Menu;
    44
     5use \Webdados\InvoiceXpressWooCommerce\Notices;
    56use \Webdados\InvoiceXpressWooCommerce\Settings\Settings;
    67
     
    2223    public function register_hooks() {
    2324
    24         //We need to allow the theme to hook into filters
    25         add_action( 'after_setup_theme', function() {
     25        // We need to allow the theme to hook into filters
     26        add_action(
     27            'after_setup_theme',
     28            function () {
    2629
    27             add_action( 'admin_menu', array( $this, 'admin_page' ), 90 );
    28             add_action( 'admin_notices', array( $this, 'show_admin_notices' ), 20 );
    29             // Hack to show admin notices on HPOS, after the notices actually are shown, until this PR is accepted: https://github.com/woocommerce/woocommerce/pull/39193
    30             if ( $this->plugin->hpos_enabled && version_compare( \WC_VERSION, '9999', '<=' ) ) {
    31                 add_action( 'woocommerce_process_shop_order_meta', array( $this, 'show_admin_notices' ), 9999 ); // After automatic invoices
     30                // Free and Pro
     31
     32                add_action( 'admin_menu', array( $this, 'admin_page' ), 90 );
     33                add_action( 'admin_notices', array( $this, 'show_admin_notices' ), 20 );
     34                // Hack to show admin notices on HPOS, after the notices actually are shown, until this PR is accepted: https://github.com/woocommerce/woocommerce/pull/39193
     35                if ( $this->plugin->hpos_enabled && version_compare( \WC_VERSION, '8.0', '<' ) ) {
     36                    add_action( 'woocommerce_process_shop_order_meta', array( $this, 'show_admin_notices' ), 9999 ); // After automatic invoices
     37                }
     38                add_filter( 'plugin_action_links_' . INVOICEXPRESS_WOOCOMMERCE_BASENAME, array( $this, 'add_action_link' ), 10, 2 );
     39
     40                add_action( 'init', array( $this, 'invoicexpress_api_rewrite_rule' ) );
     41                add_filter( 'query_vars', array( $this, 'invoicexpress_api_query_var' ) );
     42                add_action( 'parse_request', array( $this, 'invoicexpress_api_parse_request' ) );
     43
    3244            }
    33             add_filter( 'plugin_action_links_' . INVOICEXPRESS_WOOCOMMERCE_BASENAME, array( $this, 'add_action_link' ), 10, 2 );
    34 
    35             add_action( 'init', array( $this, 'invoicexpress_api_rewrite_rule' ) );
    36             add_filter( 'query_vars', array( $this, 'invoicexpress_api_query_var' ) );
    37             add_action( 'parse_request', array( $this, 'invoicexpress_api_parse_request' ) );
    38 
    39         } );
     45        );
    4046
    4147    }
  • woo-billing-with-invoicexpress/tags/8.0/includes/Menu/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/tags/8.0/includes/Modules/Invoice/InvoiceController.php

    r3330392 r3481120  
    66use Webdados\InvoiceXpressWooCommerce\ClientChecker as ClientChecker;
    77use Webdados\InvoiceXpressWooCommerce\Notices as Notices;
    8 
    9 /* WooCommerce CRUD ready */
    10 /* JSON API ready */
    11 /* WooCommerce HPOS ready 2023-07-12 */
    128
    139class InvoiceController extends BaseController {
  • woo-billing-with-invoicexpress/tags/8.0/includes/Modules/Invoice/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/tags/8.0/includes/Modules/SimplifiedInvoice/SimplifiedInvoiceController.php

    r3330392 r3481120  
    66use Webdados\InvoiceXpressWooCommerce\ClientChecker as ClientChecker;
    77use Webdados\InvoiceXpressWooCommerce\Notices as Notices;
    8 
    9 /* WooCommerce CRUD ready */
    10 /* JSON API ready */
    11 /* WooCommerce HPOS ready 2023-07-13 */
    128
    139class SimplifiedInvoiceController extends BaseController {
  • woo-billing-with-invoicexpress/tags/8.0/includes/Modules/SimplifiedInvoice/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/tags/8.0/includes/Modules/Taxes/TaxController.php

    r3331470 r3481120  
    44use Webdados\InvoiceXpressWooCommerce\BaseController as BaseController;
    55use Webdados\InvoiceXpressWooCommerce\Modules\Vat\VatController as VatController;
    6 
    7 /* WooCommerce CRUD ready */
    8 /* WooCommerce HPOS ready 2023-01-17 */
    96
    107class TaxController extends BaseController {
  • woo-billing-with-invoicexpress/tags/8.0/includes/Modules/Taxes/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/tags/8.0/includes/Modules/Vat/VatController.php

    r3369891 r3481120  
    11<?php
    22namespace Webdados\InvoiceXpressWooCommerce\Modules\Vat;
    3 
    4 // WooCommerce CRUD ready
    5 // WooCommerce HPOS ready 2023-07-13
    63
    74/**
     
    198195     */
    199196    public function woocommerce_after_edit_address_form_billing() {
    200         // if ( apply_filters( 'invoicexpress_woocommerce_external_vat', false ) ) { // TO-DO: We should not show our field if an external is being used and we should sync like we do in orders
     197        if ( ! apply_filters( 'invoicexpress_woocommerce_external_vat', false ) ) {
     198            // TO-DO: We should not show our field if an external is being used and we should sync like we do in orders - Done
     199            // On Vat.php we should account for all external plugins
    201200            global $current_user;
    202201            printf(
    203                 '<p class="form-row form-row-wide"><label for="_billing_VAT_code">%1$s:</label><span class="woocommerce-input-wrapper"><input id="%2$s" name="%2$s" type="text" value="%3$s" class="input-text"/></span><p>',
     202                '<p class="form-row form-row-wide" id="%2$s_field">
     203                    <!-- InvoiceXpress -->
     204                    <label for="_%2$s">%1$s:</label>
     205                    <span class="woocommerce-input-wrapper">
     206                        <input id="%2$s" name="%2$s" type="text" value="%3$s" class="input-text"/>
     207                    </span>
     208                <p>',
    204209                __( 'VAT number', 'woo-billing-with-invoicexpress' ),
    205210                INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD,
    206211                esc_attr( get_user_meta( $current_user->ID, INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD, true ) )
    207212            );
    208         // }
     213        }
    209214    }
    210215
     
    220225     */
    221226    public function woocommerce_customer_save_address( $user_id, $load_address ) {
    222         if ( $load_address === 'billing' && isset( $_POST[ INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD ] ) ) {
    223             $vat_number = $this->sanitize_vat_field( $_POST[ INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD ] );
    224             if ( isset( $_POST['billing_country'] ) && $_POST['billing_country'] === 'PT' && ! empty( $vat_number ) ) {
    225                 if ( ! self::validate_portuguese_vat( $vat_number ) ) {
    226                     \wc_add_notice( __( 'Invalid Portuguese VAT number.', 'woo-billing-with-invoicexpress' ), 'error' );
    227                     return;
     227        if ( $load_address === 'billing' ) {
     228            if ( apply_filters( 'invoicexpress_woocommerce_external_vat', false ) ) {
     229                // Will be taken care by the Pro plugin on Vat.php
     230                return;
     231            } else {
     232                // Get from our field
     233                if ( isset( $_POST[ INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD ] ) ) {
     234                    $vat_number = $this->sanitize_vat_field( $_POST[ INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD ] );
     235                    if ( isset( $_POST['billing_country'] ) && $_POST['billing_country'] === 'PT' && ! empty( $vat_number ) ) {
     236                        if ( ! self::validate_portuguese_vat( $vat_number ) ) {
     237                            \wc_add_notice( __( 'Invalid Portuguese VAT number.', 'woo-billing-with-invoicexpress' ), 'error' );
     238                            return;
     239                        }
     240                    }
     241                    update_user_meta( $user_id, INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD, $vat_number );
    228242                }
    229243            }
    230             update_user_meta( $user_id, INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD, $vat_number );
    231244        }
    232245    }
     
    264277     */
    265278    public function order_edit_vat_field( $fields ) {
    266         if ( $order_object = $this->plugin->get_order_object_edit_screen( null ) ) {
     279        if ( $order_object = $this->plugin->get_order_object_edit_screen( null, true ) ) {
    267280            $custom_attributes = array();
    268281            if ( ( $client_id = $order_object->get_meta( 'hd_wc_ie_plus_client_id' ) ) && ( $client_code = $order_object->get_meta( 'hd_wc_ie_plus_client_code' ) ) ) {
     
    419432     * @param \WP_Error $errors The errors object.
    420433     */
    421     public function validate_vat_frontend( &$data, &$errors ) {
     434    public function validate_vat_frontend( $data, $errors ) {
    422435        $vat_number = isset( $data[ INVOICEXPRESS_WOOCOMMERCE_VAT_CHECKOUT_FIELD ] ) ? $this->sanitize_vat_field( $data[ INVOICEXPRESS_WOOCOMMERCE_VAT_CHECKOUT_FIELD ] ) : '';
    423436        // Required? - WooCommerce already makes this validation
     
    425438        if ( ! empty( $vat_number ) && ( isset( $data['billing_country'] ) && $data['billing_country'] === 'PT' ) ) {
    426439            if ( ! self::validate_portuguese_vat( $vat_number ) ) {
    427                 $errors->add( 'billing', __( 'Invalid Portuguese VAT number.', 'woo-billing-with-invoicexpress' ), array( 'id' => INVOICEXPRESS_WOOCOMMERCE_VAT_CHECKOUT_FIELD ) );
     440                $errors->add(
     441                    'billing',
     442                    __( 'Invalid Portuguese VAT number.', 'woo-billing-with-invoicexpress' ),
     443                    array( 'id' => INVOICEXPRESS_WOOCOMMERCE_VAT_CHECKOUT_FIELD )
     444                );
    428445            }
    429446        }
  • woo-billing-with-invoicexpress/tags/8.0/includes/Modules/Vat/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/tags/8.0/includes/Plugin.php

    r3261566 r3481120  
    55namespace Webdados\InvoiceXpressWooCommerce;
    66
    7 /* WooCommerce CRUD ready */
    8 /* WooCommerce HPOS ready 2023-07-13 */
    9 
    107class Plugin {
    118
     
    1613     * @var    string
    1714     */
    18     public $wpml_active  = false;
    19     public $hpos_enabled = false;
    20     public $invoicexpress_referal_link = 'https://invoicexpress.com?fpr=webdados10';
    21     public $invoicexpress_plugin_id    = 'f608b455-90b7-47b3-b246-7c8c422e03b0';
     15    public $wpml_active                              = false;
     16    public $aelia_eu_vat_assistant_active            = false;
     17    public $woocommerce_eu_vat_field_active          = false;
     18    public $woocommerce_eu_vat_iva_compliance_active = false;
     19    public $hpos_enabled                             = false;
     20    public $invoicexpress_referal_link               = 'https://invoicexpress.com?fpr=webdados10';
     21    public $invoicexpress_plugin_id                  = 'f608b455-90b7-47b3-b246-7c8c422e03b0';
    2222
    2323    /**
     
    2929
    3030    /**
     31     * Initialize the class and set its properties.
     32     *
     33     * @since 2.3.0
     34     */
     35    public function __construct() {
     36    }
     37
     38    /**
    3139     * Load the dependencies, define the locale, and set the hooks for the Dashboard and
    3240     * the public-facing side of the site.
     
    3543     */
    3644    public function run() {
    37         $this->set_locale();
    3845        $this->set_document_type_names();
    3946        $this->define_hooks();
    40     }
    41 
    42     /**
    43      * Define the locale for this plugin for internationalization.
    44      *
    45      * @since 2.0.0
    46      */
    47     public function set_locale() {
    48         // Load translations - On init (after after_setup_theme) since WordPress 6.7 to avoid load_plugin_textdomain notices
    49         add_action(
    50             'init',
    51             function () {
    52                 load_plugin_textdomain( 'woo-billing-with-invoicexpress' );
    53             }
    54         );
    5547    }
    5648
     
    8981    public function get_create_documents_options() {
    9082        foreach ( $this->type_names as $key => $name ) {
    91             //Deal with inconsistencies on the database options
    92             switch( $key ) {
     83            // Deal with inconsistencies on the database options
     84            switch ( $key ) {
    9385                case 'invoice_receipt':
    9486                case 'quote':
    9587                case 'devolution_guide':
    96                     $option = 'hd_wc_ie_plus_'.$key;
     88                    $option = 'hd_wc_ie_plus_' . $key;
    9789                    break;
    9890                case 'receipt':
     
    10092                    break;
    10193                default:
    102                     $option = 'hd_wc_ie_plus_create_'.$key;
     94                    $option = 'hd_wc_ie_plus_create_' . $key;
    10395                    break;
    10496            }
    105             $this->allow[ $key ] = get_option( $option ) ? true : false;
     97            // This filter must be used with caution. It can break automatic documents if the current_user_can() function is used
     98            $this->allow[ $key ] = apply_filters( 'invoicexpress_woocommerce_allow_' . $key, get_option( $option ) ? true : false );
    10699        }
    107100    }
     
    115108    public function define_hooks() {
    116109        $settings = new Settings\Settings( $this );
    117         $modules = array(
     110        $modules  = array(
    118111            $settings,
    119112            new Menu\Menu( $settings, $this ),
     
    152145     */
    153146    public function admin_register_scripts_and_styles() {
    154         //WooCommerce Admin Notices compatibility
     147        // WooCommerce Admin Notices compatibility
    155148        if ( function_exists( 'wc_admin_url' ) ) {
    156149            if ( version_compare( \WC_ADMIN_VERSION_NUMBER, '0.23.2', '>=' ) ) {
     
    158151                    $register = \Automattic\WooCommerce\Admin\PageController::is_admin_page() || \Automattic\WooCommerce\Admin\PageController::is_embed_page();
    159152                    if ( $register ) {
    160                         wp_register_script( 'hd_wc_ie_woocommerce_admin_notices', plugins_url( 'assets/js/woocommerce-admin-notices.js', INVOICEXPRESS_WOOCOMMERCE_PLUGIN_FILE ), array( 'wp-hooks' ), INVOICEXPRESS_WOOCOMMERCE_VERSION.rand(0,999), true );
     153                        wp_register_script( 'hd_wc_ie_woocommerce_admin_notices', plugins_url( 'assets/js/woocommerce-admin-notices.js', INVOICEXPRESS_WOOCOMMERCE_PLUGIN_FILE ), array( 'wp-hooks' ), INVOICEXPRESS_WOOCOMMERCE_VERSION . rand( 0, 999 ), true );
    161154                        wp_enqueue_script( 'hd_wc_ie_woocommerce_admin_notices' );
    162155                    }
     
    176169            return;
    177170        }
    178         include( 'UpgradeFunctions.php' );
     171        include 'UpgradeFunctions.php';
    179172        $upgradeFunctions = new UpgradeFunctions( $this );
    180173    }
     
    186179     */
    187180    public function create_scheduled_docs_table() {
    188         //Create table for scheduled automatic documents
     181        // Create table for scheduled automatic documents
    189182        global $wpdb;
    190         $table_name = $wpdb->prefix.$this->scheduled_docs_table;
     183        $table_name   = $wpdb->prefix . $this->scheduled_docs_table;
    191184        $wpdb_collate = $wpdb->collate;
    192         $sql =
     185        $sql          =
    193186            "CREATE TABLE {$table_name} (
    194187                task_id bigint(20) UNSIGNED NOT NULL auto_increment,
     
    199192            )
    200193            COLLATE {$wpdb_collate}";
    201         require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
     194        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    202195        dbDelta( $sql );
    203196        do_action( 'invoicexpress_woocommerce_debug', "Created {$table_name} table" );
     
    205198    public function maybe_create_scheduled_docs_table() {
    206199        global $wpdb;
    207         $table = $wpdb->prefix.$this->scheduled_docs_table;
     200        $table = $wpdb->prefix . $this->scheduled_docs_table;
    208201        $query = "SHOW TABLES LIKE '{$table}'";
    209202        if ( ! $wpdb->get_row( $query ) ) {
     
    233226
    234227    /**
    235      * Get plugin translated option - Not on the free version, tho
     228     * Get order WPML language
     229     *
     230     * @since  2.0.7
     231     * @return string
     232     */
     233    public function get_order_wpml_language( $order_object ) {
     234        return $order_object->get_meta( 'wpml_language' );
     235    }
     236
     237    /**
     238     * Get plugin translated option
    236239     *
    237240     * @since  2.0.7
     
    264267
    265268    /**
    266      * Convert document type to endpoint, as some InovoiceXpress endpoints are not coherent
     269     * Convert document type to endpoint, as some InvoiceXpress endpoints are not coherent
    267270     *
    268271     * @since  3.0.0
     
    271274    public function document_type_to_endpoint( $document_type, $convert_receipt = false ) {
    272275        $endpoint = $document_type;
    273         switch( $document_type ) {
     276        switch ( $document_type ) {
    274277            case 'transport_guide':
    275278                $endpoint = 'transport';
     
    279282                break;
    280283            case 'receipt':
    281                 //Support email 2019-11-05
    282                 if ( $for_email_sending ) $endpoint = 'invoice'; // ??? Not even declared
     284                // Support email 2019-11-05
     285                if ( $for_email_sending ) {
     286                    $endpoint = 'invoice'; // ??? Not even declared
     287                }
    283288                break;
    284289        }
     
    304309    /**
    305310     * Helper to get $order on order edit screens
    306      * 
     311     *
    307312     * @since  4.0
    308313     * @return object
    309314     */
    310     public function get_order_object_edit_screen( $post_or_order_object ) {
     315    public function get_order_object_edit_screen( $post_or_order_object, $subscriptions = false ) {
    311316        if ( $post_or_order_object ) {
    312             return is_a( $post_or_order_object, 'WP_Post' ) ? wc_get_order( $post_or_order_object->ID ) : $post_or_order_object;   
     317            return is_a( $post_or_order_object, 'WP_Post' ) ? wc_get_order( $post_or_order_object->ID ) : $post_or_order_object;
    313318        } else {
    314319            global $post_type, $post;
    315320            if ( $this->hpos_enabled ) {
    316321                $screen = get_current_screen();
    317                 if ( $screen->base == wc_get_page_screen_id( 'shop-order' ) ) {
     322                if (
     323                    $screen->base === wc_get_page_screen_id( 'shop-order' )
     324                    ||
     325                    ( $subscriptions && $screen->base === 'shop_subscription' )
     326                ) {
    318327                    global $theorder;
    319328                    return $theorder;
    320329                }
    321             } elseif ( isset( $post_type ) && $post_type && isset( $post ) && $post && $post_type == 'shop_order' ) { //non-hpos
     330            } elseif (
     331                isset( $post_type )
     332                &&
     333                $post_type
     334                &&
     335                isset( $post )
     336                &&
     337                $post
     338                &&
     339                ( $post_type === 'shop_order' || ( $subscriptions && $post_type === 'shop_subscription' ) )
     340            ) { // non-hpos
    322341                return wc_get_order( $post->ID );
    323342            }
     
    336355    }
    337356
     357    /**
     358     * Add order note with InvoiceXpress prefix
     359     *
     360     * @since  7.3
     361     * @param  WC_Order $order_object The order object.
     362     * @param  string   $note         The note.
     363     * @param  string   $type         Type of note (error, warning or regular)
     364     * @return void
     365     */
     366    public function add_order_note( $order_object, $note, $type = '' ) {
     367        switch ( $type ) {
     368            case 'error':
     369                $note = '<strong>' . __( 'InvoiceXpress error', 'woo-billing-with-invoicexpress' ) . ':</strong> ' . $note;
     370                break;
     371            case 'warning':
     372                $note = '<strong>' . __( 'InvoiceXpress warning', 'woo-billing-with-invoicexpress' ) . ':</strong> ' . $note;
     373                break;
     374            default:
     375                $note = '<strong>InvoiceXpress:</strong> ' . $note;
     376                break;
     377        }
     378        $order_object->add_order_note( $note );
     379    }
    338380}
  • woo-billing-with-invoicexpress/tags/8.0/includes/ReDownloadPDF.php

    r3037536 r3481120  
    33
    44use Webdados\InvoiceXpressWooCommerce\JsonRequest as JsonRequest;
    5 
    6 /* WooCommerce CRUD ready */
    7 /* JSON API ready */
    8 /* WooCommerce HPOS ready 2023-07-13 */
    95
    106if ( ! defined( 'ABSPATH' ) ) {
  • woo-billing-with-invoicexpress/tags/8.0/includes/Settings/Settings.php

    r2938248 r3481120  
    1919     * Initialize the class and set its properties.
    2020     *
    21      * @since 2.5
     21     * @since 2.0.4 Add plugin instance parameter.
     22     * @since 2.0.0
    2223     * @param Plugin $plugin This plugin's instance.
    2324     */
    2425    public function __construct( Plugin $plugin ) {
    2526        parent::__construct( $plugin );
     27        // Delete sequences and taxes when changing the InvoiceXpress account
     28        add_action( 'update_option_hd_wc_ie_plus_subdomain', array( $this, 'update_option_hd_wc_ie_plus_subdomain' ), 10, 2 );
    2629    }
    2730
     
    6164    public function update_option_hd_wc_ie_plus_subdomain( $old_value, $new_value ) {
    6265        //if ( $old_value != '' ) {
    63         //Delete options
     66        // Delete options
    6467        $options_to_delete = array(
    6568            'hd_wc_ie_plus_default_tax',
     
    7174            delete_option( $option );
    7275        }
    73         //Warn user
     76        // Warn user
    7477        Notices::add_notice(
    7578            __( 'You need to re-set the sequences and taxes settings because you changed the InvoiceXpress API credentials.', 'woo-billing-with-invoicexpress' ),
     
    7881        //}
    7982    }
    80    
     83
    8184}
  • woo-billing-with-invoicexpress/tags/8.0/includes/Settings/Tabs/API.php

    r2938248 r3481120  
    3636                            'title'             => __( 'Subdomain', 'woo-billing-with-invoicexpress' ),
    3737                            /* translators: %s: InvoiceXpress account name */
    38                             'description'       => sprintf( __( '%s on InvoiceXpress', 'woo-billing-with-invoicexpress' ), 'ACCOUNT_NAME' ),
     38                            'description'       => sprintf( _x( '%s on InvoiceXpress', 'Account name on InvoiceXpress', 'woo-billing-with-invoicexpress' ), 'ACCOUNT_NAME' ),
    3939                            'type'              => 'text',
    4040                            'custom_attributes' => array(
     
    4545                            'title'             => __( 'API key', 'woo-billing-with-invoicexpress' ),
    4646                            /* translators: %s: InvoiceXpress API key */
    47                             'description'       => sprintf( __( '%s on InvoiceXpress', 'woo-billing-with-invoicexpress' ), 'API_KEY' ),
    48                             'type'              => 'password',
     47                            'description'       => sprintf( _x( '%s on InvoiceXpress', 'API Key on InvoiceXpress', 'woo-billing-with-invoicexpress' ), 'API_KEY' ),
     48                            'type'              => 'text',
    4949                            'custom_attributes' => array(
    5050                                'autocomplete' => 'off',
  • woo-billing-with-invoicexpress/tags/8.0/includes/Settings/Tabs/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/tags/8.0/includes/Settings/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/tags/8.0/includes/UpgradeFunctions.php

    r3331470 r3481120  
    3737            if ( version_compare( $db_version, '4.2', '<' ) ) {
    3838                $this->upgrade_4_2();
     39            }
     40            if ( version_compare( $db_version, '7.9', '<' ) ) {
     41                $this->upgrade_8_0();
    3942            }
    4043            // Create table for scheduled automatic documents, if it doesn't exists yet
     
    132135    }
    133136
     137    /**
     138     * 8.0 Upgrade routines
     139     * Adapt for new updater
     140     *
     141     * @since 8.0
     142     */
     143    public function upgrade_8_0() {
     144        if ( INVOICEXPRESS_WOOCOMMERCE_PLUGIN_EDITION === 'Pro' ) {
     145            update_option( 'hd_wc_ie_license_' . $this->plugin->plugin_update_id . '_refunded', intval( get_option( 'hd_wc_ie_' . $this->plugin->plugin_update_id . '_refunded', 0 ) ) );
     146            update_option( 'hd_wc_ie_license_' . $this->plugin->plugin_update_id . '_expired', intval( get_option( 'hd_wc_ie_' . $this->plugin->plugin_update_id . '_expired', 0 ) ) );
     147        }
     148    }
     149
    134150}
  • woo-billing-with-invoicexpress/tags/8.0/includes/WoocommerceBlocks/index.php

    r3030021 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/tags/8.0/includes/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/tags/8.0/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/tags/8.0/vendor/autoload.php

    r3330392 r3481120  
    2020require_once __DIR__ . '/composer/autoload_real.php';
    2121
    22 return ComposerAutoloaderInit4458ff8c0f9f78deecee213e2259a43f::getLoader();
     22return ComposerAutoloaderInit67d0e88033cb04896c2abfc071fbec3b::getLoader();
  • woo-billing-with-invoicexpress/tags/8.0/vendor/composer/autoload_classmap.php

    r3062101 r3481120  
    88return array(
    99    'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
     10    'Webdados\\InvoiceXpressWooCommerce\\Activator' => $baseDir . '/includes/Activator.php',
     11    'Webdados\\InvoiceXpressWooCommerce\\BaseController' => $baseDir . '/includes/BaseController.php',
     12    'Webdados\\InvoiceXpressWooCommerce\\BaseMenu' => $baseDir . '/includes/BaseMenu.php',
     13    'Webdados\\InvoiceXpressWooCommerce\\BaseSettings' => $baseDir . '/includes/BaseSettings.php',
     14    'Webdados\\InvoiceXpressWooCommerce\\ClientChecker' => $baseDir . '/includes/ClientChecker.php',
     15    'Webdados\\InvoiceXpressWooCommerce\\CountryTranslation' => $baseDir . '/includes/CountryTranslation.php',
     16    'Webdados\\InvoiceXpressWooCommerce\\Deactivator' => $baseDir . '/includes/Deactivator.php',
     17    'Webdados\\InvoiceXpressWooCommerce\\JsonRequest' => $baseDir . '/includes/JsonRequest.php',
     18    'Webdados\\InvoiceXpressWooCommerce\\JsonRequestException' => $baseDir . '/includes/JsonRequestException.php',
     19    'Webdados\\InvoiceXpressWooCommerce\\Menu\\Menu' => $baseDir . '/includes/Menu/Menu.php',
     20    'Webdados\\InvoiceXpressWooCommerce\\Modules\\Invoice\\InvoiceController' => $baseDir . '/includes/Modules/Invoice/InvoiceController.php',
     21    'Webdados\\InvoiceXpressWooCommerce\\Modules\\SimplifiedInvoice\\SimplifiedInvoiceController' => $baseDir . '/includes/Modules/SimplifiedInvoice/SimplifiedInvoiceController.php',
     22    'Webdados\\InvoiceXpressWooCommerce\\Modules\\Taxes\\TaxController' => $baseDir . '/includes/Modules/Taxes/TaxController.php',
     23    'Webdados\\InvoiceXpressWooCommerce\\Modules\\Vat\\VatController' => $baseDir . '/includes/Modules/Vat/VatController.php',
     24    'Webdados\\InvoiceXpressWooCommerce\\Notices' => $baseDir . '/includes/Notices.php',
     25    'Webdados\\InvoiceXpressWooCommerce\\Plugin' => $baseDir . '/includes/Plugin.php',
     26    'Webdados\\InvoiceXpressWooCommerce\\ReDownloadPDF' => $baseDir . '/includes/ReDownloadPDF.php',
     27    'Webdados\\InvoiceXpressWooCommerce\\Settings\\Settings' => $baseDir . '/includes/Settings/Settings.php',
     28    'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs' => $baseDir . '/includes/Settings/Tabs.php',
     29    'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs\\API' => $baseDir . '/includes/Settings/Tabs/API.php',
     30    'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs\\General' => $baseDir . '/includes/Settings/Tabs/General.php',
     31    'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs\\Invoices' => $baseDir . '/includes/Settings/Tabs/Invoices.php',
     32    'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs\\Taxes' => $baseDir . '/includes/Settings/Tabs/Taxes.php',
     33    'Webdados\\InvoiceXpressWooCommerce\\UpgradeFunctions' => $baseDir . '/includes/UpgradeFunctions.php',
     34    'Webdados\\InvoiceXpressWooCommerce\\WoocommerceBlocks\\VatCheckoutBlock' => $baseDir . '/includes/WoocommerceBlocks/VatCheckoutBlock.php',
    1035);
  • woo-billing-with-invoicexpress/tags/8.0/vendor/composer/autoload_real.php

    r3062101 r3481120  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit4458ff8c0f9f78deecee213e2259a43f
     5class ComposerAutoloaderInit67d0e88033cb04896c2abfc071fbec3b
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit4458ff8c0f9f78deecee213e2259a43f', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit67d0e88033cb04896c2abfc071fbec3b', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit4458ff8c0f9f78deecee213e2259a43f', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit67d0e88033cb04896c2abfc071fbec3b', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInit4458ff8c0f9f78deecee213e2259a43f::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b::getInitializer($loader));
    3333
    3434        $loader->register(true);
  • woo-billing-with-invoicexpress/tags/8.0/vendor/composer/autoload_static.php

    r3062101 r3481120  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit4458ff8c0f9f78deecee213e2259a43f
     7class ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b
    88{
    99    public static $prefixLengthsPsr4 = array (
    10         'W' => 
     10        'W' =>
    1111        array (
    1212            'Webdados\\InvoiceXpressWooCommerce\\' => 34,
     
    1515
    1616    public static $prefixDirsPsr4 = array (
    17         'Webdados\\InvoiceXpressWooCommerce\\' => 
     17        'Webdados\\InvoiceXpressWooCommerce\\' =>
    1818        array (
    1919            0 => __DIR__ . '/../..' . '/includes',
     
    2323    public static $classMap = array (
    2424        'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
     25        'Webdados\\InvoiceXpressWooCommerce\\Activator' => __DIR__ . '/../..' . '/includes/Activator.php',
     26        'Webdados\\InvoiceXpressWooCommerce\\BaseController' => __DIR__ . '/../..' . '/includes/BaseController.php',
     27        'Webdados\\InvoiceXpressWooCommerce\\BaseMenu' => __DIR__ . '/../..' . '/includes/BaseMenu.php',
     28        'Webdados\\InvoiceXpressWooCommerce\\BaseSettings' => __DIR__ . '/../..' . '/includes/BaseSettings.php',
     29        'Webdados\\InvoiceXpressWooCommerce\\ClientChecker' => __DIR__ . '/../..' . '/includes/ClientChecker.php',
     30        'Webdados\\InvoiceXpressWooCommerce\\CountryTranslation' => __DIR__ . '/../..' . '/includes/CountryTranslation.php',
     31        'Webdados\\InvoiceXpressWooCommerce\\Deactivator' => __DIR__ . '/../..' . '/includes/Deactivator.php',
     32        'Webdados\\InvoiceXpressWooCommerce\\JsonRequest' => __DIR__ . '/../..' . '/includes/JsonRequest.php',
     33        'Webdados\\InvoiceXpressWooCommerce\\JsonRequestException' => __DIR__ . '/../..' . '/includes/JsonRequestException.php',
     34        'Webdados\\InvoiceXpressWooCommerce\\Menu\\Menu' => __DIR__ . '/../..' . '/includes/Menu/Menu.php',
     35        'Webdados\\InvoiceXpressWooCommerce\\Modules\\Invoice\\InvoiceController' => __DIR__ . '/../..' . '/includes/Modules/Invoice/InvoiceController.php',
     36        'Webdados\\InvoiceXpressWooCommerce\\Modules\\SimplifiedInvoice\\SimplifiedInvoiceController' => __DIR__ . '/../..' . '/includes/Modules/SimplifiedInvoice/SimplifiedInvoiceController.php',
     37        'Webdados\\InvoiceXpressWooCommerce\\Modules\\Taxes\\TaxController' => __DIR__ . '/../..' . '/includes/Modules/Taxes/TaxController.php',
     38        'Webdados\\InvoiceXpressWooCommerce\\Modules\\Vat\\VatController' => __DIR__ . '/../..' . '/includes/Modules/Vat/VatController.php',
     39        'Webdados\\InvoiceXpressWooCommerce\\Notices' => __DIR__ . '/../..' . '/includes/Notices.php',
     40        'Webdados\\InvoiceXpressWooCommerce\\Plugin' => __DIR__ . '/../..' . '/includes/Plugin.php',
     41        'Webdados\\InvoiceXpressWooCommerce\\ReDownloadPDF' => __DIR__ . '/../..' . '/includes/ReDownloadPDF.php',
     42        'Webdados\\InvoiceXpressWooCommerce\\Settings\\Settings' => __DIR__ . '/../..' . '/includes/Settings/Settings.php',
     43        'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs' => __DIR__ . '/../..' . '/includes/Settings/Tabs.php',
     44        'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs\\API' => __DIR__ . '/../..' . '/includes/Settings/Tabs/API.php',
     45        'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs\\General' => __DIR__ . '/../..' . '/includes/Settings/Tabs/General.php',
     46        'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs\\Invoices' => __DIR__ . '/../..' . '/includes/Settings/Tabs/Invoices.php',
     47        'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs\\Taxes' => __DIR__ . '/../..' . '/includes/Settings/Tabs/Taxes.php',
     48        'Webdados\\InvoiceXpressWooCommerce\\UpgradeFunctions' => __DIR__ . '/../..' . '/includes/UpgradeFunctions.php',
     49        'Webdados\\InvoiceXpressWooCommerce\\WoocommerceBlocks\\VatCheckoutBlock' => __DIR__ . '/../..' . '/includes/WoocommerceBlocks/VatCheckoutBlock.php',
    2550    );
    2651
     
    2853    {
    2954        return \Closure::bind(function () use ($loader) {
    30             $loader->prefixLengthsPsr4 = ComposerStaticInit4458ff8c0f9f78deecee213e2259a43f::$prefixLengthsPsr4;
    31             $loader->prefixDirsPsr4 = ComposerStaticInit4458ff8c0f9f78deecee213e2259a43f::$prefixDirsPsr4;
    32             $loader->classMap = ComposerStaticInit4458ff8c0f9f78deecee213e2259a43f::$classMap;
     55            $loader->prefixLengthsPsr4 = ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b::$prefixLengthsPsr4;
     56            $loader->prefixDirsPsr4 = ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b::$prefixDirsPsr4;
     57            $loader->classMap = ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b::$classMap;
    3358
    3459        }, null, ClassLoader::class);
  • woo-billing-with-invoicexpress/tags/8.0/vendor/composer/index.php

    r3030021 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/tags/8.0/vendor/composer/installed.php

    r3369891 r3481120  
    22    'root' => array(
    33        'name' => 'webdados/invoicexpress-woocommerce',
    4         'pretty_version' => 'dev-master',
    5         'version' => 'dev-master',
    6         'reference' => '1f7606e1db4d388f6f61d4a2b9ebcbc71ccf09b7',
     4        'pretty_version' => '8.0',
     5        'version' => '8.0.0.0',
     6        'reference' => 'dff5711dea553ba60a8340d554fa8fe248a9be57',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'webdados/invoicexpress-woocommerce' => array(
    14             'pretty_version' => 'dev-master',
    15             'version' => 'dev-master',
    16             'reference' => '1f7606e1db4d388f6f61d4a2b9ebcbc71ccf09b7',
     14            'pretty_version' => '8.0',
     15            'version' => '8.0.0.0',
     16            'reference' => 'dff5711dea553ba60a8340d554fa8fe248a9be57',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • woo-billing-with-invoicexpress/tags/8.0/vendor/composer/platform_check.php

    r3062101 r3481120  
    2020        }
    2121    }
    22     trigger_error(
    23         'Composer detected issues in your platform: ' . implode(' ', $issues),
    24         E_USER_ERROR
     22    throw new \RuntimeException(
     23        'Composer detected issues in your platform: ' . implode(' ', $issues)
    2524    );
    2625}
  • woo-billing-with-invoicexpress/tags/8.0/vendor/index.php

    r3030021 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/tags/8.0/woocommerce-billing-invoicexpress-standard-edition.php

    r3369891 r3481120  
    33 * Plugin Name:          Invoicing with InvoiceXpress for WooCommerce - Free
    44 * Plugin URI:           https://invoicewoo.com
    5  * Version:              7.2
     5 * Version:              8.0
    66 * Description:          WooCommerce legal invoicing made easy with InvoiceXpress integration.
    77 * Author:               Naked Cat Plugins (by Webdados)
     
    99 * Text Domain:          woo-billing-with-invoicexpress
    1010 * Requires at least:    5.8
    11  * Tested up to:         6.9
     11 * Tested up to:         7.0
    1212 * Requires PHP:         7.2
    1313 * WC requires at least: 7.1
    14  * WC tested up to:      10.2
     14 * WC tested up to:      10.6
    1515 * Requires Plugins:     woocommerce
    1616 */
  • woo-billing-with-invoicexpress/trunk/assets/images/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/trunk/assets/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/trunk/assets/js/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/trunk/includes/BaseController.php

    r3369891 r3481120  
    44
    55use Webdados\InvoiceXpressWooCommerce\JsonRequest as JsonRequest;
    6 
    7 /* WooCommerce CRUD ready */
    8 /* JSON API ready */
    9 /* WooCommerce HPOS ready 2023-07-13 */
     6use Webdados\InvoiceXpressWooCommerce\Modules\Vat\VatController as VatController;
    107
    118class BaseController {
     
    300297     *
    301298     * @since 2.1.7
    302      * @param array $invoice_data The invoice data
     299     * @param array  $invoice_data The invoice data
    303300     * @param object $order_object The order
    304301     * @param string $document_type The document type
    305302     */
    306303    public function process_items( $invoice_data, $order_object, $document_type ) {
    307         //Each item
     304        // Each item
    308305        foreach ( $invoice_data['items'] as $key => $item ) {
    309             //Negative values?
     306            // Negative values?
    310307            if (
    311308                $item['unit_price'] < 0
    312309                ||
    313                 ( $item['ixwc']['unit_price'] < 0 && $document_type != 'credit_note' ) //We'll allow on credit notes for now
     310                ( $item['ixwc']['unit_price'] < 0 && $document_type != 'credit_note' ) // We'll allow on credit notes for now
    314311            ) {
    315312                $invoice_data['_prevent']         = true;
    316313                $invoice_data['_prevent_message'] = __( 'InvoiceXpress does not support, and it is not legal, to issue documents with negative items', 'woo-billing-with-invoicexpress' );
    317                 //We can get out now
     314                // We can get out now
    318315                return $invoice_data;
    319316            }
    320             //Partial exemption - WHY? Who's using this?
     317            // Partial exemption - WHY? Who's using this?
    321318            if ( isset( $item['ixwc']['type'] ) ) {
    322                 //Set partial exemption if global exemption is not set - Really? http://contabilistas.info/index.php?topic=8818.0
     319                // Set partial exemption if global exemption is not set - Really? http://contabilistas.info/index.php?topic=8818.0
    323320                if ( empty( $invoice_data['tax_exemption'] ) && apply_filters( 'invoicexpress_woocommerce_partial_exemption', false ) ) {
    324                     switch( $item['ixwc']['type'] ) {
     321                    switch ( $item['ixwc']['type'] ) {
    325322                        case 'item':
    326323                        case 'shipping':
    327324                        case 'fee':
    328325                            if ( isset( $item['tax']['name'] ) && trim( $item['tax']['name'] ) != '' && trim( $item['tax']['name'] ) === get_option( 'hd_wc_ie_plus_exemption_name' ) ) {
    329                                 $exemption = get_option( 'hd_wc_ie_plus_exemption_reason' );
     326                                $exemption                     = get_option( 'hd_wc_ie_plus_exemption_reason' );
    330327                                $invoice_data['tax_exemption'] = apply_filters( 'invoicexpress_woocommerce_partial_exemption_reason', $exemption, $item, $invoice_data, $order_object->get_id(), $document_type );
    331328                                do_action( 'invoicexpress_woocommerce_partial_exemption_applied', $item, $invoice_data, $order_object->get_id(), $document_type );
    332                                 do_action( 'invoicexpress_woocommerce_debug', 'process_items '.$document_type.' set partial exemption ' . $exemption, $order_object );
    333                                 break; //No need to keep going because we can only set one exemption reason per document (Maybe InvoiceXpress should look into that...)
     329                                do_action( 'invoicexpress_woocommerce_debug', 'process_items ' . $document_type . ' set partial exemption ' . $exemption, $order_object );
     330                                break; // No need to keep going because we can only set one exemption reason per document (Maybe InvoiceXpress should look into that...)
    334331                            }
    335332                            break;
     
    338335                    }
    339336                }
    340                 //Other stuff??
    341                 //...
    342             }
    343         }
    344         //Clear our extra information
     337                // Other stuff??
     338                // ...
     339            }
     340        }
     341        // Clear our extra information
    345342        foreach ( $invoice_data['items'] as $key => $item ) {
    346             //Important: Clear our data or InvoiceXpress will throw an error
    347             if ( isset( $item['ixwc'] ) ) unset( $invoice_data['items'][$key]['ixwc'] );
    348         }
    349         //Remove eventual HTML on titles and replace some problematic caracters
    350         $search = array(
     343            // Important: Clear our data or InvoiceXpress will throw an error
     344            if ( isset( $item['ixwc'] ) ) {
     345                unset( $invoice_data['items'][ $key ]['ixwc'] );
     346            }
     347        }
     348        // Remove eventual HTML on titles and replace some problematic caracters
     349        $search  = array(
    351350            '&euro;',
    352351            '&nbsp;',
     
    361360            $invoice_data['items'][ $key ]['description'] = trim( str_replace( $search, $replace, wp_strip_all_tags( $item['description'] ) ) );
    362361        }
    363         //Clear observations if empty - NO https://3.basecamp.com/3078239/buckets/20370269/messages/6022419606#__recording_6031501959
    364         //if ( isset( $invoice_data['observations'] ) ) {
    365         //  $invoice_data['observations'] = trim( $invoice_data['observations'] );
    366         //  if ( empty( $invoice_data['observations'] ) ) {
    367         //      unset( $invoice_data['observations'] );
    368         //  }
    369         //}
     362        // Fix observations
     363        if ( isset( $invoice_data['observations'] ) ) {
     364            $invoice_data['observations'] = trim( preg_replace( '/\s+/', ' ', $invoice_data['observations'] ) );
     365        } else {
     366            $invoice_data['observations'] = '';
     367        }
     368        // Set exemption on the observations
     369        if ( isset( $invoice_data['tax_exemption'] ) && ! empty( $invoice_data['tax_exemption'] ) ) {
     370            $exemption_reasons = VatController::get_exemption_reasons();
     371            if ( ! empty( $invoice_data['observations'] ) ) {
     372                $invoice_data['observations'] .= '
     373';
     374            }
     375            $invoice_data['observations'] .= $exemption_reasons[ $invoice_data['tax_exemption'] ];
     376        }
     377        // Return
    370378        return $invoice_data;
    371379    }
     
    375383     *
    376384     * @since 5.2
    377      * @param array $invoice_data The invoice data
     385     * @param array  $invoice_data The invoice data
    378386     * @param object $order_object The order
    379387     * @param string $document_type The document type
     
    386394    }
    387395
    388     /*
     396    /**
    389397     * Finds the sequence id for the provided document type.
    390398     *
     
    399407        $order_object = wc_get_order( $order_id );
    400408
    401         // VAT MOSS DISABLED 2023
    402         //switch( $document_type ) {
    403         //  case 'vat_moss_invoice':
    404         //  case 'vat_moss_credit_note':
    405         //      $order_sequence_id = get_option( 'hd_wc_ie_plus_vat_moss_sequence' );
    406         //      break;
    407         //  default:
    408                 $order_sequence_id = $order_object->get_meta( '_billing_sequence_id' );
    409                 if ( empty( $order_sequence_id ) ) {
    410                     $order_sequence_id = apply_filters( 'invoicexpress_woocommerce_default_sequence', '', $order_object );
    411                 }
    412                 //VAT MOSS Credit notes - VAT MOSS DISABLED 2023
    413                 //if ( $document_type == 'credit_note' && $order_object->get_meta( 'hd_wc_ie_plus_invoice_type' ) == 'vat_moss_invoice' ) {
    414                 //  $order_sequence_id = get_option( 'hd_wc_ie_plus_vat_moss_sequence' );
    415                 //}
    416         //      break;
    417         //}
    418 
    419         //Get from sequences cache
     409        $order_sequence_id = $order_object->get_meta( '_billing_sequence_id' );
     410        if ( empty( $order_sequence_id ) ) {
     411            $order_sequence_id = apply_filters( 'invoicexpress_woocommerce_default_sequence', '', $order_object );
     412        }
     413
     414        // Get from sequences cache
    420415        $cache = get_option( 'hd_wc_ie_plus_sequences_cache' );
    421416        if ( is_array( $cache ) && count( $cache ) > 0 ) {
    422             if ( isset( $cache[$order_sequence_id]['current_' . $document_type . '_sequence_id'] ) ) {
    423                 //Found in cache
    424                 do_action( 'invoicexpress_woocommerce_debug', 'find_sequence_id ' . $document_type . ' ' . $order_sequence_id . ' ' . $cache[$order_sequence_id]['current_' . $document_type . '_sequence_id'], $order_object );
    425                 return $cache[$order_sequence_id]['current_' . $document_type . '_sequence_id'];
    426             }
    427         }
    428        
     417            if ( isset( $cache[ $order_sequence_id ][ 'current_' . $document_type . '_sequence_id' ] ) ) {
     418                // Found in cache
     419                do_action( 'invoicexpress_woocommerce_debug', 'find_sequence_id ' . $document_type . ' ' . $order_sequence_id . ' ' . $cache[ $order_sequence_id ][ 'current_' . $document_type . '_sequence_id' ], $order_object );
     420                return $cache[ $order_sequence_id ][ 'current_' . $document_type . '_sequence_id' ];
     421            }
     422        }
     423
    429424        return '';
    430425    }
    431426
    432     /*
     427    /**
    433428     * Stores the document as a order note and a custom field
    434429     */
     
    462457        }
    463458
    464         $document_type_name = isset( $this->plugin->type_names[$document_type] ) ? $this->plugin->type_names[$document_type] : $document_type;
    465 
    466         $file_name = $document_type_name.'-'.$order_object->get_meta( 'hd_wc_ie_plus_'.$document_type.'_sequence_number' );
     459        $document_type_name = isset( $this->plugin->type_names[ $document_type ] ) ? $this->plugin->type_names[ $document_type ] : $document_type;
     460
     461        $file_name = $document_type_name.'-'.$order_object->get_meta( 'hd_wc_ie_plus_' . $document_type . '_sequence_number' );
    467462        if ( $prefix = get_option( 'hd_wc_ie_plus_filename_prefix' ) ) {
    468             $file_name = $prefix.'-'.$file_name;
    469         }
    470         $file_name .= '-'.substr( md5( $file_name.time() ), 0, 5 );
    471         $file_name = sanitize_title( $file_name ).'.pdf';
     463            $file_name = $prefix . '-' . $file_name;
     464        }
     465        $file_name .= '-' . substr( md5( $file_name.time() ), 0, 5 );
     466        $file_name = sanitize_title( $file_name ) . '.pdf';
    472467
    473468        $file_name = apply_filters( 'invoicexpress_woocommerce_document_filename', $file_name, $order_object, $document_url, $document_type, $invoicexpress_id, $another_doc );
     
    493488                    __( 'Download %1$s %2$s (%3$s): %4$s.', 'woo-billing-with-invoicexpress' ),
    494489                    $document_type_name,
    495                     $order_object->get_meta( 'hd_wc_ie_plus_'.$document_type.'_sequence_number' ),
     490                    $order_object->get_meta( 'hd_wc_ie_plus_' . $document_type . '_sequence_number' ),
    496491                    __( 'PDF', 'woo-billing-with-invoicexpress' ),
    497492                    sprintf(
     
    504499                    /* translators: %1$s: document name, %2$s: download link */
    505500                    __( 'Problem accessing the %1$s PDF? Download again: %2$s.', 'woo-billing-with-invoicexpress' ),
    506                     $this->plugin->type_names[$document_type],
     501                    $this->plugin->type_names[ $document_type ],
    507502                    sprintf(
    508503                        '<a href="%1$s">%2$s</a>',
     
    513508            );
    514509            $order_object->save();
    515             $order_object->add_order_note( $note );
    516             //Send it
     510            $this->plugin->add_order_note( $order_object, $note );
     511            // Send it
    517512            if ( get_option( 'hd_wc_ie_plus_send_'.$document_type ) ) {
    518                 switch( $document_type ) {
     513                switch ( $document_type ) {
    519514                    case 'transport_guide':
    520515                        $email = get_option( 'hd_wc_ie_plus_transport_guide_email_address' );
     
    525520                }
    526521                if ( ! empty( $email ) ) {
    527                     $attachment = $order_object->get_meta( 'hd_wc_ie_plus_'.$document_type.'_pdf' );
     522                    $attachment = $order_object->get_meta( 'hd_wc_ie_plus_' . $document_type . '_pdf' );
    528523                    do_action( 'invoicexpress_woocommerce_debug', 'storeAndNoteDocument will now send the invoice email', $order_object );
    529524                    $this->send_invoice_email( $email, $invoicexpress_id, $order_object->get_id(), $order_object, $attachment, $document_type );
     
    533528            }
    534529        } else {
    535             do_action( 'invoicexpress_woocommerce_error', 'storeAndNoteDocument '.$this->plugin->type_names[$document_type].' PDF: No document URL', $order_object );
     530            do_action( 'invoicexpress_woocommerce_error', 'storeAndNoteDocument '.$this->plugin->type_names[ $document_type ].' PDF: No document URL', $order_object );
    536531        }
    537532    }
     
    557552            )
    558553        );
    559         $order_object->add_order_note( $note );
     554        $this->plugin->add_order_note( $order_object, $note );
    560555    }
    561556
     
    572567        do_action( 'invoicexpress_woocommerce_before_document_email', $order_object->get_id(), $document_type );
    573568        if ( $this->can_send_non_woocommerce_email( get_option( 'hd_wc_ie_plus_email_method' ), $order_object ) ) {
    574             //Hybrid or InvoiceXpress - with pending processing only for the InvoiceXpress method (not Hybrid)
     569            // Hybrid or InvoiceXpress - with pending processing only for the InvoiceXpress method (not Hybrid)
    575570            do_action( 'invoicexpress_woocommerce_debug', $this->plugin->type_names[ $document_type ].' email method: '.get_option( 'hd_wc_ie_plus_email_method' ), $order_object );
    576571            //Send it
     
    598593
    599594                } else {
    600                     do_action( 'invoicexpress_woocommerce_error', 'getAndSendPDF '.$this->plugin->type_names[$document_type].' PDF: No email address', $order_object );
    601                 }
    602             }
    603             //Note it
     595                    do_action( 'invoicexpress_woocommerce_error', 'getAndSendPDF ' . $this->plugin->type_names[ $document_type ] . ' PDF: No email address', $order_object );
     596                }
     597            }
     598            // Note it
    604599            $note = sprintf(
    605600                /* translators: %1$s: document name, %2$s document number, %3$s: PDF string, %4$s: PDF download link */
    606601                __( 'Download %1$s %2$s (%3$s): %4$s.', 'woo-billing-with-invoicexpress' ),
    607                 $this->plugin->type_names[$document_type],
    608                 $order_object->get_meta( 'hd_wc_ie_plus_'.$document_type.'_sequence_number' ),
     602                $this->plugin->type_names[ $document_type ],
     603                $order_object->get_meta( 'hd_wc_ie_plus_' . $document_type . '_sequence_number' ),
    609604                __( 'PDF', 'woo-billing-with-invoicexpress' ),
    610605                sprintf(
    611606                    '<a target="_blank" href="%1$s">%2$s</a>',
    612                     esc_url( $order_object->get_meta( 'hd_wc_ie_plus_'.$document_type.'_permalink' ) ),
     607                    esc_url( $order_object->get_meta( 'hd_wc_ie_plus_' . $document_type . '_permalink' ) ),
    613608                    __( 'click here', 'woo-billing-with-invoicexpress' )
    614609                )
    615610            );
    616             $order_object->add_order_note( $note );
     611            $this->plugin->add_order_note( $order_object, $note );
    617612            return true;
    618613        } else {
    619             //WooCommerce method - with pending processing
     614            // WooCommerce method - with pending processing
    620615            do_action( 'invoicexpress_woocommerce_debug', 'getAndSendPDF '.$this->plugin->type_names[ $document_type ].' email method: WooCommerce', $order_object );
    621616           
     
    724719                    }
    725720
    726                     do_action( 'invoicexpress_woocommerce_error', 'Get '.$this->plugin->type_names[$document_type].' PDF: '.$error_notice, $order_object );
     721                    do_action( 'invoicexpress_woocommerce_error', 'Get ' . $this->plugin->type_names[ $document_type ] . ' PDF: '.$error_notice, $order_object );
    727722                    $this->noteDocumentFailedPDF( $order_object, $document_type, $order_id_invoicexpress );
    728723                    if ( get_option( 'hd_wc_ie_plus_automatic_email_errors' ) && ( $mode === 'automatic' || $mode === 'scheduled' ) ) {
     
    744739
    745740                $document_url = $return['object']->output->pdfUrl;
    746                 if ( $document_type == 'receipt' && $receipt_count > 1 ) {
     741                if ( $document_type === 'receipt' && $receipt_count > 1 ) {
    747742                    $this->storeAndNoteDocument( $order_object, $document_url, $document_type, $order_id_invoicexpress, '_2' );
    748743                } else {
     
    840835
    841836    private function can_send_non_woocommerce_email( $email_method, $order_object ) {
    842         return get_option( 'hd_wc_ie_plus_email_method' ) != '' && get_option( 'hd_wc_ie_plus_email_method' ) != 'woocommerce' && apply_filters( 'invoicexpress_woocommerce_allow_'.$email_method.'_email', false );
     837        return get_option( 'hd_wc_ie_plus_email_method' ) !== '' && get_option( 'hd_wc_ie_plus_email_method' ) !== 'woocommerce' && apply_filters( 'invoicexpress_woocommerce_allow_' . $email_method . '_email', false );
    843838    }
    844839
     
    870865        $placeholders['{order_date}']    = apply_filters( 'invoicexpress_woocommerce_email_order_date', trim( wc_format_datetime( $order_object->get_date_created() ) ), $order_object );
    871866        $placeholders['{order_number}']  = $this->get_order_number( $order_object );
    872         $placeholders['{customer_name}'] = trim( sprintf(
    873             '%s %s',
    874             $order_object->get_billing_first_name(),
    875             $order_object->get_billing_last_name()
    876         ) );
     867        $placeholders['{customer_name}'] = trim(
     868                sprintf(
     869                '%s %s',
     870                $order_object->get_billing_first_name(),
     871                $order_object->get_billing_last_name()
     872            )
     873        );
    877874
    878875        $subject = $this->plugin->get_translated_option( "hd_wc_ie_plus_{$document_type}_email_subject", null, $order_object );
     
    899896        if ( $this->can_send_non_woocommerce_email( get_option( 'hd_wc_ie_plus_email_method' ), $order_object ) ) {
    900897            do_action( 'invoicexpress_woocommerce_debug', $this->plugin->type_names[ $document_type ].' email method: '.get_option( 'hd_wc_ie_plus_email_method' ), $order_object );
    901             do_action( 'invoicexpress_woocommerce_'.get_option( 'hd_wc_ie_plus_email_method' ).'_email', $document_type, $order_object, $invoicexpress_id, $email, $subject, $heading, $body, $mode );
    902             if ( get_option( 'hd_wc_ie_plus_email_method' ) == 'ix' ) return;
     898            do_action( 'invoicexpress_woocommerce_' . get_option( 'hd_wc_ie_plus_email_method' ) . '_email', $document_type, $order_object, $invoicexpress_id, $email, $subject, $heading, $body, $mode );
     899            if ( get_option( 'hd_wc_ie_plus_email_method' ) === 'ix' ) return;
    903900        } else {
    904901            do_action( 'invoicexpress_woocommerce_debug', 'send_invoice_email '.$this->plugin->type_names[ $document_type ].' email method: WooCommerce', $order_object );
     
    906903
    907904        if ( $attachment_url ) {
    908             $url_explode = explode( '/', $attachment_url );
     905            $url_explode    = explode( '/', $attachment_url );
    909906            $wp_upload_path = wp_upload_dir();
    910907            $plugin_path    = $wp_upload_path['basedir'];
     
    946943        remove_filter( 'wp_mail_content_type', array( $this->plugin, 'set_email_to_html' ) );
    947944
    948         do_action( 'invoicexpress_woocommerce_debug', $this->plugin->type_names[ $document_type ].' email sent: '.( $status ? 'true' : 'false' ), $order_object );
    949         if ( ! $status ) {
    950             $note = sprintf(
    951                 '<strong>%1$s</strong> %2$s',
    952                 __( 'InvoiceXpress error', 'woo-billing-with-invoicexpress' ),
     945        do_action( 'invoicexpress_woocommerce_debug', $this->plugin->type_names[ $document_type ] . ' email sent: ' . ( $status ? 'true' : 'false' ), $order_object );
     946
     947        if ( $status ) {
     948            $note = trim(
    953949                sprintf(
    954                     /* translators: %s: document type */
    955                     __( 'An error occured while sending the %s email', 'woo-billing-with-invoicexpress' ),
    956                     $this->plugin->type_names[ $document_type ]
     950                    /* translators: %1$s: document type, %2$s: email address, %3$s: email method (if hybrid) */
     951                    __( '%1$s sent to %2$s via WooCommerce %3$s', 'woo-billing-with-invoicexpress' ),
     952                    $this->plugin->type_names[ $document_type ],
     953                    $email,
     954                    get_option( 'hd_wc_ie_plus_email_method' ) === 'hybrid' ? __( '(Hybrid method)', 'woo-billing-with-invoicexpress' ) : ''
    957955                )
    958956            );
    959             $order_object->add_order_note( $note );
     957            $this->plugin->add_order_note( $order_object, $note );
     958        } else {
     959            $note = sprintf(
     960                /* translators: %s: document type */
     961                __( 'An error occured while sending the %s email', 'woo-billing-with-invoicexpress' ),
     962                $this->plugin->type_names[ $document_type ]
     963            );
     964            $this->plugin->add_order_note( $order_object, $note, 'error' );
    960965            do_action( 'invoicexpress_woocommerce_error', $note, $order_object );
    961966        }
     
    10421047        );
    10431048
    1044         $note = "<strong>InvoiceXpress:</strong>\n" . $message . ': ' . $message_content;
    1045         $order_object->add_order_note( $note );
     1049        $note = $message . ': ' . $message_content;
     1050        $this->plugin->add_order_note( $order_object, $note );
    10461051    }
    10471052
     
    12251230                            )
    12261231                        );
    1227                         $order_object->add_order_note( $note );
     1232                        $this->plugin->add_order_note( $order_object, $note );
    12281233                        break;
    12291234                }
     
    12501255                    )
    12511256                );
    1252                 $order_object->add_order_note( $note );
     1257                $this->plugin->add_order_note( $order_object, $note );
    12531258            } else {
    12541259                if ( ! $this->getAndSendPDF( $order_object, $document_type, $order_id_invoicexpress, $mode ) ) {
     
    13601365            do_action( 'invoicexpress_woocommerce_error', $error_notice, $order_object );
    13611366        }
    1362         //But we should add it to the order notes anyway
     1367        // But we should add it to the order notes anyway
    13631368        if ( isset( $prevent['message'] ) && trim( $prevent['message'] ) != '' ) {
    1364             $order_object->add_order_note( $prevent['message'] );
     1369            $this->plugin->add_order_note( $order_object, $prevent['message'] );
    13651370        }
    13661371    }
  • woo-billing-with-invoicexpress/trunk/includes/BaseMenu.php

    r3272591 r3481120  
    321321                }
    322322
    323                 //Plugin update
     323                // Plugin update
    324324                if ( $( '.ix_api_version_update' ).length ) {
    325325                   
     
    332332                        var data = {
    333333                            'action': 'hd_invoicexpress_check_update_version',
    334                             'plugin': plugin
     334                            'plugin': plugin,
     335                            'nonce': '<?php echo esc_attr( wp_create_nonce( 'check_update_version_nonce' ) ); ?>'
    335336                        };
    336337                        jQuery.post(ajaxurl, data, function( response ) {
     
    402403                array(
    403404                    'text' => __( 'Pro plugin website', 'woo-billing-with-invoicexpress' ),
    404                     'url'  => __( 'https://invoicewoo.com', 'woo-billing-with-invoicexpress' ),
     405                    'url'  => esc_html_x( 'https://invoicewoo.com', 'Pro plugin website URL', 'woo-billing-with-invoicexpress' ),
    405406                ),
    406407                array(
    407408                    'text' => __( 'Free plugin on WordPress.org', 'woo-billing-with-invoicexpress' ),
    408                     'url'  => __( 'https://wordpress.org/plugins/woo-billing-with-invoicexpress/', 'woo-billing-with-invoicexpress' ),
     409                    'url'  => esc_html_x( 'https://wordpress.org/plugins/woo-billing-with-invoicexpress/', 'Free plugin URL', 'woo-billing-with-invoicexpress' ),
    409410                ),
    410411                array(
    411412                    'text' => __( 'Documentation', 'woo-billing-with-invoicexpress' ),
    412                     'url'  => __( 'https://invoicewoo.com/documentation/', 'woo-billing-with-invoicexpress' ),
     413                    'url'  => esc_html_x( 'https://invoicewoo.com/documentation/', 'Documentation URL', 'woo-billing-with-invoicexpress' ),
    413414                ),
    414415                array(
    415416                    'text' => __( 'Pro plugin technical support', 'woo-billing-with-invoicexpress' ),
    416                     'url'  => __( 'https://invoicewoo.com/documentation/requesting-technical-support/', 'woo-billing-with-invoicexpress' ),
     417                    'url'  => esc_html_x( 'https://invoicewoo.com/documentation/requesting-technical-support/', 'Pro plugin technical support URL', 'woo-billing-with-invoicexpress' ),
    417418                ),
    418419                array(
    419420                    'text' => __( 'Free plugin support forum', 'woo-billing-with-invoicexpress' ),
    420                     'url'  => __( 'https://wordpress.org/support/plugin/woo-billing-with-invoicexpress', 'woo-billing-with-invoicexpress' ),
     421                    'url'  => esc_html_x( 'https://wordpress.org/support/plugin/woo-billing-with-invoicexpress', 'Free plugin support forum URL', 'woo-billing-with-invoicexpress' ),
    421422                ),
    422423            );
  • woo-billing-with-invoicexpress/trunk/includes/BaseSettings.php

    r3331470 r3481120  
    66use Webdados\InvoiceXpressWooCommerce\BaseController as BaseController;
    77use Webdados\InvoiceXpressWooCommerce\JsonRequest as JsonRequest;
    8 
    9 /* WooCommerce CRUD ready */
    10 /* JSON API ready */
    11 /* WooCommerce HPOS ready 2023-07-13 */
    128
    139class BaseSettings {
     
    702698        );
    703699        $json_request = new JsonRequest( $params );
    704         $return = $json_request->getRequest();
     700        $return       = $json_request->getRequest();
    705701        if ( $return['success'] ) {
    706702            $cache_id = '';
  • woo-billing-with-invoicexpress/trunk/includes/ClientChecker.php

    r3037536 r3481120  
    44use Webdados\InvoiceXpressWooCommerce\JsonRequest as JsonRequest;
    55use Webdados\InvoiceXpressWooCommerce\CountryTranslation as CountryTranslation;
    6 
    7 /* WooCommerce CRUD ready */
    8 /* JSON API ready */
    9 /* WooCommerce HPOS ready 2023-07-13 */
    106
    117class ClientChecker {
  • woo-billing-with-invoicexpress/trunk/includes/Menu/Menu.php

    r2938248 r3481120  
    33namespace Webdados\InvoiceXpressWooCommerce\Menu;
    44
     5use \Webdados\InvoiceXpressWooCommerce\Notices;
    56use \Webdados\InvoiceXpressWooCommerce\Settings\Settings;
    67
     
    2223    public function register_hooks() {
    2324
    24         //We need to allow the theme to hook into filters
    25         add_action( 'after_setup_theme', function() {
     25        // We need to allow the theme to hook into filters
     26        add_action(
     27            'after_setup_theme',
     28            function () {
    2629
    27             add_action( 'admin_menu', array( $this, 'admin_page' ), 90 );
    28             add_action( 'admin_notices', array( $this, 'show_admin_notices' ), 20 );
    29             // Hack to show admin notices on HPOS, after the notices actually are shown, until this PR is accepted: https://github.com/woocommerce/woocommerce/pull/39193
    30             if ( $this->plugin->hpos_enabled && version_compare( \WC_VERSION, '9999', '<=' ) ) {
    31                 add_action( 'woocommerce_process_shop_order_meta', array( $this, 'show_admin_notices' ), 9999 ); // After automatic invoices
     30                // Free and Pro
     31
     32                add_action( 'admin_menu', array( $this, 'admin_page' ), 90 );
     33                add_action( 'admin_notices', array( $this, 'show_admin_notices' ), 20 );
     34                // Hack to show admin notices on HPOS, after the notices actually are shown, until this PR is accepted: https://github.com/woocommerce/woocommerce/pull/39193
     35                if ( $this->plugin->hpos_enabled && version_compare( \WC_VERSION, '8.0', '<' ) ) {
     36                    add_action( 'woocommerce_process_shop_order_meta', array( $this, 'show_admin_notices' ), 9999 ); // After automatic invoices
     37                }
     38                add_filter( 'plugin_action_links_' . INVOICEXPRESS_WOOCOMMERCE_BASENAME, array( $this, 'add_action_link' ), 10, 2 );
     39
     40                add_action( 'init', array( $this, 'invoicexpress_api_rewrite_rule' ) );
     41                add_filter( 'query_vars', array( $this, 'invoicexpress_api_query_var' ) );
     42                add_action( 'parse_request', array( $this, 'invoicexpress_api_parse_request' ) );
     43
    3244            }
    33             add_filter( 'plugin_action_links_' . INVOICEXPRESS_WOOCOMMERCE_BASENAME, array( $this, 'add_action_link' ), 10, 2 );
    34 
    35             add_action( 'init', array( $this, 'invoicexpress_api_rewrite_rule' ) );
    36             add_filter( 'query_vars', array( $this, 'invoicexpress_api_query_var' ) );
    37             add_action( 'parse_request', array( $this, 'invoicexpress_api_parse_request' ) );
    38 
    39         } );
     45        );
    4046
    4147    }
  • woo-billing-with-invoicexpress/trunk/includes/Menu/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/trunk/includes/Modules/Invoice/InvoiceController.php

    r3330392 r3481120  
    66use Webdados\InvoiceXpressWooCommerce\ClientChecker as ClientChecker;
    77use Webdados\InvoiceXpressWooCommerce\Notices as Notices;
    8 
    9 /* WooCommerce CRUD ready */
    10 /* JSON API ready */
    11 /* WooCommerce HPOS ready 2023-07-12 */
    128
    139class InvoiceController extends BaseController {
  • woo-billing-with-invoicexpress/trunk/includes/Modules/Invoice/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/trunk/includes/Modules/SimplifiedInvoice/SimplifiedInvoiceController.php

    r3330392 r3481120  
    66use Webdados\InvoiceXpressWooCommerce\ClientChecker as ClientChecker;
    77use Webdados\InvoiceXpressWooCommerce\Notices as Notices;
    8 
    9 /* WooCommerce CRUD ready */
    10 /* JSON API ready */
    11 /* WooCommerce HPOS ready 2023-07-13 */
    128
    139class SimplifiedInvoiceController extends BaseController {
  • woo-billing-with-invoicexpress/trunk/includes/Modules/SimplifiedInvoice/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/trunk/includes/Modules/Taxes/TaxController.php

    r3331470 r3481120  
    44use Webdados\InvoiceXpressWooCommerce\BaseController as BaseController;
    55use Webdados\InvoiceXpressWooCommerce\Modules\Vat\VatController as VatController;
    6 
    7 /* WooCommerce CRUD ready */
    8 /* WooCommerce HPOS ready 2023-01-17 */
    96
    107class TaxController extends BaseController {
  • woo-billing-with-invoicexpress/trunk/includes/Modules/Taxes/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/trunk/includes/Modules/Vat/VatController.php

    r3369891 r3481120  
    11<?php
    22namespace Webdados\InvoiceXpressWooCommerce\Modules\Vat;
    3 
    4 // WooCommerce CRUD ready
    5 // WooCommerce HPOS ready 2023-07-13
    63
    74/**
     
    198195     */
    199196    public function woocommerce_after_edit_address_form_billing() {
    200         // if ( apply_filters( 'invoicexpress_woocommerce_external_vat', false ) ) { // TO-DO: We should not show our field if an external is being used and we should sync like we do in orders
     197        if ( ! apply_filters( 'invoicexpress_woocommerce_external_vat', false ) ) {
     198            // TO-DO: We should not show our field if an external is being used and we should sync like we do in orders - Done
     199            // On Vat.php we should account for all external plugins
    201200            global $current_user;
    202201            printf(
    203                 '<p class="form-row form-row-wide"><label for="_billing_VAT_code">%1$s:</label><span class="woocommerce-input-wrapper"><input id="%2$s" name="%2$s" type="text" value="%3$s" class="input-text"/></span><p>',
     202                '<p class="form-row form-row-wide" id="%2$s_field">
     203                    <!-- InvoiceXpress -->
     204                    <label for="_%2$s">%1$s:</label>
     205                    <span class="woocommerce-input-wrapper">
     206                        <input id="%2$s" name="%2$s" type="text" value="%3$s" class="input-text"/>
     207                    </span>
     208                <p>',
    204209                __( 'VAT number', 'woo-billing-with-invoicexpress' ),
    205210                INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD,
    206211                esc_attr( get_user_meta( $current_user->ID, INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD, true ) )
    207212            );
    208         // }
     213        }
    209214    }
    210215
     
    220225     */
    221226    public function woocommerce_customer_save_address( $user_id, $load_address ) {
    222         if ( $load_address === 'billing' && isset( $_POST[ INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD ] ) ) {
    223             $vat_number = $this->sanitize_vat_field( $_POST[ INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD ] );
    224             if ( isset( $_POST['billing_country'] ) && $_POST['billing_country'] === 'PT' && ! empty( $vat_number ) ) {
    225                 if ( ! self::validate_portuguese_vat( $vat_number ) ) {
    226                     \wc_add_notice( __( 'Invalid Portuguese VAT number.', 'woo-billing-with-invoicexpress' ), 'error' );
    227                     return;
     227        if ( $load_address === 'billing' ) {
     228            if ( apply_filters( 'invoicexpress_woocommerce_external_vat', false ) ) {
     229                // Will be taken care by the Pro plugin on Vat.php
     230                return;
     231            } else {
     232                // Get from our field
     233                if ( isset( $_POST[ INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD ] ) ) {
     234                    $vat_number = $this->sanitize_vat_field( $_POST[ INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD ] );
     235                    if ( isset( $_POST['billing_country'] ) && $_POST['billing_country'] === 'PT' && ! empty( $vat_number ) ) {
     236                        if ( ! self::validate_portuguese_vat( $vat_number ) ) {
     237                            \wc_add_notice( __( 'Invalid Portuguese VAT number.', 'woo-billing-with-invoicexpress' ), 'error' );
     238                            return;
     239                        }
     240                    }
     241                    update_user_meta( $user_id, INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD, $vat_number );
    228242                }
    229243            }
    230             update_user_meta( $user_id, INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD, $vat_number );
    231244        }
    232245    }
     
    264277     */
    265278    public function order_edit_vat_field( $fields ) {
    266         if ( $order_object = $this->plugin->get_order_object_edit_screen( null ) ) {
     279        if ( $order_object = $this->plugin->get_order_object_edit_screen( null, true ) ) {
    267280            $custom_attributes = array();
    268281            if ( ( $client_id = $order_object->get_meta( 'hd_wc_ie_plus_client_id' ) ) && ( $client_code = $order_object->get_meta( 'hd_wc_ie_plus_client_code' ) ) ) {
     
    419432     * @param \WP_Error $errors The errors object.
    420433     */
    421     public function validate_vat_frontend( &$data, &$errors ) {
     434    public function validate_vat_frontend( $data, $errors ) {
    422435        $vat_number = isset( $data[ INVOICEXPRESS_WOOCOMMERCE_VAT_CHECKOUT_FIELD ] ) ? $this->sanitize_vat_field( $data[ INVOICEXPRESS_WOOCOMMERCE_VAT_CHECKOUT_FIELD ] ) : '';
    423436        // Required? - WooCommerce already makes this validation
     
    425438        if ( ! empty( $vat_number ) && ( isset( $data['billing_country'] ) && $data['billing_country'] === 'PT' ) ) {
    426439            if ( ! self::validate_portuguese_vat( $vat_number ) ) {
    427                 $errors->add( 'billing', __( 'Invalid Portuguese VAT number.', 'woo-billing-with-invoicexpress' ), array( 'id' => INVOICEXPRESS_WOOCOMMERCE_VAT_CHECKOUT_FIELD ) );
     440                $errors->add(
     441                    'billing',
     442                    __( 'Invalid Portuguese VAT number.', 'woo-billing-with-invoicexpress' ),
     443                    array( 'id' => INVOICEXPRESS_WOOCOMMERCE_VAT_CHECKOUT_FIELD )
     444                );
    428445            }
    429446        }
  • woo-billing-with-invoicexpress/trunk/includes/Modules/Vat/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/trunk/includes/Plugin.php

    r3261566 r3481120  
    55namespace Webdados\InvoiceXpressWooCommerce;
    66
    7 /* WooCommerce CRUD ready */
    8 /* WooCommerce HPOS ready 2023-07-13 */
    9 
    107class Plugin {
    118
     
    1613     * @var    string
    1714     */
    18     public $wpml_active  = false;
    19     public $hpos_enabled = false;
    20     public $invoicexpress_referal_link = 'https://invoicexpress.com?fpr=webdados10';
    21     public $invoicexpress_plugin_id    = 'f608b455-90b7-47b3-b246-7c8c422e03b0';
     15    public $wpml_active                              = false;
     16    public $aelia_eu_vat_assistant_active            = false;
     17    public $woocommerce_eu_vat_field_active          = false;
     18    public $woocommerce_eu_vat_iva_compliance_active = false;
     19    public $hpos_enabled                             = false;
     20    public $invoicexpress_referal_link               = 'https://invoicexpress.com?fpr=webdados10';
     21    public $invoicexpress_plugin_id                  = 'f608b455-90b7-47b3-b246-7c8c422e03b0';
    2222
    2323    /**
     
    2929
    3030    /**
     31     * Initialize the class and set its properties.
     32     *
     33     * @since 2.3.0
     34     */
     35    public function __construct() {
     36    }
     37
     38    /**
    3139     * Load the dependencies, define the locale, and set the hooks for the Dashboard and
    3240     * the public-facing side of the site.
     
    3543     */
    3644    public function run() {
    37         $this->set_locale();
    3845        $this->set_document_type_names();
    3946        $this->define_hooks();
    40     }
    41 
    42     /**
    43      * Define the locale for this plugin for internationalization.
    44      *
    45      * @since 2.0.0
    46      */
    47     public function set_locale() {
    48         // Load translations - On init (after after_setup_theme) since WordPress 6.7 to avoid load_plugin_textdomain notices
    49         add_action(
    50             'init',
    51             function () {
    52                 load_plugin_textdomain( 'woo-billing-with-invoicexpress' );
    53             }
    54         );
    5547    }
    5648
     
    8981    public function get_create_documents_options() {
    9082        foreach ( $this->type_names as $key => $name ) {
    91             //Deal with inconsistencies on the database options
    92             switch( $key ) {
     83            // Deal with inconsistencies on the database options
     84            switch ( $key ) {
    9385                case 'invoice_receipt':
    9486                case 'quote':
    9587                case 'devolution_guide':
    96                     $option = 'hd_wc_ie_plus_'.$key;
     88                    $option = 'hd_wc_ie_plus_' . $key;
    9789                    break;
    9890                case 'receipt':
     
    10092                    break;
    10193                default:
    102                     $option = 'hd_wc_ie_plus_create_'.$key;
     94                    $option = 'hd_wc_ie_plus_create_' . $key;
    10395                    break;
    10496            }
    105             $this->allow[ $key ] = get_option( $option ) ? true : false;
     97            // This filter must be used with caution. It can break automatic documents if the current_user_can() function is used
     98            $this->allow[ $key ] = apply_filters( 'invoicexpress_woocommerce_allow_' . $key, get_option( $option ) ? true : false );
    10699        }
    107100    }
     
    115108    public function define_hooks() {
    116109        $settings = new Settings\Settings( $this );
    117         $modules = array(
     110        $modules  = array(
    118111            $settings,
    119112            new Menu\Menu( $settings, $this ),
     
    152145     */
    153146    public function admin_register_scripts_and_styles() {
    154         //WooCommerce Admin Notices compatibility
     147        // WooCommerce Admin Notices compatibility
    155148        if ( function_exists( 'wc_admin_url' ) ) {
    156149            if ( version_compare( \WC_ADMIN_VERSION_NUMBER, '0.23.2', '>=' ) ) {
     
    158151                    $register = \Automattic\WooCommerce\Admin\PageController::is_admin_page() || \Automattic\WooCommerce\Admin\PageController::is_embed_page();
    159152                    if ( $register ) {
    160                         wp_register_script( 'hd_wc_ie_woocommerce_admin_notices', plugins_url( 'assets/js/woocommerce-admin-notices.js', INVOICEXPRESS_WOOCOMMERCE_PLUGIN_FILE ), array( 'wp-hooks' ), INVOICEXPRESS_WOOCOMMERCE_VERSION.rand(0,999), true );
     153                        wp_register_script( 'hd_wc_ie_woocommerce_admin_notices', plugins_url( 'assets/js/woocommerce-admin-notices.js', INVOICEXPRESS_WOOCOMMERCE_PLUGIN_FILE ), array( 'wp-hooks' ), INVOICEXPRESS_WOOCOMMERCE_VERSION . rand( 0, 999 ), true );
    161154                        wp_enqueue_script( 'hd_wc_ie_woocommerce_admin_notices' );
    162155                    }
     
    176169            return;
    177170        }
    178         include( 'UpgradeFunctions.php' );
     171        include 'UpgradeFunctions.php';
    179172        $upgradeFunctions = new UpgradeFunctions( $this );
    180173    }
     
    186179     */
    187180    public function create_scheduled_docs_table() {
    188         //Create table for scheduled automatic documents
     181        // Create table for scheduled automatic documents
    189182        global $wpdb;
    190         $table_name = $wpdb->prefix.$this->scheduled_docs_table;
     183        $table_name   = $wpdb->prefix . $this->scheduled_docs_table;
    191184        $wpdb_collate = $wpdb->collate;
    192         $sql =
     185        $sql          =
    193186            "CREATE TABLE {$table_name} (
    194187                task_id bigint(20) UNSIGNED NOT NULL auto_increment,
     
    199192            )
    200193            COLLATE {$wpdb_collate}";
    201         require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
     194        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    202195        dbDelta( $sql );
    203196        do_action( 'invoicexpress_woocommerce_debug', "Created {$table_name} table" );
     
    205198    public function maybe_create_scheduled_docs_table() {
    206199        global $wpdb;
    207         $table = $wpdb->prefix.$this->scheduled_docs_table;
     200        $table = $wpdb->prefix . $this->scheduled_docs_table;
    208201        $query = "SHOW TABLES LIKE '{$table}'";
    209202        if ( ! $wpdb->get_row( $query ) ) {
     
    233226
    234227    /**
    235      * Get plugin translated option - Not on the free version, tho
     228     * Get order WPML language
     229     *
     230     * @since  2.0.7
     231     * @return string
     232     */
     233    public function get_order_wpml_language( $order_object ) {
     234        return $order_object->get_meta( 'wpml_language' );
     235    }
     236
     237    /**
     238     * Get plugin translated option
    236239     *
    237240     * @since  2.0.7
     
    264267
    265268    /**
    266      * Convert document type to endpoint, as some InovoiceXpress endpoints are not coherent
     269     * Convert document type to endpoint, as some InvoiceXpress endpoints are not coherent
    267270     *
    268271     * @since  3.0.0
     
    271274    public function document_type_to_endpoint( $document_type, $convert_receipt = false ) {
    272275        $endpoint = $document_type;
    273         switch( $document_type ) {
     276        switch ( $document_type ) {
    274277            case 'transport_guide':
    275278                $endpoint = 'transport';
     
    279282                break;
    280283            case 'receipt':
    281                 //Support email 2019-11-05
    282                 if ( $for_email_sending ) $endpoint = 'invoice'; // ??? Not even declared
     284                // Support email 2019-11-05
     285                if ( $for_email_sending ) {
     286                    $endpoint = 'invoice'; // ??? Not even declared
     287                }
    283288                break;
    284289        }
     
    304309    /**
    305310     * Helper to get $order on order edit screens
    306      * 
     311     *
    307312     * @since  4.0
    308313     * @return object
    309314     */
    310     public function get_order_object_edit_screen( $post_or_order_object ) {
     315    public function get_order_object_edit_screen( $post_or_order_object, $subscriptions = false ) {
    311316        if ( $post_or_order_object ) {
    312             return is_a( $post_or_order_object, 'WP_Post' ) ? wc_get_order( $post_or_order_object->ID ) : $post_or_order_object;   
     317            return is_a( $post_or_order_object, 'WP_Post' ) ? wc_get_order( $post_or_order_object->ID ) : $post_or_order_object;
    313318        } else {
    314319            global $post_type, $post;
    315320            if ( $this->hpos_enabled ) {
    316321                $screen = get_current_screen();
    317                 if ( $screen->base == wc_get_page_screen_id( 'shop-order' ) ) {
     322                if (
     323                    $screen->base === wc_get_page_screen_id( 'shop-order' )
     324                    ||
     325                    ( $subscriptions && $screen->base === 'shop_subscription' )
     326                ) {
    318327                    global $theorder;
    319328                    return $theorder;
    320329                }
    321             } elseif ( isset( $post_type ) && $post_type && isset( $post ) && $post && $post_type == 'shop_order' ) { //non-hpos
     330            } elseif (
     331                isset( $post_type )
     332                &&
     333                $post_type
     334                &&
     335                isset( $post )
     336                &&
     337                $post
     338                &&
     339                ( $post_type === 'shop_order' || ( $subscriptions && $post_type === 'shop_subscription' ) )
     340            ) { // non-hpos
    322341                return wc_get_order( $post->ID );
    323342            }
     
    336355    }
    337356
     357    /**
     358     * Add order note with InvoiceXpress prefix
     359     *
     360     * @since  7.3
     361     * @param  WC_Order $order_object The order object.
     362     * @param  string   $note         The note.
     363     * @param  string   $type         Type of note (error, warning or regular)
     364     * @return void
     365     */
     366    public function add_order_note( $order_object, $note, $type = '' ) {
     367        switch ( $type ) {
     368            case 'error':
     369                $note = '<strong>' . __( 'InvoiceXpress error', 'woo-billing-with-invoicexpress' ) . ':</strong> ' . $note;
     370                break;
     371            case 'warning':
     372                $note = '<strong>' . __( 'InvoiceXpress warning', 'woo-billing-with-invoicexpress' ) . ':</strong> ' . $note;
     373                break;
     374            default:
     375                $note = '<strong>InvoiceXpress:</strong> ' . $note;
     376                break;
     377        }
     378        $order_object->add_order_note( $note );
     379    }
    338380}
  • woo-billing-with-invoicexpress/trunk/includes/ReDownloadPDF.php

    r3037536 r3481120  
    33
    44use Webdados\InvoiceXpressWooCommerce\JsonRequest as JsonRequest;
    5 
    6 /* WooCommerce CRUD ready */
    7 /* JSON API ready */
    8 /* WooCommerce HPOS ready 2023-07-13 */
    95
    106if ( ! defined( 'ABSPATH' ) ) {
  • woo-billing-with-invoicexpress/trunk/includes/Settings/Settings.php

    r2938248 r3481120  
    1919     * Initialize the class and set its properties.
    2020     *
    21      * @since 2.5
     21     * @since 2.0.4 Add plugin instance parameter.
     22     * @since 2.0.0
    2223     * @param Plugin $plugin This plugin's instance.
    2324     */
    2425    public function __construct( Plugin $plugin ) {
    2526        parent::__construct( $plugin );
     27        // Delete sequences and taxes when changing the InvoiceXpress account
     28        add_action( 'update_option_hd_wc_ie_plus_subdomain', array( $this, 'update_option_hd_wc_ie_plus_subdomain' ), 10, 2 );
    2629    }
    2730
     
    6164    public function update_option_hd_wc_ie_plus_subdomain( $old_value, $new_value ) {
    6265        //if ( $old_value != '' ) {
    63         //Delete options
     66        // Delete options
    6467        $options_to_delete = array(
    6568            'hd_wc_ie_plus_default_tax',
     
    7174            delete_option( $option );
    7275        }
    73         //Warn user
     76        // Warn user
    7477        Notices::add_notice(
    7578            __( 'You need to re-set the sequences and taxes settings because you changed the InvoiceXpress API credentials.', 'woo-billing-with-invoicexpress' ),
     
    7881        //}
    7982    }
    80    
     83
    8184}
  • woo-billing-with-invoicexpress/trunk/includes/Settings/Tabs/API.php

    r2938248 r3481120  
    3636                            'title'             => __( 'Subdomain', 'woo-billing-with-invoicexpress' ),
    3737                            /* translators: %s: InvoiceXpress account name */
    38                             'description'       => sprintf( __( '%s on InvoiceXpress', 'woo-billing-with-invoicexpress' ), 'ACCOUNT_NAME' ),
     38                            'description'       => sprintf( _x( '%s on InvoiceXpress', 'Account name on InvoiceXpress', 'woo-billing-with-invoicexpress' ), 'ACCOUNT_NAME' ),
    3939                            'type'              => 'text',
    4040                            'custom_attributes' => array(
     
    4545                            'title'             => __( 'API key', 'woo-billing-with-invoicexpress' ),
    4646                            /* translators: %s: InvoiceXpress API key */
    47                             'description'       => sprintf( __( '%s on InvoiceXpress', 'woo-billing-with-invoicexpress' ), 'API_KEY' ),
    48                             'type'              => 'password',
     47                            'description'       => sprintf( _x( '%s on InvoiceXpress', 'API Key on InvoiceXpress', 'woo-billing-with-invoicexpress' ), 'API_KEY' ),
     48                            'type'              => 'text',
    4949                            'custom_attributes' => array(
    5050                                'autocomplete' => 'off',
  • woo-billing-with-invoicexpress/trunk/includes/Settings/Tabs/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/trunk/includes/Settings/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/trunk/includes/UpgradeFunctions.php

    r3331470 r3481120  
    3737            if ( version_compare( $db_version, '4.2', '<' ) ) {
    3838                $this->upgrade_4_2();
     39            }
     40            if ( version_compare( $db_version, '7.9', '<' ) ) {
     41                $this->upgrade_8_0();
    3942            }
    4043            // Create table for scheduled automatic documents, if it doesn't exists yet
     
    132135    }
    133136
     137    /**
     138     * 8.0 Upgrade routines
     139     * Adapt for new updater
     140     *
     141     * @since 8.0
     142     */
     143    public function upgrade_8_0() {
     144        if ( INVOICEXPRESS_WOOCOMMERCE_PLUGIN_EDITION === 'Pro' ) {
     145            update_option( 'hd_wc_ie_license_' . $this->plugin->plugin_update_id . '_refunded', intval( get_option( 'hd_wc_ie_' . $this->plugin->plugin_update_id . '_refunded', 0 ) ) );
     146            update_option( 'hd_wc_ie_license_' . $this->plugin->plugin_update_id . '_expired', intval( get_option( 'hd_wc_ie_' . $this->plugin->plugin_update_id . '_expired', 0 ) ) );
     147        }
     148    }
     149
    134150}
  • woo-billing-with-invoicexpress/trunk/includes/WoocommerceBlocks/index.php

    r3030021 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/trunk/includes/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/trunk/index.php

    r2543751 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/trunk/vendor/autoload.php

    r3330392 r3481120  
    2020require_once __DIR__ . '/composer/autoload_real.php';
    2121
    22 return ComposerAutoloaderInit4458ff8c0f9f78deecee213e2259a43f::getLoader();
     22return ComposerAutoloaderInit67d0e88033cb04896c2abfc071fbec3b::getLoader();
  • woo-billing-with-invoicexpress/trunk/vendor/composer/autoload_classmap.php

    r3062101 r3481120  
    88return array(
    99    'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
     10    'Webdados\\InvoiceXpressWooCommerce\\Activator' => $baseDir . '/includes/Activator.php',
     11    'Webdados\\InvoiceXpressWooCommerce\\BaseController' => $baseDir . '/includes/BaseController.php',
     12    'Webdados\\InvoiceXpressWooCommerce\\BaseMenu' => $baseDir . '/includes/BaseMenu.php',
     13    'Webdados\\InvoiceXpressWooCommerce\\BaseSettings' => $baseDir . '/includes/BaseSettings.php',
     14    'Webdados\\InvoiceXpressWooCommerce\\ClientChecker' => $baseDir . '/includes/ClientChecker.php',
     15    'Webdados\\InvoiceXpressWooCommerce\\CountryTranslation' => $baseDir . '/includes/CountryTranslation.php',
     16    'Webdados\\InvoiceXpressWooCommerce\\Deactivator' => $baseDir . '/includes/Deactivator.php',
     17    'Webdados\\InvoiceXpressWooCommerce\\JsonRequest' => $baseDir . '/includes/JsonRequest.php',
     18    'Webdados\\InvoiceXpressWooCommerce\\JsonRequestException' => $baseDir . '/includes/JsonRequestException.php',
     19    'Webdados\\InvoiceXpressWooCommerce\\Menu\\Menu' => $baseDir . '/includes/Menu/Menu.php',
     20    'Webdados\\InvoiceXpressWooCommerce\\Modules\\Invoice\\InvoiceController' => $baseDir . '/includes/Modules/Invoice/InvoiceController.php',
     21    'Webdados\\InvoiceXpressWooCommerce\\Modules\\SimplifiedInvoice\\SimplifiedInvoiceController' => $baseDir . '/includes/Modules/SimplifiedInvoice/SimplifiedInvoiceController.php',
     22    'Webdados\\InvoiceXpressWooCommerce\\Modules\\Taxes\\TaxController' => $baseDir . '/includes/Modules/Taxes/TaxController.php',
     23    'Webdados\\InvoiceXpressWooCommerce\\Modules\\Vat\\VatController' => $baseDir . '/includes/Modules/Vat/VatController.php',
     24    'Webdados\\InvoiceXpressWooCommerce\\Notices' => $baseDir . '/includes/Notices.php',
     25    'Webdados\\InvoiceXpressWooCommerce\\Plugin' => $baseDir . '/includes/Plugin.php',
     26    'Webdados\\InvoiceXpressWooCommerce\\ReDownloadPDF' => $baseDir . '/includes/ReDownloadPDF.php',
     27    'Webdados\\InvoiceXpressWooCommerce\\Settings\\Settings' => $baseDir . '/includes/Settings/Settings.php',
     28    'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs' => $baseDir . '/includes/Settings/Tabs.php',
     29    'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs\\API' => $baseDir . '/includes/Settings/Tabs/API.php',
     30    'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs\\General' => $baseDir . '/includes/Settings/Tabs/General.php',
     31    'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs\\Invoices' => $baseDir . '/includes/Settings/Tabs/Invoices.php',
     32    'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs\\Taxes' => $baseDir . '/includes/Settings/Tabs/Taxes.php',
     33    'Webdados\\InvoiceXpressWooCommerce\\UpgradeFunctions' => $baseDir . '/includes/UpgradeFunctions.php',
     34    'Webdados\\InvoiceXpressWooCommerce\\WoocommerceBlocks\\VatCheckoutBlock' => $baseDir . '/includes/WoocommerceBlocks/VatCheckoutBlock.php',
    1035);
  • woo-billing-with-invoicexpress/trunk/vendor/composer/autoload_real.php

    r3062101 r3481120  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit4458ff8c0f9f78deecee213e2259a43f
     5class ComposerAutoloaderInit67d0e88033cb04896c2abfc071fbec3b
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit4458ff8c0f9f78deecee213e2259a43f', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit67d0e88033cb04896c2abfc071fbec3b', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit4458ff8c0f9f78deecee213e2259a43f', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit67d0e88033cb04896c2abfc071fbec3b', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInit4458ff8c0f9f78deecee213e2259a43f::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b::getInitializer($loader));
    3333
    3434        $loader->register(true);
  • woo-billing-with-invoicexpress/trunk/vendor/composer/autoload_static.php

    r3062101 r3481120  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit4458ff8c0f9f78deecee213e2259a43f
     7class ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b
    88{
    99    public static $prefixLengthsPsr4 = array (
    10         'W' => 
     10        'W' =>
    1111        array (
    1212            'Webdados\\InvoiceXpressWooCommerce\\' => 34,
     
    1515
    1616    public static $prefixDirsPsr4 = array (
    17         'Webdados\\InvoiceXpressWooCommerce\\' => 
     17        'Webdados\\InvoiceXpressWooCommerce\\' =>
    1818        array (
    1919            0 => __DIR__ . '/../..' . '/includes',
     
    2323    public static $classMap = array (
    2424        'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
     25        'Webdados\\InvoiceXpressWooCommerce\\Activator' => __DIR__ . '/../..' . '/includes/Activator.php',
     26        'Webdados\\InvoiceXpressWooCommerce\\BaseController' => __DIR__ . '/../..' . '/includes/BaseController.php',
     27        'Webdados\\InvoiceXpressWooCommerce\\BaseMenu' => __DIR__ . '/../..' . '/includes/BaseMenu.php',
     28        'Webdados\\InvoiceXpressWooCommerce\\BaseSettings' => __DIR__ . '/../..' . '/includes/BaseSettings.php',
     29        'Webdados\\InvoiceXpressWooCommerce\\ClientChecker' => __DIR__ . '/../..' . '/includes/ClientChecker.php',
     30        'Webdados\\InvoiceXpressWooCommerce\\CountryTranslation' => __DIR__ . '/../..' . '/includes/CountryTranslation.php',
     31        'Webdados\\InvoiceXpressWooCommerce\\Deactivator' => __DIR__ . '/../..' . '/includes/Deactivator.php',
     32        'Webdados\\InvoiceXpressWooCommerce\\JsonRequest' => __DIR__ . '/../..' . '/includes/JsonRequest.php',
     33        'Webdados\\InvoiceXpressWooCommerce\\JsonRequestException' => __DIR__ . '/../..' . '/includes/JsonRequestException.php',
     34        'Webdados\\InvoiceXpressWooCommerce\\Menu\\Menu' => __DIR__ . '/../..' . '/includes/Menu/Menu.php',
     35        'Webdados\\InvoiceXpressWooCommerce\\Modules\\Invoice\\InvoiceController' => __DIR__ . '/../..' . '/includes/Modules/Invoice/InvoiceController.php',
     36        'Webdados\\InvoiceXpressWooCommerce\\Modules\\SimplifiedInvoice\\SimplifiedInvoiceController' => __DIR__ . '/../..' . '/includes/Modules/SimplifiedInvoice/SimplifiedInvoiceController.php',
     37        'Webdados\\InvoiceXpressWooCommerce\\Modules\\Taxes\\TaxController' => __DIR__ . '/../..' . '/includes/Modules/Taxes/TaxController.php',
     38        'Webdados\\InvoiceXpressWooCommerce\\Modules\\Vat\\VatController' => __DIR__ . '/../..' . '/includes/Modules/Vat/VatController.php',
     39        'Webdados\\InvoiceXpressWooCommerce\\Notices' => __DIR__ . '/../..' . '/includes/Notices.php',
     40        'Webdados\\InvoiceXpressWooCommerce\\Plugin' => __DIR__ . '/../..' . '/includes/Plugin.php',
     41        'Webdados\\InvoiceXpressWooCommerce\\ReDownloadPDF' => __DIR__ . '/../..' . '/includes/ReDownloadPDF.php',
     42        'Webdados\\InvoiceXpressWooCommerce\\Settings\\Settings' => __DIR__ . '/../..' . '/includes/Settings/Settings.php',
     43        'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs' => __DIR__ . '/../..' . '/includes/Settings/Tabs.php',
     44        'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs\\API' => __DIR__ . '/../..' . '/includes/Settings/Tabs/API.php',
     45        'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs\\General' => __DIR__ . '/../..' . '/includes/Settings/Tabs/General.php',
     46        'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs\\Invoices' => __DIR__ . '/../..' . '/includes/Settings/Tabs/Invoices.php',
     47        'Webdados\\InvoiceXpressWooCommerce\\Settings\\Tabs\\Taxes' => __DIR__ . '/../..' . '/includes/Settings/Tabs/Taxes.php',
     48        'Webdados\\InvoiceXpressWooCommerce\\UpgradeFunctions' => __DIR__ . '/../..' . '/includes/UpgradeFunctions.php',
     49        'Webdados\\InvoiceXpressWooCommerce\\WoocommerceBlocks\\VatCheckoutBlock' => __DIR__ . '/../..' . '/includes/WoocommerceBlocks/VatCheckoutBlock.php',
    2550    );
    2651
     
    2853    {
    2954        return \Closure::bind(function () use ($loader) {
    30             $loader->prefixLengthsPsr4 = ComposerStaticInit4458ff8c0f9f78deecee213e2259a43f::$prefixLengthsPsr4;
    31             $loader->prefixDirsPsr4 = ComposerStaticInit4458ff8c0f9f78deecee213e2259a43f::$prefixDirsPsr4;
    32             $loader->classMap = ComposerStaticInit4458ff8c0f9f78deecee213e2259a43f::$classMap;
     55            $loader->prefixLengthsPsr4 = ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b::$prefixLengthsPsr4;
     56            $loader->prefixDirsPsr4 = ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b::$prefixDirsPsr4;
     57            $loader->classMap = ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b::$classMap;
    3358
    3459        }, null, ClassLoader::class);
  • woo-billing-with-invoicexpress/trunk/vendor/composer/index.php

    r3030021 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/trunk/vendor/composer/installed.php

    r3369891 r3481120  
    22    'root' => array(
    33        'name' => 'webdados/invoicexpress-woocommerce',
    4         'pretty_version' => 'dev-master',
    5         'version' => 'dev-master',
    6         'reference' => '1f7606e1db4d388f6f61d4a2b9ebcbc71ccf09b7',
     4        'pretty_version' => '8.0',
     5        'version' => '8.0.0.0',
     6        'reference' => 'dff5711dea553ba60a8340d554fa8fe248a9be57',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'webdados/invoicexpress-woocommerce' => array(
    14             'pretty_version' => 'dev-master',
    15             'version' => 'dev-master',
    16             'reference' => '1f7606e1db4d388f6f61d4a2b9ebcbc71ccf09b7',
     14            'pretty_version' => '8.0',
     15            'version' => '8.0.0.0',
     16            'reference' => 'dff5711dea553ba60a8340d554fa8fe248a9be57',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • woo-billing-with-invoicexpress/trunk/vendor/composer/platform_check.php

    r3062101 r3481120  
    2020        }
    2121    }
    22     trigger_error(
    23         'Composer detected issues in your platform: ' . implode(' ', $issues),
    24         E_USER_ERROR
     22    throw new \RuntimeException(
     23        'Composer detected issues in your platform: ' . implode(' ', $issues)
    2524    );
    2625}
  • woo-billing-with-invoicexpress/trunk/vendor/index.php

    r3030021 r3481120  
    1 <?php // Silence is golden
     1<?php
     2/**
     3 * Silence is golden
     4 */
  • woo-billing-with-invoicexpress/trunk/woocommerce-billing-invoicexpress-standard-edition.php

    r3369891 r3481120  
    33 * Plugin Name:          Invoicing with InvoiceXpress for WooCommerce - Free
    44 * Plugin URI:           https://invoicewoo.com
    5  * Version:              7.2
     5 * Version:              8.0
    66 * Description:          WooCommerce legal invoicing made easy with InvoiceXpress integration.
    77 * Author:               Naked Cat Plugins (by Webdados)
     
    99 * Text Domain:          woo-billing-with-invoicexpress
    1010 * Requires at least:    5.8
    11  * Tested up to:         6.9
     11 * Tested up to:         7.0
    1212 * Requires PHP:         7.2
    1313 * WC requires at least: 7.1
    14  * WC tested up to:      10.2
     14 * WC tested up to:      10.6
    1515 * Requires Plugins:     woocommerce
    1616 */
Note: See TracChangeset for help on using the changeset viewer.