improved warehouse module

This commit is contained in:
Luca Haid
2025-08-04 15:28:12 +02:00
parent 3979f907b0
commit 1ac95214b2
15 changed files with 117 additions and 26 deletions
@@ -4,12 +4,13 @@ class WarehouseArticleController extends TTCrud {
protected string $headerTitle = 'Artikel';
protected $createText = 'Artikel erstellen';
protected string $singleText = 'Artikel';
protected bool $reopenOnCreate = true;
// @formatter:off
protected array $columns = [
['key' => 'title', 'text' => 'Titel', 'required' => true, 'table' => ['priority' => 9]],
['key' => 'articleNumber', 'text' => 'Nr.', 'required' => true],
['key' => 'description', 'text' => 'Beschreibung', 'required' => true, 'table' => ['sortable' => false]],
['key' => 'description', 'text' => 'Beschreibung', 'required' => true,'modal' => ['type' => 'textarea'], 'table' => ['sortable' => false]],
['key' => 'category_id', 'text' => 'Kategorie', 'required' => true, 'modal' => ['type' => 'select', 'items' => []], 'table' => ['filter' => 'select']],
['key' => 'unit', 'text' => 'Einheit', 'required' => true,'table' => false],
['key' => 'revenueAccount', 'text' => 'Erlöskonto', 'required' => true,'modal' => ['type' => 'select', 'items' => [['value' => 0, 'text' => 'Dienstleistungen'], ['value' => 1, 'text' => 'Handelswaren']]], 'table' => false],
@@ -46,7 +47,15 @@ class WarehouseArticleController extends TTCrud {
$this->additionalJSVariables['WAREHOUSE_ADMIN'] = false;
}
protected function beforeCreate() {
if (!in_array($this->user->id, [2, 5, 6, 145]))
self::sendError("Sie haben keine Berechtigung, Artikel zu erstellen.");
return true;
}
protected function beforeUpdate($postData): bool {
if (!in_array($this->user->id, [2, 5, 6, 145]))
self::sendError("Sie haben keine Berechtigung, Artikel zu bearbeiten.");
(new WarehouseHistoryController)->create($postData, $this->mod);
return true;
}
@@ -17,6 +17,6 @@ class WarehouseArticleModel extends TTCrudBaseModel {
public string $unit;
public ?int $isSerialDocumentation;
public int $revenueAccount;
public int $create;
public int $createBy;
}
@@ -7,4 +7,6 @@ class WarehouseArticleDistributorModel extends TTCrudBaseModel {
public float $purchasePrice;
public string $externalArticleNumber;
public ?string $note;
public int $create;
public int $createBy;
}
@@ -13,4 +13,6 @@ class WarehouseArticlePacketModel extends TTCrudBaseModel {
public ?int $isEShopHide; // New field to hide from Energie Steiermark shop
public ?int $isSbidiShop; // New field for Sbidi shop visibility
public ?int $isSbidiShopHide; // New field to hide from Sbidi shop
public int $create;
public int $createBy;
}
@@ -6,4 +6,6 @@ class WarehouseArticlePriceModel extends TTCrudBaseModel {
public int $articlePriceTypeId;
public ?float $priceMultiplier;
public ?float $priceOverride;
public int $create;
public int $createBy;
}
@@ -1,23 +1,11 @@
<?php
class WarehouseCategory extends TTCrudBaseModel {
public int $id;
public string $name;
public string $description;
public ?int $articleNumberPrefix;
public int $create;
public int $create_by;
public ?int $edit;
public ?int $edit_by;
}
// SQL:
// CREATE TABLE `WarehouseCategory` (
// `id` INT NOT NULL AUTO_INCREMENT,
// `name` VARCHAR(255) NOT NULL,
// `description` TEXT NOT NULL,
// `create` INT NOT NULL,
// `create_by` INT NOT NULL,
// `edit` INT DEFAULT NULL,
// `edit_by` INT DEFAULT NULL,
// PRIMARY KEY (`id`)
// ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
}
@@ -9,10 +9,9 @@ class WarehouseCategoryController extends TTCrud {
protected array $columns = [
['key' => 'name', 'text' => 'Name', 'required' => true,],
['key' => 'description', 'text' => 'Beschreibung', 'required' => true],
['key' => 'articleNumberPrefix', 'text' => 'Artikelnummerprefix', 'required' => true],
['key' => 'create', 'text' => 'Erstellt am', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center']],
['key' => 'create_by', 'text' => 'Erstellt von', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center']],
['key' => 'edit', 'text' => 'Bearbeitet am', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center']],
['key' => 'edit_by', 'text' => 'Bearbeitet von', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center']],
['key' => 'actions', 'text' => 'Aktionen', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center', 'priority' => 10]],
];
// @formatter:on
@@ -10,4 +10,6 @@ class WarehouseDistributorModel extends TTCrudBaseModel {
public string $email;
public string $phone;
public string $contactPerson;
public int $create;
public int $createBy;
}
@@ -13,4 +13,6 @@ class WarehouseEShopOrderItemModel extends TTCrudBaseModel {
public ?int $articleId;
public int $quantity;
public ?int $articlePacketId;
public int $create;
public int $createBy;
}
@@ -6,4 +6,6 @@ class WarehouseLocationThresholdOverrideModel extends TTCrudBaseModel {
public int $articleId;
public int $warningAmount;
public int $criticalAmount;
public int $create;
public int $createBy;
}
@@ -24,4 +24,6 @@ class WarehouseOfferTemplateModel extends TTCrudBaseModel
public string $deliveryTerms;
public string $closingText;
public string $notes;
public int $create;
public int $createBy;
}