Continue with getter/setter cleanup

This commit is contained in:
Dennis Eichhorn 2023-05-30 15:44:15 +02:00
parent ae7b7d2999
commit 802790e7f3
13 changed files with 167 additions and 189 deletions

View File

@ -23,7 +23,7 @@ require_once $this->getData('defaultTemplates')
->getAbsolutePath();
/** @var \Modules\Billing\Models\Bill $bill */
$bill = $this->getData('bill') ?? new NullBill();
$bill = $this->data['bill'] ?? new NullBill();
// Set up default pdf template
/** @phpstan-import-type DefaultPdf from ../../../../Admin/Install/Media/PdfDefaultTemplate/pdfTemplate.pdf.php */
@ -33,32 +33,32 @@ $lang = include __DIR__ . '/lang.php';
$pdf->setHeaderData(
__DIR__ . '/logo.png', 15,
$this->getData('bill_logo_name') ?? 'Jingga',
$this->getData('bill_slogan') ?? 'Business solutions made simple.'
$this->data['bill_logo_name'] ?? 'Jingga',
$this->data['bill_slogan'] ?? 'Business solutions made simple.'
);
$pdf->setCreator($this->getData('bill_creator') ?? 'Jingga');
$pdf->setAuthor($this->getData('bill_creator') ?? 'Jingga');
$pdf->setTitle($this->getData('bill_title') ?? $bill->type->getL11n());
$pdf->setSubject($this->getData('bill_subtitle') ?? '');
$pdf->setKeywords(\implode(', ', $this->getData('keywords') ?? []));
$pdf->setCreator($this->data['bill_creator'] ?? 'Jingga');
$pdf->setAuthor($this->data['bill_creator'] ?? 'Jingga');
$pdf->setTitle($this->data['bill_title'] ?? $bill->type->getL11n());
$pdf->setSubject($this->data['bill_subtitle'] ?? '');
$pdf->setKeywords(\implode(', ', $this->data['keywords'] ?? []));
$pdf->language = $bill->language;
$pdf->attributes['legal_name'] = $this->getData('legal_company_name') ?? 'Jingga e.K.';
$pdf->attributes['address'] = $this->getData('bill_company_address') ?? 'Gartenstr. 26';
$pdf->attributes['city'] = $this->getData('bill_company_city') ?? '61206 Woellstadt';
$pdf->attributes['legal_name'] = $this->data['legal_company_name'] ?? 'Jingga e.K.';
$pdf->attributes['address'] = $this->data['bill_company_address'] ?? 'Gartenstr. 26';
$pdf->attributes['city'] = $this->data['bill_company_city'] ?? '61206 Woellstadt';
$pdf->attributes['ceo'] = $this->getData('bill_company_ceo') ?? 'Dennis Eichhorn';
$pdf->attributes['tax_office'] = $this->getData('bill_company_tax_office') ?? 'HRB ???';
$pdf->attributes['tax_number'] = $this->getData('bill_company_tax_id') ?? '123456789';
$pdf->attributes['terms'] = $this->getData('bill_company_terms') ?? 'https://jingga.app/terms';
$pdf->attributes['ceo'] = $this->data['bill_company_ceo'] ?? 'Dennis Eichhorn';
$pdf->attributes['tax_office'] = $this->data['bill_company_tax_office'] ?? 'HRB ???';
$pdf->attributes['tax_number'] = $this->data['bill_company_tax_id'] ?? '123456789';
$pdf->attributes['terms'] = $this->data['bill_company_terms'] ?? 'https://jingga.app/terms';
$pdf->attributes['bank_name'] = $this->getData('bill_company_bank_name') ?? 'Volksbank Mittelhessen';
$pdf->attributes['swift'] = $this->getData('bill_company_swift') ?? '.....';
$pdf->attributes['bank_account'] = $this->getData('bill_company_bank_account') ?? '.....';
$pdf->attributes['bank_name'] = $this->data['bill_company_bank_name'] ?? 'Volksbank Mittelhessen';
$pdf->attributes['swift'] = $this->data['bill_company_swift'] ?? '.....';
$pdf->attributes['bank_account'] = $this->data['bill_company_bank_account'] ?? '.....';
$pdf->attributes['website'] = $this->getData('bill_company_website') ?? 'www.jingga.app';
$pdf->attributes['email'] = $this->getData('bill_company_email') ?? 'info@jingga.app';
$pdf->attributes['phone'] = $this->getData('bill_company_phone') ?? '+49 0152 ????';
$pdf->attributes['website'] = $this->data['bill_company_website'] ?? 'www.jingga.app';
$pdf->attributes['email'] = $this->data['bill_company_email'] ?? 'info@jingga.app';
$pdf->attributes['phone'] = $this->data['bill_company_phone'] ?? '+49 0152 ????';
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
@ -308,6 +308,6 @@ $pdf->Ln();
//Close and output PDF document
$pdf->Output(
$this->getData('path') ?? ($bill->billDate->format('Y-m-d') . '_' . $bill->number . '.pdf'),
$this->data['path'] ?? ($bill->billDate->format('Y-m-d') . '_' . $bill->number . '.pdf'),
'I'
);

