mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for db::raw queries
This commit is contained in:
parent
7c108c14f7
commit
62853c1dcb
@ -961,7 +961,7 @@ class CheckData extends Command
|
||||
}
|
||||
$records = DB::table($table)
|
||||
->join($tableName, "{$tableName}.id", '=', "{$table}.{$field}_id")
|
||||
->where("{$table}.{$company_id}", '!=', DB::raw("{$tableName}.company_id")->getValue(DB::connection()->getQueryGrammar()))
|
||||
->where("{$table}.{$company_id}", '!=', DB::raw("{$tableName}.company_id"))
|
||||
->get(["{$table}.id"]);
|
||||
|
||||
if ($records->count()) {
|
||||
|
@ -96,17 +96,22 @@ class HandleRestore extends AbstractService
|
||||
$this->adjustment_amount += $payment->paymentables
|
||||
->where('paymentable_type', '=', 'invoices')
|
||||
->where('paymentable_id', $this->invoice->id)
|
||||
->sum(DB::raw('amount')->getValue(DB::connection()->getQueryGrammar()));
|
||||
|
||||
->sum('amount');
|
||||
// ->sum(DB::raw('amount')->getValue(DB::connection()->getQueryGrammar()));
|
||||
nlog($this->adjustment_amount);
|
||||
$this->adjustment_amount += $payment->paymentables
|
||||
->where('paymentable_type', '=', 'invoices')
|
||||
->where('paymentable_id', $this->invoice->id)
|
||||
->sum(DB::raw('refunded')->getValue(DB::connection()->getQueryGrammar()));
|
||||
->sum('amount');
|
||||
// ->sum(DB::raw('refunded')->getValue(DB::connection()->getQueryGrammar()));
|
||||
nlog($this->adjustment_amount);
|
||||
|
||||
//14/07/2023 - do not include credits in the payment amount
|
||||
$this->adjustment_amount -= $payment->paymentables
|
||||
->where('paymentable_type', '=', 'App\Models\Credit')
|
||||
->sum(DB::raw('amount')->getValue(DB::connection()->getQueryGrammar()));
|
||||
->sum('amount');
|
||||
// ->sum(DB::raw('amount')->getValue(DB::connection()->getQueryGrammar()));
|
||||
nlog($this->adjustment_amount);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user