diff --git a/db/mariadb.sql b/db/mariadb.sql index 88b3acf..4e475bd 100644 --- a/db/mariadb.sql +++ b/db/mariadb.sql @@ -296,7 +296,7 @@ CREATE TABLE cable ( ON DELETE RESTRICT ) ENGINE=InnoDB; -CREATE table fuse ( +CREATE TABLE fuse ( fuseid smallint(6) UNSIGNED NOT NULL AUTO_INCREMENT, vid smallint(6) NOT NULL DEFAULT 1, fnumber smallint(6) NOT NULL, @@ -306,6 +306,7 @@ CREATE table fuse ( eid smallint(6) UNSIGNED DEFAULT NULL, location tinyint(3) DEFAULT 0, -- from dropdown id 10 description varchar(60) DEFAULT NULL, + color char(6) DEFAULT NULL, remarks varchar(150) DEFAULT NULL, PRIMARY KEY (fuseid), UNIQUE INDEX ix_fusenumber (vid, fnumber), diff --git a/webgui/box.php b/webgui/box.php index a173481..7ba98e4 100644 --- a/webgui/box.php +++ b/webgui/box.php @@ -16,6 +16,7 @@ There can be a difference because not all items have a weight entered require 'globals.inc'; require 'lib/db.inc'; require 'lib/gpc.inc'; +require 'lib/form.inc'; $pagetitle = _('Boxes'); @@ -118,7 +119,7 @@ foreach ($res as $row) { echo '', ($opt_boxtype[$row['boxtype']] ?? ''), "\n"; echo '', format_color(strtoupper($row['color'])), "\n"; echo '', $row['content'], "\n"; - echo '', format_float($row['weight'], 2), "\n"; + echo '', format_float($row['weight'], 2, 'kg'), "\n"; // Edit current record button echo ""; echo '', "\n"; @@ -126,8 +127,8 @@ foreach ($res as $row) { echo "\n"; } // Table summary -$numrows = count($res); -table_rec_summary($i, $numrows, $numrows, 6); +//$numrows = count($res); +//table_rec_summary(1, $numrows, $numrows, 6); echo "\n"; form_add_button('box.php'); diff --git a/webgui/cable.php b/webgui/cable.php index 813f2a2..252efdb 100644 --- a/webgui/cable.php +++ b/webgui/cable.php @@ -9,6 +9,7 @@ require 'globals.inc'; require 'lib/db.inc'; require 'lib/gpc.inc'; +require 'lib/form.inc'; $pagetitle = _('Cables'); @@ -31,6 +32,7 @@ switch ($submit = form_get_action()) { case 'filter': $flt = array(); + $flt['type'] = gpc_get_int($_POST, 'flt_type'); $flt['txt'] = gpc_get_string($_POST, 'flt_txt'); db_save_filter($flt, 211); $action = ACT_DEFAULT; @@ -95,7 +97,7 @@ if ($action == ACT_DEFAULT): // ========== VARIANT: default behavior ======================================= // load filter from db -$flt = db_get_filter($user->id, 211, ['txt']); +$flt = db_get_filter($user->id, 211, ['txt', 'type']); $w = array('vid=:vid'); $p = array(':vid' => $user->vid); @@ -104,6 +106,13 @@ if (strlen($flt->txt) > 1) { $w[] = 'cablename LIKE :txt OR remarks LIKE :txt'; $p[':txt'] = '%'.$flt->txt.'%'; } +if ($flt->type == -1) { + $w[] = 'cabletype IS NULL'; +} elseif ($flt->type > 0) { + $w[] = 'cabletype=:cabletype'; + $p[':type'] = $flt->type; +} + $where = join(' AND ', $w); $order = ' ORDER BY cablename'; @@ -115,10 +124,10 @@ echo "

$pagetitle

\n";
Filter
-
- - -
+type); +filter_create_text('flt_txt', _('Text'), $flt->text, 30, 45); +?>