From 0354fb9befaf2f59c679d13779d75b109784bf46 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Wed, 20 Nov 2013 16:09:52 +0100 Subject: [PATCH] Supplier Payments: Fixed error during payment allocation in strict MySQL mode. --- includes/ui/allocation_cart.inc | 5 +++-- purchasing/includes/db/suppalloc_db.inc | 5 ++++- purchasing/supplier_payment.php | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/includes/ui/allocation_cart.inc b/includes/ui/allocation_cart.inc index 1be54f5c..2821fe5f 100644 --- a/includes/ui/allocation_cart.inc +++ b/includes/ui/allocation_cart.inc @@ -33,7 +33,7 @@ class allocation function allocation($type, $trans_no, $person_id = null, $person_type_id=null) { $this->allocs = array(); - + $this->trans_no = $trans_no; $this->type = $type; if ($person_id) @@ -132,7 +132,8 @@ class allocation $this->currency = isset($trans['bank_curr_code']) ? $trans['bank_curr_code'] : $trans['curr_code']; $this->bank_amount = @$trans["bank_amount"]; $this->amount = $trans["Total"]; - } + } else + $this->date_ = Today(); } /* Now populate the array of possible (and previous actual) allocations for this customer/supplier. First get the transactions that have diff --git a/purchasing/includes/db/suppalloc_db.inc b/purchasing/includes/db/suppalloc_db.inc index 92d4e750..f13d2e4e 100644 --- a/purchasing/includes/db/suppalloc_db.inc +++ b/purchasing/includes/db/suppalloc_db.inc @@ -12,8 +12,11 @@ //---------------------------------------------------------------------------------------- function add_supp_allocation($amount, $trans_type_from, $trans_no_from, - $trans_type_to, $trans_no_to, $date_) + $trans_type_to, $trans_no_to, $date_=null) { + if (!$date_) + $date = Today(); + $date = date2sql($date_); $sql = "INSERT INTO ".TB_PREF."supp_allocations ( amt, date_alloc, diff --git a/purchasing/supplier_payment.php b/purchasing/supplier_payment.php index b3fe7cee..b4e6c878 100644 --- a/purchasing/supplier_payment.php +++ b/purchasing/supplier_payment.php @@ -237,6 +237,7 @@ function handle_add_payment() new_doc_date($_POST['DatePaid']); $_SESSION['alloc']->trans_no = $payment_id; + $_SESSION['alloc']->date_ = $_POST['DatePaid']; $_SESSION['alloc']->write(); unset($_POST['bank_account']); -- 2.30.2