mirror of
https://github.com/Karaka-Management/oms-ItemManagement.git
synced 2026-02-05 06:48:42 +00:00
fixes
This commit is contained in:
parent
203eccb933
commit
f2eb46f65f
|
|
@ -26,9 +26,7 @@ use Modules\ItemManagement\Models\ItemAttributeTypeL11nMapper;
|
|||
use Modules\ItemManagement\Models\ItemAttributeTypeMapper;
|
||||
use Modules\ItemManagement\Models\ItemAttributeValueL11nMapper;
|
||||
use Modules\ItemManagement\Models\ItemAttributeValueMapper;
|
||||
use Modules\ItemManagement\Models\ItemL11n;
|
||||
use Modules\ItemManagement\Models\ItemL11nMapper;
|
||||
use Modules\ItemManagement\Models\ItemL11nType;
|
||||
use Modules\ItemManagement\Models\ItemL11nTypeMapper;
|
||||
use Modules\ItemManagement\Models\ItemMapper;
|
||||
use Modules\ItemManagement\Models\ItemPrice;
|
||||
|
|
@ -36,15 +34,16 @@ use Modules\ItemManagement\Models\ItemPriceStatus;
|
|||
use Modules\ItemManagement\Models\ItemRelationType;
|
||||
use Modules\ItemManagement\Models\ItemRelationTypeMapper;
|
||||
use Modules\ItemManagement\Models\ItemStatus;
|
||||
use Modules\ItemManagement\Models\NullItemL11nType;
|
||||
use Modules\Media\Models\Collection;
|
||||
use Modules\Media\Models\CollectionMapper;
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use Modules\Media\Models\MediaTypeMapper;
|
||||
use Modules\Media\Models\PathSettings;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
use phpOMS\Localization\BaseStringL11nType;
|
||||
use phpOMS\Localization\ISO4217CharEnum;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use phpOMS\Localization\NullBaseStringL11nType;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use phpOMS\Message\Http\HttpResponse;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
|
|
@ -81,7 +80,7 @@ final class ApiController extends Controller
|
|||
*/
|
||||
public function apiItemFind(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
|
||||
{
|
||||
/** @var \Modules\ItemManagement\Models\ItemL11n[] $l11n */
|
||||
/** @var \Modules\ItemManagement\Models\BaseStringL11n[] $l11n */
|
||||
$l11n = ItemL11nMapper::getAll()
|
||||
->with('type')
|
||||
->where('type/title', ['name1', 'name2', 'name3'], 'IN')
|
||||
|
|
@ -893,13 +892,13 @@ final class ApiController extends Controller
|
|||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return ItemL11nType
|
||||
* @return BaseStringL11nType
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function createItemL11nTypeFromRequest(RequestAbstract $request) : ItemL11nType
|
||||
private function createItemL11nTypeFromRequest(RequestAbstract $request) : BaseStringL11nType
|
||||
{
|
||||
$itemL11nType = new ItemL11nType();
|
||||
$itemL11nType = new BaseStringL11nType();
|
||||
$itemL11nType->title = $request->getDataString('title') ?? '';
|
||||
$itemL11nType->isRequired = (bool) ($request->getData('is_required') ?? false);
|
||||
|
||||
|
|
@ -1020,19 +1019,19 @@ final class ApiController extends Controller
|
|||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return ItemL11n
|
||||
* @return BaseStringL11n
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function createItemL11nFromRequest(RequestAbstract $request) : ItemL11n
|
||||
private function createItemL11nFromRequest(RequestAbstract $request) : BaseStringL11n
|
||||
{
|
||||
$itemL11n = new ItemL11n();
|
||||
$itemL11n->item = $request->getDataInt('item') ?? 0;
|
||||
$itemL11n->type = new NullItemL11nType($request->getDataInt('type') ?? 0);
|
||||
$itemL11n = new BaseStringL11n();
|
||||
$itemL11n->ref = $request->getDataInt('item') ?? 0;
|
||||
$itemL11n->type = new NullBaseStringL11nType($request->getDataInt('type') ?? 0);
|
||||
$itemL11n->setLanguage(
|
||||
$request->getDataString('language') ?? $request->getLanguage()
|
||||
);
|
||||
$itemL11n->description = $request->getDataString('description') ?? '';
|
||||
$itemL11n->content = $request->getDataString('description') ?? '';
|
||||
|
||||
return $itemL11n;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ declare(strict_types=1);
|
|||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
use Modules\Editor\Models\EditorDoc;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
use phpOMS\Localization\NullBaseStringL11n;
|
||||
use phpOMS\Stdlib\Base\FloatInt;
|
||||
|
||||
/**
|
||||
|
|
@ -64,7 +66,7 @@ class Item implements \JsonSerializable
|
|||
/**
|
||||
* Localizations.
|
||||
*
|
||||
* @var ItemL11n[]
|
||||
* @var BaseStringL11n[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $l11n = [];
|
||||
|
|
@ -118,13 +120,13 @@ class Item implements \JsonSerializable
|
|||
/**
|
||||
* Add item l11n
|
||||
*
|
||||
* @param ItemL11n $l11n Item localization
|
||||
* @param BaseStringL11n $l11n Item localization
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function addL11n(ItemL11n $l11n) : void
|
||||
public function addL11n(BaseStringL11n $l11n) : void
|
||||
{
|
||||
foreach ($this->l11n as $l11n) {
|
||||
if ($l11n->type->title === $l11n->type->title) {
|
||||
|
|
@ -140,11 +142,11 @@ class Item implements \JsonSerializable
|
|||
*
|
||||
* @param null|string $type Localization type
|
||||
*
|
||||
* @return ItemL11n
|
||||
* @return BaseStringL11n
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getL11n(string $type = null) : ItemL11n
|
||||
public function getL11n(string $type = null) : BaseStringL11n
|
||||
{
|
||||
foreach ($this->l11n as $l11n) {
|
||||
if ($l11n->type->title === $type) {
|
||||
|
|
@ -152,13 +154,13 @@ class Item implements \JsonSerializable
|
|||
}
|
||||
}
|
||||
|
||||
return new NullItemL11n();
|
||||
return new NullBaseStringL11n();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get localizations
|
||||
*
|
||||
* @return ItemL11n[]
|
||||
* @return BaseStringL11n[]
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,143 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
/**
|
||||
* Localization of the item class.
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class ItemL11n implements \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* Article ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int $id = 0;
|
||||
|
||||
/**
|
||||
* Item ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int $item = 0;
|
||||
|
||||
/**
|
||||
* Item ID.
|
||||
*
|
||||
* @var ItemL11nType
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public ItemL11nType $type;
|
||||
|
||||
/**
|
||||
* Language.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected string $language = ISO639x1Enum::_EN;
|
||||
|
||||
/**
|
||||
* Title.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public string $description = '';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ItemL11nType $type Item localization type
|
||||
* @param string $description Description/content
|
||||
* @param string $language Language
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(ItemL11nType $type = null, string $description = '', string $language = ISO639x1Enum::_EN)
|
||||
{
|
||||
$this->type = $type ?? new ItemL11nType();
|
||||
$this->description = $description;
|
||||
$this->language = $language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get language
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getLanguage() : string
|
||||
{
|
||||
return $this->language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language
|
||||
*
|
||||
* @param string $language Language
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setLanguage(string $language) : void
|
||||
{
|
||||
$this->language = $language;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'description' => $this->description,
|
||||
'item' => $this->item,
|
||||
'language' => $this->language,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize() : mixed
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
|||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
|
||||
/**
|
||||
* Item mapper class.
|
||||
|
|
@ -37,8 +38,8 @@ final class ItemL11nMapper extends DataMapperFactory
|
|||
*/
|
||||
public const COLUMNS = [
|
||||
'itemmgmt_item_l11n_id' => ['name' => 'itemmgmt_item_l11n_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'itemmgmt_item_l11n_description' => ['name' => 'itemmgmt_item_l11n_description', 'type' => 'string', 'internal' => 'description', 'autocomplete' => true],
|
||||
'itemmgmt_item_l11n_item' => ['name' => 'itemmgmt_item_l11n_item', 'type' => 'int', 'internal' => 'item'],
|
||||
'itemmgmt_item_l11n_description' => ['name' => 'itemmgmt_item_l11n_description', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
|
||||
'itemmgmt_item_l11n_item' => ['name' => 'itemmgmt_item_l11n_item', 'type' => 'int', 'internal' => 'ref'],
|
||||
'itemmgmt_item_l11n_lang' => ['name' => 'itemmgmt_item_l11n_lang', 'type' => 'string', 'internal' => 'language'],
|
||||
'itemmgmt_item_l11n_typeref' => ['name' => 'itemmgmt_item_l11n_typeref', 'type' => 'int', 'internal' => 'type'],
|
||||
];
|
||||
|
|
@ -71,4 +72,12 @@ final class ItemL11nMapper extends DataMapperFactory
|
|||
* @since 1.0.0
|
||||
*/
|
||||
public const PRIMARYFIELD = 'itemmgmt_item_l11n_id';
|
||||
|
||||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BaseStringL11n::class;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,93 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
/**
|
||||
* Item class.
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class ItemL11nType implements \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* Article ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int $id = 0;
|
||||
|
||||
/**
|
||||
* Identifier for the l11n type.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public string $title = '';
|
||||
|
||||
/**
|
||||
* Is the l11n type required for an item?
|
||||
*
|
||||
* @var bool
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public bool $isRequired = false;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $title Title
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(string $title = '')
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize() : mixed
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
|||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
use phpOMS\Localization\BaseStringL11nType;
|
||||
|
||||
/**
|
||||
* Item mapper class.
|
||||
|
|
@ -24,7 +25,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
|||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of ItemL11nType
|
||||
* @template T of BaseStringL11nType
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class ItemL11nTypeMapper extends DataMapperFactory
|
||||
|
|
@ -56,4 +57,12 @@ final class ItemL11nTypeMapper extends DataMapperFactory
|
|||
* @since 1.0.0
|
||||
*/
|
||||
public const PRIMARYFIELD = 'itemmgmt_item_l11n_type_id';
|
||||
|
||||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BaseStringL11nType::class;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ use Modules\Media\Models\Media;
|
|||
use Modules\Media\Models\MediaMapper;
|
||||
use Modules\Media\Models\MediaType;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
use phpOMS\Localization\BaseStringL11nType;
|
||||
|
||||
/**
|
||||
* Item mapper class.
|
||||
|
|
@ -169,18 +171,18 @@ final class ItemMapper extends DataMapperFactory
|
|||
$l11nsResult = $sth->fetchAll();
|
||||
|
||||
foreach ($l11nsResult as $res) {
|
||||
$l11nType = new ItemL11nType();
|
||||
$l11nType = new BaseStringL11nType();
|
||||
$l11nType->id = $res['itemmgmt_item_l11n_typeref'];
|
||||
$l11nType->title= $res['itemmgmt_item_l11n_type_title'];
|
||||
|
||||
$l11n = new ItemL11n();
|
||||
$l11n = new BaseStringL11n();
|
||||
$l11n->id = $res['itemmgmt_item_l11n_id'];
|
||||
$l11n->item = $res['itemmgmt_item_id'];
|
||||
$l11n->ref = $res['itemmgmt_item_id'];
|
||||
$l11n->type = $l11nType;
|
||||
$l11n->description = $res['itemmgmt_item_l11n_description'];
|
||||
$l11n->content = $res['itemmgmt_item_l11n_description'];
|
||||
$l11n->setLanguage($res['itemmgmt_item_l11n_lang']);
|
||||
|
||||
$items[$l11n->item]->addL11n($l11n);
|
||||
$items[$l11n->ref]->addL11n($l11n);
|
||||
}
|
||||
|
||||
return $items;
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
/**
|
||||
* Null model
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class NullItemL11n extends ItemL11n
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize() : mixed
|
||||
{
|
||||
return ['id' => $this->id];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
/**
|
||||
* Null model
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class NullItemL11nType extends ItemL11nType
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize() : mixed
|
||||
{
|
||||
return ['id' => $this->id];
|
||||
}
|
||||
}
|
||||
|
|
@ -74,11 +74,11 @@ echo $this->getData('nav')->render();
|
|||
<tr><td><label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
|
||||
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="number" id="iId" min="1" name="id" value="<?= $this->printHtml($item->number); ?>" disabled></span>
|
||||
<tr><td><label for="iName1"><?= $this->getHtml('Name1'); ?></label>
|
||||
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml($item->getL11n('name1')->description); ?>" spellcheck="false" required>
|
||||
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml($item->getL11n('name1')->content); ?>" spellcheck="false" required>
|
||||
<tr><td><label for="iName2"><?= $this->getHtml('Name2'); ?></label>
|
||||
<tr><td><input type="text" id="iName2" name="name2" value="<?= $this->printHtml($item->getL11n('name2')->description); ?>" spellcheck="false">
|
||||
<tr><td><input type="text" id="iName2" name="name2" value="<?= $this->printHtml($item->getL11n('name2')->content); ?>" spellcheck="false">
|
||||
<tr><td><label for="iName3"><?= $this->getHtml('Name3'); ?></label>
|
||||
<tr><td><input type="text" id="iName3" name="name3" value="<?= $this->printHtml($item->getL11n('name3')->description); ?>" spellcheck="false">
|
||||
<tr><td><input type="text" id="iName3" name="name3" value="<?= $this->printHtml($item->getL11n('name3')->content); ?>" spellcheck="false">
|
||||
</table>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
|
|
@ -232,7 +232,7 @@ echo $this->getData('nav')->render();
|
|||
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->getNumber()); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->type->getL11n()); ?></a>
|
||||
<td><a class="content" href="<?= UriFactory::build('{/base}/sales/client/profile?{?}&id=' . $invoice->client->id); ?>"><?= $this->printHtml($invoice->billTo); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->netSales->getCurrency()); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->getCurrency($invoice->netSales); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->createdAt->format('Y-m-d')); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
|
@ -1072,7 +1072,7 @@ echo $this->getData('nav')->render();
|
|||
<td><a href="<?= $url; ?>"><?= $invoice->getNumber(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $invoice->type->getL11n(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $invoice->billTo; ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $invoice->netSales->getCurrency(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->getCurrency($invoice->netSales); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $invoice->createdAt->format('Y-m-d'); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -74,11 +74,11 @@ echo $this->getData('nav')->render();
|
|||
<tr><td><label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
|
||||
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="number" id="iId" min="1" name="id" value="<?= $this->printHtml($item->number); ?>" disabled></span>
|
||||
<tr><td><label for="iName1"><?= $this->getHtml('Name1'); ?></label>
|
||||
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml($item->getL11n('name1')->description); ?>" spellcheck="false" required>
|
||||
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml($item->getL11n('name1')->content); ?>" spellcheck="false" required>
|
||||
<tr><td><label for="iName2"><?= $this->getHtml('Name2'); ?></label>
|
||||
<tr><td><input type="text" id="iName2" name="name2" value="<?= $this->printHtml($item->getL11n('name2')->description); ?>" spellcheck="false">
|
||||
<tr><td><input type="text" id="iName2" name="name2" value="<?= $this->printHtml($item->getL11n('name2')->content); ?>" spellcheck="false">
|
||||
<tr><td><label for="iName3"><?= $this->getHtml('Name3'); ?></label>
|
||||
<tr><td><input type="text" id="iName3" name="name3" value="<?= $this->printHtml($item->getL11n('name3')->description); ?>" spellcheck="false">
|
||||
<tr><td><input type="text" id="iName3" name="name3" value="<?= $this->printHtml($item->getL11n('name3')->content); ?>" spellcheck="false">
|
||||
</table>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
|
|
@ -526,7 +526,7 @@ echo $this->getData('nav')->render();
|
|||
<tr>
|
||||
<td><label for="iText1"><?= $this->getHtml('Value'); ?></label>
|
||||
<tr>
|
||||
<td><input id="iName5" name="name5" type="text" value="<?= $this->printHtml($item->getL11n('name1')->description); ?>">
|
||||
<td><input id="iName5" name="name5" type="text" value="<?= $this->printHtml($item->getL11n('name1')->content); ?>">
|
||||
<tr>
|
||||
<td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,78 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\tests\Models;
|
||||
|
||||
use Modules\ItemManagement\Models\ItemL11n;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class ItemL11nTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
private ItemL11n $l11n;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() : void
|
||||
{
|
||||
$this->l11n = new ItemL11n();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ItemManagement\Models\ItemL11n
|
||||
* @group module
|
||||
*/
|
||||
public function testDefault() : void
|
||||
{
|
||||
self::assertEquals(0, $this->l11n->id);
|
||||
self::assertEquals('', $this->l11n->description);
|
||||
self::assertEquals(0, $this->l11n->item);
|
||||
self::assertEquals(ISO639x1Enum::_EN, $this->l11n->getLanguage());
|
||||
self::assertInstanceOf('Modules\ItemManagement\Models\ItemL11nType', $this->l11n->type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ItemManagement\Models\ItemL11n
|
||||
* @group module
|
||||
*/
|
||||
public function testNameInputOutput() : void
|
||||
{
|
||||
$this->l11n->description = 'TestName';
|
||||
self::assertEquals('TestName', $this->l11n->description);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ItemManagement\Models\ItemL11n
|
||||
* @group module
|
||||
*/
|
||||
public function testSerialize() : void
|
||||
{
|
||||
$this->l11n->description = 'Title';
|
||||
$this->l11n->item = 2;
|
||||
$this->l11n->setLanguage(ISO639x1Enum::_DE);
|
||||
|
||||
self::assertEquals(
|
||||
[
|
||||
'id' => 0,
|
||||
'description' => 'Title',
|
||||
'item' => 2,
|
||||
'language' => ISO639x1Enum::_DE,
|
||||
],
|
||||
$this->l11n->jsonSerialize()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\tests\Models;
|
||||
|
||||
use Modules\ItemManagement\Models\ItemL11nType;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class ItemL11nTypeTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
private ItemL11nType $l11n;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() : void
|
||||
{
|
||||
$this->l11n = new ItemL11nType();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ItemManagement\Models\ItemL11nType
|
||||
* @group module
|
||||
*/
|
||||
public function testDefault() : void
|
||||
{
|
||||
self::assertEquals(0, $this->l11n->id);
|
||||
self::assertEquals('', $this->l11n->title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ItemManagement\Models\ItemL11nType
|
||||
* @group module
|
||||
*/
|
||||
public function testTitleInputOutput() : void
|
||||
{
|
||||
$this->l11n->title = 'TestName';
|
||||
self::assertEquals('TestName', $this->l11n->title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ItemManagement\Models\ItemL11nType
|
||||
* @group module
|
||||
*/
|
||||
public function testSerialize() : void
|
||||
{
|
||||
$this->l11n->title = 'Title';
|
||||
|
||||
self::assertEquals(
|
||||
[
|
||||
'id' => 0,
|
||||
'title' => 'Title',
|
||||
],
|
||||
$this->l11n->jsonSerialize()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -20,6 +20,7 @@ use Modules\Attribute\Models\Attribute;
|
|||
use Modules\ItemManagement\Models\ItemL11n;
|
||||
use Modules\ItemManagement\Models\ItemStatus;
|
||||
use Modules\Media\Models\Media;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -101,7 +102,7 @@ final class ItemTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testL11nInputOutput() : void
|
||||
{
|
||||
$this->item->addL11n($t = new ItemL11n()); // has by default '' as type
|
||||
$this->item->addL11n($t = new BaseStringL11n()); // has by default '' as type
|
||||
self::assertEquals($t, $this->item->getL11n(''));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\tests\Models;
|
||||
|
||||
use Modules\ItemManagement\Models\NullItemL11n;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NullItemL11nTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\ItemManagement\Models\NullItemL11n
|
||||
* @group framework
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\ItemManagement\Models\ItemL11n', new NullItemL11n());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ItemManagement\Models\NullItemL11n
|
||||
* @group framework
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullItemL11n(2);
|
||||
self::assertEquals(2, $null->id);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\tests\Models;
|
||||
|
||||
use Modules\ItemManagement\Models\NullItemL11nType;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NullItemL11nTypeTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\ItemManagement\Models\NullItemL11nType
|
||||
* @group framework
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\ItemManagement\Models\ItemL11nType', new NullItemL11nType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ItemManagement\Models\NullItemL11nType
|
||||
* @group framework
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullItemL11nType(2);
|
||||
self::assertEquals(2, $null->id);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user