Passing error message parameter err_msg to low level db functions from caller does...
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 12 Jul 2019 19:48:58 +0000 (21:48 +0200)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 19 Aug 2019 10:41:58 +0000 (12:41 +0200)
15 files changed:
gl/includes/db/gl_db_bank_trans.inc
gl/includes/db/gl_db_banking.inc
gl/includes/db/gl_db_trans.inc
includes/ui/items_cart.inc
manufacturing/includes/db/work_order_costing_db.inc
purchasing/includes/db/grn_db.inc
purchasing/includes/db/invoice_db.inc
purchasing/includes/db/supp_payment_db.inc
purchasing/includes/db/supp_trans_db.inc
purchasing/includes/purchasing_db.inc
sales/includes/db/payment_db.inc
sales/includes/db/sales_credit_db.inc
sales/includes/db/sales_delivery_db.inc
sales/includes/db/sales_invoice_db.inc
sales/includes/sales_db.inc

index 8c63f64573bf3bdfd5ac7f1f1e76a22d7177c5d4..1bea79a3ef3918629de5b2172caa6645579d2f67 100644 (file)
@@ -16,7 +16,7 @@
 // $date_ is display date (non-sql)
 
 function add_bank_trans($type, $trans_no, $bank_act, $ref, $date_,
-       $amount, $person_type_id, $person_id, $currency="", $err_msg="", $rate=0)
+       $amount, $person_type_id, $person_id, $currency="", $rate=0)
 {
        $sqlDate = date2sql($date_);
 
@@ -41,10 +41,7 @@ function add_bank_trans($type, $trans_no, $bank_act, $ref, $date_,
                ".db_escape($amount_bank).", ".db_escape($person_type_id)
                .", ". db_escape($person_id).")";
 
-       if ($err_msg == "")
-               $err_msg = "The bank transaction could not be inserted";
-
-       db_query($sql, $err_msg);
+       db_query($sql, "The bank transaction could not be inserted");
 }
 
 //----------------------------------------------------------------------------------------
index a7ad5576093a7f8501f923cf71f59e015d5029d0..a2cf9f78db893d7426ac7769d9b4a0e5f83d507f 100644 (file)
@@ -237,8 +237,7 @@ function add_bank_transfer($from_account, $to_account, $date_,
 
     add_bank_trans($trans_type, $trans_no, $from_account, $ref,
                $date_, -($amount + $charge),
-               PT_MISC, $person_id, $currency,
-               "Cannot insert a source bank transaction");
+               PT_MISC, $person_id, $currency);
        if ($SysPrefs->auto_currency_revaluation())
        {
                $trans_no1 = get_next_trans_no(ST_JOURNAL);
@@ -270,8 +269,7 @@ function add_bank_transfer($from_account, $to_account, $date_,
                        0, 0, _("Exchange Variance"), -$total);
        
        add_bank_trans($trans_type, $trans_no, $to_account, $ref,
-               $date_, $to_amount, PT_MISC, $person_id,
-               $to_currency, "Cannot insert a destination bank transaction");
+               $date_, $to_amount, PT_MISC, $person_id);
 
        if ($SysPrefs->auto_currency_revaluation())
        {
@@ -467,8 +465,7 @@ function write_bank_transaction($trans_type, $trans_no, $from_account, $items, $
     add_bank_trans($trans_type, $trans_no, $from_account, $ref,
        $date_, -$total_amount,
        $person_type_id, $person_id,
-       $currency,
-       "Cannot insert a source bank transaction");
+       $currency);
        $total = 0;
        foreach ($items->gl_items as $gl_item)
        {
@@ -489,8 +486,7 @@ function write_bank_transaction($trans_type, $trans_no, $from_account, $items, $
        {
                add_bank_trans($trans_type, $trans_no, $is_bank_to, $ref,
                        $date_, $gl_item->amount,
-                       $person_type_id, $person_id, $currency,
-                       "Cannot insert a destination bank transaction");
+                       $person_type_id, $person_id, $currency);
                if ($do_exchange_variance)
                {
                        add_exchange_variation($trans_no1, $date_, $is_bank_to, $gl_item->code_id, 
index 55d1ccc427f6242363d15641b5a902202548b056..229ba2d1d8dd6fe7b72ef5c8808c7dbc5cd9ae40 100644 (file)
@@ -17,7 +17,7 @@
 // if $currency is not set, then defaults to no conversion
 
 function add_gl_trans($type, $trans_id, $date_, $account, $dimension, $dimension2, $memo_,
-       $amount, $currency=null, $person_type_id=null, $person_id=null, $err_msg="", $rate=0)
+       $amount, $currency=null, $person_type_id=null, $person_id=null, $rate=0)
 {
        global $SysPrefs;
 
@@ -63,10 +63,7 @@ function add_gl_trans($type, $trans_id, $date_, $account, $dimension, $dimension
 
        $sql .= ") ";
 
-       if ($err_msg == "")
-               $err_msg = "The GL transaction could not be inserted";
-
-       db_query($sql, $err_msg);
+       db_query($sql, "The GL transaction could not be inserted");
        return $amount_in_home_currency;
 }
 
@@ -77,12 +74,12 @@ function add_gl_trans($type, $trans_id, $date_, $account, $dimension, $dimension
 // $amount is in HOME currency
 
 function add_gl_trans_std_cost($type, $trans_id, $date_, $account, $dimension, $dimension2,
-       $memo_, $amount, $person_type_id=null, $person_id=null, $err_msg="")
+       $memo_, $amount, $person_type_id=null, $person_id=null)
 {
 
        if ($amount != 0)
                return add_gl_trans($type, $trans_id, $date_, $account, $dimension, $dimension2, $memo_,
-                       $amount, null, $person_type_id, $person_id, $err_msg);
+                       $amount, null, $person_type_id, $person_id);
        else
                return 0;
 }
@@ -96,7 +93,7 @@ function add_gl_balance($type, $trans_id, $date_, $amount, $person_type_id=null,
        {
                error_log(sprintf( _("Rounding error %s encountered for trans_type:%s,trans_no:%s"), $amount, $type, $trans_id));
                return add_gl_trans($type, $trans_id, $date_, get_company_pref('exchange_diff_act'), 0, 0, "",
-                       $amount, null, $person_type_id, $person_id, "The balanced GL transaction could not be inserted");
+                       $amount, null, $person_type_id, $person_id);
        } else
                return 0;
 }
index 416719e1f194ed15759482dae462da906744a7b8..a9bcc5798c1c8141084e1b61025487ac9bdc3207 100644 (file)
@@ -367,7 +367,7 @@ class items_cart
                                $gl->date = $this->tran_date;
 
                        $total_gl += add_gl_trans($this->trans_type, $this->order_id, $gl->date, $gl->code_id, $gl->dimension_id, $gl->dimension2_id, 
-                               $gl->reference, $gl->amount, $this->currency, $gl->person_type_id, $gl->person_id, "", $this->rate);
+                               $gl->reference, $gl->amount, $this->currency, $gl->person_type_id, $gl->person_id, $this->rate);
 
                        // post to first found bank account using given gl acount code.
                        $is_bank_to = is_bank_account($gl->code_id);
@@ -397,8 +397,7 @@ class items_cart
                // update bank ledger if used
                foreach($bank_trans as $bank_id => $amount)
                        add_bank_trans($this->trans_type, $this->order_id, $bank_id, $this->reference,
-                               $this->tran_date, $amount, 0, "", $this->currency,
-                               "Cannot insert a destination bank transaction");
+                               $this->tran_date, $amount, 0, "", $this->currency);
 
                // add AP/AR for journal transaction
                if ($this->trans_type == ST_JOURNAL)
index 99cd1a5cfbd6304990cae54e5d617ba12a79e584..3641d8f7465de7585959b69bc6de21d54b12a990 100644 (file)
@@ -135,8 +135,7 @@ function add_wo_costs_journal($wo_id, $amount, $cost_type, $cr_acc, $date, $dim1
        if ($is_bank_to)
        {
                add_bank_trans(ST_JOURNAL, $journal_id, $is_bank_to, "",
-                       $date, -$amount, PT_WORKORDER, $wo_id, get_company_currency(),
-                       "Cannot insert a destination bank transaction");
+                       $date, -$amount, PT_WORKORDER, $wo_id, get_company_currency());
        }
        add_journal(ST_JOURNAL, $journal_id, $amount, $date, get_company_currency(), $ref, '', 1, $date, $date);
 
index 886e05fc5f5c2b3cb6082d740a06b0ab0c284172..948f2c0664617efa60803ea722e8c9937b95c9e6 100644 (file)
@@ -129,7 +129,7 @@ function write_grn(&$po)
                                if ($clearing_act)
                                        $total += add_gl_trans_supplier(ST_SUPPRECEIVE, $grn, $date_, $stock_gl_code["inventory_account"],
                                                $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'],
-                                           $order_line->taxfree_charge_value($po), $po->supplier_id, '', 0, $order_line->stock_id);
+                                           $order_line->taxfree_charge_value($po), $po->supplier_id, 0, $order_line->stock_id);
                                update_average_material_cost($po->supplier_id, $order_line->stock_id, $order_line->price,
                                        $order_line->quantity, $date_);
                        }
