1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Add mark paid for credits

This commit is contained in:
David Bomba 2023-06-19 19:48:53 +10:00
parent e07c070d39
commit e9dbe62d33
3 changed files with 9 additions and 5 deletions

View File

@ -61,11 +61,11 @@ class DesignFilters extends QueryFilters
*/ */
public function entityFilter(): Builder public function entityFilter(): Builder
{ {
//19-03-2023 change the scope for the design filters /** @var \App\Models\User $user */
return $this->builder->where(function ($query) { $user = auth()->user();
$query->where('company_id', auth()->user()->company()->id)->orWhere('company_id', null)->orderBy('id', 'asc');
// return $this->builder->where('company_id', auth()->user()->company()->id)->orWhere('company_id', null)->orderBy('id', 'asc');
return $this->builder->where(function ($query) use($user){
$query->where('company_id', $user->company()->id)->orWhere('company_id', null)->orderBy('id', 'asc');
}); });
} }

View File

@ -243,7 +243,7 @@ class CreditService
public function triggeredActions($request) public function triggeredActions($request)
{ {
$this->invoice = (new TriggeredActions($this->credit, $request))->run(); $this->credit = (new TriggeredActions($this->credit, $request))->run();
return $this; return $this;
} }

View File

@ -61,6 +61,10 @@ class TriggeredActions extends AbstractService
$company->save(); $company->save();
} }
if ($this->request->has('mark_paid') && $this->request->input('mark_paid') == 'true') {
$this->credit->service()->markPaid()->save();
}
return $this->credit; return $this->credit;
} }