code fixes

This commit is contained in:
Dennis Eichhorn 2024-03-15 20:24:39 +00:00
parent e6006238b4
commit bd64e5cb31
5 changed files with 31 additions and 14 deletions

View File

@ -310,6 +310,7 @@
{ "value": "FI" },
{ "value": "FR" },
{ "value": "DE" },
{ "value": "DE_0" },
{ "value": "GR" },
{ "value": "HU" },
{ "value": "IE" },

View File

@ -61,8 +61,9 @@ final class Installer extends InstallerAbstract
$attrValues = self::createSupplierAttributeValues($app, $attrTypes, $attributes);
$data = include __DIR__ . '/Install/Admin.install.php';
$content = \json_decode($data[0]['content'], true);
/** @var array $content */
$content = \json_decode($data[0]['content'], true);
foreach ($content as $type => $_) {
$content[$type] = \reset($attrValues[$type])['id'];
}

View File

@ -118,16 +118,31 @@ final class ApiController extends Controller
return $supplier;
}
/**
* Create supplier segmentation.
*
* Default: segment->section->sales_group and to the side supplier_type
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param Supplier $supplier Supplier
*
* @return void
*
* @since 1.0.0
*/
private function createSupplierSegmentation(RequestAbstract $request, ResponseAbstract $response, Supplier $supplier) : void
{
/** @var \Model\Setting $settings */
$settings = $this->app->appSettings->get(null, SettingsEnum::DEFAULT_SEGMENTATION);
/** @var array $segmentation */
$segmentation = \json_decode($settings->content, true);
if ($segmentation === false || $segmentation === null) {
return;
}
/** @var \Modules\Attribute\Models\AttributeType[] $types */
$types = SupplierAttributeTypeMapper::getAll()
->where('name', \array_keys($segmentation), 'IN')
->execute();

View File

@ -96,7 +96,7 @@ final class SearchController extends Controller
'link' => '{/base}/purchase/supplier/view?id=' . $account->id,
'email' => $account->account->getContactByType(ContactType::EMAIL)->content,
'phone' => $account->account->getContactByType(ContactType::PHONE)->content,
'city' => $account->mainAddress?->city,
'city' => $account->mainAddress->city,
'image' => $image->id === 0
? 'Web/Backend/img/logo_grey.png'
: $image->getPath(),