fix bug when packing list is deleted

This commit is contained in:
JiaSheng
2023-10-23 22:00:31 +08:00
parent af8444e0d9
commit d41bd3db39
3 changed files with 30 additions and 4 deletions
@@ -84,6 +84,25 @@ class CreateGroupsLogic extends AbstractControllerLogic
// $invoices = $this->fetchesTransaction->execute(['id_in' => $invoice_ids]);
$invoices = Transaction::whereIn('id', $invoice_ids)->get();
foreach ($invoices as $invoice) {
$order = null;
if ($invoice->owner instanceof Transaction) {
if ($invoice->owner) {
if ($invoice->owner->owner) {
$order = $invoice->owner->owner->owner;
}
}
} else if (!($invoice->owner instanceof Transaction) && !($invoice->owner instanceof Wallet)) {
if ($invoice->owner) {
$order = $invoice->owner->owner;
}
}
if (!$order) {
throw new MalformedRequestException("There is an error while paying for invoice {$invoice->bill_no}");
}
}
if ($payment_method == PaymentMethodType::WALLET) {
$companyModuleId = $invoices->first()->receiver;
+8 -2
View File
@@ -26,9 +26,15 @@ class TransactionResource extends JsonResource
$groupTransactions = null;
if ($this->owner instanceof Transaction) {
$order = new OrderResource($this->owner->owner->owner);
if ($this->owner) {
if ($this->owner->owner) {
$order = new OrderResource($this->owner->owner->owner);
}
}
} else if (!($this->owner instanceof Transaction) && !($this->owner instanceof Wallet)) {
$order = new OrderResource($this->owner->owner);
if ($this->owner) {
$order = new OrderResource($this->owner->owner);
}
} else {
$group = Group::where('reference', $this->payment_reference)->first();
if ($group) {
@@ -1,5 +1,5 @@
<template>
<div class="row m-b-15 m-l-5 m-r-10">
<div class="row m-b-15 m-l-5 m-r-10" v-if="$store.getters.isAdmin || item.order">
<div class="col bg-white rounded b-a" :class="{'b-white': !selected, 'b-primary': selected, 'bg-primary-lighter': selected}">
<div class="row">
<div class="col padding-20">
@@ -13,7 +13,8 @@
</div>
<div class="col">
<p class="no-margin fs-10 all-caps">Order</p>
<div><a :href="route('order.show', item.order.reference)">{{item.order.reference}}</a></div>
<div v-if="item.order"><a :href="route('order.show', item.order.reference)">{{item.order.reference}}</a></div>
<div class="text-danger" v-else>Error in retrieving order</div>
</div>
<div class="col">
<p class="no-margin fs-10 all-caps">Invoice Date</p>