diff --git a/app/Http/Controllers/ClientPortal/PaymentController.php b/app/Http/Controllers/ClientPortal/PaymentController.php index 55fc5abbb3fa..a89afeee4d02 100644 --- a/app/Http/Controllers/ClientPortal/PaymentController.php +++ b/app/Http/Controllers/ClientPortal/PaymentController.php @@ -78,7 +78,7 @@ class PaymentController extends Controller * @return \Illuminate\Http\RedirectResponse|mixed */ public function process() - { + { $invoices = Invoice::whereIn('id', $this->transformKeys(request()->invoices)) ->whereClientId(auth()->user()->client->id) ->get(); diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 71466fb0e7fc..481f1438efce 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -517,7 +517,7 @@ f * response=200, $users->each(function ($user, $key) use ($action, $return_user_collection) { if (auth()->user()->can('edit', $user)) { - $user = $this->user_repo->{$action}($user); + $this->user_repo->{$action}($user); $return_user_collection->push($user->id); } diff --git a/app/Libraries/MultiDB.php b/app/Libraries/MultiDB.php index 22bac8a71c13..0dc397c3a15b 100644 --- a/app/Libraries/MultiDB.php +++ b/app/Libraries/MultiDB.php @@ -123,13 +123,13 @@ class MultiDB public static function hasUser(array $data) : ?User { if (! config('ninja.db.multi_db_enabled')) { - return User::where($data)->first(); + return User::where($data)->withTrashed()->first(); } foreach (self::$dbs as $db) { self::setDB($db); - $user = User::where($data)->first(); + $user = User::where($data)->withTrashed()->first(); if ($user) { return $user; @@ -137,6 +137,7 @@ class MultiDB } self::setDefaultDatabase(); + return null; } diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php index 4d2a23db73bf..f2cfe4967a9c 100644 --- a/app/Repositories/UserRepository.php +++ b/app/Repositories/UserRepository.php @@ -78,9 +78,8 @@ class UserRepository extends BaseRepository ->whereUserId($user->id); }])->first(); - $user->restore(); - } + $user->restore(); return $user; } diff --git a/app/Utils/Traits/MakesInvoiceValues.php b/app/Utils/Traits/MakesInvoiceValues.php index ca3ad181e862..ae97a451da91 100644 --- a/app/Utils/Traits/MakesInvoiceValues.php +++ b/app/Utils/Traits/MakesInvoiceValues.php @@ -135,15 +135,11 @@ trait MakesInvoiceValues $data['$line_tax_labels'] = ['value' => $this->lineTaxLabels(), 'label' => ctrans('texts.taxes')]; $data['$line_tax_values'] = ['value' => $this->lineTaxValues(), 'label' => ctrans('texts.taxes')]; $data['$date'] = ['value' => $this->date ?: ' ', 'label' => ctrans('texts.date')]; - $data['$invoice_date'] = ['value' => $this->date ?: ' ', 'label' => ctrans('texts.invoice_date')]; + //$data['$invoice_date'] = ['value' => $this->date ?: ' ', 'label' => ctrans('texts.invoice_date')]; $data['$invoice.date'] = &$data['$date']; - $data['$due_date'] = ['value' => $this->due_date ?: ' ', 'label' => ctrans('texts.due_date')]; - $data['$invoice.due_date'] = &$data['$due_date']; + $data['$invoice.due_date'] = ['value' => $this->due_date ?: ' ', 'label' => ctrans('texts.due_date')]; $data['$invoice.number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.invoice_number')]; - $data['$invoice.invoice_number'] = &$data['$invoice.number']; - $data['$invoice_number'] = &$data['$invoice.number']; - $data['$po_number'] = ['value' => $this->po_number ?: ' ', 'label' => ctrans('texts.po_number')]; - $data['$invoice.po_number'] = &$data['$po_number']; + $data['$invoice.po_number'] = ['value' => $this->po_number ?: ' ', 'label' => ctrans('texts.po_number')]; $data['$line_taxes'] = ['value' => $this->makeLineTaxes() ?: ' ', 'label' => ctrans('texts.taxes')]; $data['$invoice.line_taxes'] = &$data['$line_taxes']; $data['$total_taxes'] = ['value' => $this->makeTotalTaxes() ?: ' ', 'label' => ctrans('texts.taxes')]; @@ -173,21 +169,15 @@ trait MakesInvoiceValues $data['$entity_number'] = &$data['$number']; //$data['$paid_to_date'] = ; - $data['$discount'] = ['value' => Number::formatMoney($this->calc()->getTotalDiscount(), $this->client) ?: ' ', 'label' => ctrans('texts.discount')]; - $data['$invoice.discount'] = &$data['$discount']; + $data['$invoice.discount'] = ['value' => Number::formatMoney($this->calc()->getTotalDiscount(), $this->client) ?: ' ', 'label' => ctrans('texts.discount')]; $data['$subtotal'] = ['value' => Number::formatMoney($this->calc()->getSubTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.subtotal')]; $data['$invoice.subtotal'] = &$data['$subtotal']; - $data['$balance_due'] = ['value' => Number::formatMoney($this->balance, $this->client) ?: ' ', 'label' => ctrans('texts.balance_due')]; - $data['$invoice.balance_due'] = &$data['$balance_due']; - $data['$partial_due'] = ['value' => Number::formatMoney($this->partial, $this->client) ?: ' ', 'label' => ctrans('texts.partial_due')]; - $data['$invoice.partial_due'] = &$data['$partial_due']; + $data['$invoice.balance_due'] = ['value' => Number::formatMoney($this->balance, $this->client) ?: ' ', 'label' => ctrans('texts.balance_due')]; + $data['$invoice.partial_due'] = ['value' => Number::formatMoney($this->partial, $this->client) ?: ' ', 'label' => ctrans('texts.partial_due')]; $data['$total'] = ['value' => Number::formatMoney($this->calc()->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.total')]; $data['$invoice.total'] = ['value' => Number::formatMoney($this->calc()->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.invoice_total')]; - $data['$amount'] = &$data['$total']; - $data['$invoice_total'] = &$data['$total']; $data['$invoice.amount'] = &$data['$total']; - $data['$quote_total'] = ['value' => Number::formatMoney($this->calc()->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.quote_total')]; - $data['$quote.amount'] = &$data['$quote_total']; + $data['$quote.amount'] = ['value' => Number::formatMoney($this->calc()->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.quote_total')]; $data['$credit_total'] = ['value' => Number::formatMoney($this->calc()->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.credit_total')]; $data['$credit.amount'] = &$data['$credit_total']; @@ -213,7 +203,6 @@ trait MakesInvoiceValues $data['$quote_no'] = &$data['$quote_number']; $data['$quote.quote_no'] = &$data['$quote_number']; $data['$valid_until'] = ['value' => $this->due_date, 'label' => ctrans('texts.valid_until')]; - $data['$quote_total'] = ['value' => Number::formatMoney($this->calc()->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.quote_total')]; $data['$credit_amount'] = ['value' => Number::formatMoney($this->calc()->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.credit_amount')]; $data['$credit_balance'] = ['value' => Number::formatMoney($this->balance, $this->client) ?: ' ', 'label' => ctrans('texts.credit_balance')]; ; diff --git a/public/js/clients/invoices/payment.js b/public/js/clients/invoices/payment.js index 5f49748833af..9503f46e3c32 100644 --- a/public/js/clients/invoices/payment.js +++ b/public/js/clients/invoices/payment.js @@ -1,2 +1,2 @@ /*! For license information please see payment.js.LICENSE.txt */ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=3)}({3:function(e,t,n){e.exports=n("FuOr")},FuOr:function(e,t){function n(e,t){for(var n=0;n