Define custom order state on shipments

This commit is contained in:
Glenn Hermans 2021-05-03 02:03:28 +02:00 committed by GitHub
parent 5e48a85d9f
commit 0f4da65937
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -70,9 +70,10 @@ class ShipmentRepository extends Repository
/**
* @param array $data
* @param string $orderState
* @return \Webkul\Sales\Contracts\Shipment
*/
public function create(array $data)
public function create(array $data, $orderState = null)
{
DB::beginTransaction();
@ -155,7 +156,11 @@ class ShipmentRepository extends Repository
'inventory_source_name' => $shipment->inventory_source->name,
]);
$this->orderRepository->updateOrderStatus($order);
if (isset($orderState)){
$this->orderRepository->updateOrderStatus($order, $orderState);
} else {
$this->orderRepository->updateOrderStatus($order);
}
Event::dispatch('sales.shipment.save.after', $shipment);
} catch (\Exception $e) {
@ -168,4 +173,4 @@ class ShipmentRepository extends Repository
return $shipment;
}
}
}