Booster for WooCommerce - Version 5.3.6

Version Description

  • 30/12/2020 =
  • Fix - CART & CHECKOUT - Checkout Custom Fields - Fix "Datepicker/Weekpicker: Current day time limit" timezone.
  • Fix - PAYMENT GATEWAYS - Gateways Currency Converter - Call to undefined function is_cart().
  • Fix - PRICES & CURRENCIES - Wholesale Price - Fix "conflict between include/exclude product and include/exclude categories".
  • Fix - PRODUCTS - Product Input Fields - Fixed the Uncaught TypeError: jQuery(...).live is not a function error
  • Fix - PRODUCTS - Product Listings - Fixed the product visibility by category. Remove the woocommerce_product_is_visible filter and added woocommerce_product_query.
  • Fix - Shortcodes - Orders - Add [wcj_order_total_in_words] shortcode. "Fixed issue for Lithuanian characters (LT) lang paramater.
  • Dev - EMAILS & MISC. - Export - Round the amount added precision to amount values for export the csv file
  • Dev - Classes - WCJ_Module - Add "hide_on_free" parameter allowing to create a feature hidden on free version.
  • Fix - PDF Invoicing - Numbering - Fixed the numbering counter issue for bulk pdf generation.
  • Fix - PDF Invoicing - Numbering - Fixed the numbering counter issue for pdf delete.
Download this release

Release Info

Developer pluggabl
Plugin Icon 128x128 Booster for WooCommerce
Version 5.3.6
Comparing to
See all releases

Code changes from version 5.3.5 to 5.3.6

includes/class-wcj-checkout-custom-fields.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Module - Checkout Custom Fields
4
  *
5
- * @version 5.3.3
6
  * @author Pluggabl LLC.
7
  */
8
 
@@ -539,7 +539,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
539
  /**
540
  * add_custom_checkout_fields.
541
  *
542
- * @version 5.3.3
543
  * @todo (maybe) fix - priority seems to not affect tab order (same in Checkout Core Fields module)
544
  * @todo (dev) (maybe) add `do_shortcode` for e.g. `description` etc.
545
  */
@@ -564,10 +564,16 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
564
  $custom_attributes['mindate'] = wcj_get_option( 'wcj_checkout_custom_field_datepicker_mindate_' . $i, -365 );
565
  if ( 0 == $custom_attributes['mindate'] ) {
566
  $custom_attributes['mindate'] = 'zero';
567
-
568
  $custom_attributes['currentday_time_limit'] = wcj_get_option( 'wcj_checkout_custom_field_datepicker_current_day_time_limit_' . $i, 0 );
569
- if( date( 'H:i',strtotime( $custom_attributes[ 'currentday_time_limit' ] ) ) < date( "H:i" ) ) {
570
- $custom_attributes[ 'mindate' ] = 1;
 
 
 
 
 
 
 
571
  }
572
  }
573
  $custom_attributes['maxdate'] = wcj_get_option( 'wcj_checkout_custom_field_datepicker_maxdate_' . $i, 365 );
2
  /**
3
  * Booster for WooCommerce - Module - Checkout Custom Fields
4
  *
5
+ * @version 5.3.6
6
  * @author Pluggabl LLC.
7
  */
8
 
539
  /**
540
  * add_custom_checkout_fields.
541
  *
542
+ * @version 5.3.6
543
  * @todo (maybe) fix - priority seems to not affect tab order (same in Checkout Core Fields module)
544
  * @todo (dev) (maybe) add `do_shortcode` for e.g. `description` etc.
545
  */
564
  $custom_attributes['mindate'] = wcj_get_option( 'wcj_checkout_custom_field_datepicker_mindate_' . $i, -365 );
565
  if ( 0 == $custom_attributes['mindate'] ) {
566
  $custom_attributes['mindate'] = 'zero';
 
567
  $custom_attributes['currentday_time_limit'] = wcj_get_option( 'wcj_checkout_custom_field_datepicker_current_day_time_limit_' . $i, 0 );
568
+ $current_datetime = current_datetime();
569
+ $time_limit_datetime = new \DateTime(null, $current_datetime->getTimezone());
570
+ $time_limit_datetime->setTimestamp($current_datetime->getTimestamp());
571
+ if ( ! empty( $custom_attributes['currentday_time_limit'] ) ) {
572
+ $time = explode( ':', $custom_attributes['currentday_time_limit'] );
573
+ $time_limit_datetime->setTime( $time[0], $time[1] );
574
+ }
575
+ if ( $time_limit_datetime < $current_datetime ) {
576
+ $custom_attributes['mindate'] = 1;
577
  }
578
  }
579
  $custom_attributes['maxdate'] = wcj_get_option( 'wcj_checkout_custom_field_datepicker_maxdate_' . $i, 365 );
includes/class-wcj-payment-gateways-currency.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Module - Gateways Currency Converter
4
  *
5
- * @version 5.2.0
6
  * @since 2.3.0
7
  * @author Pluggabl LLC.
8
  */
