mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fix for data leak on products route when using the ?with filter
This commit is contained in:
parent
0885b2a7c1
commit
5320b953db
@ -251,6 +251,7 @@ abstract class QueryFilters
|
|||||||
{
|
{
|
||||||
return $this->builder
|
return $this->builder
|
||||||
->orWhere($this->with_property, $value)
|
->orWhere($this->with_property, $value)
|
||||||
->orderByRaw("{$this->with_property} = ? DESC", [$value]);
|
->orderByRaw("{$this->with_property} = ? DESC", [$value])
|
||||||
|
->company();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,11 +239,6 @@ class SubscriptionService
|
|||||||
->where('status_id', Invoice::STATUS_PAID)
|
->where('status_id', Invoice::STATUS_PAID)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if($last_invoice)
|
|
||||||
nlog($last_invoice->toArray());
|
|
||||||
else
|
|
||||||
nlog("no invoice found");
|
|
||||||
|
|
||||||
$refund = $this->calculateProRataRefundForSubscription($last_invoice);
|
$refund = $this->calculateProRataRefundForSubscription($last_invoice);
|
||||||
|
|
||||||
if($use_credit_setting != 'off')
|
if($use_credit_setting != 'off')
|
||||||
@ -340,7 +335,7 @@ else
|
|||||||
*/
|
*/
|
||||||
private function calculateProRataRefundForSubscription($invoice) :float
|
private function calculateProRataRefundForSubscription($invoice) :float
|
||||||
{
|
{
|
||||||
if(!$invoice || !$invoice->date)
|
if(!$invoice || !$invoice->date || $invoice->status_id != Invoice::STATUS_PAID)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
$start_date = Carbon::parse($invoice->date);
|
$start_date = Carbon::parse($invoice->date);
|
||||||
@ -486,7 +481,7 @@ else
|
|||||||
->where('client_id', $recurring_invoice->client_id)
|
->where('client_id', $recurring_invoice->client_id)
|
||||||
->where('is_proforma',0)
|
->where('is_proforma',0)
|
||||||
->where('is_deleted', 0)
|
->where('is_deleted', 0)
|
||||||
->where('status_id', Invoice::STATUS_PAID)
|
->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL, Invoice::STATUS_PAID])
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->orderBy('id', 'desc')
|
->orderBy('id', 'desc')
|
||||||
->first();
|
->first();
|
||||||
@ -626,6 +621,7 @@ else
|
|||||||
|
|
||||||
$last_invoice = Invoice::where('subscription_id', $recurring_invoice->subscription_id)
|
$last_invoice = Invoice::where('subscription_id', $recurring_invoice->subscription_id)
|
||||||
->where('client_id', $recurring_invoice->client_id)
|
->where('client_id', $recurring_invoice->client_id)
|
||||||
|
->where('is_proforma',0)
|
||||||
->where('is_deleted', 0)
|
->where('is_deleted', 0)
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->orderBy('id', 'desc')
|
->orderBy('id', 'desc')
|
||||||
@ -673,6 +669,7 @@ else
|
|||||||
$last_invoice = Invoice::where('subscription_id', $recurring_invoice->subscription_id)
|
$last_invoice = Invoice::where('subscription_id', $recurring_invoice->subscription_id)
|
||||||
->where('client_id', $recurring_invoice->client_id)
|
->where('client_id', $recurring_invoice->client_id)
|
||||||
->where('is_deleted', 0)
|
->where('is_deleted', 0)
|
||||||
|
->where('is_proforma',0)
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->orderBy('id', 'desc')
|
->orderBy('id', 'desc')
|
||||||
->first();
|
->first();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user