} $db = new db_alloc(); $tf = new tf(); $tflist = $tf->get_assoc_array("tfID", "tfName"); if ($_POST["move_forwards"]) { $productSale->move_forwards(); $_POST["save"] = true; } else { if ($_POST["move_backwards"]) { $productSale->move_backwards(); $_POST["save"] = true; } } // Code to respond to form buttons if (!$TPL["message"] && $_POST["save"]) { !$productSaleID && $productSale->set_value("status", "edit"); $productSale->read_globals(); $productSale->save(); $productSaleID = $productSale->get_id(); alloc_redirect($TPL["url_alloc_productSale"] . "productSaleID=" . $productSaleID); } else { if ($_POST["save_items"] && $productSaleID) { is_array($_POST["deleteProductSaleItem"]) or $_POST["deleteProductSaleItem"] = array(); if (is_array($_POST["productSaleItemID"]) && count($_POST["productSaleItemID"])) { is_array($_POST["sellPriceIncTax"]) or $_POST["sellPriceIncTax"] = array(); foreach ($_POST["productSaleItemID"] as $k => $productSaleItemID) { // Delete if (in_array($productSaleItemID, $_POST["deleteProductSaleItem"])) { $productSaleItem = new productSaleItem(); $productSaleItem->set_id($productSaleItemID); $productSaleItem->delete();