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
+26 -6
View File
@@ -48,9 +48,18 @@ switch ($submit = form_get_action()) {
$p[':invname'] = gpc_get_string($_POST, 'invname');
$p[':number'] = gpc_get_int($_POST, 'number');
$p[':conttype'] = gpc_get_string($_POST, 'conttype');
$p[':sid'] = gpc_get_int($_POST, 'sid');
$p[':boxid'] = gpc_get_int($_POST, 'boxid');
$p[':invcond'] = 'good';
$p[':sid'] = gpc_get_uint($_POST, 'sid', 0);
$p[':boxid'] = gpc_get_uint($_POST, 'boxid', 0);
if ($p[':sid'] == NULL && $p[':boxid'] == NULL) {
$p[':conttype'] = 'storage';
$sid = db_get_default_storage($user->vid);
if ($sid === false) {
$action = ACT_ADD;
break;
}
$p[':sid'] = $sid;
}
$p[':invcond'] = 'unknown';
$id = db_exec_insert('inventory', $p);
$action = ACT_VIEW;
break;
@@ -60,8 +69,17 @@ switch ($submit = form_get_action()) {
$p[':invname'] = gpc_get_string($_POST, 'invname');
$p[':number'] = gpc_get_int($_POST, 'number');
$p[':conttype'] = gpc_get_string($_POST, 'conttype');
$p[':sid'] = gpc_get_int($_POST, 'sid');
$p[':boxid'] = gpc_get_int($_POST, 'boxid');
$p[':sid'] = gpc_get_uint($_POST, 'sid', 0);
$p[':boxid'] = gpc_get_uint($_POST, 'boxid', 0);
if ($p[':sid'] == NULL && $p[':boxid'] == NULL) {
$p[':conttype'] = 'storage';
$sid = db_get_default_storage($user->vid);
if ($sid === false) {
$action = ACT_VIEW;
break;
}
$p[':sid'] = $sid;
}
$p[':weight'] = min(gpc_get_float($_POST, 'weight'), 999.99); // limit max value
$p[':price'] = gpc_get_currency($_POST, 'price');
$p[':purchdate'] = gpc_get_date($_POST, 'purchdate');
@@ -351,7 +369,9 @@ echo '<table class="table">', "\n";
echo '<tr><th style="width:20%">', _('Box type'),"</th><td>", $inventory->conttype, "</td></tr>\n";
// Container with link
echo "<tr><th>", _('Container'),"</th><td>", sprintf(_('%s in %s'), $box['label'], $storagename);
echo '<tr><th>', $inventory->conttype == 'storage' ? _('Storage') : _('Container');
echo '</th><td>', sprintf(_('%s in %s'), $box['label'], $storagename);
// TODO insert link
echo "</td></tr>\n";
echo "<tr><th>", _('Location ID'), "</th><td>", $inventory->locationid, "</td></tr>\n";