@@ -109,20 +109,25 @@ class WCJ_Payment_Gateways_Currency extends WCJ_Module {
109
  /**
110
  * is_cart_or_checkout.
111
  *
112
- * @version 4.0.0
113
  * @since 2.3.0
114
  * @todo [dev] rename function to `do_apply_by_page_scope()`
115
  */
116
  function is_cart_or_checkout() {
117
- if ( ! is_admin() ) {
118
- if ( 'cart_and_checkout' === $this->page_scope ) {
119
- if ( is_cart() || is_checkout() ) {
120
- return true;
121
- }
122
- } elseif ( 'checkout_only' === $this->page_scope ) {
123
- if ( is_checkout() ) {
124
- return true;
125
- }
 
 
 
 
 
126
  }
127
  }
128
  return false;
2
  /**
3
  * Booster for WooCommerce - Module - Gateways Currency Converter
4
  *
5
+ * @version 5.3.6
6
  * @since 2.3.0
7
  * @author Pluggabl LLC.
8
  */
109
  /**
110
  * is_cart_or_checkout.
111
  *
112
+ * @version 5.3.6
113
  * @since 2.3.0
114
  * @todo [dev] rename function to `do_apply_by_page_scope()`
115
  */
116
  function is_cart_or_checkout() {
117
+ if (
118
+ is_admin()
119
+ || ! function_exists( 'is_checkout' )
120
+ || ! function_exists( 'is_cart' )
121
+ ) {
122
+ return false;
123
+ }
124
+ if ( 'cart_and_checkout' === $this->page_scope ) {
125
+ if ( is_cart() || is_checkout() ) {
126
+ return true;
127
+ }
128
+ } elseif ( 'checkout_only' === $this->page_scope ) {
129
+ if ( is_checkout() ) {
130
+ return true;
131
  }
132
  }
133
  return false;
includes/class-wcj-pdf-invoicing.php CHANGED
@@ -1,473 +1,473 @@
1
- <?php
2
- /**
3
- * Booster for WooCommerce - Module - PDF Invoicing
4
- *
5
- * @version 5.2.0
6
- * @author Pluggabl LLC.
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
10
-
11
- if ( ! class_exists( 'WCJ_PDF_Invoicing' ) ) :
12
-
13
- class WCJ_PDF_Invoicing extends WCJ_Module {
14
-
15
- /**
16
- * Constructor.
17
- *
18
- * @version 5.2.0
19
- */
20
- function __construct() {
21
-
22
- $this->id = 'pdf_invoicing';
23
- $this->short_desc = __( 'PDF Invoicing', 'woocommerce-jetpack' );
24
- $this->section_title = __( 'General', 'woocommerce-jetpack' );
25
- $this->desc = __( 'Invoices, Proforma Invoices (Plus), Credit Notes (Plus) and Packing Slips (Plus).', 'woocommerce-jetpack' );
26
- $this->desc_pro = __( 'Invoices, Proforma Invoices, Credit Notes and Packing Slips.', 'woocommerce-jetpack' );
27
- $this->link_slug = 'woocommerce-pdf-invoicing-and-packing-slips';
28
- parent::__construct();
29
-
30
- $this->add_tools( array(
31
- 'renumerate_invoices' => array(
32
- 'title' => __( 'Invoices Renumerate', 'woocommerce-jetpack' ),
33
- 'desc' => __( 'Tool renumerates all invoices, proforma invoices, credit notes and packing slips.', 'woocommerce-jetpack' ),
34
- ),
35
- 'invoices_report' => array(
36
- 'title' => __( 'Invoices Report', 'woocommerce-jetpack' ),
37
- 'desc' => __( 'Invoices Monthly Reports.', 'woocommerce-jetpack' ),
38
- ),
39
- ) );
40
-
41
- if ( $this->is_enabled() ) {
42
- if ( 'init' === current_filter() ) {
43
- $this->catch_args();
44
- $this->generate_pdf_on_init();
45
- } else {
46
- add_action( 'init', array( $this, 'catch_args' ) );
47
- add_action( 'init', array( $this, 'generate_pdf_on_init' ) );
48
- }
49
-
50
- // Bulk actions
51
- add_filter( 'bulk_actions-edit-' . 'shop_order', array( $this, 'bulk_actions_register' ) );
52
- add_filter( 'handle_bulk_actions-edit-' . 'shop_order', array( $this, 'bulk_actions_handle' ), 10, 3 );
53
- add_action( 'admin_notices', array( $this, 'bulk_actions_pdfs_notices' ) );
54
-
55
- $this->the_pdf_invoicing_report_tool = include_once( 'pdf-invoices/class-wcj-pdf-invoicing-report-tool.php' );
56
-
57
- $invoice_types = wcj_get_enabled_invoice_types();
58
- foreach ( $invoice_types as $invoice_type ) {
59
- $the_hooks = wcj_get_invoice_create_on( $invoice_type['id'] );
60
- foreach ( $the_hooks as $the_hook ) {
61
- if ( 'manual' != $the_hook ) {
62
- add_action( $the_hook, array( $this, 'create_document_hook' ) );
63
- if ( 'woocommerce_new_order' === $the_hook ) {
64
- add_action( 'woocommerce_api_create_order', array( $this, 'create_document_hook' ) );
65
- add_action( 'woocommerce_cli_create_order', array( $this, 'create_document_hook' ) );
66
- add_action( 'kco_before_confirm_order', array( $this, 'create_document_hook' ) );
67
- add_action( 'woocommerce_checkout_order_processed', array( $this, 'create_document_hook' ) );
68
- }
69
- }
70
- }
71
- }
72
-
73
- // Editable numbers in meta box
74
- if ( 'yes' === wcj_get_option( 'wcj_invoicing_add_order_meta_box_numbering', 'yes' ) ) {
75
- add_action( 'save_post_shop_order', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
76
- }
77
-
78
- }
79
- }
80
-
81
- /**
82
- * Adds extra bulk action options to generate/download documents.
83
- *
84
- * @version 4.3.0
85
- * @since 2.5.7
86
- *
87
- * @param $actions
88
- *
89
- * @return array
90
- */
91
- function bulk_actions_register( $actions ) {
92
- $invoice_types = wcj_get_enabled_invoice_types();
93
- $new_actions_source = array(
94
- 'generate' => __( 'Generate', 'woocommerce-jetpack' ),
95
- 'download' => __( 'Download (Zip)', 'woocommerce-jetpack' ),
96
- 'merge' => __( 'Merge (Print)', 'woocommerce-jetpack' ),
97
- );
98
- $new_actions = array();
99
- foreach ( $new_actions_source as $source_key => $source_value ) {
100
- foreach ( $invoice_types as $type_key => $type_value ) {
101
- $new_actions[ $source_key . '_' . $type_value['id'] ] = $source_value . ' ' . $type_value['title'];
102
- }
103
- }
104
- $actions = array_merge( $actions, $new_actions );
105
- return $actions;
106
- }
107
-
108
- /**
109
- * bulk_actions_pdfs_notices.
110
- *
111
- * @version 3.5.2
112
- * @since 2.5.7
113
- */
114
- function bulk_actions_pdfs_notices() {
115
- global $post_type, $pagenow;
116
- if ( $pagenow == 'edit.php' && 'shop_order' == $post_type ) {
117
- if ( isset( $_REQUEST['generated'] ) && (int) $_REQUEST['generated'] ) {
118
- $message = sprintf( _n( 'Document generated.', '%s documents generated.', $_REQUEST['generated'] ), number_format_i18n( $_REQUEST['generated'] ) );
119
- echo "<div class='updated'><p>{$message}</p></div>";
120
- }
121
- if ( isset( $_GET['wcj_notice'] ) ) {
122
- switch ( $_GET['wcj_notice'] ) {
123
- case 'ziparchive_class_missing':
124
- echo '<div class="notice notice-error"><p><strong>' .
125
- sprintf( __( 'Booster: %s class is not accessible on your server. Please contact your hosting provider.', 'woocommerce-jetpack' ),
126
- '<a target="_blank" href="http://php.net/manual/en/class.ziparchive.php">PHP ZipArchive</a>' ) .
127
- '</strong></p></div>';
128
- break;
129
- case 'ziparchive_error':
130
- echo '<div class="notice notice-error"><p>' .
131
- __( 'Booster: ZipArchive error.', 'woocommerce-jetpack' ) .
132
- '</p></div>';
133
- break;
134
- case 'merge_pdfs_no_files':
135
- echo '<div class="notice notice-error"><p>' .
136
- __( 'Booster: Merge PDFs: No files.', 'woocommerce-jetpack' ) .
137
- '</p></div>';
138
- break;
139
- case 'merge_pdfs_php_version':
140
- echo '<div class="notice notice-error"><p>' .
141
- sprintf( __( 'Booster: Merge PDFs: Command requires PHP version 5.3.0 at least. You have PHP version %s installed.', 'woocommerce-jetpack' ), PHP_VERSION ) .
142
- '</p></div>';
143
- break;
144
- default:
145
- echo '<div class="notice notice-error"><p>' .
146
- sprintf( __( 'Booster: %s.', 'woocommerce-jetpack' ), '<code>' . $_GET['wcj_notice'] . '</code>' ) .
147
- '</p></div>';
148
- break;
149
- }
150
- }
151
- }
152
- }
153
-
154
- /**
155
- * Processes the PDF bulk actions.
156
- *
157
- * @version 4.5.0
158
- * @since 2.5.7
159
- * @todo on `generate` (and maybe other actions) validate user permissions/capabilities - `if ( ! current_user_can( $post_type_object->cap->export_post, $post_id ) ) { wp_die( __( 'You are not allowed to export this post.' ) ); }`
160
- *
161
- * @param $redirect_to
162
- * @param $action
163
- * @param $post_ids
164
- *
165
- * @return string
166
- */
167
- function bulk_actions_handle( $redirect_to, $action, $post_ids ) {
168
- if (
169
- false === preg_match( '(generate|download|merge)', $action ) ||
170
- false === preg_match( '(invoice|packing_slip|credit_note)', $action ) ||
171
- false === check_admin_referer( 'bulk-posts' )
172
- ) {
173
- return $redirect_to;
174
- }
175
-
176
- // Validate the action
177
- $action_exploded = explode( '_', $action, 2 );
178
-
179
- // Perform the action
180
- $the_action = $action_exploded[0];
181
- $the_type = $action_exploded[1];
182
-
183
- switch( $the_action ) {
184
- case 'generate':
185
- $generated = 0;
186
- foreach( $post_ids as $post_id ) {
187
- if ( $this->create_document( $post_id, $the_type ) ) {
188
- $generated++;
189
- }
190
- }
191
- // Build the redirect url
192
- $redirect_to = add_query_arg(
193
- array(
194
- 'generated' => $generated,
195
- 'generated_type' => $the_type,
196
- 'generated_' . $the_type => 1,
197
- 'ids' => join( ',', $post_ids ),
198
- 'post_status' => $_GET['post_status'],
199
- ),
200
- $redirect_to
201
- );
202
- break;
203
- case 'download':
204
- if ( '' != ( $result = $this->get_invoices_zip( $the_type, $post_ids ) ) ) {
205
- // Build the redirect url
206
- $redirect_to = add_query_arg(
207
- array(
208
- 'post_status' => $_GET['post_status'],
209
- 'wcj_notice' => $result,
210
- ),
211
- $redirect_to
212
- );
213
- }
214
- break;
215
- case 'merge':
216
- $merge_ids = array();
217
- foreach( $post_ids as $post_id ) {
218
- if ( wcj_is_invoice_created( $post_id, $the_type ) ) {
219
- $merge_ids[] = $post_id;
220
- }
221
- }
222
- if ( ! empty( $merge_ids ) ) {
223
- if ( '' != ( $result = $this->merge_pdfs( $the_type, $merge_ids ) ) ) {
224
- // Build the redirect url
225
- $redirect_to = add_query_arg(
226
- array(
227
- 'post_status' => $_GET['post_status'],
228
- 'wcj_notice' => $result,
229
- ),
230
- $redirect_to
231
- );
232
- }
233
- }
234
- break;
235
- default:
236
- return $redirect_to;
237
- }
238
- return $redirect_to;
239
- }
240
-
241
- /**
242
- * merge_pdfs.
243
- *
244
- * @version 3.5.2
245
- * @since 3.5.0
246
- * @see https://www.setasign.com/products/fpdi/demos/concatenate-fake/
247
- * @todo rethink filename (i.e. 'docs.pdf')
248
- * @todo (maybe) always save/download instead of display on output
249
- */
250
- function merge_pdfs( $invoice_type_id, $post_ids ) {
251
- if ( version_compare( PHP_VERSION, '5.3.0', '<' ) ) {
252
- return 'merge_pdfs_php_version';
253
- }
254
- $files = array();
255
- foreach( $post_ids as $post_id ) {
256
- $the_invoice = wcj_get_pdf_invoice( $post_id, $invoice_type_id );
257
- $files[] = $the_invoice->get_pdf( 'F' );
258
- }
259
- if ( empty( $files ) ) {
260
- return 'merge_pdfs_no_files';
261
- }
262
- require_once( wcj_plugin_path() . '/includes/lib/FPDI/src/autoload.php' );
263
- $fpdi_pdf = require_once( wcj_plugin_path() . '/includes/pdf-invoices/tcpdffpdi.php' );
264
- $fpdi_pdf->SetTitle( 'docs.pdf' );
265
- $fpdi_pdf->setPrintHeader( false );
266
- $fpdi_pdf->setPrintFooter( false );
267
- foreach( $files as $file ) {
268
- $page_count = $fpdi_pdf->setSourceFile( $file );
269
- for ( $page_nr = 1; $page_nr <= $page_count; $page_nr++ ) {
270
- $page_id = $fpdi_pdf->ImportPage( $page_nr );
271
- $s = $fpdi_pdf->getTemplatesize( $page_id );
272
- $fpdi_pdf->AddPage( $s['orientation'], $s );
273
- $fpdi_pdf->useImportedPage( $page_id );
274
- }
275
- }
276
- $fpdi_pdf->Output( 'docs.pdf', ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type_id . '_save_as_enabled', 'no' ) ? 'D' : 'I' ) );
277
- die();
278
- }
279
-
280
- /**
281
- * get_invoices_zip.
282
- *
283
- * @version 3.5.0
284
- * @since 2.5.7
285
- * @todo (maybe) add timestamp to filename
286
- * @todo add `ZipArchive` fallback
287
- */
288
- function get_invoices_zip( $invoice_type_id, $post_ids ) {
289
- if ( ! class_exists( 'ZipArchive' ) ) {
290
- return 'ziparchive_class_missing';
291
- }
292
- // Creating Zip
293
- $zip = new ZipArchive();
294
- $zip_file_name = $invoice_type_id . '-' .
295
- sanitize_title( str_replace( array( 'http://', 'https://' ), '', site_url() ) ) . '-' .
296
- min( $post_ids ) . '-' . max( $post_ids ) .
297
- '.zip';
298
- $zip_file_path = wcj_get_invoicing_temp_dir() . '/' . $zip_file_name;
299
- if ( file_exists( $zip_file_path ) ) {
300
- @unlink( $zip_file_path );
301
- }
302
- if ( $zip->open( $zip_file_path, ZipArchive::CREATE | ZIPARCHIVE::OVERWRITE ) !== TRUE ) {
303
- return 'ziparchive_error';
304
- }
305
- foreach( $post_ids as $post_id ) {
306
- if ( wcj_is_invoice_created( $post_id, $invoice_type_id ) ) {
307
- $the_invoice = wcj_get_pdf_invoice( $post_id, $invoice_type_id );
308
- $file_name = $the_invoice->get_pdf( 'F' );
309
- $zip->addFile( $file_name, $the_invoice->get_file_name() );
310
- }
311
- }
312
- $zip->close();
313
- // Sending Zip
314
- wcj_send_file( $zip_file_name, $zip_file_path, 'zip', true );
315
- return '';
316
- }
317
-
318
- /**
319
- * create_invoices_report_tool.
320
- *
321
- * @version 2.3.10
322
- * @since 2.3.10
323
- */
324
- function create_invoices_report_tool() {
325
- return $this->the_pdf_invoicing_report_tool->create_invoices_report_tool();
326
- }
327
-
328
- /**
329
- * create_renumerate_invoices_tool.
330
- *
331
- * @version 2.3.10
332
- * @since 2.3.10
333
- */
334
- function create_renumerate_invoices_tool() {
335
- $the_tool = include_once( 'pdf-invoices/class-wcj-pdf-invoicing-renumerate-tool.php' );
336
- return $the_tool->create_renumerate_invoices_tool();
337
- }
338
-
339
- /**
340
- * create_document_hook.
341
- *
342
- * @version 3.2.0
343
- * @since 2.7.0
344
- */
345
- function create_document_hook( $order_id ) {
346
- $current_filter = current_filter();
347
- if ( in_array( $current_filter,
348
- array( 'woocommerce_api_create_order', 'woocommerce_cli_create_order', 'kco_before_confirm_order', 'woocommerce_checkout_order_processed' ) )
349
- ) {
350
- $current_filter = 'woocommerce_new_order';
351
- }
352
- $invoice_types = wcj_get_enabled_invoice_types();
353
- foreach ( $invoice_types as $invoice_type ) {
354
- $the_hooks = wcj_get_invoice_create_on( $invoice_type['id'] );
355
- foreach ( $the_hooks as $the_hook ) {
356
- if ( 'manual' != $the_hook ) {
357
- if ( $current_filter === $the_hook ) {
358
- $this->create_document( $order_id, $invoice_type['id'] );
359
- }
360
- }
361
- }
362
- }
363
- }
364
-
365
- /**
366
- * create_document.
367
- *
368
- * @version 2.5.7
369
- */
370
- function create_document( $order_id, $invoice_type ) {
371
- if ( false == wcj_is_invoice_created( $order_id, $invoice_type ) ) {
372
- wcj_create_invoice( $order_id, $invoice_type );
373
- return true;
374
- }
375
- return false;
376
- }
377
-
378
- /**
379
- * delete_document.
380
- *
381
- * @version 2.3.0
382
- * @since 2.3.0
383
- */
384
- function delete_document( $order_id, $invoice_type ) {
385
- if ( true == wcj_is_invoice_created( $order_id, $invoice_type ) ) {
386
- wcj_delete_invoice( $order_id, $invoice_type );
387
- }
388
- }
389
-
390
- /**
391
- * catch_args.
392
- *
393
- * @version 3.4.0
394
- */
395
- function catch_args() {
396
- $this->order_id = ( isset( $_GET['order_id'] ) ) ? $_GET['order_id'] : 0;
397
- $this->invoice_type_id = ( isset( $_GET['invoice_type_id'] ) ) ? $_GET['invoice_type_id'] : '';
398
- $this->save_as_pdf = ( isset( $_GET['save_pdf_invoice'] ) && '1' == $_GET['save_pdf_invoice'] );
399
- $this->get_invoice = ( isset( $_GET['get_invoice'] ) && '1' == $_GET['get_invoice'] );
400
-
401
- if ( isset( $_GET['create_invoice_for_order_id'] ) && $this->check_user_roles( false ) ) {
402
- $this->create_document( $_GET['create_invoice_for_order_id'], $this->invoice_type_id );
403
- }
404
- if ( isset( $_GET['delete_invoice_for_order_id'] ) && $this->check_user_roles( false ) ) {
405
- $this->delete_document( $_GET['delete_invoice_for_order_id'], $this->invoice_type_id );
406
- }
407
- }
408
-
409
- /**
410
- * check_user_roles.
411
- *
412
- * @version 3.4.0
413
- * @since 2.9.0
414
- * @todo check if `current_user_can( 'administrator' )` is the same as checking role directly
415
- */
416
- function check_user_roles( $allow_order_owner = true ) {
417
- if ( $allow_order_owner && get_current_user_id() == intval( get_post_meta( $this->order_id, '_customer_user', true ) ) ) {
418
- return true;
419
- }
420
- $allowed_user_roles = wcj_get_option( 'wcj_invoicing_' . $this->invoice_type_id . '_roles', array( 'administrator', 'shop_manager' ) );
421
- if ( empty( $allowed_user_roles ) ) {
422
- $allowed_user_roles = array( 'administrator' );
423
- }
424
- if ( wcj_is_user_role( $allowed_user_roles ) ) {
425
- return true;
426
- } else {
427
- add_action( 'admin_notices', array( $this, 'wrong_user_role_notice' ) );
428
- return false;
429
- }
430
- }
431
-
432
- /**
433
- * wrong_user_role_notice.
434
- *
435
- * @version 2.9.0
436
- * @since 2.9.0
437
- */
438
- function wrong_user_role_notice() {
439
- echo '<div class="notice notice-error is-dismissible"><p>' . __( 'You are not allowed to view the invoice.', 'woocommerce-jetpack' ) . '</p></div>';
440
- }
441
-
442
- /**
443
- * generate_pdf_on_init.
444
- *
445
- * @version 4.3.1
446
- */
447
- function generate_pdf_on_init() {
448
- // Check if all is OK
449
- if ( true !== $this->get_invoice || 0 == $this->order_id || ! is_user_logged_in() || ! $this->check_user_roles() ) {
450
- return;
451
- }
452
- // Get PDF
453
- $the_invoice = wcj_get_pdf_invoice( $this->order_id, $this->invoice_type_id );
454
- $dest = ( true === $this->save_as_pdf ? 'D' : 'I' );
455
- if ( 'yes' === wcj_get_option( 'wcj_general_advanced_disable_output_buffer', 'no' ) ) {
456
- ob_clean();
457
- ob_flush();
458
- $the_invoice->get_pdf( $dest );
459
- ob_end_flush();
460
- if ( ob_get_contents() ) {
461
- ob_end_clean();
462
- }
463
- } else {
464
- $the_invoice->get_pdf( $dest );
465
- }
466
- die();
467
- }
468
-
469
- }
470
-
471
- endif;
472
-
473
- return new WCJ_PDF_Invoicing();
1
+ <?php
2
+ /**
3
+ * Booster for WooCommerce - Module - PDF Invoicing
4
+ *
5
+ * @version 5.2.0
6
+ * @author Pluggabl LLC.
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
10
+
11
+ if ( ! class_exists( 'WCJ_PDF_Invoicing' ) ) :
12
+
13
+ class WCJ_PDF_Invoicing extends WCJ_Module {
14
+
15
+ /**
16
+ * Constructor.
17
+ *
18
+ * @version 5.2.0
19
+ */
20
+ function __construct() {
21
+
22
+ $this->id = 'pdf_invoicing';
23
+ $this->short_desc = __( 'PDF Invoicing', 'woocommerce-jetpack' );
24
+ $this->section_title = __( 'General', 'woocommerce-jetpack' );
25
+ $this->desc = __( 'Invoices, Proforma Invoices (Plus), Credit Notes (Plus) and Packing Slips (Plus).', 'woocommerce-jetpack' );
26
+ $this->desc_pro = __( 'Invoices, Proforma Invoices, Credit Notes and Packing Slips.', 'woocommerce-jetpack' );
27
+ $this->link_slug = 'woocommerce-pdf-invoicing-and-packing-slips';
28
+ parent::__construct();
29
+
30
+ $this->add_tools( array(
31
+ 'renumerate_invoices' => array(
32
+ 'title' => __( 'Invoices Renumerate', 'woocommerce-jetpack' ),
33
+ 'desc' => __( 'Tool renumerates all invoices, proforma invoices, credit notes and packing slips.', 'woocommerce-jetpack' ),
34
+ ),
35
+ 'invoices_report' => array(
36
+ 'title' => __( 'Invoices Report', 'woocommerce-jetpack' ),
37
+ 'desc' => __( 'Invoices Monthly Reports.', 'woocommerce-jetpack' ),
38
+ ),
39
+ ) );
40
+
41
+ if ( $this->is_enabled() ) {
42
+ if ( 'init' === current_filter() ) {
43
+ $this->catch_args();
44
+ $this->generate_pdf_on_init();
45
+ } else {
46
+ add_action( 'init', array( $this, 'catch_args' ) );
47
+ add_action( 'init', array( $this, 'generate_pdf_on_init' ) );
48
+ }
49
+
50
+ // Bulk actions
51
+ add_filter( 'bulk_actions-edit-' . 'shop_order', array( $this, 'bulk_actions_register' ) );
52
+ add_filter( 'handle_bulk_actions-edit-' . 'shop_order', array( $this, 'bulk_actions_handle' ), 10, 3 );
53
+ add_action( 'admin_notices', array( $this, 'bulk_actions_pdfs_notices' ) );
54
+
55
+ $this->the_pdf_invoicing_report_tool = include_once( 'pdf-invoices/class-wcj-pdf-invoicing-report-tool.php' );
56
+
57
+ $invoice_types = wcj_get_enabled_invoice_types();
58
+ foreach ( $invoice_types as $invoice_type ) {
59
+ $the_hooks = wcj_get_invoice_create_on( $invoice_type['id'] );
60
+ foreach ( $the_hooks as $the_hook ) {
61
+ if ( 'manual' != $the_hook ) {
62
+ add_action( $the_hook, array( $this, 'create_document_hook' ) );
63
+ if ( 'woocommerce_new_order' === $the_hook ) {
64
+ add_action( 'woocommerce_api_create_order', array( $this, 'create_document_hook' ) );
65
+ add_action( 'woocommerce_cli_create_order', array( $this, 'create_document_hook' ) );
66
+ add_action( 'kco_before_confirm_order', array( $this, 'create_document_hook' ) );
67
+ add_action( 'woocommerce_checkout_order_processed', array( $this, 'create_document_hook' ) );
68
+ }
69
+ }
70
+ }
71
+ }
72
+
73
+ // Editable numbers in meta box
74
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_add_order_meta_box_numbering', 'yes' ) ) {
75
+ add_action( 'save_post_shop_order', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
76
+ }
77
+
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Adds extra bulk action options to generate/download documents.
83
+ *
84
+ * @version 4.3.0
85
+ * @since 2.5.7
86
+ *
87
+ * @param $actions
88
+ *
89
+ * @return array
90
+ */
91
+ function bulk_actions_register( $actions ) {
92
+ $invoice_types = wcj_get_enabled_invoice_types();
93
+ $new_actions_source = array(
94
+ 'generate' => __( 'Generate', 'woocommerce-jetpack' ),
95
+ 'download' => __( 'Download (Zip)', 'woocommerce-jetpack' ),
96
+ 'merge' => __( 'Merge (Print)', 'woocommerce-jetpack' ),
97
+ );
98
+ $new_actions = array();
99
+ foreach ( $new_actions_source as $source_key => $source_value ) {
100
+ foreach ( $invoice_types as $type_key => $type_value ) {
101
+ $new_actions[ $source_key . '_' . $type_value['id'] ] = $source_value . ' ' . $type_value['title'];
102
+ }
103
+ }
104
+ $actions = array_merge( $actions, $new_actions );
105
+ return $actions;
106
+ }
107
+
108
+ /**
109
+ * bulk_actions_pdfs_notices.
110
+ *
111
+ * @version 3.5.2
112
+ * @since 2.5.7
113
+ */
114
+ function bulk_actions_pdfs_notices() {
115
+ global $post_type, $pagenow;
116
+ if ( $pagenow == 'edit.php' && 'shop_order' == $post_type ) {
117
+ if ( isset( $_REQUEST['generated'] ) && (int) $_REQUEST['generated'] ) {
118
+ $message = sprintf( _n( 'Document generated.', '%s documents generated.', $_REQUEST['generated'] ), number_format_i18n( $_REQUEST['generated'] ) );
119
+ echo "<div class='updated'><p>{$message}</p></div>";
120
+ }
121
+ if ( isset( $_GET['wcj_notice'] ) ) {
122
+ switch ( $_GET['wcj_notice'] ) {
123
+ case 'ziparchive_class_missing':
124
+ echo '<div class="notice notice-error"><p><strong>' .
125
+ sprintf( __( 'Booster: %s class is not accessible on your server. Please contact your hosting provider.', 'woocommerce-jetpack' ),
126
+ '<a target="_blank" href="http://php.net/manual/en/class.ziparchive.php">PHP ZipArchive</a>' ) .
127
+ '</strong></p></div>';
128
+ break;
129
+ case 'ziparchive_error':
130
+ echo '<div class="notice notice-error"><p>' .
131
+ __( 'Booster: ZipArchive error.', 'woocommerce-jetpack' ) .
132
+ '</p></div>';
133
+ break;
134
+ case 'merge_pdfs_no_files':
135
+ echo '<div class="notice notice-error"><p>' .
136
+ __( 'Booster: Merge PDFs: No files.', 'woocommerce-jetpack' ) .
137
+ '</p></div>';
138
+ break;
139
+ case 'merge_pdfs_php_version':
140
+ echo '<div class="notice notice-error"><p>' .
141
+ sprintf( __( 'Booster: Merge PDFs: Command requires PHP version 5.3.0 at least. You have PHP version %s installed.', 'woocommerce-jetpack' ), PHP_VERSION ) .
142
+ '</p></div>';
143
+ break;
144
+ default:
145
+ echo '<div class="notice notice-error"><p>' .
146
+ sprintf( __( 'Booster: %s.', 'woocommerce-jetpack' ), '<code>' . $_GET['wcj_notice'] . '</code>' ) .
147
+ '</p></div>';
148
+ break;
149
+ }
150
+ }
151
+ }
152
+ }
153
+
154
+ /**
155
+ * Processes the PDF bulk actions.
156
+ *
157
+ * @version 4.5.0
158
+ * @since 2.5.7
159
+ * @todo on `generate` (and maybe other actions) validate user permissions/capabilities - `if ( ! current_user_can( $post_type_object->cap->export_post, $post_id ) ) { wp_die( __( 'You are not allowed to export this post.' ) ); }`
160
+ *
161
+ * @param $redirect_to
162
+ * @param $action
163
+ * @param $post_ids
164
+ *
165
+ * @return string
166
+ */
167
+ function bulk_actions_handle( $redirect_to, $action, $post_ids ) {
168
+ if (
169
+ false === preg_match( '(generate|download|merge)', $action ) ||
170
+ false === preg_match( '(invoice|packing_slip|credit_note)', $action ) ||
171
+ false === check_admin_referer( 'bulk-posts' )
172
+ ) {
173
+ return $redirect_to;
174
+ }
175
+
176
+ // Validate the action
177
+ $action_exploded = explode( '_', $action, 2 );
178
+
179
+ // Perform the action
180
+ $the_action = $action_exploded[0];
181
+ $the_type = $action_exploded[1];
182
+
183
+ switch( $the_action ) {
184
+ case 'generate':
185
+ $generated = 0;
186
+ foreach( $post_ids as $post_id ) {
187
+ if ( $this->create_document( $post_id, $the_type ) ) {
188
+ $generated++;
189
+ }
190
+ }
191
+ // Build the redirect url
192
+ $redirect_to = add_query_arg(
193
+ array(
194
+ 'generated' => $generated,
195
+ 'generated_type' => $the_type,
196
+ 'generated_' . $the_type => 1,
197
+ 'ids' => join( ',', $post_ids ),
198
+ 'post_status' => $_GET['post_status'],
199
+ ),
200
+ $redirect_to
201
+ );
202
+ break;
203
+ case 'download':
204
+ if ( '' != ( $result = $this->get_invoices_zip( $the_type, $post_ids ) ) ) {
205
+ // Build the redirect url
206
+ $redirect_to = add_query_arg(
207
+ array(
208
+ 'post_status' => $_GET['post_status'],
209
+ 'wcj_notice' => $result,
210
+ ),
211
+ $redirect_to
212
+ );
213
+ }
214
+ break;
215
+ case 'merge':
216
+ $merge_ids = array();
217
+ foreach( $post_ids as $post_id ) {
218
+ if ( wcj_is_invoice_created( $post_id, $the_type ) ) {
219
+ $merge_ids[] = $post_id;
220
+ }
221
+ }
222
+ if ( ! empty( $merge_ids ) ) {
223
+ if ( '' != ( $result = $this->merge_pdfs( $the_type, $merge_ids ) ) ) {
224
+ // Build the redirect url
225
+ $redirect_to = add_query_arg(
226
+ array(
227
+ 'post_status' => $_GET['post_status'],
228
+ 'wcj_notice' => $result,
229
+ ),
230
+ $redirect_to
231
+ );
232
+ }
233
+ }
234
+ break;
235
+ default:
236
+ return $redirect_to;
237
+ }
238
+ return $redirect_to;
239
+ }
240
+
241
+ /**
242
+ * merge_pdfs.
243
+ *
244
+ * @version 3.5.2
245
+ * @since 3.5.0
246
+ * @see https://www.setasign.com/products/fpdi/demos/concatenate-fake/
247
+ * @todo rethink filename (i.e. 'docs.pdf')
248
+ * @todo (maybe) always save/download instead of display on output
249
+ */
250
+ function merge_pdfs( $invoice_type_id, $post_ids ) {
251
+ if ( version_compare( PHP_VERSION, '5.3.0', '<' ) ) {
252
+ return 'merge_pdfs_php_version';
253
+ }
254
+ $files = array();
255
+ foreach( $post_ids as $post_id ) {
256
+ $the_invoice = wcj_get_pdf_invoice( $post_id, $invoice_type_id );
257
+ $files[] = $the_invoice->get_pdf( 'F' );
258
+ }
259
+ if ( empty( $files ) ) {
260
+ return 'merge_pdfs_no_files';
261
+ }
262
+ require_once( wcj_plugin_path() . '/includes/lib/FPDI/src/autoload.php' );
263
+ $fpdi_pdf = require_once( wcj_plugin_path() . '/includes/pdf-invoices/tcpdffpdi.php' );
264
+ $fpdi_pdf->SetTitle( 'docs.pdf' );
265
+ $fpdi_pdf->setPrintHeader( false );
266
+ $fpdi_pdf->setPrintFooter( false );
267
+ foreach( $files as $file ) {
268
+ $page_count = $fpdi_pdf->setSourceFile( $file );
269
+ for ( $page_nr = 1; $page_nr <= $page_count; $page_nr++ ) {
270
+ $page_id = $fpdi_pdf->ImportPage( $page_nr );
271
+ $s = $fpdi_pdf->getTemplatesize( $page_id );
272
+ $fpdi_pdf->AddPage( $s['orientation'], $s );
273
+ $fpdi_pdf->useImportedPage( $page_id );
274
+ }
275
+ }
276
+ $fpdi_pdf->Output( 'docs.pdf', ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type_id . '_save_as_enabled', 'no' ) ? 'D' : 'I' ) );
277
+ die();
278
+ }
279
+
280
+ /**
281
+ * get_invoices_zip.
282
+ *
283
+ * @version 3.5.0
284
+ * @since 2.5.7
285
+ * @todo (maybe) add timestamp to filename
286
+ * @todo add `ZipArchive` fallback
287
+ */
288
+ function get_invoices_zip( $invoice_type_id, $post_ids ) {
289
+ if ( ! class_exists( 'ZipArchive' ) ) {
290
+ return 'ziparchive_class_missing';
291
+ }
292
+ // Creating Zip
293
+ $zip = new ZipArchive();
294
+ $zip_file_name = $invoice_type_id . '-' .
295
+ sanitize_title( str_replace( array( 'http://', 'https://' ), '', site_url() ) ) . '-' .
296
+ min( $post_ids ) . '-' . max( $post_ids ) .
297
+ '.zip';
298
+ $zip_file_path = wcj_get_invoicing_temp_dir() . '/' . $zip_file_name;
299
+ if ( file_exists( $zip_file_path ) ) {
300
+ @unlink( $zip_file_path );
301
+ }
302
+ if ( $zip->open( $zip_file_path, ZipArchive::CREATE | ZIPARCHIVE::OVERWRITE ) !== TRUE ) {
303
+ return 'ziparchive_error';
304
+ }
305
+ foreach( $post_ids as $post_id ) {
306
+ if ( wcj_is_invoice_created( $post_id, $invoice_type_id ) ) {
307
+ $the_invoice = wcj_get_pdf_invoice( $post_id, $invoice_type_id );
308
+ $file_name = $the_invoice->get_pdf( 'F' );
309
+ $zip->addFile( $file_name, $the_invoice->get_file_name() );
310
+ }
311
+ }
312
+ $zip->close();
313
+ // Sending Zip
314
+ wcj_send_file( $zip_file_name, $zip_file_path, 'zip', true );
315
+ return '';
316
+ }
317
+
318
+ /**
319
+ * create_invoices_report_tool.
320
+ *
321
+ * @version 2.3.10
322
+ * @since 2.3.10
323
+ */
324
+ function create_invoices_report_tool() {
325
+ return $this->the_pdf_invoicing_report_tool->create_invoices_report_tool();
326
+ }
327
+
328
+ /**
329
+ * create_renumerate_invoices_tool.
330
+ *
331
+ * @version 2.3.10
332
+ * @since 2.3.10
333
+ */
334
+ function create_renumerate_invoices_tool() {
335
+ $the_tool = include_once( 'pdf-invoices/class-wcj-pdf-invoicing-renumerate-tool.php' );
336
+ return $the_tool->create_renumerate_invoices_tool();
337
+ }
338
+
339
+ /**
340
+ * create_document_hook.
341
+ *
342
+ * @version 3.2.0
343
+ * @since 2.7.0
344
+ */
345
+ function create_document_hook( $order_id ) {
346
+ $current_filter = current_filter();
347
+ if ( in_array( $current_filter,
348
+ array( 'woocommerce_api_create_order', 'woocommerce_cli_create_order', 'kco_before_confirm_order', 'woocommerce_checkout_order_processed' ) )
349
+ ) {
350
+ $current_filter = 'woocommerce_new_order';
351
+ }
352
+ $invoice_types = wcj_get_enabled_invoice_types();
353
+ foreach ( $invoice_types as $invoice_type ) {
354
+ $the_hooks = wcj_get_invoice_create_on( $invoice_type['id'] );
355
+ foreach ( $the_hooks as $the_hook ) {
356
+ if ( 'manual' != $the_hook ) {
357
+ if ( $current_filter === $the_hook ) {
358
+ $this->create_document( $order_id, $invoice_type['id'] );
359
+ }
360
+ }
361
+ }
362
+ }
363
+ }
364
+
365
+ /**
366
+ * create_document.
367
+ *
368
+ * @version 2.5.7
369
+ */
370
+ function create_document( $order_id, $invoice_type ) {
371
+ if ( false == wcj_is_invoice_created( $order_id, $invoice_type ) ) {
372
+ wcj_create_invoice( $order_id, $invoice_type );
373
+ return true;
374
+ }
375
+ return false;
376
+ }
377
+
378
+ /**
379
+ * delete_document.
380
+ *
381
+ * @version 2.3.0
382
+ * @since 2.3.0
383
+ */
384
+ function delete_document( $order_id, $invoice_type ) {
385
+ if ( true == wcj_is_invoice_created( $order_id, $invoice_type ) ) {
386
+ wcj_delete_invoice( $order_id, $invoice_type );
387
+ }
388
+ }
389
+
390
+ /**
391
+ * catch_args.
392
+ *
393
+ * @version 3.4.0
394
+ */
395
+ function catch_args() {
396
+ $this->order_id = ( isset( $_GET['order_id'] ) ) ? $_GET['order_id'] : 0;
397
+ $this->invoice_type_id = ( isset( $_GET['invoice_type_id'] ) ) ? $_GET['invoice_type_id'] : '';
398
+ $this->save_as_pdf = ( isset( $_GET['save_pdf_invoice'] ) && '1' == $_GET['save_pdf_invoice'] );
399
+ $this->get_invoice = ( isset( $_GET['get_invoice'] ) && '1' == $_GET['get_invoice'] );
400
+
401
+ if ( isset( $_GET['create_invoice_for_order_id'] ) && $this->check_user_roles( false ) ) {
402
+ $this->create_document( $_GET['create_invoice_for_order_id'], $this->invoice_type_id );
403
+ }
404
+ if ( isset( $_GET['delete_invoice_for_order_id'] ) && $this->check_user_roles( false ) ) {
405
+ $this->delete_document( $_GET['delete_invoice_for_order_id'], $this->invoice_type_id );
406
+ }
407
+ }
408
+
409
+ /**
410
+ * check_user_roles.
411
+ *
412
+ * @version 3.4.0
413
+ * @since 2.9.0
414
+ * @todo check if `current_user_can( 'administrator' )` is the same as checking role directly
415
+ */
416
+ function check_user_roles( $allow_order_owner = true ) {
417
+ if ( $allow_order_owner && get_current_user_id() == intval( get_post_meta( $this->order_id, '_customer_user', true ) ) ) {
418
+ return true;
419
+ }
420
+ $allowed_user_roles = wcj_get_option( 'wcj_invoicing_' . $this->invoice_type_id . '_roles', array( 'administrator', 'shop_manager' ) );
421
+ if ( empty( $allowed_user_roles ) ) {
422
+ $allowed_user_roles = array( 'administrator' );
423
+ }
424
+ if ( wcj_is_user_role( $allowed_user_roles ) ) {
425
+ return true;
426
+ } else {
427
+ add_action( 'admin_notices', array( $this, 'wrong_user_role_notice' ) );
428
+ return false;
429
+ }
430
+ }
431
+
432
+ /**
433
+ * wrong_user_role_notice.
434
+ *
435
+ * @version 2.9.0
436
+ * @since 2.9.0
437
+ */
438
+ function wrong_user_role_notice() {
439
+ echo '<div class="notice notice-error is-dismissible"><p>' . __( 'You are not allowed to view the invoice.', 'woocommerce-jetpack' ) . '</p></div>';
440
+ }
441
+
442
+ /**
443
+ * generate_pdf_on_init.
444
+ *
445
+ * @version 4.3.1
446
+ */
447
+ function generate_pdf_on_init() {
448
+ // Check if all is OK
449
+ if ( true !== $this->get_invoice || 0 == $this->order_id || ! is_user_logged_in() || ! $this->check_user_roles() ) {
450
+ return;
451
+ }
452
+ // Get PDF
453
+ $the_invoice = wcj_get_pdf_invoice( $this->order_id, $this->invoice_type_id );
454
+ $dest = ( true === $this->save_as_pdf ? 'D' : 'I' );
455
+ if ( 'yes' === wcj_get_option( 'wcj_general_advanced_disable_output_buffer', 'no' ) ) {
456
+ ob_clean();
457
+ ob_flush();
458
+ $the_invoice->get_pdf( $dest );
459
+ ob_end_flush();
460
+ if ( ob_get_contents() ) {
461
+ ob_end_clean();
462
+ }
463
+ } else {
464
+ $the_invoice->get_pdf( $dest );
465
+ }
466
+ die();
467
+ }
468
+
469
+ }
470
+
471
+ endif;
472
+
473
+ return new WCJ_PDF_Invoicing();
includes/class-wcj-product-listings.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Module - Product Listings
4
  *