index e2da684c2f7f167a110100b482b343d85c0629ff..de085139e636d597f468dfe5a9c3c4a9ea8c609b 100644 (file)
@@ -151,7 +151,7 @@ function add_supp_invoice(&$supp_trans)  //, $already_voided=false, $allocs=null
 
        // store basic transaction info
        $invoice_id = write_supp_trans($trans_type, 0, $supp_trans->supplier_id, $supp_trans->tran_date, $supp_trans->due_date,
-               $supp_trans->reference, $supp_trans->supp_reference, 0, 0, 0, "", $supp_trans->ex_rate, $supp_trans->tax_included);
+               $supp_trans->reference, $supp_trans->supp_reference, 0, 0, 0, $supp_trans->ex_rate, $supp_trans->tax_included);
 
        if ($trans_no)
                move_trans_attachments($trans_type, $trans_no, $invoice_id);
index 8cbc4413dc41573a19f3a780b6f429055feea6dd..40bafa3f16ffc8a70858252cad37f6089d2a07a6 100644 (file)
@@ -44,20 +44,20 @@ function write_supp_payment($trans_no, $supplier_id, $bank_account,
 
        /* Create a supp_trans entry for the supplier payment */
        $payment_id = write_supp_trans(ST_SUPPAYMENT, 0, $supplier_id, $date_, $date_,
-               $ref, "", -$supp_amount, 0, -$supp_discount, "", $rate);
+               $ref, "", -$supp_amount, 0, -$supp_discount, $rate);
 
        // Now debit creditors account with payment + discount
 
        $total = 0;
     $supplier_accounts = get_supplier_accounts($supplier_id);
        $total += add_gl_trans_supplier(ST_SUPPAYMENT, $payment_id, $date_, $supplier_accounts["payable_account"], 0, 0,
-               $supp_amount + $supp_discount, $supplier_id, "", $rate);
+               $supp_amount + $supp_discount, $supplier_id, $rate);
 
        // Now credit discount received account with discounts
        if ($supp_discount != 0)
        {
                $total += add_gl_trans_supplier(ST_SUPPAYMENT, $payment_id, $date_, $supplier_accounts["payment_discount_account"], 0, 0,
-                       -$supp_discount, $supplier_id, "", $rate);
+                       -$supp_discount, $supplier_id, $rate);
        }
 
        if ($bank_charge != 0)
