From: Joe Hunt Date: Mon, 3 Aug 2020 10:39:56 +0000 (+0200) Subject: PHP 7.4 bug. Fixed in many files. X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=e7d70d0540ce162382b3ffcf50bff9f8e467bfeb;p=fa-stable.git PHP 7.4 bug. Fixed in many files. --- diff --git a/gl/gl_journal.php b/gl/gl_journal.php index e8af7d23..99a6145e 100644 --- a/gl/gl_journal.php +++ b/gl/gl_journal.php @@ -147,7 +147,7 @@ function create_cart($type=0, $trans_no=0) { $net_sum = 0; foreach($cart->gl_items as $gl) - if (!is_tax_account($gl->code_id) && !is_subledger_account($gl->code_id, $gl->person_id)) + if (!is_tax_account($gl->code_id) && !is_subledger_account($gl->code_id)) $net_sum += $gl->amount; $ex_net = abs($net_sum) - array_sum($tax_info['net_amount']); diff --git a/gl/includes/db/gl_db_accounts.inc b/gl/includes/db/gl_db_accounts.inc index 6bc73abd..178d98b7 100644 --- a/gl/includes/db/gl_db_accounts.inc +++ b/gl/includes/db/gl_db_accounts.inc @@ -224,7 +224,7 @@ function is_subledger_account($account) $result = db_query($sql,"Couldn't test AR/AP account"); $myrow = db_fetch_row($result); - return $myrow[0]; + return $myrow == false ? 0 : $myrow[0]; } function get_subaccount_data($code_id, $person_id) diff --git a/includes/references.inc b/includes/references.inc index fc343e65..69f6806e 100644 --- a/includes/references.inc +++ b/includes/references.inc @@ -225,7 +225,7 @@ class references return false; $result = db_fetch_row($result); - return $result[0]; + return $result == false ? false : $result[0]; } function is_new_reference($ref, $type, $trans_no=0) diff --git a/includes/ui/items_cart.inc b/includes/ui/items_cart.inc index 0e32165b..93875589 100644 --- a/includes/ui/items_cart.inc +++ b/includes/ui/items_cart.inc @@ -144,8 +144,8 @@ class items_cart $this->gl_items[$index]->code_id = $code_id; $this->gl_items[$index]->person_id = $person_id; - $gl_type = is_subledger_account($code_id, $person_id); - if ($gl_type) + $gl_type = is_subledger_account($code_id); + if ($person_id != null && $gl_type) { $this->gl_items[$index]->person_type_id = $gl_type > 0 ? PT_CUSTOMER : PT_SUPPLIER; $data = get_subaccount_data($code_id, $person_id); @@ -263,7 +263,7 @@ class items_cart foreach($this->gl_items as $gl) { - if ($person_type = is_subledger_account($gl->code_id, $gl->person_id)) + if ($person_type = is_subledger_account($gl->code_id)) { $tax_info['person_type'] = $person_type < 0 ? PT_SUPPLIER : PT_CUSTOMER; $tax_info['person_id'] = $gl->person_id; @@ -521,8 +521,8 @@ class gl_item $this->code_id = $code_id; $this->person_id = $person_id; - $gl_type = is_subledger_account($code_id, $person_id); - if ($gl_type) + $gl_type = is_subledger_account($code_id); + if ($person_id != null && $gl_type) { $this->person_type_id = $gl_type > 0 ? PT_CUSTOMER : PT_SUPPLIER; $data = get_subaccount_data($code_id, $person_id); diff --git a/sales/includes/db/sales_order_db.inc b/sales/includes/db/sales_order_db.inc index a6bb878c..dcf69e93 100644 --- a/sales/includes/db/sales_order_db.inc +++ b/sales/includes/db/sales_order_db.inc @@ -644,6 +644,6 @@ function last_sales_order_detail($order, $field) $last_query=db_query($sql, "Could not retrieve last order detail"); $row = db_fetch_row($last_query); - return $row[0]; + return $row == false ? false : $row[0]; } diff --git a/sales/includes/sales_db.inc b/sales/includes/sales_db.inc index bdc449d8..6f74a574 100644 --- a/sales/includes/sales_db.inc +++ b/sales/includes/sales_db.inc @@ -231,6 +231,7 @@ function read_sales_trans($doc_type, $trans_no, &$cart) } else { // read header data from first document $myrow = get_customer_trans($trans_no[0],$doc_type); + $debtor_no = $myrow['debtor_no']; if (count_array($trans_no)>1) $cart->trans_no = get_customer_trans_version($doc_type, $trans_no); else @@ -238,7 +239,7 @@ function read_sales_trans($doc_type, $trans_no, &$cart) $cart->set_sales_type($myrow["tpe"], $myrow["sales_type"], $myrow["tax_included"],0); - $cart->set_customer($myrow["debtor_no"], $myrow["DebtorName"], + $cart->set_customer($debtor_no, $myrow["DebtorName"], $myrow["curr_code"], $myrow["discount"], $myrow["payment_terms"]); $cart->set_branch($myrow["branch_code"], $myrow["tax_group_id"], @@ -279,7 +280,7 @@ function read_sales_trans($doc_type, $trans_no, &$cart) @$myrow["src_id"]); } } - $cart->prepayments = get_payments_for($trans_no, $doc_type, $myrow["debtor_no"]); + $cart->prepayments = get_payments_for($trans_no, $doc_type, $debtor_no); } // !newdoc diff --git a/sales/includes/ui/sales_order_ui.inc b/sales/includes/ui/sales_order_ui.inc index c47c5da5..d9e20583 100644 --- a/sales/includes/ui/sales_order_ui.inc +++ b/sales/includes/ui/sales_order_ui.inc @@ -378,7 +378,7 @@ function display_order_header(&$order, $editable, $date_text) if (($order->pos['cash_sale'] || $order->pos['credit_sale']) && !$order->is_started()) { // editable payment type - if (get_post('payment') !== $order->payment) { + if (isset($_POST['payment']) && $_POST['payment'] !== $order->payment) { $order->payment = get_post('payment'); $order->payment_terms = get_payment_terms($order->payment); $order->due_date = get_invoice_duedate($order->payment, $order->document_date);