Added Comany Setup Option. 'Open Print Dialog Direct on Reports'. @notrinos.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 20 Nov 2018 10:32:37 +0000 (11:32 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 20 Nov 2018 10:32:37 +0000 (11:32 +0100)
admin/company_preferences.php
reporting/includes/pdf_report.inc
sql/alter2.4.php
sql/en_US-demo.sql
sql/en_US-new.sql

index cccf9d9f27680d9f1373b602a00721acfe9c38c4..f4e7f9264b7b5a8ed1f500ba5f24807a5f123ea0 100644 (file)
@@ -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);
index b41bb69e867d8b4c2831dbe509868f6ef95da468..5b468764fd2ed194af318adf0836b85840307230 100644 (file)
@@ -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');
index e6e8b619d8024b8c26b8949d356d149d5abbfdd8..bd364e2e20c604c6ffa4738d971fe60ebf8ec13c 100644 (file)
@@ -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()
index ff2055f5419a8d5be60f10ac2924f477b8e86d52..aee36a1dc11decbafb0bc7c0995c36be2d70e8bb 100644 (file)
@@ -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');
index b025189a685689c9c5afea160d2aceb9f686c7fb..b834a3ebf0cddf4e0a97718024127b31d784d3c9 100644 (file)
@@ -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');