index 618ddeeb1f82f8e2fe2ae140916618bc26ca4c87..f9781392c4c1df09e04ea6b2a0208ea01901ffd9 100644 (file)
@@ -14,7 +14,7 @@
 //     FIXME - this should be revised for transaction update case.
 //
 function write_supp_trans($type, $trans_no, $supplier_id, $date_, $due_date, $reference, $supp_reference,
-       $amount, $amount_tax, $discount, $err_msg="", $rate=0, $included=0)
+       $amount, $amount_tax, $discount, $rate=0, $included=0)
 {
        $new = $trans_no==0;
        $date = date2sql($date_);
@@ -39,10 +39,7 @@ function write_supp_trans($type, $trans_no, $supplier_id, $date_, $due_date, $re
                ".db_escape($reference).", ".db_escape($supp_reference).", ".db_escape($amount)
                .", ".db_escape($amount_tax).", ".db_escape($rate).", ".db_escape($discount).", ".db_escape($included).")";
 
-       if ($err_msg == "")
-               $err_msg = "Cannot insert a supplier transaction record";
-
-       db_query($sql, $err_msg);
+       db_query($sql, "Cannot insert a supplier transaction record");
        add_audit_trail($type, $trans_no, $date_);
 
        return $trans_no;
index 745b175b2ec375260be392d531303f1f5aa253db..cffd2210d5320bf9d71bd1ebe0d79e7d4c4ffe60 100644 (file)
@@ -33,14 +33,11 @@ include_once($path_to_root . "/purchasing/includes/db/suppliers_db.inc");
 // $amount is in SUPPLIERS'S currency
 
 function add_gl_trans_supplier($type, $type_no, $date_, $account, $dimension, $dimension2,  
-       $amount, $supplier_id, $err_msg="", $rate=0, $memo="")
+       $amount, $supplier_id, $rate=0, $memo="")
 {
-       if ($err_msg == "")
-               $err_msg = "The supplier GL transaction could not be inserted"; 
-               
        return add_gl_trans($type, $type_no, $date_, $account, $dimension, $dimension2, $memo, 
                $amount, get_supplier_currency($supplier_id), 
-               PT_SUPPLIER, $supplier_id, $err_msg, $rate);
+               PT_SUPPLIER, $supplier_id, $rate);
 }
 
 //----------------------------------------------------------------------------------------
