master
Skylar Ittner 7 years ago
parent f3899029f7
commit 4ee1992d5a

@ -42,7 +42,24 @@ switch ($VARS['action']) {
returnToSender("invalid_itemid");
}
}
if (is_empty($VARS['name']) || is_empty($VARS['cat']) || is_empty($VARS['loc'])) {
if (is_empty($VARS['name'])) {
returnToSender('missing_name');
}
if (!is_empty($VARS['catstr']) && is_empty($VARS['cat'])) {
if ($database->count("categories", ["catname" => $VARS['catstr']]) == 1) {
$VARS['cat'] = $database->get("categories", 'catid', ["catname" => $VARS['catstr']]);
} else {
returnToSender('use_the_drop_luke');
}
}
if (!is_empty($VARS['locstr']) && is_empty($VARS['loc'])) {
if ($database->count("locations", ["locname" => $VARS['locstr']]) == 1) {
$VARS['loc'] = $database->get("locations", 'locid', ["locname" => $VARS['locstr']]);
} else {
returnToSender('use_the_drop_luke');
}
}
if (is_empty($VARS['cat']) || is_empty($VARS['loc'])) {
returnToSender('invalid_parameters');
}
if (is_empty($VARS['qty'])) {

@ -84,5 +84,7 @@ define("STRINGS", [
"understocked items" => "Understocked Items",
"view understocked" => "View Understocked",
"only showing understocked" => "Only showing understocked items.",
"show all items" => "Show all items"
"show all items" => "Show all items",
"missing name" => "You need to enter a name.",
"use the dropdowns" => "Whoops, you need to use the category and location autocomplete boxes."
]);

@ -72,5 +72,13 @@ define("MESSAGES", [
"field_nan" => [
"string" => "field not a number",
"type" => "danger"
],
"missing_name" => [
"string" => "missing name",
"type" => "danger"
],
"use_the_drop_luke" => [
"string" => "use the dropdowns",
"type" => "danger"
]
]);

@ -86,14 +86,14 @@ if (!is_empty($VARS['id'])) {
<div class="col-xs-12 col-md-6">
<div class="form-group">
<label for="cat"><i class="fa fa-archive"></i> <?php lang("category"); ?></label>
<input type="text" class="form-control" id="cat" placeholder="<?php lang("placeholder category name"); ?>" value="<?php echo htmlspecialchars($itemdata['catname']); ?>" />
<input type="text" name="catstr" class="form-control" id="cat" placeholder="<?php lang("placeholder category name"); ?>" value="<?php echo htmlspecialchars($itemdata['catname']); ?>" />
<input type="hidden" id="realcat" name="cat" value="<?php echo $itemdata['catid']; ?>" required="required" />
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="form-group">
<label for="loc"><i class="fa fa-map-marker"></i> <?php lang("location"); ?></label>
<input type="text" class="form-control" id="loc" placeholder="<?php lang("placeholder location name"); ?>" value="<?php echo htmlspecialchars($itemdata['locname']); ?>" />
<input type="text" name="locstr" class="form-control" id="loc" placeholder="<?php lang("placeholder location name"); ?>" value="<?php echo htmlspecialchars($itemdata['locname']); ?>" />
<input type="hidden" id="realloc" name="loc" value="<?php echo $itemdata['locid']; ?>" required="required" />
</div>
</div>

Loading…
Cancel
Save