View File

@ -413,7 +413,7 @@ final class ApiBillController extends Controller
virtualPath: $path,
pathSettings: PathSettings::FILE_PATH,
hasAccountRelation: false,
readContent: (bool) ($request->getData('parse_content') ?? false)
readContent: $request->getDataBool('parse_content') ?? false
);
$collection = null;
@ -441,7 +441,9 @@ final class ApiBillController extends Controller
}
if ($collection === null) {
$collection = MediaMapper::getParentCollection($path)->limit(1)->execute();
$collection = MediaMapper::getParentCollection($path)
->limit(1)
->execute();
if ($collection->id === 0) {
$collection = $this->app->moduleManager->get('Media')->createRecursiveMediaCollection(
@ -718,50 +720,50 @@ final class ApiBillController extends Controller
->where('id', (int) $settings[AdminSettingsEnum::DEFAULT_ASSETS]->content)
->execute();
$view->setData('defaultTemplates', $defaultTemplates);
$view->setData('defaultAssets', $defaultAssets);
$view->data['defaultTemplates'] = $defaultTemplates;
$view->data['defaultAssets'] = $defaultAssets;
$path = $this->createBillDir($bill);
$pdfDir = __DIR__ . '/../../../Modules/Media/Files' . $path;
$view->setData('bill', $bill);
$view->setData('path', $pdfDir . '/' .$bill->billDate->format('Y-m-d') . '_' . $bill->number . '.pdf');
$view->data['bill'] = $bill;
$view->data['path'] = $pdfDir . '/' .$bill->billDate->format('Y-m-d') . '_' . $bill->number . '.pdf';
$view->setData('bill_creator', $request->getDataString('bill_creator'));
$view->setData('bill_title', $request->getDataString('bill_title'));
$view->setData('bill_subtitle', $request->getDataString('bill_subtitle'));
$view->setData('keywords', $request->getDataString('keywords'));
$view->data['bill_creator'] = $request->getDataString('bill_creator');
$view->data['bill_title'] = $request->getDataString('bill_title');
$view->data['bill_subtitle'] = $request->getDataString('bill_subtitle');
$view->data['keywords'] = $request->getDataString('keywords');
$view->setData('bill_type_name', $request->getDataString('bill_type_name'));
$view->data['bill_type_name'] = $request->getDataString('bill_type_name');
$view->setData('bill_start_text', $request->getDataString('bill_start_text'));
$view->setData('bill_lines', $request->getDataString('bill_lines'));
$view->setData('bill_end_text', $request->getDataString('bill_end_text'));
$view->data['bill_start_text'] = $request->getDataString('bill_start_text');
$view->data['bill_lines'] = $request->getDataString('bill_lines');
$view->data['bill_end_text'] = $request->getDataString('bill_end_text');
$view->setData('bill_payment_terms', $request->getDataString('bill_payment_terms'));
$view->setData('bill_terms', $request->getDataString('bill_terms'));
$view->setData('bill_taxes', $request->getDataString('bill_taxes'));
$view->setData('bill_currency', $request->getDataString('bill_currency'));
$view->data['bill_payment_terms'] = $request->getDataString('bill_payment_terms');
$view->data['bill_terms'] = $request->getDataString('bill_terms');
$view->data['bill_taxes'] = $request->getDataString('bill_taxes');
$view->data['bill_currency'] = $request->getDataString('bill_currency');
// Unit specifc settings
$view->setData('bill_logo_name', $request->getDataString('bill_logo_name'));
$view->setData('bill_slogan', $request->getDataString('bill_slogan'));
$view->setData('legal_company_name', $request->getDataString('legal_company_name'));
$view->setData('bill_company_address', $request->getDataString('bill_company_address'));
$view->setData('bill_company_city', $request->getDataString('bill_company_city'));
$view->setData('bill_company_ceo', $request->getDataString('bill_company_ceo'));
$view->setData('bill_company_website', $request->getDataString('bill_company_website'));
$view->setData('bill_company_email', $request->getDataString('bill_company_email'));
$view->setData('bill_company_phone', $request->getDataString('bill_company_phone'));
$view->setData('bill_company_terms', $request->getDataString('bill_company_terms'));
$view->data['bill_logo_name'] = $request->getDataString('bill_logo_name');
$view->data['bill_slogan'] = $request->getDataString('bill_slogan');
$view->data['legal_company_name'] = $request->getDataString('legal_company_name');
$view->data['bill_company_address'] = $request->getDataString('bill_company_address');
$view->data['bill_company_city'] = $request->getDataString('bill_company_city');
$view->data['bill_company_ceo'] = $request->getDataString('bill_company_ceo');
$view->data['bill_company_website'] = $request->getDataString('bill_company_website');
$view->data['bill_company_email'] = $request->getDataString('bill_company_email');
$view->data['bill_company_phone'] = $request->getDataString('bill_company_phone');
$view->data['bill_company_terms'] = $request->getDataString('bill_company_terms');
$view->setData('bill_company_tax_office', $request->getDataString('bill_company_tax_office'));
$view->setData('bill_company_tax_id', $request->getDataString('bill_company_tax_id'));
$view->setData('bill_company_vat_id', $request->getDataString('bill_company_vat_id'));
$view->data['bill_company_tax_office'] = $request->getDataString('bill_company_tax_office');
$view->data['bill_company_tax_id'] = $request->getDataString('bill_company_tax_id');
$view->data['bill_company_vat_id'] = $request->getDataString('bill_company_vat_id');
$view->setData('bill_company_bank_name', $request->getDataString('bill_company_bank_name'));
$view->setData('bill_company_swift', $request->getDataString('bill_company_swift'));
$view->setData('bill_company_bank_account', $request->getDataString('bill_company_bank_account'));
$view->data['bill_company_bank_name'] = $request->getDataString('bill_company_bank_name');
$view->data['bill_company_swift'] = $request->getDataString('bill_company_swift');
$view->data['bill_company_bank_account'] = $request->getDataString('bill_company_bank_account');
$pdf = $view->render();
@ -855,9 +857,9 @@ final class ApiBillController extends Controller
->where('id', (int) $settings[AdminSettingsEnum::DEFAULT_ASSETS]->content)
->execute();
$view->setData('defaultTemplates', $defaultTemplates);
$view->setData('defaultAssets', $defaultAssets);
$view->setData('bill', $bill);
$view->data['defaultTemplates'] = $defaultTemplates;
$view->data['defaultAssets'] = $defaultAssets;
$view->data['bill'] = $bill;
// @todo: add bill data such as company name bank information, ..., etc.

View File

@ -61,7 +61,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/sales-bill-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response);
$mapperQuery = SalesBillMapper::getAll()
->with('type')
@ -73,24 +73,18 @@ final class BackendController extends Controller
->limit(25);
if ($request->getData('ptype') === 'p') {
$view->setData('bills',
$mapperQuery
$view->data['bills'] = $mapperQuery
->where('id', $request->getDataInt('id') ?? 0, '<')
->where('client', null, '!=')
->execute()
);
->execute();
} elseif ($request->getData('ptype') === 'n') {
$view->setData('bills',
$mapperQuery->where('id', $request->getDataInt('id') ?? 0, '>')
$view->data['bills'] = $mapperQuery->where('id', $request->getDataInt('id') ?? 0, '>')
->where('client', null, '!=')
->execute()
);
->execute();
} else {
$view->setData('bills',
$mapperQuery->where('id', 0, '>')
$view->data['bills'] = $mapperQuery->where('id', 0, '>')
->where('client', null, '!=')
->execute()
);
->execute();
}
return $view;
@ -112,7 +106,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/bill-create');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response);
/** @var \Modules\Billing\Models\Bill $bill */
$bill = SalesBillMapper::get()
@ -123,7 +117,7 @@ final class BackendController extends Controller
->where('id', (int) $request->getData('id'))
->execute();
$view->setData('bill', $bill);
$view->data['bill'] = $bill;
/** @var \Modules\Auditor\Models\Auditor[] $logsBill */
$logsBill = AuditMapper::getAll()
@ -143,7 +137,7 @@ final class BackendController extends Controller
$logs = \array_merge($logsBill, $logsElements);
$view->setData('logs', $logs);
$view->data['logs'] = $logs;
return $view;
}
@ -164,7 +158,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/bill-create');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response);
$billTypes = BillTypeMapper::getAll()
->with('l11n')
@ -173,11 +167,11 @@ final class BackendController extends Controller
->where('l11n/language', $request->header->l11n->language)
->execute();
$view->setData('billtypes', $billTypes);
$view->data['billtypes'] = $billTypes;
$mediaListView = new \Modules\Media\Theme\Backend\Components\Media\ListView($this->app->l11nManager, $request, $response);
$mediaListView->setTemplate('/Modules/Media/Theme/Backend/Components/Media/list');
$view->addData('medialist', $mediaListView);
$view->data['medialist'] = $mediaListView;
return $view;
}
@ -198,7 +192,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/bill-create');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response);
return $view;
}
@ -219,7 +213,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/bill-create');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response);
return $view;
}
@ -240,7 +234,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/purchase-bill-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005105001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005105001, $request, $response);
$mapperQuery = PurchaseBillMapper::getAll()
->with('type')
@ -251,27 +245,21 @@ final class BackendController extends Controller
->limit(25);
if ($request->getData('ptype') === 'p') {
$view->setData('bills',
$mapperQuery
$view->data['bills'] = $mapperQuery
->where('id', $request->getDataInt('id') ?? 0, '<')
->where('supplier', null, '!=')
->where('type/l11n/language', $response->header->l11n->language)
->execute()
);
->execute();
} elseif ($request->getData('ptype') === 'n') {
$view->setData('bills',
$mapperQuery->where('id', $request->getDataInt('id') ?? 0, '>')
$view->data['bills'] = $mapperQuery->where('id', $request->getDataInt('id') ?? 0, '>')
->where('supplier', null, '!=')
->where('type/l11n/language', $response->header->l11n->language)
->execute()
);
->execute();
} else {
$view->setData('bills',
$mapperQuery->where('id', 0, '>')
$view->data['bills'] = $mapperQuery->where('id', 0, '>')
->where('supplier', null, '!=')
->where('type/l11n/language', $response->header->l11n->language)
->execute()
);
->execute();
}
return $view;
@ -293,7 +281,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/purchase-bill');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005105001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005105001, $request, $response);
$bill = PurchaseBillMapper::get()
->with('elements')
@ -303,7 +291,7 @@ final class BackendController extends Controller
->where('id', (int) $request->getData('id'))
->execute();
$view->setData('bill', $bill);
$view->data['bill'] = $bill;
/** @var \Model\Setting $previewType */
$previewType = $this->app->appSettings->get(
@ -311,7 +299,7 @@ final class BackendController extends Controller
module: self::NAME
);
$view->setData('previewType', (int) $previewType->content);
$view->data['previewType'] = (int) $previewType->content;
/** @var \Model\Setting $originalType */
$originalType = $this->app->appSettings->get(
@ -319,7 +307,7 @@ final class BackendController extends Controller
module: self::NAME
);
$view->setData('originalType', (int) $originalType->content);
$view->data['originalType'] = (int) $originalType->content;
return $view;
}
@ -340,20 +328,14 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/purchase-bill-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005106001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005106001, $request, $response);
if ($request->getData('ptype') === 'p') {
$view->setData('bills',
StockBillMapper::getAll()->where('id', $request->getDataInt('id') ?? 0, '<')->limit(25)->execute()
);
$view->data['bills'] = StockBillMapper::getAll()->where('id', $request->getDataInt('id') ?? 0, '<')->limit(25)->execute();
} elseif ($request->getData('ptype') === 'n') {
$view->setData('bills',
StockBillMapper::getAll()->where('id', $request->getDataInt('id') ?? 0, '>')->limit(25)->execute()
);
$view->data['bills'] = StockBillMapper::getAll()->where('id', $request->getDataInt('id') ?? 0, '>')->limit(25)->execute();
} else {
$view->setData('bills',
StockBillMapper::getAll()->where('id', 0, '>')->limit(25)->execute()
);
$view->data['bills'] = StockBillMapper::getAll()->where('id', 0, '>')->limit(25)->execute();
}
return $view;
@ -375,11 +357,11 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/purchase-bill');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005106001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005106001, $request, $response);
$bill = StockBillMapper::get()->where('id', (int) $request->getData('id'))->execute();
$view->setData('bill', $bill);
$view->data['bill'] = $bill;
return $view;
}
@ -398,14 +380,14 @@ final class BackendController extends Controller
*/
public function viewRegionAnalysis(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
{
$head = $response->get('Content')->getData('head');
$head = $response->get('Content')->head;
$head->addAsset(AssetType::CSS, 'Resources/chartjs/Chartjs/chart.css');
$head->addAsset(AssetType::JSLATE, 'Resources/chartjs/Chartjs/chart.js');
$head->addAsset(AssetType::JSLATE, 'Modules/ClientManagement/Controller.js', ['type' => 'module']);
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/region-analysis');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001602001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001602001, $request, $response);
$monthlySalesCosts = [];
for ($i = 1; $i < 13; ++$i) {
@ -417,7 +399,7 @@ final class BackendController extends Controller
];
}
$view->addData('monthlySalesCosts', $monthlySalesCosts);
$view->data['monthlySalesCosts'] = $monthlySalesCosts;
/////
$currentCustomerRegion = [
@ -429,7 +411,7 @@ final class BackendController extends Controller
'Other' => (int) (\mt_rand(200, 400) / 4),
];
$view->addData('currentCustomerRegion', $currentCustomerRegion);
$view->data['currentCustomerRegion'] = $currentCustomerRegion;
$annualCustomerRegion = [];
for ($i = 1; $i < 11; ++$i) {
@ -445,7 +427,7 @@ final class BackendController extends Controller
];
}
$view->addData('annualCustomerRegion', $annualCustomerRegion);
$view->data['annualCustomerRegion'] = $annualCustomerRegion;
/////
$monthlySalesCustomer = [];
@ -458,7 +440,7 @@ final class BackendController extends Controller
];
}
$view->addData('monthlySalesCustomer', $monthlySalesCustomer);
$view->data['monthlySalesCustomer'] = $monthlySalesCustomer;
$annualSalesCustomer = [];
for ($i = 1; $i < 11; ++$i) {
@ -469,7 +451,7 @@ final class BackendController extends Controller
];
}
$view->addData('annualSalesCustomer', $annualSalesCustomer);
$view->data['annualSalesCustomer'] = $annualSalesCustomer;
/////
$monthlyCustomerRetention = [];
@ -480,7 +462,7 @@ final class BackendController extends Controller
];
}
$view->addData('monthlyCustomerRetention', $monthlyCustomerRetention);
$view->data['monthlyCustomerRetention'] = $monthlyCustomerRetention;
/////
$currentCustomerRegion = [
@ -492,7 +474,7 @@ final class BackendController extends Controller
'Other' => (int) (\mt_rand(200, 400) / 4),
];
$view->addData('currentCustomerRegion', $currentCustomerRegion);
$view->data['currentCustomerRegion'] = $currentCustomerRegion;
$annualCustomerRegion = [];
for ($i = 1; $i < 11; ++$i) {
@ -508,7 +490,7 @@ final class BackendController extends Controller
];
}
$view->addData('annualCustomerRegion', $annualCustomerRegion);
$view->data['annualCustomerRegion'] = $annualCustomerRegion;
/////
$currentCustomersRep = [];
@ -522,7 +504,7 @@ final class BackendController extends Controller
return $b['customers'] <=> $a['customers'];
});
$view->addData('currentCustomersRep', $currentCustomersRep);
$view->data['currentCustomersRep'] = $currentCustomersRep;
$annualCustomersRep = [];
for ($i = 1; $i < 13; ++$i) {
@ -536,7 +518,7 @@ final class BackendController extends Controller
}
}
$view->addData('annualCustomersRep', $annualCustomersRep);
$view->data['annualCustomersRep'] = $annualCustomersRep;
/////
$currentCustomersCountry = [];
@ -551,7 +533,7 @@ final class BackendController extends Controller
return $b['customers'] <=> $a['customers'];
});
$view->addData('currentCustomersCountry', $currentCustomersCountry);
$view->data['currentCustomersCountry'] = $currentCustomersCountry;
$annualCustomersCountry = [];
for ($i = 1; $i < 51; ++$i) {
@ -569,7 +551,7 @@ final class BackendController extends Controller
}
}
$view->addData('annualCustomersCountry', $annualCustomersCountry);
$view->data['annualCustomersCountry'] = $annualCustomersCountry;
/////
$customerGroups = [];
@ -579,7 +561,7 @@ final class BackendController extends Controller
];
}
$view->addData('customerGroups', $customerGroups);
$view->data['customerGroups'] = $customerGroups;
return $view;
}
@ -598,14 +580,14 @@ final class BackendController extends Controller
*/
public function viewBillAnalysis(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
{
$head = $response->get('Content')->getData('head');
$head = $response->get('Content')->head;
$head->addAsset(AssetType::CSS, 'Resources/chartjs/Chartjs/chart.css');
$head->addAsset(AssetType::JSLATE, 'Resources/chartjs/Chartjs/chart.js');
$head->addAsset(AssetType::JSLATE, 'Modules/ClientManagement/Controller.js', ['type' => 'module']);
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/bill-analysis');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001602001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001602001, $request, $response);
return $view;
}
@ -624,14 +606,14 @@ final class BackendController extends Controller
*/
public function viewSalesRepAnalysis(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
{
$head = $response->get('Content')->getData('head');
$head = $response->get('Content')->head;
$head->addAsset(AssetType::CSS, 'Resources/chartjs/Chartjs/chart.css');
$head->addAsset(AssetType::JSLATE, 'Resources/chartjs/Chartjs/chart.js');
$head->addAsset(AssetType::JSLATE, 'Modules/ClientManagement/Controller.js', ['type' => 'module']);
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/rep-analysis');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001602001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001602001, $request, $response);
/////
$currentCustomerRegion = [
@ -643,7 +625,7 @@ final class BackendController extends Controller
'Other' => (int) (\mt_rand(200, 400) / 4),
];
$view->addData('currentCustomerRegion', $currentCustomerRegion);
$view->data['currentCustomerRegion'] = $currentCustomerRegion;
$annualCustomerRegion = [];
for ($i = 1; $i < 11; ++$i) {
@ -659,7 +641,7 @@ final class BackendController extends Controller
];
}
$view->addData('annualCustomerRegion', $annualCustomerRegion);
$view->data['annualCustomerRegion'] = $annualCustomerRegion;
/////
$currentCustomersRep = [];
@ -673,7 +655,7 @@ final class BackendController extends Controller
return $b['customers'] <=> $a['customers'];
});
$view->addData('currentCustomersRep', $currentCustomersRep);
$view->data['currentCustomersRep'] = $currentCustomersRep;
$annualCustomersRep = [];
for ($i = 1; $i < 13; ++$i) {
@ -687,7 +669,7 @@ final class BackendController extends Controller
}
}
$view->addData('annualCustomersRep', $annualCustomersRep);
$view->data['annualCustomersRep'] = $annualCustomersRep;
return $view;
}
@ -708,7 +690,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/purchase-bill-upload');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response);
return $view;
}
@ -729,7 +711,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/user-purchase-bill-upload');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005109001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005109001, $request, $response);
return $view;
}
@ -750,7 +732,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/user-purchase-bill-dashboard');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005109001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005109001, $request, $response);
$mapperQuery = PurchaseBillMapper::getAll()
->with('type')
@ -762,24 +744,18 @@ final class BackendController extends Controller
->limit(25);
if ($request->getData('ptype') === 'p') {
$view->setData('bills',
$mapperQuery
$view->data['bills'] = $mapperQuery
->where('id', $request->getDataInt('id') ?? 0, '<')
->where('type/l11n/language', $response->header->l11n->language)
->execute()
);
->execute();
} elseif ($request->getData('ptype') === 'n') {
$view->setData('bills',
$mapperQuery->where('id', $request->getDataInt('id') ?? 0, '>')
$view->data['bills'] = $mapperQuery->where('id', $request->getDataInt('id') ?? 0, '>')
->where('type/l11n/language', $response->header->l11n->language)
->execute()
);
->execute();
} else {
$view->setData('bills',
$mapperQuery->where('id', 0, '>')
$view->data['bills'] = $mapperQuery->where('id', 0, '>')
->where('type/l11n/language', $response->header->l11n->language)
->execute()
);
->execute();
}
return $view;
@ -801,7 +777,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/user-purchase-bill');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005109001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005109001, $request, $response);
$bill = PurchaseBillMapper::get()
->with('elements')
@ -811,7 +787,7 @@ final class BackendController extends Controller
->where('id', (int) $request->getData('id'))
->execute();
$view->setData('bill', $bill);
$view->data['bill'] = $bill;
/** @var \Model\Setting $previewType */
$previewType = $this->app->appSettings->get(
@ -819,7 +795,7 @@ final class BackendController extends Controller
module: self::NAME
);
$view->setData('previewType', (int) $previewType->content);
$view->data['previewType'] = (int) $previewType->content;
/** @var \Model\Setting $originalType */
$originalType = $this->app->appSettings->get(
@ -827,7 +803,7 @@ final class BackendController extends Controller
module: self::NAME
);
$view->setData('originalType', (int) $originalType->content);
$view->data['originalType'] = (int) $originalType->content;
return $view;
}