index 766648533351281e718ebcde127902624c4722e8..9560179f1b7131e2b7e82c1144604f319a392289 100644 (file)
@@ -78,14 +78,12 @@ function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_accou
        if (($discount + $amount) != 0) {
        /* Now Credit Debtors account with receipts + discounts */
        $total += add_gl_trans_customer(ST_CUSTPAYMENT, $payment_no, $date_,
-               $debtors_account, 0, 0, -($discount + $amount), $customer_id,
-               "Cannot insert a GL transaction for the debtors account credit");
+               $debtors_account, 0, 0, -($discount + $amount), $customer_id);
        }
        if ($discount != 0)     {
                /* Now Debit discount account with discounts allowed*/
                $total += add_gl_trans_customer(ST_CUSTPAYMENT, $payment_no, $date_,
-                       $discount_account, 0, 0, $discount, $customer_id,
-                       "Cannot insert a GL transaction for the payment discount debit");
+                       $discount_account, 0, 0, $discount, $customer_id);
        }
 
        if ($charge != 0)       {
index 6c3a8f28b739eb6faef3ee2dd55c43dd824af65a..43b6e3081c466128c46d60979d76db342e24c761 100644 (file)
@@ -136,14 +136,12 @@ function write_credit_note(&$credit_note, $write_off_acc)
 
                $total += add_gl_trans_customer(ST_CUSTCREDIT, $credit_no, $credit_date, $branch_data["receivables_account"], 0, 0,
                        -($credit_note_total + $credit_note->freight_cost + $items_added_tax + $freight_added_tax),
-                       $credit_note->customer_id,
-                       "The total debtor GL posting for the credit note could not be inserted");
+                       $credit_note->customer_id);
        }
 
        if ($credit_note->freight_cost != 0) {
                $total += add_gl_trans_customer(ST_CUSTCREDIT, $credit_no, $credit_date, $company_data["freight_act"], 0, 0,
-                       $credit_note->get_tax_free_shipping(), $credit_note->customer_id,
-                       "The freight GL posting for this credit note could not be inserted");
+                       $credit_note->get_tax_free_shipping(), $credit_note->customer_id);
        }
 
        foreach ($taxes as $taxitem) {
@@ -156,8 +154,7 @@ function write_credit_note(&$credit_note, $write_off_acc)
                                $credit_note->document_date, $credit_note->reference, TR_OUTPUT, $credit_note->tax_group_id);
 
                        $total += add_gl_trans_customer(ST_CUSTCREDIT, $credit_no, $credit_date, $taxitem['sales_gl_code'], 0, 0,
-                               $taxitem['Value'], $credit_note->customer_id,
-                               "A tax GL posting for this credit note could not be inserted");
+                               $taxitem['Value'], $credit_note->customer_id);
                }
        }
        /*Post a balance post if $total != 0 */
