Small warning cleanup in bank payment/deposit edition.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 15 Apr 2015 10:17:30 +0000 (12:17 +0200)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 15 Apr 2015 10:17:30 +0000 (12:17 +0200)
gl/includes/db/gl_db_banking.inc

index cbeea72bbcc647691a408729d48182cb43177946..9d5b9693879dd70ecaf61f00b735f7a0a37a6b9b 100644 (file)
@@ -416,7 +416,8 @@ function write_bank_transaction($trans_type, $trans_no, $from_account, $items, $
                $old_trans = $trans_no;
                $Refs->restore_last($trans_type, $trans_no);
                $aid = has_attachment($trans_type, $trans_no);
-       }
+       } else
+               $old_trans = false;
 
        $currency = get_bank_account_currency($from_account);
        $bank_gl_account = get_bank_gl_account($from_account);
@@ -438,7 +439,8 @@ function write_bank_transaction($trans_type, $trans_no, $from_account, $items, $
 
                $trans_no = write_customer_trans($trans_type, 0, $person_id, $person_detail_id, $date_,
                $ref, $cust_amount);
-               move_trans_attachments($trans_type, $old_trans, $trans_no);
+               if ($old_trans)
+                       move_trans_attachments($trans_type, $old_trans, $trans_no);
     }
     elseif ($person_type_id == PT_SUPPLIER)
     {
@@ -454,7 +456,8 @@ function write_bank_transaction($trans_type, $trans_no, $from_account, $items, $
 
                $trans_no = write_supp_trans($trans_type, 0, $person_id, $date_, '',
                        $ref, "", $supp_amount, 0, 0);
-               move_trans_attachments($trans_type, $old_trans, $trans_no);
+               if ($old_trans)
+                       move_trans_attachments($trans_type, $old_trans, $trans_no);
     }
     else
     {
@@ -535,7 +538,7 @@ function write_bank_transaction($trans_type, $trans_no, $from_account, $items, $
 
        // old transaction can be voided only after new transaction is entered,
        //  otherwise the operation could fail for cash accounts due to temporary negative balance
-       if (@$old_trans) 
+       if ($old_trans) 
        {
                $msg = void_transaction($trans_type, $old_trans, Today(), _("Document reentered."));
                if ($msg)