Skip to content
Permalink
Browse files

Auto Increase of Document References (company setup)

  • Loading branch information...
joe-hunt committed Apr 16, 2018
1 parent 67b2242 commit 469ef80b1b4e95284a1f2469205a63161282276d
Showing with 18 additions and 4 deletions.
  1. +8 −1 admin/company_preferences.php
  2. +10 −3 sales/includes/cart_class.inc
@@ -113,7 +113,7 @@
'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',
'no_supplier_list' =>0, 'base_sales', 'ref_no_auto_increase' => 0,
'time_zone' => 0, 'company_logo_report' => 0, 'barcodes_on_stock' => 0, 'add_pct', 'round_to', 'login_tout',
'auto_curr_reval', 'bcc_email', 'alternative_tax_include_on_docs', 'suppress_tax_rates',
'use_manufacturing', 'use_fixed_assets'))
@@ -161,6 +161,12 @@
$myrow["company_logo_report"] = get_company_pref("company_logo_report");
}
$_POST['company_logo_report'] = $myrow["company_logo_report"];
if (!isset($myrow["ref_no_auto_increase"]))
{
set_company_pref("ref_no_auto_increase", "setup.company", "tinyint", 1, '0');
$myrow["ref_no_auto_increase"] = get_company_pref("ref_no_auto_increase");
}
$_POST['ref_no_auto_increase'] = $myrow["ref_no_auto_increase"];
if (!isset($myrow["barcodes_on_stock"]))
{
set_company_pref("barcodes_on_stock", "setup.company", "tinyint", 1, '0');
@@ -208,6 +214,7 @@
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']);
label_row(_("Database Scheme Version"), $_POST['version_id']);
table_section(2);
@@ -285,12 +285,19 @@ class Cart
// Makes parent documents for direct delivery/invoice by recurent call.
// $policy - 0 or 1: writeoff/return for IV, back order/cancel for DN
function write($policy=0) {
global $SysPrefs, $Refs;
begin_transaction(); // prevents partial database changes in case of direct delivery/invoice
if ($this->reference != 'auto' && $this->trans_no == 0 && !is_new_reference($this->reference, $this->trans_type))
{
commit_transaction();
return -1;
if (!empty($SysPrefs->prefs['ref_no_auto_increase']))
$this->reference = $Refs->get_next($this->trans_type, null, array('date' => Today()));
if (!is_new_reference($this->reference, $this->trans_type))
{
commit_transaction();
return -1;
}
}
if (count($this->src_docs) == 0 && ($this->trans_type == ST_SALESINVOICE || $this->trans_type == ST_CUSTDELIVERY) && !$this->is_prepaid()) {
// this is direct document - first add parent

2 comments on commit 469ef80

@apmuthu

This comment has been minimized.

Copy link
Contributor

replied Apr 16, 2018

Update the standard Charts (and upgrade script) to reflect default value for the new flag.

@apmuthu

This comment has been minimized.

Copy link
Contributor

replied Apr 16, 2018

companysetup_newflag

Please sign in to comment.
You can’t perform that action at this time.