Fixes for imports:

This commit is contained in:
David Bomba 2023-05-10 11:49:08 +10:00
parent b313a3c3ae
commit 6b6fbcc412
4 changed files with 7 additions and 4 deletions

View File

@ -213,6 +213,9 @@ class BaseImport
} }
foreach ($data as $key => $record) { foreach ($data as $key => $record) {
unset($record['']);
try { try {
$entity = $this->transformer->transform($record); $entity = $this->transformer->transform($record);

View File

@ -121,7 +121,6 @@ class Csv extends BaseImport implements ImportInterface
if (empty($data)) { if (empty($data)) {
$this->entity_count['clients'] = 0; $this->entity_count['clients'] = 0;
return; return;
} }

View File

@ -371,7 +371,8 @@ class BaseTransformer
*/ */
public function getCountryId($name) public function getCountryId($name)
{ {
if (strlen($name) == 2) {
if (strlen(trim($name)) == 2) {
return $this->getCountryIdBy2($name); return $this->getCountryIdBy2($name);
} }

View File

@ -110,8 +110,8 @@ class ClientTransformer extends BaseTransformer
), ),
], ],
], ],
'country_id' => isset($data['client.country']) 'country_id' => isset($data['client.country_id'])
? $this->getCountryId($data['client.country']) ? $this->getCountryId($data['client.country_id'])
: null, : null,
'shipping_country_id' => isset($data['client.shipping_country']) 'shipping_country_id' => isset($data['client.shipping_country'])
? $this->getCountryId($data['client.shipping_country']) ? $this->getCountryId($data['client.shipping_country'])