Skip to content

Commit

Permalink
fix error fetching product no name
Browse files Browse the repository at this point in the history
  • Loading branch information
inikoo committed Sep 26, 2024
1 parent d2a2d5f commit 7c145c6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
2 changes: 0 additions & 2 deletions app/Actions/Transfers/Aurora/FetchAuroraSupplierProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ public function handle(SourceOrganisationService $organisationSource, int $organ
public function fetchSupplierProduct($supplierProductData, $organisationSource)
{
if ($supplierProductData) {
// print_r($supplierProductData);


$found = false;
$supplierProduct = null;
Expand Down
3 changes: 0 additions & 3 deletions app/Transfers/Aurora/FetchAuroraCustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ protected function parseModel(): void
$this->parsedData['customer']['identity_document_number'] = $identityDocumentNumber;
}


//print_r($this->parsedData['customer']);

if ($billingAddress != $deliveryAddress) {
$this->parsedData['customer']['delivery_address'] = $deliveryAddress;
}
Expand Down
12 changes: 8 additions & 4 deletions app/Transfers/Aurora/FetchAuroraProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ protected function parseModel(): void
}

$state = match ($this->auroraModelData->{'Product Status'}) {
'InProcess' => ProductStateEnum::IN_PROCESS,
'InProcess' => ProductStateEnum::IN_PROCESS,
'Discontinuing' => ProductStateEnum::DISCONTINUING,
'Discontinued' => ProductStateEnum::DISCONTINUED,
default => ProductStateEnum::ACTIVE
'Discontinued' => ProductStateEnum::DISCONTINUED,
default => ProductStateEnum::ACTIVE
};


Expand All @@ -81,14 +81,18 @@ protected function parseModel(): void

$code = $this->cleanTradeUnitReference($this->auroraModelData->{'Product Code'});

$name = $this->auroraModelData->{'Product Name'};
if (!$name) {
$name = $code;
}

$this->parsedData['product'] = [
'is_main' => true,
'type' => AssetTypeEnum::PRODUCT,
'owner_type' => $owner_type,
'owner_id' => $owner_id,
'code' => $code,
'name' => $this->auroraModelData->{'Product Name'},
'name' => $name,
'price' => round($unit_price, 2),
'status' => $status,
'unit' => $this->auroraModelData->{'Product Unit Label'},
Expand Down
3 changes: 0 additions & 3 deletions app/Transfers/Aurora/FetchAuroraSupplierProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ protected function parseModel(): void
return;
}

//print_r($this->auroraModelData);
//print_r($supplier);

$orgSupplier = $supplier->orgSuppliers()->where('organisation_id', $this->organisation->id)->firstOrFail();

$this->parsedData['orgSupplier'] = $orgSupplier;
Expand Down

0 comments on commit 7c145c6

Please sign in to comment.