5
- * @version 5.2.0
6
  * @author Pluggabl LLC.
7
  */
8
 
@@ -15,7 +15,7 @@ class WCJ_Product_Listings extends WCJ_Module {
15
  /**
16
  * Constructor.
17
  *
18
- * @version 5.2.0
19
  * @todo more descriptions in settings (i.e. Storefront etc.)
20
  * @todo add deprecated options (which were moved to Storefront)
21
  * @todo add options to enable/disable each section
@@ -49,7 +49,7 @@ class WCJ_Product_Listings extends WCJ_Module {
49
  // Product visibility by category
50
  $this->cats_products_to_hide_on_shop = wcj_get_option( 'wcj_product_listings_exclude_cats_products_on_shop', '' );
51
  if ( ! empty( $this->cats_products_to_hide_on_shop ) ) {
52
- add_filter( 'woocommerce_product_is_visible', array( $this, 'product_visibility_by_category' ), PHP_INT_MAX, 2 );
53
  }
54
 
55
  }
@@ -58,11 +58,18 @@ class WCJ_Product_Listings extends WCJ_Module {
58
  /**
59
  * product_visibility_by_category.
60
  *
61
- * @version 3.5.0
62
  * @since 3.5.0
63
  */
64
- function product_visibility_by_category( $visible, $product_id ) {
65
- return ( ! isset( $_GET['s'] ) && is_shop() && wcj_is_product_term( $product_id, $this->cats_products_to_hide_on_shop, 'product_cat' ) ? false : $visible );
 
 
 
 
 
 
 
66
  }
67
 
68
  /**
2
  /**
3
  * Booster for WooCommerce - Module - Product Listings
4
  *
5
+ * @version 5.3.6
6
  * @author Pluggabl LLC.
7
  */
8
 
15
  /**
16
  * Constructor.
17
  *
18
+ * @version 5.3.6
19
  * @todo more descriptions in settings (i.e. Storefront etc.)
20
  * @todo add deprecated options (which were moved to Storefront)
21
  * @todo add options to enable/disable each section
49
  // Product visibility by category
50
  $this->cats_products_to_hide_on_shop = wcj_get_option( 'wcj_product_listings_exclude_cats_products_on_shop', '' );
51
  if ( ! empty( $this->cats_products_to_hide_on_shop ) ) {
52
+ add_action( 'woocommerce_product_query', array( $this, 'product_visibility_by_category' ), PHP_INT_MAX, 1 );
53
  }
54
 
55
  }
58
  /**
59
  * product_visibility_by_category.
60
  *
61
+ * @version 5.3.6
62
  * @since 3.5.0
63
  */
64
+ function product_visibility_by_category( $query ) {
65
+ $tax_query = (array) $query->get( 'tax_query' );
66
+ $tax_query[] = array(
67
+ 'taxonomy' => 'product_cat',
68
+ 'field' => 'ID',
69
+ 'terms' => wcj_get_option( 'wcj_product_listings_exclude_cats_products_on_shop', '' ),
70
+ 'operator' => 'NOT IN'
71
+ );
72
+ $query->set( 'tax_query', $tax_query );
73
  }
74
 
75
  /**
includes/classes/class-wcj-invoice.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce Invoice
4
  *
5
- * @version 3.5.0
6
  * @author Pluggabl LLC.
7
  */
8
 
@@ -33,7 +33,8 @@ class WCJ_Invoice {
33
  /**
34
  * delete.
35
  *
36
- * @version 3.2.2
 
37
  */
38
  function delete() {
39
  update_post_meta( $this->order_id, '_wcj_invoicing_' . $this->invoice_type . '_number_id', 0 );
@@ -41,15 +42,15 @@ class WCJ_Invoice {
41
  if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $this->invoice_type . '_sequential_enabled', 'no' ) ) {
42
  $option_name = 'wcj_invoicing_' . $this->invoice_type . '_numbering_counter';
43
  $the_invoice_counter = wcj_get_option( $option_name, 1 );
44
- update_option( $option_name, ( $the_invoice_counter - 1 ) );
45
  }
46
  }
47
 
48
  /**
49
  * create.
50
  *
51
- * @version 3.2.2
52
  * @todo use mysql transaction enabled (as in "wcj_order_number_use_mysql_transaction_enabled")
 
53
  */
54
  function create( $date = '' ) {
55
  $order_id = $this->order_id;
@@ -61,7 +62,7 @@ class WCJ_Invoice {
61
  }
62
  }
63
  if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_sequential_enabled', 'no' ) ) {
64
- $the_invoice_number = wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_numbering_counter', 1 );
65
  update_option( 'wcj_invoicing_' . $invoice_type . '_numbering_counter', ( $the_invoice_number + 1 ) );
66
  } else {
67
  $the_invoice_number = $order_id;
2
  /**
3
  * Booster for WooCommerce Invoice
4
  *
5
+ * @version 5.3.6
6
  * @author Pluggabl LLC.
7
  */
8
 
33
  /**
34
  * delete.
35
  *
36
+ * @version 5.3.6
37
+ * @todo removed update_option( $option_name, ( $the_invoice_counter - 1 ) ); It was causing the issue on the count.
38
  */
39
  function delete() {
40
  update_post_meta( $this->order_id, '_wcj_invoicing_' . $this->invoice_type . '_number_id', 0 );
42
  if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $this->invoice_type . '_sequential_enabled', 'no' ) ) {
43
  $option_name = 'wcj_invoicing_' . $this->invoice_type . '_numbering_counter';
44
  $the_invoice_counter = wcj_get_option( $option_name, 1 );
 
45
  }
