/** * Add Renumerate Invoices tool to WooCommerce menu (the content). * * @version 2.3.10 */ function create_renumerate_invoices_tool() { $result_message = ''; $renumerate_result = ''; $the_invoice_type = !empty($_POST['invoice_type']) ? $_POST['invoice_type'] : 'invoice'; $the_start_number = !empty($_POST['start_number']) ? $_POST['start_number'] : 0; $the_start_date = !empty($_POST['start_date']) ? $_POST['start_date'] : ''; $the_end_date = !empty($_POST['end_date']) ? $_POST['end_date'] : ''; $the_order_statuses = !empty($_POST['order_statuses']) ? $_POST['order_statuses'] : array(); $the_delete_all = isset($_POST['delete_all']) ? true : false; if (isset($_POST['renumerate_invoices'])) { if (!empty($the_order_statuses)) { $renumerate_result = $this->renumerate_invoices($the_invoice_type, $the_start_number, $the_start_date, $the_end_date, $the_order_statuses, $the_delete_all); $result_message = '<div class="updated"><p><strong>' . __('Invoices successfully renumerated!', 'woocommerce-jetpack') . '</strong></p></div>'; } else { $result_message = '<div class="error"><p><strong>' . __('Please select at least one order status.', 'woocommerce-jetpack') . '</strong></p></div>'; } //$result_message .= '<p>' . $renumerate_result . '</p>'; } ?> <div> <h2><?php echo __('Booster - Renumerate Invoices', 'woocommerce-jetpack'); ?> </h2> <p><?php echo __('The tool renumerates invoices from choosen date. Invoice number format is set in WooCommerce > Settings > Booster > PDF Invoicing & Packing Slips > Numbering.', 'woocommerce-jetpack'); ?> </p> <?php echo $result_message; ?> <p><form method="post" action=""> <?php // Start Date $data[] = array(__('Start Date', 'woocommerce-jetpack'), '<input class="input-text" display="date" type="text" name="start_date" value="' . $the_start_date . '">', '<em>' . __('Date to start renumerating. Leave blank to renumerate all invoices.', 'woocommerce-jetpack') . '</em>'); // End Date $data[] = array(__('End Date', 'woocommerce-jetpack'), '<input class="input-text" display="date" type="text" name="end_date" value="' . $the_end_date . '">', '<em>' . __('Date to end renumerating. Leave blank to renumerate all invoices.', 'woocommerce-jetpack') . '</em>'); // Number $data[] = array(__('Start Number', 'woocommerce-jetpack'), '<input class="input-text" type="text" name="start_number" value="' . $the_start_number . '">', '<em>' . __('Counter to start renumerating. Leave 0 to continue from current counter.', 'woocommerce-jetpack') . '</em>'); // Delete All $data[] = array(__('Delete All', 'woocommerce-jetpack'), '<input type="checkbox" name="delete_all" value="" ' . checked($the_delete_all, true, false) . '>', '<em>' . __('Clear all invoices before renumerating.', 'woocommerce-jetpack') . '</em>'); // Type $invoice_type_select_html = '<select name="invoice_type">'; //$invoice_types = wcj_get_invoice_types(); $invoice_types = wcj_get_enabled_invoice_types(); foreach ($invoice_types as $invoice_type) { $invoice_type_select_html .= '<option value="' . $invoice_type['id'] . '" ' . selected($invoice_type['id'], $the_invoice_type, false) . '>' . $invoice_type['title'] . '</option>'; } $invoice_type_select_html .= '</select>'; $data[] = array(__('Document Type', 'woocommerce-jetpack'), $invoice_type_select_html, ''); // Statuses $order_statuses_select_html = '<select id="order_statuses" name="order_statuses[]" multiple size="5">'; $order_statuses = wcj_get_order_statuses(false); foreach ($order_statuses as $status => $desc) { //$order_statuses_select_html .= '<option value="' . $status . '">' . $desc . '</option>'; $order_statuses_select_html .= '<option value="' . $status . '" ' . $this->wcj_multi_selected($status, $the_order_statuses) . '>' . $desc . '</option>'; } $order_statuses_select_html .= '</select>'; $data[] = array(__('Order Statuses', 'woocommerce-jetpack'), $order_statuses_select_html, ''); // Button $data[] = array('<input class="button-primary" type="submit" name="renumerate_invoices" value="' . __('Renumerate invoices', 'woocommerce-jetpack') . '">', '', ''); // Print all echo wcj_get_table_html($data, array('table_heading_type' => 'vertical')); ?> </form></p> <?php if ('' != $renumerate_result) { echo '<h3>' . __('Results', 'woocommerce-jetpack') . '</h3>'; echo '<p>' . $renumerate_result . '</p>'; } ?> </div><?php }
/** * get_settings. * * @version 2.5.9 */ function get_settings() { $settings = array(array('title' => __('PDF Invoicing General Options', 'woocommerce-jetpack'), 'type' => 'title', 'id' => 'wcj_pdf_invoicing_options')); // Hooks Array $create_on_array = array(); $create_on_array['disabled'] = __('Disabled', 'woocommerce-jetpack'); $create_on_array['woocommerce_new_order'] = __('Create on New Order', 'woocommerce-jetpack'); $order_statuses = wcj_get_order_statuses(true); foreach ($order_statuses as $status => $desc) { $create_on_array['woocommerce_order_status_' . $status] = __('Create on Order Status', 'woocommerce-jetpack') . ' ' . $desc; } $create_on_array['manual'] = __('Manual Only', 'woocommerce-jetpack'); // Settings $invoice_types = wcj_get_invoice_types(); foreach ($invoice_types as $k => $invoice_type) { $settings[] = array('title' => $invoice_type['title'], 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_create_on', 'default' => 'disabled', 'type' => 'select', 'class' => 'chosen_select', 'options' => $create_on_array, 'desc' => 0 === $k ? '' : apply_filters('booster_get_message', '', 'desc'), 'custom_attributes' => 0 === $k ? '' : apply_filters('booster_get_message', '', 'disabled')); $settings[] = array('id' => 'wcj_invoicing_' . $invoice_type['id'] . '_skip_zero_total', 'default' => 'no', 'type' => 'checkbox', 'desc' => __('Do not create if order total equals zero', 'woocommerce-jetpack'), 'custom_attributes' => 0 === $k ? '' : apply_filters('booster_get_message', '', 'disabled')); } $settings[] = array('title' => __('Hide Disabled Docs Settings', 'woocommerce-jetpack'), 'desc' => __('Hide', 'woocommerce-jetpack'), 'id' => 'wcj_invoicing_hide_disabled_docs_settings', 'default' => 'no', 'type' => 'checkbox'); $settings[] = array('type' => 'sectionend', 'id' => 'wcj_pdf_invoicing_options'); return $this->add_standard_settings($settings); }
} /** * get_settings. * * @version 2.3.0 */ function get_settings() { $settings = array(array('title' => __('PDF Invoicing General Options', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => '', 'id' => 'wcj_pdf_invoicing_options')); // Hooks Array $create_on_array = array(); $create_on_array['disabled'] = __('Disabled', 'woocommerce-jetpack'); $create_on_array['woocommerce_new_order'] = __('Create on New Order', 'woocommerce-jetpack'); $order_statuses = wcj_get_order_statuses(true); foreach ($order_statuses as $status => $desc) { $create_on_array['woocommerce_order_status_' . $status] = __('Create on Order Status', 'woocommerce-jetpack') . ' ' . $desc; } $create_on_array['manual'] = __('Manual Only', 'woocommerce-jetpack'); // Settings $invoice_types = wcj_get_invoice_types(); foreach ($invoice_types as $k => $invoice_type) { $settings[] = array('title' => $invoice_type['title'], 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_create_on', 'default' => 'disabled', 'type' => 'select', 'class' => 'chosen_select', 'options' => $create_on_array, 'desc' => 0 === $k ? '' : apply_filters('get_wc_jetpack_plus_message', '', 'desc'), 'custom_attributes' => 0 === $k ? '' : apply_filters('get_wc_jetpack_plus_message', '', 'disabled')); } $settings[] = array('type' => 'sectionend', 'id' => 'wcj_pdf_invoicing_options'); return $this->add_enable_module_setting($settings);
/** * get_settings. */ function get_settings() { $settings = array(array('title' => __('PDF Invoicing General Options', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => '', 'id' => 'wcj_pdf_invoicing_options'), array('title' => __('PDF Invoicing', 'woocommerce-jetpack'), 'desc' => '<strong>' . __('Enable Module', 'woocommerce-jetpack') . '</strong>', 'desc_tip' => __('WooCommerce Invoices, Proforma Invoices, Credit Notes and Packing Slips.', 'woocommerce-jetpack'), 'id' => 'wcj_pdf_invoicing_enabled', 'default' => 'no', 'type' => 'checkbox')); // Hooks Array $create_on_array = array(); $create_on_array['disabled'] = __('Disabled', 'woocommerce-jetpack'); $create_on_array['woocommerce_new_order'] = __('Create on New Order', 'woocommerce-jetpack'); $order_statuses = wcj_get_order_statuses(true); foreach ($order_statuses as $status => $desc) { $create_on_array['woocommerce_order_status_' . $status] = __('Create on Order Status', 'woocommerce-jetpack') . ' ' . $desc; } // Settings $invoice_types = wcj_get_invoice_types(); foreach ($invoice_types as $k => $invoice_type) { $settings[] = array('title' => $invoice_type['title'], 'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_create_on', 'default' => 'disabled', 'type' => 'select', 'class' => 'chosen_select', 'options' => $create_on_array, 'desc' => 0 === $k ? '' : apply_filters('get_wc_jetpack_plus_message', '', 'desc'), 'custom_attributes' => 0 === $k ? '' : apply_filters('get_wc_jetpack_plus_message', '', 'disabled')); } $settings[] = array('type' => 'sectionend', 'id' => 'wcj_pdf_invoicing_options'); return $settings; }