Merge branch 'v5-develop' of https://github.com/turbo124/invoiceninja into v5-develop

This commit is contained in:
David Bomba 2023-08-01 07:49:24 +10:00
commit 32d1114d26
5 changed files with 15 additions and 8 deletions

View File

@ -71,7 +71,7 @@ class UpdateInvoiceRequest extends Request
$rules['tax_name1'] = 'bail|sometimes|string|nullable'; $rules['tax_name1'] = 'bail|sometimes|string|nullable';
$rules['tax_name2'] = 'bail|sometimes|string|nullable'; $rules['tax_name2'] = 'bail|sometimes|string|nullable';
$rules['tax_name3'] = 'bail|sometimes|string|nullable'; $rules['tax_name3'] = 'bail|sometimes|string|nullable';
$rules['status_id'] = 'bail|sometimes|not_in:5'; //do not all cancelled invoices to be modfified. $rules['status_id'] = 'bail|sometimes|not_in:5'; //do not allow cancelled invoices to be modfified.
$rules['exchange_rate'] = 'bail|sometimes|gt:0'; $rules['exchange_rate'] = 'bail|sometimes|gt:0';
// not needed. // not needed.

View File

@ -106,7 +106,7 @@ class ValidRefundableRequest implements Rule
if ($payment->credits()->exists()) { if ($payment->credits()->exists()) {
$paymentable_credit = $payment->credits->where('id', $credit->id)->first(); $paymentable_credit = $payment->credits->where('id', $credit->id)->first();
if (! $paymentable_invoice) { if (! $paymentable_credit) {
$this->error_msg = ctrans('texts.credit_not_related_to_payment', ['credit' => $credit->hashed_id]); $this->error_msg = ctrans('texts.credit_not_related_to_payment', ['credit' => $credit->hashed_id]);
return false; return false;

View File

@ -15,12 +15,13 @@ use App\Events\Payment\PaymentWasRefunded;
use App\Events\Payment\PaymentWasVoided; use App\Events\Payment\PaymentWasVoided;
use App\Services\Ledger\LedgerService; use App\Services\Ledger\LedgerService;
use App\Services\Payment\PaymentService; use App\Services\Payment\PaymentService;
use App\Utils\Ninja; use App\Utils\Ninja;
use App\Utils\Number; use App\Utils\Number;
use App\Utils\Traits\Inviteable; use App\Utils\Traits\Inviteable;
use App\Utils\Traits\MakesDates; use App\Utils\Traits\MakesDates;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use App\Utils\Traits\Payment\Refundable; use App\Utils\Traits\Payment\Refundable;
use Awobaz\Compoships\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
/** /**
@ -251,6 +252,11 @@ class Payment extends BaseModel
return $this->belongsTo(Currency::class); return $this->belongsTo(Currency::class);
} }
public function transaction(): BelongsTo
{
return $this->belongsTo(BankTransaction::class);
}
public function exchange_currency() public function exchange_currency()
{ {
return $this->belongsTo(Currency::class, 'exchange_currency_id', 'id'); return $this->belongsTo(Currency::class, 'exchange_currency_id', 'id');

View File

@ -198,7 +198,7 @@ class Product extends BaseModel
], ],
]); ]);
return $converter->convert($this->notes); return $converter->convert($this->notes ?? '');
} }
public function portalUrl($use_react_url): string public function portalUrl($use_react_url): string

View File

@ -54,13 +54,14 @@ class DeletePayment
/** @return $this */ /** @return $this */
private function cleanupPayment() private function cleanupPayment()
{ {
$this->payment->is_deleted = true; $this->payment->is_deleted = true;
$this->payment->delete(); $this->payment->delete();
// BankTransaction::where('payment_id', $this->payment->id)->cursor()->each(function ($bt){ BankTransaction::where('payment_id', $this->payment->id)->cursor()->each(function ($bt){
// $bt->payment_id = null; $bt->payment_id = null;
// $bt->save(); $bt->save();
// }); });
return $this; return $this;
} }