if ($RESTOCK['min_quantity'] == null) { $ERRORS[] = 'No minimum quantity specified.'; } if ($RESTOCK['max_quantity'] == null) { $ERRORS[] = 'No maximum quantity specified.'; } if ($RESTOCK['quantity_cap'] == null) { $ERRORS[] = 'No quantity cap specified.'; } if (sizeof($ERRORS) > 0) { draw_errors($ERRORS); } else { $restock->setItemTypeId($item->getItemTypeId()); $restock->setShopId($RESTOCK['shop_id']); $restock->setRestockFrequencySeconds($RESTOCK['frequency']); $restock->setMinPrice($RESTOCK['min_price']); $restock->setMaxPrice($RESTOCK['max_price']); $restock->setMinQuantity($RESTOCK['min_quantity']); $restock->setMaxQuantity($RESTOCK['max_quantity']); $restock->setStoreQuantityCap($RESTOCK['quantity_cap']); $restock->save(); $_SESSION['restock_notice'] = "You have saved the restock."; redirect(null, null, "admin-restock/?item[id]={$item->getItemTypeId()}"); } // end no errors break; // end save } // end state switch } // end no errors