diff --git a/app/Classes/Modules/PackingLists/Processors/FetchOrderListsFromYdPortalProcessor.php b/app/Classes/Modules/PackingLists/Processors/FetchOrderListsFromYdPortalProcessor.php index e4fec5c2..4094cedc 100644 --- a/app/Classes/Modules/PackingLists/Processors/FetchOrderListsFromYdPortalProcessor.php +++ b/app/Classes/Modules/PackingLists/Processors/FetchOrderListsFromYdPortalProcessor.php @@ -208,7 +208,14 @@ class FetchOrderListsFromYdPortalProcessor try{ $packingList = $this->fetchesPackingList->execute(['reference' => $row->expressno]); } catch (ResourceNotFoundException $exception){ - $appointee_id = !$allow_contract ? 2037 : $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id; + + if (!$allow_contract) { + $appointee_id = 2037; + } + else { + $appointee_id = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id; + } + $warehouseReceiveObject = new PackingListObject($packingListReference, $appointee_id, PackingListType::WAREHOUSE_RECEIVE_LIST, $allow_contract ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED); /** @var PackingList $warehouseReceiveList */ @@ -261,7 +268,16 @@ class FetchOrderListsFromYdPortalProcessor try { $container = $this->fetchesContainer->execute(['reference' => $containerReference]); } catch (ResourceNotFoundException $exception){ - $originWarehouse = $this->fetchesCompanyModule->execute(['id' => $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee->id]); + + if (!$allow_contract) { + $appointee_id = 2037; + } + else { + $appointee_id = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee->id; + } + + $originWarehouse = $this->fetchesCompanyModule->execute(['id' => $appointee_id]); + $containerObject = new ContainerObject($containerReference, '', '', ContainerTypes::FORTY_FEET_DRY_CONTAINER, $loadingDate, ApprovalStatus::PENDING_VERIFICATION); /** @var Container $container */ $container = $this->createContainerProcessor->execute($containerObject, $originWarehouse);