Error: no supplier trans found for given params in Supplier Payment. Fixed.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 28 Nov 2020 15:05:29 +0000 (16:05 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 28 Nov 2020 15:05:29 +0000 (16:05 +0100)
includes/ui/allocation_cart.inc
purchasing/includes/db/po_db.inc

index 968bae42a7131e848976f011359ea7d9883527cc..f21fd2ede4ec459212eee4a34862d0c196540178 100644 (file)
@@ -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);
index 115b73f1f8381c051177fe539712cfb3161479be..23f19a09f582b81b56c8b63ca2df6244ac19a60c 100644 (file)
@@ -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