Changeset 3481120
- Timestamp:
- 03/12/2026 11:49:10 AM (2 weeks ago)
- Location:
- woo-billing-with-invoicexpress
- Files:
-
- 72 edited
- 1 copied
-
tags/8.0 (copied) (copied from woo-billing-with-invoicexpress/trunk)
-
tags/8.0/assets/images/index.php (modified) (1 diff)
-
tags/8.0/assets/index.php (modified) (1 diff)
-
tags/8.0/assets/js/index.php (modified) (1 diff)
-
tags/8.0/includes/BaseController.php (modified) (27 diffs)
-
tags/8.0/includes/BaseMenu.php (modified) (3 diffs)
-
tags/8.0/includes/BaseSettings.php (modified) (2 diffs)
-
tags/8.0/includes/ClientChecker.php (modified) (1 diff)
-
tags/8.0/includes/Menu/Menu.php (modified) (2 diffs)
-
tags/8.0/includes/Menu/index.php (modified) (1 diff)
-
tags/8.0/includes/Modules/Invoice/InvoiceController.php (modified) (1 diff)
-
tags/8.0/includes/Modules/Invoice/index.php (modified) (1 diff)
-
tags/8.0/includes/Modules/SimplifiedInvoice/SimplifiedInvoiceController.php (modified) (1 diff)
-
tags/8.0/includes/Modules/SimplifiedInvoice/index.php (modified) (1 diff)
-
tags/8.0/includes/Modules/Taxes/TaxController.php (modified) (1 diff)
-
tags/8.0/includes/Modules/Taxes/index.php (modified) (1 diff)
-
tags/8.0/includes/Modules/Vat/VatController.php (modified) (6 diffs)
-
tags/8.0/includes/Modules/Vat/index.php (modified) (1 diff)
-
tags/8.0/includes/Plugin.php (modified) (19 diffs)
-
tags/8.0/includes/ReDownloadPDF.php (modified) (1 diff)
-
tags/8.0/includes/Settings/Settings.php (modified) (4 diffs)
-
tags/8.0/includes/Settings/Tabs/API.php (modified) (2 diffs)
-
tags/8.0/includes/Settings/Tabs/index.php (modified) (1 diff)
-
tags/8.0/includes/Settings/index.php (modified) (1 diff)
-
tags/8.0/includes/UpgradeFunctions.php (modified) (2 diffs)
-
tags/8.0/includes/WoocommerceBlocks/index.php (modified) (1 diff)
-
tags/8.0/includes/index.php (modified) (1 diff)
-
tags/8.0/index.php (modified) (1 diff)
-
tags/8.0/vendor/autoload.php (modified) (1 diff)
-
tags/8.0/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
tags/8.0/vendor/composer/autoload_real.php (modified) (2 diffs)
-
tags/8.0/vendor/composer/autoload_static.php (modified) (4 diffs)
-
tags/8.0/vendor/composer/index.php (modified) (1 diff)
-
tags/8.0/vendor/composer/installed.php (modified) (2 diffs)
-
tags/8.0/vendor/composer/platform_check.php (modified) (1 diff)
-
tags/8.0/vendor/index.php (modified) (1 diff)
-
tags/8.0/woocommerce-billing-invoicexpress-standard-edition.php (modified) (2 diffs)
-
trunk/assets/images/index.php (modified) (1 diff)
-
trunk/assets/index.php (modified) (1 diff)
-
trunk/assets/js/index.php (modified) (1 diff)
-
trunk/includes/BaseController.php (modified) (27 diffs)
-
trunk/includes/BaseMenu.php (modified) (3 diffs)
-
trunk/includes/BaseSettings.php (modified) (2 diffs)
-
trunk/includes/ClientChecker.php (modified) (1 diff)
-
trunk/includes/Menu/Menu.php (modified) (2 diffs)
-
trunk/includes/Menu/index.php (modified) (1 diff)
-
trunk/includes/Modules/Invoice/InvoiceController.php (modified) (1 diff)
-
trunk/includes/Modules/Invoice/index.php (modified) (1 diff)
-
trunk/includes/Modules/SimplifiedInvoice/SimplifiedInvoiceController.php (modified) (1 diff)
-
trunk/includes/Modules/SimplifiedInvoice/index.php (modified) (1 diff)
-
trunk/includes/Modules/Taxes/TaxController.php (modified) (1 diff)
-
trunk/includes/Modules/Taxes/index.php (modified) (1 diff)
-
trunk/includes/Modules/Vat/VatController.php (modified) (6 diffs)
-
trunk/includes/Modules/Vat/index.php (modified) (1 diff)
-
trunk/includes/Plugin.php (modified) (19 diffs)
-
trunk/includes/ReDownloadPDF.php (modified) (1 diff)
-
trunk/includes/Settings/Settings.php (modified) (4 diffs)
-
trunk/includes/Settings/Tabs/API.php (modified) (2 diffs)
-
trunk/includes/Settings/Tabs/index.php (modified) (1 diff)
-
trunk/includes/Settings/index.php (modified) (1 diff)
-
trunk/includes/UpgradeFunctions.php (modified) (2 diffs)
-
trunk/includes/WoocommerceBlocks/index.php (modified) (1 diff)
-
trunk/includes/index.php (modified) (1 diff)
-
trunk/index.php (modified) (1 diff)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (4 diffs)
-
trunk/vendor/composer/index.php (modified) (1 diff)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/vendor/composer/platform_check.php (modified) (1 diff)
-
trunk/vendor/index.php (modified) (1 diff)
-
trunk/woocommerce-billing-invoicexpress-standard-edition.php (modified) (2 diffs)
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 4 4 5 5 use Webdados\InvoiceXpressWooCommerce\JsonRequest as JsonRequest; 6 7 /* WooCommerce CRUD ready */ 8 /* JSON API ready */ 9 /* WooCommerce HPOS ready 2023-07-13 */ 6 use Webdados\InvoiceXpressWooCommerce\Modules\Vat\VatController as VatController; 10 7 11 8 class BaseController { … … 300 297 * 301 298 * @since 2.1.7 302 * @param array $invoice_data The invoice data299 * @param array $invoice_data The invoice data 303 300 * @param object $order_object The order 304 301 * @param string $document_type The document type 305 302 */ 306 303 public function process_items( $invoice_data, $order_object, $document_type ) { 307 // Each item304 // Each item 308 305 foreach ( $invoice_data['items'] as $key => $item ) { 309 // Negative values?306 // Negative values? 310 307 if ( 311 308 $item['unit_price'] < 0 312 309 || 313 ( $item['ixwc']['unit_price'] < 0 && $document_type != 'credit_note' ) // We'll allow on credit notes for now310 ( $item['ixwc']['unit_price'] < 0 && $document_type != 'credit_note' ) // We'll allow on credit notes for now 314 311 ) { 315 312 $invoice_data['_prevent'] = true; 316 313 $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 now314 // We can get out now 318 315 return $invoice_data; 319 316 } 320 // Partial exemption - WHY? Who's using this?317 // Partial exemption - WHY? Who's using this? 321 318 if ( isset( $item['ixwc']['type'] ) ) { 322 // Set partial exemption if global exemption is not set - Really? http://contabilistas.info/index.php?topic=8818.0319 // Set partial exemption if global exemption is not set - Really? http://contabilistas.info/index.php?topic=8818.0 323 320 if ( empty( $invoice_data['tax_exemption'] ) && apply_filters( 'invoicexpress_woocommerce_partial_exemption', false ) ) { 324 switch ( $item['ixwc']['type'] ) {321 switch ( $item['ixwc']['type'] ) { 325 322 case 'item': 326 323 case 'shipping': 327 324 case 'fee': 328 325 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' ); 330 327 $invoice_data['tax_exemption'] = apply_filters( 'invoicexpress_woocommerce_partial_exemption_reason', $exemption, $item, $invoice_data, $order_object->get_id(), $document_type ); 331 328 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...) 334 331 } 335 332 break; … … 338 335 } 339 336 } 340 // Other stuff??341 // ...342 } 343 } 344 // Clear our extra information337 // Other stuff?? 338 // ... 339 } 340 } 341 // Clear our extra information 345 342 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( 351 350 '€', 352 351 ' ', … … 361 360 $invoice_data['items'][ $key ]['description'] = trim( str_replace( $search, $replace, wp_strip_all_tags( $item['description'] ) ) ); 362 361 } 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 370 378 return $invoice_data; 371 379 } … … 375 383 * 376 384 * @since 5.2 377 * @param array $invoice_data The invoice data385 * @param array $invoice_data The invoice data 378 386 * @param object $order_object The order 379 387 * @param string $document_type The document type … … 386 394 } 387 395 388 /* 396 /** 389 397 * Finds the sequence id for the provided document type. 390 398 * … … 399 407 $order_object = wc_get_order( $order_id ); 400 408 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 420 415 $cache = get_option( 'hd_wc_ie_plus_sequences_cache' ); 421 416 if ( is_array( $cache ) && count( $cache ) > 0 ) { 422 if ( isset( $cache[ $order_sequence_id]['current_' . $document_type . '_sequence_id'] ) ) {423 // Found in cache424 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 429 424 return ''; 430 425 } 431 426 432 /* 427 /** 433 428 * Stores the document as a order note and a custom field 434 429 */ … … 462 457 } 463 458 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' ); 467 462 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'; 472 467 473 468 $file_name = apply_filters( 'invoicexpress_woocommerce_document_filename', $file_name, $order_object, $document_url, $document_type, $invoicexpress_id, $another_doc ); … … 493 488 __( 'Download %1$s %2$s (%3$s): %4$s.', 'woo-billing-with-invoicexpress' ), 494 489 $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' ), 496 491 __( 'PDF', 'woo-billing-with-invoicexpress' ), 497 492 sprintf( … … 504 499 /* translators: %1$s: document name, %2$s: download link */ 505 500 __( '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 ], 507 502 sprintf( 508 503 '<a href="%1$s">%2$s</a>', … … 513 508 ); 514 509 $order_object->save(); 515 $ order_object->add_order_note($note );516 // Send it510 $this->plugin->add_order_note( $order_object, $note ); 511 // Send it 517 512 if ( get_option( 'hd_wc_ie_plus_send_'.$document_type ) ) { 518 switch ( $document_type ) {513 switch ( $document_type ) { 519 514 case 'transport_guide': 520 515 $email = get_option( 'hd_wc_ie_plus_transport_guide_email_address' ); … … 525 520 } 526 521 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' ); 528 523 do_action( 'invoicexpress_woocommerce_debug', 'storeAndNoteDocument will now send the invoice email', $order_object ); 529 524 $this->send_invoice_email( $email, $invoicexpress_id, $order_object->get_id(), $order_object, $attachment, $document_type ); … … 533 528 } 534 529 } 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 ); 536 531 } 537 532 } … … 557 552 ) 558 553 ); 559 $ order_object->add_order_note($note );554 $this->plugin->add_order_note( $order_object, $note ); 560 555 } 561 556 … … 572 567 do_action( 'invoicexpress_woocommerce_before_document_email', $order_object->get_id(), $document_type ); 573 568 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) 575 570 do_action( 'invoicexpress_woocommerce_debug', $this->plugin->type_names[ $document_type ].' email method: '.get_option( 'hd_wc_ie_plus_email_method' ), $order_object ); 576 571 //Send it … … 598 593 599 594 } else { 600 do_action( 'invoicexpress_woocommerce_error', 'getAndSendPDF ' .$this->plugin->type_names[$document_type].' PDF: No email address', $order_object );601 } 602 } 603 // Note it595 do_action( 'invoicexpress_woocommerce_error', 'getAndSendPDF ' . $this->plugin->type_names[ $document_type ] . ' PDF: No email address', $order_object ); 596 } 597 } 598 // Note it 604 599 $note = sprintf( 605 600 /* translators: %1$s: document name, %2$s document number, %3$s: PDF string, %4$s: PDF download link */ 606 601 __( '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' ), 609 604 __( 'PDF', 'woo-billing-with-invoicexpress' ), 610 605 sprintf( 611 606 '<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' ) ), 613 608 __( 'click here', 'woo-billing-with-invoicexpress' ) 614 609 ) 615 610 ); 616 $ order_object->add_order_note($note );611 $this->plugin->add_order_note( $order_object, $note ); 617 612 return true; 618 613 } else { 619 // WooCommerce method - with pending processing614 // WooCommerce method - with pending processing 620 615 do_action( 'invoicexpress_woocommerce_debug', 'getAndSendPDF '.$this->plugin->type_names[ $document_type ].' email method: WooCommerce', $order_object ); 621 616 … … 724 719 } 725 720 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 ); 727 722 $this->noteDocumentFailedPDF( $order_object, $document_type, $order_id_invoicexpress ); 728 723 if ( get_option( 'hd_wc_ie_plus_automatic_email_errors' ) && ( $mode === 'automatic' || $mode === 'scheduled' ) ) { … … 744 739 745 740 $document_url = $return['object']->output->pdfUrl; 746 if ( $document_type == 'receipt' && $receipt_count > 1 ) {741 if ( $document_type === 'receipt' && $receipt_count > 1 ) { 747 742 $this->storeAndNoteDocument( $order_object, $document_url, $document_type, $order_id_invoicexpress, '_2' ); 748 743 } else { … … 840 835 841 836 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 ); 843 838 } 844 839 … … 870 865 $placeholders['{order_date}'] = apply_filters( 'invoicexpress_woocommerce_email_order_date', trim( wc_format_datetime( $order_object->get_date_created() ) ), $order_object ); 871 866 $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 ); 877 874 878 875 $subject = $this->plugin->get_translated_option( "hd_wc_ie_plus_{$document_type}_email_subject", null, $order_object ); … … 899 896 if ( $this->can_send_non_woocommerce_email( get_option( 'hd_wc_ie_plus_email_method' ), $order_object ) ) { 900 897 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; 903 900 } else { 904 901 do_action( 'invoicexpress_woocommerce_debug', 'send_invoice_email '.$this->plugin->type_names[ $document_type ].' email method: WooCommerce', $order_object ); … … 906 903 907 904 if ( $attachment_url ) { 908 $url_explode = explode( '/', $attachment_url );905 $url_explode = explode( '/', $attachment_url ); 909 906 $wp_upload_path = wp_upload_dir(); 910 907 $plugin_path = $wp_upload_path['basedir']; … … 946 943 remove_filter( 'wp_mail_content_type', array( $this->plugin, 'set_email_to_html' ) ); 947 944 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( 953 949 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' ) : '' 957 955 ) 958 956 ); 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' ); 960 965 do_action( 'invoicexpress_woocommerce_error', $note, $order_object ); 961 966 } … … 1042 1047 ); 1043 1048 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 ); 1046 1051 } 1047 1052 … … 1225 1230 ) 1226 1231 ); 1227 $ order_object->add_order_note($note );1232 $this->plugin->add_order_note( $order_object, $note ); 1228 1233 break; 1229 1234 } … … 1250 1255 ) 1251 1256 ); 1252 $ order_object->add_order_note($note );1257 $this->plugin->add_order_note( $order_object, $note ); 1253 1258 } else { 1254 1259 if ( ! $this->getAndSendPDF( $order_object, $document_type, $order_id_invoicexpress, $mode ) ) { … … 1360 1365 do_action( 'invoicexpress_woocommerce_error', $error_notice, $order_object ); 1361 1366 } 1362 // But we should add it to the order notes anyway1367 // But we should add it to the order notes anyway 1363 1368 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'] ); 1365 1370 } 1366 1371 } -
woo-billing-with-invoicexpress/tags/8.0/includes/BaseMenu.php
r3272591 r3481120 321 321 } 322 322 323 // Plugin update323 // Plugin update 324 324 if ( $( '.ix_api_version_update' ).length ) { 325 325 … … 332 332 var data = { 333 333 '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' ) ); ?>' 335 336 }; 336 337 jQuery.post(ajaxurl, data, function( response ) { … … 402 403 array( 403 404 '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' ), 405 406 ), 406 407 array( 407 408 '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' ), 409 410 ), 410 411 array( 411 412 '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' ), 413 414 ), 414 415 array( 415 416 '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' ), 417 418 ), 418 419 array( 419 420 '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' ), 421 422 ), 422 423 ); -
woo-billing-with-invoicexpress/tags/8.0/includes/BaseSettings.php
r3331470 r3481120 6 6 use Webdados\InvoiceXpressWooCommerce\BaseController as BaseController; 7 7 use Webdados\InvoiceXpressWooCommerce\JsonRequest as JsonRequest; 8 9 /* WooCommerce CRUD ready */10 /* JSON API ready */11 /* WooCommerce HPOS ready 2023-07-13 */12 8 13 9 class BaseSettings { … … 702 698 ); 703 699 $json_request = new JsonRequest( $params ); 704 $return = $json_request->getRequest();700 $return = $json_request->getRequest(); 705 701 if ( $return['success'] ) { 706 702 $cache_id = ''; -
woo-billing-with-invoicexpress/tags/8.0/includes/ClientChecker.php
r3037536 r3481120 4 4 use Webdados\InvoiceXpressWooCommerce\JsonRequest as JsonRequest; 5 5 use Webdados\InvoiceXpressWooCommerce\CountryTranslation as CountryTranslation; 6 7 /* WooCommerce CRUD ready */8 /* JSON API ready */9 /* WooCommerce HPOS ready 2023-07-13 */10 6 11 7 class ClientChecker { -
woo-billing-with-invoicexpress/tags/8.0/includes/Menu/Menu.php
r2938248 r3481120 3 3 namespace Webdados\InvoiceXpressWooCommerce\Menu; 4 4 5 use \Webdados\InvoiceXpressWooCommerce\Notices; 5 6 use \Webdados\InvoiceXpressWooCommerce\Settings\Settings; 6 7 … … 22 23 public function register_hooks() { 23 24 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 () { 26 29 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 32 44 } 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 ); 40 46 41 47 } -
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 6 6 use Webdados\InvoiceXpressWooCommerce\ClientChecker as ClientChecker; 7 7 use Webdados\InvoiceXpressWooCommerce\Notices as Notices; 8 9 /* WooCommerce CRUD ready */10 /* JSON API ready */11 /* WooCommerce HPOS ready 2023-07-12 */12 8 13 9 class 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 6 6 use Webdados\InvoiceXpressWooCommerce\ClientChecker as ClientChecker; 7 7 use Webdados\InvoiceXpressWooCommerce\Notices as Notices; 8 9 /* WooCommerce CRUD ready */10 /* JSON API ready */11 /* WooCommerce HPOS ready 2023-07-13 */12 8 13 9 class 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 4 4 use Webdados\InvoiceXpressWooCommerce\BaseController as BaseController; 5 5 use Webdados\InvoiceXpressWooCommerce\Modules\Vat\VatController as VatController; 6 7 /* WooCommerce CRUD ready */8 /* WooCommerce HPOS ready 2023-01-17 */9 6 10 7 class 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 1 1 <?php 2 2 namespace Webdados\InvoiceXpressWooCommerce\Modules\Vat; 3 4 // WooCommerce CRUD ready5 // WooCommerce HPOS ready 2023-07-136 3 7 4 /** … … 198 195 */ 199 196 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 201 200 global $current_user; 202 201 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>', 204 209 __( 'VAT number', 'woo-billing-with-invoicexpress' ), 205 210 INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD, 206 211 esc_attr( get_user_meta( $current_user->ID, INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD, true ) ) 207 212 ); 208 //}213 } 209 214 } 210 215 … … 220 225 */ 221 226 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 ); 228 242 } 229 243 } 230 update_user_meta( $user_id, INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD, $vat_number );231 244 } 232 245 } … … 264 277 */ 265 278 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 ) ) { 267 280 $custom_attributes = array(); 268 281 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' ) ) ) { … … 419 432 * @param \WP_Error $errors The errors object. 420 433 */ 421 public function validate_vat_frontend( &$data, &$errors ) {434 public function validate_vat_frontend( $data, $errors ) { 422 435 $vat_number = isset( $data[ INVOICEXPRESS_WOOCOMMERCE_VAT_CHECKOUT_FIELD ] ) ? $this->sanitize_vat_field( $data[ INVOICEXPRESS_WOOCOMMERCE_VAT_CHECKOUT_FIELD ] ) : ''; 423 436 // Required? - WooCommerce already makes this validation … … 425 438 if ( ! empty( $vat_number ) && ( isset( $data['billing_country'] ) && $data['billing_country'] === 'PT' ) ) { 426 439 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 ); 428 445 } 429 446 } -
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 5 5 namespace Webdados\InvoiceXpressWooCommerce; 6 6 7 /* WooCommerce CRUD ready */8 /* WooCommerce HPOS ready 2023-07-13 */9 10 7 class Plugin { 11 8 … … 16 13 * @var string 17 14 */ 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'; 22 22 23 23 /** … … 29 29 30 30 /** 31 * Initialize the class and set its properties. 32 * 33 * @since 2.3.0 34 */ 35 public function __construct() { 36 } 37 38 /** 31 39 * Load the dependencies, define the locale, and set the hooks for the Dashboard and 32 40 * the public-facing side of the site. … … 35 43 */ 36 44 public function run() { 37 $this->set_locale();38 45 $this->set_document_type_names(); 39 46 $this->define_hooks(); 40 }41 42 /**43 * Define the locale for this plugin for internationalization.44 *45 * @since 2.0.046 */47 public function set_locale() {48 // Load translations - On init (after after_setup_theme) since WordPress 6.7 to avoid load_plugin_textdomain notices49 add_action(50 'init',51 function () {52 load_plugin_textdomain( 'woo-billing-with-invoicexpress' );53 }54 );55 47 } 56 48 … … 89 81 public function get_create_documents_options() { 90 82 foreach ( $this->type_names as $key => $name ) { 91 // Deal with inconsistencies on the database options92 switch ( $key ) {83 // Deal with inconsistencies on the database options 84 switch ( $key ) { 93 85 case 'invoice_receipt': 94 86 case 'quote': 95 87 case 'devolution_guide': 96 $option = 'hd_wc_ie_plus_' .$key;88 $option = 'hd_wc_ie_plus_' . $key; 97 89 break; 98 90 case 'receipt': … … 100 92 break; 101 93 default: 102 $option = 'hd_wc_ie_plus_create_' .$key;94 $option = 'hd_wc_ie_plus_create_' . $key; 103 95 break; 104 96 } 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 ); 106 99 } 107 100 } … … 115 108 public function define_hooks() { 116 109 $settings = new Settings\Settings( $this ); 117 $modules = array(110 $modules = array( 118 111 $settings, 119 112 new Menu\Menu( $settings, $this ), … … 152 145 */ 153 146 public function admin_register_scripts_and_styles() { 154 // WooCommerce Admin Notices compatibility147 // WooCommerce Admin Notices compatibility 155 148 if ( function_exists( 'wc_admin_url' ) ) { 156 149 if ( version_compare( \WC_ADMIN_VERSION_NUMBER, '0.23.2', '>=' ) ) { … … 158 151 $register = \Automattic\WooCommerce\Admin\PageController::is_admin_page() || \Automattic\WooCommerce\Admin\PageController::is_embed_page(); 159 152 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 ); 161 154 wp_enqueue_script( 'hd_wc_ie_woocommerce_admin_notices' ); 162 155 } … … 176 169 return; 177 170 } 178 include ( 'UpgradeFunctions.php' );171 include 'UpgradeFunctions.php'; 179 172 $upgradeFunctions = new UpgradeFunctions( $this ); 180 173 } … … 186 179 */ 187 180 public function create_scheduled_docs_table() { 188 // Create table for scheduled automatic documents181 // Create table for scheduled automatic documents 189 182 global $wpdb; 190 $table_name = $wpdb->prefix.$this->scheduled_docs_table;183 $table_name = $wpdb->prefix . $this->scheduled_docs_table; 191 184 $wpdb_collate = $wpdb->collate; 192 $sql =185 $sql = 193 186 "CREATE TABLE {$table_name} ( 194 187 task_id bigint(20) UNSIGNED NOT NULL auto_increment, … … 199 192 ) 200 193 COLLATE {$wpdb_collate}"; 201 require_once ( ABSPATH . 'wp-admin/includes/upgrade.php' );194 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 202 195 dbDelta( $sql ); 203 196 do_action( 'invoicexpress_woocommerce_debug', "Created {$table_name} table" ); … … 205 198 public function maybe_create_scheduled_docs_table() { 206 199 global $wpdb; 207 $table = $wpdb->prefix .$this->scheduled_docs_table;200 $table = $wpdb->prefix . $this->scheduled_docs_table; 208 201 $query = "SHOW TABLES LIKE '{$table}'"; 209 202 if ( ! $wpdb->get_row( $query ) ) { … … 233 226 234 227 /** 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 236 239 * 237 240 * @since 2.0.7 … … 264 267 265 268 /** 266 * Convert document type to endpoint, as some In ovoiceXpress endpoints are not coherent269 * Convert document type to endpoint, as some InvoiceXpress endpoints are not coherent 267 270 * 268 271 * @since 3.0.0 … … 271 274 public function document_type_to_endpoint( $document_type, $convert_receipt = false ) { 272 275 $endpoint = $document_type; 273 switch ( $document_type ) {276 switch ( $document_type ) { 274 277 case 'transport_guide': 275 278 $endpoint = 'transport'; … … 279 282 break; 280 283 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 } 283 288 break; 284 289 } … … 304 309 /** 305 310 * Helper to get $order on order edit screens 306 * 311 * 307 312 * @since 4.0 308 313 * @return object 309 314 */ 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 ) { 311 316 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; 313 318 } else { 314 319 global $post_type, $post; 315 320 if ( $this->hpos_enabled ) { 316 321 $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 ) { 318 327 global $theorder; 319 328 return $theorder; 320 329 } 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 322 341 return wc_get_order( $post->ID ); 323 342 } … … 336 355 } 337 356 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 } 338 380 } -
woo-billing-with-invoicexpress/tags/8.0/includes/ReDownloadPDF.php
r3037536 r3481120 3 3 4 4 use Webdados\InvoiceXpressWooCommerce\JsonRequest as JsonRequest; 5 6 /* WooCommerce CRUD ready */7 /* JSON API ready */8 /* WooCommerce HPOS ready 2023-07-13 */9 5 10 6 if ( ! defined( 'ABSPATH' ) ) { -
woo-billing-with-invoicexpress/tags/8.0/includes/Settings/Settings.php
r2938248 r3481120 19 19 * Initialize the class and set its properties. 20 20 * 21 * @since 2.5 21 * @since 2.0.4 Add plugin instance parameter. 22 * @since 2.0.0 22 23 * @param Plugin $plugin This plugin's instance. 23 24 */ 24 25 public function __construct( Plugin $plugin ) { 25 26 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 ); 26 29 } 27 30 … … 61 64 public function update_option_hd_wc_ie_plus_subdomain( $old_value, $new_value ) { 62 65 //if ( $old_value != '' ) { 63 // Delete options66 // Delete options 64 67 $options_to_delete = array( 65 68 'hd_wc_ie_plus_default_tax', … … 71 74 delete_option( $option ); 72 75 } 73 // Warn user76 // Warn user 74 77 Notices::add_notice( 75 78 __( 'You need to re-set the sequences and taxes settings because you changed the InvoiceXpress API credentials.', 'woo-billing-with-invoicexpress' ), … … 78 81 //} 79 82 } 80 83 81 84 } -
woo-billing-with-invoicexpress/tags/8.0/includes/Settings/Tabs/API.php
r2938248 r3481120 36 36 'title' => __( 'Subdomain', 'woo-billing-with-invoicexpress' ), 37 37 /* translators: %s: InvoiceXpress account name */ 38 'description' => sprintf( _ _( '%son InvoiceXpress', 'woo-billing-with-invoicexpress' ), 'ACCOUNT_NAME' ),38 'description' => sprintf( _x( '%s on InvoiceXpress', 'Account name on InvoiceXpress', 'woo-billing-with-invoicexpress' ), 'ACCOUNT_NAME' ), 39 39 'type' => 'text', 40 40 'custom_attributes' => array( … … 45 45 'title' => __( 'API key', 'woo-billing-with-invoicexpress' ), 46 46 /* translators: %s: InvoiceXpress API key */ 47 'description' => sprintf( _ _( '%son 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', 49 49 'custom_attributes' => array( 50 50 '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 37 37 if ( version_compare( $db_version, '4.2', '<' ) ) { 38 38 $this->upgrade_4_2(); 39 } 40 if ( version_compare( $db_version, '7.9', '<' ) ) { 41 $this->upgrade_8_0(); 39 42 } 40 43 // Create table for scheduled automatic documents, if it doesn't exists yet … … 132 135 } 133 136 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 134 150 } -
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 20 20 require_once __DIR__ . '/composer/autoload_real.php'; 21 21 22 return ComposerAutoloaderInit 4458ff8c0f9f78deecee213e2259a43f::getLoader();22 return ComposerAutoloaderInit67d0e88033cb04896c2abfc071fbec3b::getLoader(); -
woo-billing-with-invoicexpress/tags/8.0/vendor/composer/autoload_classmap.php
r3062101 r3481120 8 8 return array( 9 9 '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', 10 35 ); -
woo-billing-with-invoicexpress/tags/8.0/vendor/composer/autoload_real.php
r3062101 r3481120 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 4458ff8c0f9f78deecee213e2259a43f5 class ComposerAutoloaderInit67d0e88033cb04896c2abfc071fbec3b 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 4458ff8c0f9f78deecee213e2259a43f', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit67d0e88033cb04896c2abfc071fbec3b', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 4458ff8c0f9f78deecee213e2259a43f', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit67d0e88033cb04896c2abfc071fbec3b', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 4458ff8c0f9f78deecee213e2259a43f::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b::getInitializer($loader)); 33 33 34 34 $loader->register(true); -
woo-billing-with-invoicexpress/tags/8.0/vendor/composer/autoload_static.php
r3062101 r3481120 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 4458ff8c0f9f78deecee213e2259a43f7 class ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( 10 'W' => 10 'W' => 11 11 array ( 12 12 'Webdados\\InvoiceXpressWooCommerce\\' => 34, … … 15 15 16 16 public static $prefixDirsPsr4 = array ( 17 'Webdados\\InvoiceXpressWooCommerce\\' => 17 'Webdados\\InvoiceXpressWooCommerce\\' => 18 18 array ( 19 19 0 => __DIR__ . '/../..' . '/includes', … … 23 23 public static $classMap = array ( 24 24 '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', 25 50 ); 26 51 … … 28 53 { 29 54 return \Closure::bind(function () use ($loader) { 30 $loader->prefixLengthsPsr4 = ComposerStaticInit 4458ff8c0f9f78deecee213e2259a43f::$prefixLengthsPsr4;31 $loader->prefixDirsPsr4 = ComposerStaticInit 4458ff8c0f9f78deecee213e2259a43f::$prefixDirsPsr4;32 $loader->classMap = ComposerStaticInit 4458ff8c0f9f78deecee213e2259a43f::$classMap;55 $loader->prefixLengthsPsr4 = ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b::$prefixLengthsPsr4; 56 $loader->prefixDirsPsr4 = ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b::$prefixDirsPsr4; 57 $loader->classMap = ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b::$classMap; 33 58 34 59 }, 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 2 2 'root' => array( 3 3 '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', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 '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', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', -
woo-billing-with-invoicexpress/tags/8.0/vendor/composer/platform_check.php
r3062101 r3481120 20 20 } 21 21 } 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) 25 24 ); 26 25 } -
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 3 3 * Plugin Name: Invoicing with InvoiceXpress for WooCommerce - Free 4 4 * Plugin URI: https://invoicewoo.com 5 * Version: 7.25 * Version: 8.0 6 6 * Description: WooCommerce legal invoicing made easy with InvoiceXpress integration. 7 7 * Author: Naked Cat Plugins (by Webdados) … … 9 9 * Text Domain: woo-billing-with-invoicexpress 10 10 * Requires at least: 5.8 11 * Tested up to: 6.911 * Tested up to: 7.0 12 12 * Requires PHP: 7.2 13 13 * WC requires at least: 7.1 14 * WC tested up to: 10. 214 * WC tested up to: 10.6 15 15 * Requires Plugins: woocommerce 16 16 */ -
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 4 4 5 5 use Webdados\InvoiceXpressWooCommerce\JsonRequest as JsonRequest; 6 7 /* WooCommerce CRUD ready */ 8 /* JSON API ready */ 9 /* WooCommerce HPOS ready 2023-07-13 */ 6 use Webdados\InvoiceXpressWooCommerce\Modules\Vat\VatController as VatController; 10 7 11 8 class BaseController { … … 300 297 * 301 298 * @since 2.1.7 302 * @param array $invoice_data The invoice data299 * @param array $invoice_data The invoice data 303 300 * @param object $order_object The order 304 301 * @param string $document_type The document type 305 302 */ 306 303 public function process_items( $invoice_data, $order_object, $document_type ) { 307 // Each item304 // Each item 308 305 foreach ( $invoice_data['items'] as $key => $item ) { 309 // Negative values?306 // Negative values? 310 307 if ( 311 308 $item['unit_price'] < 0 312 309 || 313 ( $item['ixwc']['unit_price'] < 0 && $document_type != 'credit_note' ) // We'll allow on credit notes for now310 ( $item['ixwc']['unit_price'] < 0 && $document_type != 'credit_note' ) // We'll allow on credit notes for now 314 311 ) { 315 312 $invoice_data['_prevent'] = true; 316 313 $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 now314 // We can get out now 318 315 return $invoice_data; 319 316 } 320 // Partial exemption - WHY? Who's using this?317 // Partial exemption - WHY? Who's using this? 321 318 if ( isset( $item['ixwc']['type'] ) ) { 322 // Set partial exemption if global exemption is not set - Really? http://contabilistas.info/index.php?topic=8818.0319 // Set partial exemption if global exemption is not set - Really? http://contabilistas.info/index.php?topic=8818.0 323 320 if ( empty( $invoice_data['tax_exemption'] ) && apply_filters( 'invoicexpress_woocommerce_partial_exemption', false ) ) { 324 switch ( $item['ixwc']['type'] ) {321 switch ( $item['ixwc']['type'] ) { 325 322 case 'item': 326 323 case 'shipping': 327 324 case 'fee': 328 325 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' ); 330 327 $invoice_data['tax_exemption'] = apply_filters( 'invoicexpress_woocommerce_partial_exemption_reason', $exemption, $item, $invoice_data, $order_object->get_id(), $document_type ); 331 328 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...) 334 331 } 335 332 break; … … 338 335 } 339 336 } 340 // Other stuff??341 // ...342 } 343 } 344 // Clear our extra information337 // Other stuff?? 338 // ... 339 } 340 } 341 // Clear our extra information 345 342 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( 351 350 '€', 352 351 ' ', … … 361 360 $invoice_data['items'][ $key ]['description'] = trim( str_replace( $search, $replace, wp_strip_all_tags( $item['description'] ) ) ); 362 361 } 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 370 378 return $invoice_data; 371 379 } … … 375 383 * 376 384 * @since 5.2 377 * @param array $invoice_data The invoice data385 * @param array $invoice_data The invoice data 378 386 * @param object $order_object The order 379 387 * @param string $document_type The document type … … 386 394 } 387 395 388 /* 396 /** 389 397 * Finds the sequence id for the provided document type. 390 398 * … … 399 407 $order_object = wc_get_order( $order_id ); 400 408 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 420 415 $cache = get_option( 'hd_wc_ie_plus_sequences_cache' ); 421 416 if ( is_array( $cache ) && count( $cache ) > 0 ) { 422 if ( isset( $cache[ $order_sequence_id]['current_' . $document_type . '_sequence_id'] ) ) {423 // Found in cache424 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 429 424 return ''; 430 425 } 431 426 432 /* 427 /** 433 428 * Stores the document as a order note and a custom field 434 429 */ … … 462 457 } 463 458 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' ); 467 462 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'; 472 467 473 468 $file_name = apply_filters( 'invoicexpress_woocommerce_document_filename', $file_name, $order_object, $document_url, $document_type, $invoicexpress_id, $another_doc ); … … 493 488 __( 'Download %1$s %2$s (%3$s): %4$s.', 'woo-billing-with-invoicexpress' ), 494 489 $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' ), 496 491 __( 'PDF', 'woo-billing-with-invoicexpress' ), 497 492 sprintf( … … 504 499 /* translators: %1$s: document name, %2$s: download link */ 505 500 __( '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 ], 507 502 sprintf( 508 503 '<a href="%1$s">%2$s</a>', … … 513 508 ); 514 509 $order_object->save(); 515 $ order_object->add_order_note($note );516 // Send it510 $this->plugin->add_order_note( $order_object, $note ); 511 // Send it 517 512 if ( get_option( 'hd_wc_ie_plus_send_'.$document_type ) ) { 518 switch ( $document_type ) {513 switch ( $document_type ) { 519 514 case 'transport_guide': 520 515 $email = get_option( 'hd_wc_ie_plus_transport_guide_email_address' ); … … 525 520 } 526 521 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' ); 528 523 do_action( 'invoicexpress_woocommerce_debug', 'storeAndNoteDocument will now send the invoice email', $order_object ); 529 524 $this->send_invoice_email( $email, $invoicexpress_id, $order_object->get_id(), $order_object, $attachment, $document_type ); … … 533 528 } 534 529 } 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 ); 536 531 } 537 532 } … … 557 552 ) 558 553 ); 559 $ order_object->add_order_note($note );554 $this->plugin->add_order_note( $order_object, $note ); 560 555 } 561 556 … … 572 567 do_action( 'invoicexpress_woocommerce_before_document_email', $order_object->get_id(), $document_type ); 573 568 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) 575 570 do_action( 'invoicexpress_woocommerce_debug', $this->plugin->type_names[ $document_type ].' email method: '.get_option( 'hd_wc_ie_plus_email_method' ), $order_object ); 576 571 //Send it … … 598 593 599 594 } else { 600 do_action( 'invoicexpress_woocommerce_error', 'getAndSendPDF ' .$this->plugin->type_names[$document_type].' PDF: No email address', $order_object );601 } 602 } 603 // Note it595 do_action( 'invoicexpress_woocommerce_error', 'getAndSendPDF ' . $this->plugin->type_names[ $document_type ] . ' PDF: No email address', $order_object ); 596 } 597 } 598 // Note it 604 599 $note = sprintf( 605 600 /* translators: %1$s: document name, %2$s document number, %3$s: PDF string, %4$s: PDF download link */ 606 601 __( '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' ), 609 604 __( 'PDF', 'woo-billing-with-invoicexpress' ), 610 605 sprintf( 611 606 '<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' ) ), 613 608 __( 'click here', 'woo-billing-with-invoicexpress' ) 614 609 ) 615 610 ); 616 $ order_object->add_order_note($note );611 $this->plugin->add_order_note( $order_object, $note ); 617 612 return true; 618 613 } else { 619 // WooCommerce method - with pending processing614 // WooCommerce method - with pending processing 620 615 do_action( 'invoicexpress_woocommerce_debug', 'getAndSendPDF '.$this->plugin->type_names[ $document_type ].' email method: WooCommerce', $order_object ); 621 616 … … 724 719 } 725 720 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 ); 727 722 $this->noteDocumentFailedPDF( $order_object, $document_type, $order_id_invoicexpress ); 728 723 if ( get_option( 'hd_wc_ie_plus_automatic_email_errors' ) && ( $mode === 'automatic' || $mode === 'scheduled' ) ) { … … 744 739 745 740 $document_url = $return['object']->output->pdfUrl; 746 if ( $document_type == 'receipt' && $receipt_count > 1 ) {741 if ( $document_type === 'receipt' && $receipt_count > 1 ) { 747 742 $this->storeAndNoteDocument( $order_object, $document_url, $document_type, $order_id_invoicexpress, '_2' ); 748 743 } else { … … 840 835 841 836 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 ); 843 838 } 844 839 … … 870 865 $placeholders['{order_date}'] = apply_filters( 'invoicexpress_woocommerce_email_order_date', trim( wc_format_datetime( $order_object->get_date_created() ) ), $order_object ); 871 866 $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 ); 877 874 878 875 $subject = $this->plugin->get_translated_option( "hd_wc_ie_plus_{$document_type}_email_subject", null, $order_object ); … … 899 896 if ( $this->can_send_non_woocommerce_email( get_option( 'hd_wc_ie_plus_email_method' ), $order_object ) ) { 900 897 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; 903 900 } else { 904 901 do_action( 'invoicexpress_woocommerce_debug', 'send_invoice_email '.$this->plugin->type_names[ $document_type ].' email method: WooCommerce', $order_object ); … … 906 903 907 904 if ( $attachment_url ) { 908 $url_explode = explode( '/', $attachment_url );905 $url_explode = explode( '/', $attachment_url ); 909 906 $wp_upload_path = wp_upload_dir(); 910 907 $plugin_path = $wp_upload_path['basedir']; … … 946 943 remove_filter( 'wp_mail_content_type', array( $this->plugin, 'set_email_to_html' ) ); 947 944 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( 953 949 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' ) : '' 957 955 ) 958 956 ); 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' ); 960 965 do_action( 'invoicexpress_woocommerce_error', $note, $order_object ); 961 966 } … … 1042 1047 ); 1043 1048 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 ); 1046 1051 } 1047 1052 … … 1225 1230 ) 1226 1231 ); 1227 $ order_object->add_order_note($note );1232 $this->plugin->add_order_note( $order_object, $note ); 1228 1233 break; 1229 1234 } … … 1250 1255 ) 1251 1256 ); 1252 $ order_object->add_order_note($note );1257 $this->plugin->add_order_note( $order_object, $note ); 1253 1258 } else { 1254 1259 if ( ! $this->getAndSendPDF( $order_object, $document_type, $order_id_invoicexpress, $mode ) ) { … … 1360 1365 do_action( 'invoicexpress_woocommerce_error', $error_notice, $order_object ); 1361 1366 } 1362 // But we should add it to the order notes anyway1367 // But we should add it to the order notes anyway 1363 1368 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'] ); 1365 1370 } 1366 1371 } -
woo-billing-with-invoicexpress/trunk/includes/BaseMenu.php
r3272591 r3481120 321 321 } 322 322 323 // Plugin update323 // Plugin update 324 324 if ( $( '.ix_api_version_update' ).length ) { 325 325 … … 332 332 var data = { 333 333 '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' ) ); ?>' 335 336 }; 336 337 jQuery.post(ajaxurl, data, function( response ) { … … 402 403 array( 403 404 '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' ), 405 406 ), 406 407 array( 407 408 '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' ), 409 410 ), 410 411 array( 411 412 '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' ), 413 414 ), 414 415 array( 415 416 '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' ), 417 418 ), 418 419 array( 419 420 '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' ), 421 422 ), 422 423 ); -
woo-billing-with-invoicexpress/trunk/includes/BaseSettings.php
r3331470 r3481120 6 6 use Webdados\InvoiceXpressWooCommerce\BaseController as BaseController; 7 7 use Webdados\InvoiceXpressWooCommerce\JsonRequest as JsonRequest; 8 9 /* WooCommerce CRUD ready */10 /* JSON API ready */11 /* WooCommerce HPOS ready 2023-07-13 */12 8 13 9 class BaseSettings { … … 702 698 ); 703 699 $json_request = new JsonRequest( $params ); 704 $return = $json_request->getRequest();700 $return = $json_request->getRequest(); 705 701 if ( $return['success'] ) { 706 702 $cache_id = ''; -
woo-billing-with-invoicexpress/trunk/includes/ClientChecker.php
r3037536 r3481120 4 4 use Webdados\InvoiceXpressWooCommerce\JsonRequest as JsonRequest; 5 5 use Webdados\InvoiceXpressWooCommerce\CountryTranslation as CountryTranslation; 6 7 /* WooCommerce CRUD ready */8 /* JSON API ready */9 /* WooCommerce HPOS ready 2023-07-13 */10 6 11 7 class ClientChecker { -
woo-billing-with-invoicexpress/trunk/includes/Menu/Menu.php
r2938248 r3481120 3 3 namespace Webdados\InvoiceXpressWooCommerce\Menu; 4 4 5 use \Webdados\InvoiceXpressWooCommerce\Notices; 5 6 use \Webdados\InvoiceXpressWooCommerce\Settings\Settings; 6 7 … … 22 23 public function register_hooks() { 23 24 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 () { 26 29 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 32 44 } 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 ); 40 46 41 47 } -
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 6 6 use Webdados\InvoiceXpressWooCommerce\ClientChecker as ClientChecker; 7 7 use Webdados\InvoiceXpressWooCommerce\Notices as Notices; 8 9 /* WooCommerce CRUD ready */10 /* JSON API ready */11 /* WooCommerce HPOS ready 2023-07-12 */12 8 13 9 class 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 6 6 use Webdados\InvoiceXpressWooCommerce\ClientChecker as ClientChecker; 7 7 use Webdados\InvoiceXpressWooCommerce\Notices as Notices; 8 9 /* WooCommerce CRUD ready */10 /* JSON API ready */11 /* WooCommerce HPOS ready 2023-07-13 */12 8 13 9 class 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 4 4 use Webdados\InvoiceXpressWooCommerce\BaseController as BaseController; 5 5 use Webdados\InvoiceXpressWooCommerce\Modules\Vat\VatController as VatController; 6 7 /* WooCommerce CRUD ready */8 /* WooCommerce HPOS ready 2023-01-17 */9 6 10 7 class 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 1 1 <?php 2 2 namespace Webdados\InvoiceXpressWooCommerce\Modules\Vat; 3 4 // WooCommerce CRUD ready5 // WooCommerce HPOS ready 2023-07-136 3 7 4 /** … … 198 195 */ 199 196 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 201 200 global $current_user; 202 201 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>', 204 209 __( 'VAT number', 'woo-billing-with-invoicexpress' ), 205 210 INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD, 206 211 esc_attr( get_user_meta( $current_user->ID, INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD, true ) ) 207 212 ); 208 //}213 } 209 214 } 210 215 … … 220 225 */ 221 226 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 ); 228 242 } 229 243 } 230 update_user_meta( $user_id, INVOICEXPRESS_WOOCOMMERCE_VAT_USER_FIELD, $vat_number );231 244 } 232 245 } … … 264 277 */ 265 278 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 ) ) { 267 280 $custom_attributes = array(); 268 281 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' ) ) ) { … … 419 432 * @param \WP_Error $errors The errors object. 420 433 */ 421 public function validate_vat_frontend( &$data, &$errors ) {434 public function validate_vat_frontend( $data, $errors ) { 422 435 $vat_number = isset( $data[ INVOICEXPRESS_WOOCOMMERCE_VAT_CHECKOUT_FIELD ] ) ? $this->sanitize_vat_field( $data[ INVOICEXPRESS_WOOCOMMERCE_VAT_CHECKOUT_FIELD ] ) : ''; 423 436 // Required? - WooCommerce already makes this validation … … 425 438 if ( ! empty( $vat_number ) && ( isset( $data['billing_country'] ) && $data['billing_country'] === 'PT' ) ) { 426 439 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 ); 428 445 } 429 446 } -
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 5 5 namespace Webdados\InvoiceXpressWooCommerce; 6 6 7 /* WooCommerce CRUD ready */8 /* WooCommerce HPOS ready 2023-07-13 */9 10 7 class Plugin { 11 8 … … 16 13 * @var string 17 14 */ 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'; 22 22 23 23 /** … … 29 29 30 30 /** 31 * Initialize the class and set its properties. 32 * 33 * @since 2.3.0 34 */ 35 public function __construct() { 36 } 37 38 /** 31 39 * Load the dependencies, define the locale, and set the hooks for the Dashboard and 32 40 * the public-facing side of the site. … … 35 43 */ 36 44 public function run() { 37 $this->set_locale();38 45 $this->set_document_type_names(); 39 46 $this->define_hooks(); 40 }41 42 /**43 * Define the locale for this plugin for internationalization.44 *45 * @since 2.0.046 */47 public function set_locale() {48 // Load translations - On init (after after_setup_theme) since WordPress 6.7 to avoid load_plugin_textdomain notices49 add_action(50 'init',51 function () {52 load_plugin_textdomain( 'woo-billing-with-invoicexpress' );53 }54 );55 47 } 56 48 … … 89 81 public function get_create_documents_options() { 90 82 foreach ( $this->type_names as $key => $name ) { 91 // Deal with inconsistencies on the database options92 switch ( $key ) {83 // Deal with inconsistencies on the database options 84 switch ( $key ) { 93 85 case 'invoice_receipt': 94 86 case 'quote': 95 87 case 'devolution_guide': 96 $option = 'hd_wc_ie_plus_' .$key;88 $option = 'hd_wc_ie_plus_' . $key; 97 89 break; 98 90 case 'receipt': … … 100 92 break; 101 93 default: 102 $option = 'hd_wc_ie_plus_create_' .$key;94 $option = 'hd_wc_ie_plus_create_' . $key; 103 95 break; 104 96 } 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 ); 106 99 } 107 100 } … … 115 108 public function define_hooks() { 116 109 $settings = new Settings\Settings( $this ); 117 $modules = array(110 $modules = array( 118 111 $settings, 119 112 new Menu\Menu( $settings, $this ), … … 152 145 */ 153 146 public function admin_register_scripts_and_styles() { 154 // WooCommerce Admin Notices compatibility147 // WooCommerce Admin Notices compatibility 155 148 if ( function_exists( 'wc_admin_url' ) ) { 156 149 if ( version_compare( \WC_ADMIN_VERSION_NUMBER, '0.23.2', '>=' ) ) { … … 158 151 $register = \Automattic\WooCommerce\Admin\PageController::is_admin_page() || \Automattic\WooCommerce\Admin\PageController::is_embed_page(); 159 152 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 ); 161 154 wp_enqueue_script( 'hd_wc_ie_woocommerce_admin_notices' ); 162 155 } … … 176 169 return; 177 170 } 178 include ( 'UpgradeFunctions.php' );171 include 'UpgradeFunctions.php'; 179 172 $upgradeFunctions = new UpgradeFunctions( $this ); 180 173 } … … 186 179 */ 187 180 public function create_scheduled_docs_table() { 188 // Create table for scheduled automatic documents181 // Create table for scheduled automatic documents 189 182 global $wpdb; 190 $table_name = $wpdb->prefix.$this->scheduled_docs_table;183 $table_name = $wpdb->prefix . $this->scheduled_docs_table; 191 184 $wpdb_collate = $wpdb->collate; 192 $sql =185 $sql = 193 186 "CREATE TABLE {$table_name} ( 194 187 task_id bigint(20) UNSIGNED NOT NULL auto_increment, … … 199 192 ) 200 193 COLLATE {$wpdb_collate}"; 201 require_once ( ABSPATH . 'wp-admin/includes/upgrade.php' );194 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 202 195 dbDelta( $sql ); 203 196 do_action( 'invoicexpress_woocommerce_debug', "Created {$table_name} table" ); … … 205 198 public function maybe_create_scheduled_docs_table() { 206 199 global $wpdb; 207 $table = $wpdb->prefix .$this->scheduled_docs_table;200 $table = $wpdb->prefix . $this->scheduled_docs_table; 208 201 $query = "SHOW TABLES LIKE '{$table}'"; 209 202 if ( ! $wpdb->get_row( $query ) ) { … … 233 226 234 227 /** 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 236 239 * 237 240 * @since 2.0.7 … … 264 267 265 268 /** 266 * Convert document type to endpoint, as some In ovoiceXpress endpoints are not coherent269 * Convert document type to endpoint, as some InvoiceXpress endpoints are not coherent 267 270 * 268 271 * @since 3.0.0 … … 271 274 public function document_type_to_endpoint( $document_type, $convert_receipt = false ) { 272 275 $endpoint = $document_type; 273 switch ( $document_type ) {276 switch ( $document_type ) { 274 277 case 'transport_guide': 275 278 $endpoint = 'transport'; … … 279 282 break; 280 283 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 } 283 288 break; 284 289 } … … 304 309 /** 305 310 * Helper to get $order on order edit screens 306 * 311 * 307 312 * @since 4.0 308 313 * @return object 309 314 */ 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 ) { 311 316 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; 313 318 } else { 314 319 global $post_type, $post; 315 320 if ( $this->hpos_enabled ) { 316 321 $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 ) { 318 327 global $theorder; 319 328 return $theorder; 320 329 } 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 322 341 return wc_get_order( $post->ID ); 323 342 } … … 336 355 } 337 356 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 } 338 380 } -
woo-billing-with-invoicexpress/trunk/includes/ReDownloadPDF.php
r3037536 r3481120 3 3 4 4 use Webdados\InvoiceXpressWooCommerce\JsonRequest as JsonRequest; 5 6 /* WooCommerce CRUD ready */7 /* JSON API ready */8 /* WooCommerce HPOS ready 2023-07-13 */9 5 10 6 if ( ! defined( 'ABSPATH' ) ) { -
woo-billing-with-invoicexpress/trunk/includes/Settings/Settings.php
r2938248 r3481120 19 19 * Initialize the class and set its properties. 20 20 * 21 * @since 2.5 21 * @since 2.0.4 Add plugin instance parameter. 22 * @since 2.0.0 22 23 * @param Plugin $plugin This plugin's instance. 23 24 */ 24 25 public function __construct( Plugin $plugin ) { 25 26 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 ); 26 29 } 27 30 … … 61 64 public function update_option_hd_wc_ie_plus_subdomain( $old_value, $new_value ) { 62 65 //if ( $old_value != '' ) { 63 // Delete options66 // Delete options 64 67 $options_to_delete = array( 65 68 'hd_wc_ie_plus_default_tax', … … 71 74 delete_option( $option ); 72 75 } 73 // Warn user76 // Warn user 74 77 Notices::add_notice( 75 78 __( 'You need to re-set the sequences and taxes settings because you changed the InvoiceXpress API credentials.', 'woo-billing-with-invoicexpress' ), … … 78 81 //} 79 82 } 80 83 81 84 } -
woo-billing-with-invoicexpress/trunk/includes/Settings/Tabs/API.php
r2938248 r3481120 36 36 'title' => __( 'Subdomain', 'woo-billing-with-invoicexpress' ), 37 37 /* translators: %s: InvoiceXpress account name */ 38 'description' => sprintf( _ _( '%son InvoiceXpress', 'woo-billing-with-invoicexpress' ), 'ACCOUNT_NAME' ),38 'description' => sprintf( _x( '%s on InvoiceXpress', 'Account name on InvoiceXpress', 'woo-billing-with-invoicexpress' ), 'ACCOUNT_NAME' ), 39 39 'type' => 'text', 40 40 'custom_attributes' => array( … … 45 45 'title' => __( 'API key', 'woo-billing-with-invoicexpress' ), 46 46 /* translators: %s: InvoiceXpress API key */ 47 'description' => sprintf( _ _( '%son 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', 49 49 'custom_attributes' => array( 50 50 '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 37 37 if ( version_compare( $db_version, '4.2', '<' ) ) { 38 38 $this->upgrade_4_2(); 39 } 40 if ( version_compare( $db_version, '7.9', '<' ) ) { 41 $this->upgrade_8_0(); 39 42 } 40 43 // Create table for scheduled automatic documents, if it doesn't exists yet … … 132 135 } 133 136 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 134 150 } -
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 20 20 require_once __DIR__ . '/composer/autoload_real.php'; 21 21 22 return ComposerAutoloaderInit 4458ff8c0f9f78deecee213e2259a43f::getLoader();22 return ComposerAutoloaderInit67d0e88033cb04896c2abfc071fbec3b::getLoader(); -
woo-billing-with-invoicexpress/trunk/vendor/composer/autoload_classmap.php
r3062101 r3481120 8 8 return array( 9 9 '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', 10 35 ); -
woo-billing-with-invoicexpress/trunk/vendor/composer/autoload_real.php
r3062101 r3481120 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 4458ff8c0f9f78deecee213e2259a43f5 class ComposerAutoloaderInit67d0e88033cb04896c2abfc071fbec3b 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 4458ff8c0f9f78deecee213e2259a43f', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit67d0e88033cb04896c2abfc071fbec3b', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 4458ff8c0f9f78deecee213e2259a43f', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit67d0e88033cb04896c2abfc071fbec3b', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 4458ff8c0f9f78deecee213e2259a43f::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b::getInitializer($loader)); 33 33 34 34 $loader->register(true); -
woo-billing-with-invoicexpress/trunk/vendor/composer/autoload_static.php
r3062101 r3481120 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 4458ff8c0f9f78deecee213e2259a43f7 class ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( 10 'W' => 10 'W' => 11 11 array ( 12 12 'Webdados\\InvoiceXpressWooCommerce\\' => 34, … … 15 15 16 16 public static $prefixDirsPsr4 = array ( 17 'Webdados\\InvoiceXpressWooCommerce\\' => 17 'Webdados\\InvoiceXpressWooCommerce\\' => 18 18 array ( 19 19 0 => __DIR__ . '/../..' . '/includes', … … 23 23 public static $classMap = array ( 24 24 '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', 25 50 ); 26 51 … … 28 53 { 29 54 return \Closure::bind(function () use ($loader) { 30 $loader->prefixLengthsPsr4 = ComposerStaticInit 4458ff8c0f9f78deecee213e2259a43f::$prefixLengthsPsr4;31 $loader->prefixDirsPsr4 = ComposerStaticInit 4458ff8c0f9f78deecee213e2259a43f::$prefixDirsPsr4;32 $loader->classMap = ComposerStaticInit 4458ff8c0f9f78deecee213e2259a43f::$classMap;55 $loader->prefixLengthsPsr4 = ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b::$prefixLengthsPsr4; 56 $loader->prefixDirsPsr4 = ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b::$prefixDirsPsr4; 57 $loader->classMap = ComposerStaticInit67d0e88033cb04896c2abfc071fbec3b::$classMap; 33 58 34 59 }, 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 2 2 'root' => array( 3 3 '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', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 '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', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', -
woo-billing-with-invoicexpress/trunk/vendor/composer/platform_check.php
r3062101 r3481120 20 20 } 21 21 } 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) 25 24 ); 26 25 } -
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 3 3 * Plugin Name: Invoicing with InvoiceXpress for WooCommerce - Free 4 4 * Plugin URI: https://invoicewoo.com 5 * Version: 7.25 * Version: 8.0 6 6 * Description: WooCommerce legal invoicing made easy with InvoiceXpress integration. 7 7 * Author: Naked Cat Plugins (by Webdados) … … 9 9 * Text Domain: woo-billing-with-invoicexpress 10 10 * Requires at least: 5.8 11 * Tested up to: 6.911 * Tested up to: 7.0 12 12 * Requires PHP: 7.2 13 13 * WC requires at least: 7.1 14 * WC tested up to: 10. 214 * WC tested up to: 10.6 15 15 * Requires Plugins: woocommerce 16 16 */
Note: See TracChangeset
for help on using the changeset viewer.