X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=purchasing%2Fincludes%2Fdb%2Fsupp_payment_db.inc;h=cec8f351b10b4c0fee198614a6c53719e62e2b1c;hb=9a98bb3bc7a94f1a8e47f8dab45a87c8b4212080;hp=32b35041b90bbf799802d0372b1fedaf1443f925;hpb=36e8f1c2c571d4d606839f94ce1e6a88384cb44e;p=fa-stable.git diff --git a/purchasing/includes/db/supp_payment_db.inc b/purchasing/includes/db/supp_payment_db.inc index 32b35041..cec8f351 100644 --- a/purchasing/includes/db/supp_payment_db.inc +++ b/purchasing/includes/db/supp_payment_db.inc @@ -15,6 +15,11 @@ function add_supp_payment($supplier_id, $date_, $bank_account, global $Refs; begin_transaction(); + $args = func_get_args(); while (count($args) < 9) $args[] = 0; + $args = (object)array_combine(array('supplier_id', 'date_', 'bank_account', + 'amount', 'discount', 'ref', 'memo_', 'rate', 'charge'), $args); + $args->trans_no = 0; + hook_db_prewrite( $args, ST_SUPPAYMENT); $supplier_currency = get_supplier_currency($supplier_id); $bank_account_currency = get_bank_account_currency($bank_account); @@ -57,7 +62,7 @@ function add_supp_payment($supplier_id, $date_, $bank_account, if ($supp_charge != 0) { - $charge_act = get_company_pref('bank_charge_act'); + $charge_act = get_bank_charge_account($bank_account); $total += add_gl_trans_supplier($trans_type, $payment_id, $date_, $charge_act, 0, 0, $supp_charge, $supplier_id, "", $rate); } @@ -81,6 +86,8 @@ function add_supp_payment($supplier_id, $date_, $bank_account, $Refs->save($trans_type, $payment_id, $ref); + $args->trans_no = $payment_id; + hook_db_postwrite($args, ST_SUPPAYMENT); commit_transaction(); return $payment_id; @@ -91,6 +98,7 @@ function add_supp_payment($supplier_id, $date_, $bank_account, function void_supp_payment($type, $type_no) { begin_transaction(); + hook_db_prevoid($type, $type_no); void_bank_trans($type, $type_no, true); void_gl_trans($type, $type_no, true);