From e1ba133463ff567e87d812a5d1663fb66b70a072 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Sat, 28 Nov 2020 16:05:29 +0100 Subject: [PATCH] Error: no supplier trans found for given params in Supplier Payment. Fixed. --- includes/ui/allocation_cart.inc | 5 ++++- purchasing/includes/db/po_db.inc | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/includes/ui/allocation_cart.inc b/includes/ui/allocation_cart.inc index 968bae42..f21fd2ed 100644 --- a/includes/ui/allocation_cart.inc +++ b/includes/ui/allocation_cart.inc @@ -404,7 +404,10 @@ function check_allocations() return false; } } elseif ($_SESSION['alloc']->person_type == PT_SUPPLIER) { - $trans = get_supp_trans($_SESSION['alloc']->allocs[$counter]->type_no, $_SESSION['alloc']->allocs[$counter]->type); + if ($_SESSION['alloc']->allocs[$counter]->type == ST_PURCHORDER) + $trans = get_po($_SESSION['alloc']->allocs[$counter]->type_no); + else + $trans = get_supp_trans($_SESSION['alloc']->allocs[$counter]->type_no, $_SESSION['alloc']->allocs[$counter]->type); if ($trans['supplier_id'] != $_SESSION['alloc']->person_id) { display_error(_("Allocated transaction allocated is not related to company selected.")); set_focus('amount'.$counter); diff --git a/purchasing/includes/db/po_db.inc b/purchasing/includes/db/po_db.inc index 115b73f1..23f19a09 100644 --- a/purchasing/includes/db/po_db.inc +++ b/purchasing/includes/db/po_db.inc @@ -160,6 +160,15 @@ function update_po(&$po_obj) //---------------------------------------------------------------------------------------- +function get_po($order_no) { + $sql = "SELECT * FROM ".TB_PREF."purch_orders WHERE order_no = ".db_escape($order_no); + $result = db_query($sql); + + return db_fetch($result); +} + +//---------------------------------------------------------------------------------------- + function read_po_header($order_no, &$order) { $sql = "SELECT po.*, supplier.*, loc.location_name -- 2.30.2