Jonathan Druart [Wed, 20 Jan 2021 10:16:48 +0000 (11:16 +0100)]
Bug 27466: Don't use set_preference from updatedatabase.pl
We must never use subroutines or methods from updatedatabase.pl!
Having it using C4::Context->set_preference will call
Koha::Config::Syspref->store then C4::Log::logaction and finally
Koha::Logger->get which will need the log4perl configured correctly
(which is not necessary the case when you upgrade).
Test plan:
git checkout ed3e4540d73c1c3009375ad339e09a2e676fa1bd (20.06.00.022)
reset_all
Set the value of QuoteOfTheDay to 0
git checkout bug_27466 (master + this patch)
updatedatabase
=> QuoteOfTheDay is an empty string
git checkout ed3e4540d73c1c3009375ad339e09a2e676fa1bd (20.06.00.022)
reset_all
Set the value of QuoteOfTheDay to 1
git checkout bug_27466 (master + this patch)
updatedatabase
=> QuoteOfTheDay is set to "opac"
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Kyle M Hall [Wed, 20 May 2020 13:30:45 +0000 (09:30 -0400)]
Bug 25552: Add missing Claims Returned option to MarkLostItemsAsReturned
Marking an item as a return claim checks MarkLostItemsAsReturned to see if claim_returned is a value in MarkLostItemsAsReturned.
However, this option was never added to MarkLostItemsAsReturned so an a return claim can never be automatically removed from the patron record, even if they wanted such behavior.
Test Plan:
1) Apply this patch
2) Restart all the things
3) Note the new return claims option on MarkLostItemsAsReturned in the system preferences
Signed-off-by: Marti Fyerst <mfuerst@hmcpl.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Petro Vashchuk [Mon, 25 Jan 2021 15:37:37 +0000 (17:37 +0200)]
Bug 27549: "use of uninitialized value" warning on renew.pl
On the beginning we have empty "barcode" parameter for this form, but that not taken into account in regular expression warning emitted: "Use of uninitialized value $barcode in substitution (s///) at /usr/share/koha/intranet/cgi-bin/circ/renew.pl line 47." in renew.pl
Fixed by making $barcode to become an empty string by default.
To reproduce:
1) Head over to the "Circulation -> Renew" page.
2) Check intranet-error.log there will be a warning "Use of uninitialized value $barcode in substitution (s///) at /usr/share/koha/intranet/cgi-bin/circ/renew.pl line 47".
3) Apply the patch, refresh the "Renew" page.
4) Ensure that the new "use of uninitialized value" warnings didn't appear in the console.
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Petro Vashchuk [Mon, 25 Jan 2021 15:35:18 +0000 (17:35 +0200)]
Bug 27548: "use of uninitialized value" warning on branchoverdues.pl
On the beginning we have empty "location" parameter for this form,
but that not taken into account in comparison and undef warning emitted:
"Use of uninitialized value $location in string eq at
/usr/share/koha/intranet/cgi-bin/circ/branchoverdues.pl line 72" in branchoverdues.pl
Fixed by adding pre-check for $location.
To reproduce:
1) Head over to "Circulation ->Overdues with fines" page. Check
intranet-error.log where there will be many warnings
"Use of uninitialized value $location in string eq at /usr/share/koha/intranet/cgi-bin/circ/branchoverdues.pl line 72".
2) Apply the patch, refresh the "Overdues with fines" page.
3) Ensure that the new "use of uninitialized value" warnings didn't appear in the console.
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Petro Vashchuk [Sun, 24 Jan 2021 19:42:10 +0000 (21:42 +0200)]
Bug 27538: fix correlation of fields in Holds to Pull table
Bottom filtering row of "Holds to pull" table do not correlate to other
ones, columns diverged from "Call numbers" cell: it should be under
"Available call numbers" while it's under "Available barcodes", and so
on to the last cell (while number of cells still adjusted).
To reproduce:
1) Head to the Holds to Pull page, check that bottom filtering row
shifted to the left by one, starting from the "Call number"
column and don't correlate to the upper table (for example, "Call
numbers" cell should be under "Available call numbers" while it's
under "Available barcodes"), and so on for all cells till the end
of the filtering row.
2) Apply patch.
3) Refresh Holds to Pull page and ensure that all filtering row
columns correlate to other rows columns correctly.
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Nick Clemens [Fri, 29 Jan 2021 11:06:34 +0000 (11:06 +0000)]
Bug 27576: Don't show import recordds table after cleaning a batch
Currently if you clean a batch from the manage marc records page, the import records table appears with no items at the bottom of the screen
This is because we test for import_batch_id, we should also make sure we didn't just clean a batch
To recreate:
1 - Stage a batch for import
2 - Go to 'Manage staged records'
3 - 'Clean' the batch you just imported
4 - Note the empty table that appears at the bottom of the page
5 - Apply patch
6 - Repeat 1-3
7 - Note the table no longer appears
Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Lucas Gass [Tue, 12 Jan 2021 23:42:27 +0000 (23:42 +0000)]
Bug 27321: Make disabled DB columns clearly disabled visually
To test:
1. Apply patch and its dependency (bug 17364)
2. Rebuild the CSS (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client)
3. Go the system pref BorroweUnwantedFields
4. branchcode should cleary stand out as disabled (#cccccc)
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Owen Leonard [Fri, 29 Jan 2021 13:19:12 +0000 (13:19 +0000)]
Bug 27571: "Add to lists" on MARC and ISBD view of OPAC detail page doesn't open in new window
This page corrects the global click handler in the OPAC so that all
"addtoshelf" links will work correctly to trigger the popup window for
adding titles to a list.
To test, apply the patch and test the process of adding a title to a
list in the OPAC from various places:
Test both adding to an existing list and adding to a new list.
Everything should work correctly.
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Owen Leonard [Wed, 27 Jan 2021 12:48:57 +0000 (12:48 +0000)]
Bug 27561: Remove type attribute from script tags: Various templates
This patch replaces remaining instances of <script type="javascript"> in
templates with "<script>."
To test, apply the patch and check the changes to the template. Verify
that the changes look correct.
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Emmi Takkinen [Mon, 18 Jan 2021 09:20:06 +0000 (11:20 +0200)]
Bug 27430: Change password minimum value hint when patron category is changed
If patrons category is changed during add or edit password
minimum value doesn't change. This patch adds ajax call to
fix this.
To test:
1. Add password minimum length for patron
categories A and B.
2. Create a new patron with category A.
3. Change patrons category to B.
4. Note that password minimum value doesn't change
on hint text.
5. Apply patch.
6. Repeat patron creation, password minimum value
should now change correctly.
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Emmi Takkinen [Thu, 14 Jan 2021 12:39:08 +0000 (14:39 +0200)]
Bug 27430: Use password minimum length for patron category on password hint
Hint for password minimum length should use minimum length
set for patron category not "minPasswordLength" value.
To test:
1. Set "minPasswordLength" e.g. 6
2. Set "Patron" category minimum password length e.g. 4
3. Create new a patron.
4. Note that hint after password input field reads "Minimum
password length: 6"
5. Apply patch.
6. Hint should now read "Minimum password length: 4".
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 27330: (follow-up) Cleanup missed on bug 23843
This patch makes some cleanup missed on bug 23843. The catch condition
on the controller was copied and pasted from other controller and should
be avoided unless there's a known case that needs special handling.
Otherwise it will be catched by the $c->unhandled_exception call.
All the old mappings were inadvertedly kept in the controller as well as
the (unused) _to_api method.
The base class is also cleaned from unnecessary mappings. Only mapped
things need to be added.
To test:
1. Apply this patch
2. Run:
$ kshell
k$ prove t/db_dependent/api/v1/clubs_holds.t \
t/db_dependent/Koha/Club/Hold.t
=> SUCCESS: Tests pass!
3. Sign off :-D
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch puts the tests in line with the current codebase. Some bits
are passed through perltidy to aid readability...
To test:
1. Run:
$ kshell
k$ prove t/db_dependent/api/v1/clubs_holds.t
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
=> SUCCESS: Tests look more like the rest of the API tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Nick Clemens [Wed, 30 Sep 2020 12:52:28 +0000 (12:52 +0000)]
Bug 26578: Clean overdrive searches before passing to OD
This patch copies regex used in buildQuery to detect ccl code in queries, but here we adapt
it to remove any ccl signifiers to ensure correct results from OD
To test:
1 - Have OverDrive enabled and configured
2 - set UseAuthoritiesForTracings to "Don't use"
3 - Search in the catalog for a record
4 - From the details page for a record click on an author link
5 - Note the query in catalog is like 'au:"Whitford, Bradley."'
6 - Some overdrive catalogs will return records matching 'au:'
7 - Apply patch
8 - Reload the page, if there were spurious results before, they should now be gone
9 - Perform a search that returns overdrive results
10 - For a title in overdrive search koha with:
au:{Author} AND ti:{Title}
11 - Confirm overdrive results are returned
12 - Check the link to overdrive results and note query section is:
q=Author AND Title
Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Nick Clemens [Thu, 28 Jan 2021 18:56:39 +0000 (18:56 +0000)]
Bug 26298: Don't set too_many_items_to_process if equal to limit
In the code we prepare items for display if less than or equal to the pref, but we don't allow
the edit if greater than or equal to the pref. The second case should be only 'greater than'
To test:
1- Set MaxItemsToProcessForBatchMod to 1000
2- Go to Reports
3- Make a report for itemnumbers that will give you at least 1000 items (ex. SELECT itemnumber FROM items)
4- Save and run the report
5- In "Rows per page", choose 1000
6- Click on "Batch operations with 1000 visible records" > Batch item modification
7- Notice that the item modification form isn't there and that the message says "Too many items (1000): You are not allowed to edit more than 1000 items in a batch."
8- Apply patch
9- Restart all the things
10- Run the report again and display 1000 rows
11- Click on "Batch operations with 1000 visible records" > Batch item modification
12 - Sucess!
Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Lucas Gass [Thu, 17 Dec 2020 15:52:52 +0000 (15:52 +0000)]
Bug 27261: exlude branchcode from PatronSelfRegistrationBorrowerUnwantedField
To test:
1 - Alter PatronSelfRegistrationBorrowerUnwantedFieldand select branchcode
2 - Attempt to self register via the OPAC
3 - Kabloom, internal server error
4 - Apply patche
5 - Alter the preference again
6 - Note that branchcode is unchecked and disabled
7 - Save the pref
8 - Attempt to self register again
9 - It succeeds
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Fridolin Somers [Thu, 17 Dec 2020 08:05:25 +0000 (09:05 +0100)]
Bug 17364: (follow-up) Do not check excluded fields
When clicking on "Select all" excluded fields are selected.
Even if they are not saved into preference, this is disturbing.
Test plan :
1) Edit BorroweUnwantedFields system preference
2) Click "Select all"
3) See that branchcode is not selected
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Nick Clemens [Fri, 6 Nov 2020 11:17:56 +0000 (11:17 +0000)]
Bug 17364: Add ability to exclude some columns from selection for system preferences
Bug 22844 Added the option to provide a modal for selecting database columns for system preferences
Some system preferences are limited to a subset of the columns allowed. For instance, setting branchcode
in BorrowerUnwantedFields prevents adding new patrons
This patch allows for defining exclusions in the .pref file
To test:
1 - Alter BorroweUnwantedFields and select branchcode
2 - Attempt to add a new patron
3 - Get a message like "Something went wrong. Check the logs"
4 - Apply patches
5 - Alter the preference again
6 - Note that branchcode is unchecked and disabled
7 - Save the pref
8 - Add a patron
9 - It succeeds
Kyle M Hall [Fri, 11 Dec 2020 12:13:12 +0000 (07:13 -0500)]
Bug 27204: Fix end boundary index, never return results for non-existant accountlines
There are two primary issues I've identified with requesting line items
for fees via SIP:
1) The end boundary is incorrect. For example, if send a request with a
BP ( starting item) of 1, and a BQ (end item) of 1, I should get just
the first item. Instead I will get two items
2) Our SIP server does not check bounds. For example, if I have 3 fines,
but I send a BP of 1 and a BQ of 5, I will get back 5 AVs, two of
them being "empty" because the patron only has 3 accountlines!
Test Plan:
1) Apply the unit test patch
2) prove t/db_dependent/SIP/Patron.t
3) Note the failures
4) Apply the second patch
5) prove t/db_dependent/SIP/Patron.t
6) All tests should pass!
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Kyle M Hall [Fri, 11 Dec 2020 12:13:06 +0000 (07:13 -0500)]
Bug 27204: Add unit tests for fine_items
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Wed, 27 Jan 2021 09:22:27 +0000 (10:22 +0100)]
Bug 27530: Set correct dateofbirth for 'C'
Categories B, J, K and YA have a upper age limit of 17 years.
We are setting the dateofbirth to today - 15 years to prevent juvenils
to be 70!
Note that DATE_SUB is a MySQLism, but there is no way to be portable
here.
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Wed, 27 Jan 2021 09:17:57 +0000 (10:17 +0100)]
Bug 27530: Set dateexpiry to 2099 in sample patrons
To prevent them to be expired.
Note that the last patron is kept expired.
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Wed, 20 Jan 2021 11:09:30 +0000 (12:09 +0100)]
Bug 27450: Remove password from the mandatory fields when editing details
When a patron edit their personal details at the OPAC, the password must
be removed from the mandatory fields
Test plan:
0 - Don't apply the patch
1 - Set PatronSelfRegistrationBorrowerMandatoryField to require password
2 - Create or sign in as a patron on the opac
3 - Click 'Your personal details'
4 - Attempt to edit
5 - Save changes
=> They are rejected because not all required fields are populated
6 - Apply the patch
7 - Repeat 3 to 5
=> details are saved successfully
8 - Test the self registration feature and confirm that the password is
required
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Nick Clemens [Thu, 28 Jan 2021 13:58:14 +0000 (13:58 +0000)]
Bug 27554: Clarify and add tests for update_category_to
This patch adds a comment to the existing tests, clarifying what they test, and verifying the expected patron is affected. The
original test should be broken by 26307 when the behvaiour is prevented
I additionally add a test for 'too old'
To test:
1 - Apply patch
2 - Prove tests, they should pass
3 - Verify the comments make sense
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
JD amended patch: behvaiour ==> behaviour
and add more info to the commit title
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 27580: Handle NULL values correctly in Koha::Items->filter_by_visible_in_opac
This patch fixes the internally used query so it doesn't consider NULL
values as IN the set.
To test:
1. Apply the regression tests patch
2. Run:
$ kshell
k$ prove t/db_dependent/Koha/Items.t
=> FAIL: Tests fail :-/
3. Apply this patch
4. Repeat 2
=> SUCCESS: tests pass!
5. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This test makes all the generated sample items have undef copynumber,
and all rules are added copynumber => [ 2 ] on the tests as
suggested by Andrew on his failing example.
The tests are expected to pass. i.e. copynumber is clearly not equal to
2, so those items shouldn't be hidden.
To test:
1. Apply this patch
2. Run:
$ kshell
k$ prove t/db_dependent/Koha/Items.t
=> FAIL: Tests fail! undef is considered in [ 2 ]
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Mon, 1 Feb 2021 09:35:12 +0000 (10:35 +0100)]
Bug 25670: Fix random failure on Orders.t
It has failed at least 3 times:
# Failed test 'The right order is returned'
# at t/db_dependent/Koha/Acquisition/Orders.t line 153.
# got: '50'
# expected: '49'
# Failed test 'The right order is returned'
# at t/db_dependent/Koha/Acquisition/Orders.t line 154.
# got: '49'
# expected: '50'
# Looks like you failed 2 tests of 6.
I cannot manage to make it fail locally
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Wed, 6 Jan 2021 09:40:12 +0000 (10:40 +0100)]
Bug 27251: Don't hide the table on delete if empty
If we filtered the result, delete the only row displayed then the table
was hidden. This is a nice behaviour, especially if there was no filter.
However we must show it again if the filters are removed.
I am suggesting to simply to not hide the table and avoid adding more JS
code to deal with this very specific use case.
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Wed, 16 Dec 2020 11:34:43 +0000 (12:34 +0100)]
Bug 27251: Rewrite QOTD with the Koha REST API
This patch replace the QOTD editor with our new way to CRUD the
adminitration page (like libraries and STMP servers)
Test plan:
Play with the QOTD by adding, removing, updating quotes
Try to find bugs :)
Bug 27251: Fix capitalization
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch adds a route to fetch the items for a biblio. It relies
entirely on already existing methods.
To test:
1. Use your favourite REST tool
2. Play with the new route.
=> SUCCESS: It works as expected!
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
As $c->objects->search doesn't consider path params anymore, there's no
need to manually tweak the query parameters.
To test:
1. Run:
$ kshell
k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. Sign off :-D
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 27034: Do not use path parameters on building the query
This patch simply removes the use of path parameters on building the
query in $c->objects->search.
The sample usage in the original tests considers a specific use case in
which the 'nested' resultset has the path param in its attributes:
GET /patrons/:patron_id/holds
In this case, $c->objects->search would be passed a Koha::Holds
resultset into which it would build a query. As the patron_id param can
be mapped into a Koha::Hold attribute, this works.
We don't actually use this approach in code. What we do is searching for
the patron, and properly return a 404 if the patron doesn't exist [1]. If it
exists, we actually call $patron->holds to get the related resultset, so
there's no gain in having the path param on the query afterwards.
That said, if we wanted to build:
GET /holds/:hold_id/pickup_locations
as the latter is a calculated value, from a resultset that doesn't
actually include a (mapped to some attribute) hold_id attribute, there's
no way to use it if it will automatically add the hold_id to the
pickup_locations resultset. It will give errors about hold_id not being
an attribute of Koha::Library (Branches.pm actually).
So this patch removes the automatic use of path parameters in
$c->objects->search. We can extract them in the controller and add them
to the passed resultset if required. But this patch removes a constraint
we have for building routes controllers right now.
[1] If we didn't return the 404, and we just passed a fresh Koha::Holds
resultset to be feeded with the patron_id, we would always return an
empty array in cases where the patron doesn't exist. This would be
misleading, but I'm open to discuss it. Design-wise.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Mazen Khallaf [Thu, 21 Jan 2021 01:40:50 +0000 (01:40 +0000)]
Bug 27486: Rename system preference delimiter to CSVDelimiter
Test Plan:
1. Go to Administration
2. Go to System Preferences
3. Find 'delimiter' (note the name)
4. Apply patch
5. Repeat step 1 and 2
6. Find 'CSVDelimiter' (note the name)
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
James O'Keeffe [Thu, 21 Jan 2021 05:23:31 +0000 (05:23 +0000)]
Bug 27487: Rename system preference reviewson to OPACComments
This patch renames the reviewson system pref to OPACComments
Test Plan:
1. In Koha Administration, search for the reviewson system preferance
2. Note the presence of the reviewson system preferance
3. Apply the patch and run updatedatabase.pl
4. Repeat steps 1 and 2. The reviewson preferenace should be gone
5. Seach for and note the OPACComments system preferance
6. Ensure that the OPACComments system preferance operates correctly, as
if it were reviewson
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
https://bugs.koha-community.org/show_bug.cgi?id=27484
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Owen Leonard [Fri, 15 Jan 2021 15:41:39 +0000 (15:41 +0000)]
Bug 27440: Improve structure and style of result toolbars in the OPAC
This patch makes markup and CSS changes to areas of the OPAC classed
with "selections-toolbar," an area of controls found at the top of some
lists of titles: The cart, search results, search history, lists, and
suggestions.
To test, apply the patch and rebuild the staff client CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).
- Perform a search in the OPAC. On the search results page, confirm that
the various controls work correctly:
- With OpacHighlightedWords enabled, hightlight and unhighlight links
- Select all and clear all links
- Selecting one or more checkboxes should enable the "Select titles
to..." menu.
- Test that adding items to the cart and lists works correctly.
- Test that placing multiple holds work.
- Test that tagging multiple items works.
- From the search results page, add multiple items to the cart.
- Open the cart and confirm that the the controls described above
continue to work correctly.
- Open the search history page, confirm that the toolbar controls work
correctly for all four categories: Current session catalog searches;
previous session catalog searches; current session authority searches;
previous session authority searches.
- On the purchase suggestions page, confirm that "select all" and "clear
all" work, and that deleting multiple suggestions from the toolbar
link works.
- On the list contents page test the same controls: selection,
multi-hold, tagging, and "Remove from list."
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Owen Leonard [Fri, 22 Jan 2021 15:20:00 +0000 (15:20 +0000)]
Bug 26755: Make the guarantor search popup taller
This patch changes the dimensions of the popup window in which
guarantors are chosen during the patron edit process.
The patch also removes an obsolete function delcaration for "Dopop"
which is unused.
To test, apply the patch and open a "child" type patron account for
editing.
Click the "Add guarantor" button. This should trigger a popup window.
Eyeball the size of the window, you'll be able to tell that it is
exactly 800 pixels wide.
Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Owen Leonard [Sat, 26 Sep 2020 19:44:25 +0000 (19:44 +0000)]
Bug 21851: Improve style of sidebar forms
This patch makes minor changes to staff client CSS in order to improve
the style of forms in sidebars. It adjusts the style of nested fieldsets
and gives more room to list items (and the form fields they contain).
To test, apply the patch and regenerate the staff client CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client)
- View pages with forms in the left-hand sidebar, especially:
- Circulation -> Overdues
- Patrons -> Patrons search results
- Acquisitions -> Invoices
- Acquisitions -> Order search results
- Tools -> Tags
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Owen Leonard [Thu, 28 Jan 2021 12:45:09 +0000 (12:45 +0000)]
Bug 27493: (follow-up) Remove redundant class
This patch modifies the templates so that instances of "class='select
selectcol' are replaced with "class='selectcol'". I could find no
instances of the "select" class being used in CSS or JS.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Wed, 20 Jan 2021 12:42:58 +0000 (12:42 +0000)]
Bug 27493: Add styling for hidden columns
I'm sure adding a 'hidden' class to a table column used to remove it
from display entirely.. seems that's no longer the case so we add the
CSS back in here.
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Wed, 20 Jan 2021 09:19:21 +0000 (09:19 +0000)]
Bug 27493: Set column width for checkbox only columns
This patch updates the global OPAC css such that selectcol type columns
in tables are fixed width at 1ch to ensure these columns do not get
unneccessarily wide.
To test, apply the patch and rebuild the OPAC CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).
Test plan
PAGES: opac-basket, opac-messaging, opac-results, opac-search-history,
opac-suggestions and opac-tags.
1/ Notice that the column containing a checkbox on each of the above
pages is of a mised width, often much larger than required
2/ Apply the patch and rebuild the css file as described above
3/ Notices that the column containing a checkbox on each fo the above
pages is now of a standard, sensible, width.
4/ Signoff
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Eden Bacani [Tue, 19 Jan 2021 21:21:51 +0000 (21:21 +0000)]
Bug 27395: Add a warning to PatronSelfRegistrationDefaultCategory
This patch adds a warning to the PatronSelfRegistrationDefaultCategory system
preference to not use a regular patron category for self registration.
If a regular patron category code is used and the cleanup_database cronjob is setup
to delete unverified and unfinished OPAC self registrations, it permanently and
and unrecoverably deletes all patrons that have registered more than
PatronSelfRegistrationExpireTemporaryAccountsDelay days ago.
It also removes unnecessary apostrophes at the end of two self registration
and modification system preference descriptions.
Test plan:
1. Apply the patch.
2. Check that the warning message for the PatronSelfRegistrationDefaultCategory
system preference is clear and makes sense.
3. Sign off!
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Amy King [Thu, 21 Jan 2021 22:41:09 +0000 (22:41 +0000)]
Bug 20238: Display description of ITEMTYPECAT in search category
When adding or editing item types (Koha administration > Basic
parameters > Item types) the drop down list currently displays
the ITEMTYPECAT authorized value description. However, on the
item types page the authorized value is displayed in the search
category column.
This enhancement changes the item types page so that the search
category column displays the authorized value's description
instead of the authorized value code.
Test plan:
1. Go to Staff interface home page > Koha administration > Basic
parameters > Authorized values.
2. Find ITEMTYPECAT and add a new authorized value - make sure it
has a description.
3. Go to the Basic parameters > Item types page.
4. Edit an item type.
5. For the search category, select the new authorized value you
created. The desciption should be shown in the dropdown list.
6. Save the changes.
7. In the search category column for the item type you edited, it
should now display the description instead of the code.
8. Sign off!
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Wed, 13 Jan 2021 10:53:15 +0000 (11:53 +0100)]
Bug 20212: Remove fix_query and assume ugliness
It seems better to do things in an ugly way but simple than complicated.
This patch removes the fix_query method that deals with ean and isbn and
explicitly tell that it's a trick that must not be reused somewhere
else.
It should only be used by Koha internally and we should not advertised
it until it's ready.
This problem will have to be fixed properly when the GET /biblios route
will be implemented.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Wed, 13 Jan 2021 10:39:27 +0000 (11:39 +0100)]
Bug 20212: Fix query for the global filter
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Wed, 13 Jan 2021 10:17:48 +0000 (11:17 +0100)]
Bug 20212: Re-add EAN for UNIMARC
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Mon, 11 Jan 2021 14:42:18 +0000 (15:42 +0100)]
Bug 20212: Use the DT column filtering provided by the wrapper
Bug 27402 is adding it, we do not longer need the query_from_filters JS
function.
This patch also remove the filters on the left. As we have DT
remembering the filter on the table we don't need them anymore.
Technical note:
Prior to this patch, the search on biblio.author, biblio.title and
biblio.isbn was done by adding hidden columns. Now we are using:
"data": "biblio.author:biblio.title:biblio.isbn"
to tell the wrapper we are going to build a search on these 3
attributes.
Another trick is to pass a default_filters parameters to the wrapper, to
tell it we want to filter on the orders of a given vendor (this is a
bugfix, the original implementation was returning all the orders).
However We should not use /acq/orders?vendor_id=42 but /acq/vendor/42/orders instead (which does not exist yet),
otherwise (with bug 27353 ) we are going to display the wrong number of non-filtering rows.
The change in Orders.pm is only formatting to match what's done in
Bug 27353: Set X-Base-Total-Count header for REST API
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Tue, 12 Jan 2021 08:55:36 +0000 (09:55 +0100)]
Bug 20212: Remove fixedHeader
It's an extension that needs to be added.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Fri, 8 Jan 2021 14:04:32 +0000 (15:04 +0100)]
Bug 20212: Search on fund's name instead of id
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 20212: (follow-up) Avoid pagination on full resultset test
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Fri, 8 Jan 2021 13:15:07 +0000 (14:15 +0100)]
Bug 20212: Use functions to escape variables
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Tue, 22 Dec 2020 15:50:02 +0000 (15:50 +0000)]
Bug 20212: (QA follow-up) Spelling typo fix
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Tue, 22 Dec 2020 15:45:13 +0000 (15:45 +0000)]
Bug 20212: (QA follow-up) Restore missing comma
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 20212: Make all biblioitems.* fields searchable
Prior to this bug, only a few bilbio fields were actually searchable through
the orders API. This patch adds all of them to the mapping, so other
pages can take advantage of them.
My first approach was to add things as needed. But this is trivial to
make complete.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch adds per-column filtering to the order receiving table.
The order cost column proved difficult to filter, because of the syntax
DBIC requires for comparing replacement_cost * quantity, and passing
that all the way down from the API request to DBIC itself.
I'm still looking for options.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patchset did a copy and paste of the objects->search helper inside
the controller, to handle a very special case that wasn't worth
generalizing: the fact that the biblio object (that this patchset makes
embeddable) is actually built from two tables, and we want to filter by
fields in both tables.
This requires us to translate:
- Any filter reference to fields in biblioitems we allow to search on, through
an allow list.
- For filtering to work, we need to tweak the stashed 'embed' object so
the prefetch is done correctly
This patchset also adds a new query parameter: only_active. It is used
to only request active orders (see the spec for more details).
This patch adds tests for:
- Filtering by a column in bilbioitems (this implies correctly
prefetching the bilbio => biblioitems relation, and translating the
filtering parameter.
- Using the only_active query parameter to retrieve only active orders
To test:
1. Apply this patchset
2. Run:
$ kshell
k$ prove t/db_dependent/api/v1/acquisitions_orders.t
=> SUCCESS: Tests pass!
3. Verify the tests check for the explained behaviours.
=> SUCCESS: They do!
4. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch restores the original behaviour: if you jump into receiving
an order, and then go back to receiving, you want the page to remember
your filters.
This feature was overlooked. On fixing it, I wrapped some JS code in a
function for reusing it and simplified it a bit as well.
To test:
1. Enter a search term in either of the search fields
2. Add a note, receive or do another action
=> SUCCESS: The search term is kept
3. Apply this patch set
4. Repeat 2
=> SUCCESS: The search term is kept
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch makes the pending orders datatable render using the API
instead of hte old controller script. It implements native server-side
pagination thanks to the API and the datatables wrapper.
On polishing it, we found that data can contain many null values, and it
got dirtier in the process.
This code with all the checks that are done on the data is the result of
testing this dev with real-life production databases, huge ones with
thousands of orderlines.
To test:
1. You should compare the behaviour between this table, and the original
one in master.
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch adds options to embed more related objects based on the needs
by parcel.tt.
For filtering by biblioitems fields (ISBN and EAN) I had to make the
'list' method a modified version of the objects->search helper. I
thought of doing it in a more generic way but I didn't find any other
use cases and it would certainly make an already complex piece of code
even more complex.
So this is quite similar, but at some steps the biblio.<biblioitem
field> gets translated into the proper relation names, and the same
happens for prefetching.
A new parameter is also added: only_active. It makes the controller use
Koha::Acquisition::Orders->filter_by_active, avoiding the need to build
complex queries in the UI.
The same handling is done when the order_id parameter is passed (outside
the q= parameters). In this case using Koha::Acquisition::Orders->filter_by_id_including_transfers
This is all respecting the C4::Acquisitions::SearchOrders behaviour.
TL;DR:
This patch adapts the code from the list() sub so it manipulates the
query parameters and the embed header so:
- the biblioitem relationship is prefetch
- any queries on biblio.isbn and biblio.ean are correctly translated into search on the
biblioitems table.
- Adds an only_active parameter to the /acquisitions/orders route to
easily request only the active orders.
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Mon, 11 Jan 2021 12:36:14 +0000 (13:36 +0100)]
Bug 27402: Column filters must AND, not OR
Test plan:
Use the column filters and the global filter
Confirm that the rows are filtered as you expect
QA Note: There is more code on top of this, see bug 20212.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Mon, 11 Jan 2021 13:19:23 +0000 (14:19 +0100)]
Bug 27402: Move to datatables.js
To make it reusable we need to move the code to datatables.js
So far only the cities table is using the column filters so there is no other
view to test.
Note that the existing implementation didn't work at all, and were base
on what is done on the detail.pl page (using table_filters.js)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Fri, 8 Jan 2021 11:10:22 +0000 (12:10 +0100)]
Bug 27402: Add DT column filtering to the cities admin page
Bug 24561 added a wrapper to use easily all the DataTables functionalities when a REST API route was used within Koha.
The filtering method used is working for the global search filter, but not if we have a filter on top of each column.
This patchset is going to, first, add the filters on top of each column
of the cities table, then the code will be moved to the DT REST API wrapper to make it reusable easily.
Test plan:
Generate some cities:
use Koha::Cities;
for ( 1 .. 42 ) {
Koha::City->new({city_name => "name_$_", city_state => "state_$_", city_country => "country_$_", city_zipcode => "zipcode_$_" })->store;
}
Hit /admin/cities.pl
Use the filters
The general filter must do a OR query on each of the cities' attributes,
when column filters must use AND
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Wed, 6 Jan 2021 15:34:23 +0000 (16:34 +0100)]
Bug 27353: Set X-Base-Total-Count header for REST API
We already set X-Total-Count to the total number of filtered rows,
but we don't have the total number of non-filtered rows.
Test plan:
This is easy to test on top of bug 27352 or bug 27251, apply them if not
pushed yet.
1. Create 40 items with public notes = "xxx" for biblionumber=4
then, using Postman (or whatever you prefer):
http://kohadev-intra.mydnsname.org:8081/api/v1/biblios/4/items?_page=1&_per_page=20&q=[{"me.public_notes"%3A{"like"%3A"%25x%25"}}]&_match=contains
Check the headers and confirm you see X-Total-Count=40 and
X-Base-Total-Count=44
2. go to /cgi-bin/koha/tools/quotes.pl
You see "Showing 1 to 20 of 28 entries"
Search "he"
Showing 1 to 20 of 22 entries (filtered from 28 total entries)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Wed, 6 Jan 2021 16:11:30 +0000 (17:11 +0100)]
Bug 27353: Add tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch makes the list() controller method simpler, by removing the
checked_in parameter, and passing the appropriate restulset.
To test:
1. Run:
$ kshell
k$ prove t/db_dependent/api/v1/checkouts.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat (1)
=> SUCCESS: Tests still pass! (no behaviour change)
4. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
The original implementation included new orders regardless they were
standing orders.
This patch makes the query respect that conditions found on
C4::Acquisitions::SearchOrders.
To test:
1. Apply the regression tests patch
2. Run:
$ kshell
k$ prove t/db_dependent/Koha/Acquisition/Orders.t
=> FAIL: More orders than expected are returned
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! New orders are only considered if the basket
they are attached to, is marked as standing!
5. Verify the tests make sense
6. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 25670: Add filter_by_active and filter_by_id_including_transfers
This patch introduces a method to filter on the ordernumber, looking for
it on the aqorders_transfers table ('ordernumber_from' field).
It also adds a method for filtering on active orders.
To test:
1. Apply this patches
2. Run:
$ kshell
k$ prove t/db_dependent/Koha/Acquisition/Orders.t
=> SUCCESS: Tests pass!
3. Sign off :-D
lib
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>