View File

@ -130,7 +130,7 @@ final class CliController extends Controller
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Cli/bill-parsed');
$view->setData('bill', $bill);
$view->data['bill'] = $bill;
return $view;
}

View File

@ -18,4 +18,4 @@ declare(strict_types=1);
/**
* @var \phpOMS\Views\View $this
*/
echo $this->getData('nav')->render();
echo $this->data['nav']->render();

View File

@ -28,23 +28,23 @@ $currencies = ISO4217Enum::getConstants();
/**
* @var \phpOMS\Views\View $this
*/
$media = $this->getData('media') ?? [];
$media = $this->data['media'] ?? [];
/** @var \Modules\Billing\Models\Bill $bill */
$bill = $this->getData('bill') ?? new NullBill();
$elements = $bill->getElements();
$billTypes = $this->getData('billtypes') ?? [];
$billTypes = $this->data['billtypes'] ?? [];
$archive = $bill->getFileByTypeName('original');
/** @var \Modules\Auditor\Models\Audit */
$logs = $this->getData('logs') ?? [];
$logs = $this->data['logs'] ?? [];
$editable = $bill->id === 0 || \in_array($bill->getStatus(), [BillStatus::DRAFT, BillStatus::UNPARSED]);
$disabled = !$editable ? ' disabled' : '';
echo $this->getData('nav')->render(); ?>
echo $this->data['nav']->render(); ?>
<div class="tabview tab-2 col-simple">
<div class="box">

