mirror of
https://github.com/Karaka-Management/oms-SupplierManagement.git
synced 2026-01-11 01:18:40 +00:00
auto fixes + some impl.
This commit is contained in:
parent
afdf729a3d
commit
6139d8d336
|
|
@ -186,6 +186,11 @@
|
||||||
"type": "TINYINT(1)",
|
"type": "TINYINT(1)",
|
||||||
"null": false
|
"null": false
|
||||||
},
|
},
|
||||||
|
"suppliermgmt_attr_type_internal": {
|
||||||
|
"name": "suppliermgmt_attr_type_internal",
|
||||||
|
"type": "TINYINT(1)",
|
||||||
|
"null": false
|
||||||
|
},
|
||||||
"suppliermgmt_attr_type_required": {
|
"suppliermgmt_attr_type_required": {
|
||||||
"description": "Every item must have this attribute type if set to true.",
|
"description": "Every item must have this attribute type if set to true.",
|
||||||
"name": "suppliermgmt_attr_type_required",
|
"name": "suppliermgmt_attr_type_required",
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ use phpOMS\Message\Http\HttpRequest;
|
||||||
use phpOMS\Message\Http\HttpResponse;
|
use phpOMS\Message\Http\HttpResponse;
|
||||||
use phpOMS\Module\InstallerAbstract;
|
use phpOMS\Module\InstallerAbstract;
|
||||||
use phpOMS\Module\ModuleInfo;
|
use phpOMS\Module\ModuleInfo;
|
||||||
use phpOMS\Uri\HttpUri;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installer class.
|
* Installer class.
|
||||||
|
|
@ -47,8 +46,6 @@ final class Installer extends InstallerAbstract
|
||||||
{
|
{
|
||||||
parent::install($app, $info, $cfgHandler);
|
parent::install($app, $info, $cfgHandler);
|
||||||
|
|
||||||
\Modules\Admin\Admin\Installer::installExternal($app, ['path' => __DIR__ . '/Install/Admin.install.json']);
|
|
||||||
|
|
||||||
/* Attributes */
|
/* Attributes */
|
||||||
$fileContent = \file_get_contents(__DIR__ . '/Install/attributes.json');
|
$fileContent = \file_get_contents(__DIR__ . '/Install/attributes.json');
|
||||||
if ($fileContent === false) {
|
if ($fileContent === false) {
|
||||||
|
|
@ -63,6 +60,16 @@ final class Installer extends InstallerAbstract
|
||||||
$attrTypes = self::createSupplierAttributeTypes($app, $attributes);
|
$attrTypes = self::createSupplierAttributeTypes($app, $attributes);
|
||||||
$attrValues = self::createSupplierAttributeValues($app, $attrTypes, $attributes);
|
$attrValues = self::createSupplierAttributeValues($app, $attrTypes, $attributes);
|
||||||
|
|
||||||
|
$data = \json_decode(\file_get_contents(__DIR__ . '/Install/Admin.install.json'), true);
|
||||||
|
$content = \json_decode($data[0]['content'], true);
|
||||||
|
|
||||||
|
foreach ($content as $type => $_) {
|
||||||
|
$content[$type] = \reset($attrValues[$type])['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$data[0]['content'] = \json_encode($content);
|
||||||
|
\Modules\Admin\Admin\Installer::createSettings($app, $data[0]);
|
||||||
|
|
||||||
/* Localizations */
|
/* Localizations */
|
||||||
$fileContent = \file_get_contents(__DIR__ . '/Install/localizations.json');
|
$fileContent = \file_get_contents(__DIR__ . '/Install/localizations.json');
|
||||||
if ($fileContent === false) {
|
if ($fileContent === false) {
|
||||||
|
|
@ -97,7 +104,7 @@ final class Installer extends InstallerAbstract
|
||||||
|
|
||||||
foreach ($l11ns as $l11n) {
|
foreach ($l11ns as $l11n) {
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('title', $l11n['name']);
|
$request->setData('title', $l11n['name']);
|
||||||
|
|
@ -139,12 +146,14 @@ final class Installer extends InstallerAbstract
|
||||||
/** @var array $attribute */
|
/** @var array $attribute */
|
||||||
foreach ($attributes as $attribute) {
|
foreach ($attributes as $attribute) {
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('name', $attribute['name'] ?? '');
|
$request->setData('name', $attribute['name'] ?? '');
|
||||||
$request->setData('title', \reset($attribute['l11n']));
|
$request->setData('title', \reset($attribute['l11n']));
|
||||||
$request->setData('language', \array_keys($attribute['l11n'])[0] ?? 'en');
|
$request->setData('language', \array_keys($attribute['l11n'])[0] ?? 'en');
|
||||||
|
$request->setData('repeatable', $attribute['repeatable'] ?? false);
|
||||||
|
$request->setData('internal', $attribute['internal'] ?? false);
|
||||||
$request->setData('is_required', $attribute['is_required'] ?? false);
|
$request->setData('is_required', $attribute['is_required'] ?? false);
|
||||||
$request->setData('custom', $attribute['is_custom_allowed'] ?? false);
|
$request->setData('custom', $attribute['is_custom_allowed'] ?? false);
|
||||||
$request->setData('validation_pattern', $attribute['validation_pattern'] ?? '');
|
$request->setData('validation_pattern', $attribute['validation_pattern'] ?? '');
|
||||||
|
|
@ -169,7 +178,7 @@ final class Installer extends InstallerAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('title', $l11n);
|
$request->setData('title', $l11n);
|
||||||
|
|
@ -208,7 +217,7 @@ final class Installer extends InstallerAbstract
|
||||||
/** @var array $value */
|
/** @var array $value */
|
||||||
foreach ($attribute['values'] as $value) {
|
foreach ($attribute['values'] as $value) {
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('value', $value['value'] ?? '');
|
$request->setData('value', $value['value'] ?? '');
|
||||||
|
|
@ -242,7 +251,7 @@ final class Installer extends InstallerAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('title', $l11n);
|
$request->setData('title', $l11n);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ use phpOMS\Account\PermissionType;
|
||||||
use phpOMS\Router\RouteVerb;
|
use phpOMS\Router\RouteVerb;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'^.*/purchase/supplier/attribute/type/list.*$' => [
|
'^.*/purchase/supplier/attribute/type/list(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\SupplierManagement\Controller\BackendController:viewSupplierManagementAttributeTypeList',
|
'dest' => '\Modules\SupplierManagement\Controller\BackendController:viewSupplierManagementAttributeTypeList',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
|
|
@ -29,7 +29,7 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'^.*/purchase/supplier/attribute/type\?.*$' => [
|
'^.*/purchase/supplier/attribute/type(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\SupplierManagement\Controller\BackendController:viewSupplierManagementAttributeType',
|
'dest' => '\Modules\SupplierManagement\Controller\BackendController:viewSupplierManagementAttributeType',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
|
|
@ -40,7 +40,7 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'^.*/purchase/supplier/list.*$' => [
|
'^.*/purchase/supplier/list(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\SupplierManagement\Controller\BackendController:viewSupplierManagementSupplierList',
|
'dest' => '\Modules\SupplierManagement\Controller\BackendController:viewSupplierManagementSupplierList',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
|
|
@ -51,7 +51,7 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'^.*/purchase/supplier/create.*$' => [
|
'^.*/purchase/supplier/create(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\SupplierManagement\Controller\BackendController:viewSupplierManagementSupplierCreate',
|
'dest' => '\Modules\SupplierManagement\Controller\BackendController:viewSupplierManagementSupplierCreate',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
|
|
@ -62,9 +62,9 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'^.*/purchase/supplier/profile.*$' => [
|
'^.*/purchase/supplier/view(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\SupplierManagement\Controller\BackendController:viewSupplierManagementSupplierProfile',
|
'dest' => '\Modules\SupplierManagement\Controller\BackendController:viewSupplierManagementSupplierView',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => BackendController::NAME,
|
'module' => BackendController::NAME,
|
||||||
|
|
@ -73,7 +73,7 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'^.*/purchase/analysis/supplier.*$' => [
|
'^.*/purchase/analysis/supplier(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\SupplierManagement\Controller\BackendController:viewSupplierManagementSupplierAnalysis',
|
'dest' => '\Modules\SupplierManagement\Controller\BackendController:viewSupplierManagementSupplierAnalysis',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
|
|
|
||||||
|
|
@ -61,12 +61,15 @@ final class ApiAttributeController extends Controller
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$type = SupplierAttributeTypeMapper::get()->with('defaults')->where('id', (int) $request->getData('type'))->execute();
|
$type = SupplierAttributeTypeMapper::get()
|
||||||
|
->with('defaults')
|
||||||
|
->where('id', (int) $request->getData('type'))
|
||||||
|
->execute();
|
||||||
|
|
||||||
if (!$type->repeatable) {
|
if (!$type->repeatable) {
|
||||||
$attr = SupplierAttributeMapper::count()
|
$attr = SupplierAttributeMapper::count()
|
||||||
->with('type')
|
->with('type')
|
||||||
->where('type/id', (int) $request->getData('type'))
|
->where('type/id', $type->id)
|
||||||
->where('ref', (int) $request->getData('ref'))
|
->where('ref', (int) $request->getData('ref'))
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
|
|
@ -164,13 +167,20 @@ final class ApiAttributeController extends Controller
|
||||||
->where('id', $request->getDataInt('type') ?? 0)
|
->where('id', $request->getDataInt('type') ?? 0)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
|
if ($type->isInternal) {
|
||||||
|
$response->header->status = RequestStatusCode::R_403;
|
||||||
|
$this->createInvalidCreateResponse($request, $response, $val);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$attrValue = $this->createAttributeValueFromRequest($request, $type);
|
$attrValue = $this->createAttributeValueFromRequest($request, $type);
|
||||||
$this->createModel($request->header->account, $attrValue, SupplierAttributeValueMapper::class, 'attr_value', $request->getOrigin());
|
$this->createModel($request->header->account, $attrValue, SupplierAttributeValueMapper::class, 'attr_value', $request->getOrigin());
|
||||||
|
|
||||||
if ($attrValue->isDefault) {
|
if ($attrValue->isDefault) {
|
||||||
$this->createModelRelation(
|
$this->createModelRelation(
|
||||||
$request->header->account,
|
$request->header->account,
|
||||||
(int) $request->getData('type'),
|
$type->id,
|
||||||
$attrValue->id,
|
$attrValue->id,
|
||||||
SupplierAttributeTypeMapper::class, 'defaults', '', $request->getOrigin()
|
SupplierAttributeTypeMapper::class, 'defaults', '', $request->getOrigin()
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -18,23 +18,21 @@ use Modules\Admin\Models\Account;
|
||||||
use Modules\Admin\Models\NullAccount;
|
use Modules\Admin\Models\NullAccount;
|
||||||
use Modules\Media\Models\MediaMapper;
|
use Modules\Media\Models\MediaMapper;
|
||||||
use Modules\Media\Models\PathSettings;
|
use Modules\Media\Models\PathSettings;
|
||||||
|
use Modules\SupplierManagement\Models\Attribute\SupplierAttributeTypeMapper;
|
||||||
use Modules\SupplierManagement\Models\SettingsEnum;
|
use Modules\SupplierManagement\Models\SettingsEnum;
|
||||||
use Modules\SupplierManagement\Models\Supplier;
|
use Modules\SupplierManagement\Models\Supplier;
|
||||||
use Modules\SupplierManagement\Models\Attribute\SupplierAttributeTypeMapper;
|
|
||||||
use Modules\SupplierManagement\Models\SupplierL11nMapper;
|
use Modules\SupplierManagement\Models\SupplierL11nMapper;
|
||||||
use Modules\SupplierManagement\Models\SupplierL11nTypeMapper;
|
use Modules\SupplierManagement\Models\SupplierL11nTypeMapper;
|
||||||
use Modules\SupplierManagement\Models\SupplierMapper;
|
use Modules\SupplierManagement\Models\SupplierMapper;
|
||||||
use phpOMS\Api\Geocoding\Nominatim;
|
|
||||||
use phpOMS\Localization\BaseStringL11n;
|
use phpOMS\Localization\BaseStringL11n;
|
||||||
use phpOMS\Localization\BaseStringL11nType;
|
use phpOMS\Localization\BaseStringL11nType;
|
||||||
use phpOMS\Localization\ISO3166TwoEnum;
|
use phpOMS\Localization\ISO639x1Enum;
|
||||||
use phpOMS\Localization\NullBaseStringL11nType;
|
use phpOMS\Localization\NullBaseStringL11nType;
|
||||||
use phpOMS\Message\Http\HttpRequest;
|
use phpOMS\Message\Http\HttpRequest;
|
||||||
|
use phpOMS\Message\Http\HttpResponse;
|
||||||
use phpOMS\Message\Http\RequestStatusCode;
|
use phpOMS\Message\Http\RequestStatusCode;
|
||||||
use phpOMS\Message\RequestAbstract;
|
use phpOMS\Message\RequestAbstract;
|
||||||
use phpOMS\Message\ResponseAbstract;
|
use phpOMS\Message\ResponseAbstract;
|
||||||
use phpOMS\Stdlib\Base\Address;
|
|
||||||
use phpOMS\Uri\HttpUri;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SupplierManagement class.
|
* SupplierManagement class.
|
||||||
|
|
@ -46,8 +44,6 @@ use phpOMS\Uri\HttpUri;
|
||||||
*/
|
*/
|
||||||
final class ApiController extends Controller
|
final class ApiController extends Controller
|
||||||
{
|
{
|
||||||
use \Modules\Attribute\Controller\ApiAttributeTraitController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Api method to create news article
|
* Api method to create news article
|
||||||
*
|
*
|
||||||
|
|
@ -73,6 +69,19 @@ final class ApiController extends Controller
|
||||||
$supplier = $this->createSupplierFromRequest($request);
|
$supplier = $this->createSupplierFromRequest($request);
|
||||||
$this->createModel($request->header->account, $supplier, SupplierMapper::class, 'supplier', $request->getOrigin());
|
$this->createModel($request->header->account, $supplier, SupplierMapper::class, 'supplier', $request->getOrigin());
|
||||||
|
|
||||||
|
// Create stock
|
||||||
|
if ($this->app->moduleManager->isActive('WarehouseManagement')) {
|
||||||
|
$internalResponse = new HttpResponse();
|
||||||
|
$internalRequest = new HttpRequest($request->uri);
|
||||||
|
|
||||||
|
$internalRequest->header->account = $request->header->account;
|
||||||
|
$internalRequest->setData('name', $supplier->number);
|
||||||
|
$internalRequest->setData('supplier', $supplier->id);
|
||||||
|
|
||||||
|
$this->app->moduleManager->get('WarehouseManagement', 'Api')
|
||||||
|
->apiStockCreate($internalRequest, $internalResponse);
|
||||||
|
}
|
||||||
|
|
||||||
$this->createSupplierSegmentation($request, $response, $supplier);
|
$this->createSupplierSegmentation($request, $response, $supplier);
|
||||||
|
|
||||||
$this->createStandardCreateResponse($request, $response, $supplier);
|
$this->createStandardCreateResponse($request, $response, $supplier);
|
||||||
|
|
@ -101,25 +110,10 @@ final class ApiController extends Controller
|
||||||
$supplier = new Supplier();
|
$supplier = new Supplier();
|
||||||
$supplier->number = $request->getDataString('number') ?? '';
|
$supplier->number = $request->getDataString('number') ?? '';
|
||||||
$supplier->account = $account;
|
$supplier->account = $account;
|
||||||
$supplier->unit = $request->getDataInt('unit') ?? 1;
|
$supplier->unit = $request->getDataInt('unit') ?? 1;
|
||||||
|
|
||||||
// Handle main address
|
$request->setData('name', null, true);
|
||||||
$addr = new Address();
|
$supplier->mainAddress = $this->app->moduleManager->get('Admin', 'Api')->createAddressFromRequest($request);
|
||||||
$addr->address = $request->getDataString('address') ?? '';
|
|
||||||
$addr->postal = $request->getDataString('postal') ?? '';
|
|
||||||
$addr->city = $request->getDataString('city') ?? '';
|
|
||||||
$addr->state = $request->getDataString('state') ?? '';
|
|
||||||
$addr->setCountry($request->getDataString('country') ?? ISO3166TwoEnum::_XXX);
|
|
||||||
$supplier->mainAddress = $addr;
|
|
||||||
|
|
||||||
// Try to find lat/lon through external API
|
|
||||||
$geocoding = Nominatim::geocoding($addr->country, $addr->city, $addr->address);
|
|
||||||
if ($geocoding === ['lat' => 0.0, 'lon' => 0.0]) {
|
|
||||||
$geocoding = Nominatim::geocoding($addr->country, $addr->city);
|
|
||||||
}
|
|
||||||
|
|
||||||
$supplier->mainAddress->lat = $geocoding['lat'];
|
|
||||||
$supplier->mainAddress->lon = $geocoding['lon'];
|
|
||||||
|
|
||||||
return $supplier;
|
return $supplier;
|
||||||
}
|
}
|
||||||
|
|
@ -134,13 +128,13 @@ final class ApiController extends Controller
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$types = SupplierAttributeTypeMapper::get()
|
$types = SupplierAttributeTypeMapper::getAll()
|
||||||
->where('name', \array_keys($segmentation), 'IN')
|
->where('name', \array_keys($segmentation), 'IN')
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
$internalResponse = clone $response;
|
$internalResponse = clone $response;
|
||||||
$internalRequest = new HttpRequest(new HttpUri(''));
|
$internalRequest = new HttpRequest();
|
||||||
|
|
||||||
$internalRequest->header->account = $request->header->account;
|
$internalRequest->header->account = $request->header->account;
|
||||||
$internalRequest->setData('ref', $supplier->id);
|
$internalRequest->setData('ref', $supplier->id);
|
||||||
|
|
@ -210,13 +204,11 @@ final class ApiController extends Controller
|
||||||
*/
|
*/
|
||||||
private function createSupplierL11nFromRequest(RequestAbstract $request) : BaseStringL11n
|
private function createSupplierL11nFromRequest(RequestAbstract $request) : BaseStringL11n
|
||||||
{
|
{
|
||||||
$supplierL11n = new BaseStringL11n();
|
$supplierL11n = new BaseStringL11n();
|
||||||
$supplierL11n->ref = $request->getDataInt('supplier') ?? 0;
|
$supplierL11n->ref = $request->getDataInt('supplier') ?? 0;
|
||||||
$supplierL11n->type = new NullBaseStringL11nType($request->getDataInt('type') ?? 0);
|
$supplierL11n->type = new NullBaseStringL11nType($request->getDataInt('type') ?? 0);
|
||||||
$supplierL11n->setLanguage(
|
$supplierL11n->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? $request->header->l11n->language;
|
||||||
$request->getDataString('language') ?? $request->header->l11n->language
|
$supplierL11n->content = $request->getDataString('description') ?? '';
|
||||||
);
|
|
||||||
$supplierL11n->content = $request->getDataString('description') ?? '';
|
|
||||||
|
|
||||||
return $supplierL11n;
|
return $supplierL11n;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@ final class BackendController extends Controller
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
public function viewSupplierManagementSupplierProfile(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
public function viewSupplierManagementSupplierView(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||||
{
|
{
|
||||||
$head = $response->data['Content']->head;
|
$head = $response->data['Content']->head;
|
||||||
$nonce = $this->app->appSettings->getOption('script-nonce');
|
$nonce = $this->app->appSettings->getOption('script-nonce');
|
||||||
|
|
@ -208,7 +208,7 @@ final class BackendController extends Controller
|
||||||
$head->addAsset(AssetType::JSLATE, 'Modules/ClientManagement/Controller.js', ['nonce' => $nonce, 'type' => 'module']);
|
$head->addAsset(AssetType::JSLATE, 'Modules/ClientManagement/Controller.js', ['nonce' => $nonce, 'type' => 'module']);
|
||||||
|
|
||||||
$view = new View($this->app->l11nManager, $request, $response);
|
$view = new View($this->app->l11nManager, $request, $response);
|
||||||
$view->setTemplate('/Modules/SupplierManagement/Theme/Backend/supplier-profile');
|
$view->setTemplate('/Modules/SupplierManagement/Theme/Backend/supplier-view');
|
||||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003202001, $request, $response);
|
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003202001, $request, $response);
|
||||||
|
|
||||||
/** @var \Modules\SupplierManagement\Models\Supplier $supplier */
|
/** @var \Modules\SupplierManagement\Models\Supplier $supplier */
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,8 @@ final class SupplierAttributeTypeMapper extends DataMapperFactory
|
||||||
'suppliermgmt_attr_type_datatype' => ['name' => 'suppliermgmt_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'],
|
'suppliermgmt_attr_type_datatype' => ['name' => 'suppliermgmt_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'],
|
||||||
'suppliermgmt_attr_type_fields' => ['name' => 'suppliermgmt_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
|
'suppliermgmt_attr_type_fields' => ['name' => 'suppliermgmt_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
|
||||||
'suppliermgmt_attr_type_custom' => ['name' => 'suppliermgmt_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
|
'suppliermgmt_attr_type_custom' => ['name' => 'suppliermgmt_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
|
||||||
'suppliermgmt_attr_type_repeatable' => ['name' => 'suppliermgmt_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'],
|
'suppliermgmt_attr_type_repeatable' => ['name' => 'suppliermgmt_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'],
|
||||||
|
'suppliermgmt_attr_type_internal' => ['name' => 'suppliermgmt_attr_type_internal', 'type' => 'bool', 'internal' => 'isInternal'],
|
||||||
'suppliermgmt_attr_type_pattern' => ['name' => 'suppliermgmt_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'],
|
'suppliermgmt_attr_type_pattern' => ['name' => 'suppliermgmt_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'],
|
||||||
'suppliermgmt_attr_type_required' => ['name' => 'suppliermgmt_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],
|
'suppliermgmt_attr_type_required' => ['name' => 'suppliermgmt_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,10 @@ final class SupplierAttributeValueL11nMapper extends DataMapperFactory
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const COLUMNS = [
|
public const COLUMNS = [
|
||||||
'suppliermgmt_attr_value_l11n_id' => ['name' => 'suppliermgmt_attr_value_l11n_id', 'type' => 'int', 'internal' => 'id'],
|
'suppliermgmt_attr_value_l11n_id' => ['name' => 'suppliermgmt_attr_value_l11n_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'suppliermgmt_attr_value_l11n_title' => ['name' => 'suppliermgmt_attr_value_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
|
'suppliermgmt_attr_value_l11n_title' => ['name' => 'suppliermgmt_attr_value_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
|
||||||
'suppliermgmt_attr_value_l11n_value' => ['name' => 'suppliermgmt_attr_value_l11n_value', 'type' => 'int', 'internal' => 'ref'],
|
'suppliermgmt_attr_value_l11n_value' => ['name' => 'suppliermgmt_attr_value_l11n_value', 'type' => 'int', 'internal' => 'ref'],
|
||||||
'suppliermgmt_attr_value_l11n_lang' => ['name' => 'suppliermgmt_attr_value_l11n_lang', 'type' => 'string', 'internal' => 'language'],
|
'suppliermgmt_attr_value_l11n_lang' => ['name' => 'suppliermgmt_attr_value_l11n_lang', 'type' => 'string', 'internal' => 'language'],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -37,15 +37,15 @@ final class SupplierAttributeValueMapper extends DataMapperFactory
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const COLUMNS = [
|
public const COLUMNS = [
|
||||||
'suppliermgmt_attr_value_id' => ['name' => 'suppliermgmt_attr_value_id', 'type' => 'int', 'internal' => 'id'],
|
'suppliermgmt_attr_value_id' => ['name' => 'suppliermgmt_attr_value_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'suppliermgmt_attr_value_default' => ['name' => 'suppliermgmt_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'],
|
'suppliermgmt_attr_value_default' => ['name' => 'suppliermgmt_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'],
|
||||||
'suppliermgmt_attr_value_valueStr' => ['name' => 'suppliermgmt_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'],
|
'suppliermgmt_attr_value_valueStr' => ['name' => 'suppliermgmt_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'],
|
||||||
'suppliermgmt_attr_value_valueInt' => ['name' => 'suppliermgmt_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'],
|
'suppliermgmt_attr_value_valueInt' => ['name' => 'suppliermgmt_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'],
|
||||||
'suppliermgmt_attr_value_valueDec' => ['name' => 'suppliermgmt_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'],
|
'suppliermgmt_attr_value_valueDec' => ['name' => 'suppliermgmt_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'],
|
||||||
'suppliermgmt_attr_value_valueDat' => ['name' => 'suppliermgmt_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'],
|
'suppliermgmt_attr_value_valueDat' => ['name' => 'suppliermgmt_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'],
|
||||||
'suppliermgmt_attr_value_unit' => ['name' => 'suppliermgmt_attr_value_unit', 'type' => 'string', 'internal' => 'unit'],
|
'suppliermgmt_attr_value_unit' => ['name' => 'suppliermgmt_attr_value_unit', 'type' => 'string', 'internal' => 'unit'],
|
||||||
'suppliermgmt_attr_value_deptype' => ['name' => 'suppliermgmt_attr_value_deptype', 'type' => 'int', 'internal' => 'dependingAttributeType'],
|
'suppliermgmt_attr_value_deptype' => ['name' => 'suppliermgmt_attr_value_deptype', 'type' => 'int', 'internal' => 'dependingAttributeType'],
|
||||||
'suppliermgmt_attr_value_depvalue' => ['name' => 'suppliermgmt_attr_value_depvalue', 'type' => 'int', 'internal' => 'dependingAttributeValue'],
|
'suppliermgmt_attr_value_depvalue' => ['name' => 'suppliermgmt_attr_value_depvalue', 'type' => 'int', 'internal' => 'dependingAttributeValue'],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -90,44 +90,6 @@ class Supplier
|
||||||
$this->mainAddress = new NullAddress();
|
$this->mainAddress = new NullAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get id.
|
|
||||||
*
|
|
||||||
* @return int Model id
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function getId() : int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get status.
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function getStatus() : int
|
|
||||||
{
|
|
||||||
return $this->status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set status.
|
|
||||||
*
|
|
||||||
* @param int $status Status
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function setStatus(int $status) : void
|
|
||||||
{
|
|
||||||
$this->status = $status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get payments
|
* Get payments
|
||||||
*
|
*
|
||||||
|
|
@ -154,7 +116,7 @@ class Supplier
|
||||||
$payments = [];
|
$payments = [];
|
||||||
|
|
||||||
foreach ($this->payments as $payment) {
|
foreach ($this->payments as $payment) {
|
||||||
if ($payment->getType() === $type) {
|
if ($payment->type === $type) {
|
||||||
$payments[] = $payment;
|
$payments[] = $payment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -162,32 +124,6 @@ class Supplier
|
||||||
return $payments;
|
return $payments;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get supplier type.
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function getType() : int
|
|
||||||
{
|
|
||||||
return $this->type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set supplier type.
|
|
||||||
*
|
|
||||||
* @param int $type Type
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function setType(int $type) : void
|
|
||||||
{
|
|
||||||
$this->type = $type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add doc to item
|
* Add doc to item
|
||||||
*
|
*
|
||||||
|
|
@ -293,7 +229,7 @@ class Supplier
|
||||||
\uasort($this->contactElements, [$this, 'orderContactElements']);
|
\uasort($this->contactElements, [$this, 'orderContactElements']);
|
||||||
|
|
||||||
foreach ($this->contactElements as $element) {
|
foreach ($this->contactElements as $element) {
|
||||||
if ($element->getType() === $type) {
|
if ($element->type === $type) {
|
||||||
return $element;
|
return $element;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,11 +37,11 @@ final class SupplierL11nMapper extends DataMapperFactory
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const COLUMNS = [
|
public const COLUMNS = [
|
||||||
'suppliermgmt_supplier_l11n_id' => ['name' => 'suppliermgmt_supplier_l11n_id', 'type' => 'int', 'internal' => 'id'],
|
'suppliermgmt_supplier_l11n_id' => ['name' => 'suppliermgmt_supplier_l11n_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'suppliermgmt_supplier_l11n_description' => ['name' => 'suppliermgmt_supplier_l11n_description', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
|
'suppliermgmt_supplier_l11n_description' => ['name' => 'suppliermgmt_supplier_l11n_description', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
|
||||||
'suppliermgmt_supplier_l11n_supplier' => ['name' => 'suppliermgmt_supplier_l11n_supplier', 'type' => 'int', 'internal' => 'ref'],
|
'suppliermgmt_supplier_l11n_supplier' => ['name' => 'suppliermgmt_supplier_l11n_supplier', 'type' => 'int', 'internal' => 'ref'],
|
||||||
'suppliermgmt_supplier_l11n_lang' => ['name' => 'suppliermgmt_supplier_l11n_lang', 'type' => 'string', 'internal' => 'language'],
|
'suppliermgmt_supplier_l11n_lang' => ['name' => 'suppliermgmt_supplier_l11n_lang', 'type' => 'string', 'internal' => 'language'],
|
||||||
'suppliermgmt_supplier_l11n_typeref' => ['name' => 'suppliermgmt_supplier_l11n_typeref', 'type' => 'int', 'internal' => 'type'],
|
'suppliermgmt_supplier_l11n_typeref' => ['name' => 'suppliermgmt_supplier_l11n_typeref', 'type' => 'int', 'internal' => 'type'],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ use Modules\Admin\Models\AccountMapper;
|
||||||
use Modules\Admin\Models\AddressMapper;
|
use Modules\Admin\Models\AddressMapper;
|
||||||
use Modules\Editor\Models\EditorDocMapper;
|
use Modules\Editor\Models\EditorDocMapper;
|
||||||
use Modules\Media\Models\MediaMapper;
|
use Modules\Media\Models\MediaMapper;
|
||||||
use Modules\Profile\Models\ContactElementMapper;
|
|
||||||
use Modules\SupplierManagement\Models\Attribute\SupplierAttributeMapper;
|
use Modules\SupplierManagement\Models\Attribute\SupplierAttributeMapper;
|
||||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||||
|
|
||||||
|
|
@ -102,29 +101,23 @@ final class SupplierMapper extends DataMapperFactory
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const HAS_MANY = [
|
public const HAS_MANY = [
|
||||||
'files' => [
|
'files' => [
|
||||||
'mapper' => MediaMapper::class, /* mapper of the related object */
|
'mapper' => MediaMapper::class, /* mapper of the related object */
|
||||||
'table' => 'suppliermgmt_supplier_media', /* table of the related object, null if no relation table is used (many->1) */
|
'table' => 'suppliermgmt_supplier_media', /* table of the related object, null if no relation table is used (many->1) */
|
||||||
'external' => 'suppliermgmt_supplier_media_dst',
|
'external' => 'suppliermgmt_supplier_media_dst',
|
||||||
'self' => 'suppliermgmt_supplier_media_src',
|
'self' => 'suppliermgmt_supplier_media_src',
|
||||||
],
|
],
|
||||||
'notes' => [
|
'notes' => [
|
||||||
'mapper' => EditorDocMapper::class, /* mapper of the related object */
|
'mapper' => EditorDocMapper::class, /* mapper of the related object */
|
||||||
'table' => 'suppliermgmt_supplier_note', /* table of the related object, null if no relation table is used (many->1) */
|
'table' => 'suppliermgmt_supplier_note', /* table of the related object, null if no relation table is used (many->1) */
|
||||||
'external' => 'suppliermgmt_supplier_note_dst',
|
'external' => 'suppliermgmt_supplier_note_dst',
|
||||||
'self' => 'suppliermgmt_supplier_note_src',
|
'self' => 'suppliermgmt_supplier_note_src',
|
||||||
],
|
],
|
||||||
'contactElements' => [
|
|
||||||
'mapper' => ContactElementMapper::class,
|
|
||||||
'table' => 'suppliermgmt_supplier_contactelement',
|
|
||||||
'external' => 'suppliermgmt_supplier_contactelement_dst',
|
|
||||||
'self' => 'suppliermgmt_supplier_contactelement_src',
|
|
||||||
],
|
|
||||||
'attributes' => [
|
'attributes' => [
|
||||||
'mapper' => SupplierAttributeMapper::class,
|
'mapper' => SupplierAttributeMapper::class,
|
||||||
'table' => 'suppliermgmt_supplier_attr',
|
'table' => 'suppliermgmt_supplier_attr',
|
||||||
'self' => 'suppliermgmt_supplier_attr_supplier',
|
'self' => 'suppliermgmt_supplier_attr_supplier',
|
||||||
'external' => null,
|
'external' => null,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ echo $this->data['nav']->render(); ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="#"><i class="g-icon">close</i></a>
|
<td><a href="#"><i class="g-icon">close</i></a>
|
||||||
<td><a href="#"><i class="g-icon">settings</i></a>
|
<td><a href="#"><i class="g-icon">settings</i></a>
|
||||||
<td><?= ISO639Enum::getByName('_' . \strtoupper($value->getLanguage())); ?>
|
<td><?= ISO639Enum::getByName('_' . \strtoupper($value->language)); ?>
|
||||||
<td><?= $value->content; ?>
|
<td><?= $value->content; ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php if ($c === 0) : ?>
|
<?php if ($c === 0) : ?>
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ echo $this->data['nav']->render(); ?>
|
||||||
</label>
|
</label>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php $count = 0; foreach ($suppliers as $key => $value) : ++$count;
|
<?php $count = 0; foreach ($suppliers as $key => $value) : ++$count;
|
||||||
$url = UriFactory::build('{/base}/purchase/supplier/profile?{?}&id=' . $value->id);
|
$url = UriFactory::build('{/base}/purchase/supplier/view?{?}&id=' . $value->id);
|
||||||
?>
|
?>
|
||||||
<tr data-href="<?= $url; ?>">
|
<tr data-href="<?= $url; ?>">
|
||||||
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->number); ?></a>
|
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->number); ?></a>
|
||||||
|
|
@ -109,7 +109,7 @@ echo $this->data['nav']->render(); ?>
|
||||||
<td data-label="<?= $this->getHtml('City'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->mainAddress->city); ?></a>
|
<td data-label="<?= $this->getHtml('City'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->mainAddress->city); ?></a>
|
||||||
<td data-label="<?= $this->getHtml('Zip'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->mainAddress->postal); ?></a>
|
<td data-label="<?= $this->getHtml('Zip'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->mainAddress->postal); ?></a>
|
||||||
<td data-label="<?= $this->getHtml('Address'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->mainAddress->address); ?></a>
|
<td data-label="<?= $this->getHtml('Address'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->mainAddress->address); ?></a>
|
||||||
<td data-label="<?= $this->getHtml('Country'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->mainAddress->getCountry()); ?></a>
|
<td data-label="<?= $this->getHtml('Country'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->mainAddress->country); ?></a>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php if ($count === 0) : ?>
|
<?php if ($count === 0) : ?>
|
||||||
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||||
|
|
|
||||||
|
|
@ -128,31 +128,31 @@ $items = $this->data['items'] ?? [];
|
||||||
</label>
|
</label>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach ($items as $key => $value) :
|
foreach ($items as $key => $value) :
|
||||||
if ($value->itemNumber === '') {
|
if ($value->itemNumber === '') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
++$count;
|
++$count;
|
||||||
$url = UriFactory::build('{/base}/purchase/item/profile?{?}&id=' . $value->id);
|
$url = UriFactory::build('{/base}/purchase/item/view?{?}&id=' . $value->id);
|
||||||
?>
|
?>
|
||||||
<tr data-href="<?= $url; ?>">
|
<tr data-href="<?= $url; ?>">
|
||||||
<td><label class="checkbox" for="iPurchaseItemSelect-<?= $key; ?>">
|
<td><label class="checkbox" for="iPurchaseItemSelect-<?= $key; ?>">
|
||||||
<input type="checkbox" id="iPurchaseItemSelect-<?= $key; ?>" name="itemselect">
|
<input type="checkbox" id="iPurchaseItemSelect-<?= $key; ?>" name="itemselect">
|
||||||
<span class="checkmark"></span>
|
<span class="checkmark"></span>
|
||||||
</label>
|
</label>
|
||||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->itemNumber); ?></a>
|
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->itemNumber); ?></a>
|
||||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->itemName); ?></a>
|
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->itemName); ?></a>
|
||||||
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->getQuantity()); ?></a>
|
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->quantity->getAmount()); ?></a>
|
||||||
<td><a href="<?= $url; ?>"><?= $this->getcurrency($value->singlePurchasePriceNet); ?></a>
|
<td><a href="<?= $url; ?>"><?= $this->getCurrency($value->singlePurchasePriceNet); ?></a>
|
||||||
<td>
|
<td>
|
||||||
<td>
|
<td>
|
||||||
<td>
|
<td>
|
||||||
<td><a href="<?= $url; ?>"><?= $this->getcurrency($value->totalPurchasePriceNet); ?></a>
|
<td><a href="<?= $url; ?>"><?= $this->getCurrency($value->totalPurchasePriceNet); ?></a>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php if ($count === 0) : ?>
|
<?php if ($count === 0) : ?>
|
||||||
<tr><td colspan="9" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
<tr><td colspan="9" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</table>
|
</table>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
6
Theme/Backend/supplier-profile.tpl.php → Theme/Backend/supplier-view.tpl.php
Executable file → Normal file
6
Theme/Backend/supplier-profile.tpl.php → Theme/Backend/supplier-view.tpl.php
Executable file → Normal file
|
|
@ -146,7 +146,7 @@ echo $this->data['nav']->render();
|
||||||
<tr><td><label for="iCountry"><?= $this->getHtml('Country'); ?></label>
|
<tr><td><label for="iCountry"><?= $this->getHtml('Country'); ?></label>
|
||||||
<tr><td><select id="iCountry" name="country">
|
<tr><td><select id="iCountry" name="country">
|
||||||
<?php foreach ($countryCodes as $code3 => $code2) : ?>
|
<?php foreach ($countryCodes as $code3 => $code2) : ?>
|
||||||
<option value="<?= $this->printHtml($code2); ?>"<?= $this->printHtml($code2 === $supplier->mainAddress->getCountry() ? ' selected' : ''); ?>><?= $this->printHtml($countries[$code3]); ?>
|
<option value="<?= $this->printHtml($code2); ?>"<?= $this->printHtml($code2 === $supplier->mainAddress->country ? ' selected' : ''); ?>><?= $this->printHtml($countries[$code3]); ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
<tr><td><label for="iSupplierMap"><?= $this->getHtml('Map'); ?></label>
|
<tr><td><label for="iSupplierMap"><?= $this->getHtml('Map'); ?></label>
|
||||||
|
|
@ -236,7 +236,7 @@ echo $this->data['nav']->render();
|
||||||
<td><?= $this->getHtml('CreatedAt'); ?>
|
<td><?= $this->getHtml('CreatedAt'); ?>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($notes as $note) :
|
<?php foreach ($notes as $note) :
|
||||||
$url = UriFactory::build('{/base}/editor/single?{?}&id=' . $note->id);
|
$url = UriFactory::build('{/base}/editor/view?{?}&id=' . $note->id);
|
||||||
?>
|
?>
|
||||||
<tr data-href="<?= $url; ?>">
|
<tr data-href="<?= $url; ?>">
|
||||||
<td><a href="<?= $url; ?>"><?= $note->title; ?></a>
|
<td><a href="<?= $url; ?>"><?= $note->title; ?></a>
|
||||||
|
|
@ -259,7 +259,7 @@ echo $this->data['nav']->render();
|
||||||
<td><?= $this->getHtml('CreatedAt'); ?>
|
<td><?= $this->getHtml('CreatedAt'); ?>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($files as $file) :
|
<?php foreach ($files as $file) :
|
||||||
$url = UriFactory::build('{/base}/media/single?{?}&id=' . $file->id);
|
$url = UriFactory::build('{/base}/media/view?{?}&id=' . $file->id);
|
||||||
?>
|
?>
|
||||||
<tr data-href="<?= $url; ?>">
|
<tr data-href="<?= $url; ?>">
|
||||||
<td><a href="<?= $url; ?>"><?= $file->name; ?></a>
|
<td><a href="<?= $url; ?>"><?= $file->name; ?></a>
|
||||||
|
|
@ -75,8 +75,8 @@ final class Autoloader
|
||||||
*/
|
*/
|
||||||
public static function defaultAutoloader(string $class) : void
|
public static function defaultAutoloader(string $class) : void
|
||||||
{
|
{
|
||||||
$class = \ltrim($class, '\\');
|
$class = \ltrim($class, '\\');
|
||||||
$class = \strtr($class, '_\\', '//');
|
$class = \strtr($class, '_\\', '//');
|
||||||
|
|
||||||
if (\stripos($class, 'Web/Backend') !== false || \stripos($class, 'Web/Api') !== false) {
|
if (\stripos($class, 'Web/Backend') !== false || \stripos($class, 'Web/Api') !== false) {
|
||||||
$class = \is_dir(__DIR__ . '/Web') ? $class : \str_replace('Web/', 'MainRepository/Web/', $class);
|
$class = \is_dir(__DIR__ . '/Web') ? $class : \str_replace('Web/', 'MainRepository/Web/', $class);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Jingga
|
||||||
|
*
|
||||||
|
* PHP Version 8.1
|
||||||
|
*
|
||||||
|
* @package Modules\SupplierManagement\tests
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 2.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://jingga.app
|
||||||
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
\ini_set('memory_limit', '2048M');
|
\ini_set('memory_limit', '2048M');
|
||||||
|
|
@ -67,10 +78,10 @@ $GLOBALS['is_github'] = $IS_GITHUB;
|
||||||
$tmp = FileLogger::getInstance(__DIR__ . '/../Logs');
|
$tmp = FileLogger::getInstance(__DIR__ . '/../Logs');
|
||||||
|
|
||||||
$CONFIG = [
|
$CONFIG = [
|
||||||
'db' => [
|
'db' => [
|
||||||
'core' => [
|
'core' => [
|
||||||
'masters' => [
|
'masters' => [
|
||||||
'admin' => [
|
'admin' => [
|
||||||
'db' => 'mysql', /* db type */
|
'db' => 'mysql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '3306', /* db host port */
|
'port' => '3306', /* db host port */
|
||||||
|
|
@ -80,7 +91,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'insert' => [
|
'insert' => [
|
||||||
'db' => 'mysql', /* db type */
|
'db' => 'mysql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '3306', /* db host port */
|
'port' => '3306', /* db host port */
|
||||||
|
|
@ -90,7 +101,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'select' => [
|
'select' => [
|
||||||
'db' => 'mysql', /* db type */
|
'db' => 'mysql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '3306', /* db host port */
|
'port' => '3306', /* db host port */
|
||||||
|
|
@ -100,7 +111,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'update' => [
|
'update' => [
|
||||||
'db' => 'mysql', /* db type */
|
'db' => 'mysql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '3306', /* db host port */
|
'port' => '3306', /* db host port */
|
||||||
|
|
@ -110,7 +121,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'delete' => [
|
'delete' => [
|
||||||
'db' => 'mysql', /* db type */
|
'db' => 'mysql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '3306', /* db host port */
|
'port' => '3306', /* db host port */
|
||||||
|
|
@ -120,7 +131,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'schema' => [
|
'schema' => [
|
||||||
'db' => 'mysql', /* db type */
|
'db' => 'mysql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '3306', /* db host port */
|
'port' => '3306', /* db host port */
|
||||||
|
|
@ -132,7 +143,7 @@ $CONFIG = [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'postgresql' => [
|
'postgresql' => [
|
||||||
'admin' => [
|
'admin' => [
|
||||||
'db' => 'pgsql', /* db type */
|
'db' => 'pgsql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '5432', /* db host port */
|
'port' => '5432', /* db host port */
|
||||||
|
|
@ -142,7 +153,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'insert' => [
|
'insert' => [
|
||||||
'db' => 'pgsql', /* db type */
|
'db' => 'pgsql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '5432', /* db host port */
|
'port' => '5432', /* db host port */
|
||||||
|
|
@ -152,7 +163,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'select' => [
|
'select' => [
|
||||||
'db' => 'pgsql', /* db type */
|
'db' => 'pgsql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '5432', /* db host port */
|
'port' => '5432', /* db host port */
|
||||||
|
|
@ -162,7 +173,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'update' => [
|
'update' => [
|
||||||
'db' => 'pgsql', /* db type */
|
'db' => 'pgsql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '5432', /* db host port */
|
'port' => '5432', /* db host port */
|
||||||
|
|
@ -172,7 +183,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'delete' => [
|
'delete' => [
|
||||||
'db' => 'pgsql', /* db type */
|
'db' => 'pgsql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '5432', /* db host port */
|
'port' => '5432', /* db host port */
|
||||||
|
|
@ -182,7 +193,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'schema' => [
|
'schema' => [
|
||||||
'db' => 'pgsql', /* db type */
|
'db' => 'pgsql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '5432', /* db host port */
|
'port' => '5432', /* db host port */
|
||||||
|
|
@ -194,37 +205,37 @@ $CONFIG = [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'sqlite' => [
|
'sqlite' => [
|
||||||
'admin' => [
|
'admin' => [
|
||||||
'db' => 'sqlite', /* db type */
|
'db' => 'sqlite', /* db type */
|
||||||
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'insert' => [
|
'insert' => [
|
||||||
'db' => 'sqlite', /* db type */
|
'db' => 'sqlite', /* db type */
|
||||||
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'select' => [
|
'select' => [
|
||||||
'db' => 'sqlite', /* db type */
|
'db' => 'sqlite', /* db type */
|
||||||
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'update' => [
|
'update' => [
|
||||||
'db' => 'sqlite', /* db type */
|
'db' => 'sqlite', /* db type */
|
||||||
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'delete' => [
|
'delete' => [
|
||||||
'db' => 'sqlite', /* db type */
|
'db' => 'sqlite', /* db type */
|
||||||
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'schema' => [
|
'schema' => [
|
||||||
'db' => 'sqlite', /* db type */
|
'db' => 'sqlite', /* db type */
|
||||||
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
|
|
@ -232,7 +243,7 @@ $CONFIG = [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'mssql' => [
|
'mssql' => [
|
||||||
'admin' => [
|
'admin' => [
|
||||||
'db' => 'mssql', /* db type */
|
'db' => 'mssql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '1433', /* db host port */
|
'port' => '1433', /* db host port */
|
||||||
|
|
@ -242,7 +253,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'insert' => [
|
'insert' => [
|
||||||
'db' => 'mssql', /* db type */
|
'db' => 'mssql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '1433', /* db host port */
|
'port' => '1433', /* db host port */
|
||||||
|
|
@ -252,7 +263,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'select' => [
|
'select' => [
|
||||||
'db' => 'mssql', /* db type */
|
'db' => 'mssql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '1433', /* db host port */
|
'port' => '1433', /* db host port */
|
||||||
|
|
@ -262,7 +273,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'update' => [
|
'update' => [
|
||||||
'db' => 'mssql', /* db type */
|
'db' => 'mssql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '1433', /* db host port */
|
'port' => '1433', /* db host port */
|
||||||
|
|
@ -272,7 +283,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'delete' => [
|
'delete' => [
|
||||||
'db' => 'mssql', /* db type */
|
'db' => 'mssql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '1433', /* db host port */
|
'port' => '1433', /* db host port */
|
||||||
|
|
@ -282,7 +293,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'schema' => [
|
'schema' => [
|
||||||
'db' => 'mssql', /* db type */
|
'db' => 'mssql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '1433', /* db host port */
|
'port' => '1433', /* db host port */
|
||||||
|
|
@ -322,16 +333,16 @@ $CONFIG = [
|
||||||
'password' => '123456',
|
'password' => '123456',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'log' => [
|
'log' => [
|
||||||
'file' => [
|
'file' => [
|
||||||
'path' => __DIR__ . '/Logs',
|
'path' => __DIR__ . '/Logs',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'page' => [
|
'page' => [
|
||||||
'root' => '/',
|
'root' => '/',
|
||||||
'https' => false,
|
'https' => false,
|
||||||
],
|
],
|
||||||
'app' => [
|
'app' => [
|
||||||
'path' => __DIR__,
|
'path' => __DIR__,
|
||||||
'default' => [
|
'default' => [
|
||||||
'app' => 'Backend',
|
'app' => 'Backend',
|
||||||
|
|
@ -350,7 +361,7 @@ $CONFIG = [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'socket' => [
|
'socket' => [
|
||||||
'master' => [
|
'master' => [
|
||||||
'host' => '127.0.0.1',
|
'host' => '127.0.0.1',
|
||||||
'limit' => 300,
|
'limit' => 300,
|
||||||
|
|
@ -360,7 +371,7 @@ $CONFIG = [
|
||||||
'language' => [
|
'language' => [
|
||||||
'en',
|
'en',
|
||||||
],
|
],
|
||||||
'apis' => [
|
'apis' => [
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ use phpOMS\Localization\ISO639x1Enum;
|
||||||
use phpOMS\Message\Http\HttpRequest;
|
use phpOMS\Message\Http\HttpRequest;
|
||||||
use phpOMS\Message\Http\HttpResponse;
|
use phpOMS\Message\Http\HttpResponse;
|
||||||
use phpOMS\Message\Http\RequestStatusCode;
|
use phpOMS\Message\Http\RequestStatusCode;
|
||||||
use phpOMS\Uri\HttpUri;
|
|
||||||
|
|
||||||
trait ApiControllerAttributeTrait
|
trait ApiControllerAttributeTrait
|
||||||
{
|
{
|
||||||
|
|
@ -30,7 +29,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiSupplierAttributeTypeCreate() : void
|
public function testApiSupplierAttributeTypeCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('title', 'EN:1');
|
$request->setData('title', 'EN:1');
|
||||||
|
|
@ -48,7 +47,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiSupplierAttributeTypeL11nCreate() : void
|
public function testApiSupplierAttributeTypeL11nCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('title', 'DE:2');
|
$request->setData('title', 'DE:2');
|
||||||
|
|
@ -66,7 +65,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiSupplierAttributeValueIntCreate() : void
|
public function testApiSupplierAttributeValueIntCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('default', '1');
|
$request->setData('default', '1');
|
||||||
|
|
@ -86,7 +85,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiSupplierAttributeValueStrCreate() : void
|
public function testApiSupplierAttributeValueStrCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('value', '1');
|
$request->setData('value', '1');
|
||||||
|
|
@ -105,7 +104,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiSupplierAttributeValueFloatCreate() : void
|
public function testApiSupplierAttributeValueFloatCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('value', '1.1');
|
$request->setData('value', '1.1');
|
||||||
|
|
@ -124,7 +123,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiSupplierAttributeValueDatCreate() : void
|
public function testApiSupplierAttributeValueDatCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('value', '2020-08-02');
|
$request->setData('value', '2020-08-02');
|
||||||
|
|
@ -143,7 +142,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiSupplierAttributeCreate() : void
|
public function testApiSupplierAttributeCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('ref', '1');
|
$request->setData('ref', '1');
|
||||||
|
|
@ -161,7 +160,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiSupplierAttributeValueCreateInvalidData() : void
|
public function testApiSupplierAttributeValueCreateInvalidData() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('invalid', '1');
|
$request->setData('invalid', '1');
|
||||||
|
|
@ -177,7 +176,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiSupplierAttributeTypeCreateInvalidData() : void
|
public function testApiSupplierAttributeTypeCreateInvalidData() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('invalid', '1');
|
$request->setData('invalid', '1');
|
||||||
|
|
@ -193,7 +192,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiSupplierAttributeTypeL11nCreateInvalidData() : void
|
public function testApiSupplierAttributeTypeL11nCreateInvalidData() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('invalid', '1');
|
$request->setData('invalid', '1');
|
||||||
|
|
@ -209,7 +208,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiSupplierAttributeCreateInvalidData() : void
|
public function testApiSupplierAttributeCreateInvalidData() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('invalid', '1');
|
$request->setData('invalid', '1');
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ use phpOMS\Message\Http\HttpRequest;
|
||||||
use phpOMS\Message\Http\HttpResponse;
|
use phpOMS\Message\Http\HttpResponse;
|
||||||
use phpOMS\Message\Http\RequestStatusCode;
|
use phpOMS\Message\Http\RequestStatusCode;
|
||||||
use phpOMS\System\MimeType;
|
use phpOMS\System\MimeType;
|
||||||
use phpOMS\Uri\HttpUri;
|
|
||||||
use phpOMS\Utils\TestUtils;
|
use phpOMS\Utils\TestUtils;
|
||||||
|
|
||||||
trait ApiControllerSupplierTrait
|
trait ApiControllerSupplierTrait
|
||||||
|
|
@ -42,7 +41,7 @@ trait ApiControllerSupplierTrait
|
||||||
public function testApiSupplierCreate() : void
|
public function testApiSupplierCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('number', '123456');
|
$request->setData('number', '123456');
|
||||||
|
|
@ -65,7 +64,7 @@ trait ApiControllerSupplierTrait
|
||||||
public function testApiSupplierCreateInvalidData() : void
|
public function testApiSupplierCreateInvalidData() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('invalid', '1');
|
$request->setData('invalid', '1');
|
||||||
|
|
@ -81,7 +80,7 @@ trait ApiControllerSupplierTrait
|
||||||
public function testApiSupplierProfileImageCreate() : void
|
public function testApiSupplierProfileImageCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
\copy(__DIR__ . '/m_icon.png', __DIR__ . '/m_icon_tmp.png');
|
\copy(__DIR__ . '/m_icon.png', __DIR__ . '/m_icon_tmp.png');
|
||||||
|
|
||||||
|
|
@ -112,7 +111,7 @@ trait ApiControllerSupplierTrait
|
||||||
public function testApiSupplierFileCreate() : void
|
public function testApiSupplierFileCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
\copy(__DIR__ . '/Test file.txt', __DIR__ . '/Test file_tmp.txt');
|
\copy(__DIR__ . '/Test file.txt', __DIR__ . '/Test file_tmp.txt');
|
||||||
|
|
||||||
|
|
@ -142,7 +141,7 @@ trait ApiControllerSupplierTrait
|
||||||
public function testApiSupplierNoteCreate() : void
|
public function testApiSupplierNoteCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
|
|
||||||
|
|
@ -163,7 +162,7 @@ trait ApiControllerSupplierTrait
|
||||||
public function testApiFileCreateInvalidData() : void
|
public function testApiFileCreateInvalidData() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('invalid', '1');
|
$request->setData('invalid', '1');
|
||||||
|
|
|
||||||
|
|
@ -55,13 +55,13 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||||
protected string $appName = 'Api';
|
protected string $appName = 'Api';
|
||||||
};
|
};
|
||||||
|
|
||||||
$this->app->dbPool = $GLOBALS['dbpool'];
|
$this->app->dbPool = $GLOBALS['dbpool'];
|
||||||
$this->app->unitId = 1;
|
$this->app->unitId = 1;
|
||||||
$this->app->accountManager = new AccountManager($GLOBALS['session']);
|
$this->app->accountManager = new AccountManager($GLOBALS['session']);
|
||||||
$this->app->appSettings = new CoreSettings();
|
$this->app->appSettings = new CoreSettings();
|
||||||
$this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../../../Modules/');
|
$this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../../../Modules/');
|
||||||
$this->app->dispatcher = new Dispatcher($this->app);
|
$this->app->dispatcher = new Dispatcher($this->app);
|
||||||
$this->app->eventManager = new EventManager($this->app->dispatcher);
|
$this->app->eventManager = new EventManager($this->app->dispatcher);
|
||||||
$this->app->eventManager->importFromFile(__DIR__ . '/../../../../Web/Api/Hooks.php');
|
$this->app->eventManager->importFromFile(__DIR__ . '/../../../../Web/Api/Hooks.php');
|
||||||
$this->app->sessionManager = new HttpSession(36000);
|
$this->app->sessionManager = new HttpSession(36000);
|
||||||
$this->app->l11nManager = new L11nManager();
|
$this->app->l11nManager = new L11nManager();
|
||||||
|
|
|
||||||
|
|
@ -44,36 +44,15 @@ final class SupplierTest extends \PHPUnit\Framework\TestCase
|
||||||
self::assertEquals('', $this->supplier->number);
|
self::assertEquals('', $this->supplier->number);
|
||||||
self::assertEquals('', $this->supplier->numberReverse);
|
self::assertEquals('', $this->supplier->numberReverse);
|
||||||
self::assertEquals('', $this->supplier->info);
|
self::assertEquals('', $this->supplier->info);
|
||||||
self::assertEquals(SupplierStatus::ACTIVE, $this->supplier->getStatus());
|
self::assertEquals(SupplierStatus::ACTIVE, $this->supplier->status);
|
||||||
self::assertEquals(0, $this->supplier->getType());
|
self::assertEquals(0, $this->supplier->type);
|
||||||
self::assertEquals([], $this->supplier->getNotes());
|
self::assertEquals([], $this->supplier->getNotes());
|
||||||
self::assertEquals([], $this->supplier->files);
|
self::assertEquals([], $this->supplier->files);
|
||||||
self::assertEquals([], $this->supplier->getAddresses());
|
self::assertEquals([], $this->supplier->getAddresses());
|
||||||
self::assertEquals([], $this->supplier->getContactElements());
|
self::assertEquals([], $this->supplier->getContactElements());
|
||||||
self::assertEquals((new \DateTime('now'))->format('Y-m-d'), $this->supplier->createdAt->format('Y-m-d'));
|
self::assertEquals((new \DateTime('now'))->format('Y-m-d'), $this->supplier->createdAt->format('Y-m-d'));
|
||||||
self::assertInstanceOf('\Modules\Admin\Models\Account', $this->supplier->account);
|
self::assertInstanceOf('\Modules\Admin\Models\Account', $this->supplier->account);
|
||||||
self::assertInstanceOf('\Modules\Admin\Models\Address', $this->supplier->mainAddress);
|
self::assertInstanceOf('\phpOMS\Stdlib\Base\Address', $this->supplier->mainAddress);
|
||||||
self::assertInstanceOf('\Modules\Profile\Models\NullContactElement', $this->supplier->getMainContactElement(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers Modules\SupplierManagement\Models\Supplier
|
|
||||||
* @group module
|
|
||||||
*/
|
|
||||||
public function testStatusInputOutput() : void
|
|
||||||
{
|
|
||||||
$this->supplier->setStatus(SupplierStatus::INACTIVE);
|
|
||||||
self::assertEquals(SupplierStatus::INACTIVE, $this->supplier->getStatus());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers Modules\SupplierManagement\Models\Supplier
|
|
||||||
* @group module
|
|
||||||
*/
|
|
||||||
public function testTypeInputOutput() : void
|
|
||||||
{
|
|
||||||
$this->supplier->setType(2);
|
|
||||||
self::assertEquals(2, $this->supplier->getType());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -105,9 +84,9 @@ final class SupplierTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
$this->supplier->number = '123456';
|
$this->supplier->number = '123456';
|
||||||
$this->supplier->numberReverse = '654321';
|
$this->supplier->numberReverse = '654321';
|
||||||
$this->supplier->setStatus(SupplierStatus::INACTIVE);
|
$this->supplier->status = SupplierStatus::INACTIVE;
|
||||||
$this->supplier->setType(2);
|
$this->supplier->type = 2;
|
||||||
$this->supplier->info = 'Test info';
|
$this->supplier->info = 'Test info';
|
||||||
|
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
[
|
[
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user