Acq: general search can't always find invoices

Bug #927685 reported by Lebbeous Fogle-Weekley
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Undecided
Lebbeous Fogle-Weekley
2.0
Won't Fix
Undecided
Unassigned
2.1
Won't Fix
Undecided
Unassigned
2.2
Fix Released
Undecided
Unassigned

Bug Description

Observed by Ben Ostrowsky and Bill Erickson, affecting Evergreen 2.0+:

If you have an invoice that is related to a purchase order only via invoice *items* (which in Evergreen correspond to misc charges, taxes, etc) and not through any invoice *entries* (which correspond to lineitems - books and book-like things), then you won't see that invoice when using the Acquisitions -> General Search and searching for invoices by a field like Purchase Order ID.

I will refactor the core query used by Acq General Search to find invoices by any of their possible relationships to other Acq objects, rather than exclusively via the acq.invoice_entry table.

Tags: pullrequest
Revision history for this message
Lebbeous Fogle-Weekley (lebbeous) wrote :

Here's a solution. Testing appreciated.

    Acq: improve General Search's ability to find invoices

    Invoices in Evergreen have complex relationships with other items. They
    can be related to lineitems (and ultimately POs and selection lists) by
    invoice *entries*, or to PO items (and ultimately etc etc) by invoice
    *items*, or directly to purchase orders by either of the above mentioned
    acq.invoice_{entry,item} objects.

    This should make general search more able to find invoices related to
    other objects whose fields you might search against in Acquistions
    General search.

    Here's a diagram that I created to help me think about how to write
    these joins:

    https://docs.google.com/drawings/d/15ExkiYvq0skfobbocvPWxwdZkb7aykEZpLGfbP9P

    At Bill Erickson's suggestion, I wound up putting the joins into an IDL view
    ("acqus") rather than trying to express them in JSON query, which was turnin
    into a real time sink.

    To prevent this change from making Acq General Search slower than it
    was, I've also added indices on all the foreign keys used in the IDL
    view, so that the joins should be as fast as possible.

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/senator/lp-927685

tags: added: pullrequest
Revision history for this message
Lebbeous Fogle-Weekley (lebbeous) wrote :

The google docs link above was cut off. Here's the whole thing: https://docs.google.com/drawings/d/15ExkiYvq0skfobbocvPWxwdZkb7aykEZpLGfbP9PL04/edit

Revision history for this message
Lebbeous Fogle-Weekley (lebbeous) wrote :

Heads up if you've already fetched that branch in the past 10 minutes; just force-pushed small corrections.

Revision history for this message
Bill Erickson (berick) wrote :

Tested and signed off on the main commit. I've also pushed a follow up commit which fixes the jump-to-invoices button in the PO page. Both commits can be found in working/collab/berick/lp-927685

Changed in evergreen:
status: New → In Progress
Changed in evergreen:
status: In Progress → New
milestone: 2.2.0alpha2 → 2.2.0beta1
Revision history for this message
Mike Rylander (mrylander) wrote :

Merged to master!

Revision history for this message
Mike Rylander (mrylander) wrote :

However, 2.1 has merge conflicts. Leaving it in progress as a result.

Changed in evergreen:
milestone: 2.2.0beta1 → none
status: New → In Progress
Revision history for this message
Lebbeous Fogle-Weekley (lebbeous) wrote :

Lost track of this for a while, but bug #983195 addresses problems in the code that was merged to master but never merged to 2.1 and 2.0.

I am marking this bug as wontfix for 2.0 and 2.1, and will fix everything all at once on bug #983195.

Changed in evergreen:
status: In Progress → Fix Committed
Ben Shum (bshum)
Changed in evergreen:
status: Fix Committed → Fix Released
milestone: none → 2.2.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.