Booster for WooCommerce - Version 2.3.10

Version Description

  • 26/12/2015 =
  • Dev - WCJ_Tools and WCJ_Module - Code refactoring (mostly Tools related). Additionally modified modules: Admin Tools, Bulk Price Converter, Custom Price Labels, EU VAT Number, General, Old Slugs, Order Custom Statuses, Order Numbers, PDF Invoicing, SKU.
  • Dev - PDF Invoicing - "Invoices Report" tool - Code refactoring.
  • Dev - PDF Invoicing - "Invoices Report" tool - "Document Type" select option added.
  • Dev - PDF Invoicing - "Invoices Report" tool - "Download all monthly invoices PDFs in single ZIP file" button added.
  • Dev - PDF Invoicing - "Renumerate Invoices" tool - "End Date" field added.
  • Dev - PDF Invoicing - Display - Admin's "Orders" Page - "Column Title", "Create Button" and "Delete Button" options added.
  • Dev - PDF Invoicing - Display - "Misc." menu renamed to "Display & Misc.".
  • Dev - PDF Invoicing - Display - Customer's "My Account" Page - "Add link" and "Link text" options unlocked.
  • Dev - PDF Invoices (v1) marked as "Depreciated".
  • Fix - EMAILS & MISC. - General - Tabs on "Booster Tools" page fixed (caused other module's tools tabs disappear). Info on "Booster Tools Dashboard" page fixed.
  • Dev - EMAILS & MISC. - EU VAT Number - "EU Countries VAT Rates" tool added.
  • Dev - Donate link removed.
Download this release

Release Info

Developer algoritmika
Plugin Icon 128x128 Booster for WooCommerce
Version 2.3.10
Comparing to
See all releases

Code changes from version 2.3.9 to 2.3.10

includes/admin/class-wcj-tools.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Tools class.
6
  *
7
- * @version 2.2.4
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -15,7 +15,7 @@ if ( ! class_exists( 'WCJ_Tools' ) ) :
15
  class WCJ_Tools {
16
 
17
  /**
18
- * __construct.
19
  */
20
  function __construct() {
21
  if ( is_admin() ) {
@@ -29,61 +29,58 @@ class WCJ_Tools {
29
  * @version 2.2.4
30
  */
31
  function add_wcj_tools() {
32
- add_submenu_page( 'woocommerce', __( 'Booster for WooCommerce Tools', 'woocommerce-jetpack' ), __( 'Booster Tools', 'woocommerce-jetpack' ), 'manage_options', 'wcj-tools', array( $this, 'create_tools_page' ) );
 
 
 
 
 
 
 
33
  }
34
 
35
  /**
36
  * create_tools_page.
37
  *
38
- * @version 2.2.4
39
  */
40
  function create_tools_page() {
41
 
42
- $tabs = array(
 
43
  array(
44
- 'id' => 'dashboard',
45
- 'title' => __( 'Tools Dashboard', 'woocommerce-jetpack' ),
46
- //'desc' => __( 'WooCommerce Jetpack Tools Dashboard', 'woocommerce-jetpack' ),
47
  ),
48
- );
49
-
50
- $tabs = apply_filters( 'wcj_tools_tabs', $tabs );
51
-
52
  $html = '<h2 class="nav-tab-wrapper woo-nav-tab-wrapper">';
53
-
54
- $active_tab = 'dashboard';
55
- if ( isset( $_GET['tab'] ) )
56
- $active_tab = $_GET['tab'];
57
-
58
  foreach ( $tabs as $tab ) {
59
-
60
- $is_active = '';
61
- if ( $active_tab === $tab['id'] )
62
- $is_active = 'nav-tab-active';
63
-
64
- //$html .= '<a href="' . get_admin_url() . 'admin.php?page=wcj-tools&tab=' . $tab['id'] . '" class="nav-tab ' . $is_active . '">' . $tab['title'] . '</a>';
65
- //$html .= '<a href="' . add_query_arg( 'tab', $tab['id'] ) . '" class="nav-tab ' . $is_active . '">' . $tab['title'] . '</a>';
66
- $html .= '<a href="admin.php?page=wcj-tools&tab=' . $tab['id'] . '" class="nav-tab ' . $is_active . '">' . $tab['title'] . '</a>';
67
-
68
  }
69
  $html .= '</h2>';
70
-
71
  echo $html;
72
 
 
73
  if ( 'dashboard' === $active_tab ) {
74
- echo '<h3>' . __( 'Booster for WooCommerce Tools - Dashboard', 'woocommerce-jetpack' ) . '</h3>';
75
- echo '<p>' . __( 'This dashboard lets you check statuses and short descriptions of all available Booster for WooCommerce tools. Tools can be enabled through WooCommerce > Settings > Booster. Enabled tools will appear in the tabs menu above.', 'woocommerce-jetpack' ) . '</p>';
 
 
76
  echo '<table class="widefat" style="width:90%;">';
77
  echo '<tr>';
78
- echo '<th style="width:25%;">' . __( 'Tool', 'woocommerce-jetpack' ) . '</th>';
79
- echo '<th style="width:25%;">' . __( 'Status', 'woocommerce-jetpack' ) . '</th>';
80
  echo '<th style="width:50%;">' . __( 'Description', 'woocommerce-jetpack' ) . '</th>';
 
81
  echo '</tr>';
82
- do_action( 'wcj_tools_' . $active_tab );
83
  echo '</table>';
84
  }
85
- else
86
  do_action( 'wcj_tools_' . $active_tab );
 
87
  }
88
  }
89
 
4
  *
5
  * The WooCommerce Jetpack Tools class.
6
  *
7
+ * @version 2.3.10
8
  * @author Algoritmika Ltd.
9
  */
10
 
15
  class WCJ_Tools {
16
 
17
  /**
18
+ * Constructor.
19
  */
20
  function __construct() {
21
  if ( is_admin() ) {
29
  * @version 2.2.4
30
  */
31
  function add_wcj_tools() {
32
+ add_submenu_page(
33
+ 'woocommerce',
34
+ __( 'Booster for WooCommerce Tools', 'woocommerce-jetpack' ),
35
+ __( 'Booster Tools', 'woocommerce-jetpack' ),
36
+ 'manage_options',
37
+ 'wcj-tools',
38
+ array( $this, 'create_tools_page' )
39
+ );
40
  }
41
 
42
  /**
43
  * create_tools_page.
44
  *
45
+ * @version 2.3.10
46
  */
47
  function create_tools_page() {
48
 
49
+ // Tabs
50
+ $tabs = apply_filters( 'wcj_tools_tabs', array(
51
  array(
52
+ 'id' => 'dashboard',
53
+ 'title' => __( 'Tools Dashboard', 'woocommerce-jetpack' ),
 
54
  ),
55
+ ) );
 
 
 
56
  $html = '<h2 class="nav-tab-wrapper woo-nav-tab-wrapper">';
57
+ $active_tab = ( isset( $_GET['tab'] ) ) ? $_GET['tab'] : 'dashboard';
 
 
 
 
58
  foreach ( $tabs as $tab ) {
59
+ $is_active = ( $active_tab === $tab['id'] ) ? 'nav-tab-active' : '';
60
+ $html .= '<a href="' . add_query_arg( array( 'page' => 'wcj-tools', 'tab' => $tab['id'] ), get_admin_url() . 'admin.php' ) . '" class="nav-tab ' . $is_active . '">' . $tab['title'] . '</a>';
 
 
 
 
 
 
 
61
  }
62
  $html .= '</h2>';
 
63
  echo $html;
64
 
65
+ // Content
66
  if ( 'dashboard' === $active_tab ) {
67
+ $title = __( 'Booster for WooCommerce Tools - Dashboard', 'woocommerce-jetpack' );
68
+ $desc = __( 'This dashboard lets you check statuses and short descriptions of all available Booster for WooCommerce tools. Tools can be enabled through WooCommerce > Settings > Booster. Enabled tools will appear in the tabs menu above.', 'woocommerce-jetpack' );
69
+ echo '<h3>' . $title . '</h3>';
70
+ echo '<p>' . $desc . '</p>';
71
  echo '<table class="widefat" style="width:90%;">';
72
  echo '<tr>';
73
+ echo '<th style="width:20%;">' . __( 'Tool', 'woocommerce-jetpack' ) . '</th>';
74
+ echo '<th style="width:20%;">' . __( 'Module', 'woocommerce-jetpack' ) . '</th>';
75
  echo '<th style="width:50%;">' . __( 'Description', 'woocommerce-jetpack' ) . '</th>';
76
+ echo '<th style="width:10%;">' . __( 'Status', 'woocommerce-jetpack' ) . '</th>';
77
  echo '</tr>';
78
+ do_action( 'wcj_tools_' . 'dashboard' );
79
  echo '</table>';
80
  }
81
+ else {
82
  do_action( 'wcj_tools_' . $active_tab );
83
+ }
84
  }
85
  }
86
 
includes/admin/wcj-modules-cats.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Modules Array.
6
  *
7
- * @version 2.3.9
8
  * @since 2.2.0
9
  * @author Algoritmika Ltd.
10
  */
@@ -126,9 +126,9 @@ return array(
126
  'old_slugs',
127
  'reports',
128
  'admin_tools',
129
- 'pdf_invoices',
130
  'emails',
131
  'wpml',
 
132
  ),
133
  ),
134
 
4
  *
5
  * The WooCommerce Modules Array.
6
  *
7
+ * @version 2.3.10
8
  * @since 2.2.0
9
  * @author Algoritmika Ltd.
10
  */
126
  'old_slugs',
127
  'reports',
128
  'admin_tools',
 
129
  'emails',
130
  'wpml',
131
+ 'pdf_invoices',
132
  ),
133
  ),
134
 
includes/class-wcj-admin-tools.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Admin Tools class.
6
  *
7
- * @version 2.2.4
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -17,7 +17,7 @@ class WCJ_Admin_Tools extends WCJ_Module {
17
  /**
18
  * Constructor.
19
  *
20
- * @version 2.2.4
21
  */
22
  public function __construct() {
23
 
@@ -26,48 +26,21 @@ class WCJ_Admin_Tools extends WCJ_Module {
26
  $this->desc = __( 'Booster for WooCommerce debug and log tools.', 'woocommerce-jetpack' );
27
  parent::__construct();
28
 
29
- $this->add_tools( array( 'admin_tools' => __( 'Admin Tools', 'woocommerce-jetpack' ), ) );
30
-
31
- if ( $this->is_enabled() ) {
32
- add_filter( 'wcj_tools_tabs', array( $this, 'add_tool_tab' ), 100 );
33
- add_action( 'wcj_tools_' . 'admin_tools', array( $this, 'create_tool' ), 100 );
34
- }
35
-
36
- add_action( 'wcj_tools_dashboard', array( $this, 'add_tool_info_to_tools_dashboard' ), 100 );
37
- }
38
-
39
- /**
40
- * add_tool_info_to_tools_dashboard.
41
- */
42
- public function add_tool_info_to_tools_dashboard() {
43
- echo '<tr>';
44
- if ( 'yes' === get_option( 'wcj_admin_tools_enabled') )
45
- $is_enabled = '<span style="color:green;font-style:italic;">' . __( 'enabled', 'woocommerce-jetpack' ) . '</span>';
46
- else
47
- $is_enabled = '<span style="color:gray;font-style:italic;">' . __( 'disabled', 'woocommerce-jetpack' ) . '</span>';
48
- echo '<td>' . __( 'Admin Tools', 'woocommerce-jetpack' ) . '</td>';
49
- echo '<td>' . $is_enabled . '</td>';
50
- echo '<td>' . __( 'Log.', 'woocommerce-jetpack' ) . '</td>';
51
- echo '</tr>';
52
- }
53
-
54
- /**
55
- * add_tool_tab.
56
- */
57
- public function add_tool_tab( $tabs ) {
58
- $tabs[] = array(
59
- 'id' => 'admin_tools',
60
- 'title' => __( 'Log', 'woocommerce-jetpack' ),
61
- );
62
- return $tabs;
63
  }
64
 
65
  /**
66
  * create_tool.
67
  *
68
- * @version 2.2.3
69
  */
70
- public function create_tool() {
71
 
72
  $the_notice = '';
73
  if ( isset( $_GET['wcj_delete_log'] ) && is_super_admin() ) {
@@ -81,28 +54,29 @@ class WCJ_Admin_Tools extends WCJ_Module {
81
  $the_tools .= '<a href="' . add_query_arg( 'wcj_delete_log', '1' ) . '">' . __( 'Delete Log', 'woocommerce-jetpack' ) . '</a>';
82
 
83
  $the_log = '';
84
- //if ( isset( $_GET['wcj_view_log'] ) ) {
85
  $the_log .= '<pre>' . get_option( 'wcj_log', '' ) . '</pre>';
86
- //}
87
-
88
- echo '<p>' . $the_tools . '</p>';
89
 
 
90
  echo '<p>' . $the_notice . '</p>';
91
-
92
- echo '<p>' . $the_log . '</p>';
93
-
94
  }
95
 
96
  /**
97
  * get_settings.
98
  *
99
- * @version 2.2.3
100
  */
101
  function get_settings() {
102
 
103
  $settings = array(
104
 
105
- array( 'title' => __( 'Admin Tools Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_admin_tools_module_options' ),
 
 
 
 
106
 
107
  array(
108
  'title' => __( 'Logging', 'woocommerce-jetpack' ),
@@ -120,19 +94,20 @@ class WCJ_Admin_Tools extends WCJ_Module {
120
  'type' => 'checkbox',
121
  ),
122
 
123
- /*array(
124
  'title' => __( 'Custom Shortcode', 'woocommerce-jetpack' ),
125
  'id' => 'wcj_custom_shortcode_1',
126
  'default' => '',
127
  'type' => 'textarea',
128
- ),*/
129
 
130
- array( 'type' => 'sectionend', 'id' => 'wcj_admin_tools_module_options' ),
 
 
 
131
  );
132
 
133
- $settings = $this->add_tools_list( $settings );
134
-
135
- return $this->add_enable_module_setting( $settings );
136
  }
137
  }
138
 
4
  *
5
  * The WooCommerce Jetpack Admin Tools class.
6
  *
7
+ * @version 2.3.10
8
  * @author Algoritmika Ltd.
9
  */
10
 
17
  /**
18
  * Constructor.
19
  *
20
+ * @version 2.3.10
21
  */
22
  public function __construct() {
23
 
26
  $this->desc = __( 'Booster for WooCommerce debug and log tools.', 'woocommerce-jetpack' );
27
  parent::__construct();
28
 
29
+ $this->add_tools( array(
30
+ 'admin_tools' => array(
31
+ 'title' => __( 'Admin Tools', 'woocommerce-jetpack' ),
32
+ 'desc' => __( 'Log.', 'woocommerce-jetpack' ),
33
+ 'tab_title' => __( 'Log', 'woocommerce-jetpack' ),
34
+ ),
35
+ ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  }
37
 
38
  /**
39
  * create_tool.
40
  *
41
+ * @version 2.3.10
42
  */
43
+ public function create_admin_tools_tool() {
44
 
45
  $the_notice = '';
46
  if ( isset( $_GET['wcj_delete_log'] ) && is_super_admin() ) {
54
  $the_tools .= '<a href="' . add_query_arg( 'wcj_delete_log', '1' ) . '">' . __( 'Delete Log', 'woocommerce-jetpack' ) . '</a>';
55
 
56
  $the_log = '';
57
+ // if ( isset( $_GET['wcj_view_log'] ) ) {
58
  $the_log .= '<pre>' . get_option( 'wcj_log', '' ) . '</pre>';
59
+ // }
 
 
60
 
61
+ echo '<p>' . $the_tools . '</p>';
62
  echo '<p>' . $the_notice . '</p>';
63
+ echo '<p>' . $the_log . '</p>';
 
 
64
  }
65
 
66
  /**
67
  * get_settings.
68
  *
69
+ * @version 2.3.10
70
  */
71
  function get_settings() {
72
 
73
  $settings = array(
74
 
75
+ array(
76
+ 'title' => __( 'Admin Tools Options', 'woocommerce-jetpack' ),
77
+ 'type' => 'title',
78
+ 'id' => 'wcj_admin_tools_module_options',
79
+ ),
80
 
81
  array(
82
  'title' => __( 'Logging', 'woocommerce-jetpack' ),
94
  'type' => 'checkbox',
95
  ),
96
 
97
+ /* array(
98
  'title' => __( 'Custom Shortcode', 'woocommerce-jetpack' ),
99
  'id' => 'wcj_custom_shortcode_1',
100
  'default' => '',
101
  'type' => 'textarea',
102
+ ), */
103
 
104
+ array(
105
+ 'type' => 'sectionend',
106
+ 'id' => 'wcj_admin_tools_module_options',
107
+ ),
108
  );
109
 
110
+ return $this->add_standard_settings( $settings );
 
 
111
  }
112
  }
113
 
includes/class-wcj-emails.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Emails class.
6
  *
7
- * @version 2.3.9
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -140,7 +140,7 @@ class WCJ_Emails extends WCJ_Module {
140
  /**
141
  * get_settings.
142
  *
143
- * @version 2.3.9
144
  */
145
  function get_settings() {
146
  $settings = array(
@@ -165,7 +165,7 @@ class WCJ_Emails extends WCJ_Module {
165
  ),
166
  );
167
  $settings = array_merge( $settings, $this->get_emails_forwarding_settings() );
168
- return $this->add_enable_module_setting( $settings );
169
  }
170
  }
171
 
4
  *
5
  * The WooCommerce Jetpack Emails class.
6
  *
7
+ * @version 2.3.10
8
  * @author Algoritmika Ltd.
9
  */
10
 
140
  /**
141
  * get_settings.
142
  *
143
+ * @version 2.3.10
144
  */
145
  function get_settings() {
146
  $settings = array(
165
  ),
166
  );
167
  $settings = array_merge( $settings, $this->get_emails_forwarding_settings() );
168
+ return $this->add_standard_settings( $settings );
169
  }
170
  }
171
 
includes/class-wcj-eu-vat-number.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack EU VAT Number class.
6
  *
7
- * @version 2.3.9
8
  * @since 2.3.9
9
  * @author Algoritmika Ltd.
10
  */
@@ -17,6 +17,8 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
17
 
18
  /**
19
  * Constructor.
 
 
20
  */
21
  function __construct() {
22
 
@@ -25,6 +27,13 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
25
  $this->desc = __( 'Collect and validate EU VAT numbers on WooCommerce checkout. Automatically disable VAT for valid numbers.', 'woocommerce-jetpack' );
26
  parent::__construct();
27
 
 
 
 
 
 
 
 
28
  if ( $this->is_enabled() ) {
29
  /* if ( ! session_id() ) {
30
  session_start();
@@ -41,9 +50,21 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
41
  add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'update_eu_vat_number_checkout_field_order_meta' ) );
42
  add_filter( 'woocommerce_customer_meta_fields', array( $this, 'add_eu_vat_number_customer_meta_field' ) );
43
  add_filter( 'default_checkout_billing_eu_vat_number', array( $this, 'add_default_checkout_billing_eu_vat_number' ), PHP_INT_MAX, 2 );
 
 
44
  }
45
  }
46
 
 
 
 
 
 
 
 
 
 
 
47
  /**
48
  * add_default_checkout_billing_eu_vat_number.
49
  */
@@ -231,6 +252,8 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
231
 
232
  /**
233
  * get_settings.
 
 
234
  */
235
  function get_settings() {
236
 
@@ -330,7 +353,7 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
330
  ),
331
  );
332
 
333
- return $this->add_enable_module_setting( $settings );
334
  }
335
  }
336
 
4
  *
5
  * The WooCommerce Jetpack EU VAT Number class.
6
  *
7
+ * @version 2.3.10
8
  * @since 2.3.9
9
  * @author Algoritmika Ltd.
10
  */
17
 
18
  /**
19
  * Constructor.
20
+ *
21
+ * @version 2.3.10
22
  */
23
  function __construct() {
24
 
27
  $this->desc = __( 'Collect and validate EU VAT numbers on WooCommerce checkout. Automatically disable VAT for valid numbers.', 'woocommerce-jetpack' );
28
  parent::__construct();
29
 
30
+ $this->add_tools( array(
31
+ 'eu_countries_vat_rates' => array(
32
+ 'title' => __( 'EU Countries VAT Rates', 'woocommerce-jetpack' ),
33
+ 'desc' => __( 'Add all EU countries VAT standard rates to WooCommerce.', 'woocommerce-jetpack' ),
34
+ ),
35
+ ) );
36
+
37
  if ( $this->is_enabled() ) {
38
  /* if ( ! session_id() ) {
39
  session_start();
50
  add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'update_eu_vat_number_checkout_field_order_meta' ) );
51
  add_filter( 'woocommerce_customer_meta_fields', array( $this, 'add_eu_vat_number_customer_meta_field' ) );
52
  add_filter( 'default_checkout_billing_eu_vat_number', array( $this, 'add_default_checkout_billing_eu_vat_number' ), PHP_INT_MAX, 2 );
53
+
54
+ $this->eu_countries_vat_rates_tool = include_once( 'tools/class-wcj-eu-countries-vat-rates-tool.php' );
55
  }
56
  }
57
 
58
+ /**
59
+ * create_eu_countries_vat_rates_tool.
60
+ *
61
+ * @version 2.3.10
62
+ * @since 2.3.10
63
+ */
64
+ function create_eu_countries_vat_rates_tool() {
65
+ return $this->eu_countries_vat_rates_tool->create_eu_countries_vat_rates_tool( $this->get_tool_header_html( 'eu_countries_vat_rates' ) );
66
+ }
67
+
68
  /**
69
  * add_default_checkout_billing_eu_vat_number.
70
  */
252
 
253
  /**
254
  * get_settings.
255
+ *
256
+ * @version 2.3.10
257
  */
258
  function get_settings() {
259
 
353
  ),
354
  );
355
 
356
+ return $this->add_standard_settings( $settings );
357
  }
358
  }
359
 
includes/class-wcj-general.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack General class.
6
  *
7
- * @version 2.3.9
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -17,7 +17,7 @@ class WCJ_General extends WCJ_Module {
17
  /**
18
  * Constructor.
19
  *
20
- * @version 2.3.9
21
  */
22
  public function __construct() {
23
 
@@ -27,8 +27,14 @@ class WCJ_General extends WCJ_Module {
27
  parent::__construct();
28
 
29
  $this->add_tools( array(
30
- 'products_atts' => __( 'All Products and All Attributes', 'woocommerce-jetpack' ),
31
- 'export_customers' => __( 'Export Customers', 'woocommerce-jetpack' ),
 
 
 
 
 
 
32
  ) );
33
 
34
  if ( $this->is_enabled() ) {
@@ -43,31 +49,9 @@ class WCJ_General extends WCJ_Module {
43
  if ( '' != get_option( 'wcj_general_custom_admin_css' ) ) {
44
  add_action( 'admin_head', array( $this, 'hook_custom_admin_css' ) );
45
  }
46
-
47
- add_filter( 'wcj_tools_tabs', array( $this, 'add_tool_tabs' ), 100 );
48
- add_action( 'wcj_tools_' . 'products_atts', array( $this, 'create_products_atts_tool' ), 100 );
49
- add_action( 'wcj_tools_' . 'export_customers', array( $this, 'create_export_customers_tool' ), 100 );
50
  }
51
  }
52
 
53
- /**
54
- * add_tool_tabs.
55
- *
56
- * @version 2.3.9
57
- * @since 2.3.9
58
- */
59
- function add_tool_tabs() {
60
- $tabs[] = array(
61
- 'id' => 'products_atts',
62
- 'title' => __( 'Products Atts', 'woocommerce-jetpack' ),
63
- );
64
- $tabs[] = array(
65
- 'id' => 'export_customers',
66
- 'title' => __( 'Export Customers', 'woocommerce-jetpack' ),
67
- );
68
- return $tabs;
69
- }
70
-
71
  /**
72
  * create_export_customers_tool.
73
  *
@@ -187,7 +171,7 @@ class WCJ_General extends WCJ_Module {
187
  $_GET['wcj_attribute'],
188
  );
189
  } else {
190
- //$table_data[] = array_values( $attributes_names );
191
  $table_data[] = array_keys( $attributes_names );
192
  }
193
  foreach ( $attributes_names as $attributes_name => $attribute_title ) {
4
  *
5
  * The WooCommerce Jetpack General class.
6
  *
7
+ * @version 2.3.10
8
  * @author Algoritmika Ltd.
9
  */
10
 
17
  /**
18
  * Constructor.
19
  *
20
+ * @version 2.3.10
21
  */
22
  public function __construct() {
23
 
27
  parent::__construct();
28
 
29
  $this->add_tools( array(
30
+ 'products_atts' => array(
31
+ 'title' => __( 'Products Atts', 'woocommerce-jetpack' ),
32
+ 'desc' => __( 'All Products and All Attributes.', 'woocommerce-jetpack' ),
33
+ ),
34
+ 'export_customers' => array(
35
+ 'title' => __( 'Export Customers', 'woocommerce-jetpack' ),
36
+ 'desc' => __( 'Export Customers (extracted from orders).', 'woocommerce-jetpack' ),
37
+ ),
38
  ) );
39
 
40
  if ( $this->is_enabled() ) {
49
  if ( '' != get_option( 'wcj_general_custom_admin_css' ) ) {
50
  add_action( 'admin_head', array( $this, 'hook_custom_admin_css' ) );
51
  }
 
 
 
 
52
  }
53
  }
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  /**
56
  * create_export_customers_tool.
57
  *
171
  $_GET['wcj_attribute'],
172
  );
173
  } else {
174
+ // $table_data[] = array_values( $attributes_names );
175
  $table_data[] = array_keys( $attributes_names );
176
  }
177
  foreach ( $attributes_names as $attributes_name => $attribute_title ) {
includes/class-wcj-old-slugs.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Old Slugs class.
6
  *
7
- * @version 2.3.9
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -17,7 +17,7 @@ class WCJ_Old_Slugs extends WCJ_Module {
17
  /**
18
  * Constructor.
19
  *
20
- * @version 2.3.9
21
  */
22
  public function __construct() {
23
 
@@ -26,41 +26,12 @@ class WCJ_Old_Slugs extends WCJ_Module {
26
  $this->desc = __( 'Remove old WooCommerce products slugs.', 'woocommerce-jetpack' );
27
  parent::__construct();
28
 
29
- $this->add_tools( array( 'old_slugs' => __( 'Remove Old Slugs', 'woocommerce-jetpack' ), ) );
30
-
31
- if ( $this->is_enabled() ) {
32
- if ( is_admin() ) {
33
- add_filter( 'wcj_tools_tabs', array( $this, 'add_old_slugs_tool_tab' ), 100 );
34
- add_action( 'wcj_tools_old_slugs', array( $this, 'create_old_slugs_tool' ), 100 );
35
- }
36
- }
37
- add_action( 'wcj_tools_dashboard', array( $this, 'add_old_slugs_tool_info_to_tools_dashboard' ), 100 );
38
- }
39
-
40
- /**
41
- * add_old_slugs_tool_info_to_tools_dashboard.
42
- */
43
- public function add_old_slugs_tool_info_to_tools_dashboard() {
44
- echo '<tr>';
45
- if ( 'yes' === get_option( 'wcj_old_slugs_enabled') )
46
- $is_enabled = '<span style="color:green;font-style:italic;">' . __( 'enabled', 'woocommerce-jetpack' ) . '</span>';
47
- else
48
- $is_enabled = '<span style="color:gray;font-style:italic;">' . __( 'disabled', 'woocommerce-jetpack' ) . '</span>';
49
- echo '<td>' . __( 'Remove Old Slugs', 'woocommerce-jetpack' ) . '</td>';
50
- echo '<td>' . $is_enabled . '</td>';
51
- echo '<td>' . __( 'Tool removes old slugs/permalinks from database.', 'woocommerce-jetpack' ) . '</td>';
52
- echo '</tr>';
53
- }
54
-
55
- /**
56
- * add_old_slugs_tool_tab.
57
- */
58
- public function add_old_slugs_tool_tab( $tabs ) {
59
- $tabs[] = array(
60
- 'id' => 'old_slugs',
61
- 'title' => __( 'Remove Old Slugs', 'woocommerce-jetpack' ),
62
- );
63
- return $tabs;
64
  }
65
 
66
  /*
@@ -122,8 +93,9 @@ class WCJ_Old_Slugs extends WCJ_Module {
122
  $remove_result_html = '<div class="updated"><p><strong>Removing old slugs from database finished! ' . ($num_old_slugs-$recheck_result_count) . ' old slug(s) deleted. Please <a href="">refresh</a> the page.</strong></p></div>';
123
  }
124
  }
 
125
  ?><div>
126
- <h2><?php _e( 'WooCommerce Jetpack - Remove Old Product Slugs', 'woocommerce-jetpack' ); ?></h2>
127
  <p><?php _e( 'Tool removes old slugs/permalinks from database.', 'woocommerce-jetpack' ); ?></p>
128
  <?php echo $remove_result_html; ?>
129
  <?php
4
  *
5
  * The WooCommerce Jetpack Old Slugs class.
6
  *
7
+ * @version 2.3.10
8
  * @author Algoritmika Ltd.
9
  */
10
 
17
  /**
18
  * Constructor.
19
  *
20
+ * @version 2.3.10
21
  */
22
  public function __construct() {
23
 
26
  $this->desc = __( 'Remove old WooCommerce products slugs.', 'woocommerce-jetpack' );
27
  parent::__construct();
28
 
29
+ $this->add_tools( array(
30
+ 'old_slugs' => array(
31
+ 'title' => __( 'Remove Old Slugs', 'woocommerce-jetpack' ),
32
+ 'desc' => __( 'Tool removes old slugs/permalinks from database.', 'woocommerce-jetpack' ),
33
+ ),
34
+ ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
36
 
37
  /*
93
  $remove_result_html = '<div class="updated"><p><strong>Removing old slugs from database finished! ' . ($num_old_slugs-$recheck_result_count) . ' old slug(s) deleted. Please <a href="">refresh</a> the page.</strong></p></div>';
94
  }
95
  }
96
+
97
  ?><div>
98
+ <h2><?php _e( 'Booster - Remove Old Product Slugs', 'woocommerce-jetpack' ); ?></h2>
99
  <p><?php _e( 'Tool removes old slugs/permalinks from database.', 'woocommerce-jetpack' ); ?></p>
100
  <?php echo $remove_result_html; ?>
101
  <?php
includes/class-wcj-order-custom-statuses.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Order Custom Statuses class.
6
  *
7
- * @version 2.3.8
8
  * @since 2.2.0
9
  * @author Algoritmika Ltd.
10
  */
@@ -18,7 +18,7 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
18
  /**
19
  * Constructor.
20
  *
21
- * @version 2.3.8
22
  */
23
  public function __construct() {
24
 
@@ -27,7 +27,12 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
27
  $this->desc = __( 'Custom statuses for WooCommerce orders.', 'woocommerce-jetpack' );
28
  parent::__construct();
29
 
30
- $this->add_tools( array( 'custom_statuses' => __( 'Custom Statuses', 'woocommerce-jetpack' ), ) );
 
 
 
 
 
31
 
32
  $this->default_statuses = array(
33
  'wc-pending' => _x( 'Pending payment', 'Order status', 'woocommerce' ),
@@ -44,8 +49,6 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
44
  add_filter( 'wc_order_statuses', array( $this, 'add_custom_statuses_to_filter' ), 100 );
45
  add_action( 'init', array( $this, 'register_custom_post_statuses' ) );
46
  add_action( 'admin_head', array( $this, 'hook_statuses_icons_css' ) );
47
- add_filter( 'wcj_tools_tabs', array( $this, 'add_custom_statuses_tool_tab' ), 100 );
48
- add_action( 'wcj_tools_custom_statuses', array( $this, 'create_custom_statuses_tool' ), 100 );
49
 
50
  add_filter( 'woocommerce_default_order_status', array( $this, 'set_default_order_status' ), 100 );
51
 
@@ -56,10 +59,7 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
56
  if ( 'yes' === get_option( 'wcj_orders_custom_statuses_add_to_bulk_actions' ) ) {
57
  add_action( 'admin_footer', array( $this, 'bulk_admin_footer' ), 11 );
58
  }
59
-
60
  }
61
-
62
- add_action( 'wcj_tools_dashboard', array( $this, 'add_custom_statuses_tool_info_to_tools_dashboard' ), 100 );
63
  }
64
 
65
  /**
@@ -112,31 +112,6 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
112
  return array_merge( $order_statuses, $wcj_orders_custom_statuses_array );
113
  }
114
 
115
- /**
116
- * add_custom_statuses_tool_info_to_tools_dashboard.
117
- */
118
- public function add_custom_statuses_tool_info_to_tools_dashboard() {
119
- echo '<tr>';
120
- $is_enabled = ( $this->is_enabled() ) ?
121
- '<span style="color:green;font-style:italic;">' . __( 'enabled', 'woocommerce-jetpack' ) . '</span>' :
122
- '<span style="color:gray;font-style:italic;">' . __( 'disabled', 'woocommerce-jetpack' ) . '</span>';
123
- echo '<td>' . __( 'Custom Statuses', 'woocommerce-jetpack' ) . '</td>';
124
- echo '<td>' . $is_enabled . '</td>';
125
- echo '<td>' . __( 'Tool lets you add or delete any custom status for WooCommerce orders.', 'woocommerce-jetpack' ) . '</td>';
126
- echo '</tr>';
127
- }
128
-
129
- /**
130
- * add_custom_statuses_tool_tab.
131
- */
132
- public function add_custom_statuses_tool_tab( $tabs ) {
133
- $tabs[] = array(
134
- 'id' => 'custom_statuses',
135
- 'title' => __( 'Custom Statuses', 'woocommerce-jetpack' ),
136
- );
137
- return $tabs;
138
- }
139
-
140
  /**
141
  * hook_statuses_icons_css.
142
  *
4
  *
5
  * The WooCommerce Jetpack Order Custom Statuses class.
6
  *
7
+ * @version 2.3.10
8
  * @since 2.2.0
9
  * @author Algoritmika Ltd.
10
  */
18
  /**
19
  * Constructor.
20
  *
21
+ * @version 2.3.10
22
  */
23
  public function __construct() {
24
 
27
  $this->desc = __( 'Custom statuses for WooCommerce orders.', 'woocommerce-jetpack' );
28
  parent::__construct();
29
 
30
+ $this->add_tools( array(
31
+ 'custom_statuses' => array(
32
+ 'title' => __( 'Custom Statuses', 'woocommerce-jetpack' ),
33
+ 'desc' => __( 'Tool lets you add or delete any custom status for WooCommerce orders.', 'woocommerce-jetpack' ),
34
+ ),
35
+ ) );
36
 
37
  $this->default_statuses = array(
38
  'wc-pending' => _x( 'Pending payment', 'Order status', 'woocommerce' ),
49
  add_filter( 'wc_order_statuses', array( $this, 'add_custom_statuses_to_filter' ), 100 );
50
  add_action( 'init', array( $this, 'register_custom_post_statuses' ) );
51
  add_action( 'admin_head', array( $this, 'hook_statuses_icons_css' ) );
 
 
52
 
53
  add_filter( 'woocommerce_default_order_status', array( $this, 'set_default_order_status' ), 100 );
54
 
59
  if ( 'yes' === get_option( 'wcj_orders_custom_statuses_add_to_bulk_actions' ) ) {
60
  add_action( 'admin_footer', array( $this, 'bulk_admin_footer' ), 11 );
61
  }
 
62
  }
 
 
63
  }
64
 
65
  /**
112
  return array_merge( $order_statuses, $wcj_orders_custom_statuses_array );
113
  }
114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  /**
116
  * hook_statuses_icons_css.
117
  *
includes/class-wcj-order-numbers.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Order Numbers class.
6
  *
7
- * @version 2.2.7
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -17,7 +17,7 @@ class WCJ_Order_Numbers extends WCJ_Module {
17
  /**
18
  * Constructor.
19
  *
20
- * @version 2.2.7
21
  */
22
  public function __construct() {
23
 
@@ -26,14 +26,19 @@ class WCJ_Order_Numbers extends WCJ_Module {
26
  $this->desc = __( 'WooCommerce sequential order numbering, custom order number prefix, suffix and number width.', 'woocommerce-jetpack' );
27
  parent::__construct();
28
 
 
 
 
 
 
 
 
 
29
  if ( $this->is_enabled() ) {
30
  // add_action( 'woocommerce_new_order', array( $this, 'add_new_order_number' ), PHP_INT_MAX );
31
  add_action( 'wp_insert_post', array( $this, 'add_new_order_number' ), PHP_INT_MAX );
32
  add_filter( 'woocommerce_order_number', array( $this, 'display_order_number' ), PHP_INT_MAX, 2 );
33
- add_filter( 'wcj_tools_tabs', array( $this, 'add_renumerate_orders_tool_tab' ), PHP_INT_MAX );
34
- add_action( 'wcj_tools_renumerate_orders', array( $this, 'create_renumerate_orders_tool' ), PHP_INT_MAX );
35
  }
36
- add_action( 'wcj_tools_dashboard', array( $this, 'add_renumerate_orders_tool_info_to_tools_dashboard' ), PHP_INT_MAX );
37
  }
38
 
39
  /**
@@ -59,32 +64,6 @@ class WCJ_Order_Numbers extends WCJ_Module {
59
  return $order_number;
60
  }
61
 
62
- /**
63
- * add_renumerate_orders_tool_info_to_tools_dashboard.
64
- */
65
- public function add_renumerate_orders_tool_info_to_tools_dashboard() {
66
- echo '<tr>';
67
- if ( 'yes' === get_option( 'wcj_order_numbers_enabled') )
68
- $is_enabled = '<span style="color:green;font-style:italic;">' . __( 'enabled', 'woocommerce-jetpack' ) . '</span>';
69
- else
70
- $is_enabled = '<span style="color:gray;font-style:italic;">' . __( 'disabled', 'woocommerce-jetpack' ) . '</span>';
71
- echo '<td>' . __( 'Orders Renumerate', 'woocommerce-jetpack' ) . '</td>';
72
- echo '<td>' . $is_enabled . '</td>';
73
- echo '<td>' . __( 'Tool renumerates all orders.', 'woocommerce-jetpack' ) . '</td>';
74
- echo '</tr>';
75
- }
76
-
77
- /**
78
- * add_renumerate_orders_tool_tab.
79
- */
80
- public function add_renumerate_orders_tool_tab( $tabs ) {
81
- $tabs[] = array(
82
- 'id' => 'renumerate_orders',
83
- 'title' => __( 'Renumerate orders', 'woocommerce-jetpack' ),
84
- );
85
- return $tabs;
86
- }
87
-
88
  /**
89
  * Add Renumerate Orders tool to WooCommerce menu (the content).
90
  *
@@ -153,6 +132,8 @@ class WCJ_Order_Numbers extends WCJ_Module {
153
 
154
  /**
155
  * get_settings.
 
 
156
  */
157
  function get_settings() {
158
 
@@ -238,7 +219,7 @@ class WCJ_Order_Numbers extends WCJ_Module {
238
 
239
  );
240
 
241
- return $this->add_enable_module_setting( $settings );
242
  }
243
  }
244
 
4
  *
5
  * The WooCommerce Jetpack Order Numbers class.
6
  *
7
+ * @version 2.3.10
8
  * @author Algoritmika Ltd.
9
  */
10
 
17
  /**
18
  * Constructor.
19
  *
20
+ * @version 2.3.10
21
  */
22
  public function __construct() {
23
 
26
  $this->desc = __( 'WooCommerce sequential order numbering, custom order number prefix, suffix and number width.', 'woocommerce-jetpack' );
27
  parent::__construct();
28
 
29
+ $this->add_tools( array(
30
+ 'renumerate_orders' => array(
31
+ 'title' => __( 'Orders Renumerate', 'woocommerce-jetpack' ),
32
+ 'desc' => __( 'Tool renumerates all orders.', 'woocommerce-jetpack' ),
33
+ // 'tab_title' => __( 'Renumerate orders', 'woocommerce-jetpack' ),
34
+ ),
35
+ ) );
36
+
37
  if ( $this->is_enabled() ) {
38
  // add_action( 'woocommerce_new_order', array( $this, 'add_new_order_number' ), PHP_INT_MAX );
39
  add_action( 'wp_insert_post', array( $this, 'add_new_order_number' ), PHP_INT_MAX );
40
  add_filter( 'woocommerce_order_number', array( $this, 'display_order_number' ), PHP_INT_MAX, 2 );
 
 
41
  }
 
42
  }
43
 
44
  /**
64
  return $order_number;
65
  }
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  /**
68
  * Add Renumerate Orders tool to WooCommerce menu (the content).
69
  *
132
 
133
  /**
134
  * get_settings.
135
+ *
136
+ * @version 2.3.10
137
  */
138
  function get_settings() {
139
 
219
 
220
  );
221
 
222
+ return $this->add_standard_settings( $settings );
223
  }
224
  }
225
 
includes/class-wcj-pdf-invoices.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack PDF Invoices class.
6
  *
7
- * @version 2.2.2
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -14,26 +14,28 @@ if ( ! class_exists( 'WCJ_PDF_Invoices' ) ) :
14
 
15
  class WCJ_PDF_Invoices {
16
 
17
- public $default_css =
18
- '.pdf_invoice_header_text_wcj { text-align: right; color: gray; font-weight: bold; }
19
- .pdf_invoice_number_and_date_table_wcj { width: 50%; }
20
- .pdf_invoice_items_table_wcj { padding: 5px; width: 100%; }
21
- .pdf_invoice_items_table_wcj th { border: 1px solid #F0F0F0; font-weight: bold; text-align: center; }
22
- .pdf_invoice_items_table_wcj td { border: 1px solid #F0F0F0; }
23
- .pdf_invoice_totals_table_wcj { padding: 5px; width: 100%; }
24
- .pdf_invoice_totals_table_wcj th { width: 80%; text-align: right; }
25
- .pdf_invoice_totals_table_wcj td { width: 20%; text-align: right; border: 1px solid #F0F0F0; }';
26
 
27
  /**
28
  * Constructor.
29
  */
30
  public function __construct() {
31
 
32
- //add_shortcode( 'wcj_order_date', array( $this, 'shortcode_pdf_invoices_order_date' ) );
33
- //add_shortcode( 'wcj_order_billing_address', array( $this, 'shortcode_pdf_invoices_billing_address' ) );
34
- //add_shortcode( 'wcj_items_total_weight', array( $this, 'shortcode_pdf_invoices_items_total_weight' ) );
35
- //add_shortcode( 'wcj_items_total_quantity', array( $this, 'shortcode_pdf_invoices_items_total_quantity' ) );
36
- //add_shortcode( 'wcj_items_total_number', array( $this, 'shortcode_pdf_invoices_items_total_number' ) );
 
 
 
 
 
 
 
 
 
 
37
 
38
  // Main hooks
39
  if ( get_option( 'wcj_pdf_invoices_enabled' ) == 'yes' ) {
@@ -1432,9 +1434,11 @@ class WCJ_PDF_Invoices {
1432
 
1433
  /**
1434
  * settings_section.
 
 
1435
  */
1436
  function settings_section( $sections ) {
1437
- $sections['pdf_invoices'] = __( 'PDF Invoices', 'woocommerce-jetpack' );
1438
  return $sections;
1439
  }
1440
  }
4
  *
5
  * The WooCommerce Jetpack PDF Invoices class.
6
  *
7
+ * @version 2.3.10
8
  * @author Algoritmika Ltd.
9
  */
10
 
14
 
15
  class WCJ_PDF_Invoices {
16
 
17
+ public $default_css;
 
 
 
 
 
 
 
 
18
 
19
  /**
20
  * Constructor.
21
  */
22
  public function __construct() {
23
 
24
+ $this->default_css =
25
+ '.pdf_invoice_header_text_wcj { text-align: right; color: gray; font-weight: bold; } ' .
26
+ '.pdf_invoice_number_and_date_table_wcj { width: 50%; } ' .
27
+ '.pdf_invoice_items_table_wcj { padding: 5px; width: 100%; } ' .
28
+ '.pdf_invoice_items_table_wcj th { border: 1px solid #F0F0F0; font-weight: bold; text-align: center; } ' .
29
+ '.pdf_invoice_items_table_wcj td { border: 1px solid #F0F0F0; } ' .
30
+ '.pdf_invoice_totals_table_wcj { padding: 5px; width: 100%; } ' .
31
+ '.pdf_invoice_totals_table_wcj th { width: 80%; text-align: right; } ' .
32
+ '.pdf_invoice_totals_table_wcj td { width: 20%; text-align: right; border: 1px solid #F0F0F0; }';
33
+
34
+ // add_shortcode( 'wcj_order_date', array( $this, 'shortcode_pdf_invoices_order_date' ) );
35
+ // add_shortcode( 'wcj_order_billing_address', array( $this, 'shortcode_pdf_invoices_billing_address' ) );
36
+ // add_shortcode( 'wcj_items_total_weight', array( $this, 'shortcode_pdf_invoices_items_total_weight' ) );
37
+ // add_shortcode( 'wcj_items_total_quantity', array( $this, 'shortcode_pdf_invoices_items_total_quantity' ) );
38
+ // add_shortcode( 'wcj_items_total_number', array( $this, 'shortcode_pdf_invoices_items_total_number' ) );
39
 
40
  // Main hooks
41
  if ( get_option( 'wcj_pdf_invoices_enabled' ) == 'yes' ) {
1434
 
1435
  /**
1436
  * settings_section.
1437
+ *
1438
+ * @version 2.3.10
1439
  */
1440
  function settings_section( $sections ) {
1441
+ $sections['pdf_invoices'] = __( 'PDF Invoices', 'woocommerce-jetpack' ) . ' v1 - <em>' . __( 'Depreciated', 'woocommerce-jetpack' ) . '</em>';
1442
  return $sections;
1443
  }
1444
  }
includes/class-wcj-pdf-invoicing.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack PDF Invoicing class.
6
  *
7
- * @version 2.3.0
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -17,7 +17,7 @@ class WCJ_PDF_Invoicing extends WCJ_Module {
17
  /**
18
  * Constructor.
19
  *
20
- * @version 2.3.0
21
  */
22
  public function __construct() {
23
 
@@ -27,14 +27,24 @@ class WCJ_PDF_Invoicing extends WCJ_Module {
27
  $this->desc = __( 'WooCommerce Invoices, Proforma Invoices, Credit Notes and Packing Slips.', 'woocommerce-jetpack' );
28
  parent::__construct();
29
 
30
- if ( $this->is_enabled() ) {
 
 
 
 
 
 
 
 
 
31
 
32
- include_once( 'pdf-invoices/class-wcj-pdf-invoicing-renumerate-tool.php' );
33
- include_once( 'pdf-invoices/class-wcj-pdf-invoicing-report-tool.php' );
34
 
35
  add_action( 'init', array( $this, 'catch_args' ) );
36
  add_action( 'init', array( $this, 'generate_pdf_on_init' ) );
37
 
 
 
38
  // define ( 'K_PATH_IMAGES', $_SERVER['DOCUMENT_ROOT'] );
39
 
40
  $invoice_types = wcj_get_enabled_invoice_types();
@@ -52,13 +62,35 @@ class WCJ_PDF_Invoicing extends WCJ_Module {
52
  }
53
  }
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  /**
56
  * create_meta_box.
57
  *
58
  * @version 2.3.0
59
  * @since 2.3.0
60
- *
61
- public function create_meta_box() {
62
 
63
  $current_post_id = get_the_ID();
64
 
@@ -90,7 +122,7 @@ class WCJ_PDF_Invoicing extends WCJ_Module {
90
  }
91
  $html .= '</table>';
92
  echo $html;
93
- }
94
 
95
  * create_invoice.
96
  */
@@ -201,7 +233,7 @@ class WCJ_PDF_Invoicing extends WCJ_Module {
201
 
202
  * get_settings.
203
  *
204
- * @version 2.3.0
205
  */
206
  function get_settings() {
207
 
@@ -237,7 +269,7 @@ class WCJ_PDF_Invoicing extends WCJ_Module {
237
 
238
  $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_pdf_invoicing_options' );
239
 
240
- return $this->add_enable_module_setting( $settings );
241
  }
242
  }
243
 
4
  *
5
  * The WooCommerce Jetpack PDF Invoicing class.
6
  *
7
+ * @version 2.3.10
8
  * @author Algoritmika Ltd.
9
  */
10
 
17
  /**
18
  * Constructor.
19
  *
20
+ * @version 2.3.10
21
  */
22
  public function __construct() {
23
 
27
  $this->desc = __( 'WooCommerce Invoices, Proforma Invoices, Credit Notes and Packing Slips.', 'woocommerce-jetpack' );
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
 
43
  add_action( 'init', array( $this, 'catch_args' ) );
44
  add_action( 'init', array( $this, 'generate_pdf_on_init' ) );
45
 
46
+ $this->the_pdf_invoicing_report_tool = include_once( 'pdf-invoices/class-wcj-pdf-invoicing-report-tool.php' );
47
+
48
  // define ( 'K_PATH_IMAGES', $_SERVER['DOCUMENT_ROOT'] );
49
 
50
  $invoice_types = wcj_get_enabled_invoice_types();
62
  }
63
  }
64
 
65
+ /**
66
+ * create_invoices_report_tool.
67
+ *
68
+ * @version 2.3.10
69
+ * @since 2.3.10
70
+ */
71
+ function create_invoices_report_tool() {
72
+ //$the_tool = include_once( 'pdf-invoices/class-wcj-pdf-invoicing-report-tool.php' );
73
+ return $this->the_pdf_invoicing_report_tool->create_invoices_report_tool();
74
+ }
75
+
76
+ /**
77
+ * create_renumerate_invoices_tool.
78
+ *
79
+ * @version 2.3.10
80
+ * @since 2.3.10
81
+ */
82
+ function create_renumerate_invoices_tool() {
83
+ $the_tool = include_once( 'pdf-invoices/class-wcj-pdf-invoicing-renumerate-tool.php' );
84
+ return $the_tool->create_renumerate_invoices_tool();
85
+ }
86
+
87
  /**
88
  * create_meta_box.
89
  *
90
  * @version 2.3.0
91
  * @since 2.3.0
92
+ */
93
+ /* public function create_meta_box() {
94
 
95
  $current_post_id = get_the_ID();
96
 
122
  }
123
  $html .= '</table>';
124
  echo $html;
125
+ } */
126
 
127
  * create_invoice.
128
  */
233
 
234
  * get_settings.
235
  *
236
+ * @version 2.3.10
237
  */
238
  function get_settings() {
239
 
269
 
270
  $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_pdf_invoicing_options' );
271
 
272
+ return $this->add_standard_settings( $settings );
273
  }
274
  }
275
 
includes/class-wcj-price-labels.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Price Labels class.
6
  *
7
- * @version 2.3.9
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -17,7 +17,7 @@ class WCJ_Price_Labels extends WCJ_Module {
17
  /**
18
  * Constructor.
19
  *
20
- * @version 2.3.9
21
  */
22
  public function __construct() {
23
 
@@ -26,6 +26,15 @@ class WCJ_Price_Labels extends WCJ_Module {
26
  $this->desc = __( 'Create any custom price label for any WooCommerce product.', 'woocommerce-jetpack' );
27
  parent::__construct();
28
 
 
 
 
 
 
 
 
 
 
29
  // Custom Price Labels - fields array
30
  $this->custom_tab_group_name = 'wcj_price_labels';// for compatibility with Custom Price Label Pro plugin should use 'simple_is_custom_pricing_label'
31
  $this->custom_tab_sections = array( '_instead', '_before', '_between', '_after', );
@@ -54,14 +63,6 @@ class WCJ_Price_Labels extends WCJ_Module {
54
 
55
  if ( $this->is_enabled() ) {
56
 
57
- if ( is_admin() ) {
58
- if ( 'yes' === get_option( 'wcj_migrate_from_custom_price_labels_enabled' ) ) {
59
- // "Migrate from Custom Price Labels (Pro)" tool
60
- add_filter( 'wcj_tools_tabs', array( $this, 'add_migrate_from_custom_price_labels_tool_tab' ), 100 );
61
- add_action( 'wcj_tools_migrate_from_custom_price_labels', array( $this, 'create_migrate_from_custom_price_labels_tool_tab' ), 100 );
62
- }
63
- }
64
-
65
  if ( 'yes' === get_option( 'wcj_local_price_labels_enabled', 'yes' ) ) {
66
  // Meta box (admin)
67
  add_action( 'add_meta_boxes', array( $this, 'add_price_label_meta_box' ) );
@@ -103,34 +104,6 @@ class WCJ_Price_Labels extends WCJ_Module {
103
  foreach ( $this->prices_filters as $the_filter )
104
  add_filter( $the_filter, array( $this, 'custom_price' ), 100, 2 );
105
  }
106
-
107
- add_action( 'wcj_tools_dashboard', array( $this, 'add_migrate_tool_info_to_tools_dashboard' ), 1000 );
108
- }
109
-
110
- /**
111
- * add_migrate_tool_info_to_tools_dashboard.
112
- */
113
- public function add_migrate_tool_info_to_tools_dashboard() {
114
- echo '<tr>';
115
- if ( 'yes' === get_option( 'wcj_migrate_from_custom_price_labels_enabled') && 'yes' === get_option( 'wcj_price_labels_enabled') )
116
- $is_enabled = '<span style="color:green;font-style:italic;">' . __( 'enabled', 'woocommerce-jetpack' ) . '</span>';
117
- else
118
- $is_enabled = '<span style="color:gray;font-style:italic;">' . __( 'disabled', 'woocommerce-jetpack' ) . '</span>';
119
- echo '<td>' . __( 'Migrate from Custom Price Labels (Pro)', 'woocommerce-jetpack' ) . '</td>';
120
- echo '<td>' . $is_enabled . '</td>';
121
- echo '<td>' . __( 'Tool lets you copy all the data (that is labels) from Custom Price labels (Pro) plugin to WooCommerce Jetpack.', 'woocommerce-jetpack' ) . '</td>';
122
- echo '</tr>';
123
- }
124
-
125
- /**
126
- * Add tab to WooCommerce > Jetpack Tools.
127
- */
128
- public function add_migrate_from_custom_price_labels_tool_tab( $tabs ) {
129
- $tabs[] = array(
130
- 'id' => 'migrate_from_custom_price_labels',
131
- 'title' => __( 'Migrate from Custom Price Labels', 'woocommerce-jetpack' ),
132
- );
133
- return $tabs;
134
  }
135
 
136
  /**
@@ -142,11 +115,13 @@ class WCJ_Price_Labels extends WCJ_Module {
142
  } */
143
 
144
  /**
145
- * create_migrate_from_custom_price_labels_tool_tab.
 
 
146
  */
147
- public function create_migrate_from_custom_price_labels_tool_tab() {
148
 
149
- echo '<h2>' . __( 'WooCommerce Jetpack - Migrate from Custom Price Labels (Pro)', 'woocommerce-jetpack' ) . '</h2>';
150
 
151
  $migrate = isset( $_POST['migrate'] ) ? true : false;
152
 
@@ -556,11 +531,12 @@ class WCJ_Price_Labels extends WCJ_Module {
556
  /**
557
  * get_settings.
558
  *
559
- * @version 2.3.7
560
  */
561
  function get_settings() {
562
  $settings = array();
563
  $settings = apply_filters( 'wcj_price_labels_settings', $settings );
 
564
  return $this->add_enable_module_setting( $settings );
565
  }
566
 
@@ -577,7 +553,7 @@ class WCJ_Price_Labels extends WCJ_Module {
577
  /*
578
  * add_settings.
579
  *
580
- * @version 2.3.7
581
  * @since 2.3.7
582
  */
583
  function add_settings() {
@@ -752,7 +728,7 @@ class WCJ_Price_Labels extends WCJ_Module {
752
  'id' => 'wcj_local_price_labels_options'
753
  ),
754
 
755
- array(
756
  'title' => __( 'Migrate from Custom Price Labels (Pro) Options', 'woocommerce-jetpack' ),
757
  'type' => 'title',
758
  'desc' => __( 'This section lets you enable "Migrate from Custom Price Labels (Pro)" tool.', 'woocommerce-jetpack' ),
@@ -769,7 +745,7 @@ class WCJ_Price_Labels extends WCJ_Module {
769
  array(
770
  'type' => 'sectionend',
771
  'id' => 'wcj_migrate_from_custom_price_labels_options'
772
- ),
773
 
774
  );
775
 
4
  *
5
  * The WooCommerce Jetpack Price Labels class.
6
  *
7
+ * @version 2.3.10
8
  * @author Algoritmika Ltd.
9
  */
10
 
17
  /**
18
  * Constructor.
19
  *
20
+ * @version 2.3.10
21
  */
22
  public function __construct() {
23
 
26
  $this->desc = __( 'Create any custom price label for any WooCommerce product.', 'woocommerce-jetpack' );
27
  parent::__construct();
28
 
29
+ $this->add_tools( array(
30
+ 'migrate_from_custom_price_labels' => array(
31
+ 'title' => __( 'Migrate from Custom Price Labels (Pro)', 'woocommerce-jetpack' ),
32
+ 'desc' => __( 'Tool lets you copy all the data (that is labels) from Custom Price labels (Pro) plugin to Booster.', 'woocommerce-jetpack' ),
33
+ // 'tab_title' => __( 'Migrate from Custom Price Labels (Pro)', 'woocommerce-jetpack' ),
34
+ 'depreciated' => true,
35
+ ),
36
+ ), array( 'tools_dashboard_hook_priority' => PHP_INT_MAX ) );
37
+
38
  // Custom Price Labels - fields array
39
  $this->custom_tab_group_name = 'wcj_price_labels';// for compatibility with Custom Price Label Pro plugin should use 'simple_is_custom_pricing_label'
40
  $this->custom_tab_sections = array( '_instead', '_before', '_between', '_after', );
63
 
64
  if ( $this->is_enabled() ) {
65
 
 
 
 
 
 
 
 
 
66
  if ( 'yes' === get_option( 'wcj_local_price_labels_enabled', 'yes' ) ) {
67
  // Meta box (admin)
68
  add_action( 'add_meta_boxes', array( $this, 'add_price_label_meta_box' ) );
104
  foreach ( $this->prices_filters as $the_filter )
105
  add_filter( $the_filter, array( $this, 'custom_price' ), 100, 2 );
106
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  }
108
 
109
  /**
115
  } */
116
 
117
  /**
118
+ * create_migrate_from_custom_price_labels_tool.
119
+ *
120
+ * @version 2.3.10
121
  */
122
+ public function create_migrate_from_custom_price_labels_tool() {
123
 
124
+ echo '<h2>' . __( 'Booster - Migrate from Custom Price Labels (Pro)', 'woocommerce-jetpack' ) . '</h2>';
125
 
126
  $migrate = isset( $_POST['migrate'] ) ? true : false;
127
 
531
  /**
532
  * get_settings.
533
  *
534
+ * @version 2.3.10
535
  */
536
  function get_settings() {
537
  $settings = array();
538
  $settings = apply_filters( 'wcj_price_labels_settings', $settings );
539
+ $settings = $this->add_tools_list( $settings );
540
  return $this->add_enable_module_setting( $settings );
541
  }
542
 
553
  /*
554
  * add_settings.
555
  *
556
+ * @version 2.3.10
557
  * @since 2.3.7
558
  */
559
  function add_settings() {
728
  'id' => 'wcj_local_price_labels_options'
729
  ),
730
 
731
+ /* array(
732
  'title' => __( 'Migrate from Custom Price Labels (Pro) Options', 'woocommerce-jetpack' ),
733
  'type' => 'title',
734
  'desc' => __( 'This section lets you enable "Migrate from Custom Price Labels (Pro)" tool.', 'woocommerce-jetpack' ),
745
  array(
746
  'type' => 'sectionend',
747
  'id' => 'wcj_migrate_from_custom_price_labels_options'
748
+ ), */
749
 
750
  );
751
 
includes/class-wcj-product-bulk-price-converter.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Bulk Price Converter class.
6
  *
7
- * @version 2.3.0
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -17,7 +17,7 @@ class WCJ_Bulk_Price_Converter extends WCJ_Module {
17
  /**
18
  * Constructor.
19
  *
20
- * @version 2.3.0
21
  */
22
  public function __construct() {
23
 
@@ -26,24 +26,12 @@ class WCJ_Bulk_Price_Converter extends WCJ_Module {
26
  $this->desc = __( 'Multiply all WooCommerce products prices by set value.', 'woocommerce-jetpack' );
27
  parent::__construct();
28
 
29
- $this->add_tools( array( 'bulk_price_converter' => __( 'Bulk Price Converter Tool', 'woocommerce-jetpack' ), ) );
30
-
31
- if ( $this->is_enabled() ) {
32
- add_filter( 'wcj_tools_tabs', array( $this, 'add_bulk_price_converter_tool_tab' ), 100 );
33
- add_action( 'wcj_tools_bulk_price_converter', array( $this, 'create_bulk_price_converter_tool' ), 100 );
34
- }
35
- add_action( 'wcj_tools_dashboard', array( $this, 'add_bulk_price_converter_tool_info_to_tools_dashboard' ), 100 );
36
- }
37
-
38
- /**
39
- * add_bulk_price_converter_tool_tab.
40
- */
41
- public function add_bulk_price_converter_tool_tab( $tabs ) {
42
- $tabs[] = array(
43
- 'id' => 'bulk_price_converter',
44
- 'title' => __( 'Bulk Price Converter', 'woocommerce-jetpack' ),
45
- );
46
- return $tabs;
47
  }
48
 
49
  /**
@@ -172,8 +160,8 @@ class WCJ_Bulk_Price_Converter extends WCJ_Module {
172
 
173
  /**
174
  * make_pretty_price.
175
- *
176
- function make_pretty_price( $price ) {
177
 
178
  if ( 0 == $price )
179
  return $price;
@@ -225,22 +213,7 @@ class WCJ_Bulk_Price_Converter extends WCJ_Module {
225
  }
226
 
227
  return $the_multiplied_price;
228
- }
229
-
230
- /**
231
- * add_bulk_price_converter_tool_info_to_tools_dashboard.
232
- */
233
- public function add_bulk_price_converter_tool_info_to_tools_dashboard() {
234
- echo '<tr>';
235
- if ( 'yes' === get_option( 'wcj_bulk_price_converter_enabled') )
236
- $is_enabled = '<span style="color:green;font-style:italic;">' . __( 'enabled', 'woocommerce-jetpack' ) . '</span>';
237
- else
238
- $is_enabled = '<span style="color:gray;font-style:italic;">' . __( 'disabled', 'woocommerce-jetpack' ) . '</span>';
239
- echo '<td>' . __( 'Bulk Price Converter', 'woocommerce-jetpack' ) . '</td>';
240
- echo '<td>' . $is_enabled . '</td>';
241
- echo '<td>' . __( 'Bulk Price Converter Tool.', 'woocommerce-jetpack' ) . '</td>';
242
- echo '</tr>';
243
- }
244
 
245
  /**
246
  * get_settings.
@@ -256,4 +229,4 @@ class WCJ_Bulk_Price_Converter extends WCJ_Module {
256
 
257
  endif;
258
 
259
- return new WCJ_Bulk_Price_Converter();
4
  *
5
  * The WooCommerce Jetpack Bulk Price Converter class.
6
  *
7
+ * @version 2.3.10
8
  * @author Algoritmika Ltd.
9
  */
10
 
17
  /**
18
  * Constructor.
19
  *
20
+ * @version 2.3.10
21
  */
22
  public function __construct() {
23
 
26
  $this->desc = __( 'Multiply all WooCommerce products prices by set value.', 'woocommerce-jetpack' );
27
  parent::__construct();
28
 
29
+ $this->add_tools( array(
30
+ 'bulk_price_converter' => array(
31
+ 'title' => __( 'Bulk Price Converter', 'woocommerce-jetpack' ),
32
+ 'desc' => __( 'Bulk Price Converter Tool.', 'woocommerce-jetpack' ),
33
+ ),
34
+ ) );
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
36
 
37
  /**
160
 
161
  /**
162
  * make_pretty_price.
163
+ */
164
+ /* function make_pretty_price( $price ) {
165
 
166
  if ( 0 == $price )
167
  return $price;
213
  }
214
 
215
  return $the_multiplied_price;
216
+ } */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
 
218
  /**
219
  * get_settings.
229
 
230
  endif;
231
 
232
+ return new WCJ_Bulk_Price_Converter();
includes/class-wcj-sku.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack SKU class.
6
  *
7
- * @version 2.2.3
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -17,7 +17,7 @@ class WCJ_SKU extends WCJ_Module {
17
  /**
18
  * Constructor.
19
  *
20
- * @version 2.2.3
21
  */
22
  function __construct() {
23
 
@@ -26,16 +26,16 @@ class WCJ_SKU extends WCJ_Module {
26
  $this->desc = __( 'Generate WooCommerce SKUs automatically.', 'woocommerce-jetpack' );
27
  parent::__construct();
28
 
29
- $this->add_tools( array( 'sku' => __( 'Autogenerate SKUs for Existing Products', 'woocommerce-jetpack' ), ) );
 
 
 
 
 
30
 
31
- $the_priority = 100;
32
  if ( $this->is_enabled() ) {
33
- add_filter( 'wcj_tools_tabs', array( $this, 'add_sku_tool_tab' ), $the_priority );
34
- add_action( 'wcj_tools_sku', array( $this, 'create_sku_tool' ), $the_priority );
35
-
36
- add_action( 'wp_insert_post', array( $this, 'set_product_sku' ), $the_priority, 3 );
37
  }
38
- add_action( 'wcj_tools_dashboard', array( $this, 'add_sku_tool_info_to_tools_dashboard' ), $the_priority );
39
  }
40
 
41
  /**
@@ -76,13 +76,11 @@ class WCJ_SKU extends WCJ_Module {
76
  * set_sku.
77
  */
78
  function set_sku( $product_id, $sku_number, $variation_suffix, $is_preview ) {
79
-
80
  $the_sku = sprintf( '%s%0' . get_option( 'wcj_sku_minimum_number_length', 0 ) . 'd%s%s',
81
  get_option( 'wcj_sku_prefix', '' ),
82
  $sku_number,
83
  apply_filters( 'wcj_get_option_filter', '', get_option( 'wcj_sku_suffix', '' ) ),
84
  $variation_suffix );
85
-
86
  if ( $is_preview ) {
87
  echo '<tr>' .
88
  '<td>' . $this->product_counter++ . '</td>' .
@@ -90,115 +88,83 @@ class WCJ_SKU extends WCJ_Module {
90
  '<td>' . $the_sku . '</td>' .
91
  '</tr>';
92
  }
93
- else
94
  update_post_meta( $product_id, '_' . 'sku', $the_sku );
 
95
  }
96
 
97
  /**
98
- * set_all_sku.
 
 
99
  */
100
- function set_all_sku( $is_preview ) {
101
-
102
  $limit = 1000;
103
  $offset = 0;
104
-
105
  while ( TRUE ) {
106
  $posts = new WP_Query( array(
107
  'posts_per_page' => $limit,
108
  'offset' => $offset,
109
  'post_type' => 'product',
110
- 'post_status' => 'any',
111
  ));
112
-
113
  if ( ! $posts->have_posts() ) break;
114
-
115
  while ( $posts->have_posts() ) {
116
  $posts->the_post();
117
-
118
  $this->set_sku_with_variable( $posts->post->ID, $is_preview );
119
  }
120
-
121
  $offset += $limit;
122
  }
123
  }
124
 
125
  /**
126
- * set_product_sku.
 
 
127
  */
128
- function set_product_sku( $post_ID, $post, $update ) {
129
-
130
  if ( 'product' != $post->post_type ) {
131
  return;
132
  }
133
-
134
  if ( false === $update ) {
135
  $this->set_sku_with_variable( $post_ID, false );
136
  }
137
  }
138
 
139
- /**
140
- * add_sku_tool_tab.
141
- */
142
- function add_sku_tool_tab( $tabs ) {
143
- $tabs[] = array(
144
- 'id' => 'sku',
145
- 'title' => __( 'Autogenerate SKUs', 'woocommerce-jetpack' ),
146
- );
147
- return $tabs;
148
- }
149
-
150
  /**
151
  * create_sku_tool
152
  *
153
- * @version 2.2.3
154
  */
155
  function create_sku_tool() {
156
  $result_message = '';
157
  $is_preview = ( isset( $_POST['preview_sku'] ) ) ? true : false;
158
-
159
  if ( isset( $_POST['set_sku'] ) || isset( $_POST['preview_sku'] ) ) {
160
-
161
  $this->product_counter = 1;
162
  $preview_html = '<table class="widefat" style="width:50%; min-width: 300px;">';
163
- $preview_html .= '<tr>' .
164
- '<th></th>' .
165
- '<th>' . __( 'Product', 'woocommerce-jetpack' ) . '</th>' .
166
- '<th>' . __( 'SKU', 'woocommerce-jetpack' ) . '</th>' .
167
- '</tr>';
 
168
  ob_start();
169
- $this->set_all_sku( $is_preview );
170
  $preview_html .= ob_get_clean();
171
  $preview_html .= '</table>';
172
  $result_message = '<p><div class="updated"><p><strong>' . __( 'SKUs generated and set successfully!', 'woocommerce-jetpack' ) . '</strong></p></div></p>';
173
  }
174
  ?><div>
175
- <?php echo $this->get_back_to_settings_link_html(); ?>
176
- <h2><?php echo __( 'WooCommerce Jetpack - Autogenerate SKUs', 'woocommerce-jetpack' ); ?></h2>
177
- <p><?php echo __( 'The tool generates and sets product SKUs.', 'woocommerce-jetpack' ); ?></p>
178
  <?php if ( ! $is_preview ) echo $result_message; ?>
179
  <p><form method="post" action="">
180
- <input class="button-primary" type="submit" name="preview_sku" id="preview_sku" value="Preview SKUs">
181
- <input class="button-primary" type="submit" name="set_sku" value="Set SKUs">
182
  </form></p>
183
  <?php if ( $is_preview ) echo $preview_html; ?>
184
  </div><?php
185
  }
186
 
187
- /**
188
- * add_sku_tool_info_to_tools_dashboard.
189
- */
190
- function add_sku_tool_info_to_tools_dashboard() {
191
- echo '<tr>';
192
- if ( 'yes' === get_option( 'wcj_sku_enabled') )
193
- $is_enabled = '<span style="color:green;font-style:italic;">' . __( 'enabled', 'woocommerce-jetpack' ) . '</span>';
194
- else
195
- $is_enabled = '<span style="color:gray;font-style:italic;">' . __( 'disabled', 'woocommerce-jetpack' ) . '</span>';
196
- echo '<td>' . __( 'Autogenerate SKUs', 'woocommerce-jetpack' ) . '</td>';
197
- echo '<td>' . $is_enabled . '</td>';
198
- echo '<td>' . __( 'The tool generates and sets product SKUs.', 'woocommerce-jetpack' ) . '</td>';
199
- echo '</tr>';
200
- }
201
-
202
  /**
203
  * get_settings.
204
  */
@@ -210,7 +176,7 @@ class WCJ_SKU extends WCJ_Module {
210
  'title' => __( 'SKU Format Options', 'woocommerce-jetpack' ),
211
  'type' => 'title',
212
  'desc' => '',
213
- 'id' => 'wcj_sku_format_options'
214
  ),
215
 
216
  array(
@@ -232,9 +198,8 @@ class WCJ_SKU extends WCJ_Module {
232
  'id' => 'wcj_sku_suffix',
233
  'default' => '',
234
  'type' => 'text',
235
- 'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
236
- 'custom_attributes'
237
- => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
238
  ),
239
 
240
  array(
@@ -243,25 +208,22 @@ class WCJ_SKU extends WCJ_Module {
243
  'default' => 'as_variable',
244
  'type' => 'select',
245
  'options' => array(
246
- 'as_variable' => __( 'SKU same as parent\'s product', 'woocommerce-jetpack' ),
247
- 'as_variation' => __( 'Generate different SKU for each variation', 'woocommerce-jetpack' ),
248
- 'as_variable_with_suffix' => __( 'SKU same as parent\'s product + variation letter suffix', 'woocommerce-jetpack' ),
249
- ),
250
  'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
251
- 'custom_attributes'
252
- => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
253
  ),
254
 
255
  array(
256
  'type' => 'sectionend',
257
- 'id' => 'wcj_sku_format_options'
258
  ),
259
 
260
  );
261
 
262
- $settings = $this->add_tools_list( $settings );
263
-
264
- return $this->add_enable_module_setting( $settings, __( 'When enabled - all new products will be given (autogenerated) SKU.<br>If you wish to set SKUs for existing products, use Autogenerate SKUs Tool.', 'woocommerce-jetpack' ) );
265
  }
266
  }
267
 
4
  *
5
  * The WooCommerce Jetpack SKU class.
6
  *
7
+ * @version 2.3.10
8
  * @author Algoritmika Ltd.
9
  */
10
 
17
  /**
18
  * Constructor.
19
  *
20
+ * @version 2.3.10
21
  */
22
  function __construct() {
23
 
26
  $this->desc = __( 'Generate WooCommerce SKUs automatically.', 'woocommerce-jetpack' );
27
  parent::__construct();
28
 
29
+ $this->add_tools( array(
30
+ 'sku' => array(
31
+ 'title' => __( 'Autogenerate SKUs', 'woocommerce-jetpack' ),
32
+ 'desc' => __( 'The tool generates and sets product SKUs.', 'woocommerce-jetpack' ),//__( 'Autogenerate SKUs for Existing Products', 'woocommerce-jetpack' ),
33
+ ),
34
+ ) );
35
 
 
36
  if ( $this->is_enabled() ) {
37
+ add_action( 'wp_insert_post', array( $this, 'set_sku_for_new_product' ), PHP_INT_MAX, 3 );
 
 
 
38
  }
 
39
  }
40
 
41
  /**
76
  * set_sku.
77
  */
78
  function set_sku( $product_id, $sku_number, $variation_suffix, $is_preview ) {
 
79
  $the_sku = sprintf( '%s%0' . get_option( 'wcj_sku_minimum_number_length', 0 ) . 'd%s%s',
80
  get_option( 'wcj_sku_prefix', '' ),
81
  $sku_number,
82
  apply_filters( 'wcj_get_option_filter', '', get_option( 'wcj_sku_suffix', '' ) ),
83
  $variation_suffix );
 
84
  if ( $is_preview ) {
85
  echo '<tr>' .
86
  '<td>' . $this->product_counter++ . '</td>' .
88
  '<td>' . $the_sku . '</td>' .
89
  '</tr>';
90
  }
91
+ else {
92
  update_post_meta( $product_id, '_' . 'sku', $the_sku );
93
+ }
94
  }
95
 
96
  /**
97
+ * set_all_products_skus.
98
+ *
99
+ * @version 2.3.10
100
  */
101
+ function set_all_products_skus( $is_preview ) {
 
102
  $limit = 1000;
103
  $offset = 0;
 
104
  while ( TRUE ) {
105
  $posts = new WP_Query( array(
106
  'posts_per_page' => $limit,
107
  'offset' => $offset,
108
  'post_type' => 'product',
109
+ 'post_status' => 'any',
110
  ));
 
111
  if ( ! $posts->have_posts() ) break;
 
112
  while ( $posts->have_posts() ) {
113
  $posts->the_post();
 
114
  $this->set_sku_with_variable( $posts->post->ID, $is_preview );
115
  }
 
116
  $offset += $limit;
117
  }
118
  }
119
 
120
  /**
121
+ * set_sku_for_new_product.
122
+ *
123
+ * @version 2.3.10
124
  */
125
+ function set_sku_for_new_product( $post_ID, $post, $update ) {
 
126
  if ( 'product' != $post->post_type ) {
127
  return;
128
  }
 
129
  if ( false === $update ) {
130
  $this->set_sku_with_variable( $post_ID, false );
131
  }
132
  }
133
 
 
 
 
 
 
 
 
 
 
 
 
134
  /**
135
  * create_sku_tool
136
  *
137
+ * @version 2.3.10
138
  */
139
  function create_sku_tool() {
140
  $result_message = '';
141
  $is_preview = ( isset( $_POST['preview_sku'] ) ) ? true : false;
 
142
  if ( isset( $_POST['set_sku'] ) || isset( $_POST['preview_sku'] ) ) {
 
143
  $this->product_counter = 1;
144
  $preview_html = '<table class="widefat" style="width:50%; min-width: 300px;">';
145
+ $preview_html .=
146
+ '<tr>' .
147
+ '<th></th>' .
148
+ '<th>' . __( 'Product', 'woocommerce-jetpack' ) . '</th>' .
149
+ '<th>' . __( 'SKU', 'woocommerce-jetpack' ) . '</th>' .
150
+ '</tr>';
151
  ob_start();
152
+ $this->set_all_products_skus( $is_preview );
153
  $preview_html .= ob_get_clean();
154
  $preview_html .= '</table>';
155
  $result_message = '<p><div class="updated"><p><strong>' . __( 'SKUs generated and set successfully!', 'woocommerce-jetpack' ) . '</strong></p></div></p>';
156
  }
157
  ?><div>
158
+ <?php echo $this->get_tool_header_html( 'sku' ); ?>
 
 
159
  <?php if ( ! $is_preview ) echo $result_message; ?>
160
  <p><form method="post" action="">
161
+ <input class="button-primary" type="submit" name="preview_sku" id="preview_sku" value="<?php _e( 'Preview SKUs', 'woocommerce-jetpack' ); ?>">
162
+ <input class="button-primary" type="submit" name="set_sku" value="<?php _e( 'Set SKUs', 'woocommerce-jetpack' ); ?>">
163
  </form></p>
164
  <?php if ( $is_preview ) echo $preview_html; ?>
165
  </div><?php
166
  }
167
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  /**
169
  * get_settings.
170
  */
176
  'title' => __( 'SKU Format Options', 'woocommerce-jetpack' ),
177
  'type' => 'title',
178
  'desc' => '',
179
+ 'id' => 'wcj_sku_format_options',
180
  ),
181
 
182
  array(
198
  'id' => 'wcj_sku_suffix',
199
  'default' => '',
200
  'type' => 'text',
201
+ 'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
202
+ 'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
 
203
  ),
204
 
205
  array(
208
  'default' => 'as_variable',
209
  'type' => 'select',
210
  'options' => array(
211
+ 'as_variable' => __( 'SKU same as parent\'s product', 'woocommerce-jetpack' ),
212
+ 'as_variation' => __( 'Generate different SKU for each variation', 'woocommerce-jetpack' ),
213
+ 'as_variable_with_suffix' => __( 'SKU same as parent\'s product + variation letter suffix', 'woocommerce-jetpack' ),
214
+ ),
215
  'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
216
+ 'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
 
217
  ),
218
 
219
  array(
220
  'type' => 'sectionend',
221
+ 'id' => 'wcj_sku_format_options',
222
  ),
223
 
224
  );
225
 
226
+ return $this->add_standard_settings( $settings, __( 'When enabled - all new products will be given (autogenerated) SKU.<br>If you wish to set SKUs for existing products, use Autogenerate SKUs Tool.', 'woocommerce-jetpack' ) );
 
 
227
  }
228
  }
229
 
includes/classes/class-wcj-module.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Module class.
6
  *
7
- * @version 2.3.8
8
  * @since 2.2.0
9
  * @author Algoritmika Ltd.
10
  */
@@ -35,6 +35,19 @@ if ( ! class_exists( 'WCJ_Module' ) ) :
35
  }
36
  }
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  /**
39
  * get_settings.
40
  *
@@ -63,7 +76,7 @@ if ( ! class_exists( 'WCJ_Module' ) ) :
63
  /**
64
  * add_meta_box.
65
  *
66
- * @version 2.3.0
67
  * @since 2.2.6
68
  */
69
  function add_meta_box() {
@@ -72,7 +85,7 @@ if ( ! class_exists( 'WCJ_Module' ) ) :
72
  $priority = ( isset( $this->meta_box_priority ) ) ? $this->meta_box_priority : 'high';
73
  add_meta_box(
74
  'wc-jetpack-' . $this->id,
75
- __( 'WooCommerce Jetpack', 'woocommerce-jetpack' ) . ': ' . $this->short_desc,
76
  array( $this, 'create_meta_box' ),
77
  $screen,
78
  $context,
@@ -168,13 +181,13 @@ if ( ! class_exists( 'WCJ_Module' ) ) :
168
  /**
169
  * get_back_to_settings_link_html.
170
  *
171
- * @version 2.2.3
172
  * @since 2.2.3
173
  */
174
  function get_back_to_settings_link_html() {
175
  $cat_id = $this->get_cat_by_section( $this->id );
176
  $the_link = admin_url( 'admin.php?page=wc-settings&tab=jetpack&wcj-cat=' . $cat_id . '&section=' . $this->id );
177
- return '<a href="' . $the_link . '">' . __( 'Back to Module Settings', 'woocommerce-jetpack' ) . '</a>';
178
  }
179
 
180
  /**
@@ -203,37 +216,103 @@ if ( ! class_exists( 'WCJ_Module' ) ) :
203
  ) );
204
  }
205
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  /**
207
  * add_tools.
208
  *
209
- * @version 2.2.3
210
  * @since 2.2.3
211
  */
212
- function add_tools( $tools_array ) {
213
  $this->tools_array = $tools_array;
214
  add_action( 'wcj_module_tools_' . $this->id, array( $this, 'add_tool_link' ), PHP_INT_MAX );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  }
216
 
217
  /**
218
  * add_tool_link.
219
  *
220
- * @version 2.2.3
221
  * @since 2.2.3
222
  */
223
  function add_tool_link() {
224
- //echo '<ul>';
225
- foreach ( $this->tools_array as $tool_id => $tool_desc ) {
226
- //echo '<li>';
227
- if ( $this->is_enabled() ) {
228
- echo '<a href="' . admin_url( 'admin.php?page=wcj-tools&tab=' . $tool_id ) . '"><code>' . $tool_desc . '</code></a>';
229
- }
230
- else {
231
- echo '<code>' . $tool_desc . '</code>';
232
- }
233
- //echo '</li>';
234
- echo '<br>';
235
  }
236
- //echo '</ul>';
237
  }
238
 
239
  /**
4
  *
5
  * The WooCommerce Jetpack Module class.
6
  *
7
+ * @version 2.3.10
8
  * @since 2.2.0
9
  * @author Algoritmika Ltd.
10
  */
35
  }
36
  }
37
 
38
+ /**
39
+ * add_standard_settings.
40
+ *
41
+ * @version 2.3.10
42
+ * @since 2.3.10
43
+ */
44
+ function add_standard_settings( $settings = array(), $module_desc = '' ) {
45
+ if ( isset( $this->tools_array ) && ! empty( $this->tools_array ) ) {
46
+ $settings = $this->add_tools_list( $settings );
47
+ }
48
+ return $this->add_enable_module_setting( $settings, $module_desc );
49
+ }
50
+
51
  /**
52
  * get_settings.
53
  *
76
  /**
77
  * add_meta_box.
78
  *
79
+ * @version 2.3.10
80
  * @since 2.2.6
81
  */
82
  function add_meta_box() {
85
  $priority = ( isset( $this->meta_box_priority ) ) ? $this->meta_box_priority : 'high';
86
  add_meta_box(
87
  'wc-jetpack-' . $this->id,
88
+ __( 'Booster', 'woocommerce-jetpack' ) . ': ' . $this->short_desc,
89
  array( $this, 'create_meta_box' ),
90
  $screen,
91
  $context,
181
  /**
182
  * get_back_to_settings_link_html.
183
  *
184
+ * @version 2.3.10
185
  * @since 2.2.3
186
  */
187
  function get_back_to_settings_link_html() {
188
  $cat_id = $this->get_cat_by_section( $this->id );
189
  $the_link = admin_url( 'admin.php?page=wc-settings&tab=jetpack&wcj-cat=' . $cat_id . '&section=' . $this->id );
190
+ return '<a href="' . $the_link . '"><< ' . __( 'Back to Module Settings', 'woocommerce-jetpack' ) . '</a>';
191
  }
192
 
193
  /**
216
  ) );
217
  }
218
 
219
+ /**
220
+ * get_tool_header_html.
221
+ *
222
+ * @version 2.3.10
223
+ * @since 2.3.10
224
+ */
225
+ function get_tool_header_html( $tool_id ) {
226
+ $html = '';
227
+ if ( isset( $this->tools_array[ $tool_id ] ) ) {
228
+ $html .= '<p>' . $this->get_back_to_settings_link_html() . '</p>';
229
+ $html .= '<h3>' . __( 'Booster', 'woocommerce-jetpack' ) . ' - ' . $this->tools_array[ $tool_id ]['title'] . '</h3>';
230
+ $html .= '<p style="font-style:italic;">' . $this->tools_array[ $tool_id ]['desc'] . '</p>';
231
+ }
232
+ return $html;
233
+ }
234
+
235
  /**
236
  * add_tools.
237
  *
238
+ * @version 2.3.10
239
  * @since 2.2.3
240
  */
241
+ function add_tools( $tools_array, $args = array() ) {
242
  $this->tools_array = $tools_array;
243
  add_action( 'wcj_module_tools_' . $this->id, array( $this, 'add_tool_link' ), PHP_INT_MAX );
244
+ $hook_priority = isset( $args['tools_dashboard_hook_priority'] ) ? $args['tools_dashboard_hook_priority'] : 10;
245
+ if ( $this->is_enabled() ) {
246
+ add_filter( 'wcj_tools_tabs', array( $this, 'add_module_tools_tabs' ), $hook_priority );
247
+ foreach ( $this->tools_array as $tool_id => $tool_data ) {
248
+ add_action( 'wcj_tools_' . $tool_id, array( $this, 'create_' . $tool_id . '_tool' ) );
249
+ }
250
+ }
251
+ add_action( 'wcj_tools_dashboard', array( $this, 'add_module_tools_info_to_tools_dashboard' ), $hook_priority );
252
+ }
253
+
254
+ /**
255
+ * add_module_tools_tabs.
256
+ *
257
+ * @version 2.3.10
258
+ * @since 2.3.10
259
+ */
260
+ function add_module_tools_tabs( $tabs ) {
261
+ foreach ( $this->tools_array as $tool_id => $tool_data ) {
262
+ $tool_title = ( isset( $tool_data['tab_title'] ) ) ?
263
+ $tool_data['tab_title'] :
264
+ $tool_data['title'];
265
+ $tabs[] = array(
266
+ 'id' => $tool_id,
267
+ 'title' => $tool_title,
268
+ );
269
+ }
270
+ return $tabs;
271
+ }
272
+
273
+ /**
274
+ * add_module_tools_info_to_tools_dashboard.
275
+ *
276
+ * @version 2.3.10
277
+ * @since 2.3.10
278
+ */
279
+ public function add_module_tools_info_to_tools_dashboard() {
280
+ $is_enabled_html = ( $this->is_enabled() ) ?
281
+ '<span style="color:green;font-style:italic;">' . __( 'enabled', 'woocommerce-jetpack' ) . '</span>' :
282
+ '<span style="color:gray;font-style:italic;">' . __( 'disabled', 'woocommerce-jetpack' ) . '</span>';
283
+ foreach ( $this->tools_array as $tool_id => $tool_data ) {
284
+ $tool_title = $tool_data['title'];
285
+ $tool_desc = $tool_data['desc'];
286
+ $additional_style_html = '';
287
+ $additional_info_html = '';
288
+ if ( isset( $tool_data['depreciated'] ) && true === $tool_data['depreciated'] ) {
289
+ $additional_style_html = 'color:gray;font-style:italic;';
290
+ $additional_info_html = ' - ' . __( 'Depreciated', 'woocommerce-jetpack' );
291
+ }
292
+ echo '<tr>';
293
+ echo '<td style="' . $additional_style_html . '">' . $tool_title . $additional_info_html . '</td>';
294
+ echo '<td style="' . $additional_style_html . '">' . $this->short_desc . '</td>';
295
+ echo '<td style="' . $additional_style_html . '">' . $tool_desc . '</td>';
296
+ echo '<td style="' . $additional_style_html . '">' . $is_enabled_html . '</td>';
297
+ echo '</tr>';
298
+ }
299
  }
300
 
301
  /**
302
  * add_tool_link.
303
  *
304
+ * @version 2.3.10
305
  * @since 2.2.3
306
  */
307
  function add_tool_link() {
308
+ foreach ( $this->tools_array as $tool_id => $tool_data ) {
309
+ $tool_title = $tool_data['title'];
310
+ echo '<p>';
311
+ echo ( $this->is_enabled() ) ?
312
+ '<a href="' . admin_url( 'admin.php?page=wcj-tools&tab=' . $tool_id ) . '"><code>' . $tool_title . '</code></a>' :
313
+ '<code>' . $tool_title . '</code>';
314
+ echo '</p>';
 
 
 
 
315
  }
 
316
  }
317
 
318
  /**
includes/functions/wcj-functions.php CHANGED
@@ -4,10 +4,47 @@
4
  *
5
  * The WooCommerce Jetpack Functions.
6
  *
7
- * @version 2.3.0
8
  * @author Algoritmika Ltd.
9
  */
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  /*
12
  * wcj_get_select_options()
13
  *
4
  *
5
  * The WooCommerce Jetpack Functions.
6
  *
7
+ * @version 2.3.10
8
  * @author Algoritmika Ltd.
9
  */
10
 
11
+ if ( ! function_exists( 'wcj_get_rates_for_tax_class' ) ) {
12
+ /* Used by admin settings page.
13
+ *
14
+ * @param string $tax_class
15
+ *
16
+ * @return array|null|object
17
+ *
18
+ * @version 2.3.10
19
+ * @since 2.3.10
20
+ */
21
+ function wcj_get_rates_for_tax_class( $tax_class ) {
22
+ global $wpdb;
23
+
24
+ // Get all the rates and locations. Snagging all at once should significantly cut down on the number of queries.
25
+ $rates = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `{$wpdb->prefix}woocommerce_tax_rates` WHERE `tax_rate_class` = %s ORDER BY `tax_rate_order`;", sanitize_title( $tax_class ) ) );
26
+ $locations = $wpdb->get_results( "SELECT * FROM `{$wpdb->prefix}woocommerce_tax_rate_locations`" );
27
+
28
+ // Set the rates keys equal to their ids.
29
+ $rates = array_combine( wp_list_pluck( $rates, 'tax_rate_id' ), $rates );
30
+
31
+ // Drop the locations into the rates array.
32
+ foreach ( $locations as $location ) {
33
+ // Don't set them for unexistent rates.
34
+ if ( ! isset( $rates[ $location->tax_rate_id ] ) ) {
35
+ continue;
36
+ }
37
+ // If the rate exists, initialize the array before appending to it.
38
+ if ( ! isset( $rates[ $location->tax_rate_id ]->{$location->location_type} ) ) {
39
+ $rates[ $location->tax_rate_id ]->{$location->location_type} = array();
40
+ }
41
+ $rates[ $location->tax_rate_id ]->{$location->location_type}[] = $location->location_code;
42
+ }
43
+
44
+ return $rates;
45
+ }
46
+ }
47
+
48
  /*
49
  * wcj_get_select_options()
50
  *
includes/pdf-invoices/class-wcj-pdf-invoicing-renumerate-tool.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack PDF Invoices Renumerate Tool class.
6
  *
7
- * @version 2.3.9
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -16,39 +16,15 @@ class WCJ_PDF_Invoicing_Renumerate_Tool {
16
 
17
  /**
18
  * Constructor.
 
 
19
  */
20
  public function __construct() {
21
- add_filter( 'wcj_tools_tabs', array( $this, 'add_renumerate_invoices_tool_tab' ), 100 );
22
- add_action( 'wcj_tools_renumerate_invoices', array( $this, 'create_renumerate_invoices_tool' ), 100 );
23
- add_action( 'wcj_tools_dashboard', array( $this, 'add_renumerate_invoices_tool_info_to_tools_dashboard' ), 100 );
24
- }
25
-
26
- /**
27
- * add_renumerate_invoices_tool_info_to_tools_dashboard.
28
- */
29
- public function add_renumerate_invoices_tool_info_to_tools_dashboard() {
30
- echo '<tr>';
31
- if ( 'yes' === get_option( 'wcj_pdf_invoicing_enabled') )
32
- $is_enabled = '<span style="color:green;font-style:italic;">' . __( 'enabled', 'woocommerce-jetpack' ) . '</span>';
33
- else
34
- $is_enabled = '<span style="color:gray;font-style:italic;">' . __( 'disabled', 'woocommerce-jetpack' ) . '</span>';
35
- echo '<td>' . __( 'Invoices Renumerate', 'woocommerce-jetpack' ) . '</td>';
36
- echo '<td>' . $is_enabled . '</td>';
37
- echo '<td>' . __( 'Tool renumerates all invoices, proforma invoices, credit notes and packing slips.', 'woocommerce-jetpack' ) . '</td>';
38
- echo '</tr>';
39
  }
40
 
41
  /**
42
- * add_renumerate_invoices_tool_tab.
43
  */
44
- public function add_renumerate_invoices_tool_tab( $tabs ) {
45
- $tabs[] = array(
46
- 'id' => 'renumerate_invoices',
47
- 'title' => __( 'Renumerate Invoices', 'woocommerce-jetpack' ),
48
- );
49
- return $tabs;
50
- }
51
-
52
  function wcj_multi_selected( $selected, $current_multi ) {
53
  if ( ! is_array( $current_multi ) ) return selected( $selected, $current_multi, false );
54
  foreach( $current_multi as $current ) {
@@ -61,21 +37,22 @@ class WCJ_PDF_Invoicing_Renumerate_Tool {
61
  /**
62
  * Add Renumerate Invoices tool to WooCommerce menu (the content).
63
  *
64
- * @version 2.3.0
65
  */
66
- public function create_renumerate_invoices_tool() {
67
  $result_message = '';
68
  $renumerate_result = '';
69
 
70
  $the_invoice_type = ( ! empty( $_POST['invoice_type'] ) ) ? $_POST['invoice_type'] : 'invoice';
71
  $the_start_number = ( ! empty( $_POST['start_number'] ) ) ? $_POST['start_number'] : 0;
72
  $the_start_date = ( ! empty( $_POST['start_date'] ) ) ? $_POST['start_date'] : '';
 
73
  $the_order_statuses = ( ! empty( $_POST['order_statuses'] ) ) ? $_POST['order_statuses'] : array();
74
  $the_delete_all = ( isset( $_POST['delete_all'] ) ) ? true : false;
75
 
76
  if ( isset( $_POST['renumerate_invoices'] ) ) {
77
  if ( ! empty( $the_order_statuses ) ) {
78
- $renumerate_result = $this->renumerate_invoices( $the_invoice_type, $the_start_number, $the_start_date, $the_order_statuses, $the_delete_all );
79
  $result_message = '<div class="updated"><p><strong>' . __( 'Invoices successfully renumerated!', 'woocommerce-jetpack' ) . '</strong></p></div>';
80
  } else {
81
  $result_message = '<div class="error"><p><strong>' . __( 'Please select at least one order status.', 'woocommerce-jetpack' ) . '</strong></p></div>';
@@ -89,13 +66,20 @@ class WCJ_PDF_Invoicing_Renumerate_Tool {
89
  <p><form method="post" action="">
90
  <?php
91
 
92
- // Date
93
  $data[] = array(
94
  __( 'Start Date', 'woocommerce-jetpack' ),
95
  '<input class="input-text" display="date" type="text" name="start_date" value="' . $the_start_date . '">',
96
  '<em>' . __( 'Date to start renumerating. Leave blank to renumerate all invoices.', 'woocommerce-jetpack' ) . '</em>',
97
  );
98
 
 
 
 
 
 
 
 
99
  // Number
100
  $data[] = array(
101
  __( 'Start Number', 'woocommerce-jetpack' ),
@@ -130,11 +114,13 @@ class WCJ_PDF_Invoicing_Renumerate_Tool {
130
  $order_statuses_select_html .= '</select>';
131
  $data[] = array( __( 'Order Statuses', 'woocommerce-jetpack' ), $order_statuses_select_html, '', );
132
 
 
 
 
133
  // Print all
134
  echo wcj_get_table_html( $data, array( 'table_heading_type' => 'vertical', ) );
135
 
136
  ?>
137
- <input type="submit" name="renumerate_invoices" value="Renumerate invoices">
138
  </form></p>
139
  <?php
140
  if ( '' != $renumerate_result ) {
@@ -148,9 +134,9 @@ class WCJ_PDF_Invoicing_Renumerate_Tool {
148
  /**
149
  * Renumerate invoices function.
150
  *
151
- * @version 2.3.9
152
  */
153
- public function renumerate_invoices( $invoice_type, $start_number, $start_date, $order_statuses, $the_delete_all ) {
154
 
155
  $output = '';
156
 
@@ -158,6 +144,16 @@ class WCJ_PDF_Invoicing_Renumerate_Tool {
158
  update_option( 'wcj_invoicing_' . $invoice_type . '_numbering_counter', $start_number );
159
  }
160
 
 
 
 
 
 
 
 
 
 
 
161
  $deleted_invoices_counter = 0;
162
  $created_invoices_counter = 0;
163
 
@@ -172,12 +168,7 @@ class WCJ_PDF_Invoicing_Renumerate_Tool {
172
  'offset' => $offset,
173
  'orderby' => 'date',
174
  'order' => 'ASC',
175
- 'date_query' => array(
176
- array(
177
- 'after' => $start_date,
178
- 'inclusive' => true,
179
- ),
180
- ),
181
  );
182
 
183
  $loop = new WP_Query( $args );
@@ -187,7 +178,11 @@ class WCJ_PDF_Invoicing_Renumerate_Tool {
187
  while ( $loop->have_posts() ) : $loop->the_post();
188
 
189
  $order_id = $loop->post->ID;
190
- if ( in_array( $loop->post->post_status, $order_statuses ) && strtotime( $loop->post->post_date ) >= strtotime( $start_date ) ) {
 
 
 
 
191
 
192
  $the_order = wc_get_order( $order_id );
193
  if ( 0 != $the_order->get_total() ) {
4
  *
5
  * The WooCommerce Jetpack PDF Invoices Renumerate Tool class.
6
  *
7
+ * @version 2.3.10
8
  * @author Algoritmika Ltd.
9
  */
10
 
16
 
17
  /**
18
  * Constructor.
19
+ *
20
+ * @version 2.3.10
21
  */
22
  public function __construct() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
24
 
25
  /**
26
+ * wcj_multi_selected.
27
  */
 
 
 
 
 
 
 
 
28
  function wcj_multi_selected( $selected, $current_multi ) {
29
  if ( ! is_array( $current_multi ) ) return selected( $selected, $current_multi, false );
30
  foreach( $current_multi as $current ) {
37
  /**
38
  * Add Renumerate Invoices tool to WooCommerce menu (the content).
39
  *
40
+ * @version 2.3.10
41
  */
42
+ function create_renumerate_invoices_tool() {
43
  $result_message = '';
44
  $renumerate_result = '';
45
 
46
  $the_invoice_type = ( ! empty( $_POST['invoice_type'] ) ) ? $_POST['invoice_type'] : 'invoice';
47
  $the_start_number = ( ! empty( $_POST['start_number'] ) ) ? $_POST['start_number'] : 0;
48
  $the_start_date = ( ! empty( $_POST['start_date'] ) ) ? $_POST['start_date'] : '';
49
+ $the_end_date = ( ! empty( $_POST['end_date'] ) ) ? $_POST['end_date'] : '';
50
  $the_order_statuses = ( ! empty( $_POST['order_statuses'] ) ) ? $_POST['order_statuses'] : array();
51
  $the_delete_all = ( isset( $_POST['delete_all'] ) ) ? true : false;
52
 
53
  if ( isset( $_POST['renumerate_invoices'] ) ) {
54
  if ( ! empty( $the_order_statuses ) ) {
55
+ $renumerate_result = $this->renumerate_invoices( $the_invoice_type, $the_start_number, $the_start_date, $the_end_date, $the_order_statuses, $the_delete_all );
56
  $result_message = '<div class="updated"><p><strong>' . __( 'Invoices successfully renumerated!', 'woocommerce-jetpack' ) . '</strong></p></div>';
57
  } else {
58
  $result_message = '<div class="error"><p><strong>' . __( 'Please select at least one order status.', 'woocommerce-jetpack' ) . '</strong></p></div>';
66
  <p><form method="post" action="">
67
  <?php
68
 
69
+ // Start Date
70
  $data[] = array(
71
  __( 'Start Date', 'woocommerce-jetpack' ),
72
  '<input class="input-text" display="date" type="text" name="start_date" value="' . $the_start_date . '">',
73
  '<em>' . __( 'Date to start renumerating. Leave blank to renumerate all invoices.', 'woocommerce-jetpack' ) . '</em>',
74
  );
75
 
76
+ // End Date
77
+ $data[] = array(
78
+ __( 'End Date', 'woocommerce-jetpack' ),
79
+ '<input class="input-text" display="date" type="text" name="end_date" value="' . $the_end_date . '">',
80
+ '<em>' . __( 'Date to end renumerating. Leave blank to renumerate all invoices.', 'woocommerce-jetpack' ) . '</em>',
81
+ );
82
+
83
  // Number
84
  $data[] = array(
85
  __( 'Start Number', 'woocommerce-jetpack' ),
114
  $order_statuses_select_html .= '</select>';
115
  $data[] = array( __( 'Order Statuses', 'woocommerce-jetpack' ), $order_statuses_select_html, '', );
116
 
117
+ // Button
118
+ $data[] = array( '<input class="button-primary" type="submit" name="renumerate_invoices" value="' . __( 'Renumerate invoices', 'woocommerce-jetpack' ) . '">', '', '' );
119
+
120
  // Print all
121
  echo wcj_get_table_html( $data, array( 'table_heading_type' => 'vertical', ) );
122
 
123
  ?>
 
124
  </form></p>
125
  <?php
126
  if ( '' != $renumerate_result ) {
134
  /**
135
  * Renumerate invoices function.
136
  *
137
+ * @version 2.3.10
138
  */
139
+ function renumerate_invoices( $invoice_type, $start_number, $start_date, $end_date, $order_statuses, $the_delete_all ) {
140
 
141
  $output = '';
142
 
144
  update_option( 'wcj_invoicing_' . $invoice_type . '_numbering_counter', $start_number );
145
  }
146
 
147
+ $date_query_array = array(
148
+ array(
149
+ 'after' => $start_date,
150
+ 'inclusive' => true,
151
+ ),
152
+ );
153
+ if ( '' != $end_date ) {
154
+ $date_query_array[0]['before'] = $end_date;
155
+ }
156
+
157
  $deleted_invoices_counter = 0;
158
  $created_invoices_counter = 0;
159
 
168
  'offset' => $offset,
169
  'orderby' => 'date',
170
  'order' => 'ASC',
171
+ 'date_query' => $date_query_array,
 
 
 
 
 
172
  );
173
 
174
  $loop = new WP_Query( $args );
178
  while ( $loop->have_posts() ) : $loop->the_post();
179
 
180
  $order_id = $loop->post->ID;
181
+ if (
182
+ in_array( $loop->post->post_status, $order_statuses ) &&
183
+ strtotime( $loop->post->post_date ) >= strtotime( $start_date ) &&
184
+ ( strtotime( $loop->post->post_date ) <= strtotime( $end_date ) || '' == $end_date )
185
+ ) {
186
 
187
  $the_order = wc_get_order( $order_id );
188
  if ( 0 != $the_order->get_total() ) {
includes/pdf-invoices/class-wcj-pdf-invoicing-report-tool.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack PDF Invoices Report Tool class.
6
  *
7
- * @version 2.2.1
8
  * @since 2.2.1
9
  * @author Algoritmika Ltd.
10
  */
@@ -17,90 +17,171 @@ class WCJ_PDF_Invoicing_Report_Tool {
17
 
18
  /**
19
  * Constructor.
 
 
20
  */
21
  public function __construct() {
22
- add_filter( 'wcj_tools_tabs', array( $this, 'add_invoices_report_tool_tab' ), 100 );
23
- add_action( 'wcj_tools_invoices_report', array( $this, 'create_invoices_report_tool' ), 100 );
24
- add_action( 'wcj_tools_dashboard', array( $this, 'add_invoices_report_tool_info_to_tools_dashboard' ), 100 );
25
  }
26
 
27
  /**
28
- * add_invoices_report_tool_info_to_tools_dashboard.
 
 
 
29
  */
30
- public function add_invoices_report_tool_info_to_tools_dashboard() {
31
- echo '<tr>';
32
- if ( 'yes' === get_option( 'wcj_pdf_invoicing_enabled') )
33
- $is_enabled = '<span style="color:green;font-style:italic;">' . __( 'enabled', 'woocommerce-jetpack' ) . '</span>';
34
- else
35
- $is_enabled = '<span style="color:gray;font-style:italic;">' . __( 'disabled', 'woocommerce-jetpack' ) . '</span>';
36
- echo '<td>' . __( 'Invoices Report', 'woocommerce-jetpack' ) . '</td>';
37
- echo '<td>' . $is_enabled . '</td>';
38
- echo '<td>' . __( 'Invoices Monthly Reports.', 'woocommerce-jetpack' ) . '</td>';
39
- echo '</tr>';
40
- }
41
-
42
- /**
43
- * add_invoices_report_tool_tab.
44
- */
45
- public function add_invoices_report_tool_tab( $tabs ) {
46
- $tabs[] = array(
47
- 'id' => 'invoices_report',
48
- 'title' => __( 'Invoices Report', 'woocommerce-jetpack' ),
49
- );
50
- return $tabs;
51
  }
52
 
53
  /**
54
  * Add Invoices Report tool to WooCommerce menu (the content).
 
 
55
  */
56
- public function create_invoices_report_tool() {
57
-
58
  $result_message = '';
59
-
60
- $the_year = ( ! empty( $_POST['report_year'] ) ) ? $_POST['report_year'] : '';
61
  $the_month = ( ! empty( $_POST['report_month'] ) ) ? $_POST['report_month'] : '';
62
-
63
  if ( isset( $_POST['get_invoices_report'] ) ) {
64
- if ( ! empty( $the_year ) && ! empty( $the_month ) ) {
65
- $result_message = $this->get_invoices_report( $the_year, $the_month );
66
  } else {
67
  $result_message = '<div class="error"><p><strong>' . __( 'Please fill year and month values.', 'woocommerce-jetpack' ) . '</strong></p></div>';
68
  }
69
  }
70
  ?><div>
71
- <h2><?php echo __( 'WooCommerce Jetpack - Invoices Report', 'woocommerce-jetpack' ); ?></h2>
72
  <p><?php echo __( 'Invoices Monthly Reports.', 'woocommerce-jetpack' ); ?></p>
73
  <?php echo $result_message; ?>
74
- <p><form method="post" action="">
75
- <?php
76
-
77
- // Year
78
- $data[] = array(
79
- __( 'Year', 'woocommerce-jetpack' ),
80
- '<input class="input-text" type="text" name="report_year" value="' . $the_year . '">',
81
- //'<em>' . __( 'Year.', 'woocommerce-jetpack' ) . '</em>',
82
- );
83
-
84
- // Month
85
- $data[] = array(
86
- __( 'Month', 'woocommerce-jetpack' ),
87
- '<input class="input-text" type="text" name="report_month" value="' . $the_month . '">',
88
- //'<em>' . __( 'Month.', 'woocommerce-jetpack' ) . '</em>',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  );
90
-
91
  // Print all
92
  echo wcj_get_table_html( $data, array( 'table_heading_type' => 'vertical', ) );
93
-
94
- ?>
95
- <input type="submit" name="get_invoices_report" value="<?php _e( 'Get Report', 'woocommerce-jetpack' ); ?>">
96
- </form></p>
97
  </div><?php
98
  }
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  /**
101
  * Invoices Report function.
 
 
102
  */
103
- function get_invoices_report( $year, $month ) {
104
 
105
  $output = '';
106
 
@@ -121,70 +202,72 @@ class WCJ_PDF_Invoicing_Report_Tool {
121
  $total_sum_excl_tax = 0;
122
  $total_tax = 0;
123
 
124
- $args = array(
125
- 'post_type' => 'shop_order',
126
- 'post_status' => 'any',
127
- 'posts_per_page' => -1,
128
- 'orderby' => 'date',
129
- 'order' => 'ASC',
130
-
131
- 'year' => $year,
132
- 'monthnum' => $month,
133
- );
134
- $loop = new WP_Query( $args );
135
- while ( $loop->have_posts() ) : $loop->the_post();
136
- $order_id = $loop->post->ID;
137
- $invoice_type_id = 'invoice';
138
-
139
-
140
- if ( wcj_is_invoice_created( $order_id, $invoice_type_id ) ) {
141
-
142
- $the_order = wc_get_order( $order_id );
143
-
144
- $user_meta = get_user_meta( $the_order->get_user_id() );
145
- $billing_country = isset( $user_meta['billing_country'][0] ) ? $user_meta['billing_country'][0] : '';
146
- $shipping_country = isset( $user_meta['shipping_country'][0] ) ? $user_meta['shipping_country'][0] : '';
147
- $customer_country = ( '' == $billing_country ) ? $shipping_country : $billing_country;
148
-
149
- $order_total = $the_order->get_total();
150
-
151
- $order_tax = apply_filters( 'wcj_order_total_tax', $the_order->get_total_tax(), $the_order );
152
- //$order_tax_percent = ( isset( $taxes_by_countries_eu[ $customer_country ] ) ) ? $taxes_by_countries_eu[ $customer_country ] : 0;
153
- //$order_tax_percent /= 100;
154
- //$order_tax = $order_total * $order_tax_percent;
155
- $order_total_exlc_tax = $order_total - $order_tax;
156
- $order_tax_percent = ( 0 == $order_total ) ? 0 : $order_tax / $order_total_exlc_tax;
157
-
158
- $total_sum += $order_total;
159
- $total_sum_excl_tax += $order_total_exlc_tax;
160
- $total_tax += $order_tax;
161
-
162
- //$order_tax_html = ( 0 == $order_tax ) ? '' : sprintf( '$ %.2f', $order_tax );
163
- $order_tax_html = sprintf( '%.2f', $order_tax );
164
-
165
- $data[] = array(
166
- wcj_get_invoice_number( $order_id, $invoice_type_id ),
167
- wcj_get_invoice_date( $order_id, $invoice_type_id, 0, get_option( 'date_format' ) ),
168
- $order_id,
169
- $customer_country,
170
- sprintf( '%.0f %%', $order_tax_percent * 100 ),
171
- sprintf( '%.2f', $order_total_exlc_tax ),
172
- $order_tax_html,
173
- sprintf( '%.2f', $order_total ),
174
- $the_order->get_order_currency(),
175
- );
176
- }
177
- endwhile;
 
 
 
 
178
 
179
  /* $output .= '<h3>' . 'Total Sum Excl. Tax: ' . sprintf( '$ %.2f', $total_sum_excl_tax ) . '</h3>';
180
  $output .= '<h3>' . 'Total Sum: ' . sprintf( '$ %.2f', $total_sum ) . '</h3>';
181
  $output .= '<h3>' . 'Total Tax: ' . sprintf( '$ %.2f', $total_tax ) . '</h3>'; */
182
  $output .= wcj_get_table_html( $data, array( 'table_class' => 'widefat', ) );
183
- /**/
184
 
185
  return $output;
186
  }
187
- /**/
188
  }
189
 
190
  endif;
4
  *
5
  * The WooCommerce Jetpack PDF Invoices Report Tool class.
6
  *
7
+ * @version 2.3.10
8
  * @since 2.2.1
9
  * @author Algoritmika Ltd.
10
  */
17
 
18
  /**
19
  * Constructor.
20
+ *
21
+ * @version 2.3.10
22
  */
23
  public function __construct() {
24
+ $this->notice = '';
25
+ add_action( 'init', array( $this, 'generate_report_zip' ) );
 
26
  }
27
 
28
  /**
29
+ * generate_report_zip.
30
+ *
31
+ * @version 2.3.10
32
+ * @since 2.3.10
33
  */
34
+ function generate_report_zip() {
35
+ if ( isset( $_POST['get_invoices_report_zip'] ) ) {
36
+ if ( ! empty( $_POST['report_year'] ) && ! empty( $_POST['report_month'] ) && ! empty( $_POST['invoice_type'] ) ) {
37
+ if ( is_super_admin() || is_shop_manager() ) {
38
+ if ( false === $this->get_invoices_report_zip( $_POST['report_year'], $_POST['report_month'], $_POST['invoice_type'] ) ) {
39
+ $this->notice = '<div class="error"><p><strong>' . __( 'Sorry, but something went wrong...', 'woocommerce-jetpack' ) . '</strong></p></div>';
40
+ }
41
+ }
42
+ } else {
43
+ $this->notice = '<div class="error"><p><strong>' . __( 'Please fill year and month values.', 'woocommerce-jetpack' ) . '</strong></p></div>';
44
+ }
45
+ }
 
 
 
 
 
 
 
 
 
46
  }
47
 
48
  /**
49
  * Add Invoices Report tool to WooCommerce menu (the content).
50
+ *
51
+ * @version 2.3.10
52
  */
53
+ function create_invoices_report_tool() {
 
54
  $result_message = '';
55
+ $result_message .= $this->notice;
56
+ $the_year = ( ! empty( $_POST['report_year'] ) ) ? $_POST['report_year'] : '';
57
  $the_month = ( ! empty( $_POST['report_month'] ) ) ? $_POST['report_month'] : '';
58
+ $the_invoice_type = ( ! empty( $_POST['invoice_type'] ) ) ? $_POST['invoice_type'] : 'invoice';
59
  if ( isset( $_POST['get_invoices_report'] ) ) {
60
+ if ( ! empty( $the_year ) && ! empty( $the_month ) && ! empty( $the_invoice_type ) ) {
61
+ $result_message = $this->get_invoices_report( $the_year, $the_month, $the_invoice_type );
62
  } else {
63
  $result_message = '<div class="error"><p><strong>' . __( 'Please fill year and month values.', 'woocommerce-jetpack' ) . '</strong></p></div>';
64
  }
65
  }
66
  ?><div>
67
+ <h3><?php echo __( 'Booster - Invoices Report', 'woocommerce-jetpack' ); ?></h3>
68
  <p><?php echo __( 'Invoices Monthly Reports.', 'woocommerce-jetpack' ); ?></p>
69
  <?php echo $result_message; ?>
70
+ <p><form method="post" action=""><?php
71
+
72
+ // Type
73
+ $invoice_type_select_html = '<select name="invoice_type">';
74
+ $invoice_types = wcj_get_enabled_invoice_types();
75
+ foreach ( $invoice_types as $invoice_type ) {
76
+ $invoice_type_select_html .= '<option value="' . $invoice_type['id'] . '" ' . selected( $invoice_type['id'], $the_invoice_type, false ) . '>' . $invoice_type['title'] . '</option>';
77
+ }
78
+ $invoice_type_select_html .= '</select>';
79
+
80
+ $data = array(
81
+ // Year
82
+ array(
83
+ __( 'Year', 'woocommerce-jetpack' ),
84
+ '<input class="input-text" type="number" min="2000" max="2100" step="1" name="report_year" value="' . $the_year . '">',
85
+ ),
86
+ // Month
87
+ array(
88
+ __( 'Month', 'woocommerce-jetpack' ),
89
+ '<input class="input-text" type="number" min="1" max="12" step="1" name="report_month" value="' . $the_month . '">',
90
+ ),
91
+ // Type
92
+ array(
93
+ __( 'Document Type', 'woocommerce-jetpack' ),
94
+ $invoice_type_select_html,
95
+ ),
96
+ // Get Report Button
97
+ array(
98
+ '',
99
+ '<input class="button-primary" type="submit" name="get_invoices_report" value="' . __( 'Display monthly invoices table', 'woocommerce-jetpack' ) . '">',
100
+ ),
101
+ // Get Report Zip Button
102
+ array(
103
+ '',
104
+ '<input class="button-primary" type="submit" name="get_invoices_report_zip" value="' . __( 'Download all monthly invoices PDFs in single ZIP file', 'woocommerce-jetpack' ) . '">',
105
+ ),
106
  );
 
107
  // Print all
108
  echo wcj_get_table_html( $data, array( 'table_heading_type' => 'vertical', ) );
109
+ ?></form></p>
 
 
 
110
  </div><?php
111
  }
112
 
113
+ /**
114
+ * get_invoices_report_zip.
115
+ *
116
+ * @version 2.3.10
117
+ * @since 2.3.10
118
+ */
119
+ function get_invoices_report_zip( $year, $month, $invoice_type_id ) {
120
+ $zip = new ZipArchive();
121
+ $zip_file_name = $year . '_' . $month . '-' . $invoice_type_id . '.zip';
122
+ $zip_file_path = sys_get_temp_dir() . '/' . $zip_file_name;
123
+ if ( file_exists( $zip_file_path ) ) {
124
+ unlink ( $zip_file_path );
125
+ }
126
+ if ( $zip->open( $zip_file_path, ZipArchive::CREATE ) !== TRUE ) {
127
+ return false;
128
+ }
129
+
130
+ $offset = 0;
131
+ $block_size = 96;
132
+ while( true ) {
133
+ $args = array(
134
+ 'post_type' => 'shop_order',
135
+ 'post_status' => 'any',
136
+ 'posts_per_page' => $block_size,
137
+ 'orderby' => 'date',
138
+ 'order' => 'ASC',
139
+ 'year' => $year,
140
+ 'monthnum' => $month,
141
+ 'offset' => $offset,
142
+ );
143
+ $loop = new WP_Query( $args );
144
+ if ( ! $loop->have_posts() ) break;
145
+ while ( $loop->have_posts() ) : $loop->the_post();
146
+ $order_id = $loop->post->ID;
147
+ if ( wcj_is_invoice_created( $order_id, $invoice_type_id ) ) {
148
+ $the_invoice = wcj_get_pdf_invoice( $order_id, $invoice_type_id );
149
+ $file_name = $the_invoice->get_pdf( 'F' );
150
+ $zip->addFile( $file_name, $the_invoice->get_file_name() );
151
+ }
152
+ endwhile;
153
+ $offset += $block_size;
154
+ }
155
+
156
+ /* $output .= "numfiles: " . $zip->numFiles . "\n";
157
+ $output .= "status: " . $zip->getStatusString() . "\n"; */
158
+ $zip->close();
159
+
160
+ header( "Content-Type: application/octet-stream" );
161
+ header( "Content-Disposition: attachment; filename=" . urlencode( $zip_file_name ) );
162
+ header( "Content-Type: application/octet-stream" );
163
+ header( "Content-Type: application/download" );
164
+ header( "Content-Description: File Transfer" );
165
+ header( "Content-Length: " . filesize( $zip_file_path ) );
166
+ flush(); // this doesn't really matter.
167
+ if ( false !== ( $fp = fopen( $zip_file_path, "r" ) ) ) {
168
+ while ( ! feof( $fp ) ) {
169
+ echo fread( $fp, 65536 );
170
+ flush(); // this is essential for large downloads
171
+ }
172
+ fclose( $fp );
173
+ } else {
174
+ die( __( 'Unexpected error', 'woocommerce-jetpack' ) );
175
+ }
176
+ return true;
177
+ }
178
+
179
  /**
180
  * Invoices Report function.
181
+ *
182
+ * @version 2.3.10
183
  */
184
+ function get_invoices_report( $year, $month, $invoice_type_id ) {
185
 
186
  $output = '';
187
 
202
  $total_sum_excl_tax = 0;
203
  $total_tax = 0;
204
 
205
+ $offset = 0;
206
+ $block_size = 96;
207
+ while( true ) {
208
+ $args = array(
209
+ 'post_type' => 'shop_order',
210
+ 'post_status' => 'any',
211
+ 'posts_per_page' => $block_size,
212
+ 'orderby' => 'date',
213
+ 'order' => 'ASC',
214
+ 'year' => $year,
215
+ 'monthnum' => $month,
216
+ 'offset' => $offset,
217
+ );
218
+ $loop = new WP_Query( $args );
219
+ if ( ! $loop->have_posts() ) break;
220
+ while ( $loop->have_posts() ) : $loop->the_post();
221
+ $order_id = $loop->post->ID;
222
+
223
+ if ( wcj_is_invoice_created( $order_id, $invoice_type_id ) ) {
224
+
225
+ $the_order = wc_get_order( $order_id );
226
+
227
+ $user_meta = get_user_meta( $the_order->get_user_id() );
228
+ $billing_country = isset( $user_meta['billing_country'][0] ) ? $user_meta['billing_country'][0] : '';
229
+ $shipping_country = isset( $user_meta['shipping_country'][0] ) ? $user_meta['shipping_country'][0] : '';
230
+ $customer_country = ( '' == $billing_country ) ? $shipping_country : $billing_country;
231
+
232
+ $order_total = $the_order->get_total();
233
+
234
+ $order_tax = apply_filters( 'wcj_order_total_tax', $the_order->get_total_tax(), $the_order );
235
+ // $order_tax_percent = ( isset( $taxes_by_countries_eu[ $customer_country ] ) ) ? $taxes_by_countries_eu[ $customer_country ] : 0;
236
+ // $order_tax_percent /= 100;
237
+ // $order_tax = $order_total * $order_tax_percent;
238
+ $order_total_exlc_tax = $order_total - $order_tax;
239
+ $order_tax_percent = ( 0 == $order_total ) ? 0 : $order_tax / $order_total_exlc_tax;
240
+
241
+ $total_sum += $order_total;
242
+ $total_sum_excl_tax += $order_total_exlc_tax;
243
+ $total_tax += $order_tax;
244
+
245
+ // $order_tax_html = ( 0 == $order_tax ) ? '' : sprintf( '$ %.2f', $order_tax );
246
+ $order_tax_html = sprintf( '%.2f', $order_tax );
247
+
248
+ $data[] = array(
249
+ wcj_get_invoice_number( $order_id, $invoice_type_id ),
250
+ wcj_get_invoice_date( $order_id, $invoice_type_id, 0, get_option( 'date_format' ) ),
251
+ $order_id,
252
+ $customer_country,
253
+ sprintf( '%.0f %%', $order_tax_percent * 100 ),
254
+ sprintf( '%.2f', $order_total_exlc_tax ),
255
+ $order_tax_html,
256
+ sprintf( '%.2f', $order_total ),
257
+ $the_order->get_order_currency(),
258
+ );
259
+ }
260
+ endwhile;
261
+ $offset += $block_size;
262
+ }
263
 
264
  /* $output .= '<h3>' . 'Total Sum Excl. Tax: ' . sprintf( '$ %.2f', $total_sum_excl_tax ) . '</h3>';
265
  $output .= '<h3>' . 'Total Sum: ' . sprintf( '$ %.2f', $total_sum ) . '</h3>';
266
  $output .= '<h3>' . 'Total Tax: ' . sprintf( '$ %.2f', $total_tax ) . '</h3>'; */
267
  $output .= wcj_get_table_html( $data, array( 'table_class' => 'widefat', ) );
 
268
 
269
  return $output;
270
  }
 
271
  }
272
 
273
  endif;
includes/pdf-invoices/settings/class-wcj-pdf-invoicing-display.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack PDF Invoicing Display class.
6
  *
7
- * @version 2.3.9
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -17,26 +17,20 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
17
  /**
18
  * Constructor.
19
  *
20
- * @version 2.3.0
21
  */
22
  function __construct() {
23
 
24
  $this->id = 'pdf_invoicing_display';
25
  $this->parent_id = 'pdf_invoicing';
26
- $this->short_desc = __( 'Misc.', 'woocommerce-jetpack' );
27
  $this->desc = '';
28
  parent::__construct( 'submodule' );
29
 
30
  if ( $this->is_enabled() ) {
31
-
32
  // Columns on Admin's Orders page
33
  add_filter( 'manage_edit-shop_order_columns', array( $this, 'add_order_column' ), PHP_INT_MAX );
34
  add_action( 'manage_shop_order_posts_custom_column', array( $this, 'render_order_columns' ), 2 );
35
-
36
- // Action Links on Admin's Orders page
37
- // add_filter( 'woocommerce_admin_order_actions', array( $this, 'add_pdf_invoices_action_links' ), PHP_INT_MAX, 2 );
38
- // add_action( 'admin_head', array( $this, 'add_pdf_invoice_icon_css' ) );
39
-
40
  // Action Links on Customer's My Account page
41
  add_filter( 'woocommerce_my_account_my_orders_actions', array( $this, 'add_pdf_invoices_action_links' ), PHP_INT_MAX, 2 );
42
  }
@@ -44,12 +38,14 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
44
 
45
  /**
46
  * add_order_column.
 
 
47
  */
48
  function add_order_column( $columns ) {
49
  $invoice_types = wcj_get_enabled_invoice_types();
50
  foreach ( $invoice_types as $invoice_type ) {
51
  if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_page_column', 'yes' ) ) {
52
- $columns[ $invoice_type['id'] ] = $invoice_type['title'];
53
  }
54
  }
55
  return $columns;
@@ -59,90 +55,70 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
59
  * Ouput custom columns for products
60
  *
61
  * @param string $column
62
- * @version 2.3.9
63
  */
64
  public function render_order_columns( $column ) {
65
-
66
  $invoice_types_ids = wcj_get_enabled_invoice_types_ids();
67
  if ( ! in_array( $column, $invoice_types_ids ) ) {
68
  return;
69
  }
70
-
71
  $order_id = get_the_ID();
72
  $invoice_type_id = $column;
73
-
74
  $html = '';
75
  if ( wcj_is_invoice_created( $order_id, $invoice_type_id ) ) {
76
  $the_invoice = wcj_get_invoice( $order_id, $invoice_type_id );
77
  $the_number = $the_invoice->get_invoice_number();
78
- // $the_url = $the_invoice->get_invoice_url();
79
- // $the_link = $the_invoice->get_invoice_link();
80
-
81
- //$html .= ' ';
82
 
 
83
  $query_args = array( 'order_id' => $order_id, 'invoice_type_id' => $invoice_type_id, 'get_invoice' => '1', );
84
  if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type_id . '_save_as_enabled', 'no' ) ) {
85
  $query_args['save_pdf_invoice'] = '1';
86
  }
87
- $html .= '<a href="' . add_query_arg( $query_args, remove_query_arg( array( 'create_invoice_for_order_id', 'delete_invoice_for_order_id' ) ) ) . '">' . $the_number . '</a>';
88
-
89
- $html .= ' ';
90
-
91
- $html .= '<a href="';
92
- $html .= add_query_arg(
93
- array( 'delete_invoice_for_order_id' => $order_id, 'invoice_type_id' => $invoice_type_id ),
94
- remove_query_arg( 'create_invoice_for_order_id' )
95
- );
96
- $html .= '"><span style="color:gray;font-style:italic;font-size:x-small;text-decoration:underline;">' . __( 'Delete', 'woocommerce-jetpack' ) . '</span></a>';
97
- //$html .= '">' . '<img src="http://icons.iconarchive.com/icons/double-j-design/origami-colored-pencil/16/red-cross-icon.png">' . '</a>';
98
-
 
 
 
99
  } else {
100
- $html .= '<a href="';
101
- $html .= add_query_arg(
102
- array( 'create_invoice_for_order_id' => $order_id, 'invoice_type_id' => $invoice_type_id ),
103
- remove_query_arg( 'delete_invoice_for_order_id' )
104
- );
105
- $html .= '"><span style="color:gray;font-style:italic;font-size:x-small;text-decoration:underline;">' . __( 'Create', 'woocommerce-jetpack' ) . '</span></a>';
106
- //$html .= '">' . '<img src="http://icons.iconarchive.com/icons/double-j-design/origami-colored-pencil/16/blue-plus-icon.png">' . '</a>';
 
 
 
107
  }
108
  echo $html;
109
  }
110
 
111
- /**
112
- * add_pdf_invoice_icon_css.
113
- *
114
- function add_pdf_invoice_icon_css() {
115
- $invoice_types = wcj_get_enabled_invoice_types();
116
- foreach ( $invoice_types as $invoice_type ) {
117
- echo '<style> a.button.tips.view.' . $invoice_type['id'] . ':after { content: "' . $invoice_type['icon'] . '" !important; } </style>';
118
- }
119
- }
120
-
121
  /**
122
  * add_pdf_invoices_action_links.
123
  *
124
  * @version 2.3.7
125
  */
126
  function add_pdf_invoices_action_links( $actions, $the_order ) {
127
-
128
  $invoice_types = wcj_get_enabled_invoice_types();
129
  foreach ( $invoice_types as $invoice_type ) {
130
-
131
  if ( ! wcj_is_invoice_created( $the_order->id, $invoice_type['id'] ) )
132
  continue;
133
-
134
- //$admin_option_name = 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_page';
135
  $my_account_option_name = 'wcj_invoicing_' . $invoice_type['id'] . '_enabled_for_customers';
136
-
137
- /*if ( ( 'woocommerce_admin_order_actions' === current_filter() && 'add_action_link' === get_option( $admin_option_name, 'add_column' ) ) ||
138
- ( 'woocommerce_my_account_my_orders_actions' === current_filter() && 'yes' === apply_filters( 'wcj_get_option_filter', 'no', get_option( $my_account_option_name, 'no' ) ) ) ) {*/
139
-
140
- //if ( 'woocommerce_my_account_my_orders_actions' === current_filter() && 'yes' === apply_filters( 'wcj_get_option_filter', 'no', get_option( $my_account_option_name, 'no' ) ) ) {
141
  if ( 'yes' === get_option( $my_account_option_name, 'no' ) ) {
142
 
143
  $the_action_id = $invoice_type['id'];
144
 
145
- //$the_url = basename( $_SERVER['REQUEST_URI'] ) . '&order_id=' . $the_order->id . '&invoice_type_id=' . $invoice_type['id'] . '&get_invoice=1';
146
  $query_args = array( 'order_id' => $the_order->id, 'invoice_type_id' => $invoice_type['id'], 'get_invoice' => '1', );
147
  if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_save_as_enabled', 'no' ) ) {
148
  $query_args['save_pdf_invoice'] = '1';
@@ -151,23 +127,19 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
151
 
152
  $the_name = get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_link_text' );
153
  if ( '' == $the_name ) $the_name = $invoice_type['title'];
154
- $the_action = 'view ' . $invoice_type['id'];
155
 
156
- /* if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_save_as_enabled', 'no' ) ) {
157
- $the_url .= '&save_pdf_invoice=1';
158
- } */
159
 
160
- $actions[ $the_action_id ] = array( 'url' => $the_url, 'name' => $the_name, 'action' => $the_action, );
161
  }
162
  }
163
-
164
  return $actions;
165
  }
166
 
167
  /**
168
  * get_settings.
169
  *
170
- * @version 2.3.7
171
  */
172
  function get_settings() {
173
 
@@ -176,9 +148,9 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
176
  foreach ( $invoice_types as $invoice_type ) {
177
 
178
  $settings[] = array(
179
- 'title' => strtoupper( $invoice_type['desc'] ),
180
- 'type' => 'title',
181
- 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_display_options',
182
  );
183
 
184
  $settings = array_merge( $settings, array(
@@ -189,31 +161,48 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
189
  'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_page_column',
190
  'default' => 'yes',
191
  'type' => 'checkbox',
192
- /* 'class' => 'chosen_select',
193
- 'options' => array(
194
- 'add_column' => __( 'Add Column', 'woocommerce-jetpack' ),
195
- 'add_action_link' => __( 'Add Action Link', 'woocommerce-jetpack' ),
196
- ), */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  ),
198
 
199
  array(
200
  'title' => __( 'Customer\'s "My Account" Page', 'woocommerce-jetpack' ),
201
  'desc' => __( 'Add link', 'woocommerce-jetpack' ),
202
- 'desc_tip' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
203
  'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_enabled_for_customers',
204
  'default' => 'no',
205
  'type' => 'checkbox',
206
- 'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
207
  ),
208
 
209
  array(
210
  'title' => '',
211
  'desc' => __( 'Link Text', 'woocommerce-jetpack' ),
212
- 'desc_tip' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc_no_link' ),
213
  'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_link_text',
214
  'default' => $invoice_type['title'],
215
  'type' => 'text',
216
- 'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
217
  ),
218
 
219
  array(
@@ -235,8 +224,8 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
235
  ) );
236
 
237
  $settings[] = array(
238
- 'type' => 'sectionend',
239
- 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_display_options',
240
  );
241
  }
242
 
4
  *
5
  * The WooCommerce Jetpack PDF Invoicing Display class.
6
  *
7
+ * @version 2.3.10
8
  * @author Algoritmika Ltd.
9
  */
10
 
17
  /**
18
  * Constructor.
19
  *
20
+ * @version 2.3.10
21
  */
22
  function __construct() {
23
 
24
  $this->id = 'pdf_invoicing_display';
25
  $this->parent_id = 'pdf_invoicing';
26
+ $this->short_desc = __( 'Display & Misc.', 'woocommerce-jetpack' );
27
  $this->desc = '';
28
  parent::__construct( 'submodule' );
29
 
30
  if ( $this->is_enabled() ) {
 
31
  // Columns on Admin's Orders page
32
  add_filter( 'manage_edit-shop_order_columns', array( $this, 'add_order_column' ), PHP_INT_MAX );
33
  add_action( 'manage_shop_order_posts_custom_column', array( $this, 'render_order_columns' ), 2 );
 
 
 
 
 
34
  // Action Links on Customer's My Account page
35
  add_filter( 'woocommerce_my_account_my_orders_actions', array( $this, 'add_pdf_invoices_action_links' ), PHP_INT_MAX, 2 );
36
  }
38
 
39
  /**
40
  * add_order_column.
41
+ *
42
+ * @version 2.3.10
43
  */
44
  function add_order_column( $columns ) {
45
  $invoice_types = wcj_get_enabled_invoice_types();
46
  foreach ( $invoice_types as $invoice_type ) {
47
  if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_page_column', 'yes' ) ) {
48
+ $columns[ $invoice_type['id'] ] = get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_page_column_text' );
49
  }
50
  }
51
  return $columns;
55
  * Ouput custom columns for products
56
  *
57
  * @param string $column
58
+ * @version 2.3.10
59
  */
60
  public function render_order_columns( $column ) {
 
61
  $invoice_types_ids = wcj_get_enabled_invoice_types_ids();
62
  if ( ! in_array( $column, $invoice_types_ids ) ) {
63
  return;
64
  }
 
65
  $order_id = get_the_ID();
66
  $invoice_type_id = $column;
 
67
  $html = '';
68
  if ( wcj_is_invoice_created( $order_id, $invoice_type_id ) ) {
69
  $the_invoice = wcj_get_invoice( $order_id, $invoice_type_id );
70
  $the_number = $the_invoice->get_invoice_number();
 
 
 
 
71
 
72
+ // Document Link
73
  $query_args = array( 'order_id' => $order_id, 'invoice_type_id' => $invoice_type_id, 'get_invoice' => '1', );
74
  if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type_id . '_save_as_enabled', 'no' ) ) {
75
  $query_args['save_pdf_invoice'] = '1';
76
  }
77
+ $html .= '<a href="'
78
+ . add_query_arg( $query_args, remove_query_arg( array( 'create_invoice_for_order_id', 'delete_invoice_for_order_id' ) ) )
79
+ . '">' . $the_number . '</a>';
80
+
81
+ // Delete button
82
+ $delete_button_label = get_option( 'wcj_invoicing_' . $invoice_type_id . '_admin_column_delete_btn', __( 'Delete', 'woocommerce-jetpack' ) );
83
+ if ( '' != $delete_button_label ) {
84
+ $html .= ' ';
85
+ $html .= '<a href="';
86
+ $html .= add_query_arg(
87
+ array( 'delete_invoice_for_order_id' => $order_id, 'invoice_type_id' => $invoice_type_id ),
88
+ remove_query_arg( 'create_invoice_for_order_id' )
89
+ );
90
+ $html .= '"><span style="color:gray;font-style:italic;font-size:x-small;text-decoration:underline;">' . $delete_button_label . '</span></a>';
91
+ }
92
  } else {
93
+ // Create Button
94
+ $create_button_label = get_option( 'wcj_invoicing_' . $invoice_type_id . '_admin_column_create_btn', __( 'Create', 'woocommerce-jetpack' ) );
95
+ if ( '' != $create_button_label ) {
96
+ $html .= '<a href="';
97
+ $html .= add_query_arg(
98
+ array( 'create_invoice_for_order_id' => $order_id, 'invoice_type_id' => $invoice_type_id ),
99
+ remove_query_arg( 'delete_invoice_for_order_id' )
100
+ );
101
+ $html .= '"><span style="color:gray;font-style:italic;font-size:x-small;text-decoration:underline;">' . $create_button_label . '</span></a>';
102
+ }
103
  }
104
  echo $html;
105
  }
106
 
 
 
 
 
 
 
 
 
 
 
107
  /**
108
  * add_pdf_invoices_action_links.
109
  *
110
  * @version 2.3.7
111
  */
112
  function add_pdf_invoices_action_links( $actions, $the_order ) {
 
113
  $invoice_types = wcj_get_enabled_invoice_types();
114
  foreach ( $invoice_types as $invoice_type ) {
 
115
  if ( ! wcj_is_invoice_created( $the_order->id, $invoice_type['id'] ) )
116
  continue;
 
 
117
  $my_account_option_name = 'wcj_invoicing_' . $invoice_type['id'] . '_enabled_for_customers';
 
 
 
 
 
118
  if ( 'yes' === get_option( $my_account_option_name, 'no' ) ) {
119
 
120
  $the_action_id = $invoice_type['id'];
121
 
 
122
  $query_args = array( 'order_id' => $the_order->id, 'invoice_type_id' => $invoice_type['id'], 'get_invoice' => '1', );
123
  if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_save_as_enabled', 'no' ) ) {
124
  $query_args['save_pdf_invoice'] = '1';
127
 
128
  $the_name = get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_link_text' );
129
  if ( '' == $the_name ) $the_name = $invoice_type['title'];
 
130
 
131
+ $the_action = 'view ' . $invoice_type['id'];
 
 
132
 
133
+ $actions[ $the_action_id ] = array( 'url' => $the_url, 'name' => $the_name, 'action' => $the_action, );
134
  }
135
  }
 
136
  return $actions;
137
  }
138
 
139
  /**
140
  * get_settings.
141
  *
142
+ * @version 2.3.10
143
  */
144
  function get_settings() {
145
 
148
  foreach ( $invoice_types as $invoice_type ) {
149
 
150
  $settings[] = array(
151
+ 'title' => strtoupper( $invoice_type['desc'] ),
152
+ 'type' => 'title',
153
+ 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_display_options',
154
  );
155
 
156
  $settings = array_merge( $settings, array(
161
  'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_page_column',
162
  'default' => 'yes',
163
  'type' => 'checkbox',
164
+ ),
165
+
166
+ array(
167
+ 'title' => '',
168
+ 'desc' => __( 'Column Title', 'woocommerce-jetpack' ),
169
+ 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_admin_page_column_text',
170
+ 'default' => $invoice_type['title'],
171
+ 'type' => 'text',
172
+ ),
173
+
174
+ array(
175
+ 'title' => '',
176
+ 'desc' => __( 'Create Button', 'woocommerce-jetpack' ),
177
+ 'desc_tip' => __( 'Set empty to disable the button', 'woocommerce-jetpack' ),
178
+ 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_admin_column_create_btn',
179
+ 'default' => __( 'Create', 'woocommerce-jetpack' ),
180
+ 'type' => 'text',
181
+ ),
182
+
183
+ array(
184
+ 'title' => '',
185
+ 'desc' => __( 'Delete Button', 'woocommerce-jetpack' ),
186
+ 'desc_tip' => __( 'Set empty to disable the button', 'woocommerce-jetpack' ),
187
+ 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_admin_column_delete_btn',
188
+ 'default' => __( 'Delete', 'woocommerce-jetpack' ),
189
+ 'type' => 'text',
190
  ),
191
 
192
  array(
193
  'title' => __( 'Customer\'s "My Account" Page', 'woocommerce-jetpack' ),
194
  'desc' => __( 'Add link', 'woocommerce-jetpack' ),
 
195
  'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_enabled_for_customers',
196
  'default' => 'no',
197
  'type' => 'checkbox',
 
198
  ),
199
 
200
  array(
201
  'title' => '',
202
  'desc' => __( 'Link Text', 'woocommerce-jetpack' ),
 
203
  'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_link_text',
204
  'default' => $invoice_type['title'],
205
  'type' => 'text',
 
206
  ),
207
 
208
  array(
224
  ) );
225
 
226
  $settings[] = array(
227
+ 'type' => 'sectionend',
228
+ 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_display_options',
229
  );
230
  }
231
 
includes/pdf-invoices/settings/class-wcj-pdf-invoicing-numbering.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack PDF Invoices Numbering class.
6
  *
7
- * @version 2.3.0
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -17,7 +17,7 @@ class WCJ_PDF_Invoicing_Numbering extends WCJ_Module {
17
  /**
18
  * Constructor.
19
  *
20
- * @version 2.3.0
21
  */
22
  public function __construct() {
23
 
@@ -26,19 +26,15 @@ class WCJ_PDF_Invoicing_Numbering extends WCJ_Module {
26
  $this->short_desc = __( 'Numbering', 'woocommerce-jetpack' );
27
  $this->desc = '';
28
  parent::__construct( 'submodule' );
29
-
30
- $this->add_tools( array( 'renumerate_invoices' => __( 'Renumerate Invoices', 'woocommerce-jetpack' ), ) );
31
  }
32
 
33
  /**
34
  * get_settings.
35
  *
36
- * @version 2.3.0
37
  */
38
  function get_settings() {
39
-
40
  $settings = array();
41
-
42
  $invoice_types = wcj_get_invoice_types();
43
  foreach ( $invoice_types as $invoice_type ) {
44
  $settings[] = array( 'title' => strtoupper( $invoice_type['desc'] ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_numbering_options' );
@@ -74,9 +70,6 @@ class WCJ_PDF_Invoicing_Numbering extends WCJ_Module {
74
  );
75
  $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_numbering_options' );
76
  }
77
-
78
- $settings = $this->add_tools_list( $settings );
79
-
80
  return $settings;
81
  }
82
  }
4
  *
5
  * The WooCommerce Jetpack PDF Invoices Numbering class.
6
  *
7
+ * @version 2.3.10
8
  * @author Algoritmika Ltd.
9
  */
10
 
17
  /**
18
  * Constructor.
19
  *
20
+ * @version 2.3.10
21
  */
22
  public function __construct() {
23
 
26
  $this->short_desc = __( 'Numbering', 'woocommerce-jetpack' );
27
  $this->desc = '';
28
  parent::__construct( 'submodule' );
 
 
29
  }
30
 
31
  /**
32
  * get_settings.
33
  *
34
+ * @version 2.3.10
35
  */
36
  function get_settings() {
 
37
  $settings = array();
 
38
  $invoice_types = wcj_get_invoice_types();
39
  foreach ( $invoice_types as $invoice_type ) {
40
  $settings[] = array( 'title' => strtoupper( $invoice_type['desc'] ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_numbering_options' );
70
  );
71
  $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_numbering_options' );
72
  }
 
 
 
73
  return $settings;
74
  }
75
  }
includes/tools/class-wcj-eu-countries-vat-rates-tool.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WooCommerce Jetpack EU Countries VAT Rates Tool
4
+ *
5
+ * The WooCommerce Jetpack EU Countries VAT Rates Tool class.
6
+ *
7
+ * @version 2.3.10
8
+ * @since 2.3.10
9
+ * @author Algoritmika Ltd.
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) exit;
13
+
14
+ if ( ! class_exists( 'WCJ_EU_Countries_VAT_Rates_Tool' ) ) :
15
+
16
+ class WCJ_EU_Countries_VAT_Rates_Tool {
17
+
18
+ /**
19
+ * Constructor.
20
+ *
21
+ * @version 2.3.10
22
+ * @since 2.3.10
23
+ */
24
+ function __construct() {
25
+ add_action( 'init', array( $this, 'add_eu_countries_vat_rates' ) );
26
+ }
27
+
28
+ /**
29
+ * add_eu_countries_vat_rates.
30
+ *
31
+ * @version 2.3.10
32
+ * @since 2.3.10
33
+ */
34
+ function add_eu_countries_vat_rates() {
35
+ if ( ! isset( $_POST['add_eu_countries_vat_rates'] ) ) return;
36
+ if ( ! is_super_admin() && ! is_shop_manager() ) return;
37
+ $loop = 0;
38
+ foreach ( wcj_get_european_union_countries_with_vat() as $country => $rate ) {
39
+ $tax_rate = array(
40
+ 'tax_rate_country' => $country,
41
+ 'tax_rate' => $rate,
42
+
43
+ 'tax_rate_name' => isset( $_POST['wcj_tax_name'] ) ? $_POST['wcj_tax_name'] : __( 'VAT', 'woocommerce' ),
44
+ 'tax_rate_priority' => 1,
45
+ 'tax_rate_compound' => 0,
46
+ 'tax_rate_shipping' => 1,
47
+
48
+ 'tax_rate_order' => $loop++,
49
+ 'tax_rate_class' => '',
50
+ );
51
+ $tax_rate_id = WC_Tax::_insert_tax_rate( $tax_rate );
52
+ WC_Tax::_update_tax_rate_postcodes( $tax_rate_id, '' );
53
+ WC_Tax::_update_tax_rate_cities( $tax_rate_id, '' );
54
+ }
55
+ }
56
+
57
+ /**
58
+ * create_eu_countries_vat_rates_tool.
59
+ *
60
+ * @version 2.3.10
61
+ * @since 2.3.10
62
+ */
63
+ function create_eu_countries_vat_rates_tool( $header_html ) {
64
+
65
+ $the_tool_html = '';
66
+ $the_tool_html .= $header_html;
67
+
68
+ // $the_tool_html .= '<h4>' . __( 'Settings', 'woocommerce-jetpack' ) . '</h4>';
69
+ $data = array();
70
+ $the_name = ( isset( $_POST['wcj_tax_name'] ) ) ? $_POST['wcj_tax_name'] : __( 'VAT', 'woocommerce' );
71
+ $data[] = array(
72
+ __( 'Name', 'woocommerce-jetpack' ),
73
+ '<input class="input-text" type="text" name="wcj_tax_name" value="' . $the_name . '">',
74
+ );
75
+ $data[] = array(
76
+ '',
77
+ '<input class="button-primary" type="submit" name="add_eu_countries_vat_rates" value="' . __( 'Add EU Countries VAT Rates', 'woocommerce-jetpack' ) . '">' . ' ' . __( 'Note: will add duplicates.', 'woocommerce-jetpack' ),
78
+ );
79
+ $the_tool_html .= '<p>';
80
+ $the_tool_html .= '<form method="post" action="">';
81
+ $the_tool_html .= wcj_get_table_html( $data, array( 'table_heading_type' => 'vertical', ) );
82
+ $the_tool_html .= '</form>';
83
+ $the_tool_html .= '</p>';
84
+
85
+ $the_tool_html .= '<h4>' . __( 'List of EU VAT rates to be added', 'woocommerce-jetpack' ) . '</h4>';
86
+ $eu_vat_rates = wcj_get_european_union_countries_with_vat();
87
+ $data = array();
88
+ $data[] = array(
89
+ '',
90
+ __( 'Country', 'woocommerce-jetpack' ),
91
+ __( 'Rate', 'woocommerce-jetpack' ),
92
+ );
93
+ $i = 1;
94
+ foreach ( $eu_vat_rates as $country => $rate ) {
95
+ $data[] = array( $i++, $country . ' - ' . wcj_get_country_name_by_code( $country ), $rate . '%' );
96
+ }
97
+ $the_tool_html .= wcj_get_table_html( $data, array( 'table_class' => 'widefat', 'table_style' => 'width:50%;min-width:300px;', ) );
98
+
99
+ $the_tool_html .= '<h4>' . __( 'Current standard tax rates', 'woocommerce-jetpack' ) . '</h4>';
100
+ $standard_tax_rates = wcj_get_rates_for_tax_class( '' );
101
+ $data = array();
102
+ $data[] = array(
103
+ '',
104
+ __( 'Country', 'woocommerce-jetpack' ),
105
+ __( 'Rate', 'woocommerce-jetpack' ),
106
+ __( 'Name', 'woocommerce-jetpack' ),
107
+ );
108
+ $i = 1;
109
+ foreach ( $standard_tax_rates as $tax_rate_object ) {
110
+ $data[] = array( $i++, $tax_rate_object->tax_rate_country . ' - ' . wcj_get_country_name_by_code( $tax_rate_object->tax_rate_country ), $tax_rate_object->tax_rate . '%', $tax_rate_object->tax_rate_name, );
111
+ }
112
+ $the_tool_html .= wcj_get_table_html( $data, array( 'table_class' => 'widefat', 'table_style' => 'width:75%;min-width:300px;', ) );
113
+
114
+ echo $the_tool_html;
115
+ }
116
+ }
117
+
118
+ endif;
119
+
120
+ return new WCJ_EU_Countries_VAT_Rates_Tool();
readme.txt CHANGED
@@ -1,10 +1,9 @@
1
  === Booster for WooCommerce ===
2
  Contributors: algoritmika,anbinder,solovjov
3
- Donate link: http://algoritmika.com/donate/
4
- Tags: woocommerce,booster for woocommerce,woocommerce jetpack,custom price labels,call for price,currency symbol,remove sorting,remove old product slugs,add to cart text,order number,sequential order numbering,email pdf invoice,pdf invoice,pdf invoices,already in cart,empty cart,redirect to checkout,minimum order amount,customize checkout fields,checkout fields,email,customize product tabs,product tabs,related products number,empty cart,redirect add to cart,redirect to checkout,product already in cart,custom payment gateway,payment gateway icon,auto-complete all orders,custom order statuses,custom order status,remove text from price,custom css,hide categories count,hide subcategories count,hide category count,hide subcategory count,display total sales,custom product tabs,remove product tab,payment gateway fee,
5
  Requires at least: 3.8
6
  Tested up to: 4.4
7
- Stable tag: 2.3.9
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -80,7 +79,7 @@ Booster for WooCommerce is a WordPress plugin that supercharges your site with a
80
 
81
  * *Admin Tools* - Booster for WooCommerce debug and log tools.
82
  * *Emails* - Add custom emails. Add another email recipient(s) to all WooCommerce emails.
83
- * *EU VAT Number* - Collect and validate EU VAT numbers on WooCommerce checkout. Automatically disable VAT for valid numbers.
84
  * *General* - Separate custom CSS for front and back end. Shortcodes in Wordpress text widgets.
85
  * *Old Slugs* - Remove old WooCommerce products slugs.
86
  * *Reports* - WooCommerce stock, sales, customers etc. reports.
@@ -117,6 +116,21 @@ To unlock all Booster for WooCommerce features, please install additional <a hre
117
 
118
  == Changelog ==
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  = 2.3.9 - 18/12/2015 =
121
  * Fix - Shortcodes - `lang` and `not_lang` params PHP notice fixed.
122
  * Dev - Shortcodes - `wcj_order_billing_address` filter added.
1
  === Booster for WooCommerce ===
2
  Contributors: algoritmika,anbinder,solovjov
3
+ Tags: woocommerce,booster for woocommerce,woocommerce jetpack,custom price labels,call for price,currency symbol,remove sorting,remove old product slugs,add to cart text,order number,sequential order numbering,email pdf invoice,pdf invoice,pdf invoices,already in cart,empty cart,redirect to checkout,minimum order amount,customize checkout fields,checkout fields,email,customize product tabs,product tabs,related products number,empty cart,redirect add to cart,redirect to checkout,product already in cart,custom payment gateway,payment gateway icon,auto-complete all orders,custom order statuses,custom order status,remove text from price,custom css,hide categories count,hide subcategories count,hide category count,hide subcategory count,display total sales,custom product tabs,remove product tab,payment gateway fee,vat
 
4
  Requires at least: 3.8
5
  Tested up to: 4.4
6
+ Stable tag: 2.3.10
7
  License: GNU General Public License v3.0
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
79
 
80
  * *Admin Tools* - Booster for WooCommerce debug and log tools.
81
  * *Emails* - Add custom emails. Add another email recipient(s) to all WooCommerce emails.
82
+ * *EU VAT Number* - Collect and validate EU VAT numbers on WooCommerce checkout. Automatically disable VAT for valid numbers. Add all EU countries VAT standard rates to WooCommerce.
83
  * *General* - Separate custom CSS for front and back end. Shortcodes in Wordpress text widgets.
84
  * *Old Slugs* - Remove old WooCommerce products slugs.
85
  * *Reports* - WooCommerce stock, sales, customers etc. reports.
116
 
117
  == Changelog ==
118
 
119
+ = 2.3.10 - 26/12/2015 =
120
+ * Dev - `WCJ_Tools` and `WCJ_Module` - Code refactoring (mostly Tools related). Additionally modified modules:
121
+ Admin Tools, Bulk Price Converter, Custom Price Labels, EU VAT Number, General, Old Slugs, Order Custom Statuses, Order Numbers, PDF Invoicing, SKU.
122
+ * Dev - PDF Invoicing - "Invoices Report" tool - Code refactoring.
123
+ * Dev - PDF Invoicing - "Invoices Report" tool - "Document Type" select option added.
124
+ * Dev - PDF Invoicing - "Invoices Report" tool - "Download all monthly invoices PDFs in single ZIP file" button added.
125
+ * Dev - PDF Invoicing - "Renumerate Invoices" tool - "End Date" field added.
126
+ * Dev - PDF Invoicing - Display - Admin's "Orders" Page - "Column Title", "Create Button" and "Delete Button" options added.
127
+ * Dev - PDF Invoicing - Display - "Misc." menu renamed to "Display & Misc.".
128
+ * Dev - PDF Invoicing - Display - Customer's "My Account" Page - "Add link" and "Link text" options unlocked.
129
+ * Dev - PDF Invoices (v1) marked as "Depreciated".
130
+ * Fix - EMAILS & MISC. - General - Tabs on "Booster Tools" page fixed (caused other module's tools tabs disappear). Info on "Booster Tools Dashboard" page fixed.
131
+ * Dev - EMAILS & MISC. - EU VAT Number - "EU Countries VAT Rates" tool added.
132
+ * Dev - Donate link removed.
133
+
134
  = 2.3.9 - 18/12/2015 =
135
  * Fix - Shortcodes - `lang` and `not_lang` params PHP notice fixed.
136
  * Dev - Shortcodes - `wcj_order_billing_address` filter added.
woocommerce-jetpack.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Booster for WooCommerce
4
  Plugin URI: http://booster.io
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
- Version: 2.3.9
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2015 Algoritmika Ltd.
3
  Plugin Name: Booster for WooCommerce
4
  Plugin URI: http://booster.io
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
+ Version: 2.3.10
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2015 Algoritmika Ltd.