From 561e44e6af27c09236aa0ae3aa83cb7097b534c8 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Tue, 20 Nov 2018 11:32:37 +0100 Subject: [PATCH] Added Comany Setup Option. 'Open Print Dialog Direct on Reports'. @notrinos. --- admin/company_preferences.php | 13 ++++++++++--- reporting/includes/pdf_report.inc | 3 +++ sql/alter2.4.php | 5 ++++- sql/en_US-demo.sql | 1 + sql/en_US-new.sql | 1 + 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/admin/company_preferences.php b/admin/company_preferences.php index cccf9d9f..f4e7f926 100644 --- a/admin/company_preferences.php +++ b/admin/company_preferences.php @@ -138,9 +138,9 @@ if (isset($_POST['update']) && $_POST['update'] != "") 'use_dimension', 'curr_default', 'f_year', 'shortname_name_in_list', 'no_item_list' => 0, 'no_customer_list' => 0, 'no_supplier_list' =>0, 'base_sales', 'ref_no_auto_increase' => 0, - 'time_zone' => 0, 'company_logo_report' => 0, 'barcodes_on_stock' => 0, 'add_pct', 'round_to', 'login_tout', - 'auto_curr_reval', 'bcc_email', 'alternative_tax_include_on_docs', 'suppress_tax_rates', - 'use_manufacturing', 'use_fixed_assets')) + 'time_zone' => 0, 'company_logo_report' => 0, 'barcodes_on_stock' => 0, 'print_dialog_direct' => 0, + 'add_pct', 'round_to', 'login_tout', 'auto_curr_reval', 'bcc_email', 'alternative_tax_include_on_docs', + 'suppress_tax_rates', 'use_manufacturing', 'use_fixed_assets')) ); $_SESSION['wa_current_user']->timeout = $_POST['login_tout']; @@ -197,6 +197,12 @@ if (!isset($myrow["barcodes_on_stock"])) $myrow["barcodes_on_stock"] = get_company_pref("barcodes_on_stock"); } $_POST['barcodes_on_stock'] = $myrow["barcodes_on_stock"]; +if (!isset($myrow["print_dialog_direct"])) +{ + set_company_pref("print_dialog_direct", "setup.company", "tinyint", 1, '0'); + $myrow["print_dialog_direct"] = get_company_pref("print_dialog_direct"); +} +$_POST['print_dialog_direct'] = $myrow["print_dialog_direct"]; $_POST['version_id'] = $myrow["version_id"]; $_POST['add_pct'] = $myrow['add_pct']; $_POST['login_tout'] = $myrow['login_tout']; @@ -268,6 +274,7 @@ number_list_row(_("Use Dimensions:"), 'use_dimension', null, 0, 2); table_section_title(_("User Interface Options")); check_row(_("Short Name and Name in List"), 'shortname_name_in_list', $_POST['shortname_name_in_list']); +check_row(_("Open Print Dialog Direct on Reports"), 'print_dialog_direct', null); check_row(_("Search Item List"), 'no_item_list', null); check_row(_("Search Customer List"), 'no_customer_list', null); check_row(_("Search Supplier List"), 'no_supplier_list', null); diff --git a/reporting/includes/pdf_report.inc b/reporting/includes/pdf_report.inc index b41bb69e..5b468764 100644 --- a/reporting/includes/pdf_report.inc +++ b/reporting/includes/pdf_report.inc @@ -952,6 +952,9 @@ class FrontReport extends Cpdf { global $SysPrefs, $path_to_root; + if (!empty($SysPrefs->prefs['print_dialog_direct'])) + $this->includeJS("print();"); // force to open print dialog + if ($SysPrefs->pdf_debug == 1) { $pdfcode = $this->Output('','S'); diff --git a/sql/alter2.4.php b/sql/alter2.4.php index e6e8b619..bd364e2e 100644 --- a/sql/alter2.4.php +++ b/sql/alter2.4.php @@ -74,6 +74,9 @@ class fa2_4 extends fa_patch { if (get_company_pref('company_logo_report') === null) { // available from 2.4.2, during updates set_company_pref('company_logo_report', 'setup.company', 'tinyint', 1, '0'); } + if (get_company_pref('print_dialog_direct') === null) { // available from 2.4.5, during updates + set_company_pref('print_dialog_direct', 'setup.company', 'tinyint', 1, '0'); + } if (get_company_pref('barcodes_on_stock') === null) { // available from 2.4.3, during updates set_company_pref('barcodes_on_stock', 'setup.company', 'tinyint', 1, '0'); } @@ -121,7 +124,7 @@ class fa2_4 extends fa_patch { 'default_quote_valid_days', 'no_zero_lines_amount', 'show_po_item_codes', 'accounts_alpha', 'loc_notification', 'print_invoice_no', 'allow_negative_prices', 'print_item_images_on_quote', 'bcc_email', 'alternative_tax_include_on_docs', 'suppress_tax_rates', 'company_logo_report', - 'barcodes_on_stock', 'ref_no_auto_increase')"); + 'barcodes_on_stock', print_dialog_direct', 'ref_no_auto_increase')"); } function update_workorders() diff --git a/sql/en_US-demo.sql b/sql/en_US-demo.sql index ff2055f5..aee36a1d 100644 --- a/sql/en_US-demo.sql +++ b/sql/en_US-demo.sql @@ -2176,6 +2176,7 @@ INSERT INTO `0_sys_prefs` VALUES ('print_item_images_on_quote','glsetup.inventor INSERT INTO `0_sys_prefs` VALUES ('suppress_tax_rates','setup.company', 'tinyint', 1, '0'); INSERT INTO `0_sys_prefs` VALUES ('company_logo_report','setup.company', 'tinyint', 1, '0'); INSERT INTO `0_sys_prefs` VALUES ('barcodes_on_stock','setup.company', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES ('print_dialog_direct','setup.company', 'tinyint', 1, '0'); INSERT INTO `0_sys_prefs` VALUES ('ref_no_auto_increase','setup.company', 'tinyint', 1, '0'); INSERT INTO `0_sys_prefs` VALUES ('default_loss_on_asset_disposal_act', 'glsetup.items', 'varchar', '15', '5660'); INSERT INTO `0_sys_prefs` VALUES ('depreciation_period', 'glsetup.company', 'tinyint', '1', '1'); diff --git a/sql/en_US-new.sql b/sql/en_US-new.sql index b025189a..b834a3eb 100644 --- a/sql/en_US-new.sql +++ b/sql/en_US-new.sql @@ -1897,6 +1897,7 @@ INSERT INTO `0_sys_prefs` VALUES ('print_item_images_on_quote','glsetup.inventor INSERT INTO `0_sys_prefs` VALUES ('suppress_tax_rates','setup.company', 'tinyint', 1, '0'); INSERT INTO `0_sys_prefs` VALUES ('company_logo_report','setup.company', 'tinyint', 1, '0'); INSERT INTO `0_sys_prefs` VALUES ('barcodes_on_stock','setup.company', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES ('print_dialog_direct','setup.company', 'tinyint', 1, '0'); INSERT INTO `0_sys_prefs` VALUES ('ref_no_auto_increase','setup.company', 'tinyint', 1, '0'); INSERT INTO `0_sys_prefs` VALUES ('default_loss_on_asset_disposal_act', 'glsetup.items', 'varchar', '15', '5660'); INSERT INTO `0_sys_prefs` VALUES ('depreciation_period', 'glsetup.company', 'tinyint', '1', '1'); -- 2.30.2