fix l11n call

This commit is contained in:
Dennis Eichhorn 2021-06-24 00:06:49 +02:00
parent 9657262309
commit a8c964c6c5
3 changed files with 11 additions and 16 deletions

View File

@ -277,18 +277,9 @@ final class ApiController extends Controller
}
$attrType = $this->createItemAttributeTypeFromRequest($request);
$attrType->setL11n($request->getData('title'), $request->getData('language'));
$this->createModel($request->header->account, $attrType, ItemAttributeTypeMapper::class, 'attr_type', $request->getOrigin());
$l11nRequest = new HttpRequest($request->uri);
$l11nRequest->setData('type', $attrType->getId());
$l11nRequest->setData('title', $request->getData('title'));
$l11nRequest->setData('language', $request->getData('language'));
$l11nAttributeType = $this->createItemAttributeTypeL11nFromRequest($l11nRequest);
$this->createModel($request->header->account, $l11nAttributeType, ItemAttributeTypeL11nMapper::class, 'attr_type_l11n_create', $request->getOrigin());
$attrType->setL11n($l11nAttributeType);
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Attribute type', 'Attribute type successfully created', $attrType);
}
@ -304,7 +295,7 @@ final class ApiController extends Controller
private function createItemAttributeTypeFromRequest(RequestAbstract $request) : ItemAttributeType
{
$attrType = new ItemAttributeType();
$attrType->setL11n((string) ($request->getData('name') ?? ''));
$attrType->name = (string) ($request->getData('name') ?? '');
$attrType->setFields((int) ($request->getData('fields') ?? 0));
$attrType->setCustom((bool) ($request->getData('custom') ?? false));

View File

@ -16,6 +16,7 @@ use Modules\Media\Models\NullMedia;
use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Views\View $this */
/** @var \Modules\ItemManagement\Models\Item[] $items */
$items = $this->getData('items');
echo $this->getData('nav')->render(); ?>

View File

@ -18,11 +18,13 @@ use phpOMS\Localization\Money;
use phpOMS\Localization\NullLocalization;
use phpOMS\Uri\UriFactory;
/**
* @var \Modules\ItemManagement\Models\Item $item
*/
$item = $this->getData('item');
$itemL11n = $this->getData('itemL11n');
/** @var \Modules\ItemManagement\Models\Item $item */
$item = $this->getData('item');
/** @var \Modules\ItemManagement\Models\ItemL11n $itemL11n */
$itemL11n = $this->getData('itemL11n');
/** @var \Modules\ItemManagement\Models\ItemAttribute $itemAttribute */
$itemAttribute = $this->getData('itemAttribute');
$notes = $item->getNotes();
@ -37,6 +39,7 @@ $monthlySalesCosts = $this->getData('monthlySalesCosts') ?? [];
$languages = ISO639Enum::getConstants();
/** @var \phpOMS\Localization\Localization $l11n */
$l11n = $this->getData('defaultlocalization') ?? new NullLocalization();
echo $this->getData('nav')->render();