Filter invoices by library doesn't work in invoices.pl Some invoices will be listed but not all the applicable invoices. An easy way to reproduce this problem is to list all the invoices within a date range, make a note of the invoices for one particular library, now filter your list by that library and you will notice that all the invoices you expect are listed.
Can you confirm the invoices that are missing are linked with a basket that has the authorisedby column not NULL?
The missing invoices are all linked to a basket. Baskets have authorisedby column = 0. What is the significance of authorisedby for this filter?
When the "library" filter on the invoice page is set, a JOIN is done on the borrowers table using the branchcode of this patron. And aqbasket.authorisedby is the borrowernumber of the librarian who created the basket. BUT if the patron is removed, the column will be set to NULL, and the JOIN will not return the invoices created by this (now deleted) patron. There is a "Managing library" (aqbasket.branch) at basket level, maybe we should use it instead of borrowers.branchcode.
Hm, the managing library was introduced later - which could explain why it was not used in the first place. In my experience libraries often forget to set it, but it would be more reliable in this case. Daphne, would it work for your data? The meaning of authorised_by in several places has led us to migrate with a migration acq user for a valid borrowernumber, which helps, but is not a real good solution.
Managing Library might be more straightforward but my problem is arising on baskets created from EDI Quotes or the GOBI API so either way we are going to be dependent on data supplied by the vendor or an update when the basket is created.
Could we maybe do both, a search option for managing library or a fallback on managing library for the search option?