View File

@ -14,9 +14,9 @@ declare(strict_types=1);
use phpOMS\Uri\UriFactory;
$bills = $this->getData('bills') ?? [];
$bills = $this->data['bills'] ?? [];
echo $this->getData('nav')->render(); ?>
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">

View File

@ -22,16 +22,16 @@ include __DIR__ . '/../../../Media/Theme/Backend/template-functions.php';
* @var \phpOMS\Views\View $this
*/
$bill = $this->getData('bill');
$bill = $this->data['bill'];
$elements = $bill->getElements();
$previewType = $this->getData('previewType');
$originalType = $this->getData('originalType');
$previewType = $this->data['previewType'];
$originalType = $this->data['originalType'];
$billPdf = $bill->getFileByType($previewType);
$original = $bill->getFileByType($originalType);
$media = $bill->getMedia();
echo $this->getData('nav')->render(); ?>
echo $this->data['nav']->render(); ?>
<div class="tabview tab-2 col-simple">
<div class="box">

View File

@ -20,7 +20,7 @@ use phpOMS\Localization\Money;
/**
* @var \phpOMS\Views\View $this
*/
echo $this->getData('nav')->render();
echo $this->data['nav']->render();
?>
<div class="tabview tab-2">
@ -100,7 +100,7 @@ echo $this->getData('nav')->render();
Sales per Region - Current
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $customerRegion = $this->getData('currentCustomerRegion'); ?>
<?php $customerRegion = $this->data['currentCustomerRegion']; ?>
<div class="portlet-body">
<canvas id="sales-region" data-chart='{
"type": "pie",
@ -171,7 +171,7 @@ echo $this->getData('nav')->render();
Sales per Region - Annual
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $customerRegion = $this->getData('annualCustomerRegion'); ?>
<?php $customerRegion = $this->data['annualCustomerRegion']; ?>
<div class="portlet-body">
<canvas id="sales-region" data-chart='{
"type": "line",
@ -370,7 +370,7 @@ echo $this->getData('nav')->render();
Profit per Region - Current
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $customerRegion = $this->getData('currentCustomerRegion'); ?>
<?php $customerRegion = $this->data['currentCustomerRegion']; ?>
<div class="portlet-body">
<canvas id="sales-region" data-chart='{
"type": "pie",
@ -441,7 +441,7 @@ echo $this->getData('nav')->render();
Profit per Region - Annual
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $customerRegion = $this->getData('annualCustomerRegion'); ?>
<?php $customerRegion = $this->data['annualCustomerRegion']; ?>
<div class="portlet-body">
<canvas id="sales-region" data-chart='{
"type": "line",
@ -682,7 +682,7 @@ echo $this->getData('nav')->render();
Sales / Profit - Monthly
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $saleCustomer = $this->getData('monthlySaleCustomer'); ?>
<?php $saleCustomer = $this->data['monthlySaleCustomer']; ?>
<div class="portlet-body">
<canvas id="sales-region" data-chart='{
"type": "bar",
@ -809,7 +809,7 @@ echo $this->getData('nav')->render();
Sales / Profit - Annual
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $saleCustomer = $this->getData('annualSaleCustomer'); ?>
<?php $saleCustomer = $this->data['annualSaleCustomer']; ?>
<div class="portlet-body">
<canvas id="sales-customer-annual" data-chart='{
"type": "bar",
@ -927,7 +927,7 @@ echo $this->getData('nav')->render();
Sales per Attribute - Current
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $customerGroups = $this->getData('customerGroups'); ?>
<?php $customerGroups = $this->data['customerGroups']; ?>
<div class="portlet-body">
<div class="form-group">
<label for="iOname"><?= $this->getHtml('Attribute'); ?></label>
@ -1014,7 +1014,7 @@ echo $this->getData('nav')->render();
Sales per Attribute - Annual
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $customerRegion = $this->getData('annualCustomerRegion'); ?>
<?php $customerRegion = $this->data['annualCustomerRegion']; ?>
<div class="portlet-body">
<div class="form-group">
<label for="iOname"><?= $this->getHtml('Attribute'); ?></label>
@ -1220,7 +1220,7 @@ echo $this->getData('nav')->render();
Profit per Attribute - Current
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $customerGroups = $this->getData('customerGroups'); ?>
<?php $customerGroups = $this->data['customerGroups']; ?>
<div class="portlet-body">
<div class="form-group">
<label for="iOname"><?= $this->getHtml('Attribute'); ?></label>
@ -1307,7 +1307,7 @@ echo $this->getData('nav')->render();
Profit per Attribute - Annual
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $customerRegion = $this->getData('annualCustomerRegion'); ?>
<?php $customerRegion = $this->data['annualCustomerRegion']; ?>
<div class="portlet-body">
<div class="form-group">
<label for="iOname"><?= $this->getHtml('Attribute'); ?></label>
@ -1513,7 +1513,7 @@ echo $this->getData('nav')->render();
Invoices / Articles - Monthly
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $saleCustomer = $this->getData('monthlySaleCustomer'); ?>
<?php $saleCustomer = $this->data['monthlySaleCustomer']; ?>
<div class="portlet-body">
<canvas id="sales-region" data-chart='{
"type": "bar",
@ -1639,7 +1639,7 @@ echo $this->getData('nav')->render();
Invoices / Articles - Annual
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $saleCustomer = $this->getData('annualSaleCustomer'); ?>
<?php $saleCustomer = $this->data['annualSaleCustomer']; ?>
<div class="portlet-body">
<canvas id="sales-customer-annual" data-chart='{
"type": "bar",

