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