mirror of
https://github.com/Karaka-Management/oms-ItemManagement.git
synced 2026-02-15 11:48:40 +00:00
Quick backup before crash
This commit is contained in:
parent
c2556519c3
commit
f3e313043b
|
|
@ -112,7 +112,7 @@ final class Installer extends InstallerAbstract
|
||||||
/** @var \Modules\Attribute\Models\AttributeType[] $attributeTypes */
|
/** @var \Modules\Attribute\Models\AttributeType[] $attributeTypes */
|
||||||
$attributeTypes = ItemAttributeTypeMapper::getAll()->with('defaults')->execute();
|
$attributeTypes = ItemAttributeTypeMapper::getAll()->with('defaults')->execute();
|
||||||
|
|
||||||
/** @var \Modules\ItemManagement\Models\ItemL11nType[] $l11nTypes */
|
/** @var \phpOMS\Localization\BaseStringL11nType[] $l11nTypes */
|
||||||
$l11nTypes = ItemL11nTypeMapper::getAll()->execute();
|
$l11nTypes = ItemL11nTypeMapper::getAll()->execute();
|
||||||
|
|
||||||
// Change indexing for easier search later on.
|
// Change indexing for easier search later on.
|
||||||
|
|
@ -292,10 +292,10 @@ final class Installer extends InstallerAbstract
|
||||||
/**
|
/**
|
||||||
* Install default attribute types
|
* Install default attribute types
|
||||||
*
|
*
|
||||||
* @param ApplicationAbstract $app Application
|
* @param ApplicationAbstract $app Application
|
||||||
* @param array<array{name:string, l11n?:array<string, string>, is_required?:bool, is_custom_allowed?:bool, validation_pattern?:string, value_type?:string, values?:array<string, mixed>}> $attributes Attribute definition
|
* @param array $attributes Attribute definition
|
||||||
*
|
*
|
||||||
* @return array<string, array>
|
* @return array
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
@ -357,11 +357,11 @@ final class Installer extends InstallerAbstract
|
||||||
/**
|
/**
|
||||||
* Create default attribute values for types
|
* Create default attribute values for types
|
||||||
*
|
*
|
||||||
* @param ApplicationAbstract $app Application
|
* @param ApplicationAbstract $app Application
|
||||||
* @param array $itemAttrType Attribute types
|
* @param array $itemAttrType Attribute types
|
||||||
* @param array<array{name:string, l11n?:array<string, string>, is_required?:bool, is_custom_allowed?:bool, validation_pattern?:string, value_type?:string, values?:array<string, mixed>}> $attributes Attribute definition
|
* @param array $attributes Attribute definition
|
||||||
*
|
*
|
||||||
* @return array<string, array>
|
* @return array
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ final class ApiController extends Controller
|
||||||
*/
|
*/
|
||||||
public function apiItemFind(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
|
public function apiItemFind(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
|
||||||
{
|
{
|
||||||
/** @var \Modules\ItemManagement\Models\BaseStringL11n[] $l11n */
|
/** @var BaseStringL11n[] $l11n */
|
||||||
$l11n = ItemL11nMapper::getAll()
|
$l11n = ItemL11nMapper::getAll()
|
||||||
->with('type')
|
->with('type')
|
||||||
->where('type/title', ['name1', 'name2', 'name3'], 'IN')
|
->where('type/title', ['name1', 'name2', 'name3'], 'IN')
|
||||||
|
|
@ -90,7 +90,7 @@ final class ApiController extends Controller
|
||||||
|
|
||||||
$items = [];
|
$items = [];
|
||||||
foreach ($l11n as $item) {
|
foreach ($l11n as $item) {
|
||||||
$items[] = $item->item;
|
$items[] = $item->ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var \Modules\ItemManagement\Models\Item[] $itemList */
|
/** @var \Modules\ItemManagement\Models\Item[] $itemList */
|
||||||
|
|
|
||||||
|
|
@ -402,27 +402,31 @@ final class BackendController extends Controller
|
||||||
SettingsEnum::DEFAULT_LOCALIZATION,
|
SettingsEnum::DEFAULT_LOCALIZATION,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
|
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
|
||||||
$view->data['attributeView']->data['defaultlocalization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute();
|
$view->data['attributeView']->data['defaultlocalization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute();
|
||||||
|
|
||||||
$l11nTypes = ItemL11nTypeMapper::getAll()
|
$l11nTypes = ItemL11nTypeMapper::getAll()
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$view->data['l11nTypes'] = $l11nTypes;
|
$view->data['l11nTypes'] = $l11nTypes;
|
||||||
|
|
||||||
$l11nValues = ItemL11nMapper::getAll()
|
$l11nValues = ItemL11nMapper::getAll()
|
||||||
->with('type')
|
->with('type')
|
||||||
->where('ref', $item->id)
|
->where('ref', $item->id)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$view->data['l11nValues'] = $l11nValues;
|
$view->data['l11nValues'] = $l11nValues;
|
||||||
|
|
||||||
$attributeTypes = ItemAttributeTypeMapper::getAll()
|
$attributeTypes = ItemAttributeTypeMapper::getAll()
|
||||||
->with('l11n')
|
->with('l11n')
|
||||||
->where('l11n/language', $response->header->l11n->language)
|
->where('l11n/language', $response->header->l11n->language)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$view->data['attributeTypes'] = $attributeTypes;
|
$view->data['attributeTypes'] = $attributeTypes;
|
||||||
|
|
||||||
$units = UnitMapper::getAll()
|
$units = UnitMapper::getAll()
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$view->data['units'] = $units;
|
$view->data['units'] = $units;
|
||||||
|
|
||||||
$prices = PriceMapper::getAll()
|
$prices = PriceMapper::getAll()
|
||||||
|
|
@ -430,6 +434,7 @@ final class BackendController extends Controller
|
||||||
->where('type', PriceType::SALES)
|
->where('type', PriceType::SALES)
|
||||||
->where('client', null)
|
->where('client', null)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$view->data['prices'] = $prices;
|
$view->data['prices'] = $prices;
|
||||||
|
|
||||||
$audits = AuditMapper::getAll()
|
$audits = AuditMapper::getAll()
|
||||||
|
|
@ -437,6 +442,7 @@ final class BackendController extends Controller
|
||||||
->where('module', 'ItemManagement')
|
->where('module', 'ItemManagement')
|
||||||
->where('ref', $item->id)
|
->where('ref', $item->id)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$view->data['audits'] = $audits;
|
$view->data['audits'] = $audits;
|
||||||
|
|
||||||
$files = MediaMapper::getAll()
|
$files = MediaMapper::getAll()
|
||||||
|
|
@ -444,6 +450,7 @@ final class BackendController extends Controller
|
||||||
->join('id', ItemMapper::class, 'files') // id = media id, files = item relations
|
->join('id', ItemMapper::class, 'files') // id = media id, files = item relations
|
||||||
->on('id', $item->id, relation: 'files') // id = item id
|
->on('id', $item->id, relation: 'files') // id = item id
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$view->data['files'] = $files;
|
$view->data['files'] = $files;
|
||||||
|
|
||||||
$mediaListView = new \Modules\Media\Theme\Backend\Components\Media\ListView($this->app->l11nManager, $request, $response);
|
$mediaListView = new \Modules\Media\Theme\Backend\Components\Media\ListView($this->app->l11nManager, $request, $response);
|
||||||
|
|
@ -679,6 +686,7 @@ final class BackendController extends Controller
|
||||||
/////
|
/////
|
||||||
$currentCustomersCountry = [];
|
$currentCustomersCountry = [];
|
||||||
for ($i = 1; $i < 51; ++$i) {
|
for ($i = 1; $i < 51; ++$i) {
|
||||||
|
/** @var string $country */
|
||||||
$country = ISO3166NameEnum::getRandom();
|
$country = ISO3166NameEnum::getRandom();
|
||||||
$currentCustomersCountry[\substr($country, 0, 20)] = [
|
$currentCustomersCountry[\substr($country, 0, 20)] = [
|
||||||
'customers' => (int) (\mt_rand(200, 400) / 12),
|
'customers' => (int) (\mt_rand(200, 400) / 12),
|
||||||
|
|
@ -693,6 +701,7 @@ final class BackendController extends Controller
|
||||||
|
|
||||||
$annualCustomersCountry = [];
|
$annualCustomersCountry = [];
|
||||||
for ($i = 1; $i < 51; ++$i) {
|
for ($i = 1; $i < 51; ++$i) {
|
||||||
|
/** @var string $countryCode */
|
||||||
$countryCode = ISO3166CharEnum::getRandom();
|
$countryCode = ISO3166CharEnum::getRandom();
|
||||||
$countryName = ISO3166NameEnum::getByName('_' . $countryCode);
|
$countryName = ISO3166NameEnum::getByName('_' . $countryCode);
|
||||||
$annualCustomersCountry[\substr($countryName, 0, 20)] = [];
|
$annualCustomersCountry[\substr($countryName, 0, 20)] = [];
|
||||||
|
|
|
||||||
|
|
@ -85,14 +85,6 @@ class Item implements \JsonSerializable
|
||||||
*/
|
*/
|
||||||
public FloatInt $purchasePrice;
|
public FloatInt $purchasePrice;
|
||||||
|
|
||||||
/**
|
|
||||||
* Notes.
|
|
||||||
*
|
|
||||||
* @var EditorDoc[]
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private array $notes = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Localizations.
|
* Localizations.
|
||||||
*
|
*
|
||||||
|
|
@ -177,7 +169,7 @@ class Item implements \JsonSerializable
|
||||||
public function addL11n(BaseStringL11n $l11n) : void
|
public function addL11n(BaseStringL11n $l11n) : void
|
||||||
{
|
{
|
||||||
foreach ($this->l11n as $l11n) {
|
foreach ($this->l11n as $l11n) {
|
||||||
if ($l11n->type->title === $l11n->type->title) {
|
if ($l11n->type?->title === $l11n->type?->title) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -197,7 +189,7 @@ class Item implements \JsonSerializable
|
||||||
public function getL11n(string $type = null) : BaseStringL11n
|
public function getL11n(string $type = null) : BaseStringL11n
|
||||||
{
|
{
|
||||||
foreach ($this->l11n as $l11n) {
|
foreach ($this->l11n as $l11n) {
|
||||||
if ($l11n->type->title === $type) {
|
if ($l11n->type?->title === $type) {
|
||||||
return $l11n;
|
return $l11n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ use phpOMS\Localization\BaseStringL11n;
|
||||||
* @link https://jingga.app
|
* @link https://jingga.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
* @template T of ItemL11n
|
* @template T of BaseStringL11n
|
||||||
* @extends DataMapperFactory<T>
|
* @extends DataMapperFactory<T>
|
||||||
*/
|
*/
|
||||||
final class ItemL11nMapper extends DataMapperFactory
|
final class ItemL11nMapper extends DataMapperFactory
|
||||||
|
|
|
||||||
|
|
@ -101,8 +101,18 @@ final class ItemMapper extends DataMapperFactory
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
// @todo: experimental (not 100% working)
|
/**
|
||||||
public static function getItemList(string $langugae) : array
|
* Get the item list
|
||||||
|
*
|
||||||
|
* @param string $language Language
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @todo: experimental (not 100% working)
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public static function getItemList(string $language) : array
|
||||||
{
|
{
|
||||||
// items
|
// items
|
||||||
$query = <<<SQL
|
$query = <<<SQL
|
||||||
|
|
@ -141,7 +151,7 @@ final class ItemMapper extends DataMapperFactory
|
||||||
$item->salesPrice->setInt($res['itemmgmt_item_salesprice']);
|
$item->salesPrice->setInt($res['itemmgmt_item_salesprice']);
|
||||||
|
|
||||||
if ($media !== null) {
|
if ($media !== null) {
|
||||||
$item->addFile($media);
|
$item->files[$media->id] = $media;
|
||||||
}
|
}
|
||||||
|
|
||||||
$items[$item->id] = $item;
|
$items[$item->id] = $item;
|
||||||
|
|
@ -166,7 +176,7 @@ final class ItemMapper extends DataMapperFactory
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
$sth = self::$db->con->prepare($query);
|
$sth = self::$db->con->prepare($query);
|
||||||
$sth->execute(['lang' => $langugae]);
|
$sth->execute(['lang' => $language]);
|
||||||
|
|
||||||
$l11nsResult = $sth->fetchAll();
|
$l11nsResult = $sth->fetchAll();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\ItemManagement\Models;
|
namespace Modules\ItemManagement\Models;
|
||||||
|
|
||||||
use phpOMS\Localization\Money;
|
|
||||||
use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
|
use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
|
||||||
|
use phpOMS\Stdlib\Base\FloatInt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Account class.
|
* Account class.
|
||||||
|
|
@ -39,7 +39,7 @@ class ItemPrice implements \JsonSerializable
|
||||||
|
|
||||||
public string $currency = '';
|
public string $currency = '';
|
||||||
|
|
||||||
public Money $price;
|
public FloatInt $price;
|
||||||
|
|
||||||
public int $status = ItemPriceStatus::ACTIVE;
|
public int $status = ItemPriceStatus::ACTIVE;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ return ['ItemManagement' => [
|
||||||
'AvgPrice' => 'Avg. Price',
|
'AvgPrice' => 'Avg. Price',
|
||||||
'Bills' => 'Bills',
|
'Bills' => 'Bills',
|
||||||
'Bonus' => 'Bonus',
|
'Bonus' => 'Bonus',
|
||||||
'ClientGroup' => 'Client/Group',
|
|
||||||
'Commission' => 'Commission',
|
'Commission' => 'Commission',
|
||||||
'Container' => 'Container',
|
'Container' => 'Container',
|
||||||
'CostCenter' => 'CostCenter',
|
'CostCenter' => 'CostCenter',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user