From 13a64fcbb21828399d5b10a35fed5fc045484c5f Mon Sep 17 00:00:00 2001 From: Formatter Bot Date: Sun, 10 Apr 2022 16:05:18 +0000 Subject: [PATCH] Automated formatting changes --- Admin/Install/Admin.install.php | 3 - Admin/Installer.php | 1 - Controller/ApiController.php | 38 +++++------ Models/Bill.php | 4 +- Models/BillElementMapper.php | 18 ++--- Models/BillMapper.php | 82 +++++++++++------------ Models/BillTypeMapper.php | 8 +-- Models/PurchaseBillMapper.php | 1 - Models/SalesBillMapper.php | 1 - Theme/Backend/Lang/Navigation.en.lang.php | 2 +- Theme/Backend/purchase-bill.tpl.php | 8 +-- Theme/Backend/user-purchase-bill.tpl.php | 8 +-- tests/Models/BillTest.php | 58 ++++++++-------- 13 files changed, 113 insertions(+), 119 deletions(-) diff --git a/Admin/Install/Admin.install.php b/Admin/Install/Admin.install.php index 668c5c8..9cdfd85 100644 --- a/Admin/Install/Admin.install.php +++ b/Admin/Install/Admin.install.php @@ -12,8 +12,5 @@ */ declare(strict_types=1); -use Modules\Billing\Controller\ApiController; -use Modules\Billing\Models\SettingsEnum; - return [ ]; diff --git a/Admin/Installer.php b/Admin/Installer.php index fe33301b..b0afe10 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -22,7 +22,6 @@ use Modules\Billing\Models\BillTypeMapper; use Modules\Media\Models\NullCollection; use phpOMS\Application\ApplicationAbstract; use phpOMS\Config\SettingsInterface; -use phpOMS\DataStorage\Database\DatabasePool; use phpOMS\Localization\ISO639x1Enum; use phpOMS\Module\InstallerAbstract; use phpOMS\Module\ModuleInfo; diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 5ab84e9..a6b0d73 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -69,7 +69,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function apiBillUpdate(RequestAbstract $request, ResponseAbstract $response, $data = null): void + public function apiBillUpdate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { if (!empty($val = $this->validateBillUpdate($request))) { $response->set($request->uri->__toString(), new FormValidation($val)); @@ -94,7 +94,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - private function validateBillUpdate(RequestAbstract $request): array + private function validateBillUpdate(RequestAbstract $request) : array { $val = []; if (($val['bill'] = empty($request->getData('bill')))) { @@ -115,7 +115,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function updateBillFromRequest(RequestAbstract $request, ResponseAbstract $response, $data = null): Bill + public function updateBillFromRequest(RequestAbstract $request, ResponseAbstract $response, $data = null) : Bill { /** @var Bill $bill */ $bill = BillMapper::get()->where('id', (int) $request->getData('bill'))->execute(); @@ -136,7 +136,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function apiBillCreate(RequestAbstract $request, ResponseAbstract $response, $data = null): void + public function apiBillCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { if (!empty($val = $this->validateBillCreate($request))) { $response->set($request->uri->__toString(), new FormValidation($val)); @@ -166,7 +166,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function createBillFromRequest(RequestAbstract $request, ResponseAbstract $response, $data = null): Bill + public function createBillFromRequest(RequestAbstract $request, ResponseAbstract $response, $data = null) : Bill { $account = null; if ($request->getData('client') !== null) { @@ -218,7 +218,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - private function validateBillCreate(RequestAbstract $request): array + private function validateBillCreate(RequestAbstract $request) : array { $val = []; if (($val['client/supplier'] = (empty($request->getData('client')) @@ -243,7 +243,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function apiMediaAddToBill(RequestAbstract $request, ResponseAbstract $response, $data = null): void + public function apiMediaAddToBill(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { if (!empty($val = $this->validateMediaAddToBill($request))) { $response->set($request->uri->__toString(), new FormValidation($val)); @@ -313,7 +313,7 @@ final class ApiController extends Controller $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Media', 'Media added to bill.', [ 'upload' => $uploaded, - 'media' => $mediaFiles + 'media' => $mediaFiles, ]); } @@ -326,7 +326,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - private function createBillDir(Bill $bill): string + private function createBillDir(Bill $bill) : string { return '/Modules/Billing/Bills/' . $bill->createdAt->format('Y') . '/' @@ -344,7 +344,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - private function validateMediaAddToBill(RequestAbstract $request): array + private function validateMediaAddToBill(RequestAbstract $request) : array { $val = []; if (($val['media'] = (empty($request->getData('media')) && empty($request->getFiles()))) @@ -369,7 +369,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function apiBillElementCreate(RequestAbstract $request, ResponseAbstract $response, $data = null): void + public function apiBillElementCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { if (!empty($val = $this->validateBillElementCreate($request))) { $response->set($request->uri->__toString(), new FormValidation($val)); @@ -400,7 +400,7 @@ final class ApiController extends Controller * @since 1.0.0 * @todo in the database the customer localized version should be stored because this is the version which went out */ - public function createBillElementFromRequest(RequestAbstract $request, ResponseAbstract $response, $data = null): BillElement + public function createBillElementFromRequest(RequestAbstract $request, ResponseAbstract $response, $data = null) : BillElement { $element = new BillElement(); $element->bill = (int) $request->getData('bill'); @@ -443,7 +443,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function updateBillWithBillElement(Bill $bill, BillElement $element, int $type = 1): Bill + public function updateBillWithBillElement(Bill $bill, BillElement $element, int $type = 1) : Bill { if ($type === 1) { $bill->netSales->add($element->totalSalesPriceNet); @@ -462,7 +462,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - private function validateBillElementCreate(RequestAbstract $request): array + private function validateBillElementCreate(RequestAbstract $request) : array { $val = []; if (($val['bill'] = empty($request->getData('bill')))) { @@ -485,7 +485,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function apiBillPdfArchiveCreate(RequestAbstract $request, ResponseAbstract $response, $data = null): void + public function apiBillPdfArchiveCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { Autoloader::addPath(__DIR__ . '/../../../Resources/'); @@ -569,7 +569,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function apiBillPdfCreate(RequestAbstract $request, ResponseAbstract $response, $data = null): void + public function apiBillPdfCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { } @@ -586,7 +586,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function apiNoteCreate(RequestAbstract $request, ResponseAbstract $response, $data = null): void + public function apiNoteCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { if (!empty($val = $this->validateNoteCreate($request))) { $response->set('bill_note_create', new FormValidation($val)); @@ -618,7 +618,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - private function validateNoteCreate(RequestAbstract $request): array + private function validateNoteCreate(RequestAbstract $request) : array { $val = []; if (($val['id'] = empty($request->getData('id')))) { @@ -641,7 +641,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function apiSupplierBillUpload(RequestAbstract $request, ResponseAbstract $response, $data = null): void + public function apiSupplierBillUpload(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { $originalType = (int) ($request->getData('type') ?? $this->app->appSettings->get( names: SettingsEnum::ORIGINAL_MEDIA_TYPE, diff --git a/Models/Bill.php b/Models/Bill.php index 7fccbec..9c8f15c 100755 --- a/Models/Bill.php +++ b/Models/Bill.php @@ -17,12 +17,12 @@ namespace Modules\Billing\Models; use Modules\Admin\Models\Account; use Modules\Admin\Models\NullAccount; use Modules\ClientManagement\Models\Client; +use Modules\Editor\Models\EditorDoc; use Modules\Media\Models\Media; +use Modules\Media\Models\NullMedia; use Modules\SupplierManagement\Models\Supplier; use phpOMS\Localization\ISO4217CharEnum; use phpOMS\Localization\Money; -use Modules\Editor\Models\EditorDoc; -use Modules\Media\Models\NullMedia; /** * Bill class. diff --git a/Models/BillElementMapper.php b/Models/BillElementMapper.php index 3e01414..d2073b5 100755 --- a/Models/BillElementMapper.php +++ b/Models/BillElementMapper.php @@ -41,26 +41,26 @@ final class BillElementMapper extends DataMapperFactory 'billing_bill_element_item_desc' => ['name' => 'billing_bill_element_item_desc', 'type' => 'string', 'internal' => 'itemDescription'], 'billing_bill_element_quantity' => ['name' => 'billing_bill_element_quantity', 'type' => 'int', 'internal' => 'quantity'], - 'billing_bill_element_single_netlistprice' => ['name' => 'billing_bill_element_single_netlistprice', 'type' => 'Serializable', 'internal' => 'singleListPriceNet'], + 'billing_bill_element_single_netlistprice' => ['name' => 'billing_bill_element_single_netlistprice', 'type' => 'Serializable', 'internal' => 'singleListPriceNet'], 'billing_bill_element_single_grosslistprice' => ['name' => 'billing_bill_element_single_grosslistprice', 'type' => 'Serializable', 'internal' => 'singleListPriceGross'], - 'billing_bill_element_total_netlistprice' => ['name' => 'billing_bill_element_total_netlistprice', 'type' => 'Serializable', 'internal' => 'totalListPriceNet'], + 'billing_bill_element_total_netlistprice' => ['name' => 'billing_bill_element_total_netlistprice', 'type' => 'Serializable', 'internal' => 'totalListPriceNet'], 'billing_bill_element_total_grosslistprice' => ['name' => 'billing_bill_element_total_grosslistprice', 'type' => 'Serializable', 'internal' => 'totalListPriceGross'], - 'billing_bill_element_single_netsalesprice' => ['name' => 'billing_bill_element_single_netsalesprice', 'type' => 'Serializable', 'internal' => 'singleSalesPriceNet'], + 'billing_bill_element_single_netsalesprice' => ['name' => 'billing_bill_element_single_netsalesprice', 'type' => 'Serializable', 'internal' => 'singleSalesPriceNet'], 'billing_bill_element_single_grosssalesprice' => ['name' => 'billing_bill_element_single_grosssalesprice', 'type' => 'Serializable', 'internal' => 'singleSalesPriceGross'], - 'billing_bill_element_total_netsalesprice' => ['name' => 'billing_bill_element_total_netsalesprice', 'type' => 'Serializable', 'internal' => 'totalSalesPriceNet'], + 'billing_bill_element_total_netsalesprice' => ['name' => 'billing_bill_element_total_netsalesprice', 'type' => 'Serializable', 'internal' => 'totalSalesPriceNet'], 'billing_bill_element_total_grosssalesprice' => ['name' => 'billing_bill_element_total_grosssalesprice', 'type' => 'Serializable', 'internal' => 'totalSalesPriceGross'], - 'billing_bill_element_single_netprofit' => ['name' => 'billing_bill_element_single_netprofit', 'type' => 'Serializable', 'internal' => 'singleProfitNet'], + 'billing_bill_element_single_netprofit' => ['name' => 'billing_bill_element_single_netprofit', 'type' => 'Serializable', 'internal' => 'singleProfitNet'], 'billing_bill_element_single_grossprofit' => ['name' => 'billing_bill_element_single_grossprofit', 'type' => 'Serializable', 'internal' => 'singleProfitGross'], - 'billing_bill_element_total_netprofit' => ['name' => 'billing_bill_element_total_netprofit', 'type' => 'Serializable', 'internal' => 'totalProfitNet'], + 'billing_bill_element_total_netprofit' => ['name' => 'billing_bill_element_total_netprofit', 'type' => 'Serializable', 'internal' => 'totalProfitNet'], 'billing_bill_element_total_grossprofit' => ['name' => 'billing_bill_element_total_grossprofit', 'type' => 'Serializable', 'internal' => 'totalProfitGross'], - 'billing_bill_element_single_netpurchaseprice' => ['name' => 'billing_bill_element_single_netpurchaseprice', 'type' => 'Serializable', 'internal' => 'singlePurchasePriceNet'], + 'billing_bill_element_single_netpurchaseprice' => ['name' => 'billing_bill_element_single_netpurchaseprice', 'type' => 'Serializable', 'internal' => 'singlePurchasePriceNet'], 'billing_bill_element_single_grosspurchaseprice' => ['name' => 'billing_bill_element_single_grosspurchaseprice', 'type' => 'Serializable', 'internal' => 'singlePurchasePriceGross'], - 'billing_bill_element_total_netpurchaseprice' => ['name' => 'billing_bill_element_total_netpurchaseprice', 'type' => 'Serializable', 'internal' => 'totalPurchasePriceNet'], + 'billing_bill_element_total_netpurchaseprice' => ['name' => 'billing_bill_element_total_netpurchaseprice', 'type' => 'Serializable', 'internal' => 'totalPurchasePriceNet'], 'billing_bill_element_total_grosspurchaseprice' => ['name' => 'billing_bill_element_total_grosspurchaseprice', 'type' => 'Serializable', 'internal' => 'totalPurchasePriceGross'], - 'billing_bill_element_bill' => ['name' => 'billing_bill_element_bill', 'type' => 'int', 'internal' => 'bill'], + 'billing_bill_element_bill' => ['name' => 'billing_bill_element_bill', 'type' => 'int', 'internal' => 'bill'], ]; /** diff --git a/Models/BillMapper.php b/Models/BillMapper.php index f09fae5..83aa147 100755 --- a/Models/BillMapper.php +++ b/Models/BillMapper.php @@ -16,10 +16,10 @@ namespace Modules\Billing\Models; use Modules\Admin\Models\AccountMapper; use Modules\ClientManagement\Models\ClientMapper; +use Modules\Editor\Models\EditorDocMapper; use Modules\Media\Models\MediaMapper; use Modules\SupplierManagement\Models\SupplierMapper; use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; -use Modules\Editor\Models\EditorDocMapper; /** * Mapper class. @@ -38,47 +38,47 @@ class BillMapper extends DataMapperFactory * @since 1.0.0 */ public const COLUMNS = [ - 'billing_bill_id' => ['name' => 'billing_bill_id', 'type' => 'int', 'internal' => 'id'], - 'billing_bill_number' => ['name' => 'billing_bill_number', 'type' => 'string', 'internal' => 'number'], - 'billing_bill_numberformat' => ['name' => 'billing_bill_numberformat', 'type' => 'string', 'internal' => 'numberFormat'], - 'billing_bill_type' => ['name' => 'billing_bill_type', 'type' => 'int', 'internal' => 'type'], - 'billing_bill_info' => ['name' => 'billing_bill_info', 'type' => 'string', 'internal' => 'info'], - 'billing_bill_status' => ['name' => 'billing_bill_status', 'type' => 'int', 'internal' => 'status'], - 'billing_bill_shipTo' => ['name' => 'billing_bill_shipTo', 'type' => 'string', 'internal' => 'shipTo'], - 'billing_bill_shipFAO' => ['name' => 'billing_bill_shipFAO', 'type' => 'string', 'internal' => 'shipFAO'], - 'billing_bill_shipAddr' => ['name' => 'billing_bill_shipAddr', 'type' => 'string', 'internal' => 'shipAddress'], - 'billing_bill_shipCity' => ['name' => 'billing_bill_shipCity', 'type' => 'string', 'internal' => 'shipCity'], - 'billing_bill_shipZip' => ['name' => 'billing_bill_shipZip', 'type' => 'string', 'internal' => 'shipZip'], - 'billing_bill_shipCountry' => ['name' => 'billing_bill_shipCountry', 'type' => 'string', 'internal' => 'shipCountry'], - 'billing_bill_billTo' => ['name' => 'billing_bill_billTo', 'type' => 'string', 'internal' => 'billTo'], - 'billing_bill_billFAO' => ['name' => 'billing_bill_billFAO', 'type' => 'string', 'internal' => 'billFAO'], - 'billing_bill_billAddr' => ['name' => 'billing_bill_billAddr', 'type' => 'string', 'internal' => 'billAddress'], - 'billing_bill_billCity' => ['name' => 'billing_bill_billCity', 'type' => 'string', 'internal' => 'billCity'], - 'billing_bill_billZip' => ['name' => 'billing_bill_billZip', 'type' => 'string', 'internal' => 'billZip'], - 'billing_bill_billCountry' => ['name' => 'billing_bill_billCountry', 'type' => 'string', 'internal' => 'billCountry'], - 'billing_bill_netprofit' => ['name' => 'billing_bill_netprofit', 'type' => 'Serializable', 'internal' => 'netProfit'], - 'billing_bill_grossprofit' => ['name' => 'billing_bill_grossprofit', 'type' => 'Serializable', 'internal' => 'grossProfit'], - 'billing_bill_netcosts' => ['name' => 'billing_bill_netcosts', 'type' => 'Serializable', 'internal' => 'netCosts'], - 'billing_bill_grosscosts' => ['name' => 'billing_bill_grosscosts', 'type' => 'Serializable', 'internal' => 'grossCosts'], - 'billing_bill_netsales' => ['name' => 'billing_bill_netsales', 'type' => 'Serializable', 'internal' => 'netSales'], - 'billing_bill_grosssales' => ['name' => 'billing_bill_grosssales', 'type' => 'Serializable', 'internal' => 'grossSales'], - 'billing_bill_netdiscount' => ['name' => 'billing_bill_netdiscount', 'type' => 'Serializable', 'internal' => 'netDiscount'], + 'billing_bill_id' => ['name' => 'billing_bill_id', 'type' => 'int', 'internal' => 'id'], + 'billing_bill_number' => ['name' => 'billing_bill_number', 'type' => 'string', 'internal' => 'number'], + 'billing_bill_numberformat' => ['name' => 'billing_bill_numberformat', 'type' => 'string', 'internal' => 'numberFormat'], + 'billing_bill_type' => ['name' => 'billing_bill_type', 'type' => 'int', 'internal' => 'type'], + 'billing_bill_info' => ['name' => 'billing_bill_info', 'type' => 'string', 'internal' => 'info'], + 'billing_bill_status' => ['name' => 'billing_bill_status', 'type' => 'int', 'internal' => 'status'], + 'billing_bill_shipTo' => ['name' => 'billing_bill_shipTo', 'type' => 'string', 'internal' => 'shipTo'], + 'billing_bill_shipFAO' => ['name' => 'billing_bill_shipFAO', 'type' => 'string', 'internal' => 'shipFAO'], + 'billing_bill_shipAddr' => ['name' => 'billing_bill_shipAddr', 'type' => 'string', 'internal' => 'shipAddress'], + 'billing_bill_shipCity' => ['name' => 'billing_bill_shipCity', 'type' => 'string', 'internal' => 'shipCity'], + 'billing_bill_shipZip' => ['name' => 'billing_bill_shipZip', 'type' => 'string', 'internal' => 'shipZip'], + 'billing_bill_shipCountry' => ['name' => 'billing_bill_shipCountry', 'type' => 'string', 'internal' => 'shipCountry'], + 'billing_bill_billTo' => ['name' => 'billing_bill_billTo', 'type' => 'string', 'internal' => 'billTo'], + 'billing_bill_billFAO' => ['name' => 'billing_bill_billFAO', 'type' => 'string', 'internal' => 'billFAO'], + 'billing_bill_billAddr' => ['name' => 'billing_bill_billAddr', 'type' => 'string', 'internal' => 'billAddress'], + 'billing_bill_billCity' => ['name' => 'billing_bill_billCity', 'type' => 'string', 'internal' => 'billCity'], + 'billing_bill_billZip' => ['name' => 'billing_bill_billZip', 'type' => 'string', 'internal' => 'billZip'], + 'billing_bill_billCountry' => ['name' => 'billing_bill_billCountry', 'type' => 'string', 'internal' => 'billCountry'], + 'billing_bill_netprofit' => ['name' => 'billing_bill_netprofit', 'type' => 'Serializable', 'internal' => 'netProfit'], + 'billing_bill_grossprofit' => ['name' => 'billing_bill_grossprofit', 'type' => 'Serializable', 'internal' => 'grossProfit'], + 'billing_bill_netcosts' => ['name' => 'billing_bill_netcosts', 'type' => 'Serializable', 'internal' => 'netCosts'], + 'billing_bill_grosscosts' => ['name' => 'billing_bill_grosscosts', 'type' => 'Serializable', 'internal' => 'grossCosts'], + 'billing_bill_netsales' => ['name' => 'billing_bill_netsales', 'type' => 'Serializable', 'internal' => 'netSales'], + 'billing_bill_grosssales' => ['name' => 'billing_bill_grosssales', 'type' => 'Serializable', 'internal' => 'grossSales'], + 'billing_bill_netdiscount' => ['name' => 'billing_bill_netdiscount', 'type' => 'Serializable', 'internal' => 'netDiscount'], 'billing_bill_grossdiscount' => ['name' => 'billing_bill_grossdiscount', 'type' => 'Serializable', 'internal' => 'grossDiscount'], - 'billing_bill_currency' => ['name' => 'billing_bill_currency', 'type' => 'string', 'internal' => 'currency'], - 'billing_bill_referral' => ['name' => 'billing_bill_referral', 'type' => 'int', 'internal' => 'referral'], - 'billing_bill_referral_name' => ['name' => 'billing_bill_referral_name', 'type' => 'string', 'internal' => 'referralName'], - 'billing_bill_reference' => ['name' => 'billing_bill_reference', 'type' => 'int', 'internal' => 'reference'], - 'billing_bill_payment' => ['name' => 'billing_bill_payment', 'type' => 'int', 'internal' => 'payment'], - 'billing_bill_payment_text' => ['name' => 'billing_bill_payment_text', 'type' => 'string', 'internal' => 'paymentText'], - 'billing_bill_paymentterms' => ['name' => 'billing_bill_paymentterms', 'type' => 'int', 'internal' => 'terms'], - 'billing_bill_paymentterms_text' => ['name' => 'billing_bill_paymentterms_text', 'type' => 'string', 'internal' => 'termsText'], - 'billing_bill_ship_type' => ['name' => 'billing_bill_ship_type', 'type' => 'int', 'internal' => 'shipping'], - 'billing_bill_ship_text' => ['name' => 'billing_bill_ship_text', 'type' => 'string', 'internal' => 'shippingText'], - 'billing_bill_client' => ['name' => 'billing_bill_client', 'type' => 'int', 'internal' => 'client'], - 'billing_bill_supplier' => ['name' => 'billing_bill_supplier', 'type' => 'int', 'internal' => 'supplier'], - 'billing_bill_created_by' => ['name' => 'billing_bill_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], - 'billing_bill_performance_date' => ['name' => 'billing_bill_performance_date', 'type' => 'DateTime', 'internal' => 'performanceDate', 'readonly' => true], - 'billing_bill_created_at' => ['name' => 'billing_bill_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], + 'billing_bill_currency' => ['name' => 'billing_bill_currency', 'type' => 'string', 'internal' => 'currency'], + 'billing_bill_referral' => ['name' => 'billing_bill_referral', 'type' => 'int', 'internal' => 'referral'], + 'billing_bill_referral_name' => ['name' => 'billing_bill_referral_name', 'type' => 'string', 'internal' => 'referralName'], + 'billing_bill_reference' => ['name' => 'billing_bill_reference', 'type' => 'int', 'internal' => 'reference'], + 'billing_bill_payment' => ['name' => 'billing_bill_payment', 'type' => 'int', 'internal' => 'payment'], + 'billing_bill_payment_text' => ['name' => 'billing_bill_payment_text', 'type' => 'string', 'internal' => 'paymentText'], + 'billing_bill_paymentterms' => ['name' => 'billing_bill_paymentterms', 'type' => 'int', 'internal' => 'terms'], + 'billing_bill_paymentterms_text' => ['name' => 'billing_bill_paymentterms_text', 'type' => 'string', 'internal' => 'termsText'], + 'billing_bill_ship_type' => ['name' => 'billing_bill_ship_type', 'type' => 'int', 'internal' => 'shipping'], + 'billing_bill_ship_text' => ['name' => 'billing_bill_ship_text', 'type' => 'string', 'internal' => 'shippingText'], + 'billing_bill_client' => ['name' => 'billing_bill_client', 'type' => 'int', 'internal' => 'client'], + 'billing_bill_supplier' => ['name' => 'billing_bill_supplier', 'type' => 'int', 'internal' => 'supplier'], + 'billing_bill_created_by' => ['name' => 'billing_bill_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], + 'billing_bill_performance_date' => ['name' => 'billing_bill_performance_date', 'type' => 'DateTime', 'internal' => 'performanceDate', 'readonly' => true], + 'billing_bill_created_at' => ['name' => 'billing_bill_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], ]; /** diff --git a/Models/BillTypeMapper.php b/Models/BillTypeMapper.php index c2cf640..4bc6f34 100755 --- a/Models/BillTypeMapper.php +++ b/Models/BillTypeMapper.php @@ -34,11 +34,11 @@ final class BillTypeMapper extends DataMapperFactory * @since 1.0.0 */ public const COLUMNS = [ - 'billing_type_id' => ['name' => 'billing_type_id', 'type' => 'int', 'internal' => 'id'], + 'billing_type_id' => ['name' => 'billing_type_id', 'type' => 'int', 'internal' => 'id'], 'billing_type_number_format' => ['name' => 'billing_type_number_format', 'type' => 'string', 'internal' => 'numberFormat'], - 'billing_type_template' => ['name' => 'billing_type_template', 'type' => 'int', 'internal' => 'template'], - 'billing_type_transfer_type' => ['name' => 'billing_type_transfer_type', 'type' => 'int', 'internal' => 'transferType'], - 'billing_type_transfer_stock' => ['name' => 'billing_type_transfer_stock', 'type' => 'bool', 'internal' => 'transferStock'], + 'billing_type_template' => ['name' => 'billing_type_template', 'type' => 'int', 'internal' => 'template'], + 'billing_type_transfer_type' => ['name' => 'billing_type_transfer_type', 'type' => 'int', 'internal' => 'transferType'], + 'billing_type_transfer_stock' => ['name' => 'billing_type_transfer_stock', 'type' => 'bool', 'internal' => 'transferStock'], ]; /** diff --git a/Models/PurchaseBillMapper.php b/Models/PurchaseBillMapper.php index 8925bc9..cd0c69e 100755 --- a/Models/PurchaseBillMapper.php +++ b/Models/PurchaseBillMapper.php @@ -227,7 +227,6 @@ final class PurchaseBillMapper extends BillMapper */ public static function getItemTopSuppliers(int $id, \DateTime $start, \DateTime $end, int $limit = 10) : array { - $query = SupplierMapper::getQuery(); $query->selectAs('SUM(billing_bill_element_total_netpurchaseprice)', 'net_purchase') ->leftJoin(self::TABLE, self::TABLE . '_d1') diff --git a/Models/SalesBillMapper.php b/Models/SalesBillMapper.php index 459404e..bb0ff21 100755 --- a/Models/SalesBillMapper.php +++ b/Models/SalesBillMapper.php @@ -227,7 +227,6 @@ final class SalesBillMapper extends BillMapper */ public static function getItemTopClients(int $id, \DateTime $start, \DateTime $end, int $limit = 10) : array { - $query = ClientMapper::getQuery(); $query->selectAs('SUM(billing_bill_element_total_netsalesprice)', 'net_sales') ->leftJoin(self::TABLE, self::TABLE . '_d1') diff --git a/Theme/Backend/Lang/Navigation.en.lang.php b/Theme/Backend/Lang/Navigation.en.lang.php index 8eaf2f2..dd27092 100644 --- a/Theme/Backend/Lang/Navigation.en.lang.php +++ b/Theme/Backend/Lang/Navigation.en.lang.php @@ -13,7 +13,7 @@ declare(strict_types=1); return ['Navigation' => [ - 'Open' => 'Open', + 'Open' => 'Open', 'Archive' => 'Archive', 'Bill' => 'Bill', 'Billing' => 'Billing', diff --git a/Theme/Backend/purchase-bill.tpl.php b/Theme/Backend/purchase-bill.tpl.php index 383d768..edb5553 100755 --- a/Theme/Backend/purchase-bill.tpl.php +++ b/Theme/Backend/purchase-bill.tpl.php @@ -26,11 +26,11 @@ include __DIR__ . '/../../../Media/Theme/Backend/template-functions.php'; $bill = $this->getData('bill'); $elements = $bill->getElements(); -$previewType = $this->getData('previewType'); +$previewType = $this->getData('previewType'); $originalType = $this->getData('originalType'); -$billPdf = $bill->getFileByType($previewType); -$original = $bill->getFileByType($originalType); -$media = $bill->getMedia(); +$billPdf = $bill->getFileByType($previewType); +$original = $bill->getFileByType($originalType); +$media = $bill->getMedia(); echo $this->getData('nav')->render(); ?> diff --git a/Theme/Backend/user-purchase-bill.tpl.php b/Theme/Backend/user-purchase-bill.tpl.php index 4bbad90..464eccf 100644 --- a/Theme/Backend/user-purchase-bill.tpl.php +++ b/Theme/Backend/user-purchase-bill.tpl.php @@ -26,11 +26,11 @@ include __DIR__ . '/../../../Media/Theme/Backend/template-functions.php'; $bill = $this->getData('bill'); $elements = $bill->getElements(); -$previewType = $this->getData('previewType'); +$previewType = $this->getData('previewType'); $originalType = $this->getData('originalType'); -$billPdf = $bill->getFileByType($previewType); -$original = $bill->getFileByType($originalType); -$media = $bill->getMedia(); +$billPdf = $bill->getFileByType($previewType); +$original = $bill->getFileByType($originalType); +$media = $bill->getMedia(); echo $this->getData('nav')->render(); ?> diff --git a/tests/Models/BillTest.php b/tests/Models/BillTest.php index c251293..ada2492 100644 --- a/tests/Models/BillTest.php +++ b/tests/Models/BillTest.php @@ -174,40 +174,40 @@ final class BillTest extends \PHPUnit\Framework\TestCase */ public function testSerialize() : void { - $this->bill->number = '123456'; + $this->bill->number = '123456'; $this->bill->numberFormat = '{y}'; - $this->bill->type = 2; - $this->bill->shipTo = 'To'; - $this->bill->shipFAO = 'FAO'; - $this->bill->shipAddress = 'Address'; - $this->bill->shipCity = 'City'; - $this->bill->shipZip = 'Zip'; - $this->bill->shipCountry = 'Country'; - $this->bill->billTo = 'To'; - $this->bill->billFAO = 'FAO'; - $this->bill->billAddress = 'Address'; - $this->bill->billCity = 'City'; - $this->bill->billZip = 'Zip'; - $this->bill->billCountry = 'Country'; + $this->bill->type = 2; + $this->bill->shipTo = 'To'; + $this->bill->shipFAO = 'FAO'; + $this->bill->shipAddress = 'Address'; + $this->bill->shipCity = 'City'; + $this->bill->shipZip = 'Zip'; + $this->bill->shipCountry = 'Country'; + $this->bill->billTo = 'To'; + $this->bill->billFAO = 'FAO'; + $this->bill->billAddress = 'Address'; + $this->bill->billCity = 'City'; + $this->bill->billZip = 'Zip'; + $this->bill->billCountry = 'Country'; self::assertEquals( [ - 'id' => 0, - 'number' => '123456', + 'id' => 0, + 'number' => '123456', 'numberFormat' => '{y}', - 'type' => 2, - 'shipTo' => 'To', - 'shipFAO' => 'FAO', - 'shipAddress' => 'Address', - 'shipCity' => 'City', - 'shipZip' => 'Zip', - 'shipCountry' => 'Country', - 'billTo' => 'To', - 'billFAO' => 'FAO', - 'billAddress' => 'Address', - 'billCity' => 'City', - 'billZip' => 'Zip', - 'billCountry' => 'Country', + 'type' => 2, + 'shipTo' => 'To', + 'shipFAO' => 'FAO', + 'shipAddress' => 'Address', + 'shipCity' => 'City', + 'shipZip' => 'Zip', + 'shipCountry' => 'Country', + 'billTo' => 'To', + 'billFAO' => 'FAO', + 'billAddress' => 'Address', + 'billCity' => 'City', + 'billZip' => 'Zip', + 'billCountry' => 'Country', ], $this->bill->jsonSerialize() );