From 0c1ab57c09d87eed2bd248892dbfe3f256767a82 Mon Sep 17 00:00:00 2001 From: Joe Date: Sun, 28 Dec 2014 16:17:10 +0100 Subject: [PATCH] Removed many global variables from config.default.php to GL Setup, Company Setup and Display Setup. --- admin/company_preferences.php | 19 ++++-- admin/display_prefs.php | 25 ++++++-- admin/fiscalyears.php | 2 +- admin/gl_setup.php | 64 ++++++++++++++++++- admin/void_transaction.php | 2 +- config.default.php | 40 ------------ dimensions/dimension_entry.php | 2 +- dimensions/inquiry/search_dimensions.php | 2 +- dimensions/view/view_dimension.php | 2 +- gl/accruals.php | 2 +- gl/bank_account_reconcile.php | 2 +- gl/bank_transfer.php | 2 +- gl/gl_bank.php | 2 +- gl/gl_journal.php | 2 +- gl/inquiry/balance_sheet.php | 2 +- gl/inquiry/bank_inquiry.php | 2 +- gl/inquiry/gl_account_inquiry.php | 2 +- gl/inquiry/gl_trial_balance.php | 2 +- gl/inquiry/journal_inquiry.php | 2 +- gl/inquiry/profit_loss.php | 2 +- gl/inquiry/tax_inquiry.php | 2 +- gl/manage/close_period.php | 2 +- gl/manage/exchange_rates.php | 2 +- gl/manage/gl_accounts.php | 4 +- gl/manage/revaluate_currencies.php | 2 +- includes/current_user.inc | 19 ++++++ includes/prefs/sysprefs.inc | 46 ++++++++++++- includes/prefs/userprefs.inc | 40 +++++++++++- includes/ui/db_pager_view.inc | 2 +- includes/ui/ui_input.inc | 4 +- includes/ui/ui_lists.inc | 12 ++++ includes/ui/ui_view.inc | 6 +- inventory/adjustments.php | 2 +- inventory/includes/db/items_adjust_db.inc | 8 +-- inventory/includes/db/items_transfer_db.inc | 8 +-- inventory/inquiry/stock_movements.php | 2 +- inventory/manage/items.php | 2 +- inventory/transfers.php | 2 +- manufacturing/work_order_add_finished.php | 2 +- manufacturing/work_order_costs.php | 2 +- manufacturing/work_order_entry.php | 4 +- manufacturing/work_order_issue.php | 2 +- manufacturing/work_order_release.php | 2 +- purchasing/inquiry/po_search.php | 2 +- purchasing/inquiry/po_search_completed.php | 2 +- .../inquiry/supplier_allocation_inquiry.php | 2 +- purchasing/inquiry/supplier_inquiry.php | 2 +- purchasing/manage/suppliers.php | 2 +- purchasing/po_entry_items.php | 2 +- purchasing/po_receive_items.php | 2 +- purchasing/supplier_credit.php | 2 +- purchasing/supplier_invoice.php | 2 +- purchasing/supplier_payment.php | 2 +- reporting/includes/doctext.inc | 12 ++-- reporting/includes/pdf_report.inc | 2 +- reporting/includes/reporting.inc | 43 ++++++++++++- reporting/includes/reports_classes.inc | 22 +++---- reporting/prn_redirect.php | 6 +- reporting/rep107.php | 12 ++-- reporting/rep109.php | 6 +- reporting/rep110.php | 8 +-- reporting/rep111.php | 12 ++-- reporting/rep113.php | 6 +- reporting/rep209.php | 8 +-- reporting/reports_main.php | 2 +- sales/create_recurrent_invoices.php | 4 +- sales/credit_note_entry.php | 2 +- sales/customer_credit_invoice.php | 2 +- sales/customer_delivery.php | 2 +- sales/customer_invoice.php | 2 +- sales/customer_payments.php | 2 +- sales/includes/db/sales_order_db.inc | 16 ++--- sales/inquiry/customer_allocation_inquiry.php | 2 +- sales/inquiry/customer_inquiry.php | 2 +- sales/inquiry/sales_deliveries_view.php | 2 +- sales/inquiry/sales_orders_view.php | 2 +- sales/manage/customers.php | 2 +- sales/manage/recurrent_invoices.php | 2 +- sales/sales_order_entry.php | 6 +- sql/alter2.4.php | 46 ++++++++++++- sql/alter2.4.sql | 5 ++ sql/en_US-demo.sql | 21 +++++- sql/en_US-new.sql | 18 +++++- taxes/db/tax_groups_db.inc | 5 +- 84 files changed, 468 insertions(+), 191 deletions(-) diff --git a/admin/company_preferences.php b/admin/company_preferences.php index c747669b..cb8d1014 100644 --- a/admin/company_preferences.php +++ b/admin/company_preferences.php @@ -23,9 +23,7 @@ include_once($path_to_root . "/admin/db/company_db.inc"); if (isset($_POST['update']) && $_POST['update'] != "") { - $input_error = 0; - if (!check_num('login_tout', 10)) { display_error(_("Login timeout must be positive number not less than 10.")); @@ -109,7 +107,7 @@ if (isset($_POST['update']) && $_POST['update'] != "") 'no_item_list' => 0, 'no_customer_list' => 0, 'no_supplier_list' =>0, 'base_sales', 'time_zone' => 0, 'add_pct', 'round_to', 'login_tout', 'auto_curr_reval', - 'bcc_email')) + 'bcc_email', 'alternative_tax_include_on_docs', 'suppress_tax_rates')) ); $_SESSION['wa_current_user']->timeout = $_POST['login_tout']; @@ -124,8 +122,17 @@ if (get_company_pref('bcc_email') === null) { // available from 2.3.14, can be n set_company_pref('bcc_email', 'setup.company', 'varchar', 100, ''); refresh_sys_prefs(); } +if (get_company_pref('alternative_tax_include_on_docs') === null) { // available from 2.3.14, can be not defined on pre-2.4 installations + set_company_pref('alternative_tax_include_on_docs', 'setup.company', 'tinyint', 1, '0'); + refresh_sys_prefs(); +} +if (get_company_pref('suppress_tax_rates') === null) { // available from 2.3.14, can be not defined on pre-2.4 installations + set_company_pref('suppress_tax_rates', 'setup.company', 'tinyint', 1, '0'); + refresh_sys_prefs(); +} start_form(true); + $myrow = get_company_prefs(); $_POST['coy_name'] = $myrow["coy_name"]; @@ -156,6 +163,8 @@ $_POST['round_to'] = $myrow['round_to']; $_POST['auto_curr_reval'] = $myrow['auto_curr_reval']; $_POST['del_coy_logo'] = 0; $_POST['bcc_email'] = $myrow["bcc_email"]; +$_POST['alternative_tax_include_on_docs'] = $myrow["alternative_tax_include_on_docs"]; +$_POST['suppress_tax_rates'] = $myrow["suppress_tax_rates"]; start_outer_table(TABLESTYLE2); @@ -174,10 +183,11 @@ email_row_ex(_("BCC Address for all outgoing mails:"), 'bcc_email', 50, 55); text_row_ex(_("Official Company Number:"), 'coy_no', 25); text_row_ex(_("GSTNo:"), 'gst_no', 25); -currencies_list_row(_("Home Currency:"), 'curr_default', $_POST['curr_default']); fiscalyears_list_row(_("Fiscal Year:"), 'f_year', $_POST['f_year']); text_row_ex(_("Tax Periods:"), 'tax_prd', 10, 10, '', null, null, _('Months.')); text_row_ex(_("Tax Last Period:"), 'tax_last', 10, 10, '', null, null, _('Months back.')); +check_row(_("Put alternative Tax Include on Docs"), 'alternative_tax_include_on_docs', null); +check_row(_("Suppress Tax Rates on Docs"), 'suppress_tax_rates', null); table_section(2); @@ -197,6 +207,7 @@ 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); label_row("", " "); +currencies_list_row(_("Home Currency:"), 'curr_default', $_POST['curr_default']); check_row(_("Automatic Revaluation Currency Accounts"), 'auto_curr_reval', $_POST['auto_curr_reval']); check_row(_("Time Zone on Reports"), 'time_zone', $_POST['time_zone']); text_row_ex(_("Login Timeout:"), 'login_tout', 10, 10, '', null, null, _('seconds')); diff --git a/admin/display_prefs.php b/admin/display_prefs.php index e4a69f75..85406a8c 100644 --- a/admin/display_prefs.php +++ b/admin/display_prefs.php @@ -42,7 +42,8 @@ if (isset($_POST['setprefs'])) 'theme', 'page_size', 'language', 'startup_tab', 'show_gl' => 0, 'show_codes'=> 0, 'show_hints' => 0, 'rep_popup' => 0, 'graphic_links' => 0, 'sticky_doc_date' => 0, - 'query_size' => 10.0, 'transaction_days' => 30))); + 'query_size' => 10.0, 'transaction_days' => 30, 'save_report_selections' => 0, + 'use_date_picker' => 0, 'def_print_destination' => 0, 'def_print_orientation' => 0))); if ($chg_lang) $_SESSION['language']->set_language($_POST['language']); @@ -93,14 +94,24 @@ decseps_list_row(_("Decimal Separator:"), "dec_sep", user_dec_sep()); /* The array $decseps is set up in config.php for modifications possible separators can be added by modifying the array definition by editing that file */ + +check_row(_("Use Date Picker"), 'use_date_picker', user_use_date_picker()); + if (!isset($_POST['language'])) $_POST['language'] = $_SESSION['language']->code; -table_section_title(_("Language")); +table_section_title(_("Reports")); -languages_list_row(_("Language:"), 'language', $_POST['language']); +text_row_ex(_("Save Report Selection Days:"), 'save_report_selections', 5, 5, '', user_save_report_selections()); + +yesno_list_row(_("Default Report Destination:"), 'def_print_destination', user_def_print_destination(), + $name_yes=_("Excel"), $name_no=_("PDF/Printer")); + +yesno_list_row(_("Default Report Orientation:"), 'def_print_orientation', user_def_print_orientation(), + $name_yes=_("Landscape"), $name_no=_("Portrait")); table_section(2); + table_section_title(_("Miscellaneous")); check_row(_("Show hints for new users:"), 'show_hints', user_hints()); @@ -133,13 +144,17 @@ check_row(_("Use popup window to display reports:"), 'rep_popup', user_rep_popup check_row(_("Use icons instead of text links:"), 'graphic_links', user_graphic_links(), false, _('Set this option to on for using icons instead of text links')); -text_row_ex(_("Query page size:"), 'query_size', 5, 5, '', user_query_size()); - check_row(_("Remember last document date:"), 'sticky_doc_date', sticky_doc_date(), false, _('If set document date is remembered on subsequent documents, otherwise default is current date')); +text_row_ex(_("Query page size:"), 'query_size', 5, 5, '', user_query_size()); + text_row_ex(_("Transaction days:"), 'transaction_days', 5, 5, '', user_transaction_days()); +table_section_title(_("Language")); + +languages_list_row(_("Language:"), 'language', $_POST['language']); + end_outer_table(1); submit_center('setprefs', _("Update"), true, '', 'default'); diff --git a/admin/fiscalyears.php b/admin/fiscalyears.php index 5db546b1..6cd4ae37 100644 --- a/admin/fiscalyears.php +++ b/admin/fiscalyears.php @@ -20,7 +20,7 @@ include_once($path_to_root . "/includes/ui.inc"); include_once($path_to_root . "/sales/includes/db/cust_trans_db.inc"); include_once($path_to_root . "/admin/db/maintenance_db.inc"); $js = ""; -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Fiscal Years"), false, false, "", $js); diff --git a/admin/gl_setup.php b/admin/gl_setup.php index a160f448..9367d65d 100644 --- a/admin/gl_setup.php +++ b/admin/gl_setup.php @@ -47,7 +47,10 @@ function can_process() } $grn_act = get_company_pref('grn_clearing_act'); - if ((get_post('grn_clearing_act') != $grn_act) && db_num_rows(get_grn_items(0, '', true))) + $post_grn_act = get_post('grn_clearing_act'); + if ($post_grn_act == null) + $post_grn_act = 0; + if (($post_grn_act != $grn_act) && db_num_rows(get_grn_items(0, '', true))) { display_error(_("Before GRN Clearing Account can be changed all GRNs have to be invoiced")); $_POST['grn_clearing_act'] = $grn_act; @@ -73,6 +76,8 @@ if (isset($_POST['submit']) && can_process()) 'default_adj_act', 'default_inv_sales_act', 'default_assembly_act', 'legal_text', 'past_due_days', 'default_workorder_required', 'default_dim_required', 'default_receival_required', 'default_delivery_required', 'default_quote_valid_days', 'grn_clearing_act', 'tax_algorithm', + 'no_zero_lines_amount', 'show_po_item_codes', 'accounts_alpha', 'loc_notification', 'print_invoice_no', + 'allow_negative_prices', 'print_item_images_on_quote', 'allow_negative_stock'=> 0, 'accumulate_shipping'=> 0, 'po_over_receive' => 0.0, 'po_over_charge' => 0.0, 'default_credit_limit'=>0.0 ))); @@ -103,6 +108,41 @@ if (get_company_pref('default_quote_valid_days') === null) { // available from 2 refresh_sys_prefs(); } +if (get_company_pref('no_zero_lines_amount') === null) { // new in 2.4 installations + set_company_pref('no_zero_lines_amount', 'glsetup.sales', 'tinyint', 1, '1'); + refresh_sys_prefs(); +} + +if (get_company_pref('show_po_item_codes') === null) { // new in 2.4 installations + set_company_pref('show_po_item_codes', 'glsetup.purchase', 'tinyint', 1, '0'); + refresh_sys_prefs(); +} + +if (get_company_pref('accounts_alpha') === null) { // new in 2.4 installations + set_company_pref('accounts_alpha', 'glsetup.general', 'tinyint', 1, '0'); + refresh_sys_prefs(); +} + +if (get_company_pref('loc_notification') === null) { // new in 2.4 installations + set_company_pref('loc_notification', 'glsetup.inventory', 'tinyint', 1, '0'); + refresh_sys_prefs(); +} + +if (get_company_pref('print_invoice_no') === null) { // new in 2.4 installations + set_company_pref('print_invoice_no', 'glsetup.sales', 'tinyint', 1, '0'); + refresh_sys_prefs(); +} + +if (get_company_pref('allow_negative_prices') === null) { // new in 2.4 installations + set_company_pref('allow_negative_prices', 'glsetup.inventory', 'tinyint', 1, '1'); + refresh_sys_prefs(); +} + +if (get_company_pref('print_item_images_on_quote') === null) { // new in 2.4 installations + set_company_pref('print_item_images_on_quote', 'glsetup.inventory', 'tinyint', 1, '0'); + refresh_sys_prefs(); +} + $myrow = get_company_prefs(); $_POST['retained_earnings_act'] = $myrow["retained_earnings_act"]; @@ -143,6 +183,13 @@ $_POST['default_dim_required'] = $myrow['default_dim_required']; $_POST['default_delivery_required'] = $myrow['default_delivery_required']; $_POST['default_receival_required'] = $myrow['default_receival_required']; $_POST['default_quote_valid_days'] = $myrow['default_quote_valid_days']; +$_POST['no_zero_lines_amount'] = $myrow['no_zero_lines_amount']; +$_POST['show_po_item_codes'] = $myrow['show_po_item_codes']; +$_POST['accounts_alpha'] = $myrow['accounts_alpha']; +$_POST['loc_notification'] = $myrow['loc_notification']; +$_POST['print_invoice_no'] = $myrow['print_invoice_no']; +$_POST['allow_negative_prices'] = $myrow['allow_negative_prices']; +$_POST['print_item_images_on_quote'] = $myrow['print_item_images_on_quote']; //--------------- @@ -151,6 +198,8 @@ table_section_title(_("General GL")); text_row(_("Past Due Days Interval:"), 'past_due_days', $_POST['past_due_days'], 6, 6, '', "", _("days")); +accounts_type_list_row(_("Accounts Type:"), 'accounts_alpha', $_POST['accounts_alpha']); + gl_all_accounts_list_row(_("Retained Earnings:"), 'retained_earnings_act', $_POST['retained_earnings_act']); gl_all_accounts_list_row(_("Profit/Loss Year:"), 'profit_loss_year_act', $_POST['profit_loss_year_act']); @@ -167,8 +216,12 @@ table_section_title(_("Customers and Sales")); text_row(_("Default Credit Limit:"), 'default_credit_limit', $_POST['default_credit_limit'], 12, 12); +yesno_list_row(_("Invoice Identification:"), 'print_invoice_no', $_POST['print_invoice_no'], $name_yes=_("Number"), $name_no=_("Reference")); + check_row(_("Accumulate batch shipping:"), 'accumulate_shipping', null); +check_row(_("Print Item Image on Quote:"), 'print_item_images_on_quote', null); + textarea_row(_("Legal Text on Invoice:"), 'legal_text', $_POST['legal_text'], 32, 4); gl_all_accounts_list_row(_("Shipping Charged Account:"), 'freight_act', $_POST['freight_act']); @@ -219,11 +272,19 @@ gl_all_accounts_list_row(_("GRN Clearing Account:"), 'grn_clearing_act', get_pos text_row(_("Receival Required By:"), 'default_receival_required', $_POST['default_receival_required'], 6, 6, '', "", _("days")); +check_row(_("Show PO item codes:"), 'show_po_item_codes', null); + table_section_title(_("Inventory")); check_row(_("Allow Negative Inventory:"), 'allow_negative_stock', null); label_row(null, _("Warning: This may cause a delay in GL postings"), "", "class='stockmankofg' colspan=2"); +check_row(_("No zero-amounts (Service):"), 'no_zero_lines_amount', null); + +check_row(_("Location Notifications:"), 'loc_notification', null); + +check_row(_("Allow Negative Prices:"), 'allow_negative_prices', null); + table_section_title(_("Items Defaults")); gl_all_accounts_list_row(_("Sales Account:"), 'default_inv_sales_act', $_POST['default_inv_sales_act']); @@ -241,7 +302,6 @@ table_section_title(_("Manufacturing Defaults")); text_row(_("Work Order Required By After:"), 'default_workorder_required', $_POST['default_workorder_required'], 6, 6, '', "", _("days")); - //---------------- end_outer_table(1); diff --git a/admin/void_transaction.php b/admin/void_transaction.php index 474217a0..7e3019ab 100644 --- a/admin/void_transaction.php +++ b/admin/void_transaction.php @@ -21,7 +21,7 @@ include_once($path_to_root . "/admin/db/transactions_db.inc"); include_once($path_to_root . "/admin/db/voiding_db.inc"); $js = ""; -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); if ($use_popup_windows) $js .= get_js_open_window(800, 500); diff --git a/config.default.php b/config.default.php index 2588a81e..1275e2fb 100644 --- a/config.default.php +++ b/config.default.php @@ -71,24 +71,15 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_ /* No check on edit conflicts. Maybe needed to be set to 1 in certains Windows Servers */ $no_check_edit_conflicts = 0; - /* Do not print zero lines amount of 0.00 in Sales Documents if service item. 1 = do not */ - $no_zero_lines_amount = 1; - /* Use icon for editkey (=true) right of combobox. 1 = use, 0 = do not use */ $use_icon_for_editkey = 0; /* Creates automatic a default branch with contact. Value 0 do not create auto branch */ $auto_create_branch = 1; - /* Save Report selections (a value > 0 means days to save. 0 = no save) */ - $save_report_selections = 0; - /* use popup windows for views */ $use_popup_windows = 1; - /* use date picker for all date fields */ - $use_date_picker = 1; - /* use Audit Trails in GL */ /* This variable is deprecated. Setting this to 1, will stamp the user name in the memo fields in GL */ /* This has been superseded with built in Audit Trail */ @@ -103,15 +94,6 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_ /* show users online discretely in the footer */ $show_users_online = 0; - /* show item codes on purchase order */ - $show_po_item_codes = 0; - - /* default print destination. 0 = PDF/Printer, 1 = Excel */ - $def_print_destination = 0; - - /* default print orientation. 0 = Portrait, 1 = Landscape */ - $def_print_orientation = 0; - // Wiki context help configuration // If your help wiki use translated page titles uncomment next line // $old_style_help = 1; // this setting is depreciated and subject to removal in next FA versions @@ -126,26 +108,10 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_ /* per user data/cache directory */ $comp_path = $path_to_root.'/company'; - /* allow alpha characters in accounts. 0 = numeric, 1 = alpha numeric, 2 = uppercase alpha numeric */ - $accounts_alpha = 0; - /* Date systems. 0 = traditional, 1 = Jalali used by Iran, nabour countries, Afghanistan and some other Central Asian nations, 2 = Islamic used by other arabic nations. 3 = traditional, but where non-workday is Friday and start of week is Saturday */ $date_system = 0; - /* email stock location if order below reorder-level */ - /* Remember to set an email on the Location(s). */ - $loc_notification = 0; - - /* print_invoice_no. 0 = print reference number, 1 = print invoice number */ - $print_invoice_no = 0; - - /* 1 = print Subtotal tax excluded, tax and Total tax included */ - $alternative_tax_include_on_docs = 0; - - /* suppress tax rates on documents. 0 = no, 1 = yes. */ - $suppress_tax_rates = 0; - /* allow reopening closed transactions */ $allow_gl_reopen = 0; @@ -179,9 +145,6 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_ /* Show average costed values instead of fixed standard cost in report, Inventory Valuation Report */ $use_costed_values = 0; - /* Allow negative prices for dummy/service items. To be moved to GL db settings */ - $allow_negative_prices = 1; - /* Show menu category icons in core themes */ $show_menu_category_icons = 1; @@ -195,9 +158,6 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_ /* Whether to allow sending new password by e-mail */ $allow_password_reset = false; - /* Print Item Images on Sales Quotations. Set to 1 if so. */ - $print_item_images_on_quote = 0; - /* for uploaded item pictures */ $pic_width = 80; $pic_height = 50; diff --git a/dimensions/dimension_entry.php b/dimensions/dimension_entry.php index 8ee8fb8a..aebbc648 100644 --- a/dimensions/dimension_entry.php +++ b/dimensions/dimension_entry.php @@ -22,7 +22,7 @@ include_once($path_to_root . "/dimensions/includes/dimensions_db.inc"); include_once($path_to_root . "/dimensions/includes/dimensions_ui.inc"); $js = ""; -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Dimension Entry"), false, false, "", $js); diff --git a/dimensions/inquiry/search_dimensions.php b/dimensions/inquiry/search_dimensions.php index ccf72ada..8a333046 100644 --- a/dimensions/inquiry/search_dimensions.php +++ b/dimensions/inquiry/search_dimensions.php @@ -20,7 +20,7 @@ include_once($path_to_root . "/includes/ui.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(800, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); if (isset($_GET['outstanding_only']) && $_GET['outstanding_only']) diff --git a/dimensions/view/view_dimension.php b/dimensions/view/view_dimension.php index b13420d9..efef3763 100644 --- a/dimensions/view/view_dimension.php +++ b/dimensions/view/view_dimension.php @@ -15,7 +15,7 @@ $path_to_root = "../.."; include_once($path_to_root . "/includes/session.inc"); $js = ""; -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "View Dimension"), true, false, "", $js); diff --git a/gl/accruals.php b/gl/accruals.php index 4bfc923b..8a05f80c 100644 --- a/gl/accruals.php +++ b/gl/accruals.php @@ -11,7 +11,7 @@ include_once($path_to_root . "/includes/session.inc"); include_once($path_to_root . "/gl/includes/db/gl_db_trans.inc"); $js = get_js_open_window(800, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); // Begin the UI diff --git a/gl/bank_account_reconcile.php b/gl/bank_account_reconcile.php index eda80cd1..5769af7d 100644 --- a/gl/bank_account_reconcile.php +++ b/gl/bank_account_reconcile.php @@ -25,7 +25,7 @@ include_once($path_to_root . "/includes/banking.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(800, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); add_js_file('reconcile.js'); diff --git a/gl/bank_transfer.php b/gl/bank_transfer.php index e56726f5..1bffb9cb 100644 --- a/gl/bank_transfer.php +++ b/gl/bank_transfer.php @@ -23,7 +23,7 @@ include_once($path_to_root . "/gl/includes/gl_ui.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(800, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Transfer between Bank Accounts"), false, false, "", $js); diff --git a/gl/gl_bank.php b/gl/gl_bank.php index 14a8518d..b73f1c0e 100644 --- a/gl/gl_bank.php +++ b/gl/gl_bank.php @@ -27,7 +27,7 @@ include_once($path_to_root . "/admin/db/attachments_db.inc"); $js = ''; if ($use_popup_windows) $js .= get_js_open_window(800, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); if (isset($_GET['NewPayment'])) { diff --git a/gl/gl_journal.php b/gl/gl_journal.php index 063dd8ae..b68d247f 100644 --- a/gl/gl_journal.php +++ b/gl/gl_journal.php @@ -26,7 +26,7 @@ include_once($path_to_root . "/taxes/db/tax_types_db.inc"); $js = ''; if ($use_popup_windows) $js .= get_js_open_window(800, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); if (isset($_GET['ModifyGL'])) { diff --git a/gl/inquiry/balance_sheet.php b/gl/inquiry/balance_sheet.php index 01dc3c1e..2d764d32 100644 --- a/gl/inquiry/balance_sheet.php +++ b/gl/inquiry/balance_sheet.php @@ -21,7 +21,7 @@ include_once($path_to_root . "/includes/data_checks.inc"); include_once($path_to_root . "/gl/includes/gl_db.inc"); $js = ""; -if ($use_date_picker) +if (user_use_date_picker()) $js = get_js_date_picker(); page(_($help_context = "Balance Sheet Drilldown"), false, false, "", $js); diff --git a/gl/inquiry/bank_inquiry.php b/gl/inquiry/bank_inquiry.php index c667c887..4c25ddd2 100644 --- a/gl/inquiry/bank_inquiry.php +++ b/gl/inquiry/bank_inquiry.php @@ -23,7 +23,7 @@ include_once($path_to_root . "/includes/banking.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(800, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Bank Statement"), isset($_GET['bank_account']), false, "", $js); diff --git a/gl/inquiry/gl_account_inquiry.php b/gl/inquiry/gl_account_inquiry.php index bf10abf0..9ba25a53 100644 --- a/gl/inquiry/gl_account_inquiry.php +++ b/gl/inquiry/gl_account_inquiry.php @@ -25,7 +25,7 @@ $js = ''; set_focus('account'); if ($use_popup_windows) $js .= get_js_open_window(800, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "General Ledger Inquiry"), false, false, '', $js); diff --git a/gl/inquiry/gl_trial_balance.php b/gl/inquiry/gl_trial_balance.php index bfb6a547..27c38dac 100644 --- a/gl/inquiry/gl_trial_balance.php +++ b/gl/inquiry/gl_trial_balance.php @@ -22,7 +22,7 @@ include_once($path_to_root . "/includes/data_checks.inc"); include_once($path_to_root . "/gl/includes/gl_db.inc"); $js = ""; -if ($use_date_picker) +if (user_use_date_picker()) $js = get_js_date_picker(); page(_($help_context = "Trial Balance"), false, false, "", $js); diff --git a/gl/inquiry/journal_inquiry.php b/gl/inquiry/journal_inquiry.php index 2d9eaabc..5d6064e8 100644 --- a/gl/inquiry/journal_inquiry.php +++ b/gl/inquiry/journal_inquiry.php @@ -21,7 +21,7 @@ include_once($path_to_root . "/includes/ui.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(800, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Journal Inquiry"), false, false, "", $js); diff --git a/gl/inquiry/profit_loss.php b/gl/inquiry/profit_loss.php index 8d9144d6..4022e968 100644 --- a/gl/inquiry/profit_loss.php +++ b/gl/inquiry/profit_loss.php @@ -21,7 +21,7 @@ include_once($path_to_root . "/includes/data_checks.inc"); include_once($path_to_root . "/gl/includes/gl_db.inc"); $js = ""; -if ($use_date_picker) +if (user_use_date_picker()) $js = get_js_date_picker(); page(_($help_context = "Profit & Loss Drilldown"), false, false, "", $js); diff --git a/gl/inquiry/tax_inquiry.php b/gl/inquiry/tax_inquiry.php index e1e7c853..91b111d9 100644 --- a/gl/inquiry/tax_inquiry.php +++ b/gl/inquiry/tax_inquiry.php @@ -24,7 +24,7 @@ $js = ''; set_focus('account'); if ($use_popup_windows) $js .= get_js_open_window(800, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Tax Inquiry"), false, false, '', $js); diff --git a/gl/manage/close_period.php b/gl/manage/close_period.php index fc057c25..563e40b6 100644 --- a/gl/manage/close_period.php +++ b/gl/manage/close_period.php @@ -20,7 +20,7 @@ include_once($path_to_root . "/includes/banking.inc"); include_once($path_to_root . "/admin/db/fiscalyears_db.inc"); $js = ""; -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Closing GL Transactions"), false, false, "", $js); diff --git a/gl/manage/exchange_rates.php b/gl/manage/exchange_rates.php index 49e924f6..4ce1673c 100644 --- a/gl/manage/exchange_rates.php +++ b/gl/manage/exchange_rates.php @@ -19,7 +19,7 @@ include_once($path_to_root . "/includes/ui.inc"); include_once($path_to_root . "/includes/banking.inc"); $js = ""; -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Exchange Rates"), false, false, "", $js); diff --git a/gl/manage/gl_accounts.php b/gl/manage/gl_accounts.php index 99d2a8ab..a6b58f42 100644 --- a/gl/manage/gl_accounts.php +++ b/gl/manage/gl_accounts.php @@ -59,7 +59,7 @@ if (isset($_POST['add']) || isset($_POST['update'])) display_error( _("The account name cannot be empty.")); set_focus('account_name'); } - elseif (!$accounts_alpha && !is_numeric($_POST['account_code'])) + elseif (!$SysPrefs->accounts_alpha() && !is_numeric($_POST['account_code'])) { $input_error = 1; display_error( _("The account code must be numeric.")); @@ -67,7 +67,7 @@ if (isset($_POST['add']) || isset($_POST['update'])) } if ($input_error != 1) { - if ($accounts_alpha == 2) + if ($SysPrefs->accounts_alpha() == 2) $_POST['account_code'] = strtoupper($_POST['account_code']); if (!isset($_POST['account_tags'])) diff --git a/gl/manage/revaluate_currencies.php b/gl/manage/revaluate_currencies.php index 050637d5..749c0f4d 100644 --- a/gl/manage/revaluate_currencies.php +++ b/gl/manage/revaluate_currencies.php @@ -18,7 +18,7 @@ include_once($path_to_root . "/includes/ui.inc"); include_once($path_to_root . "/includes/banking.inc"); $js = ""; -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Revaluation of Currency Accounts"), false, false, "", $js); diff --git a/includes/current_user.inc b/includes/current_user.inc index 5dd2c197..26b288a1 100644 --- a/includes/current_user.inc +++ b/includes/current_user.inc @@ -547,6 +547,25 @@ function user_transaction_days() return $_SESSION["wa_current_user"]->prefs->transaction_days(); } +function user_save_report_selections() +{ + return $_SESSION["wa_current_user"]->prefs->save_report_selections(); +} + +function user_use_date_picker() +{ + return $_SESSION["wa_current_user"]->prefs->use_date_picker(); +} + +function user_def_print_destination() +{ + return $_SESSION["wa_current_user"]->prefs->def_print_destination(); +} + +function user_def_print_orientation() +{ + return $_SESSION["wa_current_user"]->prefs->def_print_orientation(); +} function user_check_access($sec_area) { diff --git a/includes/prefs/sysprefs.inc b/includes/prefs/sysprefs.inc index 426d3a78..f5063382 100644 --- a/includes/prefs/sysprefs.inc +++ b/includes/prefs/sysprefs.inc @@ -86,7 +86,51 @@ class sys_prefs global $config_allocation_settled_allowance; return $config_allocation_settled_allowance; } - + + function no_zero_lines_amount() + { + return $this->prefs['no_zero_lines_amount']; + } + + function show_po_item_codes() + { + return $this->prefs['show_po_item_codes']; + } + + function accounts_alpha() + { + return $this->prefs['accounts_alpha']; + } + + function loc_notification() + { + return $this->prefs['loc_notification']; + } + + function print_invoice_no() + { + return $this->prefs['print_invoice_no']; + } + + function allow_negative_prices() + { + return $this->prefs['allow_negative_prices']; + } + + function print_item_images_on_quote() + { + return $this->prefs['print_item_images_on_quote']; + } + + function alternative_tax_include_on_docs() + { + return $this->prefs['alternative_tax_include_on_docs']; + } + + function suppress_tax_rates() + { + return $this->prefs['suppress_tax_rates']; + } } ?> \ No newline at end of file diff --git a/includes/prefs/userprefs.inc b/includes/prefs/userprefs.inc index bd72d667..80a3a62f 100644 --- a/includes/prefs/userprefs.inc +++ b/includes/prefs/userprefs.inc @@ -35,7 +35,11 @@ class user_prefs var $graphic_links; // use graphic links var $sticky_date; // save date on subsequent document entry var $startup_tab; // default start-up menu tab - var $transaction_days; // transaction days in inquiries. + var $transaction_days; // transaction days in inquiries + var $save_report_selection; // save report selections days 0... + var $use_date_picker; // use date picker for all date fields + var $def_print_destination; // default print destination. 0 = PDF/Printer, 1 = Excel + var $def_print_orientation; // default print orientation. 0 = Portrait. 1 = Landscape function user_prefs($user=null) { @@ -51,6 +55,10 @@ class user_prefs $this->language = $dflt_lang; $this->theme = 'default'; $this->transaction_days = -30; + $this->save_report_selections = 0; + $this->use_date_picker = 1; + $this->def_print_destination = 0; + $this->def_print_orientation = 0; } else { global $path_to_root; @@ -86,6 +94,10 @@ class user_prefs $this->startup_tab = "orders"; } $this->transaction_days = $user['transaction_days']; + $this->save_report_selections = $user['save_report_selections']; + $this->use_date_picker = $user['use_date_picker']; + $this->def_print_destination = $user['def_print_destination']; + $this->def_print_orientation = $user['def_print_orientation']; if (!file_exists("$path_to_root/themes/$this->theme")) $this->theme = "default"; @@ -114,7 +126,11 @@ class user_prefs 'query_size' => $this->query_size, 'graphic_links' => $this->graphic_links, 'sticky_doc_date' => $this->sticky_date, - 'startup_tab' => $this->startup_tab); + 'startup_tab' => $this->startup_tab, + 'save_report_selections' => $this->save_report_selections, + 'use_date_picker' => $this->use_date_picker, + 'def_print_destination' => $this->def_print_destination, + 'def_print_orientation' => $this->def_print_orientation); } function language() @@ -240,6 +256,26 @@ class user_prefs return $this->transaction_days; } + function save_report_selections() + { + return $this->save_report_selections; + } + + function use_date_picker() + { + return $this->use_date_picker; + } + + function def_print_destination() + { + return $this->def_print_destination; + } + + function def_print_orientation() + { + return $this->def_print_orientation; + } + function set_dec($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes) { $this->price_dec = $price_dec; diff --git a/includes/ui/db_pager_view.inc b/includes/ui/db_pager_view.inc index e8718c63..6c0a8d7f 100644 --- a/includes/ui/db_pager_view.inc +++ b/includes/ui/db_pager_view.inc @@ -40,7 +40,7 @@ function navi_button_cell($name, $value, $enabled=true, $align='left') { // Sql paged table view. Call this function inside form. // function display_db_pager(&$pager) { - global $use_popup_windows, $use_date_picker, $path_to_root; + global $use_popup_windows, $path_to_root; $pager->select_records(); diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc index a6537a83..c1091b37 100644 --- a/includes/ui/ui_input.inc +++ b/includes/ui/ui_input.inc @@ -606,7 +606,7 @@ function link_row_ex($label, $name, $size, $max=null, $title=null, $value=null, function date_cells($label, $name, $title = null, $check=null, $inc_days=0, $inc_months=0, $inc_years=0, $params=null, $submit_on_change=false) { - global $use_date_picker, $path_to_root, $Ajax; + global $path_to_root, $Ajax; if (!isset($_POST[$name]) || $_POST[$name] == "") { @@ -624,7 +624,7 @@ function date_cells($label, $name, $title = null, $check=null, $inc_days=0, $_POST[$name] = $dd; } } - if ($use_date_picker) + if (user_use_date_picker()) { $calc_image = (file_exists("$path_to_root/themes/".user_theme()."/images/cal.gif")) ? "$path_to_root/themes/".user_theme()."/images/cal.gif" : "$path_to_root/themes/default/images/cal.gif"; diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index 7b21ec09..3d9babeb 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -2451,3 +2451,15 @@ function subledger_list_row($label, $name, $selected_id=null, $all_option = fals echo subledger_list($name, $account, $selected_id); echo "\n\n"; } + +function accounts_type_list_row($label, $name, $selected_id=null) +{ + echo ""; + if ($label != null) + echo "$label\n"; + echo ""; + $sel = array(_("Numeric"), _("Alpha Numeric"), _("ALPHA NUMERIC")); + echo array_selector($name, $selected_id, $sel); + echo "\n"; +} + diff --git a/includes/ui/ui_view.inc b/includes/ui/ui_view.inc index f16e72f7..8c8bae8d 100644 --- a/includes/ui/ui_view.inc +++ b/includes/ui/ui_view.inc @@ -423,7 +423,7 @@ function display_debit_or_credit_cells($value, $bold=false) function display_customer_trans_tax_details($tax_items, $columns) { - global $alternative_tax_include_on_docs, $suppress_tax_rates; + global $SysPrefs; $first = true; while ($tax_item = db_fetch($tax_items)) { @@ -431,13 +431,13 @@ function display_customer_trans_tax_details($tax_items, $columns) continue; $tax = number_format2($tax_item['amount'],user_price_dec()); - if (isset($suppress_tax_rates) && $suppress_tax_rates == 1) + if ($SysPrefs->suppress_tax_rates() == 1) $tax_type_name = $tax_item['tax_type_name']; else $tax_type_name = $tax_item['tax_type_name']." (".$tax_item['rate']."%) "; if ($tax_item['included_in_price']) { - if (isset($alternative_tax_include_on_docs) && $alternative_tax_include_on_docs == 1) + if ($SysPrefs->alternative_tax_include_on_docs() == 1) { if ($first) label_row(_("Total Tax Excluded"), number_format2($tax_item['net_amount'], user_price_dec()), diff --git a/inventory/adjustments.php b/inventory/adjustments.php index 94e10b30..7d86faa6 100644 --- a/inventory/adjustments.php +++ b/inventory/adjustments.php @@ -23,7 +23,7 @@ include_once($path_to_root . "/inventory/includes/inventory_db.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(800, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Item Adjustments Note"), false, false, "", $js); diff --git a/inventory/includes/db/items_adjust_db.inc b/inventory/includes/db/items_adjust_db.inc index 6e95c257..57c4b33c 100644 --- a/inventory/includes/db/items_adjust_db.inc +++ b/inventory/includes/db/items_adjust_db.inc @@ -13,7 +13,7 @@ function add_stock_adjustment($items, $location, $date_, $type, $increase, $reference, $memo_) { - global $loc_notification, $path_to_root, $Refs; + global $SysPrefs, $path_to_root, $Refs; begin_transaction(); $args = func_get_args(); @@ -24,7 +24,7 @@ function add_stock_adjustment($items, $location, $date_, $type, $increase, $refe $adj_id = get_next_trans_no(ST_INVADJUST); - if ($loc_notification == 1 && !$increase) + if ($SysPrefs->loc_notification() == 1 && !$increase) { include_once($path_to_root . "/inventory/includes/inventory_db.inc"); $st_ids = array(); @@ -35,7 +35,7 @@ function add_stock_adjustment($items, $location, $date_, $type, $increase, $refe foreach ($items as $line_item) { - if ($loc_notification == 1 && !$increase) + if ($SysPrefs->loc_notification() == 1 && !$increase) $loc = calculate_reorder_level($location, $line_item, $st_ids, $st_names, $st_num, $st_reorder); if (!$increase) @@ -53,7 +53,7 @@ function add_stock_adjustment($items, $location, $date_, $type, $increase, $refe $args->trans_no = $adj_id; hook_db_postwrite($args, ST_INVADJUST); commit_transaction(); - if ($loc_notification == 1 && !$increase && count($st_ids) > 0) + if ($SysPrefs->loc_notification() == 1 && !$increase && count($st_ids) > 0) send_reorder_email($loc, $st_ids, $st_names, $st_num, $st_reorder); return $adj_id; diff --git a/inventory/includes/db/items_transfer_db.inc b/inventory/includes/db/items_transfer_db.inc index 0acd0900..8448ae89 100644 --- a/inventory/includes/db/items_transfer_db.inc +++ b/inventory/includes/db/items_transfer_db.inc @@ -13,7 +13,7 @@ function add_stock_transfer($Items, $location_from, $location_to, $date_, $type, $reference, $memo_) { - global $loc_notification, $path_to_root, $Refs; + global $SysPrefs, $path_to_root, $Refs; begin_transaction(); $args = func_get_args(); @@ -24,7 +24,7 @@ function add_stock_transfer($Items, $location_from, $location_to, $date_, $type, $transfer_id = get_next_trans_no(ST_LOCTRANSFER); - if ($loc_notification == 1) + if ($SysPrefs->loc_notification() == 1) { include_once($path_to_root . "/inventory/includes/inventory_db.inc"); $st_ids = array(); @@ -34,7 +34,7 @@ function add_stock_transfer($Items, $location_from, $location_to, $date_, $type, } foreach ($Items as $line_item) { - if ($loc_notification == 1) + if ($SysPrefs->loc_notification() == 1) $loc = calculate_reorder_level($location_from, $line_item, $st_ids, $st_names, $st_num, $st_reorder); add_stock_transfer_item($transfer_id, $line_item->stock_id, $location_from, $location_to, $date_, $type, $reference, $line_item->quantity); @@ -50,7 +50,7 @@ function add_stock_transfer($Items, $location_from, $location_to, $date_, $type, commit_transaction(); - if ($loc_notification == 1 && count($st_ids) > 0) + if ($SysPrefs->loc_notification() == 1 && count($st_ids) > 0) send_reorder_email($loc, $st_ids, $st_names, $st_num, $st_reorder); return $transfer_id; diff --git a/inventory/inquiry/stock_movements.php b/inventory/inquiry/stock_movements.php index 2c2e0974..6021f1ee 100644 --- a/inventory/inquiry/stock_movements.php +++ b/inventory/inquiry/stock_movements.php @@ -21,7 +21,7 @@ include_once($path_to_root . "/includes/ui.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(800, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Inventory Item Movement"), @$_GET['popup'], false, "", $js); //------------------------------------------------------------------------------------------------ diff --git a/inventory/manage/items.php b/inventory/manage/items.php index 71e2f2b9..46fb1469 100644 --- a/inventory/manage/items.php +++ b/inventory/manage/items.php @@ -16,7 +16,7 @@ include($path_to_root . "/includes/session.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Items"), @$_REQUEST['popup'], false, "", $js); diff --git a/inventory/transfers.php b/inventory/transfers.php index 0da6d755..40277211 100644 --- a/inventory/transfers.php +++ b/inventory/transfers.php @@ -23,7 +23,7 @@ include_once($path_to_root . "/inventory/includes/inventory_db.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(800, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Inventory Location Transfers"), false, false, "", $js); diff --git a/manufacturing/work_order_add_finished.php b/manufacturing/work_order_add_finished.php index 35c73176..ec2dca66 100644 --- a/manufacturing/work_order_add_finished.php +++ b/manufacturing/work_order_add_finished.php @@ -24,7 +24,7 @@ include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Produce or Unassemble Finished Items From Work Order"), false, false, "", $js); diff --git a/manufacturing/work_order_costs.php b/manufacturing/work_order_costs.php index 4054fcbd..ddb0d1ea 100644 --- a/manufacturing/work_order_costs.php +++ b/manufacturing/work_order_costs.php @@ -24,7 +24,7 @@ include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Work Order Additional Costs"), false, false, "", $js); diff --git a/manufacturing/work_order_entry.php b/manufacturing/work_order_entry.php index 06e82837..5c27369b 100644 --- a/manufacturing/work_order_entry.php +++ b/manufacturing/work_order_entry.php @@ -24,7 +24,7 @@ include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Work Order Entry"), false, false, "", $js); @@ -63,7 +63,7 @@ if (isset($_GET['AddedID'])) submenu_print(_("&Email This Work Order"), ST_WORKORDER, $id, null, 1); display_note(get_gl_view_str($stype, $id, _("View the GL Journal Entries for this Work Order")), 1); $ar = array('PARAM_0' => $_GET['date'], 'PARAM_1' => $_GET['date'], 'PARAM_2' => $stype, 'PARAM_3' => '', - 'PARAM_4' => (isset($def_print_orientation) && $def_print_orientation == 1 ? 1 : 0)); + 'PARAM_4' => (user_def_print_orientation() == 1 ? 1 : 0)); display_note(print_link(_("Print the GL Journal Entries for this Work Order"), 702, $ar), 1); hyperlink_params("$path_to_root/admin/attachments.php", _("Add an Attachment"), "filterType=$stype&trans_no=$id"); } diff --git a/manufacturing/work_order_issue.php b/manufacturing/work_order_issue.php index d2344f6f..abc518de 100644 --- a/manufacturing/work_order_issue.php +++ b/manufacturing/work_order_issue.php @@ -25,7 +25,7 @@ include_once($path_to_root . "/manufacturing/includes/work_order_issue_ui.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(800, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Issue Items to Work Order"), false, false, "", $js); diff --git a/manufacturing/work_order_release.php b/manufacturing/work_order_release.php index 10044b7b..dbdb8b46 100644 --- a/manufacturing/work_order_release.php +++ b/manufacturing/work_order_release.php @@ -22,7 +22,7 @@ include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(800, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Work Order Release to Manufacturing"), false, false, "", $js); diff --git a/purchasing/inquiry/po_search.php b/purchasing/inquiry/po_search.php index 44b9b357..399e3e86 100644 --- a/purchasing/inquiry/po_search.php +++ b/purchasing/inquiry/po_search.php @@ -20,7 +20,7 @@ include_once($path_to_root . "/reporting/includes/reporting.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Search Outstanding Purchase Orders"), false, false, "", $js); diff --git a/purchasing/inquiry/po_search_completed.php b/purchasing/inquiry/po_search_completed.php index 196de84e..31c77426 100644 --- a/purchasing/inquiry/po_search_completed.php +++ b/purchasing/inquiry/po_search_completed.php @@ -19,7 +19,7 @@ include_once($path_to_root . "/reporting/includes/reporting.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Search Purchase Orders"), false, false, "", $js); diff --git a/purchasing/inquiry/supplier_allocation_inquiry.php b/purchasing/inquiry/supplier_allocation_inquiry.php index fc19aee8..6e4bcf88 100644 --- a/purchasing/inquiry/supplier_allocation_inquiry.php +++ b/purchasing/inquiry/supplier_allocation_inquiry.php @@ -18,7 +18,7 @@ include($path_to_root . "/purchasing/includes/purchasing_ui.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Supplier Allocation Inquiry"), false, false, "", $js); diff --git a/purchasing/inquiry/supplier_inquiry.php b/purchasing/inquiry/supplier_inquiry.php index 94ab5275..03a5d11d 100644 --- a/purchasing/inquiry/supplier_inquiry.php +++ b/purchasing/inquiry/supplier_inquiry.php @@ -20,7 +20,7 @@ include_once($path_to_root . "/reporting/includes/reporting.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Supplier Inquiry"), isset($_GET['supplier_id']), false, "", $js); diff --git a/purchasing/manage/suppliers.php b/purchasing/manage/suppliers.php index a8c6571a..81a6e57b 100644 --- a/purchasing/manage/suppliers.php +++ b/purchasing/manage/suppliers.php @@ -16,7 +16,7 @@ include_once($path_to_root . "/includes/session.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Suppliers"), @$_REQUEST['popup'], false, "", $js); diff --git a/purchasing/po_entry_items.php b/purchasing/po_entry_items.php index dd2cc3bc..1ab8e663 100644 --- a/purchasing/po_entry_items.php +++ b/purchasing/po_entry_items.php @@ -33,7 +33,7 @@ set_page_security( @$_SESSION['PO']->trans_type, $js = ''; if ($use_popup_windows) $js .= get_js_open_window(900, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); if (isset($_GET['ModifyOrderNumber']) && is_numeric($_GET['ModifyOrderNumber'])) { diff --git a/purchasing/po_receive_items.php b/purchasing/po_receive_items.php index d2697de9..57ef24a0 100644 --- a/purchasing/po_receive_items.php +++ b/purchasing/po_receive_items.php @@ -20,7 +20,7 @@ include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Receive Purchase Order Items"), false, false, "", $js); diff --git a/purchasing/supplier_credit.php b/purchasing/supplier_credit.php index 0d1e6c9f..2b8c07b3 100644 --- a/purchasing/supplier_credit.php +++ b/purchasing/supplier_credit.php @@ -23,7 +23,7 @@ include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); //---------------------------------------------------------------------------------------- diff --git a/purchasing/supplier_invoice.php b/purchasing/supplier_invoice.php index ffb5e79b..d7172ee0 100644 --- a/purchasing/supplier_invoice.php +++ b/purchasing/supplier_invoice.php @@ -23,7 +23,7 @@ include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); //---------------------------------------------------------------------------------------- diff --git a/purchasing/supplier_payment.php b/purchasing/supplier_payment.php index 75ab908a..38ca82dc 100644 --- a/purchasing/supplier_payment.php +++ b/purchasing/supplier_payment.php @@ -23,7 +23,7 @@ include_once($path_to_root . "/reporting/includes/reporting.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); add_js_file('payalloc.js'); diff --git a/reporting/includes/doctext.inc b/reporting/includes/doctext.inc index 06bb7b1f..de3082a9 100644 --- a/reporting/includes/doctext.inc +++ b/reporting/includes/doctext.inc @@ -50,7 +50,7 @@ $this->title = _("SALES QUOTATION"); $this->formData['document_name'] =_("Quotation No."); $this->formData['document_date'] = $this->formData['ord_date']; - $this->formData['document_number'] = $print_invoice_no == 0 && isset($this->formData['reference']) + $this->formData['document_number'] = $SysPrefs->print_invoice_no() == 0 && isset($this->formData['reference']) ? $this->formData['reference'] : $this->formData['order_no']; $aux_info = array( _("Customer's Reference") => $this->formData["customer_ref"], @@ -65,7 +65,7 @@ $this->title = ($print_as_quote==1 ? _("QUOTE") : ($this->formData['prepaid'] ? _("PREPAYMENT ORDER") : _("SALES ORDER"))); $this->formData['document_name'] =_("Order No."); $this->formData['document_date'] = $this->formData['ord_date']; - $this->formData['document_number'] = $print_invoice_no == 0 && isset($this->formData['reference']) + $this->formData['document_number'] = $SysPrefs->print_invoice_no() == 0 && isset($this->formData['reference']) ? $this->formData['reference'] : $this->formData['order_no']; $this->formData['document_amount'] = $this->formData['order_no']; @@ -84,7 +84,7 @@ if (@$packing_slip) $Payment_Terms = ''; $ref = $this->formData['order_']; - if ($print_invoice_no == 0) + if ($SysPrefs->print_invoice_no() == 0) { $ref = get_reference(ST_SALESORDER, $this->formData['order_']); if (!$ref) @@ -121,7 +121,7 @@ $Footer[0] = _("Please quote Invoice no. when paying. All amounts stated in"). " - " . $this->formData['curr_code']; $deliveries = get_sales_parent_numbers(ST_SALESINVOICE, $this->formData['trans_no']); - if ($print_invoice_no == 0) + if ($SysPrefs->print_invoice_no() == 0) { foreach($deliveries as $n => $delivery) { $deliveries[$n] = get_reference(ST_CUSTDELIVERY, $delivery); @@ -177,7 +177,7 @@ $Addr2['name'] = $this->company['coy_name']; //$Addr2['address'] = $this->company['postal_address']; No, don't destroy delivery address! $this->formData['document_date'] = $this->formData['ord_date']; - $this->formData['document_number'] = $print_invoice_no == 0 && isset($this->formData['reference']) + $this->formData['document_number'] = $SysPrefs->print_invoice_no() == 0 && isset($this->formData['reference']) ? $this->formData['reference'] : $this->formData['order_no']; $aux_info = array( @@ -252,7 +252,7 @@ $this->formData['document_date'] = $this->formData['tran_date']; if (!isset($this->formData['document_number'])) - $this->formData['document_number'] = $print_invoice_no == 0 && isset($this->formData['reference']) + $this->formData['document_number'] = $SysPrefs->print_invoice_no() == 0 && isset($this->formData['reference']) ? $this->formData['reference'] : @$this->formData['trans_no']; // footer generic content diff --git a/reporting/includes/pdf_report.inc b/reporting/includes/pdf_report.inc index 887284b9..cb7bea9d 100644 --- a/reporting/includes/pdf_report.inc +++ b/reporting/includes/pdf_report.inc @@ -424,7 +424,7 @@ class FrontReport extends Cpdf function Header2() { global $path_to_root, $print_as_quote, - $print_invoice_no, $packing_slip, $dflt_lang; // FIXME should be passed as params + $SysPrefs, $packing_slip, $dflt_lang; // FIXME should be passed as params $doctype = $this->formData['doctype']; $header2type = true; diff --git a/reporting/includes/reporting.inc b/reporting/includes/reporting.inc index 4f2e6665..018da18b 100644 --- a/reporting/includes/reporting.inc +++ b/reporting/includes/reporting.inc @@ -17,11 +17,11 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no, $icon=false, $class='printlink', $id='', $email=0, $extra=0) { - global $path_to_root, $def_print_orientation; + global $path_to_root; include_once($path_to_root . "/includes/types.inc"); $url = $path_to_root.'/reporting/prn_redirect.php?'; - $def_orientation = (isset($def_print_orientation) && $def_print_orientation == 1 ? 1 : 0); + $def_orientation = (user_def_print_orientation() == 1 ? 1 : 0); switch ($type_no) { @@ -146,4 +146,43 @@ function print_link($link_text, $rep, $pars = array(), $dir = '', return "$pars[0]"; } +/* +// Purpose: Function to parse a string into parameters +// Release Date: 2014-12-26 +// Author: ApMuthu +// Usage: +$str = "PPFrt#2000 CID#6378465 TaxEx#2345-038 abcde ertrgdert COD#4253 jdegtd PIN#6473654"; +$p = parse_notes_params($str); +echo print_r($p, true); + +An example of usage will be in the reporting/rep110.php file at near the end just before the last $rep-Font(); statement: + + + $notes_params = parse_notes_params($branch['notes']); + if ($packing_slip == 0 && array_key_exists('CID', $notes_params)) { + $rep->NewLine(1); + $rep->TextCol(1, 7, "Old Customer# : " . $notes_params['CID'], - 2); + } +*/ + +function parse_notes_params($str, $sep=" ", $delim="#") { + $str_params = explode($sep, $str); + $param_array=Array('notes' => ''); + foreach ($str_params AS $str_param) { + $param_set=explode($delim, trim($str_param)); + $key = (array_key_exists(0, $param_set) ? trim($param_set[0]) : ''); + $val = (array_key_exists(1, $param_set) ? trim($param_set[1]) : ''); + if (strlen($key) > 0 && strlen($val) > 0) { + $param_array[$key]=$val; + } else { + // stop at first missing parameter set + // break; + // Collect the rest into notes + $param_array['notes'] .= (" " . $str_param); + } + } + $param_array['notes'] = trim($param_array['notes']); + return $param_array; +} + ?> \ No newline at end of file diff --git a/reporting/includes/reports_classes.inc b/reporting/includes/reports_classes.inc index d9076691..73439b95 100644 --- a/reporting/includes/reports_classes.inc +++ b/reporting/includes/reports_classes.inc @@ -167,8 +167,8 @@ class BoxReports // function get_ctrl($name, $type) { - global $path_to_root, $use_date_picker, $pdf_debug, $print_invoice_no, - $def_print_destination, $def_print_orientation, $type_shortcuts; + global $path_to_root, $pdf_debug, $SysPrefs, + $type_shortcuts; $st = ''; switch ($type) @@ -214,7 +214,7 @@ class BoxReports else // saved parameters 2010-10-16 Joe Hunt $date = $_POST[$name]; $st = ""; - if ($use_date_picker) + if (user_use_date_picker()) { $calc_image = (file_exists("$path_to_root/themes/".user_theme()."/images/cal.gif")) ? "$path_to_root/themes/".user_theme()."/images/cal.gif" : "$path_to_root/themes/default/images/cal.gif"; @@ -233,14 +233,14 @@ class BoxReports case 'DESTINATION': $sel = array(_("PDF/Printer"), "Excel"); $def = 0; - if (isset($def_print_destination) && $def_print_destination == 1) + if (user_def_print_destination() == 1) $def = 1; return array_selector($name, $def, $sel); case 'ORIENTATION': $sel = array(_("Portrait"), _("Landscape")); $def = 0; - if (isset($def_print_orientation) && $def_print_orientation == 1) + if (user_def_print_orientation() == 1) $def = 1; return array_selector($name, $def, $sel); @@ -314,7 +314,7 @@ class BoxReports case 'INVOICE': $IV = $type_shortcuts[ST_SALESINVOICE]; - $ref = ($print_invoice_no == 1 ? "trans_no" : "reference"); + $ref = ($SysPrefs->print_invoice_no() == 1 ? "trans_no" : "reference"); $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-', ".TB_PREF."debtor_trans.type) AS TNO, concat('$IV ', ".TB_PREF."debtor_trans.$ref,' ', ".TB_PREF."debtors_master.name) as IName FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE type=".ST_SALESINVOICE." AND ".TB_PREF."debtors_master.debtor_no=".TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC"; @@ -322,7 +322,7 @@ class BoxReports case 'CREDIT': $CN = $type_shortcuts[ST_CUSTCREDIT]; - $ref = ($print_invoice_no == 1 ? "trans_no" : "reference"); + $ref = ($SysPrefs->print_invoice_no() == 1 ? "trans_no" : "reference"); $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-', ".TB_PREF."debtor_trans.type) AS TNO, concat('$CN ', ".TB_PREF."debtor_trans.$ref,' ', ".TB_PREF."debtors_master.name) as IName FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE type=".ST_CUSTCREDIT." AND ".TB_PREF."debtors_master.debtor_no=".TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC"; @@ -339,7 +339,7 @@ class BoxReports return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false)); case 'ORDERS': - $ref = ($print_invoice_no == 1 ? "order_no" : "reference"); + $ref = ($SysPrefs->print_invoice_no() == 1 ? "order_no" : "reference"); $sql = "SELECT ".TB_PREF."sales_orders.order_no, concat(".TB_PREF."sales_orders.$ref, '-', ".TB_PREF."debtors_master.name) as IName FROM ".TB_PREF."debtors_master, ".TB_PREF."sales_orders WHERE ".TB_PREF."debtors_master.debtor_no=".TB_PREF."sales_orders.debtor_no @@ -347,7 +347,7 @@ class BoxReports return combo_input($name, '', $sql, 'order_no', 'IName',array('order'=>false)); case 'QUOTATIONS': - $ref = ($print_invoice_no == 1 ? "order_no" : "reference"); + $ref = ($SysPrefs->print_invoice_no() == 1 ? "order_no" : "reference"); $sql = "SELECT ".TB_PREF."sales_orders.order_no, concat(".TB_PREF."sales_orders.$ref, '-', ".TB_PREF."debtors_master.name) as IName FROM ".TB_PREF."debtors_master, ".TB_PREF."sales_orders WHERE ".TB_PREF."debtors_master.debtor_no=".TB_PREF."sales_orders.debtor_no @@ -355,7 +355,7 @@ class BoxReports return combo_input($name, '', $sql, 'order_no', 'IName',array('order'=>false)); case 'PO': - $ref = ($print_invoice_no == 1 ? "order_no" : "reference"); + $ref = ($SysPrefs->print_invoice_no() == 1 ? "order_no" : "reference"); $sql = "SELECT ".TB_PREF."purch_orders.order_no, concat(".TB_PREF."purch_orders.$ref, '-', ".TB_PREF."suppliers.supp_name) as IName FROM ".TB_PREF."suppliers, ".TB_PREF."purch_orders WHERE ".TB_PREF."suppliers.supplier_id=".TB_PREF."purch_orders.supplier_id ORDER BY ".TB_PREF."purch_orders.order_no DESC"; @@ -374,7 +374,7 @@ class BoxReports case 'RECEIPT': $BD = $type_shortcuts[ST_BANKDEPOSIT]; $CP = $type_shortcuts[ST_CUSTPAYMENT]; - $ref = ($print_invoice_no == 1 ? "trans_no" : "reference"); + $ref = ($SysPrefs->print_invoice_no() == 1 ? "trans_no" : "reference"); $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-', ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.$ref, if (type=".ST_BANKDEPOSIT.", ' $BD ', ' $CP '), ".TB_PREF."debtors_master.name) as IName FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE (type=".ST_BANKDEPOSIT." OR type=".ST_CUSTPAYMENT." OR type=".ST_CUSTCREDIT.") AND ".TB_PREF."debtors_master.debtor_no=".TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC"; diff --git a/reporting/prn_redirect.php b/reporting/prn_redirect.php index d7147a7f..22d48cfc 100644 --- a/reporting/prn_redirect.php +++ b/reporting/prn_redirect.php @@ -14,15 +14,15 @@ print button in reporting module. */ $path_to_root = ".."; -global $page_security, $save_report_selections; +global $page_security; $page_security = 'SA_OPEN'; // this level is later overriden in rep file include_once($path_to_root . "/includes/session.inc"); -if (isset($save_report_selections) && $save_report_selections > 0 && isset($_POST['REP_ID'])) { // save parameters from Report Center +if (user_save_report_selections() > 0 && isset($_POST['REP_ID'])) { // save parameters from Report Center for($i=0; $i<12; $i++) { // 2013-01-16 Joe Hunt if (isset($_POST['PARAM_'.$i]) && !is_array($_POST['PARAM_'.$i])) { $rep = $_POST['REP_ID']; - setcookie("select[$rep][$i]", $_POST['PARAM_'.$i], time()+60*60*24*$save_report_selections); // days from $save_report_selections + setcookie("select[$rep][$i]", $_POST['PARAM_'.$i], time()+60*60*24*user_save_report_selections()); // days from user_save_report_selections() } } } diff --git a/reporting/rep107.php b/reporting/rep107.php index 2fea78e6..f1d5f9fe 100644 --- a/reporting/rep107.php +++ b/reporting/rep107.php @@ -27,9 +27,9 @@ include_once($path_to_root . "/sales/includes/sales_db.inc"); //---------------------------------------------------------------------------------------------------- function get_invoice_range($from, $to) { - global $print_invoice_no; + global $SysPrefs; - $ref = ($print_invoice_no == 1 ? "trans_no" : "reference"); + $ref = ($SysPrefs->print_invoice_no() == 1 ? "trans_no" : "reference"); $sql = "SELECT trans.trans_no, trans.reference FROM ".TB_PREF."debtor_trans trans @@ -49,7 +49,7 @@ print_invoices(); function print_invoices() { - global $path_to_root, $alternative_tax_include_on_docs, $suppress_tax_rates, $no_zero_lines_amount; + global $path_to_root, $SysPrefs; $show_this_payment = true; // include payments invoiced here in summary @@ -163,7 +163,7 @@ function print_invoices() $rep->TextColLines($c++, $c, $myrow2['StockDescription'], -2); $newrow = $rep->row; $rep->row = $oldrow; - if ($Net != 0.0 || !is_service($myrow2['mb_flag']) || !isset($no_zero_lines_amount) || $no_zero_lines_amount == 0) + if ($Net != 0.0 || !is_service($myrow2['mb_flag']) || !$SysPrefs->no_zero_lines_amount()) { $rep->TextCol($c++, $c, $DisplayQty, -2); $rep->TextCol($c++, $c, $myrow2['units'], -2); @@ -242,14 +242,14 @@ function print_invoices() continue; $DisplayTax = number_format2($sign*$tax_item['amount'], $dec); - if (isset($suppress_tax_rates) && $suppress_tax_rates == 1) + if ($SysPrefs->suppress_tax_rates() == 1) $tax_type_name = $tax_item['tax_type_name']; else $tax_type_name = $tax_item['tax_type_name']." (".$tax_item['rate']."%) "; if ($myrow['tax_included']) { - if (isset($alternative_tax_include_on_docs) && $alternative_tax_include_on_docs == 1) + if ($SysPrefs->alternative_tax_include_on_docs() == 1) { if ($first) { diff --git a/reporting/rep109.php b/reporting/rep109.php index 1f7270c4..e0c577a5 100644 --- a/reporting/rep109.php +++ b/reporting/rep109.php @@ -33,7 +33,7 @@ $print_as_quote = 0; function print_sales_orders() { - global $path_to_root, $print_as_quote, $no_zero_lines_amount; + global $path_to_root, $print_as_quote, $SysPrefs; include_once($path_to_root . "/reporting/includes/pdf_report.inc"); @@ -128,7 +128,7 @@ function print_sales_orders() $rep->TextColLines(1, 2, $myrow2['description'], -2); $newrow = $rep->row; $rep->row = $oldrow; - if ($Net != 0.0 || !is_service($myrow2['mb_flag']) || !isset($no_zero_lines_amount) || $no_zero_lines_amount == 0) + if ($Net != 0.0 || !is_service($myrow2['mb_flag']) || !$SysPrefs->no_zero_lines_amount()) { $rep->TextCol(2, 3, $DisplayQty, -2); $rep->TextCol(3, 4, $myrow2['units'], -2); @@ -179,7 +179,7 @@ function print_sales_orders() if ($myrow['tax_included']) { - if (isset($alternative_tax_include_on_docs) && $alternative_tax_include_on_docs == 1) + if ($SysPrefs->alternative_tax_include_on_docs() == 1) { if ($first) { diff --git a/reporting/rep110.php b/reporting/rep110.php index f016948f..52870c04 100644 --- a/reporting/rep110.php +++ b/reporting/rep110.php @@ -34,7 +34,7 @@ print_deliveries(); function print_deliveries() { - global $path_to_root, $packing_slip, $alternative_tax_include_on_docs, $suppress_tax_rates, $no_zero_lines_amount; + global $path_to_root, $packing_slip, $SysPrefs; include_once($path_to_root . "/reporting/includes/pdf_report.inc"); @@ -125,7 +125,7 @@ function print_deliveries() $rep->TextColLines(1, 2, $myrow2['StockDescription'], -2); $newrow = $rep->row; $rep->row = $oldrow; - if ($Net != 0.0 || !is_service($myrow2['mb_flag']) || !isset($no_zero_lines_amount) || $no_zero_lines_amount == 0) + if ($Net != 0.0 || !is_service($myrow2['mb_flag']) || !$SysPrefs->no_zero_lines_amount()) { $rep->TextCol(2, 3, $DisplayQty, -2); $rep->TextCol(3, 4, $myrow2['units'], -2); @@ -170,14 +170,14 @@ function print_deliveries() continue; $DisplayTax = number_format2($tax_item['amount'], $dec); - if (isset($suppress_tax_rates) && $suppress_tax_rates == 1) + if ($SysPrefs->suppress_tax_rates() == 1) $tax_type_name = $tax_item['tax_type_name']; else $tax_type_name = $tax_item['tax_type_name']." (".$tax_item['rate']."%) "; if ($myrow['tax_included']) { - if (isset($alternative_tax_include_on_docs) && $alternative_tax_include_on_docs == 1) + if ($SysPrefs->alternative_tax_include_on_docs() == 1) { if ($first) { diff --git a/reporting/rep111.php b/reporting/rep111.php index 4287a4de..02c39815 100644 --- a/reporting/rep111.php +++ b/reporting/rep111.php @@ -31,7 +31,7 @@ print_sales_quotations(); function print_sales_quotations() { - global $path_to_root, $print_as_quote, $print_invoice_no, $no_zero_lines_amount, $print_item_images_on_quote, $pic_height; + global $path_to_root, $print_as_quote, $SysPrefs, $pic_height; include_once($path_to_root . "/reporting/includes/pdf_report.inc"); @@ -47,7 +47,7 @@ function print_sales_quotations() $orientation = ($orientation ? 'L' : 'P'); $dec = user_price_dec(); - $pictures = (isset($print_item_images_on_quote) && $print_item_images_on_quote==1); + $pictures = $SysPrefs->print_item_images_on_quote(); // If you want a larger image, then increase $pic_height f.i. // $pic_height += 25; @@ -74,7 +74,7 @@ function print_sales_quotations() if ($email == 1) { $rep = new FrontReport("", "", user_pagesize(), 9, $orientation); - if ($print_invoice_no == 1) + if ($SysPrefs->print_invoice_no() == 1) $rep->filename = "SalesQuotation" . $i . ".pdf"; else $rep->filename = "SalesQuotation" . $myrow['reference'] . ".pdf"; @@ -111,7 +111,7 @@ function print_sales_quotations() $rep->TextColLines(1, 2, $myrow2['description'], -2); $newrow = $rep->row; $rep->row = $oldrow; - if ($Net != 0.0 || !is_service($myrow2['mb_flag']) || !isset($no_zero_lines_amount) || $no_zero_lines_amount == 0) + if ($Net != 0.0 || !is_service($myrow2['mb_flag']) || !$SysPrefs->no_zero_lines_amount()) { $rep->TextCol(2, 3, $DisplayQty, -2); $rep->TextCol(3, 4, $myrow2['units'], -2); @@ -176,7 +176,7 @@ function print_sales_quotations() if ($myrow['tax_included']) { - if (isset($alternative_tax_include_on_docs) && $alternative_tax_include_on_docs == 1) + if ($SysPrefs->alternative_tax_include_on_docs() == 1) { if ($first) { @@ -215,7 +215,7 @@ function print_sales_quotations() $rep->Font(); if ($email == 1) { - if ($print_invoice_no == 1) + if ($SysPrefs->print_invoice_no() == 1) $myrow['reference'] = $i; $rep->End($email); } diff --git a/reporting/rep113.php b/reporting/rep113.php index 2e8e1dc5..f8811652 100644 --- a/reporting/rep113.php +++ b/reporting/rep113.php @@ -32,7 +32,7 @@ print_credits(); function print_credits() { - global $path_to_root, $alternative_tax_include_on_docs, $suppress_tax_rates; + global $path_to_root, $SysPrefs; include_once($path_to_root . "/reporting/includes/pdf_report.inc"); @@ -155,14 +155,14 @@ function print_credits() continue; $DisplayTax = number_format2($sign*$tax_item['amount'], $dec); - if (isset($suppress_tax_rates) && $suppress_tax_rates == 1) + if ($SysPrefs->suppress_tax_rates() == 1) $tax_type_name = $tax_item['tax_type_name']; else $tax_type_name = $tax_item['tax_type_name']." (".$tax_item['rate']."%) "; if ($myrow['tax_included']) { - if (isset($alternative_tax_include_on_docs) && $alternative_tax_include_on_docs == 1) + if ($SysPrefs->alternative_tax_include_on_docs() == 1) { if ($first) { diff --git a/reporting/rep209.php b/reporting/rep209.php index e5188bc6..9f9f0121 100644 --- a/reporting/rep209.php +++ b/reporting/rep209.php @@ -58,7 +58,7 @@ function get_po_details($order_no) function print_po() { - global $path_to_root, $show_po_item_codes; + global $path_to_root, $SysPrefs; include_once($path_to_root . "/reporting/includes/pdf_report.inc"); @@ -135,7 +135,7 @@ function print_po() $DisplayPrice = price_decimal_format($myrow2["unit_price"],$dec2); $DisplayQty = number_format2($myrow2["quantity_ordered"],get_qty_dec($myrow2['item_code'])); $DisplayNet = number_format2($Net,$dec); - if ($show_po_item_codes) { + if ($SysPrefs->show_po_item_codes()) { $rep->TextCol(0, 1, $myrow2['item_code'], -2); $rep->TextCol(1, 2, $myrow2['description'], -2); } else @@ -172,14 +172,14 @@ function print_po() continue; $DisplayTax = number_format2($tax_item['Value'], $dec); - if (isset($suppress_tax_rates) && $suppress_tax_rates == 1) + if ($SysPrefs->suppress_tax_rates() == 1) $tax_type_name = $tax_item['tax_type_name']; else $tax_type_name = $tax_item['tax_type_name']." (".$tax_item['rate']."%) "; if ($myrow['tax_included']) { - if (isset($alternative_tax_include_on_docs) && $alternative_tax_include_on_docs == 1) + if ($SysPrefs->alternative_tax_include_on_docs() == 1) { if ($first) { diff --git a/reporting/reports_main.php b/reporting/reports_main.php index 039eb3b8..66c07caf 100644 --- a/reporting/reports_main.php +++ b/reporting/reports_main.php @@ -18,7 +18,7 @@ include_once($path_to_root . "/includes/data_checks.inc"); include_once($path_to_root . "/includes/ui.inc"); include_once($path_to_root . "/reporting/includes/reports_classes.inc"); $js = ""; -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); add_js_file('reports.js'); diff --git a/sales/create_recurrent_invoices.php b/sales/create_recurrent_invoices.php index 56e39bb0..d96fcd47 100644 --- a/sales/create_recurrent_invoices.php +++ b/sales/create_recurrent_invoices.php @@ -20,7 +20,7 @@ include_once($path_to_root . "/reporting/includes/reporting.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 600); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Create and Print Recurrent Invoices"), false, false, "", $js); @@ -111,7 +111,7 @@ if ($id != -1) if (count($invs) > 0) { $ar = array('PARAM_0' => $min."-".ST_SALESINVOICE, 'PARAM_1' => $max."-".ST_SALESINVOICE, 'PARAM_2' => "", - 'PARAM_3' => 0, 'PARAM_4' => 0, 'PARAM_5' => "", 'PARAM_6' => $def_print_orientation); + 'PARAM_3' => 0, 'PARAM_4' => 0, 'PARAM_5' => "", 'PARAM_6' => user_def_print_orientation()); display_note(print_link(sprintf(_("&Print Recurrent Invoices # %s - # %s"), $min, $max), 107, $ar), 0, 1); $ar['PARAM_3'] = 1; // email display_note(print_link(sprintf(_("&Email Recurrent Invoices # %s - # %s"), $min, $max), 107, $ar), 0, 1); diff --git a/sales/credit_note_entry.php b/sales/credit_note_entry.php index b3ccc708..5fa56cc3 100644 --- a/sales/credit_note_entry.php +++ b/sales/credit_note_entry.php @@ -29,7 +29,7 @@ $js = ""; if ($use_popup_windows) { $js .= get_js_open_window(900, 500); } -if ($use_date_picker) { +if (user_use_date_picker()) { $js .= get_js_date_picker(); } diff --git a/sales/customer_credit_invoice.php b/sales/customer_credit_invoice.php index fcc934bd..2b31654a 100644 --- a/sales/customer_credit_invoice.php +++ b/sales/customer_credit_invoice.php @@ -30,7 +30,7 @@ if ($use_popup_windows) { $js .= get_js_open_window(900, 500); } -if ($use_date_picker) { +if (user_use_date_picker()) { $js .= get_js_date_picker(); } diff --git a/sales/customer_delivery.php b/sales/customer_delivery.php index f9253802..fa7fc581 100644 --- a/sales/customer_delivery.php +++ b/sales/customer_delivery.php @@ -29,7 +29,7 @@ $js = ""; if ($use_popup_windows) { $js .= get_js_open_window(900, 500); } -if ($use_date_picker) { +if (user_use_date_picker()) { $js .= get_js_date_picker(); } diff --git a/sales/customer_invoice.php b/sales/customer_invoice.php index 6e4b77bd..66f676e6 100644 --- a/sales/customer_invoice.php +++ b/sales/customer_invoice.php @@ -30,7 +30,7 @@ $js = ""; if ($use_popup_windows) { $js .= get_js_open_window(900, 500); } -if ($use_date_picker) { +if (user_use_date_picker()) { $js .= get_js_date_picker(); } diff --git a/sales/customer_payments.php b/sales/customer_payments.php index 3b44bc67..17c39619 100644 --- a/sales/customer_payments.php +++ b/sales/customer_payments.php @@ -24,7 +24,7 @@ $js = ""; if ($use_popup_windows) { $js .= get_js_open_window(900, 500); } -if ($use_date_picker) { +if (user_use_date_picker()) { $js .= get_js_date_picker(); } add_js_file('payalloc.js'); diff --git a/sales/includes/db/sales_order_db.inc b/sales/includes/db/sales_order_db.inc index 86ba5aa3..d02df7bd 100644 --- a/sales/includes/db/sales_order_db.inc +++ b/sales/includes/db/sales_order_db.inc @@ -12,7 +12,7 @@ //---------------------------------------------------------------------------------------- function add_sales_order(&$order) { - global $loc_notification, $path_to_root, $Refs; + global $SysPrefs, $path_to_root, $Refs; begin_transaction(); hook_db_prewrite($order, $order->trans_type); @@ -45,7 +45,7 @@ function add_sales_order(&$order) $order->trans_no = array($order_no=>0); - if ($loc_notification == 1) + if ($SysPrefs->loc_notification() == 1) { include_once($path_to_root . "/inventory/includes/inventory_db.inc"); $st_ids = array(); @@ -55,7 +55,7 @@ function add_sales_order(&$order) } foreach ($order->line_items as $line) { - if ($loc_notification == 1 && is_inventory_item($line->stock_id)) + if ($SysPrefs->loc_notification() == 1 && is_inventory_item($line->stock_id)) $loc = calculate_reorder_level($order->Location, $line, $st_ids, $st_names, $st_num, $st_reorder); $sql = "INSERT INTO ".TB_PREF."sales_order_details (order_no, trans_type, stk_code, description, unit_price, quantity, discount_percent) VALUES ("; @@ -77,7 +77,7 @@ function add_sales_order(&$order) hook_db_postwrite($order, $order->trans_type); commit_transaction(); - if ($loc_notification == 1 && count($st_ids) > 0) + if ($SysPrefs->loc_notification() == 1 && count($st_ids) > 0) send_reorder_email($loc, $st_ids, $st_names, $st_num, $st_reorder); return $order_no; } @@ -120,7 +120,7 @@ function update_sales_order_version($order) function update_sales_order($order) { - global $loc_notification, $path_to_root, $Refs; + global $SysPrefs, $path_to_root, $Refs; $del_date = date2sql($order->due_date); $ord_date = date2sql($order->document_date); @@ -168,7 +168,7 @@ function update_sales_order($order) db_query($sql, "Old order Cannot be Deleted"); - if ($loc_notification == 1) + if ($SysPrefs->loc_notification() == 1) { include_once($path_to_root . "/inventory/includes/inventory_db.inc"); $st_ids = array(); @@ -178,7 +178,7 @@ function update_sales_order($order) } foreach ($order->line_items as $line) { - if ($loc_notification == 1 && is_inventory_item($line->stock_id)) + if ($SysPrefs->loc_notification() == 1 && is_inventory_item($line->stock_id)) $loc = calculate_reorder_level($order->Location, $line, $st_ids, $st_names, $st_num, $st_reorder); if (!$line->id) //new line @@ -215,7 +215,7 @@ function update_sales_order($order) hook_db_postwrite($order, $order->trans_type); commit_transaction(); - if ($loc_notification == 1 && count($st_ids) > 0) + if ($SysPrefs->loc_notification() == 1 && count($st_ids) > 0) send_reorder_email($loc, $st_ids, $st_names, $st_num, $st_reorder); } diff --git a/sales/inquiry/customer_allocation_inquiry.php b/sales/inquiry/customer_allocation_inquiry.php index 7fa66013..a1e0e552 100644 --- a/sales/inquiry/customer_allocation_inquiry.php +++ b/sales/inquiry/customer_allocation_inquiry.php @@ -20,7 +20,7 @@ include_once($path_to_root . "/sales/includes/sales_db.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Customer Allocation Inquiry"), false, false, "", $js); diff --git a/sales/inquiry/customer_inquiry.php b/sales/inquiry/customer_inquiry.php index 86b96588..43561213 100644 --- a/sales/inquiry/customer_inquiry.php +++ b/sales/inquiry/customer_inquiry.php @@ -21,7 +21,7 @@ include_once($path_to_root . "/reporting/includes/reporting.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Customer Transactions"), isset($_GET['customer_id']), false, "", $js); diff --git a/sales/inquiry/sales_deliveries_view.php b/sales/inquiry/sales_deliveries_view.php index f6ac03fa..91787385 100644 --- a/sales/inquiry/sales_deliveries_view.php +++ b/sales/inquiry/sales_deliveries_view.php @@ -20,7 +20,7 @@ include_once($path_to_root . "/reporting/includes/reporting.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 600); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); if (isset($_GET['OutstandingOnly']) && ($_GET['OutstandingOnly'] == true)) diff --git a/sales/inquiry/sales_orders_view.php b/sales/inquiry/sales_orders_view.php index b96b99dd..ae9a666e 100644 --- a/sales/inquiry/sales_orders_view.php +++ b/sales/inquiry/sales_orders_view.php @@ -73,7 +73,7 @@ else $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 600); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page($_SESSION['page_title'], false, false, "", $js); diff --git a/sales/manage/customers.php b/sales/manage/customers.php index 6515b8af..b007ac00 100644 --- a/sales/manage/customers.php +++ b/sales/manage/customers.php @@ -17,7 +17,7 @@ include_once($path_to_root . "/includes/session.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Customers"), @$_REQUEST['popup'], false, "", $js); diff --git a/sales/manage/recurrent_invoices.php b/sales/manage/recurrent_invoices.php index 999bccdb..c100204c 100644 --- a/sales/manage/recurrent_invoices.php +++ b/sales/manage/recurrent_invoices.php @@ -18,7 +18,7 @@ include_once($path_to_root . "/sales/includes/sales_db.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 600); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Recurrent Invoices"), false, false, "", $js); diff --git a/sales/sales_order_entry.php b/sales/sales_order_entry.php index 13a88349..ecca77d0 100644 --- a/sales/sales_order_entry.php +++ b/sales/sales_order_entry.php @@ -55,7 +55,7 @@ if ($use_popup_windows) { $js .= get_js_open_window(900, 500); } -if ($use_date_picker) { +if (user_use_date_picker()) { $js .= get_js_date_picker(); } @@ -505,7 +505,7 @@ if (isset($_POST['ProcessOrder']) && can_process()) { function check_item_data() { - global $SysPrefs, $allow_negative_prices; + global $SysPrefs; $is_inventory_item = is_inventory_item(get_post('stock_id')); if(!get_post('stock_id_text', true)) { @@ -517,7 +517,7 @@ function check_item_data() display_error( _("The item could not be updated because you are attempting to set the quantity ordered to less than 0, or the discount percent to more than 100.")); set_focus('qty'); return false; - } elseif (!check_num('price', 0) && (!$allow_negative_prices || $is_inventory_item)) { + } elseif (!check_num('price', 0) && (!SysPrefs->$allow_negative_prices() || $is_inventory_item)) { display_error( _("Price for inventory item must be entered and can not be less than 0")); set_focus('price'); return false; diff --git a/sql/alter2.4.php b/sql/alter2.4.php index 3f29a739..0a2584d3 100644 --- a/sql/alter2.4.php +++ b/sql/alter2.4.php @@ -35,7 +35,51 @@ class fa2_4 { if (get_company_pref('default_receival_required') === null) { // new in 2.4 installations set_company_pref('default_receival_required', 'glsetup.purchase', 'smallint', 6, 10); } - $result = $this->update_workorders() && $this->update_grn_rates() && $this->switch_database_to_utf($pref); + if (get_company_pref('default_quote_valid_days') === null) { // new in 2.3.23 installations + set_company_pref('default_quote_valid_days', 'glsetup.sales', 'smallint', 6, 30); + } + if (get_company_pref('no_zero_lines_amount') === null) { // new in 2.4 installations + set_company_pref('no_zero_lines_amount', 'glsetup.sales', 'tinyint', 1, '1'); + refresh_sys_prefs(); + } + if (get_company_pref('show_po_item_codes') === null) { // new in 2.4 installations + set_company_pref('show_po_item_codes', 'glsetup.purchase', 'tinyint', 1, '0'); + refresh_sys_prefs(); + } + if (get_company_pref('accounts_alpha') === null) { // new in 2.4 installations + set_company_pref('accounts_alpha', 'glsetup.general', 'tinyint', 1, '0'); + refresh_sys_prefs(); + } + if (get_company_pref('loc_notification') === null) { // new in 2.4 installations + set_company_pref('loc_notification', 'glsetup.inventory', 'tinyint', 1, '0'); + refresh_sys_prefs(); + } + if (get_company_pref('print_invoice_no') === null) { // new in 2.4 installations + set_company_pref('print_invoice_no', 'glsetup.sales', 'tinyint', 1, '0'); + refresh_sys_prefs(); + } + if (get_company_pref('allow_negative_prices') === null) { // new in 2.4 installations + set_company_pref('allow_negative_prices', 'glsetup.inventory', 'tinyint', 1, '1'); + refresh_sys_prefs(); + } + if (get_company_pref('print_item_images_on_quote') === null) { // new in 2.4 installations + set_company_pref('print_item_images_on_quote', 'glsetup.inventory', 'tinyint', 1, '0'); + refresh_sys_prefs(); + } + if (get_company_pref('bcc_email') === null) { // available from 2.3.14, can be not defined on pre-2.4 installations + set_company_pref('bcc_email', 'setup.company', 'varchar', 100, ''); + refresh_sys_prefs(); + } + if (get_company_pref('alternative_tax_include_on_docs') === null) { // available from 2.3.14, can be not defined on pre-2.4 installations + set_company_pref('alternative_tax_include_on_docs', 'setup.company', 'tinyint', 1, '0'); + refresh_sys_prefs(); + } + if (get_company_pref('suppress_tax_rates') === null) { // available from 2.3.14, can be not defined on pre-2.4 installations + set_company_pref('suppress_tax_rates', 'setup.company', 'tinyint', 1, '0'); + refresh_sys_prefs(); + } + +$result = $this->update_workorders() && $this->update_grn_rates() && $this->switch_database_to_utf($pref); if ($result) $result = $this->do_cleanup(); diff --git a/sql/alter2.4.sql b/sql/alter2.4.sql index 14afb1ae..dd300d2c 100644 --- a/sql/alter2.4.sql +++ b/sql/alter2.4.sql @@ -83,3 +83,8 @@ ALTER TABLE `0_stock_category` ADD COLUMN `dflt_no_purchase` tinyint(1) NOT NULL # added exchange rate field in grn_batch ALTER TABLE `0_grn_batch` ADD COLUMN `rate` double NULL default '1' AFTER `loc_code`; ALTER TABLE `0_users` CHANGE `query_size` `query_size` TINYINT(1) UNSIGNED NOT NULL DEFAULT 10; + +ALTER TABLE `0_users` ADD `save_report_selections` SMALLINT( 6 ) NOT NULL default '0' COMMENT 'Save Report Selection Days' AFTER `transaction_days`; +ALTER TABLE `0_users` ADD `use_date_picker` TINYINT(1) NOT NULL default '1' COMMENT 'Use Date Picker for all Date Values' AFTER `save_report_selections`; +ALTER TABLE `0_users` ADD `def_print_destination` TINYINT(1) NOT NULL default '0' COMMENT 'Default Report Destination' AFTER `use_date_picker`; +ALTER TABLE `0_users` ADD `def_print_orientation` TINYINT(1) NOT NULL default '0' COMMENT 'Default Report Orientation' AFTER `def_print_destination`; diff --git a/sql/en_US-demo.sql b/sql/en_US-demo.sql index aabfbb6f..fcef56ab 100644 --- a/sql/en_US-demo.sql +++ b/sql/en_US-demo.sql @@ -2063,6 +2063,7 @@ INSERT INTO `0_sys_prefs` VALUES('default_sales_discount_act', 'glsetup.sales', INSERT INTO `0_sys_prefs` VALUES('default_prompt_payment_act', 'glsetup.sales', 'varchar', 15, '4500'); INSERT INTO `0_sys_prefs` VALUES('default_delivery_required', 'glsetup.sales', 'smallint', 6, '1'); INSERT INTO `0_sys_prefs` VALUES('default_receival_required', 'glsetup.purchase', 'smallint', 6, '10'); +INSERT INTO `0_sys_prefs` VALUES('default_quote_valid_days', 'glsetup.sales', 'smallint', 6, '30'); INSERT INTO `0_sys_prefs` VALUES('default_dim_required', 'glsetup.dims', 'int', 11, '20'); INSERT INTO `0_sys_prefs` VALUES('pyt_discount_act', 'glsetup.purchase', 'varchar', 15, '5060'); INSERT INTO `0_sys_prefs` VALUES('creditors_act', 'glsetup.purchase', 'varchar', 15, '2100'); @@ -2081,6 +2082,18 @@ INSERT INTO `0_sys_prefs` VALUES('grn_clearing_act', 'glsetup.purchase', 'varcha INSERT INTO `0_sys_prefs` VALUES('bcc_email', 'setup.company', 'varchar', 100, ''); INSERT INTO `0_sys_prefs` VALUES('deferred_income_act', 'glsetup.sales', 'varchar', '15', ''); INSERT INTO `0_sys_prefs` VALUES('gl_closing_date','setup.closing_date', 'date', 8, ''); +INSERT INTO `0_sys_prefs` VALUES('alternative_tax_include_on_docs','setup.company', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES('suppress_tax_rates','setup.company', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES('no_zero_lines_amount','glsetup.sales', 'tinyint', 1, '1'); +INSERT INTO `0_sys_prefs` VALUES('show_po_item_codes','glsetup.purchase', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES('accounts_alpha','glsetup.general', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES('loc_notification','glsetup.inventory', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES('print_invoice_no','glsetup.sales', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES('allow_negative_prices','glsetup.inventory', 'tinyint', 1, '1'); +INSERT INTO `0_sys_prefs` VALUES('print_item_images_on_quote','glsetup.inventory', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES('alternative_tax_include_on_docs','setup.company', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES('suppress_tax_rates','setup.company', 'tinyint', 1, '0'); + -- -------------------------------------------------------- @@ -2328,6 +2341,10 @@ CREATE TABLE IF NOT EXISTS `0_users` ( `sticky_doc_date` tinyint(1) default '0', `startup_tab` varchar(20) NOT NULL default '', `transaction_days` smallint(6) NOT NULL default '30', + 'save_report_selections' smallint(6) NOT NULL default '0', + 'use_date_picker' tinyint(1) NOT NULL default '1', + 'def_print_destination' tinyint(1) NOT NULL default '0', + 'def_print_orientation' tinyint(1) NOT NULL default '0', `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `user_id` (`user_id`) @@ -2337,8 +2354,8 @@ CREATE TABLE IF NOT EXISTS `0_users` ( -- Dumping data for table `0_users` -- -INSERT INTO `0_users` VALUES(1, 'admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', 2, '', 'adm@adm.com', 'en_US', 0, 0, 0, 0, 'default', 'Letter', 2, 2, 4, 1, 1, 0, 0, '2014-05-11 23:27:46', 10, 1, 1, '1', 1, 0, 'orders', 30, 0); -INSERT INTO `0_users` VALUES(2, 'demouser', '5f4dcc3b5aa765d61d8327deb882cf99', 'Demo User', 9, '999-999-999', 'demo@demo.nu', 'en_US', 0, 0, 0, 0, 'default', 'Letter', 2, 2, 3, 1, 1, 0, 0, '2014-02-06 19:02:35', 10, 1, 1, '1', 1, 0, 'orders', 30, 0); +INSERT INTO `0_users` VALUES(1, 'admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', 2, '', 'adm@adm.com', 'en_US', 0, 0, 0, 0, 'default', 'Letter', 2, 2, 4, 1, 1, 0, 0, '2014-05-11 23:27:46', 10, 1, 1, '1', 1, 0, 'orders', 30, 0, 1, 0, 0, 0); +INSERT INTO `0_users` VALUES(2, 'demouser', '5f4dcc3b5aa765d61d8327deb882cf99', 'Demo User', 9, '999-999-999', 'demo@demo.nu', 'en_US', 0, 0, 0, 0, 'default', 'Letter', 2, 2, 3, 1, 1, 0, 0, '2014-02-06 19:02:35', 10, 1, 1, '1', 1, 0, 'orders', 30, 0, 1, 0, 0, 0); -- -------------------------------------------------------- diff --git a/sql/en_US-new.sql b/sql/en_US-new.sql index 7e77cb89..d46b8906 100644 --- a/sql/en_US-new.sql +++ b/sql/en_US-new.sql @@ -1824,6 +1824,7 @@ INSERT INTO `0_sys_prefs` VALUES('default_sales_discount_act', 'glsetup.sales', INSERT INTO `0_sys_prefs` VALUES('default_prompt_payment_act', 'glsetup.sales', 'varchar', 15, '4500'); INSERT INTO `0_sys_prefs` VALUES('default_delivery_required', 'glsetup.sales', 'smallint', 6, '1'); INSERT INTO `0_sys_prefs` VALUES('default_receival_required', 'glsetup.purchase', 'smallint', 6, '10'); +INSERT INTO `0_sys_prefs` VALUES('default_quote_valid_days', 'glsetup.sales', 'smallint', 6, '30'); INSERT INTO `0_sys_prefs` VALUES('default_dim_required', 'glsetup.dims', 'int', 11, '20'); INSERT INTO `0_sys_prefs` VALUES('pyt_discount_act', 'glsetup.purchase', 'varchar', 15, '5060'); INSERT INTO `0_sys_prefs` VALUES('creditors_act', 'glsetup.purchase', 'varchar', 15, '2100'); @@ -1842,6 +1843,17 @@ INSERT INTO `0_sys_prefs` VALUES('grn_clearing_act', 'glsetup.purchase', 'varcha INSERT INTO `0_sys_prefs` VALUES('bcc_email', 'setup.company', 'varchar', 100, ''); INSERT INTO `0_sys_prefs` VALUES('deferred_income_act', 'glsetup.sales', 'varchar', '15', ''); INSERT INTO `0_sys_prefs` VALUES('gl_closing_date','setup.closing_date', 'date', 8, ''); +INSERT INTO `0_sys_prefs` VALUES('alternative_tax_include_on_docs','setup.company', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES('suppress_tax_rates','setup.company', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES('no_zero_lines_amount','glsetup.sales', 'tinyint', 1, '1'); +INSERT INTO `0_sys_prefs` VALUES('show_po_item_codes','glsetup.purchase', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES('accounts_alpha','glsetup.general', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES('loc_notification','glsetup.inventory', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES('print_invoice_no','glsetup.sales', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES('allow_negative_prices','glsetup.inventory', 'tinyint', 1, '1'); +INSERT INTO `0_sys_prefs` VALUES('print_item_images_on_quote','glsetup.inventory', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES('alternative_tax_include_on_docs','setup.company', 'tinyint', 1, '0'); +INSERT INTO `0_sys_prefs` VALUES('suppress_tax_rates','setup.company', 'tinyint', 1, '0'); -- -------------------------------------------------------- @@ -2078,6 +2090,10 @@ CREATE TABLE IF NOT EXISTS `0_users` ( `sticky_doc_date` tinyint(1) default '0', `startup_tab` varchar(20) NOT NULL default '', `transaction_days` smallint(6) NOT NULL default '30', + 'save_report_selections' smallint(6) NOT NULL default '0', + 'use_date_picker' tinyint(1) NOT NULL default '1', + 'def_print_destination' tinyint(1) NOT NULL default '0', + 'def_print_orientation' tinyint(1) NOT NULL default '0', `inactive` tinyint(1) NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `user_id` (`user_id`) @@ -2087,7 +2103,7 @@ CREATE TABLE IF NOT EXISTS `0_users` ( -- Dumping data for table `0_users` -- -INSERT INTO `0_users` VALUES(1, 'admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', 2, '', 'adm@adm.com', 'en_US', 0, 0, 0, 0, 'default', 'Letter', 2, 2, 4, 1, 1, 0, 0, '2008-04-04 12:34:29', 10, 1, 1, '1', 1, 0, 'orders', 30, 0); +INSERT INTO `0_users` VALUES(1, 'admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', 2, '', 'adm@adm.com', 'en_US', 0, 0, 0, 0, 'default', 'Letter', 2, 2, 4, 1, 1, 0, 0, '2008-04-04 12:34:29', 10, 1, 1, '1', 1, 0, 'orders', 30, 0, 1, 0, 0, 0); -- -------------------------------------------------------- diff --git a/taxes/db/tax_groups_db.inc b/taxes/db/tax_groups_db.inc index 032cc560..aff2014d 100644 --- a/taxes/db/tax_groups_db.inc +++ b/taxes/db/tax_groups_db.inc @@ -89,12 +89,11 @@ function delete_tax_group_items($id) // function get_tax_group_rates($group_id=null, $tax_shipping=false) { - global $suppress_tax_rates; + global $SysPrefs; $sql = "SELECT t.id as tax_type_id," - .(isset($suppress_tax_rates) && $suppress_tax_rates == 1 - ? "t.name as tax_type_name," + .($SysPrefs->suppress_tax_rates() == 1 ? "t.name as tax_type_name," : "CONCAT(t.name, ' (', t.rate, '%)') as tax_type_name,") ."t.sales_gl_code, t.purchasing_gl_code, -- 2.30.2