From 7226477a2624571ba8460f773092f6e38bbc46f3 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Sat, 16 May 2020 15:29:39 +0200 Subject: [PATCH] Recurring invoices result in no dimensions on gl_trans. Fixed by company flag option. --- admin/company_preferences.php | 13 ++++++++++--- sales/create_recurrent_invoices.php | 7 +++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/admin/company_preferences.php b/admin/company_preferences.php index f4e7f926..8090d18e 100644 --- a/admin/company_preferences.php +++ b/admin/company_preferences.php @@ -136,8 +136,8 @@ if (isset($_POST['update']) && $_POST['update'] != "") get_post( array('coy_name','coy_no','gst_no','tax_prd','tax_last', 'postal_address','phone', 'fax', 'email', 'coy_logo', 'domicile', 'use_dimension', 'curr_default', 'f_year', 'shortname_name_in_list', - 'no_item_list' => 0, 'no_customer_list' => 0, - 'no_supplier_list' =>0, 'base_sales', 'ref_no_auto_increase' => 0, + 'no_item_list' => 0, 'no_customer_list' => 0, 'no_supplier_list' => 0, + 'base_sales', 'ref_no_auto_increase' => 0, 'dim_on_recurrent_invoice' => 0, 'time_zone' => 0, 'company_logo_report' => 0, 'barcodes_on_stock' => 0, 'print_dialog_direct' => 0, 'add_pct', 'round_to', 'login_tout', 'auto_curr_reval', 'bcc_email', 'alternative_tax_include_on_docs', 'suppress_tax_rates', 'use_manufacturing', 'use_fixed_assets')) @@ -203,6 +203,12 @@ if (!isset($myrow["print_dialog_direct"])) $myrow["print_dialog_direct"] = get_company_pref("print_dialog_direct"); } $_POST['print_dialog_direct'] = $myrow["print_dialog_direct"]; +if (!isset($myrow["dim_on_recurrent_invoice"])) +{ + set_company_pref("dim_on_recurrent_invoice", "setup.company", "tinyint", 1, '0'); + $myrow["dim_on_recurrent_invoice"] = get_company_pref("dim_on_recurrent_invoice"); +} +$_POST['dim_on_recurrent_invoice'] = $myrow["dim_on_recurrent_invoice"]; $_POST['version_id'] = $myrow["version_id"]; $_POST['add_pct'] = $myrow['add_pct']; $_POST['login_tout'] = $myrow['login_tout']; @@ -240,11 +246,11 @@ label_row(_("Company Logo:"), $_POST['coy_logo']); file_row(_("New Company Logo (.jpg)") . ":", 'pic', 'pic'); check_row(_("Delete Company Logo:"), 'del_coy_logo', $_POST['del_coy_logo']); -check_row(_("Automatic Revaluation Currency Accounts"), 'auto_curr_reval', $_POST['auto_curr_reval']); check_row(_("Time Zone on Reports"), 'time_zone', $_POST['time_zone']); check_row(_("Company Logo on Reports"), 'company_logo_report', $_POST['company_logo_report']); check_row(_("Use Barcodes on Stocks"), 'barcodes_on_stock', $_POST['barcodes_on_stock']); check_row(_("Auto Increase of Document References"), 'ref_no_auto_increase', $_POST['ref_no_auto_increase']); +check_row(_("Use Dimensions on Recurrent Invoices"), 'dim_on_recurrent_invoice', $_POST['dim_on_recurrent_invoice']); label_row(_("Database Scheme Version"), $_POST['version_id']); table_section(2); @@ -255,6 +261,7 @@ 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); +check_row(_("Automatic Revaluation Currency Accounts"), 'auto_curr_reval', $_POST['auto_curr_reval']); table_section_title(_("Sales Pricing")); sales_types_list_row(_("Base for auto price calculations:"), 'base_sales', $_POST['base_sales'], false, diff --git a/sales/create_recurrent_invoices.php b/sales/create_recurrent_invoices.php index 3f359f8c..ea71fd3a 100644 --- a/sales/create_recurrent_invoices.php +++ b/sales/create_recurrent_invoices.php @@ -27,12 +27,15 @@ page(_($help_context = "Create and Print Recurrent Invoices"), false, false, "", function create_recurrent_invoices($customer_id, $branch_id, $order_no, $tmpl_no, $date, $from, $to, $memo) { - global $Refs; + global $Refs, $SysPrefs; update_last_sent_recurrent_invoice($tmpl_no, $to); $doc = new Cart(ST_SALESORDER, array($order_no)); - + + if (!empty($SysPrefs->prefs['dim_on_recurrent_invoice'])) + $doc->trans_type = ST_SALESINVOICE; + get_customer_details_to_order($doc, $customer_id, $branch_id); $doc->trans_type = ST_SALESORDER; -- 2.30.2