Added some permissions for warehouse
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
class WarehouseArticleController extends TTCrud {
|
||||
protected string $headerTitle = 'Artikel';
|
||||
protected string $createText = 'Artikel erstellen';
|
||||
protected $createText = 'Artikel erstellen';
|
||||
|
||||
// @formatter:off
|
||||
protected array $columns = [
|
||||
@@ -32,11 +32,26 @@ class WarehouseArticleController extends TTCrud {
|
||||
];
|
||||
// @formatter:on
|
||||
|
||||
protected array $additionalJSVariables = ['WAREHOUSE_ADMIN' => true];
|
||||
|
||||
protected array $infoMessages = ['create' => 'Artikel wurde erstellt',
|
||||
'update' => 'Artikel wurde aktualisiert',
|
||||
'delete' => 'Artikel wurde gelöscht',
|
||||
'noChanges' => 'Keine Änderungen',];
|
||||
|
||||
protected function prepareCrudConfig() {
|
||||
if (!$this->user->can('WarehouseAdmin')) {
|
||||
// find column with key actions, cheapestPurchasePrice, warningAmount, criticalAmount and set table to false
|
||||
foreach ($this->columns as $key => $column) {
|
||||
if (in_array($column['key'], ['actions', 'cheapestPurchasePrice', 'warningAmount', 'criticalAmount'])) {
|
||||
$this->columns[$key]['table'] = false;
|
||||
}
|
||||
}
|
||||
$this->createText = false;
|
||||
$this->additionalJSVariables['WAREHOUSE_ADMIN'] = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected function beforeUpdate($postData): bool {
|
||||
(new WarehouseHistoryController)->create($postData, $this->mod);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user