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
+16 -2
View File
@@ -14,6 +14,7 @@ $pagetitle = _('Storage');
$id = gpc_get_int($_REQUEST, 'id', 0);
$opt_stype = db_get_options(3);
$opt_capaunit = $g_opt_empty + db_load_enum('storage', 'capaunit', true, true);
// ========== ACTIONS START ===================================================
@@ -44,6 +45,10 @@ switch ($submit = form_get_action()) {
$p[':wx'] = gpc_get_int($_POST, 'wx');
$p[':wy'] = gpc_get_int($_POST, 'wy');
$p[':wz'] = gpc_get_int($_POST, 'wz');
$p[':angle'] = gpc_get_int($_POST, 'angle');
$p[':capacity'] = gpc_get_int($_POST, 'capacity');
if ($p[':capacity'] == 0) $p[':capacity'] = NULL;
$p[':capaunit'] = gpc_get_string($_POST, 'capaunit');
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150);
db_exec_update('storage', $p, 'sid');
$action = ACT_VIEW;
@@ -180,7 +185,7 @@ foreach ($res as $row) {
}
// Table summary
$numrows = count($res);
table_rec_summary($i, $numrows, $numrows, 4);
table_rec_summary($i, $numrows, $numrows, 5);
echo "</table>\n";
form_add_button('box.php');
@@ -277,7 +282,7 @@ elseif ($action == ACT_EDIT):
echo '<h2>', _('Edit Storage'), "</h2>\n";
$sql = "SELECT sid, sname, stype, x, y, z, wx, wy, wz, remarks "
$sql = "SELECT sid, sname, stype, x, y, z, wx, wy, wz, angle, capacity, capaunit, remarks "
. "FROM storage "
. "WHERE sid=?";
$sth = $pdo->prepare($sql);
@@ -322,6 +327,15 @@ form_create_select('stype', _('Type'), $opt_stype, $storage->stype);
</div>
</div>
</div>
<div class="mb-3">
<label for="angle" class="form-label"><?=_('Angle, deg.')?></label>
<input type="number" class="form-control" id="angle" name="angle" value="<?=$storage->angle ?>">
</div>
<div class="mb-3">
<label for="capacity" class="form-label"><?=_('Capacity')?></label>
<input type="number" class="form-control" id="capacity" name="capacity" value="<?=$storage->capacity ?>">
</div>
<?php form_create_select('capaunit', _('Capacity Unit'), $opt_capaunit, $storage->capaunit); ?>
<div class="mb-3">
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=$storage->remarks ?></textarea>