46
  }
47
 
48
  /**
49
  * create.
50
  *
51
+ * @version 5.3.6
52
  * @todo use mysql transaction enabled (as in "wcj_order_number_use_mysql_transaction_enabled")
53
+ * @todo used get_option instead wcj_get_option to get current numbering_counter.
54
  */
55
  function create( $date = '' ) {
56
  $order_id = $this->order_id;
62
  }
63
  }
64
  if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_sequential_enabled', 'no' ) ) {
65
+ $the_invoice_number = get_option( 'wcj_invoicing_' . $invoice_type . '_numbering_counter', 1 );
66
  update_option( 'wcj_invoicing_' . $invoice_type . '_numbering_counter', ( $the_invoice_number + 1 ) );
67
  } else {
68
  $the_invoice_number = $order_id;
includes/classes/class-wcj-module.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce Module
4
  *
5
- * @version 5.3.3
6
  * @since 2.2.0
7
  * @author Pluggabl LLC.
8
  * @todo [dev] maybe should be `abstract` ?
@@ -499,11 +499,32 @@ class WCJ_Module {
499
  /**
500
  * get_settings.
501
  *
502
- * @version 2.7.0
503
  * @since 2.2.6
504
  */
505
  function get_settings() {
506
- return $this->add_standard_settings( apply_filters( 'wcj_' . $this->id . '_settings', array() ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
507
  }
508
 
509
  /**
2
  /**
3
  * Booster for WooCommerce Module
4
  *
5
+ * @version 5.3.6
6
  * @since 2.2.0
7
  * @author Pluggabl LLC.
8
  * @todo [dev] maybe should be `abstract` ?
499
  /**
500
  * get_settings.
501
  *
502
+ * @version 5.3.6
503
  * @since 2.2.6
504
  */
505
  function get_settings() {
506
+ $settings = apply_filters( 'wcj_' . $this->id . '_settings', array() );
507
+ $settings = $this->add_standard_settings( $settings );
508
+ $settings = $this->handle_hide_on_free_parameter( $settings );
509
+ return $settings;
510
+ }
511
+
512
+ /**
513
+ * handle_hide_on_free_parameter.
514
+ *
515
+ * @version 5.3.6
516
+ * @since 5.3.6
517
+ *
518
+ * @param $settings
519
+ *
520
+ * @return array
521
+ */
522
+ function handle_hide_on_free_parameter( $settings ) {
523
+ if ( 'woocommerce-jetpack.php' !== basename( WCJ_PLUGIN_FILE ) ) {
524
+ return $settings;
525
+ }
526
+ $settings = wp_list_filter( $settings, array( 'hide_on_free' => true ), 'NOT' );
527
+ return $settings;
528
  }
529
 
530
  /**
includes/export/class-wcj-exporter-orders.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce Exporter Orders
4
  *
5
- * @version 5.1.0
6
  * @since 2.5.9
7
  * @author Pluggabl LLC.
8
  * @todo filter export by date
@@ -27,11 +27,26 @@ class WCJ_Exporter_Orders {
27
  /**
28
  * get_export_orders_row.
29
  *
30
- * @version 2.7.0
31
  * @since 2.5.9
 
32
  */
33
  function get_export_orders_row( $fields_ids, $order_id, $order, $items, $items_product_input_fields, $item, $item_id ) {
34
- $row = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  foreach( $fields_ids as $field_id ) {
36
  switch ( $field_id ) {
37
  case 'item-product-input-fields':
@@ -62,22 +77,22 @@ class WCJ_Exporter_Orders {
62
  $row[] = $item['variation_id'];
63
  break;
64
  case 'item-line-subtotal':
65
- $row[] = $item['line_subtotal'];
66
  break;
67
  case 'item-line-total':
68
- $row[] = $item['line_total'];
69
  break;
70
  case 'item-line-subtotal-tax':
71
- $row[] = $item['line_subtotal_tax'];
72
  break;
73
  case 'item-line-tax':
74
- $row[] = $item['line_tax'];
75
  break;
76
  case 'item-line-total-plus-tax':
77
- $row[] = $item['line_total'] + $item['line_tax'];
78
  break;
79
  case 'item-line-subtotal-plus-tax':
80
- $row[] = $item['line_subtotal'] + $item['line_subtotal_tax'];
81
  break;
82
  case 'order-id':
83
  $row[] = $order_id;
@@ -107,10 +122,10 @@ class WCJ_Exporter_Orders {
107
  $row[] = wcj_get_order_currency( $order );
108
  break;
109
  case 'order-total':
110
- $row[] = $order->get_total();
111
  break;
112
  case 'order-total-tax':
113
- $row[] = $order->get_total_tax();
114
  break;
115
  case 'order-payment-method':
116
  $row[] = ( WCJ_IS_WC_VERSION_BELOW_3 ? $order->payment_method_title : $order->get_payment_method_title() );
2
  /**
3
  * Booster for WooCommerce Exporter Orders
4
  *
5
+ * @version 5.3.6
6
  * @since 2.5.9
7
  * @author Pluggabl LLC.
8
  * @todo filter export by date
27
  /**
28
  * get_export_orders_row.
29
  *
30
+ * @version 5.3.6
31
  * @since 2.5.9
32
+ * @todo added precisions to the price fields.
33
  */
34
  function get_export_orders_row( $fields_ids, $order_id, $order, $items, $items_product_input_fields, $item, $item_id ) {
35
+ $row = array();
36
+
37
+ /* Woocommerce default precision */
38
+ $precision = !isset( $precision ) || is_null( $precision ) ? wc_get_price_decimals() : intval( $precision );
39
+
40
+ /* Precision from Booster's Price formats module */
41
+ if ( 'yes' === wcj_get_option( 'wcj_price_formats_enabled', 'no' ) ) {
42
+ $order_curr = wcj_get_order_currency ( $order );
43
+ for ( $i = 1; $i <= wcj_get_option ( 'wcj_price_formats_total_number', 1 ) ; $i++ ) {
44
+ if ( $order_curr === wcj_get_option ( 'wcj_price_formats_currency_' . $i ) ) {
45
+ $precision = absint( wcj_get_option( 'wcj_price_formats_number_of_decimals_' . $i ) );
46
+ break;
47
+ }
48
+ }
49
+ }
50
  foreach( $fields_ids as $field_id ) {
51
  switch ( $field_id ) {
52
  case 'item-product-input-fields':
77
  $row[] = $item['variation_id'];
78
  break;
79
  case 'item-line-subtotal':
80
+ $row[] = round( $item['line_subtotal'], $precision );
81
  break;
82
  case 'item-line-total':
83
+ $row[] = round( $item['line_total'], $precision );
84
  break;
85
  case 'item-line-subtotal-tax':
86
+ $row[] = round( $item['line_subtotal_tax'], $precision );
87
  break;
88
  case 'item-line-tax':
89
+ $row[] = round( $item['line_tax'], $precision );
90
  break;
91
  case 'item-line-total-plus-tax':
92
+ $row[] = round( $item['line_total'] + $item['line_tax'], $precision );
93
  break;
94
  case 'item-line-subtotal-plus-tax':
95
+ $row[] = round( $item['line_subtotal'] + $item['line_subtotal_tax'], $precision );
96
  break;
97
  case 'order-id':
98
  $row[] = $order_id;
122
  $row[] = wcj_get_order_currency( $order );
123
  break;
124
  case 'order-total':
125
+ $row[] = round( $order->get_total(), $precision );
126
  break;
127
  case 'order-total-tax':
128
+ $row[] = round( $order->get_total_tax(), $precision );
129
  break;
130
  case 'order-payment-method':
131
  $row[] = ( WCJ_IS_WC_VERSION_BELOW_3 ? $order->payment_method_title : $order->get_payment_method_title() );
includes/functions/wcj-functions-products.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Functions - Products
4
  *
5
- * @version 5.3.3
6
  * @since 2.9.0
7
  * @author Pluggabl LLC.
8
  */
@@ -424,38 +424,40 @@ if ( ! function_exists( 'wcj_is_product_wholesale_enabled' ) ) {
424
  /**
425
  * wcj_is_product_wholesale_enabled.
426
  *
427
- * @version 5.3.3
428
  */
429
  function wcj_is_product_wholesale_enabled( $product_id ) {
430
  if ( wcj_is_module_enabled( 'wholesale_price' ) ) {
431
  if ( wcj_is_product_wholesale_enabled_per_product( $product_id ) ) {
432
  return true;
433
  } else {
434
- $products_to_include_passed = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
435
  $products_to_include = wcj_get_option( 'wcj_wholesale_price_products_to_include', array() );
436
  if ( ! empty( $products_to_include ) && in_array( $product_id, $products_to_include ) ) {
437
- $products_to_include_passed = true;
438
- }
439
- $product_cats_to_include_passed = true;
440
- $product_cats_to_include = wcj_get_option( 'wcj_wholesale_price_product_cats_to_include', array() );
441
- if ( ! empty( $product_cats_to_include ) && ! wcj_is_product_term( $product_id, $product_cats_to_include, 'product_cat' ) ) {
442
- $product_cats_to_include_passed = false;
443
  }
444
- $products_to_exclude_passed = false;
445
- $product_cats_to_exclude_passed = false;
446
  if ( 'no' === wcj_get_option( 'wcj_wholesale_price_per_product_enable', 'yes' ) ) {
447
- $products_to_exclude_passed = true;
448
  $products_to_exclude = wcj_get_option( 'wcj_wholesale_price_products_to_exclude', array() );
449
  if ( ! empty( $products_to_exclude ) && in_array( $product_id, $products_to_exclude ) ) {
450
- $products_to_exclude_passed = false;
451
- }
452
- $product_cats_to_exclude_passed = true;
453
- $product_cats_to_exclude = wcj_get_option( 'wcj_wholesale_price_product_cats_to_exclude', array() );
454
- if ( ! empty( $product_cats_to_exclude ) && wcj_is_product_term( $product_id, $product_cats_to_exclude, 'product_cat' ) ) {
455
- $product_cats_to_exclude_passed = false;
456
  }
457
  }
458
- return ( $products_to_include_passed || $product_cats_to_include_passed || ( $products_to_exclude_passed && $product_cats_to_exclude_passed ) );
 
459
  }
460
  }
461
  return false;
2
  /**
3
  * Booster for WooCommerce - Functions - Products
4
  *
5
+ * @version 5.3.6
6
  * @since 2.9.0
7
  * @author Pluggabl LLC.
8
  */
424
  /**
425
  * wcj_is_product_wholesale_enabled.
426
  *
427
+ * @version 5.3.6
428
  */
429
  function wcj_is_product_wholesale_enabled( $product_id ) {
430
  if ( wcj_is_module_enabled( 'wholesale_price' ) ) {
431
  if ( wcj_is_product_wholesale_enabled_per_product( $product_id ) ) {
432
  return true;
433
  } else {
434
+ $is_product_eligible = true;
435
+
436
+ $product_cats_to_include = wcj_get_option( 'wcj_wholesale_price_product_cats_to_include', array() );
437
+ if ( ! empty( $product_cats_to_include ) && ! wcj_is_product_term( $product_id, $product_cats_to_include, 'product_cat' ) ) {
438
+ $is_product_eligible = false;
439
+ }
440
+
441
+ if ( 'no' === wcj_get_option( 'wcj_wholesale_price_per_product_enable', 'yes' ) ) {
442
+ $product_cats_to_exclude = wcj_get_option( 'wcj_wholesale_price_product_cats_to_exclude', array() );
443
+ if ( ! empty( $product_cats_to_exclude ) && wcj_is_product_term( $product_id, $product_cats_to_exclude, 'product_cat' ) ) {
444
+ $is_product_eligible = false;
445
+ }
446
+ }
447
+
448
  $products_to_include = wcj_get_option( 'wcj_wholesale_price_products_to_include', array() );
449
  if ( ! empty( $products_to_include ) && in_array( $product_id, $products_to_include ) ) {
450
+ $is_product_eligible = true;
 
 
 
 
 
451
  }
452
+
 
453
  if ( 'no' === wcj_get_option( 'wcj_wholesale_price_per_product_enable', 'yes' ) ) {
 
454
  $products_to_exclude = wcj_get_option( 'wcj_wholesale_price_products_to_exclude', array() );
455
  if ( ! empty( $products_to_exclude ) && in_array( $product_id, $products_to_exclude ) ) {
456
+ $is_product_eligible = false;
 
 
 
 
 
457
  }
458
  }
459
+
460
+ return $is_product_eligible;
461
  }
462
  }
463
  return false;
includes/js/wcj-ajax-exchange-rates.js CHANGED
@@ -1,24 +1,24 @@
1
  /**
2
  * wcj-ajax-exchange-rates.js
3
  *
4
- * @version 2.6.0
5
  */
6
  jQuery(document).ready(function() {
7
- jQuery(".exchage_rate_button").click(function(){
8
- var input_id = '#'+this.getAttribute('multiply_by_field_id');//+' input';
9
- var data = {
10
- 'action': 'wcj_ajax_get_exchange_rates',
11
- 'wcj_currency_from': this.getAttribute('currency_from'),
12
- 'wcj_currency_to': this.getAttribute('currency_to')
13
- };
14
- jQuery.ajax({
15
- type: "POST",
16
- url: ajax_object.ajax_url,
17
- data: data,
18
- success: function(response) {
19
- jQuery(input_id).val(parseFloat(response));
20
- },
21
- });
22
- return false;
23
- });
24
  });
1
  /**
2
  * wcj-ajax-exchange-rates.js
3
  *
4
+ * @version 5.3.6
5
  */
6
  jQuery(document).ready(function() {
7
+ jQuery(".exchage_rate_button").click(function() {
8
+ var input_id = '#' + this.getAttribute('multiply_by_field_id'); //+' input';
9
+ var data = {
10
+ 'action': 'wcj_ajax_get_exchange_rates',
11
+ 'wcj_currency_from': this.getAttribute('currency_from'),
12
+ 'wcj_currency_to': this.getAttribute('currency_to')
13
+ };
14
+ jQuery.ajax({
15
+ type: "POST",
16
+ url: ajax_object.ajax_url,
17
+ data: data,
18
+ success: function(response) {
19
+ jQuery(input_id).val(parseFloat(response));
20
+ },
21
+ });
22
+ return false;
23
+ });
24
  });
includes/js/wcj-weekpicker.js CHANGED
@@ -1,44 +1,44 @@
1
  /**
2
  * wcj-weekpicker.
3
  *
4
- * version 2.4.7
5
  */
6
  jQuery(document).ready(function() {
7
- jQuery("input[display='week']").each( function () {
8
- jQuery(this).datepicker({
9
- dateFormat : jQuery(this).attr("dateformat"),
10
- minDate : jQuery(this).attr("mindate"),
11
- maxDate : jQuery(this).attr("maxdate"),
12
- firstDay : jQuery(this).attr("firstday"),
13
- changeYear: jQuery(this).attr("changeyear"),
14
- yearRange: jQuery(this).attr("yearrange"),
15
- showOtherMonths: true,
16
- selectOtherMonths: true,
17
- changeMonth: true,
18
- showWeek: true,
19
- beforeShow: function(dateText, inst) {
20
- // for week highighting
21
- jQuery(".ui-datepicker-calendar tbody tr").live("mousemove", function() {
22
- jQuery(this).find("td a").addClass("ui-state-hover");
23
- jQuery(this).find(".ui-datepicker-week-col").addClass("ui-state-hover");
24
- });
25
- jQuery(".ui-datepicker-calendar tbody tr").live("mouseleave", function() {
26
- jQuery(this).find("td a").removeClass("ui-state-hover");
27
- jQuery(this).find(".ui-datepicker-week-col").removeClass("ui-state-hover");
28
- });
29
- },
30
- onClose: function(dateText, inst) {
31
- var date = jQuery(this).datepicker( "getDate" );
32
- if (date != null){
33
- var dateFormat = inst.settings.dateFormat || jQuery(this).datepicker._defaults.dateFormat;
34
- var endDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 6);
35
- var endDateFormatted = jQuery.datepicker.formatDate( dateFormat, endDate, inst.settings );
36
- jQuery(this).val(dateText + " - " + endDateFormatted);
37
- }
38
- // disable live listeners so they dont impact other instances
39
- jQuery(".ui-datepicker-calendar tbody tr").die("mousemove");
40
- jQuery(".ui-datepicker-calendar tbody tr").die("mouseleave");
41
- }
42
- });
43
- });
44
  });
1
  /**
2
  * wcj-weekpicker.
3
  *
4
+ * version 5.3.6
5
  */
6
  jQuery(document).ready(function() {
7
+ jQuery("input[display='week']").each(function() {
8
+ jQuery(this).datepicker({
9
+ dateFormat: jQuery(this).attr("dateformat"),
10
+ minDate: jQuery(this).attr("mindate"),
11
+ maxDate: jQuery(this).attr("maxdate"),
12
+ firstDay: jQuery(this).attr("firstday"),
13
+ changeYear: jQuery(this).attr("changeyear"),
14
+ yearRange: jQuery(this).attr("yearrange"),
15
+ showOtherMonths: true,
16
+ selectOtherMonths: true,
17
+ changeMonth: true,
18
+ showWeek: true,
19
+ beforeShow: function(dateText, inst) {
20
+ // for week highighting
21
+ jQuery(".ui-datepicker-calendar tbody").on("mousemove", "tr", function() {
22
+ jQuery(this).find("td a").addClass("ui-state-hover");
23
+ jQuery(this).find(".ui-datepicker-week-col").addClass("ui-state-hover");
24
+ });
25
+ jQuery(".ui-datepicker-calendar tbody").on("mouseleave", "tr", function() {
26
+ jQuery(this).find("td a").removeClass("ui-state-hover");
27
+ jQuery(this).find(".ui-datepicker-week-col").removeClass("ui-state-hover");
28
+ });
29
+ },
30
+ onClose: function(dateText, inst) {
31
+ var date = jQuery(this).datepicker("getDate");
32
+ if (date != null) {
33
+ var dateFormat = inst.settings.dateFormat || jQuery(this).datepicker._defaults.dateFormat;
34
+ var endDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 6);
35
+ var endDateFormatted = jQuery.datepicker.formatDate(dateFormat, endDate, inst.settings);
36
+ jQuery(this).val(dateText + " - " + endDateFormatted);
37
+ }
38
+ // disable live listeners so they dont impact other instances
39
+ jQuery('.ui-datepicker-calendar tbody tr').off('mousemove');
40
+ jQuery('.ui-datepicker-calendar tbody tr').off('mouseleave');
41
+ }
42
+ });
43
+ });
44
  });
includes/shipping/class-wc-shipping-wcj-custom-with-shipping-zones.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Shipping - Custom Shipping with Shipping Zones
4
  *
5
- * @version 5.3.4
6
  * @since 2.5.6
7
  * @author Pluggabl LLC.
8
  */
2
  /**
3
  * Booster for WooCommerce - Shipping - Custom Shipping with Shipping Zones
4
  *
5
+ * @version 5.3.5
6
  * @since 2.5.6
7
  * @author Pluggabl LLC.
8
  */
includes/shortcodes/class-wcj-shortcodes-orders.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Shortcodes - Orders
4
  *
5
- * @version 5.2.0
6
  * @author Pluggabl LLC.
7
  */
8
 
@@ -1314,11 +1314,11 @@ class WCJ_Orders_Shortcodes extends WCJ_Shortcodes {
1314
  /**
1315
  * mb_ucfirst - for wcj_order_total_in_words.
1316
  *
1317
- * @version 2.5.9
1318
  * @since 2.5.9
1319
  */
1320
  function mb_ucfirst( $string ) {
1321
- return mb_strtoupper( mb_substr( $string, 0, 1 ) ) . mb_substr( $string, 1 );
1322
  }
1323
 
1324
  /**
2
  /**
3
  * Booster for WooCommerce - Shortcodes - Orders
4
  *
5
+ * @version 5.3.6
6
  * @author Pluggabl LLC.
7
  */
8
 
1314
  /**
1315
  * mb_ucfirst - for wcj_order_total_in_words.
1316
  *
1317
+ * @version 5.3.6
1318
  * @since 2.5.9
1319
  */
1320
  function mb_ucfirst( $string ) {
1321
+ return ucfirst( mb_substr( $string, 0, 1 ) ) . mb_substr( $string, 1 );
1322
  }
1323
 
1324
  /**
langs/woocommerce-jetpack.pot CHANGED
@@ -9,7 +9,7 @@ msgstr ""
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 2.1.1\n"
13
  "X-Poedit-Basepath: ..\n"
14
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
  "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
@@ -42,8 +42,8 @@ msgstr ""
42
  #: includes/class-wcj-orders.php:125 includes/class-wcj-orders.php:154
43
  #: includes/class-wcj-payment-gateways.php:92
44
  #: includes/class-wcj-track-users.php:164 includes/class-wcj-track-users.php:252
45
- #: includes/classes/class-wcj-module.php:561
46
- #: includes/classes/class-wcj-module.php:761
47
  #: includes/settings/wcj-settings-price-by-country.php:238
48
  msgid "Booster"
49
  msgstr ""
@@ -256,7 +256,7 @@ msgstr ""
256
 
257
  #: includes/admin/class-wc-settings-jetpack.php:591
258
  #: includes/class-wcj-admin-bar.php:172
259
- #: includes/classes/class-wcj-module.php:901
260
  msgid "Documentation"
261
  msgstr ""
262
 
@@ -589,7 +589,7 @@ msgstr ""
589
 
590
  #: includes/class-wcj-admin-bar.php:245 includes/class-wcj-admin-bar.php:288
591
  #: includes/class-wcj-admin-bar.php:632
592
- #: includes/classes/class-wcj-module.php:734
593
  #: includes/settings/wcj-settings-wpml.php:91
594
  msgid "Tools"
595
  msgstr ""
@@ -2402,7 +2402,7 @@ msgstr ""
2402
  #: includes/class-wcj-product-by-user.php:207
2403
  #: includes/class-wcj-purchase-data.php:95
2404
  #: includes/class-wcj-track-users.php:335
2405
- #: includes/classes/class-wcj-module.php:870
2406
  #: includes/functions/wcj-functions-general.php:189
2407
  #: includes/functions/wcj-functions-html.php:117
2408
  #: includes/reports/wcj-class-reports-monthly-sales.php:351
@@ -5505,30 +5505,30 @@ msgid ""
5505
  "\" products."
5506
  msgstr ""
5507
 
5508
- #: includes/classes/class-wcj-module.php:653
5509
  #, php-format
5510
  msgid "Selected: %s."
5511
  msgstr ""
5512
 
5513
- #: includes/classes/class-wcj-module.php:722
5514
  msgid "Back to Module Settings"
5515
  msgstr ""
5516
 
5517
- #: includes/classes/class-wcj-module.php:740
5518
  #: includes/settings/wcj-settings-wpml.php:96
5519
  msgid "Module Tools"
5520
  msgstr ""
5521
 
5522
- #: includes/classes/class-wcj-module.php:813
5523
  #: includes/settings/wcj-settings-checkout-core-fields.php:77
5524
  msgid "enabled"
5525
  msgstr ""
5526
 
5527
- #: includes/classes/class-wcj-module.php:814
5528
  msgid "disabled"
5529
  msgstr ""
5530
 
5531
- #: includes/classes/class-wcj-module.php:822
5532
  #: includes/settings/wcj-settings-product-tabs.php:172
5533
  #: includes/settings/wcj-settings-product-tabs.php:184
5534
  #: includes/settings/wcj-settings-product-tabs.php:196
@@ -5536,27 +5536,27 @@ msgstr ""
5536
  msgid "Deprecated"
5537
  msgstr ""
5538
 
5539
- #: includes/classes/class-wcj-module.php:860
5540
  msgid "Reset Settings"
5541
  msgstr ""
5542
 
5543
- #: includes/classes/class-wcj-module.php:866
5544
  msgid "Reset Module to Default Settings"
5545
  msgstr ""
5546
 
5547
- #: includes/classes/class-wcj-module.php:867
5548
  msgid "Reset Submodule to Default Settings"
5549
  msgstr ""
5550
 
5551
- #: includes/classes/class-wcj-module.php:871
5552
  msgid "Reset settings"
5553
  msgstr ""
5554
 
5555
- #: includes/classes/class-wcj-module.php:905
5556
  msgid "Module Options"
5557
  msgstr ""
5558
 
5559
- #: includes/classes/class-wcj-module.php:912
5560
  msgid "Enable Module"
5561
  msgstr ""
5562
 
@@ -8378,95 +8378,6 @@ msgstr ""
8378
  msgid "Templates"
8379
  msgstr ""
8380
 
8381
- #: includes/plus/class-wcj-plus-site-key-manager.php:79
8382
- #, php-format
8383
- msgid "Status last checked at %s."
8384
- msgstr ""
8385
-
8386
- #: includes/plus/class-wcj-plus-site-key-manager.php:80
8387
- #, php-format
8388
- msgid "Cron scheduled at %s."
8389
- msgstr ""
8390
-
8391
- #: includes/plus/class-wcj-plus-site-key-manager.php:81
8392
- #, php-format
8393
- msgid "Cron last run at %s."
8394
- msgstr ""
8395
-
8396
- #: includes/plus/class-wcj-plus-site-key-manager.php:122
8397
- msgid "No key set."
8398
- msgstr ""
8399
-
8400
- #: includes/plus/class-wcj-plus-site-key-manager.php:123
8401
- #, php-format
8402
- msgid ""
8403
- "To get the key, please visit <a target=\"_blank\" href=\"%s\">your account "
8404
- "page at %s</a>."
8405
- msgstr ""
8406
-
8407
- #: includes/plus/class-wcj-plus-site-key-manager.php:126
8408
- #, php-format
8409
- msgid "No response from server. Please <a href=\"%s\">try again</a> later."
8410
- msgstr ""
8411
-
8412
- #: includes/plus/class-wcj-plus-site-key-manager.php:128
8413
- #, php-format
8414
- msgid "Server error. Please <a href=\"%s\">try again</a> later."
8415
- msgstr ""
8416
-
8417
- #: includes/plus/class-wcj-plus-site-key-section.php:46
8418
- msgid "Manage site key"
8419
- msgstr ""
8420
-
8421
- #: includes/plus/class-wcj-plus-site-key-section.php:59
8422
- #: includes/plus/class-wcj-plus-site-key-section.php:73
8423
- #: includes/plus/class-wcj-plus-site-key-section.php:81
8424
- msgid "Site Key"
8425
- msgstr ""
8426
-
8427
- #: includes/plus/class-wcj-plus-site-key-section.php:74
8428
- msgid ""
8429
- "This section lets you manage site key for paid Booster Plus for WooCommerce "
8430
- "plugin."
8431
- msgstr ""
8432
-
8433
- #: includes/plus/class-wcj-plus-site-key-section.php:75
8434
- #, php-format
8435
- msgid ""
8436
- "To get the key, please go to <a target=\"_blank\" href=\"%s\">your account "
8437
- "page at %s</a>."
8438
- msgstr ""
8439
-
8440
- #: includes/plus/class-wcj-plus-site-key-section.php:78
8441
- msgid "Check site key now"
8442
- msgstr ""
8443
-
8444
- #: includes/plus/class-wcj-plus-site-key-section.php:82
8445
- #, php-format
8446
- msgid "Site URL: %s"
8447
- msgstr ""
8448
-
8449
- #: includes/plus/lib/plugin-update-checker/github-checker.php:119
8450
- msgid "There is no changelog available."
8451
- msgstr ""
8452
-
8453
- #: includes/plus/lib/plugin-update-checker/plugin-update-checker.php:763
8454
- msgid "Check for updates"
8455
- msgstr ""
8456
-
8457
- #: includes/plus/lib/plugin-update-checker/plugin-update-checker.php:807
8458
- msgid "This plugin is up to date."
8459
- msgstr ""
8460
-
8461
- #: includes/plus/lib/plugin-update-checker/plugin-update-checker.php:809
8462
- msgid "A new version of this plugin is available."
8463
- msgstr ""
8464
-
8465
- #: includes/plus/lib/plugin-update-checker/plugin-update-checker.php:811
8466
- #, php-format
8467
- msgid "Unknown update checker status \"%s\""
8468
- msgstr ""
8469
-
8470
  #: includes/price-by-country/class-wcj-price-by-country-group-generator.php:34
8471
  msgid "Country groups successfully generated."
8472
  msgstr ""
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.0.6\n"
13
  "X-Poedit-Basepath: ..\n"
14
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
  "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
42
  #: includes/class-wcj-orders.php:125 includes/class-wcj-orders.php:154
43
  #: includes/class-wcj-payment-gateways.php:92
44
  #: includes/class-wcj-track-users.php:164 includes/class-wcj-track-users.php:252
45
+ #: includes/classes/class-wcj-module.php:582
46
+ #: includes/classes/class-wcj-module.php:782
47
  #: includes/settings/wcj-settings-price-by-country.php:238
48
  msgid "Booster"
49
  msgstr ""
256
 
257
  #: includes/admin/class-wc-settings-jetpack.php:591
258
  #: includes/class-wcj-admin-bar.php:172
259
+ #: includes/classes/class-wcj-module.php:922
260
  msgid "Documentation"
261
  msgstr ""
262
 
589
 
590
  #: includes/class-wcj-admin-bar.php:245 includes/class-wcj-admin-bar.php:288
591
  #: includes/class-wcj-admin-bar.php:632
592
+ #: includes/classes/class-wcj-module.php:755
593
  #: includes/settings/wcj-settings-wpml.php:91
594
  msgid "Tools"
595
  msgstr ""
2402
  #: includes/class-wcj-product-by-user.php:207
2403
  #: includes/class-wcj-purchase-data.php:95
2404
  #: includes/class-wcj-track-users.php:335
2405
+ #: includes/classes/class-wcj-module.php:891
2406
  #: includes/functions/wcj-functions-general.php:189
2407
  #: includes/functions/wcj-functions-html.php:117
2408
  #: includes/reports/wcj-class-reports-monthly-sales.php:351
5505
  "\" products."
5506
  msgstr ""
5507
 
5508
+ #: includes/classes/class-wcj-module.php:674
5509
  #, php-format
5510
  msgid "Selected: %s."
5511
  msgstr ""
5512
 
5513
+ #: includes/classes/class-wcj-module.php:743
5514
  msgid "Back to Module Settings"
5515
  msgstr ""
5516
 
5517
+ #: includes/classes/class-wcj-module.php:761
5518
  #: includes/settings/wcj-settings-wpml.php:96
5519
  msgid "Module Tools"
5520
  msgstr ""
5521
 
5522
+ #: includes/classes/class-wcj-module.php:834
5523
  #: includes/settings/wcj-settings-checkout-core-fields.php:77
5524
  msgid "enabled"
5525
  msgstr ""
5526
 
5527
+ #: includes/classes/class-wcj-module.php:835
5528
  msgid "disabled"
5529
  msgstr ""
5530
 
5531
+ #: includes/classes/class-wcj-module.php:843
5532
  #: includes/settings/wcj-settings-product-tabs.php:172
5533
  #: includes/settings/wcj-settings-product-tabs.php:184
5534
  #: includes/settings/wcj-settings-product-tabs.php:196
5536
  msgid "Deprecated"
5537
  msgstr ""
5538
 
5539
+ #: includes/classes/class-wcj-module.php:881
5540
  msgid "Reset Settings"
5541
  msgstr ""
5542
 
5543
+ #: includes/classes/class-wcj-module.php:887
5544
  msgid "Reset Module to Default Settings"
5545
  msgstr ""
5546
 
5547
+ #: includes/classes/class-wcj-module.php:888
5548
  msgid "Reset Submodule to Default Settings"
5549
  msgstr ""
5550
 
5551
+ #: includes/classes/class-wcj-module.php:892
5552
  msgid "Reset settings"
5553
  msgstr ""
5554
 
5555
+ #: includes/classes/class-wcj-module.php:926
5556
  msgid "Module Options"
5557
  msgstr ""
5558
 
5559
+ #: includes/classes/class-wcj-module.php:933
5560
  msgid "Enable Module"
5561
  msgstr ""
5562
 
8378
  msgid "Templates"
8379
  msgstr ""
8380
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8381
  #: includes/price-by-country/class-wcj-price-by-country-group-generator.php:34
8382
  msgid "Country groups successfully generated."
8383
  msgstr ""
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: anbinder, karzin, pluggabl
3
  Tags: woocommerce, booster for woocommerce, woocommerce jetpack
4
  Requires at least: 4.4
5
- Tested up to: 5.5
6
- Stable tag: 5.3.5
7
  License: GNU General Public License v3.0
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -193,6 +193,18 @@ You can see the differences between versions in this [table](https://booster.io/
193
 
194
  == Changelog ==
195
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  = 5.3.5 - 09/10/2020 =
197
  * Fix - PRODUCTS - Product by Condition - Fix shipping removing algorithm.
198
  * Fix - Improper replacement of `get_option()` by `wcj_option()`.
2
  Contributors: anbinder, karzin, pluggabl
3
  Tags: woocommerce, booster for woocommerce, woocommerce jetpack
4
  Requires at least: 4.4
5
+ Tested up to: 5.6
6
+ Stable tag: 5.3.6
7
  License: GNU General Public License v3.0
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
193
 
194
  == Changelog ==
195
 
196
+ = 5.3.6 - 30/12/2020 =
197
+ * Fix - CART & CHECKOUT - Checkout Custom Fields - Fix "Datepicker/Weekpicker: Current day time limit" timezone.
198
+ * Fix - PAYMENT GATEWAYS - Gateways Currency Converter - Call to undefined function `is_cart()`.
199
+ * Fix - PRICES & CURRENCIES - Wholesale Price - Fix "conflict between include/exclude product and include/exclude categories".
200
+ * Fix - PRODUCTS - Product Input Fields - Fixed the Uncaught TypeError: jQuery(...).live is not a function error
201
+ * Fix - PRODUCTS - Product Listings - Fixed the product visibility by category. Remove the woocommerce_product_is_visible filter and added woocommerce_product_query.
202
+ * Fix - Shortcodes - Orders - Add `[wcj_order_total_in_words]` shortcode. "Fixed issue for Lithuanian characters (LT) lang paramater.
203
+ * Dev - EMAILS & MISC. - Export - Round the amount added precision to amount values for export the csv file
204
+ * Dev - Classes - `WCJ_Module` - Add "hide_on_free" parameter allowing to create a feature hidden on free version.
205
+ * Fix - PDF Invoicing - Numbering - Fixed the numbering counter issue for bulk pdf generation.
206
+ * Fix - PDF Invoicing - Numbering - Fixed the numbering counter issue for pdf delete.
207
+
208
  = 5.3.5 - 09/10/2020 =
209
  * Fix - PRODUCTS - Product by Condition - Fix shipping removing algorithm.
210
  * Fix - Improper replacement of `get_option()` by `wcj_option()`.
woocommerce-jetpack.php CHANGED
@@ -3,13 +3,13 @@
3
  Plugin Name: Booster for WooCommerce
4
  Plugin URI: https://booster.io
5
  Description: Supercharge your WooCommerce site with these awesome powerful features. More than 100 modules. All in one WooCommerce plugin.
6
- Version: 5.3.5
7
  Author: Pluggabl LLC
8
  Author URI: https://booster.io
9
  Text Domain: woocommerce-jetpack
10
  Domain Path: /langs
11
  Copyright: © 2020 Pluggabl LLC.
12
- WC tested up to: 4.5
13
  License: GNU General Public License v3.0
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
  */
@@ -57,7 +57,7 @@ final class WC_Jetpack {
57
  * @var string
58
  * @since 2.4.7
59
  */
60
- public $version = '5.3.5';
61
 
62
  /**
63
  * @var WC_Jetpack The single instance of the class
3
  Plugin Name: Booster for WooCommerce
4
  Plugin URI: https://booster.io
5
  Description: Supercharge your WooCommerce site with these awesome powerful features. More than 100 modules. All in one WooCommerce plugin.
6
+ Version: 5.3.6
7
  Author: Pluggabl LLC
8
  Author URI: https://booster.io
9
  Text Domain: woocommerce-jetpack
10
  Domain Path: /langs
11
  Copyright: © 2020 Pluggabl LLC.
12
+ WC tested up to: 4.8
13
  License: GNU General Public License v3.0
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
  */
57
  * @var string
58
  * @since 2.4.7
59
  */
60
+ public $version = '5.3.6';
61
 
62
  /**
63
  * @var WC_Jetpack The single instance of the class