@@ -216,8 +213,7 @@ function add_gl_trans_credit_costs($order, $order_line, $credit_no, $date_,
 
                $total += add_gl_trans_std_cost(ST_CUSTCREDIT, $credit_no, $date_, $stock_gl_codes["cogs_account"],
                        $dim, $dim2, "", -($unit_cost * $order_line->qty_dispatched),
-                       PT_CUSTOMER, $order->customer_id,
-                       "The cost of sales GL posting could not be inserted");
+                       PT_CUSTOMER, $order->customer_id);
 
                /*now the stock entry*/
                if ($credit_type == "WriteOff") {
@@ -229,8 +225,7 @@ function add_gl_trans_credit_costs($order, $order_line, $credit_no, $date_,
 
                $total += add_gl_trans_std_cost(ST_CUSTCREDIT, $credit_no, $date_, $stock_entry_account, 0, 0,
                        "", ($unit_cost * $order_line->qty_dispatched),
-                       PT_CUSTOMER, $order->customer_id,
-                       "The stock side (or write off) of the cost of sales GL posting could not be inserted");
+                       PT_CUSTOMER, $order->customer_id);
 
        } /* end of if GL and stock integrated and standard cost !=0 */
 
@@ -253,15 +248,13 @@ function add_gl_trans_credit_costs($order, $order_line, $credit_no, $date_,
                else
                        $sales_account = $stock_gl_codes['sales_account'];
                $total += add_gl_trans_customer(ST_CUSTCREDIT, $credit_no, $date_, $sales_account, $dim, $dim2,
-                       ($line_taxfree_price * $order_line->qty_dispatched), $order->customer_id,
-                       "The credit note GL posting could not be inserted");
+                       ($line_taxfree_price * $order_line->qty_dispatched), $order->customer_id);
 
                if ($order_line->discount_percent != 0) {
 
                        $total += add_gl_trans_customer(ST_CUSTCREDIT, $credit_no, $date_, $branch_data["sales_discount_account"],
                                $dim, $dim2, -($line_taxfree_price * $order_line->qty_dispatched * $order_line->discount_percent),
-                               $order->customer_id,
-                               "The credit note discount GL posting could not be inserted");
+                               $order->customer_id);
 
                } /*end of if discount !=0 */
        } /*if line_price!=0 */
index f1ae7a8acceeb5dfb0b78347776e4d1ada277e7a..18faa0be27f1e16bf3148cce546e49440c8f3595 100644 (file)
@@ -120,7 +120,7 @@ function write_sales_delivery(&$delivery,$bo_policy)
                                $sales_account = ($branch_data['sales_account'] != "" ? $branch_data['sales_account'] : $stock_gl_code['sales_account']);
 
                                $total += add_gl_trans_customer(ST_CUSTDELIVERY, $delivery_no, $delivery->document_date, $sales_account, $dim, $dim2,
-                                       -$line_taxfree_price, $delivery->customer_id, "The sales price GL posting could not be inserted");
+                                       -$line_taxfree_price, $delivery->customer_id);
                        }
                        /* insert gl_trans to credit stock and debit cost of sales at standard cost*/
                        
