diff --git a/Admin/Installer.php b/Admin/Installer.php index 55a31b0..d6f8485 100644 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -15,9 +15,9 @@ declare(strict_types=1); namespace Modules\Billing\Admin; use Modules\Billing\Models\BillType; -use Modules\Billing\Models\BillTypeMapper; use Modules\Billing\Models\BillTypeL11n; use Modules\Billing\Models\BillTypeL11nMapper; +use Modules\Billing\Models\BillTypeMapper; use phpOMS\Config\SettingsInterface; use phpOMS\DataStorage\Database\DatabasePool; use phpOMS\Localization\ISO639x1Enum; @@ -34,7 +34,7 @@ use phpOMS\Module\ModuleInfo; */ final class Installer extends InstallerAbstract { - /** + /** * {@inheritdoc} */ public static function install(DatabasePool $dbPool, ModuleInfo $info, SettingsInterface $cfgHandler) : void diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php index e5c4ab9..cb13ef9 100644 --- a/Admin/Routes/Web/Backend.php +++ b/Admin/Routes/Web/Backend.php @@ -8,56 +8,56 @@ use phpOMS\Router\RouteVerb; return [ '^.*/sales/invoice/create.*$' => [ [ - 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingInvoiceCreate', - 'verb' => RouteVerb::GET, + 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingInvoiceCreate', + 'verb' => RouteVerb::GET, 'permission' => [ 'module' => BackendController::MODULE_NAME, - 'type' => PermissionType::CREATE, - 'state' => PermissionState::SALES_INVOICE, + 'type' => PermissionType::CREATE, + 'state' => PermissionState::SALES_INVOICE, ], ], ], '^.*/sales/invoice/list.*$' => [ [ - 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingInvoiceList', - 'verb' => RouteVerb::GET, + 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingInvoiceList', + 'verb' => RouteVerb::GET, 'permission' => [ 'module' => BackendController::MODULE_NAME, - 'type' => PermissionType::READ, - 'state' => PermissionState::SALES_INVOICE, + 'type' => PermissionType::READ, + 'state' => PermissionState::SALES_INVOICE, ], ], ], '^.*/sales/invoice\?.*$' => [ [ - 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingInvoice', - 'verb' => RouteVerb::GET, + 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingInvoice', + 'verb' => RouteVerb::GET, 'permission' => [ 'module' => BackendController::MODULE_NAME, - 'type' => PermissionType::READ, - 'state' => PermissionState::SALES_INVOICE, + 'type' => PermissionType::READ, + 'state' => PermissionState::SALES_INVOICE, ], ], ], '^.*/purchase/invoice/create.*$' => [ [ - 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingPurchaseInvoiceCreate', - 'verb' => RouteVerb::GET, + 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingPurchaseInvoiceCreate', + 'verb' => RouteVerb::GET, 'permission' => [ 'module' => BackendController::MODULE_NAME, - 'type' => PermissionType::CREATE, - 'state' => PermissionState::PURCHASE_INVOICE, + 'type' => PermissionType::CREATE, + 'state' => PermissionState::PURCHASE_INVOICE, ], ], ], '^.*/purchase/invoice/list.*$' => [ [ - 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingPurchaInvoiceList', - 'verb' => RouteVerb::GET, + 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingPurchaInvoiceList', + 'verb' => RouteVerb::GET, 'permission' => [ 'module' => BackendController::MODULE_NAME, - 'type' => PermissionType::READ, - 'state' => PermissionState::PURCHASE_INVOICE, + 'type' => PermissionType::READ, + 'state' => PermissionState::PURCHASE_INVOICE, ], ], ], diff --git a/Controller/ApiController.php b/Controller/ApiController.php index be8e1e9..0b2a35c 100644 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -16,22 +16,19 @@ namespace Modules\Billing\Controller; use Modules\Admin\Models\NullAccount; use Modules\Billing\Models\Bill; -use Modules\Billing\Models\BillMapper; use Modules\Billing\Models\BillElement; use Modules\Billing\Models\BillElementMapper; +use Modules\Billing\Models\BillMapper; use Modules\Billing\Models\NullBillType; +use Modules\ClientManagement\Models\ClientMapper; use Modules\ClientManagement\Models\NullClient; -use phpOMS\Message\Http\HttpRequest; -use phpOMS\Message\Http\HttpResponse; +use Modules\ItemManagement\Models\ItemMapper; +use phpOMS\Localization\Money; use phpOMS\Message\Http\RequestStatusCode; use phpOMS\Message\NotificationLevel; use phpOMS\Message\RequestAbstract; use phpOMS\Message\ResponseAbstract; use phpOMS\Model\Message\FormValidation; -use phpOMS\Utils\Parser\Markdown\Markdown; -use Modules\ItemManagement\Models\ItemMapper; -use phpOMS\Localization\Money; -use Modules\ClientManagement\Models\ClientMapper; /** * Billing class. @@ -90,9 +87,9 @@ final class ApiController extends Controller $bill->number = '{y}-{id}'; // @todo: use admin defined format $bill->billTo = $request->getData('billto') ?? ($client->profile->account->name1 . (!empty($client->profile->account->name2) ? ', ' . $client->profile->account->name2 : '')); // @todo: use defaultInvoiceAddress or mainAddress. also consider to use billto1, billto2, billto3 (for multiple lines e.g. name2, fao etc.) - $bill->billCountry = $request->getData('billtocountry') ?? $client->mainAddress->getCountry(); - $bill->type = new NullBillType((int) $request->getData('type')); - $bill->client = new NullClient((int) $request->getData('client')); + $bill->billCountry = $request->getData('billtocountry') ?? $client->mainAddress->getCountry(); + $bill->type = new NullBillType((int) $request->getData('type')); + $bill->client = new NullClient((int) $request->getData('client')); $bill->performanceDate = new \DateTime($request->getData('performancedate') ?? 'now'); return $bill; @@ -168,7 +165,7 @@ final class ApiController extends Controller */ public function createBillElementFromRequest(RequestAbstract $request, ResponseAbstract $response, $data = null) : BillElement { - $element = new BillElement(); + $element = new BillElement(); $element->bill = (int) $request->getData('bill'); $element->item = $request->getData('item', 'int'); @@ -179,11 +176,11 @@ final class ApiController extends Controller $item = ItemMapper::withConditional('language', $response->getLanguage())::get($element->item); // @todo: which item name should be stored in the database? server language (problem for international company with subsidiaries)? customer default language/customer invoice language? $element->itemNumber = $item->number; - $element->itemName = $item->getL11n('name1')->description; - $element->quantity = $request->getData('quantity', 'int'); + $element->itemName = $item->getL11n('name1')->description; + $element->quantity = $request->getData('quantity', 'int'); $element->singleSalesPriceNet = new Money($request->getData('singlesalespricenet', 'int') ?? $item->salesPrice->getInt()); - $element->totalSalesPriceNet = clone $element->singleSalesPriceNet; + $element->totalSalesPriceNet = clone $element->singleSalesPriceNet; $element->totalSalesPriceNet->mult($element->quantity); // discounts @@ -193,7 +190,7 @@ final class ApiController extends Controller } $element->singlePurchasePriceNet = new Money($item->purchasePrice->getInt()); - $element->totalPurchasePriceNet = clone $element->singlePurchasePriceNet; + $element->totalPurchasePriceNet = clone $element->singlePurchasePriceNet; $element->totalPurchasePriceNet->mult($element->quantity); return $element; diff --git a/Controller/BackendController.php b/Controller/BackendController.php index e99e471..db8eb54 100644 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -15,13 +15,11 @@ declare(strict_types=1); namespace Modules\Billing\Controller; use Modules\Billing\Models\BillMapper; +use Modules\Billing\Models\BillTypeL11n; use phpOMS\Contract\RenderableInterface; use phpOMS\Message\RequestAbstract; use phpOMS\Message\ResponseAbstract; use phpOMS\Views\View; -use Modules\Billing\Models\BillType; -use Modules\Billing\Models\BillTypeL11n; -use phpOMS\DataStorage\Database\RelationType; /** * Billing class. diff --git a/Models/Bill.php b/Models/Bill.php index c6bd247..3af86ea 100644 --- a/Models/Bill.php +++ b/Models/Bill.php @@ -51,7 +51,9 @@ class Bill implements \JsonSerializable * @var int|BillType * @since 1.0.0 */ - public int|BillType $type = 0; + public int | + +BillType $type = 0; /** * Bill status. @@ -246,15 +248,15 @@ class Bill implements \JsonSerializable */ public function __construct() { - $this->net = new Money(0); - $this->gross = new Money(0); - $this->costs = new Money(0); + $this->net = new Money(0); + $this->gross = new Money(0); + $this->costs = new Money(0); $this->profit = new Money(0); - $this->createdAt = new \DateTimeImmutable(); + $this->createdAt = new \DateTimeImmutable(); $this->performanceDate = new \DateTime(); - $this->createdBy = new NullAccount(); - $this->referer = new NullAccount(); + $this->createdBy = new NullAccount(); + $this->referer = new NullAccount(); } /** diff --git a/Models/BillElement.php b/Models/BillElement.php index 5c2e30b..b439987 100644 --- a/Models/BillElement.php +++ b/Models/BillElement.php @@ -83,10 +83,10 @@ class BillElement implements \JsonSerializable public function __construct() { $this->singleSalesPriceNet = new Money(); - $this->totalSalesPriceNet = new Money(); + $this->totalSalesPriceNet = new Money(); $this->singlePurchasePriceNet = new Money(); - $this->totalPurchasePriceNet = new Money(); + $this->totalPurchasePriceNet = new Money(); } /** diff --git a/Models/BillElementMapper.php b/Models/BillElementMapper.php index 629b3a7..03270a8 100644 --- a/Models/BillElementMapper.php +++ b/Models/BillElementMapper.php @@ -14,7 +14,6 @@ declare(strict_types=1); namespace Modules\Billing\Models; -use Modules\ClientManagement\Models\ClientMapper; use phpOMS\DataStorage\Database\DataMapperAbstract; /** @@ -34,18 +33,18 @@ final class BillElementMapper extends DataMapperAbstract * @since 1.0.0 */ protected static array $columns = [ - 'billing_out_element_id' => ['name' => 'billing_out_element_id', 'type' => 'int', 'internal' => 'id'], - 'billing_out_element_order' => ['name' => 'billing_out_element_order', 'type' => 'int', 'internal' => 'order'], - 'billing_out_element_item' => ['name' => 'billing_out_element_item', 'type' => 'int', 'internal' => 'item'], - 'billing_out_element_item_number' => ['name' => 'billing_out_element_item_number', 'type' => 'string', 'internal' => 'itemNumber'], - 'billing_out_element_item_name' => ['name' => 'billing_out_element_item_name', 'type' => 'string', 'internal' => 'itemName'], - 'billing_out_element_item_desc' => ['name' => 'billing_out_element_item_desc', 'type' => 'string', 'internal' => 'itemDescription'], - 'billing_out_element_quantity' => ['name' => 'billing_out_element_quantity', 'type' => 'int', 'internal' => 'quantity'], - 'billing_out_element_single_salesprice_net' => ['name' => 'billing_out_element_single_salesprice_net', 'type' => 'Serializable', 'internal' => 'singleSalesPriceNet'], + 'billing_out_element_id' => ['name' => 'billing_out_element_id', 'type' => 'int', 'internal' => 'id'], + 'billing_out_element_order' => ['name' => 'billing_out_element_order', 'type' => 'int', 'internal' => 'order'], + 'billing_out_element_item' => ['name' => 'billing_out_element_item', 'type' => 'int', 'internal' => 'item'], + 'billing_out_element_item_number' => ['name' => 'billing_out_element_item_number', 'type' => 'string', 'internal' => 'itemNumber'], + 'billing_out_element_item_name' => ['name' => 'billing_out_element_item_name', 'type' => 'string', 'internal' => 'itemName'], + 'billing_out_element_item_desc' => ['name' => 'billing_out_element_item_desc', 'type' => 'string', 'internal' => 'itemDescription'], + 'billing_out_element_quantity' => ['name' => 'billing_out_element_quantity', 'type' => 'int', 'internal' => 'quantity'], + 'billing_out_element_single_salesprice_net' => ['name' => 'billing_out_element_single_salesprice_net', 'type' => 'Serializable', 'internal' => 'singleSalesPriceNet'], 'billing_out_element_single_purchaseprice_net' => ['name' => 'billing_out_element_single_purchaseprice_net', 'type' => 'Serializable', 'internal' => 'singlePurchasePriceNet'], - 'billing_out_element_total_salesprice_net' => ['name' => 'billing_out_element_total_salesprice_net', 'type' => 'Serializable', 'internal' => 'totalSalesPriceNet'], - 'billing_out_element_total_purchaseprice_net' => ['name' => 'billing_out_element_total_purchaseprice_net', 'type' => 'Serializable', 'internal' => 'totalPurchasePriceNet'], - 'billing_out_element_bill' => ['name' => 'billing_out_element_bill', 'type' => 'int', 'internal' => 'bill'], + 'billing_out_element_total_salesprice_net' => ['name' => 'billing_out_element_total_salesprice_net', 'type' => 'Serializable', 'internal' => 'totalSalesPriceNet'], + 'billing_out_element_total_purchaseprice_net' => ['name' => 'billing_out_element_total_purchaseprice_net', 'type' => 'Serializable', 'internal' => 'totalPurchasePriceNet'], + 'billing_out_element_bill' => ['name' => 'billing_out_element_bill', 'type' => 'int', 'internal' => 'bill'], ]; /** diff --git a/Models/BillMapper.php b/Models/BillMapper.php index 00c9006..ec439c7 100644 --- a/Models/BillMapper.php +++ b/Models/BillMapper.php @@ -18,9 +18,9 @@ use Modules\Admin\Models\AccountMapper; use Modules\ClientManagement\Models\ClientMapper; use phpOMS\DataStorage\Database\DataMapperAbstract; use phpOMS\DataStorage\Database\Query\Builder; -use phpOMS\Localization\Money; use phpOMS\DataStorage\Database\RelationType; use phpOMS\Localization\Defaults\CountryMapper; +use phpOMS\Localization\Money; /** * Mapper class. @@ -39,41 +39,41 @@ final class BillMapper extends DataMapperAbstract * @since 1.0.0 */ protected static array $columns = [ - 'billing_out_id' => ['name' => 'billing_out_id', 'type' => 'int', 'internal' => 'id'], - 'billing_out_number' => ['name' => 'billing_out_number', 'type' => 'string', 'internal' => 'number'], - 'billing_out_type' => ['name' => 'billing_out_type', 'type' => 'int', 'internal' => 'type'], - 'billing_out_info' => ['name' => 'billing_out_info', 'type' => 'string', 'internal' => 'info'], - 'billing_out_status' => ['name' => 'billing_out_status', 'type' => 'int', 'internal' => 'status'], - 'billing_out_shipTo' => ['name' => 'billing_out_shipTo', 'type' => 'string', 'internal' => 'shipTo'], - 'billing_out_shipFAO' => ['name' => 'billing_out_shipFAO', 'type' => 'string', 'internal' => 'shipFAO'], - 'billing_out_shipAddr' => ['name' => 'billing_out_shipAddr', 'type' => 'string', 'internal' => 'shipAddress'], - 'billing_out_shipCity' => ['name' => 'billing_out_shipCity', 'type' => 'string', 'internal' => 'shipCity'], - 'billing_out_shipZip' => ['name' => 'billing_out_shipZip', 'type' => 'string', 'internal' => 'shipZip'], - 'billing_out_shipCountry' => ['name' => 'billing_out_shipCountry', 'type' => 'string', 'internal' => 'shipCountry'], - 'billing_out_billTo' => ['name' => 'billing_out_billTo', 'type' => 'string', 'internal' => 'billTo'], - 'billing_out_billFAO' => ['name' => 'billing_out_billFAO', 'type' => 'string', 'internal' => 'billFAO'], - 'billing_out_billAddr' => ['name' => 'billing_out_billAddr', 'type' => 'string', 'internal' => 'billAddress'], - 'billing_out_billCity' => ['name' => 'billing_out_billCity', 'type' => 'string', 'internal' => 'billCity'], - 'billing_out_billZip' => ['name' => 'billing_out_billZip', 'type' => 'string', 'internal' => 'billZip'], - 'billing_out_billCountry' => ['name' => 'billing_out_billCountry', 'type' => 'string', 'internal' => 'billCountry'], - 'billing_out_gross' => ['name' => 'billing_out_gross', 'type' => 'Serializable', 'internal' => 'gross'], - 'billing_out_net' => ['name' => 'billing_out_net', 'type' => 'Serializable', 'internal' => 'net'], - 'billing_out_costs' => ['name' => 'billing_out_costs', 'type' => 'Serializable', 'internal' => 'costs'], - 'billing_out_profit' => ['name' => 'billing_out_profit', 'type' => 'Serializable', 'internal' => 'profit'], - 'billing_out_currency' => ['name' => 'billing_out_currency', 'type' => 'int', 'internal' => 'currency'], - 'billing_out_referral' => ['name' => 'billing_out_referral', 'type' => 'int', 'internal' => 'referral'], - 'billing_out_referral_name' => ['name' => 'billing_out_referral_name', 'type' => 'string', 'internal' => 'referralName'], - 'billing_out_reference' => ['name' => 'billing_out_reference', 'type' => 'int', 'internal' => 'reference'], - 'billing_out_payment' => ['name' => 'billing_out_payment', 'type' => 'int', 'internal' => 'payment'], - 'billing_out_payment_text' => ['name' => 'billing_out_payment_text', 'type' => 'string', 'internal' => 'paymentText'], - 'billing_out_paymentterms' => ['name' => 'billing_out_paymentterms', 'type' => 'int', 'internal' => 'terms'], + 'billing_out_id' => ['name' => 'billing_out_id', 'type' => 'int', 'internal' => 'id'], + 'billing_out_number' => ['name' => 'billing_out_number', 'type' => 'string', 'internal' => 'number'], + 'billing_out_type' => ['name' => 'billing_out_type', 'type' => 'int', 'internal' => 'type'], + 'billing_out_info' => ['name' => 'billing_out_info', 'type' => 'string', 'internal' => 'info'], + 'billing_out_status' => ['name' => 'billing_out_status', 'type' => 'int', 'internal' => 'status'], + 'billing_out_shipTo' => ['name' => 'billing_out_shipTo', 'type' => 'string', 'internal' => 'shipTo'], + 'billing_out_shipFAO' => ['name' => 'billing_out_shipFAO', 'type' => 'string', 'internal' => 'shipFAO'], + 'billing_out_shipAddr' => ['name' => 'billing_out_shipAddr', 'type' => 'string', 'internal' => 'shipAddress'], + 'billing_out_shipCity' => ['name' => 'billing_out_shipCity', 'type' => 'string', 'internal' => 'shipCity'], + 'billing_out_shipZip' => ['name' => 'billing_out_shipZip', 'type' => 'string', 'internal' => 'shipZip'], + 'billing_out_shipCountry' => ['name' => 'billing_out_shipCountry', 'type' => 'string', 'internal' => 'shipCountry'], + 'billing_out_billTo' => ['name' => 'billing_out_billTo', 'type' => 'string', 'internal' => 'billTo'], + 'billing_out_billFAO' => ['name' => 'billing_out_billFAO', 'type' => 'string', 'internal' => 'billFAO'], + 'billing_out_billAddr' => ['name' => 'billing_out_billAddr', 'type' => 'string', 'internal' => 'billAddress'], + 'billing_out_billCity' => ['name' => 'billing_out_billCity', 'type' => 'string', 'internal' => 'billCity'], + 'billing_out_billZip' => ['name' => 'billing_out_billZip', 'type' => 'string', 'internal' => 'billZip'], + 'billing_out_billCountry' => ['name' => 'billing_out_billCountry', 'type' => 'string', 'internal' => 'billCountry'], + 'billing_out_gross' => ['name' => 'billing_out_gross', 'type' => 'Serializable', 'internal' => 'gross'], + 'billing_out_net' => ['name' => 'billing_out_net', 'type' => 'Serializable', 'internal' => 'net'], + 'billing_out_costs' => ['name' => 'billing_out_costs', 'type' => 'Serializable', 'internal' => 'costs'], + 'billing_out_profit' => ['name' => 'billing_out_profit', 'type' => 'Serializable', 'internal' => 'profit'], + 'billing_out_currency' => ['name' => 'billing_out_currency', 'type' => 'int', 'internal' => 'currency'], + 'billing_out_referral' => ['name' => 'billing_out_referral', 'type' => 'int', 'internal' => 'referral'], + 'billing_out_referral_name' => ['name' => 'billing_out_referral_name', 'type' => 'string', 'internal' => 'referralName'], + 'billing_out_reference' => ['name' => 'billing_out_reference', 'type' => 'int', 'internal' => 'reference'], + 'billing_out_payment' => ['name' => 'billing_out_payment', 'type' => 'int', 'internal' => 'payment'], + 'billing_out_payment_text' => ['name' => 'billing_out_payment_text', 'type' => 'string', 'internal' => 'paymentText'], + 'billing_out_paymentterms' => ['name' => 'billing_out_paymentterms', 'type' => 'int', 'internal' => 'terms'], 'billing_out_paymentterms_text' => ['name' => 'billing_out_paymentterms_text', 'type' => 'string', 'internal' => 'termsText'], - 'billing_out_ship_type' => ['name' => 'billing_out_ship_type', 'type' => 'int', 'internal' => 'shipping'], - 'billing_out_ship_text' => ['name' => 'billing_out_ship_text', 'type' => 'string', 'internal' => 'shippingText'], - 'billing_out_client' => ['name' => 'billing_out_client', 'type' => 'int', 'internal' => 'client'], - 'billing_out_created_by' => ['name' => 'billing_out_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], - 'billing_out_performance_date' => ['name' => 'billing_out_performance_date', 'type' => 'DateTime', 'internal' => 'performanceDate', 'readonly' => true], - 'billing_out_created_at' => ['name' => 'billing_out_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], + 'billing_out_ship_type' => ['name' => 'billing_out_ship_type', 'type' => 'int', 'internal' => 'shipping'], + 'billing_out_ship_text' => ['name' => 'billing_out_ship_text', 'type' => 'string', 'internal' => 'shippingText'], + 'billing_out_client' => ['name' => 'billing_out_client', 'type' => 'int', 'internal' => 'client'], + 'billing_out_created_by' => ['name' => 'billing_out_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], + 'billing_out_performance_date' => ['name' => 'billing_out_performance_date', 'type' => 'DateTime', 'internal' => 'performanceDate', 'readonly' => true], + 'billing_out_created_at' => ['name' => 'billing_out_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], ]; /** @@ -221,12 +221,10 @@ final class BillMapper extends DataMapperAbstract public static function getItemRetentionRate(int $id, \DateTime $start, \DateTime $end) : float { - } public static function getItemLivetimeValue(int $id, \DateTime $start, \DateTime $end) : Money { - } public static function getNewestItemInvoices(int $id, int $limit = 10) : array @@ -287,7 +285,7 @@ final class BillMapper extends DataMapperAbstract ->groupBy(ClientMapper::getTable() . '_' . $depth . '.clientmgmt_client_id'); $clients = ClientMapper::getAllByQuery($query, RelationType::ALL, $depth); - $data = ClientMapper::getDataLastQuery(); + $data = ClientMapper::getDataLastQuery(); return [$clients, $data]; } diff --git a/Models/BillStatus.php b/Models/BillStatus.php index 7037ec4..67ec8d5 100644 --- a/Models/BillStatus.php +++ b/Models/BillStatus.php @@ -27,8 +27,12 @@ use phpOMS\Stdlib\Base\Enum; abstract class BillStatus extends Enum { public const ACTIVE = 1; + public const ARCHIVED = 2; + public const DELETED = 4; + public const DONE = 8; + public const DRAFT = 16; } diff --git a/Models/BillType.php b/Models/BillType.php index b51609f..20085ef 100644 --- a/Models/BillType.php +++ b/Models/BillType.php @@ -26,7 +26,7 @@ use phpOMS\Localization\ISO639x1Enum; */ class BillType { - /** + /** * Id * * @var int @@ -34,7 +34,7 @@ class BillType */ protected int $id = 0; - /** + /** * Localization * * @var int|int[]|BillTypeL11n|BillTypeL11n[] @@ -69,7 +69,7 @@ class BillType * Set l11n * * @param string|BillTypeL11n $l11n Tag article l11n - * @param string $lang Language + * @param string $lang Language * * @return void * @@ -83,7 +83,7 @@ class BillType $this->l11n->name = $l11n; } elseif (\is_string($l11n)) { $this->l11n = new BillTypeL11n(); - $this->l11n->name = $l11n; + $this->l11n->name = $l11n; $this->l11n->setLanguage($lang); } } diff --git a/Models/BillTypeL11n.php b/Models/BillTypeL11n.php index 12838dd..71a4e51 100644 --- a/Models/BillTypeL11n.php +++ b/Models/BillTypeL11n.php @@ -41,7 +41,9 @@ class BillTypeL11n implements \JsonSerializable, ArrayableInterface * @var int * @since 1.0.0 */ - protected int|BillType $type = 0; + protected int | + +BillType $type = 0; /** * Language. @@ -63,12 +65,12 @@ class BillTypeL11n implements \JsonSerializable, ArrayableInterface * Constructor. * * @param int|BillType $type Attribute type - * @param string $name Localized name + * @param string $name Localized name * @param string $language Language * * @since 1.0.0 */ - public function __construct(int|BillType $type = 0, string $name = '', string $language = ISO639x1Enum::_EN) + public function __construct(int | BillType $type = 0, string $name = '', string $language = ISO639x1Enum::_EN) { $this->type = $type; $this->name = $name; @@ -146,7 +148,7 @@ class BillTypeL11n implements \JsonSerializable, ArrayableInterface { return [ 'id' => $this->id, - 'name' => $this->name, + 'name' => $this->name, 'type' => $this->type, 'language' => $this->language, ]; diff --git a/Models/BillTypeL11nMapper.php b/Models/BillTypeL11nMapper.php index 89938e4..7a74c51 100644 --- a/Models/BillTypeL11nMapper.php +++ b/Models/BillTypeL11nMapper.php @@ -33,10 +33,10 @@ final class BillTypeL11nMapper extends DataMapperAbstract * @since 1.0.0 */ protected static array $columns = [ - 'billing_type_l11n_id' => ['name' => 'billing_type_l11n_id', 'type' => 'int', 'internal' => 'id'], - 'billing_type_l11n_name' => ['name' => 'billing_type_l11n_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true], + 'billing_type_l11n_id' => ['name' => 'billing_type_l11n_id', 'type' => 'int', 'internal' => 'id'], + 'billing_type_l11n_name' => ['name' => 'billing_type_l11n_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true], 'billing_type_l11n_type' => ['name' => 'billing_type_l11n_type', 'type' => 'int', 'internal' => 'type'], - 'billing_type_l11n_language' => ['name' => 'billing_type_l11n_language', 'type' => 'string', 'internal' => 'language'], + 'billing_type_l11n_language' => ['name' => 'billing_type_l11n_language', 'type' => 'string', 'internal' => 'language'], ]; /** diff --git a/Models/NullBillType.php b/Models/NullBillType.php index 448ddc6..ee5edb3 100644 --- a/Models/NullBillType.php +++ b/Models/NullBillType.php @@ -24,7 +24,7 @@ namespace Modules\Billing\Models; */ final class NullBillType extends BillType { - /** + /** * Constructor * * @param int $id Model id diff --git a/Models/PermissionState.php b/Models/PermissionState.php index 135aca9..ecc567f 100644 --- a/Models/PermissionState.php +++ b/Models/PermissionState.php @@ -27,5 +27,6 @@ use phpOMS\Stdlib\Base\Enum; abstract class PermissionState extends Enum { public const SALES_INVOICE = 1; + public const PURCHASE_INVOICE = 2; } diff --git a/Theme/Backend/purchase-invoice-list.tpl.php b/Theme/Backend/purchase-invoice-list.tpl.php index 419bfd0..4e7aaef 100644 --- a/Theme/Backend/purchase-invoice-list.tpl.php +++ b/Theme/Backend/purchase-invoice-list.tpl.php @@ -12,7 +12,6 @@ */ declare(strict_types=1); - $footerView = new \phpOMS\Views\PaginationView($this->l11nManager, $this->request, $this->response); $footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig'); $footerView->setPages(20); diff --git a/Theme/Backend/sales-bill.tpl.php b/Theme/Backend/sales-bill.tpl.php index 1f3816c..a0baa91 100644 --- a/Theme/Backend/sales-bill.tpl.php +++ b/Theme/Backend/sales-bill.tpl.php @@ -16,7 +16,7 @@ declare(strict_types=1); * @var \phpOMS\Views\View $this */ -$bill = $this->getData('bill'); +$bill = $this->getData('bill'); $elements = $bill->getElements(); echo $this->getData('nav')->render(); ?> @@ -153,7 +153,7 @@ echo $this->getData('nav')->render(); ?> - +