View File

@ -18,7 +18,7 @@ declare(strict_types=1);
/**
* @var \phpOMS\Views\View $this
*/
echo $this->getData('nav')->render();
echo $this->data['nav']->render();
?>
<div class="tabview tab-2">
@ -97,7 +97,7 @@ echo $this->getData('nav')->render();
Sales per Rep - Current
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $customersRep = $this->getData('currentCustomersRep'); ?>
<?php $customersRep = $this->data['currentCustomersRep']; ?>
<div class="portlet-body">
<canvas id="sales-region" data-chart='{
"type": "horizontalBar",
@ -175,7 +175,7 @@ echo $this->getData('nav')->render();
Sales per Rep - Annual
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $customersRep = $this->getData('annualCustomersRep'); ?>
<?php $customersRep = $this->data['annualCustomersRep']; ?>
<table class="default">
<thead>
<tr>
@ -211,7 +211,7 @@ echo $this->getData('nav')->render();
Profit per Rep - Current
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $customersRep = $this->getData('currentCustomersRep'); ?>
<?php $customersRep = $this->data['currentCustomersRep']; ?>
<div class="portlet-body">
<canvas id="sales-region" data-chart='{
"type": "horizontalBar",
@ -289,7 +289,7 @@ echo $this->getData('nav')->render();
Profit per Rep - Annual
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $customersRep = $this->getData('annualCustomersRep'); ?>
<?php $customersRep = $this->data['annualCustomersRep']; ?>
<table class="default">
<thead>
<tr>

