mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Additional logic for updating a payment in form request
This commit is contained in:
parent
8622c4b60a
commit
7fd1446f43
@ -71,10 +71,6 @@ class UpdatePaymentRequest extends Request
|
||||
unset($input['amount']);
|
||||
}
|
||||
|
||||
// if (isset($input['number'])) {
|
||||
// unset($input['number']);
|
||||
// }
|
||||
|
||||
if (isset($input['invoices']) && is_array($input['invoices']) !== false) {
|
||||
foreach ($input['invoices'] as $key => $value) {
|
||||
$input['invoices'][$key]['invoice_id'] = $this->decodePrimaryKey($value['invoice_id']);
|
||||
|
@ -111,6 +111,10 @@ class StoreRecurringInvoiceRequest extends Request
|
||||
}
|
||||
}
|
||||
|
||||
/* If there is no number, just unset it here. */
|
||||
if(array_key_exists('number', $input) && ( is_null($input['number']) || empty($input['number'])))
|
||||
unset($input['number']);
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ class PaymentAppliedValidAmount implements Rule
|
||||
|
||||
private function calculateAmounts() :bool
|
||||
{
|
||||
$payment = Payment::whereId($this->decodePrimaryKey(request()->segment(4)))->company()->first();
|
||||
$payment = Payment::withTrashed()->whereId($this->decodePrimaryKey(request()->segment(4)))->company()->first();
|
||||
|
||||
if (! $payment) {
|
||||
return false;
|
||||
@ -53,6 +53,15 @@ class PaymentAppliedValidAmount implements Rule
|
||||
|
||||
$payment_amounts = $payment->amount - $payment->refunded - $payment->applied;
|
||||
|
||||
if(request()->has('credits')
|
||||
&& is_array(request()->input('credits'))
|
||||
&& count(request()->input('credits')) == 0
|
||||
&& request()->has('invoices')
|
||||
&& is_array(request()->input('invoices'))
|
||||
&& count(request()->input('invoices')) == 0){
|
||||
return true;
|
||||
}
|
||||
|
||||
if (request()->input('credits') && is_array(request()->input('credits'))) {
|
||||
foreach (request()->input('credits') as $credit) {
|
||||
$payment_amounts += $credit['amount'];
|
||||
|
@ -35,19 +35,19 @@ class ClientContactResetPasswordObject
|
||||
public function build()
|
||||
{
|
||||
|
||||
$settings = $this->client_contact->client->getMergedSettings();
|
||||
App::forgetInstance('translator');
|
||||
$t = app('translator');
|
||||
App::setLocale($this->client_contact->preferredLocale());
|
||||
$t->replace(Ninja::transformTranslations($this->client_contact->client->getMergedSettings()));
|
||||
|
||||
$t->replace(Ninja::transformTranslations($settings));
|
||||
|
||||
$data = [
|
||||
'title' => ctrans('texts.your_password_reset_link'),
|
||||
'content' => ctrans('texts.reset_password'),
|
||||
'url' => route('client.password.reset', ['token' => $this->token, 'email' => $this->client_contact->email]),
|
||||
'button' => ctrans('texts.reset'),
|
||||
'signature' => $this->company->settings->email_signature,
|
||||
'settings' => $this->company->settings,
|
||||
'signature' => $settings->email_signature,
|
||||
'settings' => $settings,
|
||||
'company' => $this->company,
|
||||
'logo' => $this->company->present()->logo(),
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user