Minor fixes

This commit is contained in:
David Bomba 2024-10-11 11:32:15 +11:00
parent 0818513ade
commit 056490fd8f
3 changed files with 2 additions and 6 deletions

View File

@ -276,7 +276,7 @@ class InvoiceFilters extends QueryFilters
{
$sort_col = explode('|', $sort);
if (!is_array($sort_col) || count($sort_col) != 2 || in_array($sort_col[0], ['documents'])) {
if (!is_array($sort_col) || count($sort_col) != 2 || !in_array($sort_col[0], \Illuminate\Support\Facades\Schema::getColumnListing($this->builder->getModel()->getTable()))) {
return $this->builder;
}
@ -290,9 +290,6 @@ class InvoiceFilters extends QueryFilters
}
if($sort_col[0] == 'number') {
// return $this->builder->orderByRaw('CAST(number AS UNSIGNED), number ' . $dir);
// return $this->builder->orderByRaw("number REGEXP '^[A-Za-z]+$',CAST(number as SIGNED INTEGER),CAST(REPLACE(number,'-','')AS SIGNED INTEGER) ,number");
// return $this->builder->orderByRaw('ABS(number) ' . $dir);
return $this->builder->orderByRaw("REGEXP_REPLACE(invoices.number,'[^0-9]+','')+0 " . $dir);
}

View File

@ -116,7 +116,7 @@ class Summary extends Component
return \sprintf(
'%s/%s',
Number::formatMoney($recurring + $recurring_optional, $this->subscription->company),
RecurringInvoice::frequencyForKey($this->subscription->frequency_id)
RecurringInvoice::frequencyForKey($this->subscription->frequency_id ?? 0)
);
}

View File

@ -405,7 +405,6 @@ class BaseDriver extends AbstractPaymentDriver
return $item;
})
->whereIn('type_id', ['3'])
// ->where('gross_line_total', '<=', round($fee_total,2))
->count();
if($invoice && $fee_count == 0){