X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fsales_db.inc;h=b7e168320d2e63af6c56bd993982746e917bfb3e;hb=d63ba7b7819e07a73cd1999cec249fc6f0b009fb;hp=465002303887c7ca2659ea5ec8aa9b34865e360c;hpb=f11b39846d81bd043490ba9596224b859e47467c;p=fa-stable.git diff --git a/sales/includes/sales_db.inc b/sales/includes/sales_db.inc index 46500230..b7e16832 100644 --- a/sales/includes/sales_db.inc +++ b/sales/includes/sales_db.inc @@ -231,14 +231,15 @@ 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); - if (count($trans_no)>1) + $debtor_no = $myrow['debtor_no']; + if (count_array($trans_no)>1) $cart->trans_no = get_customer_trans_version($doc_type, $trans_no); else $cart->trans_no = array($trans_no[0]=>$myrow["version"]); $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[0], $doc_type, $debtor_no); } // !newdoc @@ -368,10 +369,10 @@ function get_sales_child_documents($trans_type, $trans_no) // FIXME - credit notes retrieved here should be those linked to invoices containing // at least one line from related invoice - if (!count($trans_no)) + if (!count_array($trans_no)) return false; $childs = get_sales_child_numbers($trans_type, $trans_no, false); - if (!count($childs)) + if (!count_array($childs)) return false; $sql = "SELECT * FROM ".TB_PREF."debtor_trans