Ask, reply and learn. Join the community of Akaunting.
With the new/awesome pinning feature of the Invoices module, I set "All Invoices" to be pinned. When I click on Sales > Invoices, I get taken to the default URL, aka:
https://akaunting.mydoamin.ca/1/sales/invoices
... where All is pinned. However, if I search for, say, "driven", then the page URL changes to:
https://akaunting.mydomain.ca/1/sales/invoices?search=%22driven%22
... but this is wrong, it should be:
https://akaunting.mydomain.ca/1/sales/invoices?list_records=all&search=%22driven%22
If I manually click "All", then search again, it works.
Can anybody help? This is a bug!
Update: bug still exists in 3.1.21 and it happens in both Firefox and Chrome
FIXED using Claude.ai ....
1.) edit app/Abstracts/Http/Controller.php and change the code to look like this:
if (! empty($tab_pins) && ! empty($tab_pins[$this->type])) {
if ($tab_pins[$this->type] === 'all') {
request()->offsetSet('list_records', 'all'); return;
}
$data = config('type.document.' . $this->type . '.route.params.' . $tab_pins[$this->type]);
if (! empty($data)) {
request()->merge($data);
}
}
2.) edit resources/views/components/documents/index/content.blade.php and add the following to the top of the file:
@if (request()->get('list_records') === 'all' && !str_contains(request()->fullUrl(), 'list_records')) (function() { var url = window.location.href;
var sep = url.indexOf('?') !== -1 ? '&' : '?'; window.history.replaceState({}, document.title, url + sep + 'list_records=all');
})();
@endif
Explanation from Claude.ai ....
To summarize the two-part fix for your records:
Fix 1 — app/Abstracts/Http/Controller.php in setActiveTabForDocuments():
When the pinned tab is all, explicitly set list_records=all on the request object and return early, preventing the fallthrough that was force-setting search=status:unpaid
Fix 2 — resources/views/components/documents/index/content.blade.php at the top:
When the PHP request has list_records=all but the browser URL doesn't (the pinned-load scenario), use history.replaceState to silently update the browser URL bar so the Vue search component can find list_records=all when it builds the search URL
The developers half-implemented the pinning feature — they stored and read the pin setting correctly, but never handled the all tab case in the controller, and never ensured the browser URL reflected the active state. Two files, two small fixes, problem solved.
Point of clarification in the code:
Add the character "" after 'list_records')) and then add "" before @endif
UGH trying again ...
Point of clarification in the code:
after 'list_records')) add an opening pointy bracket then the word script then a closing pointy bracket. Before @endif add an opening pointy bracket then a forward slash then the word script then a closing pointy bracket
Showing 1 to 7 of 7 discussions