diff --git a/app/Filters/InvoiceFilters.php b/app/Filters/InvoiceFilters.php index 9f3a935146..5c2d83be66 100644 --- a/app/Filters/InvoiceFilters.php +++ b/app/Filters/InvoiceFilters.php @@ -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); } diff --git a/app/Livewire/BillingPortal/Summary.php b/app/Livewire/BillingPortal/Summary.php index 3e824f95ef..22f24021be 100644 --- a/app/Livewire/BillingPortal/Summary.php +++ b/app/Livewire/BillingPortal/Summary.php @@ -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) ); } diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index 2ca2bc71d4..580ac5bd00 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -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){