mirror of
https://github.com/Karaka-Management/oms-Shop.git
synced 2026-02-17 02:08:41 +00:00
Quick backup before crash
This commit is contained in:
parent
69dae414b1
commit
36f1e1246e
|
|
@ -127,7 +127,7 @@ final class Application
|
||||||
|
|
||||||
/* CSRF token OK? */
|
/* CSRF token OK? */
|
||||||
if ($request->hasData('CSRF')
|
if ($request->hasData('CSRF')
|
||||||
&& !\hash_equals($this->app->sessionManager->get('CSRF'), $request->getDataString('CSRF'))
|
&& !\hash_equals($this->app->sessionManager->data['CSRF'] ?? '', $request->getDataString('CSRF'))
|
||||||
) {
|
) {
|
||||||
$response->header->status = RequestStatusCode::R_403;
|
$response->header->status = RequestStatusCode::R_403;
|
||||||
|
|
||||||
|
|
@ -153,20 +153,20 @@ final class Application
|
||||||
|
|
||||||
if ($account->id > 0) {
|
if ($account->id > 0) {
|
||||||
$response->header->l11n = $account->l11n;
|
$response->header->l11n = $account->l11n;
|
||||||
} elseif ($this->app->sessionManager->get('language') !== null
|
} elseif (isset($this->app->sessionManager->data['language'])
|
||||||
&& $response->header->l11n->language !== $this->app->sessionManager->get('language')
|
&& $response->header->l11n->language !== $this->app->sessionManager->data['language']
|
||||||
) {
|
) {
|
||||||
$response->header->l11n
|
$response->header->l11n
|
||||||
->loadFromLanguage(
|
->loadFromLanguage(
|
||||||
$this->app->sessionManager->get('language'),
|
$this->app->sessionManager->data['language'],
|
||||||
$this->app->sessionManager->get('country') ?? '*'
|
$this->app->sessionManager->data['country'] ?? '*'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->app->setResponseLanguage($request, $response, $this->config);
|
$this->app->setResponseLanguage($request, $response, $this->config);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!\in_array($response->header->l11n->language, $this->config['language'])) {
|
if (!\in_array($response->header->l11n->language, $this->config['language'])) {
|
||||||
$response->header->l11n->setLanguage($this->app->l11nServer->language);
|
$response->header->l11n->language = $this->app->l11nServer->language;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pageView = new ShopView($this->app->l11nManager, $request, $response);
|
$pageView = new ShopView($this->app->l11nManager, $request, $response);
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ final class ApiController extends Controller
|
||||||
public function apiItemFileDownload(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
|
public function apiItemFileDownload(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
|
||||||
{
|
{
|
||||||
// Handle public files
|
// Handle public files
|
||||||
|
/** @var \Modules\ItemManagement\Models\Item $item */
|
||||||
$item = ItemMapper::get()
|
$item = ItemMapper::get()
|
||||||
->with('files')
|
->with('files')
|
||||||
->with('files/types')
|
->with('files/types')
|
||||||
|
|
@ -76,11 +77,13 @@ final class ApiController extends Controller
|
||||||
|
|
||||||
// Handle private files
|
// Handle private files
|
||||||
// @todo: this is another example where it would be useful to have clients and items as models in the bill and bill element
|
// @todo: this is another example where it would be useful to have clients and items as models in the bill and bill element
|
||||||
|
/** @var \Modules\ClientManagement\Models\Client $client */
|
||||||
$client = ClientMapper::get()
|
$client = ClientMapper::get()
|
||||||
->where('account', $request->header->account)
|
->where('account', $request->header->account)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
// @todo: only for sales invoice, currently also for offers
|
// @todo: only for sales invoice, currently also for offers
|
||||||
|
/** @var \Modules\Billing\Models\Bill[] $bills */
|
||||||
$bills = BillMapper::getAll()
|
$bills = BillMapper::getAll()
|
||||||
->with('elements')
|
->with('elements')
|
||||||
->where('client', $client->id)
|
->where('client', $client->id)
|
||||||
|
|
@ -93,6 +96,7 @@ final class ApiController extends Controller
|
||||||
$elements = $bill->getElements();
|
$elements = $bill->getElements();
|
||||||
|
|
||||||
foreach ($elements as $element) {
|
foreach ($elements as $element) {
|
||||||
|
/** @var \Modules\ItemManagement\Models\Item $item */
|
||||||
$item = ItemMapper::get()
|
$item = ItemMapper::get()
|
||||||
->with('files')
|
->with('files')
|
||||||
->with('files/type')
|
->with('files/type')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user