Bug 6721

Summary: Add Basket number and Invoice number search
Product: Koha Reporter: Srdjan Jankovic <srdjan>
Component: AcquisitionsAssignee: Srdjan Jankovic <srdjan>
Status: CLOSED FIXED QA Contact: Bugs List <koha-bugs>
Severity: enhancement    
Priority: PATCH-Sent (DO NOT USE) CC: chris, katrin.fischer, koha.sekjal, nengard, paul.poulain, robin
Version: 3.6   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7085
Change sponsored?: Sponsored Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 6807    
Attachments: patch
Bug 6721 - improve searching in the acquisitions system
[SIGNED-OFF] Bug 6721 - improve searching in the acquisitions system

Description Srdjan Jankovic 2011-08-15 00:00:38 UTC
* To the Acquisitions quick Order Search bar add a plus sign (like on patron search) that expands to show two new search boxes
          o Basket:  searches aqbasket.basketname or aqbasket.basketno
          o Invoice:  searches aqorder.booksellerinvoicenumber
    * To the Acquisitions Advanced Order Search (/cgi-bin/koha/acqui/histsearch.pl) add two more search options
          o Basket:  as defined above
          o Invoice: as defined above
    * The search should return Orders from both open and closed baskets
    * The search should return Orders that have both been received and are yet unreceived.
    * Searches terms should mix together using Boolean “AND”

How to test:

    * Enter six baskets, “BasketA” through “BasketF” for a specific vendor with two items in each basket
          o Close BasketA though BasketC
          o Leave one the other three open
          o Note the Basket numbers on all six
    * Receive one item each of BasketA and BasketD on “Invoice1”
    * Receive two items each of BasketB and BasketE on “Invoice2”
    * Search for each basket name using the quick order search
          o The two orders for each basket searched should be returned every time
    * Repeat the searches above, only with the appropriate basket number instead of basket name
          o Results should be the same
    * Search for “Invoice1”
          o Should return both Orders received on Invoice1
    * Search for “Invoice2” and BasketB
          o Should return both Orders from BasketB received on Invoice2
    * Search for “Invoice2” and a title of one of the items ordered in BasketB
          o Should return only that Order
    * Search for “BasketA” and one of the titles ordered in BasketA
          o Should return only that title
Comment 1 Srdjan Jankovic 2011-08-16 05:36:15 UTC Comment hidden (obsolete)
Comment 2 Nicole C. Engard 2011-08-16 10:47:27 UTC
A few tests show some errors.  

#1 - the plus sign isn't available on the search results so I can't redo a search: cgi-bin/koha/acqui/histsearch.pl

#2 - the advanced search link on the search results doesn't do anything but show me the results again: cgi-bin/koha/acqui/histsearch.pl 

#3 - after doing a basket or invoice search clicking 'advanced search' from anywhere brings me back to the last results instead of to the search box .. I can't get back to the search box no matter what I try.  See here (this recorded after I did a search): http://screencast.com/t/bxjNDiWQnC

#4 - I got trailing whitespace errors when I applied the patch:

Applying: bug_6721: Acquisitions: basket and invoice search
/home/nengard/kohaclone/.git/rebase-apply/patch:41: trailing whitespace.
params:  
/home/nengard/kohaclone/.git/rebase-apply/patch:48: trailing whitespace.
  booksellerinvoicenumber 
/home/nengard/kohaclone/.git/rebase-apply/patch:475: trailing whitespace.
    
/home/nengard/kohaclone/.git/rebase-apply/patch:488: trailing whitespace.
    
warning: 4 lines add whitespace errors.
nengard@debian:~/kohaclone$
Comment 3 Srdjan Jankovic 2011-08-16 13:06:35 UTC
#1 - acqui/histsearch.pl does not have the same top search as the acquisition home page. I can add it there too, but I don't see the point - that page is actually the search expanded, so new search boxes are present on the page itself

#2 #3 is how it used to behave. I can change that while I'm at it, just please tell me what do you want to see there - search criteria selection before/after the results, or just the form when clicking on the advanced search link?

#4 I have no idea what it is, will consult with someone
Comment 4 Nicole C. Engard 2011-08-16 15:10:56 UTC
I guess with all three of the first things I said I was trying to redo the search and couldn't get to the blank search for to do that.  So I was trying to find the plus or the blank form so I could do a new search from the results.  

Does that make sense?

#4 is a patch style thing and not something I think that causes failed QA comments - but thought I should mention it. 

Basically we need a way to search again and see the blank search form instead of the search results over and over again.
Comment 5 Robin Sheat 2011-08-24 02:06:46 UTC
The search box the hist page uses is only used by that, and virtually identical to the regular one. So now it uses the regular one. That'll address #1.
Comment 6 Robin Sheat 2011-08-24 02:07:28 UTC
I don't think the advanced search link should give you results immediately. That's pretty strange.
Comment 7 Robin Sheat 2011-08-24 02:28:25 UTC Comment hidden (obsolete)
Comment 8 Robin Sheat 2011-08-24 02:29:14 UTC
New version attached that hopefully addresses the issues here.
Comment 9 Nicole C. Engard 2011-08-24 15:41:32 UTC
Created attachment 5117 [details] [review]
[SIGNED-OFF] Bug 6721 - improve searching in the acquisitions system

This allows a basket to be searched for by name or invoice number from
anywhere in the acquisitions system. It is accessible by clicking on
"orders search", clicking the '[+]' and filling in the basket or invoice
no. fields.

Author:    Srdjan Jankovic <srdjan@catalyst.net.nz>
Author:    Robin Sheat <robin@catalyst.net.nz>
Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Comment 10 Nicole C. Engard 2011-08-24 15:42:09 UTC
There were still trailing whitespace errors, but I don't think those cause it to fail QA so I have signed off.
Comment 11 Ian Walls 2011-08-25 17:18:06 UTC
Code is largely additive, and I've read through the portions that reimplement existing functionality.  Patch is cleanly rewritten and on-topic.  Marking as Passed QA.
Comment 12 Chris Cormack 2011-08-26 02:46:20 UTC
Pushed please test
Comment 13 Paul Poulain 2011-10-06 16:25:23 UTC
I think i've found a bug, consequence of this patch.
If I search in the breadcrumb, on top, there are results
If I open "advanced search", I can't get any result

I've investigated, and I think it's because of 
if (defined $title) { ... add WHERE }

title is always defined, even if it's empty.
(same for author & bookseller name)

Ca others reproduce this behaviour ?

In this case, we should probably just have if ($title)
(tested quickly, seems to solve the problem)
Comment 14 Robin Sheat 2011-10-06 22:33:11 UTC
the if (defined $title) was in the original code too, does it occur there?

I can't reproduce it with a quick experiment:

1) go to acquisitions
2) in the search form, click 'Orders Search' and then 'Advanced Search'
3) put a value in the Vendor field (e.g. 'a')
4) hit search, and I get plenty of results.

Does this differ from what you were trying?
Comment 15 Paul Poulain 2011-10-07 08:29:55 UTC
Very strange:
* if I enter a vendor or a title from the search tab on top of the screen (Orders Search), both work
* if I reach the koha/acqui/histsearch.pl and enter the same values, I can't get any result
* If I just remove the defined, I get results

Tested in english, so it's not a translation problem
Comment 16 Srdjan Jankovic 2011-10-10 04:27:34 UTC
No idea. The patch is in the master, and I got results on koha/acqui/histsearch.pl for vendor
Comment 17 Katrin Fischer 2011-10-30 23:53:28 UTC
Invoice and basket number/name search work on current master/3.6.
The problems Paul notes with advanced order search should be solved with the patch for bug 7085.