Add stock management mode setting
This commit is contained in:
parent
5c0bea68a9
commit
841c03847e
@ -118,8 +118,13 @@ for ($i = 0; $i < count($items); $i++) {
|
|||||||
$user = new User($_SESSION['uid']);
|
$user = new User($_SESSION['uid']);
|
||||||
if ($user->hasPermission("INV_EDIT")) {
|
if ($user->hasPermission("INV_EDIT")) {
|
||||||
$items[$i]["editbtn"] = '<a class="btn btn-primary" href="app.php?page=edititem&id=' . $items[$i]['itemid'] . '"><i class="fas fa-edit"></i> ' . $Strings->get("edit", false) . '</a>';
|
$items[$i]["editbtn"] = '<a class="btn btn-primary" href="app.php?page=edititem&id=' . $items[$i]['itemid'] . '"><i class="fas fa-edit"></i> ' . $Strings->get("edit", false) . '</a>';
|
||||||
$items[$i]["addstockbtn"] = '<a class="btn btn-success" href="app.php?page=addstock&id=' . $items[$i]['itemid'] . '"><i class="fas fa-plus"></i> ' . $Strings->get("addstock", false) . '</a>';
|
if ($SETTINGS['stock_management']) {
|
||||||
$items[$i]["removestockbtn"] = '<a class="btn btn-danger" href="app.php?page=removestock&id=' . $items[$i]['itemid'] . '"><i class="fas fa-minus"></i> ' . $Strings->get("removestock", false) . '</a>';
|
$items[$i]["addstockbtn"] = '<a class="btn btn-success" href="app.php?page=addstock&id=' . $items[$i]['itemid'] . '"><i class="fas fa-plus"></i> ' . $Strings->get("addstock", false) . '</a>';
|
||||||
|
$items[$i]["removestockbtn"] = '<a class="btn btn-danger" href="app.php?page=removestock&id=' . $items[$i]['itemid'] . '"><i class="fas fa-minus"></i> ' . $Strings->get("removestock", false) . '</a>';
|
||||||
|
} else {
|
||||||
|
$items[$i]["addstockbtn"] = '';
|
||||||
|
$items[$i]["removestockbtn"] = '';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$items[$i]["editbtn"] = '';
|
$items[$i]["editbtn"] = '';
|
||||||
$items[$i]["addstockbtn"] = '';
|
$items[$i]["addstockbtn"] = '';
|
||||||
|
@ -165,14 +165,14 @@ if (!empty($VARS['id'])) {
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="qty"><i class="fas fa-hashtag"></i> <?php $Strings->get('quantity'); ?></label>
|
<label for="qty"><i class="fas fa-hashtag"></i> <?php $Strings->get('quantity'); ?></label>
|
||||||
<?php
|
<?php
|
||||||
if ($editing) {
|
if ($SETTINGS['stock_management'] && $editing && !$cloning){
|
||||||
?>
|
?>
|
||||||
<input type="text" class="form-control" id="qty" name="qty" readonly value="<?php echo $itemdata['qty']; ?>" />
|
<input type="text" class="form-control" id="qty" name="qty" readonly value="<?php echo $itemdata['qty']; ?>" />
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
<input type="number" class="form-control" id="qty" name="qty" placeholder="1" value="<?php echo $itemdata['qty']; ?>" />
|
<input type="number" class="form-control" id="qty" name="qty" placeholder="1" value="<?php echo $itemdata['qty']; ?>" />
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -169,44 +169,49 @@ $item = $database->get(
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
<?php
|
||||||
|
if ($SETTINGS['stock_management']) {
|
||||||
|
?>
|
||||||
|
<hr />
|
||||||
|
|
||||||
<hr />
|
<div class="row mt-4 mx-0">
|
||||||
|
<table id="stocktable" class="table table-bordered table-hover table-sm">
|
||||||
<div class="row mt-4 mx-0">
|
<thead>
|
||||||
<table id="stocktable" class="table table-bordered table-hover table-sm">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th data-priority="1"><i class="fas fa-fw fa-calendar d-none d-md-inline"></i> <?php $Strings->get('date'); ?></th>
|
|
||||||
<th data-priority="2"><i class="fas fa-fw fa-hashtag d-none d-md-inline"></i> <?php $Strings->get('amount'); ?></th>
|
|
||||||
<th data-priority="3"><i class="fas fa-fw fa-sticky-note d-none d-md-inline"></i> <?php $Strings->get('description'); ?></th>
|
|
||||||
<th data-priority="4"><i class="fas fa-fw fa-user d-none d-md-inline"></i> <?php $Strings->get('changed by'); ?></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
$stockentries = $database->select('stock', [
|
|
||||||
'timestamp',
|
|
||||||
'stock',
|
|
||||||
'text1',
|
|
||||||
'userid'
|
|
||||||
], [
|
|
||||||
'itemid' => $item['itemid']
|
|
||||||
]
|
|
||||||
);
|
|
||||||
foreach ($stockentries as $stockentry) {
|
|
||||||
$user = new User($stockentry['userid'])
|
|
||||||
?>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $stockentry['timestamp']; ?></td>
|
<th data-priority="1"><i class="fas fa-fw fa-calendar d-none d-md-inline"></i> <?php $Strings->get('date'); ?></th>
|
||||||
<td><?php echo $stockentry['stock']; ?></td>
|
<th data-priority="2"><i class="fas fa-fw fa-hashtag d-none d-md-inline"></i> <?php $Strings->get('amount'); ?></th>
|
||||||
<td><?php echo $stockentry['text1']; ?></td>
|
<th data-priority="3"><i class="fas fa-fw fa-sticky-note d-none d-md-inline"></i> <?php $Strings->get('description'); ?></th>
|
||||||
<td><?php echo $user->getName() . " (" . $user->getUsername() . ")"; ?></td>
|
<th data-priority="4"><i class="fas fa-fw fa-user d-none d-md-inline"></i> <?php $Strings->get('changed by'); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
}
|
$stockentries = $database->select('stock', [
|
||||||
?>
|
'timestamp',
|
||||||
</tbody>
|
'stock',
|
||||||
</table>
|
'text1',
|
||||||
</div>
|
'userid'
|
||||||
|
], [
|
||||||
|
'itemid' => $item['itemid']
|
||||||
|
]
|
||||||
|
);
|
||||||
|
foreach ($stockentries as $stockentry) {
|
||||||
|
$user = new User($stockentry['userid'])
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $stockentry['timestamp']; ?></td>
|
||||||
|
<td><?php echo $stockentry['stock']; ?></td>
|
||||||
|
<td><?php echo $stockentry['text1']; ?></td>
|
||||||
|
<td><?php echo $user->getName() . " (" . $user->getUsername() . ")"; ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -56,5 +56,7 @@ $SETTINGS = [
|
|||||||
// Base URL for building links relative to the location of the app.
|
// Base URL for building links relative to the location of the app.
|
||||||
// Only used when there's no good context for the path.
|
// Only used when there's no good context for the path.
|
||||||
// The default is almost definitely fine.
|
// The default is almost definitely fine.
|
||||||
"url" => "."
|
"url" => ".",
|
||||||
|
// Enable stock management mode.
|
||||||
|
"stock_management" => false,
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user