@@ -133,20 +133,17 @@ function write_sales_delivery(&$delivery,$bo_policy)
                                        add_gl_trans_std_cost(ST_CUSTDELIVERY, $delivery_no,
                                                $delivery->document_date, $stock_gl_code["adjustment_account"], $dim, $dim2, "",
                                                $fa_depreciation,
-                                               PT_CUSTOMER, $delivery->customer_id,
-                                               "The cost of sales GL posting could not be inserted");
+                                               PT_CUSTOMER, $delivery->customer_id);
                                        /*then remove asset*/
                                        add_gl_trans_std_cost(ST_CUSTDELIVERY, $delivery_no, $delivery->document_date,
                                                $stock_gl_code["inventory_account"], 0, 0, "",
                                                -$fa_purchase_cost,
-                                               PT_CUSTOMER, $delivery->customer_id,
-                                               "The stock side of the cost of sales GL posting could not be inserted");
+                                               PT_CUSTOMER, $delivery->customer_id);
                                        /*finally adjust sales account with the remaining*/
                                        add_gl_trans_std_cost(ST_CUSTDELIVERY, $delivery_no, $delivery->document_date,
                                                $stock_gl_code["cogs_account"], 0, 0, "",
                                                ($fa_purchase_cost - $fa_depreciation),
-                                               PT_CUSTOMER, $delivery->customer_id,
-                                               "The stock side of the cost of sales GL posting could not be inserted");
+                                               PT_CUSTOMER, $delivery->customer_id);
                                }
                                // Invetory Items
                                else if ($delivery_line->unit_cost != 0) {
@@ -154,15 +151,13 @@ function write_sales_delivery(&$delivery,$bo_policy)
                                        add_gl_trans_std_cost(ST_CUSTDELIVERY, $delivery_no,
                                                $delivery->document_date, $stock_gl_code["cogs_account"], $dim, $dim2, "",
                                                $delivery_line->unit_cost * $delivery_line->qty_dispatched,
-                                               PT_CUSTOMER, $delivery->customer_id,
-                                               "The cost of sales GL posting could not be inserted");
+                                               PT_CUSTOMER, $delivery->customer_id);
 
                                        /*now the stock entry*/
                                        add_gl_trans_std_cost(ST_CUSTDELIVERY, $delivery_no, $delivery->document_date,
                                                $stock_gl_code["inventory_account"], 0, 0, "",
                                                (-$delivery_line->unit_cost * $delivery_line->qty_dispatched),
-                                               PT_CUSTOMER, $delivery->customer_id,
-                                               "The stock side of the cost of sales GL posting could not be inserted");
+                                               PT_CUSTOMER, $delivery->customer_id);
                                }                               
 
                        } /* end of if GL and stock integrated and standard cost !=0 */
@@ -174,7 +169,7 @@ function write_sales_delivery(&$delivery,$bo_policy)
        {
                $deferred_act = get_company_pref('deferred_income_act');
                add_gl_trans_customer(ST_CUSTDELIVERY, $delivery_no, $delivery->document_date, $deferred_act, 0, 0,
-                       -$total, $delivery->customer_id, "The deferred income GL posting could not be inserted");
+                       -$total, $delivery->customer_id);
        }
 
        if ($bo_policy == 0) {
index 376a6c84cb896664fb090194522d86567b256cdf..96ba23a6adb0d5bcbb41c09dc19536fe3c916147 100644 (file)
@@ -143,15 +143,13 @@ function write_sales_invoice(&$invoice)
                                $dim2 = ($invoice->dimension2_id != $customer['dimension2_id'] ? $invoice->dimension2_id : 
                                        ($customer['dimension2_id'] != 0 ? $customer["dimension2_id"] : $stock_gl_code["dimension2_id"]));
                                $total += add_gl_trans_customer(ST_SALESINVOICE, $invoice_no, $date_, $sales_account, $dim, $dim2,
-                                       -$line_taxfree_price*$prepaid_factor,
-                                       $invoice->customer_id, "The sales price GL posting could not be inserted");
+                                       -$line_taxfree_price*$prepaid_factor, $invoice->customer_id);
 
                                if ($invoice_line->discount_percent != 0) {
 
                                        $total += add_gl_trans_customer(ST_SALESINVOICE, $invoice_no, $date_,
                                                $branch_data["sales_discount_account"], $dim, $dim2,
-                                               ($line_taxfree_price * $invoice_line->discount_percent)*$prepaid_factor,
-                                               $invoice->customer_id, "The sales discount GL posting could not be inserted");
+                                               ($line_taxfree_price * $invoice_line->discount_percent)*$prepaid_factor, $invoice->customer_id);
                                } /*end of if discount !=0 */
                        }
                } /*quantity dispatched is more than 0 */
