Bug 14669 - Search orders by managing library
Summary: Search orders by managing library
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Katrin Fischer
QA Contact: Testopia
URL: /cgi-bin/koha/acqui/histsearch.pl
Keywords: Academy
Depends on:
Blocks: 29298
  Show dependency treegraph
 
Reported: 2015-08-10 22:29 UTC by Nicole C. Engard
Modified: 2021-10-21 09:43 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00
Circulation function:


Attachments
Bug 14669: Add search option for managing library to orders search (8.14 KB, patch)
2019-04-06 16:20 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14669: Add search option for managing library to orders search (8.09 KB, patch)
2019-05-11 21:09 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14669: Add search option for managing library to orders search (8.08 KB, patch)
2019-06-02 07:59 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14669: Add search option for managing library to orders search (8.10 KB, patch)
2019-08-18 09:04 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 14669: Add search option for managing library to orders search (8.87 KB, patch)
2019-10-03 12:21 UTC, Alex Sassmannshausen
Details | Diff | Splinter Review
Bug 14669: Add search option for managing library to orders search (8.92 KB, patch)
2019-10-03 12:26 UTC, Alex Sassmannshausen
Details | Diff | Splinter Review
Bug 14669: Add search option for managing library to orders search (8.98 KB, patch)
2019-10-04 07:50 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 14669: (RM follow-up) Ensure updated include compiles (1.23 KB, patch)
2019-10-09 06:31 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nicole C. Engard 2015-08-10 22:29:32 UTC
It would be nice to do an order search by branch.
Comment 1 Laura Horgan 2019-03-15 19:58:25 UTC
We have several funds and accounts and would also be interested in a search by branch as we are a multicampus library
Comment 2 Katrin Fischer 2019-04-06 16:20:17 UTC Comment hidden (obsolete)
Comment 3 Katrin Fischer 2019-05-11 21:09:12 UTC Comment hidden (obsolete)
Comment 4 Katrin Fischer 2019-05-11 21:10:22 UTC
Rebased and fixed authorship (me, not kohadev-koha!)
Comment 5 Caroline Cyr La Rose 2019-05-22 13:36:47 UTC
Not sure if it's me or the patch, but when I try to apply, I get this message

Traceback (most recent call last):
  File "/usr/local/bin/git-bz", line 2671, in <module>
    do_apply(*args)
  File "/usr/local/bin/git-bz", line 1734, in do_apply
    attachmentdata=True)
  File "/usr/local/bin/git-bz", line 1472, in load
    bug._load(bug_reference.id, attachmentdata)
  File "/usr/local/bin/git-bz", line 1228, in _load
    response = self.server.send_request("GET", url)
  File "/usr/local/bin/git-bz", line 998, in send_request
    cookies = self.get_cookie_string()
  File "/usr/local/bin/git-bz", line 991, in get_cookie_string
    self.cookies = get_bugzilla_cookies(host)
NameError: global name 'host' is not defined
Comment 6 Katrin Fischer 2019-06-02 07:59:30 UTC
Hm, this is a little strange - patch applies cleanly for me. Just uploading it again to make sure!
Comment 7 Katrin Fischer 2019-06-02 07:59:52 UTC Comment hidden (obsolete)
Comment 8 Liz Rea 2019-06-03 15:06:18 UTC
Hi Katrin,

This works but it has a QA tool failure that I don't understand because it seems to be set up correctly:

 FAIL	koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc
   FAIL	  valid_template
		options_for_libraries: not found

IT may be a false positive, if it is just let me know and I'll sign it off.

