Supplier Payments: Fixed error during payment allocation in strict MySQL mode.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 20 Nov 2013 15:09:52 +0000 (16:09 +0100)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 20 Nov 2013 15:09:52 +0000 (16:09 +0100)
includes/ui/allocation_cart.inc
purchasing/includes/db/suppalloc_db.inc
purchasing/supplier_payment.php

index 1be54f5ca61442256d3eedde74d47efbf7172178..2821fe5fe7874786443bb72f0a65ea0e50c669c7 100644 (file)
@@ -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 
index 92d4e750db3add241e1d8a59b087bfb933b9a808..f13d2e4e17f0f46c78b5cd39423c2369aac2f1de 100644 (file)
 //----------------------------------------------------------------------------------------
 
 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,
index b3fe7ceeaefc241a3a35141d238e500edd2c969a..b4e6c87864d7ee66a19765bd971386255c541e8d 100644 (file)
@@ -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']);