@@ -159,15 +157,13 @@ function write_sales_invoice(&$invoice)
 
        if (($items_total + $charge_shipping) != 0) {
                $total += add_gl_trans_customer(ST_SALESINVOICE, $invoice_no, $date_, $branch_data["receivables_account"], 0, 0,
-                       ($items_total + $charge_shipping + $items_added_tax + $freight_added_tax)*$prepaid_factor,
-                       $invoice->customer_id, "The total debtor GL posting could not be inserted");
+                       ($items_total + $charge_shipping + $items_added_tax + $freight_added_tax)*$prepaid_factor, $invoice->customer_id);
        }
        $to_allocate = ($items_total + $charge_shipping + $items_added_tax + $freight_added_tax);
 
        if ($charge_shipping != 0) {
                $total += add_gl_trans_customer(ST_SALESINVOICE, $invoice_no, $date_, $company_data["freight_act"], 0, 0,
-                       -$invoice->get_tax_free_shipping()*$prepaid_factor, $invoice->customer_id,
-                       "The freight GL posting could not be inserted");
+                       -$invoice->get_tax_free_shipping()*$prepaid_factor, $invoice->customer_id);
        }
        // post all taxes
        foreach ($taxes as $taxitem) {
@@ -178,8 +174,7 @@ function write_sales_invoice(&$invoice)
                                 $taxitem['Net'], $ex_rate, $date_, $invoice->reference, TR_OUTPUT, $invoice->tax_group_id);
                        if (isset($taxitem['sales_gl_code']) && !empty($taxitem['sales_gl_code']) && $taxitem['Value'] != 0)
                                $total += add_gl_trans_customer(ST_SALESINVOICE, $invoice_no, $date_, $taxitem['sales_gl_code'], 0, 0,
-                                       (-$taxitem['Value'])*$prepaid_factor, $invoice->customer_id,
-                                       "A tax GL posting could not be inserted");
+                                       (-$taxitem['Value'])*$prepaid_factor, $invoice->customer_id);
                }
        }
 
index d1cabba5ccf83fd32f19895ad2212f4cbadbb7e6..7f0a752f942a7cfc2e18d4565efde7b7eea432f0 100644 (file)
@@ -33,14 +33,11 @@ include_once($path_to_root . "/sales/includes/db/customers_db.inc");
 // $amount is in CUSTOMER'S currency
 
 function add_gl_trans_customer($type, $type_no, $date_, $account, $dimension, $dimension2,
-       $amount, $customer_id, $err_msg="", $rate=0)
+       $amount, $customer_id, $rate=0)
 {
-       if ($err_msg == "")
-               $err_msg = "The customer GL transaction could not be inserted";
-
        return add_gl_trans($type, $type_no, $date_, $account, $dimension, $dimension2, "", $amount,
                get_customer_currency($customer_id),
-               PT_CUSTOMER, $customer_id, $err_msg, $rate);
+               PT_CUSTOMER, $customer_id, $rate);
 }
 
 //----------------------------------------------------------------------------------------