diff --git a/lib/getitemtable.php b/lib/getitemtable.php index ab1cf80..6aee0d5 100644 --- a/lib/getitemtable.php +++ b/lib/getitemtable.php @@ -118,8 +118,13 @@ for ($i = 0; $i < count($items); $i++) { $user = new User($_SESSION['uid']); if ($user->hasPermission("INV_EDIT")) { $items[$i]["editbtn"] = ' ' . $Strings->get("edit", false) . ''; - $items[$i]["addstockbtn"] = ' ' . $Strings->get("addstock", false) . ''; - $items[$i]["removestockbtn"] = ' ' . $Strings->get("removestock", false) . ''; + if ($SETTINGS['stock_management']) { + $items[$i]["addstockbtn"] = ' ' . $Strings->get("addstock", false) . ''; + $items[$i]["removestockbtn"] = ' ' . $Strings->get("removestock", false) . ''; + } else { + $items[$i]["addstockbtn"] = ''; + $items[$i]["removestockbtn"] = ''; + } } else { $items[$i]["editbtn"] = ''; $items[$i]["addstockbtn"] = ''; diff --git a/pages/edititem.php b/pages/edititem.php index c8f402d..1b1d8ee 100644 --- a/pages/edititem.php +++ b/pages/edititem.php @@ -165,14 +165,14 @@ if (!empty($VARS['id'])) {
- - + + - - + +
diff --git a/pages/item.php b/pages/item.php index eabb20e..9a61cf5 100644 --- a/pages/item.php +++ b/pages/item.php @@ -169,44 +169,49 @@ $item = $database->get( } ?> + +
-
- -
- - - - - - - - - - - select('stock', [ - 'timestamp', - 'stock', - 'text1', - 'userid' - ], [ - 'itemid' => $item['itemid'] - ] - ); - foreach ($stockentries as $stockentry) { - $user = new User($stockentry['userid']) - ?> +
+
get('date'); ?> get('amount'); ?> get('description'); ?> get('changed by'); ?>
+ - - - - + + + + + + - -
getName() . " (" . $user->getUsername() . ")"; ?> get('date'); ?> get('amount'); ?> get('description'); ?> get('changed by'); ?>
-
+ $stockentries = $database->select('stock', [ + 'timestamp', + 'stock', + 'text1', + 'userid' + ], [ + 'itemid' => $item['itemid'] + ] + ); + foreach ($stockentries as $stockentry) { + $user = new User($stockentry['userid']) + ?> + + + + + getName() . " (" . $user->getUsername() . ")"; ?> + + + + + + diff --git a/settings.template.php b/settings.template.php index 4350bd3..d68964a 100644 --- a/settings.template.php +++ b/settings.template.php @@ -56,5 +56,7 @@ $SETTINGS = [ // Base URL for building links relative to the location of the app. // Only used when there's no good context for the path. // The default is almost definitely fine. - "url" => "." + "url" => ".", + // Enable stock management mode. + "stock_management" => false, ];