diff --git a/Admin/Hooks/Web/Api.php b/Admin/Hooks/Web/Api.php new file mode 100644 index 0000000..336606d --- /dev/null +++ b/Admin/Hooks/Web/Api.php @@ -0,0 +1,25 @@ + [ + 'callback' => ['\Modules\WarehouseManagement\Controller\ApiController:eventStockCreateInternal'], + ], + 'POST:Module:SupplierManagement-supplier-create' => [ + 'callback' => ['\Modules\WarehouseManagement\Controller\ApiController:eventStockCreateInternal'], + ], + '/POST:Module:Billing\-bill(_element)*\-(create|delete|update)/' => [ + 'callback' => ['\Modules\WarehouseManagement\Controller\ApiController:eventBillUpdateInternal'], + ], +]; diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json index 344d34a..60df5b0 100644 --- a/Admin/Install/Navigation.install.json +++ b/Admin/Install/Navigation.install.json @@ -9,10 +9,56 @@ "target": "self", "icon": "fa fa-cube", "order": 40, - "from": "Warehousing", + "from": "WarehouseManagement", "permission": { "permission": 2, "type": null, "element": null }, "parent": 0, "children": [ + { + "id": 1001302001, + "pid": "/", + "type": 2, + "subtype": 1, + "name": "Stock", + "uri": "{/prefix}warehouse/stock/list", + "target": "self", + "icon": null, + "order": 1, + "from": "WarehouseManagement", + "permission": { "permission": 2, "type": null, "element": null }, + "parent": 1001301001, + "children": [ + { + "id": 1001303001, + "pid": "/warehouse/stock", + "type": 3, + "subtype": 1, + "name": "Stocks", + "uri": "{/prefix}warehouse/stock/list", + "target": "self", + "icon": null, + "order": 1, + "from": "WarehouseManagement", + "permission": { "permission": 2, "type": null, "element": null }, + "parent": 1001302001, + "children": [] + }, + { + "id": 1001303002, + "pid": "/warehouse/stock", + "type": 3, + "subtype": 1, + "name": "Locations", + "uri": "{/prefix}warehouse/stock/location/list", + "target": "self", + "icon": null, + "order": 1, + "from": "WarehouseManagement", + "permission": { "permission": 2, "type": null, "element": null }, + "parent": 1001302001, + "children": [] + } + ] + } ] } ] diff --git a/Admin/Install/Navigation.php b/Admin/Install/Navigation.php index 0256785..e091e85 100644 --- a/Admin/Install/Navigation.php +++ b/Admin/Install/Navigation.php @@ -2,7 +2,7 @@ /** * Orange Management * - * PHP Version 7.4 + * PHP Version 8.0 * * @package Modules\WarehouseManagement\Admin\Install * @copyright Dennis Eichhorn diff --git a/Admin/Install/db.json b/Admin/Install/db.json index e683232..5a9d5fc 100644 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -267,7 +267,8 @@ "warehousemgmt_movement_lot": { "name": "warehousemgmt_movement_lot", "type": "INT", - "null": false, + "null": true, + "default": null, "foreignTable": "warehousemgmt_lot", "foreignKey": "warehousemgmt_lot_id" }, @@ -293,6 +294,7 @@ "null": false }, "warehousemgmt_movement_subtype": { + "description": "Destroy, return, sale, purchase, ...", "name": "warehousemgmt_movement_subtype", "type": "INT", "null": false, diff --git a/Admin/Installer.php b/Admin/Installer.php index 4d8195e..12738a4 100644 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -2,7 +2,7 @@ /** * Orange Management * - * PHP Version 7.4 + * PHP Version 8.0 * * @package Modules\WarehouseManagement\Admin * @copyright Dennis Eichhorn @@ -14,7 +14,15 @@ declare(strict_types=1); namespace Modules\WarehouseManagement\Admin; +use phpOMS\Config\SettingsInterface; +use phpOMS\DataStorage\Database\DatabasePool; +use phpOMS\Localization\ISO639x1Enum; use phpOMS\Module\InstallerAbstract; +use phpOMS\Module\ModuleInfo; +use Modules\WarehouseManagement\Models\Stock; +use Modules\WarehouseManagement\Models\StockMapper; +use Modules\WarehouseManagement\Models\StockLocation; +use Modules\WarehouseManagement\Models\StockLocationMapper; /** * Installer class. @@ -26,4 +34,24 @@ use phpOMS\Module\InstallerAbstract; */ final class Installer extends InstallerAbstract { + /** + * {@inheritdoc} + */ + public static function install(DatabasePool $dbPool, ModuleInfo $info, SettingsInterface $cfgHandler) : void + { + parent::install($dbPool, $info, $cfgHandler); + + self::createStock(); + } + + private static function createStock() : void + { + $stock = new Stock('Default'); + $stock->type = 0; + StockMapper::create($stock); + + $stockLocation = new StockLocation((string) ($stock->getId() . '-1')); + $stockLocation->stock = $stock; + StockLocationMapper::create($stockLocation); + } } diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php index f0b60b4..038973e 100644 --- a/Admin/Routes/Web/Backend.php +++ b/Admin/Routes/Web/Backend.php @@ -1,3 +1,65 @@ - [ + [ + 'dest' => '\Modules\WarehouseManagement\Controller\BackendController:viewStockList', + 'verb' => RouteVerb::GET, + 'permission' => [ + 'module' => BackendController::MODULE_NAME, + 'type' => PermissionType::READ, + 'state' => PermissionState::STOCK, + ], + ], + ], + '^.*/warehouse/stock(\?.*)?$' => [ + [ + 'dest' => '\Modules\WarehouseManagement\Controller\BackendController:viewStock', + 'verb' => RouteVerb::GET, + 'permission' => [ + 'module' => BackendController::MODULE_NAME, + 'type' => PermissionType::READ, + 'state' => PermissionState::STOCK, + ], + ], + ], + '^.*/warehouse/stock/location/list.*$' => [ + [ + 'dest' => '\Modules\WarehouseManagement\Controller\BackendController:viewStockLocationList', + 'verb' => RouteVerb::GET, + 'permission' => [ + 'module' => BackendController::MODULE_NAME, + 'type' => PermissionType::READ, + 'state' => PermissionState::STOCK_LOCATION, + ], + ], + ], + '^.*/warehouse/stock/location(\?.*)?$' => [ + [ + 'dest' => '\Modules\WarehouseManagement\Controller\BackendController:viewStockLocation', + 'verb' => RouteVerb::GET, + 'permission' => [ + 'module' => BackendController::MODULE_NAME, + 'type' => PermissionType::READ, + 'state' => PermissionState::STOCK_LOCATION, + ], + ], + ], +]; diff --git a/Admin/Status.php b/Admin/Status.php index 0f293f4..f6f2364 100644 --- a/Admin/Status.php +++ b/Admin/Status.php @@ -2,7 +2,7 @@ /** * Orange Management * - * PHP Version 7.4 + * PHP Version 8.0 * * @package Modules\WarehouseManagement\Admin * @copyright Dennis Eichhorn diff --git a/Admin/Uninstaller.php b/Admin/Uninstaller.php index 5a86ee3..01663ce 100644 --- a/Admin/Uninstaller.php +++ b/Admin/Uninstaller.php @@ -2,7 +2,7 @@ /** * Orange Management * - * PHP Version 7.4 + * PHP Version 8.0 * * @package Modules\WarehouseManagement\Admin * @copyright Dennis Eichhorn diff --git a/Admin/Updater.php b/Admin/Updater.php index 97ceadb..ad7f136 100644 --- a/Admin/Updater.php +++ b/Admin/Updater.php @@ -2,7 +2,7 @@ /** * Orange Management * - * PHP Version 7.4 + * PHP Version 8.0 * * @package Modules\WarehouseManagement\Admin * @copyright Dennis Eichhorn diff --git a/Controller/ApiController.php b/Controller/ApiController.php new file mode 100644 index 0000000..5c9e8d6 --- /dev/null +++ b/Controller/ApiController.php @@ -0,0 +1,84 @@ +number); + $stock->type = 1; + StockMapper::create($stock); + + $stockLocation = new StockLocation($new->number . '-1'); + $stockLocation->stock = $stock->getId(); + StockLocationMapper::create($stockLocation); + } + + public function eventBillUpdateInternal( + int $account, + mixed $old, + mixed $new, + int $type = 0, + string $trigger = '', + string $module = null, + string $ref = null, + string $content = null, + string $ip = null + ) : void + { + if ($trigger === 'POST:Module:Billing-bill_element-create') { + // @todo: if is bill element create, create stock movement + + } elseif ($trigger === 'POST:Module:Billing-bill_element-update') { + // quantity change + // lot changes + // stock changes + // all other changes ignore! + // check availability again, if not available abort bill + } elseif ($trigger === 'POST:Module:Billing-bill_element-delete') { + // @todo: delete stock movement + } elseif ($trigger === 'POST:Module:Billing-bill-delete') { + // @todo: delete stock movements + } elseif ($trigger === 'POST:Module:Billing-bill-update') { + // is receiver update -> change all movements + // is status update -> change all movements (delete = delete) + } + } +} diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 12a7db9..34cf25e 100644 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -2,7 +2,7 @@ /** * Orange Management * - * PHP Version 7.4 + * PHP Version 8.0 * * @package Modules\WarehouseManagement * @copyright Dennis Eichhorn @@ -14,6 +14,13 @@ declare(strict_types=1); namespace Modules\WarehouseManagement\Controller; +use Modules\WarehouseManagement\Models\StockMapper; +use Modules\WarehouseManagement\Models\StockLocationMapper; +use phpOMS\Contract\RenderableInterface; +use phpOMS\Message\RequestAbstract; +use phpOMS\Message\ResponseAbstract; +use phpOMS\Views\View; + /** * WarehouseManagement class. * @@ -24,4 +31,131 @@ namespace Modules\WarehouseManagement\Controller; */ final class BackendController extends Controller { + /** + * Routing end-point for application behaviour. + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return RenderableInterface Returns a renderable object + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + public function viewStockList(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + { + $view = new View($this->app->l11nManager, $request, $response); + + $view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock-list'); + $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response)); + + if ($request->getData('ptype') === 'p') { + $view->setData('stocks', + StockMapper::withConditional('language', $response->getLanguage()) + ::getBeforePivot((int) ($request->getData('id') ?? 0), limit: 25) + ); + } elseif ($request->getData('ptype') === 'n') { + $view->setData('stocks', + StockMapper::withConditional('language', $response->getLanguage()) + ::getAfterPivot((int) ($request->getData('id') ?? 0), limit: 25) + ); + } else { + $view->setData('stocks', + StockMapper::withConditional('language', $response->getLanguage()) + ::getAfterPivot(0, limit: 25) + ); + } + + return $view; + } + + /** + * Routing end-point for application behaviour. + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return RenderableInterface Returns a renderable object + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + public function viewStock(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + { + $view = new View($this->app->l11nManager, $request, $response); + + $view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock'); + $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response)); + + $view->setData('stock', StockMapper::get((int) $request->getData('id'))); + + + return $view; + } + + /** + * Routing end-point for application behaviour. + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return RenderableInterface Returns a renderable object + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + public function viewStockLocationList(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + { + $view = new View($this->app->l11nManager, $request, $response); + + $view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock-location-list'); + $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response)); + + if ($request->getData('ptype') === 'p') { + $view->setData('locations', + StockLocationMapper::withConditional('language', $response->getLanguage()) + ::getBeforePivot((int) ($request->getData('id') ?? 0), limit: 25) + ); + } elseif ($request->getData('ptype') === 'n') { + $view->setData('locations', + StockLocationMapper::withConditional('language', $response->getLanguage()) + ::getAfterPivot((int) ($request->getData('id') ?? 0), limit: 25) + ); + } else { + $view->setData('locations', + StockLocationMapper::withConditional('language', $response->getLanguage()) + ::getAfterPivot(0, limit: 25) + ); + } + + return $view; + } + + /** + * Routing end-point for application behaviour. + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return RenderableInterface Returns a renderable object + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + public function viewStockLocation(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + { + $view = new View($this->app->l11nManager, $request, $response); + + $view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock-location'); + $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response)); + + $view->setData('location', StockLocationMapper::get((int) $request->getData('id'))); + + + return $view; + } } diff --git a/Controller/Controller.php b/Controller/Controller.php index 4d5d110..60e0709 100644 --- a/Controller/Controller.php +++ b/Controller/Controller.php @@ -2,7 +2,7 @@ /** * Orange Management * - * PHP Version 7.4 + * PHP Version 8.0 * * @package Modules\WarehouseManagement * @copyright Dennis Eichhorn diff --git a/Models/Arrival.php b/Models/Arrival.php deleted file mode 100644 index 7e8489a..0000000 --- a/Models/Arrival.php +++ /dev/null @@ -1,250 +0,0 @@ -id = $id; - } - - /** - * Get ID. - * - * @return int - * - * @since 1.0.0 - */ - public function getId() - { - return $this->id; - } - - /** - * Get date of when the consignment arrived. - * - * @return \DateTime Date of arrival - * - * @since 1.0.0 - */ - public function getDate() - { - return $this->date; - } - - /** - * Set date of when the consignment arrived. - * - * @param \DateTime $date Date of arrival - * - * @return void - * - * @since 1.0.0 - */ - public function setDate($date) : void - { - $this->date = $date; - } - - /** - * Get order. - * - * @return string - * - * @since 1.0.0 - */ - public function getOrder() : string - { - return $this->order; - } - - /** - * Set order. - * - * @param string $order Order Id - * - * @return void - * - * @since 1.0.0 - */ - public function setOrder(string $order) : void - { - $this->order = $order; - } - - /** - * Get From. - * - * @return \phpOMS\Stdlib\Base\Address - * - * @since 1.0.0 - */ - public function getFrom() - { - return $this->from; - } - - /** - * Set From. - * - * @param \phpOMS\Stdlib\Base\Address $from Consignor - * - * @return void - * - * @since 1.0.0 - */ - public function setFrom($from) : void - { - $this->from = $from; - } - - /** - * Get status. - * - * @return int - * - * @since 1.0.0 - */ - public function getStatus() : int - { - return $this->status; - } - - /** - * Set status. - * - * @param int $status Status - * - * @return void - * - * @since 1.0.0 - */ - public function setStatus(int $status) : void - { - $this->status = $status; - } - - /** - * Get warehouse. - * - * @return Warehouse - * - * @since 1.0.0 - */ - public function getWarehouse() - { - return $this->warehouse; - } - - /** - * Get acceptor. - * - * @return int - * - * @since 1.0.0 - */ - public function getAcceptor() - { - return $this->acceptor; - } - - /** - * Set acceptor. - * - * @param int $acceptor Person who accepted the consignment - * - * @return void - * - * @since 1.0.0 - */ - public function setAcceptor($acceptor) : void - { - $this->acceptor = $acceptor; - } -} diff --git a/Models/Article.php b/Models/Article.php deleted file mode 100644 index 45cf39b..0000000 --- a/Models/Article.php +++ /dev/null @@ -1,333 +0,0 @@ -id = $id; - } - - /** - * Get ID. - * - * @return int - * - * @since 1.0.0 - */ - public function getId() - { - return $this->id; - } - - /** - * Get name. - * - * @return string - * - * @since 1.0.0 - */ - public function getName() - { - return $this->name; - } - - /** - * Set name. - * - * @param string $name Name of the article - * - * @return void - * - * @since 1.0.0 - */ - public function setName($name) : void - { - $this->name = $name; - } - - /** - * Get matchcode. - * - * @return string - * - * @since 1.0.0 - */ - public function getMatchcode() - { - return $this->matchcode; - } - - /** - * Set matchcode. - * - * @param string $matchcode Matchcode of the article - * - * @return void - * - * @since 1.0.0 - */ - public function setMatchcode($matchcode) : void - { - $this->matchcode = $matchcode; - } - - /** - * Get description. - * - * @return string - * - * @since 1.0.0 - */ - public function getDescription() - { - return $this->description; - } - - /** - * Set description. - * - * @param string $desc Description of the article - * - * @return void - * - * @since 1.0.0 - */ - public function setDescription($desc) : void - { - $this->description = $desc; - } - - /** - * Get created. - * - * @return \DateTime - * - * @since 1.0.0 - */ - public function getCreated() - { - return $this->created; - } - - /** - * Set created. - * - * @param \DateTime $created Date of when the article got created - * - * @return void - * - * @since 1.0.0 - */ - public function setCreated($created) : void - { - $this->created = $created; - } - - /** - * Get creator. - * - * @return \phpOMS\Models\User - * - * @since 1.0.0 - */ - public function getCreator() - { - return $this->creator; - } - - /** - * Set creator. - * - * @param \phpOMS\Models\User $creator Creator ID - * - * @return void - * - * @since 1.0.0 - */ - public function setCreator($creator) : void - { - $this->creator = $creator; - } - - /** - * Add price to pricelist. - * - * @param array $price Price - * @param bool $db Update DB and cache? - * - * @return void - * - * @since 1.0.0 - */ - public function addPrice($price, $db = true) : void - { - $id = 0; /* insert and get id */ - $this->prices[$id] = $price; - } - - /** - * Remove price from pricelist. - * - * @param int $id Price ID - * @param bool $db Update DB and cache? - * - * @return void - * - * @since 1.0.0 - */ - public function removePrice($id, $db = true) : void - { - if (isset($this->prices[$id])) { - unset($this->prices[$id]); - } - } - - /** - * Add price to pricelist. - * - * @param int $id Price ID - * @param array $price Price - * @param bool $db Update DB and cache? - * - * @return void - * - * @since 1.0.0 - */ - public function editPrice($id, $price, $db = true) : void - { - if (isset($this->prices[$id])) { - $this->prices[$id] = $price; - } - } -} diff --git a/Models/CountingList.php b/Models/CountingList.php index ec5b5f1..1f14a83 100644 --- a/Models/CountingList.php +++ b/Models/CountingList.php @@ -2,7 +2,7 @@ /** * Orange Management * - * PHP Version 7.4 + * PHP Version 8.0 * * @package Modules\Warehousing\Models * @copyright Dennis Eichhorn diff --git a/Models/PackagingStatus.php b/Models/PermissionState.php similarity index 53% rename from Models/PackagingStatus.php rename to Models/PermissionState.php index dc920d8..84778ca 100644 --- a/Models/PackagingStatus.php +++ b/Models/PermissionState.php @@ -2,9 +2,9 @@ /** * Orange Management * - * PHP Version 7.4 + * PHP Version 8.0 * - * @package Modules\Warehousing\Models + * @package Modules\WarehouseManagement\Models * @copyright Dennis Eichhorn * @license OMS License 1.0 * @version 1.0.0 @@ -17,22 +17,15 @@ namespace Modules\WarehouseManagement\Models; use phpOMS\Stdlib\Base\Enum; /** - * Packaging status enum. + * Permision state enum. * - * @package Modules\Warehousing\Models + * @package Modules\WarehouseManagement\Models * @license OMS License 1.0 * @link https://orange-management.org * @since 1.0.0 */ -abstract class PackagingStatus extends Enum +abstract class PermissionState extends Enum { - public const PENDING = 0; - - public const PACKING = 1; - - public const PACKED = 2; - - public const SUSPENDED = 3; - - public const CANCELED = 4; + public const STOCK = 1; + public const STOCK_LOCATION = 2; } diff --git a/Models/Shipping.php b/Models/Shipping.php deleted file mode 100644 index b8c8994..0000000 --- a/Models/Shipping.php +++ /dev/null @@ -1,248 +0,0 @@ -id = $id; - } - - /** - * Get ID. - * - * @return int - * - * @since 1.0.0 - */ - public function getId() - { - return $this->id; - } - - /** - * Get order. - * - * @return int - * - * @since 1.0.0 - */ - public function getOrder() : int - { - return $this->order; - } - - /** - * Set order. - * - * @param int $order Order ID - * - * @return void - * - * @since 1.0.0 - */ - public function setOrder(int $order) : void - { - $this->order = $order; - } - - /** - * Get delivered. - * - * @return \DateTime - * - * @since 1.0.0 - */ - public function getDelivered() - { - return $this->delivered; - } - - /** - * Set delivered. - * - * @param \DateTime $delivered Date of delivery - * - * @return void - * - * @since 1.0.0 - */ - public function setDelivered($delivered) : void - { - $this->delivered = $delivered; - } - - /** - * Get To. - * - * @return \phpOMS\Stdlib\Base\Address - * - * @since 1.0.0 - */ - public function getTo() - { - return $this->to; - } - - /** - * Set To. - * - * @param \phpOMS\Stdlib\Base\Address $to Receiver - * - * @return void - * - * @since 1.0.0 - */ - public function setTo($to) : void - { - $this->to = $to; - } - - /** - * Get status. - * - * @return int - * - * @since 1.0.0 - */ - public function getStatus() : int - { - return $this->status; - } - - /** - * Set status. - * - * @param int $status Status - * - * @return void - * - * @since 1.0.0 - */ - public function setStatus(int $status) : void - { - $this->status = $status; - } - - /** - * Get warehouse. - * - * @return mixed - * - * @since 1.0.0 - */ - public function getWarehouse() - { - return $this->warehouse; - } - - /** - * Get acceptor. - * - * @return int - * - * @since 1.0.0 - */ - public function getSender() - { - return $this->sender; - } - - /** - * Set sender. - * - * @param int $sender Person who accepted the consignment - * - * @return void - * - * @since 1.0.0 - */ - public function setSender($sender) : void - { - $this->sender = $sender; - } -} diff --git a/Models/ArrivalStatus.php b/Models/Stock.php similarity index 53% rename from Models/ArrivalStatus.php rename to Models/Stock.php index 4c17cc5..114955f 100644 --- a/Models/ArrivalStatus.php +++ b/Models/Stock.php @@ -2,7 +2,7 @@ /** * Orange Management * - * PHP Version 7.4 + * PHP Version 8.0 * * @package Modules\Warehousing\Models * @copyright Dennis Eichhorn @@ -14,25 +14,35 @@ declare(strict_types=1); namespace Modules\WarehouseManagement\Models; -use phpOMS\Stdlib\Base\Enum; - /** - * Arrival status enum. + * Warehouse class. * * @package Modules\Warehousing\Models * @license OMS License 1.0 * @link https://orange-management.org * @since 1.0.0 */ -abstract class ArrivalStatus extends Enum +class Stock { - public const NONE = 0; + /** + * ID. + * + * @var int + * @since 1.0.0 + */ + private int $id = 0; - public const PENDING = 1; + public string $name = ''; - public const CHECKING = 2; + public int $type = 0; - public const SORTING = 3; + public function __construct(string $name = '') + { + $this->name = $name; + } - public const FINISHED = 4; + public function getId() : int + { + return $this->id; + } } diff --git a/Models/StockLocation.php b/Models/StockLocation.php new file mode 100644 index 0000000..afbccfd --- /dev/null +++ b/Models/StockLocation.php @@ -0,0 +1,54 @@ +name = $name; + } + + public function getId() : int + { + return $this->id; + } +} diff --git a/Models/StockLocationMapper.php b/Models/StockLocationMapper.php new file mode 100644 index 0000000..785fa37 --- /dev/null +++ b/Models/StockLocationMapper.php @@ -0,0 +1,72 @@ + + * @since 1.0.0 + */ + protected static array $columns = [ + 'warehousemgmt_stocklocation_id' => ['name' => 'warehousemgmt_stocklocation_id', 'type' => 'int', 'internal' => 'id'], + 'warehousemgmt_stocklocation_name' => ['name' => 'warehousemgmt_stocklocation_name', 'type' => 'string', 'internal' => 'name'], + 'warehousemgmt_stocklocation_stock' => ['name' => 'warehousemgmt_stocklocation_stock', 'type' => 'int', 'internal' => 'stock'], + 'warehousemgmt_stocklocation_x' => ['name' => 'warehousemgmt_stocklocation_x', 'type' => 'int', 'internal' => 'x'], + 'warehousemgmt_stocklocation_y' => ['name' => 'warehousemgmt_stocklocation_y', 'type' => 'int', 'internal' => 'y'], + 'warehousemgmt_stocklocation_z' => ['name' => 'warehousemgmt_stocklocation_z', 'type' => 'int', 'internal' => 'z'], + ]; + + /** + * Belongs to. + * + * @var array + * @since 1.0.0 + */ + protected static array $belongsTo = [ + 'stock' => [ + 'mapper' => StockMapper::class, + 'external' => 'warehousemgmt_stocklocation_stock', + ], + ]; + + /** + * Primary table. + * + * @var string + * @since 1.0.0 + */ + protected static string $table = 'warehousemgmt_stocklocation'; + + /** + * Primary field name. + * + * @var string + * @since 1.0.0 + */ + protected static string $primaryField = 'warehousemgmt_stocklocation_id'; +} diff --git a/Models/StockMapper.php b/Models/StockMapper.php new file mode 100644 index 0000000..3d17576 --- /dev/null +++ b/Models/StockMapper.php @@ -0,0 +1,56 @@ + + * @since 1.0.0 + */ + protected static array $columns = [ + 'warehousemgmt_stock_id' => ['name' => 'warehousemgmt_stock_id', 'type' => 'int', 'internal' => 'id'], + 'warehousemgmt_stock_name' => ['name' => 'warehousemgmt_stock_name', 'type' => 'string', 'internal' => 'name'], + 'warehousemgmt_stock_type' => ['name' => 'warehousemgmt_stock_type', 'type' => 'int', 'internal' => 'type'], + ]; + + /** + * Primary table. + * + * @var string + * @since 1.0.0 + */ + protected static string $table = 'warehousemgmt_stock'; + + /** + * Primary field name. + * + * @var string + * @since 1.0.0 + */ + protected static string $primaryField = 'warehousemgmt_stock_id'; +} diff --git a/Models/StockMovement.php b/Models/StockMovement.php new file mode 100644 index 0000000..91a4b26 --- /dev/null +++ b/Models/StockMovement.php @@ -0,0 +1,78 @@ +id; + } +} diff --git a/Models/StockMovementMapper.php b/Models/StockMovementMapper.php new file mode 100644 index 0000000..e69de29 diff --git a/Models/Warehouse.php b/Models/Warehouse.php deleted file mode 100644 index 4c4fcc0..0000000 --- a/Models/Warehouse.php +++ /dev/null @@ -1,160 +0,0 @@ -id = $id; - } - - /** - * Get ID. - * - * @return int - * - * @since 1.0.0 - */ - public function getId() - { - return $this->id; - } - - /** - * Get name. - * - * @return string - * - * @since 1.0.0 - */ - public function getName() - { - return $this->name; - } - - /** - * Set name. - * - * @param string $name Name of the article - * - * @return void - * - * @since 1.0.0 - */ - public function setName($name) : void - { - $this->name = $name; - } - - /** - * Get name. - * - * @return string - * - * @since 1.0.0 - */ - public function getDescription() - { - return $this->description; - } - - /** - * Set name. - * - * @param string $description Description of the warehouse - * - * @return void - * - * @since 1.0.0 - */ - public function setDescription($description) : void - { - $this->description = $description; - } - - /** - * Get location. - * - * @return \phpOMS\Stdlib\Base\Location - * - * @since 1.0.0 - */ - public function getLocation() - { - return $this->location; - } - - /** - * Set location. - * - * @param \phpOMS\Stdlib\Base\Location $location Location of the warehouse - * - * @return void - * - * @since 1.0.0 - */ - public function setLocation($location) : void - { - $this->location = $location; - } -} diff --git a/Theme/Backend/Lang/Navigation.en.lang.php b/Theme/Backend/Lang/Navigation.en.lang.php index 3d077b2..f1c0603 100644 --- a/Theme/Backend/Lang/Navigation.en.lang.php +++ b/Theme/Backend/Lang/Navigation.en.lang.php @@ -2,7 +2,7 @@ /** * Orange Management * - * PHP Version 7.4 + * PHP Version 8.0 * * @package Modules\WarehouseManagement * @copyright Dennis Eichhorn @@ -15,7 +15,9 @@ declare(strict_types=1); return ['Navigation' => [ 'Arrival' => 'Arrival', 'Articles' => 'Articles', + 'Locations' => 'Locations', 'Shipping' => 'Shipping', 'Stock' => 'Stock', + 'Stocks' => 'Stocks', 'Warehousing' => 'Warehousing', ]]; diff --git a/Theme/Backend/Lang/api.en.lang.php b/Theme/Backend/Lang/api.en.lang.php index 2557a9e..d3db293 100644 --- a/Theme/Backend/Lang/api.en.lang.php +++ b/Theme/Backend/Lang/api.en.lang.php @@ -2,7 +2,7 @@ /** * Orange Management * - * PHP Version 7.4 + * PHP Version 8.0 * * @package Modules\WarehouseManagement * @copyright Dennis Eichhorn diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index dc0fc19..74d4d7a 100644 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -2,7 +2,7 @@ /** * Orange Management * - * PHP Version 7.4 + * PHP Version 8.0 * * @package Modules\WarehouseManagement * @copyright Dennis Eichhorn diff --git a/Theme/Backend/stock-list.tpl.php b/Theme/Backend/stock-list.tpl.php new file mode 100644 index 0000000..891589a --- /dev/null +++ b/Theme/Backend/stock-list.tpl.php @@ -0,0 +1,47 @@ +getData('stocks') ?? []; + +echo $this->getData('nav')->render(); ?> + +
+
+
+
getHtml('Stocks'); ?>
+ + + + + $value) : + ++$count; + $url = UriFactory::build('{/prefix}warehouse/stock?{?}&id=' . $value->getId()); + ?> + +
getHtml('ID', '0', '0'); ?> + getHtml('Type'); ?> + getHtml('Name'); ?> +
getId(); ?> + type; ?> + name; ?> + + +
getHtml('Empty', '0', '0'); ?> + +
+
+
+
diff --git a/Theme/Backend/stock-location-list.tpl.php b/Theme/Backend/stock-location-list.tpl.php new file mode 100644 index 0000000..49f3cf4 --- /dev/null +++ b/Theme/Backend/stock-location-list.tpl.php @@ -0,0 +1,47 @@ +getData('locations') ?? []; + +echo $this->getData('nav')->render(); ?> + +
+
+
+
getHtml('Locations'); ?>
+ + + + + $value) : + ++$count; + $url = UriFactory::build('{/prefix}warehouse/stock/location?{?}&id=' . $value->getId()); + ?> + +
getHtml('ID', '0', '0'); ?> + getHtml('Stock'); ?> + getHtml('Name'); ?> +
getId(); ?> + stock->name; ?> + name; ?> + + +
getHtml('Empty', '0', '0'); ?> + +
+
+
+
diff --git a/Theme/Backend/stock-location.tpl.php b/Theme/Backend/stock-location.tpl.php new file mode 100644 index 0000000..5b030ee --- /dev/null +++ b/Theme/Backend/stock-location.tpl.php @@ -0,0 +1,26 @@ +getData('location'); + +echo $this->getData('nav')->render(); +?> +
+
+
+
printHtml($location->name); ?>
+
+
+
+
\ No newline at end of file diff --git a/Theme/Backend/stock.tpl.php b/Theme/Backend/stock.tpl.php new file mode 100644 index 0000000..1bb5af7 --- /dev/null +++ b/Theme/Backend/stock.tpl.php @@ -0,0 +1,26 @@ +getData('stock'); + +echo $this->getData('nav')->render(); +?> +
+
+
+
printHtml($stock->name); ?>
+
+
+
+
\ No newline at end of file diff --git a/info.json b/info.json index 5b3e45c..3c86332 100644 --- a/info.json +++ b/info.json @@ -17,7 +17,9 @@ "description": "Warehousing module.", "directory": "WarehouseManagement", "dependencies": { - "Admin": "1.0.0" + "Admin": "1.0.0", + "ItemManagement": "1.0.0", + "Billing": "1.0.0" }, "providing": { "Navigation": "*" @@ -28,7 +30,7 @@ "/warehouse" ], "type": 4, - "for": 0, + "for": "WarehouseManagement", "from": "WarehouseManagement", "file": "WarehouseManagement" },