Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 5.9.0-b1
-
Component/s: None
-
Labels:None
Description
To reproduce:
- Visit any invoices widget
- Submit an invoice number filter
- See the results don't change
- See a new error in the log
Possible solution
In app/models/invoices.php in the getInvoices() method change
$fields = ['invoices.*'];
To
$fields = ['invoices.*', 'REPLACE(invoices.id_format, ?, invoices.id_value)' => 'id_code'];
Change
$this->Record->select(['invoices.total-IFNULL(invoices.paid,0)' => 'due'], false) ->appendValues( [ $this->replacement_keys['invoices']['ID_VALUE_TAG'], $this->replacement_keys['clients']['ID_VALUE_TAG'] ] );
To
$this->Record->select(['invoices.total-IFNULL(invoices.paid,0)' => 'due'], false) ->appendValues( [ $this->replacement_keys['clients']['ID_VALUE_TAG'] ] );
Change
// Filter on invoice number if (!empty($filters['invoice_number'])) { $this->Record->having('id_code', '=', $filters['invoice_number']); }
To
// Filter on invoice number if (!empty($filters['invoice_number'])) { $this->Record->having('id_code', 'like', '%' . $filters['invoice_number'] . '%'); }