Added default storage to vessel and some other fixes

This commit is contained in:
2026-07-20 13:05:15 +02:00
parent a01329fdab
commit 562aa587ad
10 changed files with 205 additions and 25 deletions
+5 -2
View File
@@ -20,6 +20,7 @@ $pagetitle = _('Boxes');
$id = gpc_get_int($_REQUEST, 'id', 0);
// TODO use global function
// Storage options
$sql = "SELECT sid, sname FROM storage WHERE vid=? ORDER BY sname";
$sth = $pdo->prepare($sql);
@@ -44,7 +45,7 @@ switch ($submit = form_get_action()) {
case 'insert':
$p[':label'] = gpc_get_string($_POST, 'label');
$p[':sid'] = gpc_get_int($_POST, 'sid');
$p[':sid'] = gpc_get_uint($_POST, 'sid');
$p[':content'] = gpc_get_string($_POST, 'content');
$p[':remarks'] = gpc_get_string($_POST, 'remarks');
$id = db_exec_insert('box', $p);
@@ -59,6 +60,7 @@ switch ($submit = form_get_action()) {
$p[':content'] = gpc_get_string($_POST, 'content');
$p[':color'] = gpc_get_color($_POST, 'color');
$p[':weight'] = min(gpc_get_float($_POST, 'weight'), 99.99);
$p[':sid'] = gpc_get_uint($_POST, 'sid');
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150);
db_exec_update('box', $p, 'boxid');
$action = ACT_VIEW;
@@ -231,7 +233,7 @@ if ($res) {
elseif ($action == ACT_EDIT):
// ========== VARIANT: edit single record =====================================
$sql = "SELECT boxtype, label, content, color, weight, remarks "
$sql = "SELECT boxtype, label, content, color, weight, sid, remarks "
. "FROM box "
. "WHERE boxid=?";
$sth = $pdo->prepare($sql);
@@ -261,6 +263,7 @@ echo '<h2>', _('Edit Box'), "</h2>\n";
<label for="weight" class="form-label"><?=_('Weight, kg')?></label>
<input type="text" class="form-control" id="weight" name="weight" value="<?=format_float($box->weight); ?>">
</div>
<?php form_create_select('sid', _('Storage'), $opt_storage, $box->sid); ?>
<div class="mb-3">
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=$box->remarks ?></textarea>