1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-05 18:52:44 +01:00

Fixes for Users (#3526)

This commit is contained in:
David Bomba 2020-03-25 10:20:42 +11:00 committed by GitHub
parent 2b85feedc0
commit cd36f64423
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 25 deletions

View File

@ -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();

View File

@ -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);
}

View File

@ -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;
}

View File

@ -78,9 +78,8 @@ class UserRepository extends BaseRepository
->whereUserId($user->id);
}])->first();
$user->restore();
}
$user->restore();
return $user;
}

View File

@ -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')];
;

View File

@ -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<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var r=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.shouldDisplayTerms=t,this.shouldDisplaySignature=n,this.termsAccepted=!1}var t,r,i;return t=e,(r=[{key:"handleMethodSelect",value:function(e){var t=this;this.shouldDisplaySignature&&!this.shouldDisplayTerms&&(this.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){t.termsAccepted=!0,t.submitForm()}))),!this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){t.submitForm()}))),this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){t.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){t.termsAccepted=!0,t.submitForm()}))}))),this.shouldDisplaySignature||this.shouldDisplayTerms||this.submitForm()}},{key:"submitForm",value:function(){document.getElementById("payment-form").submit()}},{key:"displayTerms",value:function(){document.getElementById("displayTermsModal").removeAttribute("style")}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style"),new SignaturePad(document.getElementById("signature-pad"),{backgroundColor:"rgb(240,240,240)",penColor:"rgb(0, 0, 0)"})}},{key:"handle",value:function(){var e=this;document.querySelectorAll(".dropdown-gateway-button").forEach((function(t){t.addEventListener("click",(function(){return e.handleMethodSelect(t)}))}))}}])&&n(t.prototype,r),i&&n(t,i),e}(),i=document.querySelector('meta[name="require-invoice-signature"]').content,o=document.querySelector('meta[name="show-invoice-terms"]').content;new r(Boolean(+i),Boolean(+o)).handle()}});
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.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 o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));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<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var r=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.shouldDisplayTerms=t,this.shouldDisplaySignature=n,this.termsAccepted=!1}var t,r,o;return t=e,(r=[{key:"handleMethodSelect",value:function(e){var t=this;document.getElementById("company_gateway_id").value=e.dataset.companyGatewayId,document.getElementById("payment_method_id").value=e.dataset.gatewayTypeId,this.shouldDisplaySignature&&!this.shouldDisplayTerms&&(this.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){t.termsAccepted=!0,t.submitForm()}))),!this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){t.submitForm()}))),this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){t.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){t.termsAccepted=!0,t.submitForm()}))}))),this.shouldDisplaySignature||this.shouldDisplayTerms||this.submitForm()}},{key:"submitForm",value:function(){document.getElementById("payment-form").submit()}},{key:"displayTerms",value:function(){document.getElementById("displayTermsModal").removeAttribute("style")}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style"),new SignaturePad(document.getElementById("signature-pad"),{backgroundColor:"rgb(240,240,240)",penColor:"rgb(0, 0, 0)"})}},{key:"handle",value:function(){var e=this;document.querySelectorAll(".dropdown-gateway-button").forEach((function(t){t.addEventListener("click",(function(){return e.handleMethodSelect(t)}))}))}}])&&n(t.prototype,r),o&&n(t,o),e}(),o=document.querySelector('meta[name="require-invoice-signature"]').content,i=document.querySelector('meta[name="show-invoice-terms"]').content;new r(Boolean(+o),Boolean(+i)).handle()}});