Cheers,
Liz
Comment 9 Katrin Fischer 2019-08-18 09:03:00 UTC
(In reply to Liz Rea from comment #8)
> Hi Katrin,
> 
> This works but it has a QA tool failure that I don't understand because it
> seems to be set up correctly:
> 
>  FAIL	koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc
>    FAIL	  valid_template
> 		options_for_libraries: not found
> 
> IT may be a false positive, if it is just let me know and I'll sign it off.
> 
> Cheers,
> Liz

After some checking I believe it's a false positive:

The BLOCK options for libraries is defined in html_helpers.inc

koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc:[% BLOCK options_for_libraries %]

doc-head-close.inc includes html_helpers.inc:

koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc:[% PROCESS 'html_helpers.inc' %]

And koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt includes doc_head-close.inc.

... and the file koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc is included in histsearch.tt

I think the test might not cope well with all this.

I am still amending the patch to make a slight change: In the first version the filter preselected on the user's current branch which will limit search results and change behaviour. I have now changed it to select 'All libraries' by default.
Comment 10 Katrin Fischer 2019-08-18 09:04:06 UTC
Created attachment 92343 [details] [review]
Bug 14669: Add search option for managing library to orders search

Currently the order search can't be limited by managing library.
The patch adds the search option to the order history search form
and a column for the managing library to the search results table.

To test:
- Create some baskets with orders
  - Set managing library for some, but also have some without
- Apply patch
- prove t/db_dependent/Acquisition.t
- Go to Aquisition > Orders search tab on top > Advanced search link
- Search for orders without limiting
  Orders with and without managing library set should show up
- Limit search to a specific managing library
- Verify results match expectations
Comment 11 Katrin Fischer 2019-08-18 09:04:52 UTC
Owen, just to make sure, could you maybe verify my conclusions about the includes/QA failure?
Comment 12 Owen Leonard 2019-08-23 23:38:56 UTC
(In reply to Katrin Fischer from comment #11)
> Owen, just to make sure, could you maybe verify my conclusions about the
> includes/QA failure?

I agree that it looks like a false positive.

When the page is displaying search results and the form is in the sidebar is it possible to preselect the managing library the user just searched for? To be consistent it should remember their selection.
Comment 13 Alex Sassmannshausen 2019-10-02 14:52:20 UTC
Tests pass, but filtering does not seem to work.

I've created baskets with orders.  One is managed by centerville the other by none.

Standard search returns both results, but search filtered by managed by centerville also returns both.  I would expect to only return those managed by centerville.

Managing library is also not displayed in the basket overview datatable.

Hth,

Alex
Comment 14 Alex Sassmannshausen 2019-10-03 12:21:16 UTC
Created attachment 93583 [details] [review]
Bug 14669: Add search option for managing library to orders search

Currently the order search can't be limited by managing library.
The patch adds the search option to the order history search form
and a column for the managing library to the search results table.

To test:
- Create some baskets with orders
  - Set managing library for some, but also have some without
- Apply patch
- prove t/db_dependent/Acquisition.t
- Go to Aquisition > Orders search tab on top > Advanced search link
- Search for orders without limiting
  Orders with and without managing library set should show up
- Limit search to a specific managing library
- Verify results match expectations
Comment 15 Alex Sassmannshausen 2019-10-03 12:26:31 UTC
Created attachment 93587 [details] [review]
Bug 14669: Add search option for managing library to orders search

Currently the order search can't be limited by managing library.
The patch adds the search option to the order history search form
and a column for the managing library to the search results table.

To test:
- Create some baskets with orders
  - Set managing library for some, but also have some without
- Apply patch
- prove t/db_dependent/Acquisition.t
- Go to Aquisition > Orders search tab on top > Advanced search link
- Search for orders without limiting
  Orders with and without managing library set should show up
- Limit search to a specific managing library
- Verify results match expectations

Signed-off-by: Alex Sassmannshausen <alex@komputilo.eu>
Comment 16 Nick Clemens (kidclamp) 2019-10-04 07:50:42 UTC
Created attachment 93669 [details] [review]
Bug 14669: Add search option for managing library to orders search

Currently the order search can't be limited by managing library.
The patch adds the search option to the order history search form
and a column for the managing library to the search results table.

To test:
- Create some baskets with orders
  - Set managing library for some, but also have some without
- Apply patch
- prove t/db_dependent/Acquisition.t
- Go to Aquisition > Orders search tab on top > Advanced search link
- Search for orders without limiting
  Orders with and without managing library set should show up
- Limit search to a specific managing library
- Verify results match expectations

Signed-off-by: Alex Sassmannshausen <alex@komputilo.eu>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 17 Martin Renvoize (ashimema) 2019-10-08 13:16:38 UTC
Nice work!

Pushed to master for 19.11.00
Comment 18 Martin Renvoize (ashimema) 2019-10-09 06:31:24 UTC
Created attachment 93907 [details] [review]
Bug 14669: (RM follow-up) Ensure updated include compiles

The introduction of `options_for_libraries` in the filter-orders include
template requires that we process 'html_helpers' within the file to
ensure it always compiles.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>