Supplier description is overwritten when receiving items. Fixed.
authorJoe <joe.hunt.consulting@gmail.com>
Wed, 19 Apr 2023 05:24:56 +0000 (07:24 +0200)
committerJoe <joe.hunt.consulting@gmail.com>
Wed, 19 Apr 2023 05:24:56 +0000 (07:24 +0200)
purchasing/includes/purchasing_db.inc

index 121c90df0345d1b318b68b8869ed1c9c3473e25f..69df53b4a6e4052d4dadbcebcf559d7e76994bdf 100644 (file)
@@ -102,7 +102,7 @@ function add_or_update_purchase_data($supplier_id, $stock_id, $price, $descripti
                $sql = "INSERT INTO ".TB_PREF."purch_data (supplier_id, stock_id, price, suppliers_uom,
                        conversion_factor, supplier_description) VALUES (".db_escape($supplier_id)
                        .", ".db_escape($stock_id).", ".db_escape($price).", "
-                       .db_escape($uom).", 1, ".db_escape($description).")";
+                       .db_escape($uom).", 1, ".db_escape($description).")"; // the description should only be updated here.
                db_query($sql,"The supplier purchasing details could not be added");
                return;
        }       
@@ -110,8 +110,8 @@ function add_or_update_purchase_data($supplier_id, $stock_id, $price, $descripti
        $sql = "UPDATE ".TB_PREF."purch_data SET price=".db_escape($price);
        if ($uom != "")
                $sql .= ",suppliers_uom=".db_escape($uom);
-       if ($description != "") 
-               $sql .= ",supplier_description=".db_escape($description);
+       //if ($description != "") should only be updateded if $data === false (see above)       
+       //      $sql .= ",supplier_description=".db_escape($description);
        $sql .= " WHERE stock_id=".db_escape($stock_id)." AND supplier_id=".db_escape($supplier_id);
        db_query($sql,"The supplier purchasing details could not be updated");
        return true;