if (isset($_POST["action"]) && ($_POST["action"] == "Create" || $_POST["action"] == "Update")) { $sup->SupplyID = $_REQUEST["supplyid"]; $sup->PartNum = $_REQUEST["partnum"]; $sup->PartName = $_REQUEST["partname"]; $sup->MinQty = $_REQUEST["minqty"]; $sup->MaxQty = $_REQUEST["maxqty"]; if ($_REQUEST["action"] == "Create") { if ($sup->PartNum != null && $sup->PartNum != "") { $sup->CreateSupplies(); } } else { $status = "Updated"; $sup->UpdateSupplies(); } } $supplyList = $sup->GetSuppliesList(); $supplytable = ''; if (sizeof($inventory) > 0) { $sb = new SupplyBin(); $supplytable = '<div class="table border"> <div> <div>' . __("Bin ID") . '</div> <div>' . __("Count") . '</div> </div>'; foreach ($inventory as $binContent) { $sb->BinID = $binContent->BinID; $sb->GetBin(); $supplytable .= "\t<div>\t\t<div><a href=\"supplybin.php?binid={$sb->BinID}\">{$sb->Location}</a></div>\n\t\t<div>{$binContent->Count}</div>\n\t</div>\n"; } $supplytable .= '</div>'; }
<?php require_once "db.inc.php"; require_once "facilities.inc.php"; $subheader = __("Data Center Stockroom Supply Bins"); if (!$person->SiteAdmin) { // No soup for you. header('Location: ' . redirect()); exit; } $bin = new SupplyBin(); $bc = new BinContents(); $sup = new Supplies(); $supList = $sup->GetSuppliesList(true); $formpatch = ""; $status = ""; if (isset($_REQUEST["binid"])) { $bin->BinID = isset($_POST['binid']) ? $_POST['binid'] : $_GET['binid']; $bin->GetBin(); $bc->BinID = $bin->BinID; if (isset($_POST["action"]) && ($_POST["action"] == "Create" || $_POST["action"] == "Update") && ($_POST["location"] != null && $_POST["location"] != "")) { $bin->Location = $_POST["location"]; if ($_POST["action"] == "Create") { $bin->CreateBin(); } else { $binContents = $bc->GetBinContents(); // We don't want someone changing the name of a bin to a blank anymore than we want them creating one as a blank name $status = __("Updated"); $bin->UpdateBin(); // only attempt to alter the contents of the bin if we have the proper elements if (isset($_POST['supplyid']) && count($_POST['supplyid'] > 0)) {