View File

@ -14,9 +14,9 @@ declare(strict_types=1);
use phpOMS\Uri\UriFactory;
$bills = $this->getData('bills') ?? [];
$bills = $this->data['bills'] ?? [];
echo $this->getData('nav')->render(); ?>
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">

View File

@ -16,9 +16,9 @@ use phpOMS\Localization\ISO3166NameEnum;
use phpOMS\Localization\ISO3166TwoEnum;
use phpOMS\Uri\UriFactory;
$bills = $this->getData('bills') ?? [];
$bills = $this->data['bills'] ?? [];
echo $this->getData('nav')->render(); ?>
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">

View File

@ -22,16 +22,16 @@ include __DIR__ . '/../../../Media/Theme/Backend/template-functions.php';
* @var \phpOMS\Views\View $this
*/
$bill = $this->getData('bill');
$bill = $this->data['bill'];
$elements = $bill->getElements();
$previewType = $this->getData('previewType');
$originalType = $this->getData('originalType');
$previewType = $this->data['previewType'];
$originalType = $this->data['originalType'];
$billPdf = $bill->getFileByType($previewType);
$original = $bill->getFileByType($originalType);
$media = $bill->getMedia();
echo $this->getData('nav')->render(); ?>
echo $this->data['nav']->render(); ?>
<div class="tabview tab-2">
<div class="box">