Fixed incorect selection of invoices in Customer Payments/Payments To Supplier when...
authorJanusz Dobrowolski <janusz@frontaccouting.eu>
Wed, 12 Sep 2012 22:15:39 +0000 (00:15 +0200)
committerJanusz Dobrowolski <janusz@frontaccouting.eu>
Wed, 12 Sep 2012 22:15:39 +0000 (00:15 +0200)
purchasing/supplier_payment.php
sales/customer_payments.php

index 28f890a0fcc04a25cd8d23e03c4dd7e70f359fe8..aff82825edb15968fd0a36d46829ecdbc2eed6d7 100644 (file)
@@ -57,11 +57,6 @@ if (isset($_POST['_DatePaid_changed'])) {
   $Ajax->activate('_ex_rate');
 }
 
-if (list_updated('supplier_id') || list_updated('bank_account')) {
-  $_SESSION['alloc']->read();
-  $_POST['memo_'] = $_POST['amount'] = '';
-  $Ajax->activate('alloc_tbl');
-}
 //----------------------------------------------------------------------------------------
 
 if (!isset($_POST['bank_account'])) { // first page call
@@ -274,6 +269,12 @@ start_form();
 
     supplier_list_row(_("Payment To:"), 'supplier_id', null, false, true);
 
+       if (list_updated('supplier_id') || list_updated('bank_account')) {
+         $_SESSION['alloc']->read();
+         $_POST['memo_'] = $_POST['amount'] = '';
+         $Ajax->activate('alloc_tbl');
+       }
+
        set_global_supplier($_POST['supplier_id']);
        
        if (!list_updated('bank_account'))
index 34a862b1fc93e39c468bdfd73d46b8bdc69f7f60..b81b609cbd5e243f3ce829481f5f8f63accc37e8 100644 (file)
@@ -251,11 +251,6 @@ if (isset($_POST['ref']) && $_SESSION['alloc']->trans_no == 0) // added by Joe t
 }              
 $new = $_SESSION['alloc']->trans_no == 0;
 
-if (list_updated('customer_id') || ($new && list_updated('bank_account'))) {
-  $_SESSION['alloc']->read();
-  $_POST['memo_'] = $_POST['amount'] = $_POST['discount'] = '';
-  $Ajax->activate('alloc_tbl');
-}
 //----------------------------------------------------------------------------------------------
 
 if (isset($_POST['AddPaymentItem'])) {
@@ -346,6 +341,12 @@ start_form();
                hidden('customer_id', $_POST['customer_id']);
        }
 
+       if (list_updated('customer_id') || ($new && list_updated('bank_account'))) {
+               $_SESSION['alloc']->read();
+               $_POST['memo_'] = $_POST['amount'] = $_POST['discount'] = '';
+               $Ajax->activate('alloc_tbl');
+       }
+
        if (!isset($_POST['charge'])) // first page call
        {
                //Prepare allocation cart