mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-23 06:24:03 +00:00
delete duplicated purchase orders on approval
This commit is contained in:
@@ -61,7 +61,11 @@ class ApprovePurchaseOrderLogic extends AbstractControllerLogic
|
||||
|
||||
$booking = $this->fetchesBooking->execute(['id' => $request->route('id')]);
|
||||
|
||||
$this->updatesTransactionStatus->execute($booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->first(), ApprovalStatus::APPROVED);
|
||||
$purchaseOrder = $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->first();
|
||||
|
||||
$booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->where('id', '!=', $purchaseOrder->id)->delete();
|
||||
|
||||
$this->updatesTransactionStatus->execute($purchaseOrder, ApprovalStatus::APPROVED);
|
||||
|
||||
$this->createInvoiceTransactionProcessor->execute($booking);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user