koha.git
2 years agoBug 14237: (follow-up) Make the routines exclusively take itemnumber, biblionumber...
Nick Clemens [Fri, 11 Jun 2021 19:17:27 +0000 (19:17 +0000)]
Bug 14237: (follow-up) Make the routines exclusively take itemnumber, biblionumber, or ci_id

This patch changes the parameters for several of the CourseReserves routines to take a single
identifier exclusively.

Following the existing pattern we simply return if the params are incorrect

This patch also:
removes an unused 'title' variable
adds a prefetch to save some db calls where we fetch related objects
adjusts tests

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 14237: Set course_items.biblionumber in the DBrev
Jonathan Druart [Fri, 7 May 2021 07:22:50 +0000 (09:22 +0200)]
Bug 14237: Set course_items.biblionumber in the DBrev

We need to create the new column without the NOT NULL clause, set the
correct values, then add the NOT NULL clause.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 14237: Tests
Aleisha Amohia [Sun, 14 Mar 2021 20:15:32 +0000 (09:15 +1300)]
Bug 14237: Tests

Confirm all tests pass: t/db_dependent/CourseReserves/CourseItems.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 14237: Schema updates
Aleisha Amohia [Tue, 2 Feb 2021 21:04:30 +0000 (10:04 +1300)]
Bug 14237: Schema updates

Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 14237: Database updates
Aleisha Amohia [Tue, 2 Feb 2021 21:01:15 +0000 (10:01 +1300)]
Bug 14237: Database updates

This patch adds a biblionumber column to course_items, adds a
relationship between course_items.biblionumber and biblio.biblionumber,
and changes course_items.itemnumber to allow null values.

Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 14237: Add individual bibliographic records to course reserves
Aleisha Amohia [Wed, 3 Feb 2021 00:03:31 +0000 (13:03 +1300)]
Bug 14237: Add individual bibliographic records to course reserves

This feature allows a patron to add bibliographic records to course
reserves. They can be added individually or in a batch. The courses that
have reserved this record will also show on the record's detail page.

To test:
1) Update database, refresh schema, and restart services
2) Enable the system preference UseCourseReserves
3) Set up a couple of biblios and a couple of items (attached to
    different biblios)
4) Go to Course Reserves and add a new course
5) Click Add reserves and put something in both the barcode field and
biblionumber field. Click submit and confirm you get an error.
6) Add a barcode in the barcode field and submit. Confirm the item is
reserved for the course as expected.
7) Add a biblionumber in the barcode field and submit. Add notes and
Save. Confirm the record is reserved for the course as expected and the
notes are saved correctly.
8) Edit the record-level course reserve that you just added. Confirm the
correct record shows and any edits save as expected.
9) Go back to the course and try removing reserves. Use both the Remove
action button for individual reserves and the Remove all reserves
button. Confirm both work as expected.
10) Go to Batch add reserves and put something in both the barcodes
field and biblionumbers field. Click submit and confirm you get an
error.
11) Remove the barcodes and put some biblionumbers in the biblionumbers
field. Add notes and Submit. Confirm the records are all added as
expected.
12) Click on one of the biblios that has been reserved for the course.
Confirm that the course shows under 'Courses that have reserved this
title' on the biblio detail page.
13) Go back to the course and click Add reserves. Try and add a
biblionumber that is already reserved. Confirm it detects that the
biblio has already been reserved.

Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ)
Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28644: Fix calling borrowernumber on undefined value
Marcel de Rooy [Thu, 1 Jul 2021 14:13:05 +0000 (14:13 +0000)]
Bug 28644: Fix calling borrowernumber on undefined value

If the hold is not found (e.g. already cancelled), we should
return earlier without crashing:
    Can't call method "borrowernumber" on an undefined value at /usr/share/koha/C4/Reserves.pm line 521
    (Note: line number from 19.11)

Test plan:
Run t/db_dependent/Reserves.t
Add a hold, go to user menu with holds in OPAC.
At the same time, cancel this hold from staff.
Now click the Cancel in OPAC.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28483: Remove warnings from Search.t
Tomas Cohen Arazi [Tue, 22 Jun 2021 19:41:55 +0000 (16:41 -0300)]
Bug 28483: Remove warnings from Search.t

There are too many warnings about uninitialized variables in Search.pm.
This patch deals with that, the same way it is dealt accross the file:
by setting an empty string when things are not defined.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Search.t
=> FAIL: Wow, too many warnings. Some related to this bug, some not.
2. Apply this patch
3. Repeat 1
=> SUCCESS: No more warnings!
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: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28673: Add missing ampersand to amp; construction
Marcel de Rooy [Wed, 7 Jul 2021 12:38:48 +0000 (12:38 +0000)]
Bug 28673: Add missing ampersand to amp; construction

Super trivial one character fix ;)

Test plan:
Open Your Lists from the button on main page.
Click again on Your lists under Lists in the middle of the form.
Verify that the URL does no longer show something like:
    op=listamp;category=1

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28561: Remove DBIC warning in opac-shelves
Jonathan Druart [Fri, 18 Jun 2021 10:36:00 +0000 (12:36 +0200)]
Bug 28561: Remove DBIC warning in opac-shelves

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28561: Fix noisy warning about $direction too
Marcel de Rooy [Mon, 14 Jun 2021 12:51:13 +0000 (12:51 +0000)]
Bug 28561: Fix noisy warning about $direction too

Use of uninitialized value $direction in string ne at /usr/share/koha/opac/opac-shelves.pl line 265.

Bonus:
Use of uninitialized value $sortfield in string eq at /usr/share/koha/opac/opac-shelves.pl line 264.

Test plan:
While testing patch 1, check the logs for these warnings with and
without this patch.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28399: Remove txn error from batchRebuildItemsTables.pl
Jonathan Druart [Thu, 24 Jun 2021 13:11:18 +0000 (15:11 +0200)]
Bug 28399: Remove txn error from batchRebuildItemsTables.pl

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Restore newdate and timestamp for slip notices
Jonathan Druart [Wed, 17 Feb 2021 10:59:51 +0000 (11:59 +0100)]
Bug 22544: Restore newdate and timestamp for slip notices

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Fixed typo pubished_on

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Fix OpacLoginInstructions
Jonathan Druart [Wed, 17 Feb 2021 10:50:39 +0000 (11:50 +0100)]
Bug 22544: Fix OpacLoginInstructions

Moved recently

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: TT plugin should return hashref only if news exist
Jonathan Druart [Wed, 17 Feb 2021 10:48:36 +0000 (11:48 +0100)]
Bug 22544: TT plugin should return hashref only if news exist

It restore the header and fix the RSS feeds (see comment 103)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Use template plugin for news author display
Josef Moravec [Tue, 19 Jan 2021 08:42:02 +0000 (08:42 +0000)]
Bug 22544: Use template plugin for news author display

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Add default language value to KohaNews template plugin
Josef Moravec [Mon, 18 Jan 2021 12:41:31 +0000 (12:41 +0000)]
Bug 22544: Add default language value to KohaNews template plugin

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Enhance exception description
Josef Moravec [Mon, 18 Jan 2021 11:49:51 +0000 (11:49 +0000)]
Bug 22544: Enhance exception description

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Clarify documentation and change param 'type' to 'location'
Josef Moravec [Mon, 18 Jan 2021 09:33:21 +0000 (10:33 +0100)]
Bug 22544: Clarify documentation and change param 'type' to 'location'

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Fix filtering by location on tools -> news management
Josef Moravec [Thu, 1 Oct 2020 05:39:19 +0000 (05:39 +0000)]
Bug 22544: Fix filtering by location on tools -> news management

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Update search_for_display to be able to take more types
Josef Moravec [Thu, 1 Oct 2020 05:03:52 +0000 (05:03 +0000)]
Bug 22544: Update search_for_display to be able to take more types

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Update to current codebase
Josef Moravec [Wed, 30 Sep 2020 18:58:01 +0000 (18:58 +0000)]
Bug 22544: Update to current codebase

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: (QA follow-up) Fix spelling
Josef Moravec [Mon, 2 Mar 2020 07:04:54 +0000 (07:04 +0000)]
Bug 22544: (QA follow-up) Fix spelling

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Refactor searching of news items
Josef Moravec [Wed, 20 Mar 2019 11:07:22 +0000 (11:07 +0000)]
Bug 22544: Refactor searching of news items

Test plan:
1) Go to tools and define some news
2) Try different parameters, try to edit new items, and delete some
3) Go to all places where news are presented and ensure that there are
the right ones shown:
    opac main page - based on language
    opac righ column (formerly syspref OpacNavRight) - based on language
    opac news rss feed
    circulation slip (not quick slip)
    intranet main page
4) run tests:
prove t/db_dependent/Koha/News.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Add tests
Josef Moravec [Wed, 20 Mar 2019 10:20:29 +0000 (10:20 +0000)]
Bug 22544: Add tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Move GetNewsToDisplay to Koha namespace
Josef Moravec [Wed, 20 Mar 2019 07:36:53 +0000 (07:36 +0000)]
Bug 22544: Move GetNewsToDisplay to Koha namespace

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 22544: fix count call - to squash

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Move add_opac_item to Koha namespace
Josef Moravec [Tue, 19 Mar 2019 10:35:23 +0000 (10:35 +0000)]
Bug 22544: Move add_opac_item to Koha namespace

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Move upd_opac_new to Koha namespace
Josef Moravec [Tue, 19 Mar 2019 10:30:27 +0000 (10:30 +0000)]
Bug 22544: Move upd_opac_new to Koha namespace

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Move del_opac_new to Koha namespace
Josef Moravec [Tue, 19 Mar 2019 10:23:40 +0000 (10:23 +0000)]
Bug 22544: Move del_opac_new to Koha namespace

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Move get_opac_news to Koha namespace
Josef Moravec [Tue, 19 Mar 2019 10:17:31 +0000 (10:17 +0000)]
Bug 22544: Move get_opac_news to Koha namespace

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22544: Move get_opac_new to Koha namespace
Josef Moravec [Tue, 19 Mar 2019 09:14:47 +0000 (09:14 +0000)]
Bug 22544: Move get_opac_new to Koha namespace

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28597: Fetch the logged in branchcode for OpacSuggestioninstructions
Nick Clemens [Fri, 18 Jun 2021 13:09:29 +0000 (13:09 +0000)]
Bug 28597: Fetch the logged in branchcode for OpacSuggestioninstructions

To test:
 1 - Set two news items with location 'OpacSuggestioninstructions'
 2 - One should be for all libraries
 3 - One should be for a specific library
 4 - Sign in to opac with user from the specific library
 5 - Add a suggestion
 6 - The instructions only show the all libraries item
 7 - Apply patch
 8 - Reload
 9 - All libraries and specific library items are shown
10 - Allow anonymous suggestions:  AnonSuggestions - Allow
11 - Sign out of opac
12 - Add a suggestion
13 - Only all librares news is visible

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28455: Update wording on TrackLastPatronActivity
Andrew Fuerste-Henry [Thu, 3 Jun 2021 21:11:56 +0000 (21:11 +0000)]
Bug 28455: Update wording on TrackLastPatronActivity

This patch updates the wording on TrackLackPatronActivity to maintain the corrections from bug 28467 and also reflect the change made in this bug. It should now read: The first time each day that a patron either logs into the OPAC, connects to Koha via SIP, or checks an item out, borrowers.lastseen will update with the current date and time.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28455: lastseen should be updated at checkout if TrackLastPatronActivity is enabled
Nick Clemens [Tue, 25 May 2021 18:20:25 +0000 (18:20 +0000)]
Bug 28455: lastseen should be updated at checkout if TrackLastPatronActivity is enabled

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28611: Fix width to 50% for additem form elements
Jonathan Druart [Tue, 22 Jun 2021 09:46:55 +0000 (11:46 +0200)]
Bug 28611: Fix width to 50% for additem form elements

This patch suggests to set the width of select and input to 50%

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>
2 years agoBug 28299: Make buildKohaItemsNamespace accept Koha::Items
Tomas Cohen Arazi [Mon, 10 May 2021 08:01:02 +0000 (10:01 +0200)]
Bug 28299: Make buildKohaItemsNamespace accept Koha::Items

This patch makes buildKohaItemsNamespace (and its only caller,
XSLTParse4Display) accept a an optional Koha::Items resultset.

This way we don't need to calculate (from the DB) the list of hidden
itemnumbers, but solve it in one query.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
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>
2 years agoBug 28299: Take OpacHiddenItems into account on opac-shelves
Jonathan Druart [Fri, 7 May 2021 09:16:17 +0000 (11:16 +0200)]
Bug 28299: Take OpacHiddenItems into account on opac-shelves

hidden_items was not passed to XSLTParse4Display

2 things:
* Should we hide the biblio record if OpacHiddenItemsHidesRecord is set?
* allow_onshelf_holds is not working like in other scripts, what's the
expected behaviour? If hidden should we completely ignore the item?

Test plan:
1. Without the patch
2. fill OpacHiddenItems with «damaged: [1]»
3. find a record with several item
4. mark one of them as damaged
5. OPAC: go to the record, you shouldn't see the damaged item
6. add the record to a list
7. see the list
8. in Availability you see the damaged item mentioned, this is the issue
9. apply the patches and restart the services
10. the list should not mention the damaged item :D

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
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>
2 years agoBug 28299: Unit tests for buildKohaItemsNamespace
Tomas Cohen Arazi [Mon, 10 May 2021 14:17:57 +0000 (11:17 -0300)]
Bug 28299: Unit tests for buildKohaItemsNamespace

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
2 years agoBug 28462: Remove line breaks in TT tags
Jonathan Druart [Wed, 23 Jun 2021 07:50:55 +0000 (09:50 +0200)]
Bug 28462: Remove line breaks in TT tags

Same as previous patch for other files.
Looks like the problem exists only with IF.

== test plan ==
1. See the problematic strings in a given language
     git grep "\bIF\b" misc/translator/po | grep -v '#' | grep '\bzh-Hant-TW'
2. update the language
   misc/translator/translate update zh-Hant-TW
3. Recheck the problematic strings, they aren't here anymore
4. Check the diff: git diff
   and search the if's with «/-.* IF » to see how the deleted strings
   look like and that it makes sense.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28462: Remove TT tag on several lines - opac-advsearch.tt
Jonathan Druart [Wed, 26 May 2021 14:24:32 +0000 (16:24 +0200)]
Bug 28462: Remove TT tag on several lines - opac-advsearch.tt

It fixes the translation in case the operators have been translated

Test plan:
1. misc/translator/translate update pt-BR
2. In pt-BR-opac-bootstrap.po , find OpacAdvSearchMoreOptions
3. sabotage the translation part, like replacing IF with something else
4. misc/translator/translate install pt-BR
5. enable and use pt-BR and hit opac-advsearch.pl
6. Notice the error
   Template process failed: file error - parse error - /kohadevbox/koha/koha-tmpl/opac-tmpl/bootstrap/pt-BR/modules/opac-advsearch.tt line 409: unexpected token (e)                                                    [% IF (OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.size> 0 e extended_options) ou (OpacAdvSearchOptions and OpacAdvSearchOptions.size> 0 e n expandido_options) %] at /kohadevbox/koha/C4/Templates.pm
7. Apply the patch and redo update and install of the language
8. Note that it's now working

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28524: Escape 'rank' in cat_issues_top.pl
Jonathan Druart [Wed, 16 Jun 2021 12:51:08 +0000 (14:51 +0200)]
Bug 28524: Escape 'rank' in cat_issues_top.pl

It's a MySQL 8 keyword

Test plan:
Turn off strict_sql_modes (there are other problems in this script)
Hit Home Reports > Most-circulated items
Submit the form

Without this patch you got:
  You have an error in your SQL syntax; check the manual that
  corresponds to your MySQL server version for the right syntax to use
  near 'RANK, biblio.biblionumber AS ID, itemcallnumber as CALLNUM,
  ccode as CCODE, loca' at line 1

With this patch applied you see the report result view

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28523: Escape 'rank' in bor_issues_top.pl
Jonathan Druart [Wed, 16 Jun 2021 12:54:47 +0000 (14:54 +0200)]
Bug 28523: Escape 'rank' in bor_issues_top.pl

It's a MySQL 8 keyword

Test plan:
Turn off strict_sql_modes (there are other problems in this script)
Hit Home Reports > Patrons with the most checkouts
Submit the form

Without this patch you got:
    You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to
    use near 'RANK, borrowers.borrowernumber AS ID FROM `old_issues`

With this patch applied you see the report result view

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28409: Adjust regression test
Jonathan Druart [Thu, 24 Jun 2021 07:55:23 +0000 (09:55 +0200)]
Bug 28409: Adjust regression test

We are no longer expecting an URI escaped value but a corrected category
value, either 1 or 2.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28409: Simplify data validation
Jonathan Druart [Fri, 21 May 2021 07:09:53 +0000 (09:09 +0200)]
Bug 28409: Simplify data validation

Simplify the affectation then trust it.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
JD Amended patch: remove duplicate comma

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28409: Comprehensively validate category in opac-shelves.pl
David Cook [Fri, 21 May 2021 06:52:25 +0000 (06:52 +0000)]
Bug 28409: Comprehensively validate category in opac-shelves.pl

Default to a category of 1 (ie Private). Only allow input of 1
or 2 (ie Public)

== Test plan ==
1. Go to http://localhost:8080/cgi-bin/koha/opac-shelves.pl?category=function(){window.location.href%20=%20%27https://git.koha-community.org/stats/koha-master/authors.html%27}()
2. Note that you are redirected to another website
3. Go to http://localhost:8080/cgi-bin/koha/opac-shelves.pl?op=add&shelfname=foo&category=9
4. Note that you can't see this list in the Lists (but it has been added to the database)
5. Apply the patch & restart services
6. Go to http://localhost:8080/cgi-bin/koha/opac-shelves.pl?category=function(){window.location.href%20=%20%27https://git.koha-community.org/stats/koha-master/authors.html%27}()
7. Note that you are not redirected to another website
8. Go to http://localhost:8080/cgi-bin/koha/opac-shelves.pl?op=add&shelfname=bar&category=9
9. Note that "bar" has been added as a Private list

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28615: (follow-up) Disable strict mode explicitly
Tomas Cohen Arazi [Tue, 29 Jun 2021 15:24:52 +0000 (12:24 -0300)]
Bug 28615: (follow-up) Disable strict mode explicitly

So Debian 9's version of Test::MockModule doens't have ->redefine, and
Ubuntu 20.04's doesn't recognise qw(nostrict). So the only solution is
to just remove the keywords use completely and move back to using
->mock, as the rest of the codebase.

FIXME: using ->mock might be hiding some errors (like a method not being
defined/removed) and should be avoided. ->redefine will explode if the
method doesn't already exist, which is what we want, to catch this kind
of errors. That's why ->mock in strict mode is forbidden. We should try
packaging a newer Test::MockModule ourselves.

Tested on master-buster, master-stretch and master-focal.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 28615: (follow-up) Newer Test::MockModule forbid ->mock
Tomas Cohen Arazi [Tue, 29 Jun 2021 14:18:12 +0000 (11:18 -0300)]
Bug 28615: (follow-up) Newer Test::MockModule forbid ->mock

In strict mode, ->mock is forbidden and ->redefine needs to be used
instead. I tested this on buster to see if it breaks something, but it
doesn't.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 28615: Fix t/Auth_with_shibboleth.t
Tomas Cohen Arazi [Mon, 28 Jun 2021 18:28:49 +0000 (15:28 -0300)]
Bug 28615: Fix t/Auth_with_shibboleth.t

This patch makes t/Auth_with_shibboleth.t use the new
t::lib::Mocks::Logger tools

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 28615: Add a simple way to mock Koha::Logger
Tomas Cohen Arazi [Mon, 28 Jun 2021 18:22:33 +0000 (15:22 -0300)]
Bug 28615: Add a simple way to mock Koha::Logger

This patch introduces a new way to mock and test Koha::Logger.

As the POD says, it is used by calling

    my $logger = t::lib::Mocks::Logger->new();

It then provides convenient methods for testing the logging itself per
log-level:

* warn_is
* warn_like
* debug_is
* debug_like
...

Methods for counting the logging activity and also for clearing the mock
buffer are provided as well. This is covered in the POD and also on the
follow-up, that makes use of this to fix Auth_with_shibboleth.t

To test:

1. Run:
   $ kshell
  k$ prove t/Auth_with_shibboleth.t
=> FAIL: Tests fail! It expects some warns but they are not returned by
the lib
2. Apply this patches
3. Repeat 1
=> SUCCESS: Tests pass! The tests now use the new lib, and they
correctly find the logging Auth_with_shibboleth.pm does on function
calls.
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: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 28571: Remove C4::Auth::_session_log
Jonathan Druart [Wed, 16 Jun 2021 13:28:01 +0000 (15:28 +0200)]
Bug 28571: Remove C4::Auth::_session_log

It's not used and must be removed

Test plan:
  % git grep _session_log
must not return any result.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28606: Remove $DEBUG and $ENV{DEBUG}
Jonathan Druart [Tue, 22 Jun 2021 10:54:15 +0000 (12:54 +0200)]
Bug 28606: Remove $DEBUG and $ENV{DEBUG}

We should remove the debug statements or use Koha::Logger when we want
to keep it.

Test plan:
Confirm that occurrences of remaining occurrences of DEBUG need to be
kept (historical scripts for instance)
Confirm that the occurrences removed by this patch can be removed
Confirm that the occurrences replaced by Koha::Logger are correct

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Looks good to me, noting a few minor points on BZ.

JD amended patch: replace "warn #Finished" with "#warn Finished", and
put the statement on a single line

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28601: Fix 'Home' breadcrumd on circulation-home.pl
Nick Clemens [Fri, 18 Jun 2021 15:45:42 +0000 (15:45 +0000)]
Bug 28601: Fix 'Home' breadcrumd on circulation-home.pl

To test:
1 - Got to 'Circulation'
2 - Click 'Home' in breadcrumbs
3 - You are still in circulation home
4 - Apply patch
5 - reload page
6 - Click 'Home'
7 - Success!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28600: (bug 18989 follow-up) Resolve variable scope issue
Tomas Cohen Arazi [Fri, 18 Jun 2021 18:20:30 +0000 (15:20 -0300)]
Bug 28600: (bug 18989 follow-up) Resolve variable scope issue

This patch fixes a scope issue. Originally, a variable declared as

our $borcat

was replaced by

my $patron

This patch makes the method not rely on global variables, but have a
parameter for the patron, and thus things are clearer.

To test:
1. Open the OPAC detail page for a record
=> FAIL: The logs show some errors about the $patron variable not
available in the scope
2. Apply this patch
3. Repeat 1
=> SUCCESS: No errors
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: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28588: (follow-up) Make the API use the new method
Tomas Cohen Arazi [Fri, 18 Jun 2021 19:34:00 +0000 (16:34 -0300)]
Bug 28588: (follow-up) Make the API use the new method

This patch adapts the controller method for resolving a return claim so
it uses the Koha::Checkouts::ReturnClaim method instead.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/return_claims.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28588: Add Koha::Checkouts::ReturnClaim->resolve
Tomas Cohen Arazi [Fri, 18 Jun 2021 19:15:15 +0000 (16:15 -0300)]
Bug 28588: Add Koha::Checkouts::ReturnClaim->resolve

This patch introduces a high-level method for resolving claims.
The behavior intends to replace the code in the API controller that is
used for resolving a claim.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Checkouts/ReturnClaim.t
=> SUCCESS: Tests pass
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28588: Unit tests
Tomas Cohen Arazi [Fri, 18 Jun 2021 19:14:43 +0000 (16:14 -0300)]
Bug 28588: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28604: Prevent double encoding of MARC::Record::MiJ->to_mij output
Tomas Cohen Arazi [Fri, 18 Jun 2021 21:32:37 +0000 (18:32 -0300)]
Bug 28604: Prevent double encoding of MARC::Record::MiJ->to_mij output

This patch fixes a double-encoding issue with MiJ output.

Mojolicious' *text* renderer encodes the passed information according to
the request context. [1]

MARC::Record::MiJ->to_mij, conveniently encodes the string before
output [2].

This causes double encoding.

So the solution to this situation, is to use the *data* renderer, which
doesn't perform any encoding [3].

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/biblios.t
=> FAIL: Tests contain diacritics and fail!
3. Have a record with diacritics
4. Try the API routes for fetching a biblio:
   $ curl --location --request GET 'http://localhost:8080/api/v1/public/biblios/144' \
          --header 'Accept: application/marc-in-json'
   (replace the record id with the one you've chosen)
=> FAIL: Boo, double encoding
5. Bonus point: you can try it on the non-public route, but you need
   more configuration boilerplate (basic auth, permissions). If you look
   at the fix, you will understand the tests cover it and no need to
   complicate yourself.
6. Apply this patch
7. Repeat 2
=> SUCCESS: Tests pass!
8. Repeat 4 (and maybe 5)
=> SUCCESS: No double encoding! Yay!
9. Sign off :-D

[1] https://metacpan.org/release/MRAMBERG/Convos-0.5/view/local/lib/perl5/Mojolicious/Guides/Rendering.pod#Rendering-text
[2] https://metacpan.org/dist/MARC-File-MiJ/source/lib/MARC/Record/MiJ.pm#L111
[3] https://metacpan.org/release/MRAMBERG/Convos-0.5/view/local/lib/perl5/Mojolicious/Guides/Rendering.pod#Rendering-data

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>
2 years agoBug 28604: Regression tests
Tomas Cohen Arazi [Fri, 18 Jun 2021 21:30:56 +0000 (18:30 -0300)]
Bug 28604: Regression tests

This patch introduces regression tests for the encoding issue with MiJ
output.

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>
2 years agoBug 28480: (QA follow-up) Add unit test
Nick Clemens [Fri, 11 Jun 2021 18:02:11 +0000 (18:02 +0000)]
Bug 28480: (QA follow-up) Add unit test

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28480: Add q parameters for GET /patrons
Tomas Cohen Arazi [Fri, 28 May 2021 11:34:29 +0000 (08:34 -0300)]
Bug 28480: Add q parameters for GET /patrons

This patch adds the q query parameters to the route.

To test:
1. Try the route with the following query parameter:
   q={"patron_id":2}
   i.e. GET /api/v1/patrons?q={"patron_id":2}
=> FAIL: You get a bad request respose
2. Apply this patch
3. Restart all
4. Repeat 1
=> SUCCESS: You get the patron
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28581: (QA follow-up) Fix method on unblessed reference
Marcel de Rooy [Mon, 21 Jun 2021 08:47:59 +0000 (08:47 +0000)]
Bug 28581: (QA follow-up) Fix method on unblessed reference

Speaks for itself.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28581: Enhance POD for EnqueueLetter
Martin Renvoize [Thu, 17 Jun 2021 13:47:07 +0000 (14:47 +0100)]
Bug 28581: Enhance POD for EnqueueLetter

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28581: Use 'from_email_address' where appropriate
Martin Renvoize [Thu, 17 Jun 2021 13:30:59 +0000 (14:30 +0100)]
Bug 28581: Use 'from_email_address' where appropriate

This patch replaces a few more trivial cases where we were using
library->branchemail with a fallback to KohaAdminEmail to just use the
new library->from_email_address method directly instead.

There were also a couple of cases where we were passing borrowernumber
and the patrons library from address too.. this is unneccesary as the
code in _send_email_massage will already default to patron library from
address if we do not pass an override.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Added a semicolon.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28581: (QA follow-up) Prevent code failure
Martin Renvoize [Thu, 17 Jun 2021 13:12:23 +0000 (14:12 +0100)]
Bug 28581: (QA follow-up) Prevent code failure

This patch prevents a fatal error when both $params->{from} and
$params->{borrowernumber} are undefined. We fallback to
KohaAdminEmailAddress before finally falling through to setting a
failure status for the message if that last fallback is not found.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28581: Use from_email_address in the codebase
Marcel de Rooy [Thu, 17 Jun 2021 09:59:18 +0000 (09:59 +0000)]
Bug 28581: Use from_email_address in the codebase

Adding only a few (trivial) cases now. Changes in C4::Letters
are not trivial after all..
We now add the KohaAdminEmail fallback implicitly when the from
address was still empty. The extra check makes us not rely on
a do or die action in Email::Stuffer.

Test plan:
Run password recovery or membership expiry cron.
Check sender address.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28581: Add 'from_email_address' method and use in Koha::Patron
Martin Renvoize [Thu, 17 Jun 2021 08:54:46 +0000 (09:54 +0100)]
Bug 28581: Add 'from_email_address' method and use in Koha::Patron

This patch adds a new 'from_email_address' method to Koha::Library to
return the appropriate email address to use as the 'from' field for
email notices from the library.

We then update Koha::Patron->queue_notice to use this new method instead
of the incorrect inbound_email_address.

I also update the POD for inbound_email_address to clarify it's use
case.

Test plan

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26205: DBRev 21.06.00.005
Jonathan Druart [Wed, 23 Jun 2021 13:08:36 +0000 (13:08 +0000)]
Bug 26205: DBRev 21.06.00.005

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26205: (QA follow-up) Add punctuation and widen pref description a bit
Katrin Fischer [Tue, 1 Jun 2021 08:16:52 +0000 (08:16 +0000)]
Bug 26205: (QA follow-up) Add punctuation and widen pref description a bit

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26205: (QA follow-up) Change OPACNEWS to just NEWS
Katrin Fischer [Tue, 1 Jun 2021 08:15:49 +0000 (08:15 +0000)]
Bug 26205: (QA follow-up) Change OPACNEWS to just NEWS

As news are usable in OPAC and staff interface, I suggest changing the code
to just be NEWS instead of OPACNEWS.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26205: (QA follow-up) Capitalization: OPAC News
Katrin Fischer [Tue, 1 Jun 2021 08:13:11 +0000 (08:13 +0000)]
Bug 26205: (QA follow-up) Capitalization: OPAC News

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26205: Add logging of news items
Lucas Gass [Wed, 12 May 2021 18:20:16 +0000 (18:20 +0000)]
Bug 26205: Add logging of news items

To test:

1. Apply patch, updatedatabase, restart_all
2. Make sure the system pref 'NewsLog' is turned on.
3. Go to the Koha News tool and create a new news item.
4. View the logs and display only the OPAC News module
5. You should see your new news, it will include the lang (
   OPACheader_en ) and the content of the news item.
6. Filter the logs so the only action is 'Add', your new news item
   should appear
7. Modify some news items
8. They should appear in the logs now as modification.
9. Make sure you can filter the action to 'Modify' and can confirm it
   works
10. Delete some news items
11. They should appear in the logs now as deletinon
12. Make sure you can filter the action to 'Delete' and can confirm it
    works

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>
2 years agoBug 28516: Prevent failures if borrower_attribute_types.mandatory=1
Jonathan Druart [Fri, 4 Jun 2021 13:36:59 +0000 (15:36 +0200)]
Bug 28516: Prevent failures if borrower_attribute_types.mandatory=1

TestBuilder will generate an integer for the
Koha::Patron::Attribute::Type object, but if 1 is picked some tests are
failing randomly
At least t/db_dependent/Koha/Patrons.t and t/db_dependent/Koha/Patrons/Import.t
The expection "Missing mandatory extended attribute" is raised when the
patron is stored.

Test plan:
The following script should return 0 when the patch is applied:

"""
use t::lib::TestBuilder;
my $builder = t::lib::TestBuilder->new;
my $x = $builder->build_object(
    {
        class => 'Koha::Patron::Attribute::Types',
    }
);
say $x->mandatory;
"""

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28616: (bug 28220 follow-up) Replace Data::Printer with simple warn
Jonathan Druart [Wed, 23 Jun 2021 07:40:36 +0000 (09:40 +0200)]
Bug 28616: (bug 28220 follow-up) Replace Data::Printer with simple warn

$_ is an exception that will be stringify in scalar context. We don't
need Data::Printer here.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28572: Set missing __LOG_DIR__ variable in zebra_config.pl
Tomas Cohen Arazi [Tue, 22 Jun 2021 19:14:16 +0000 (16:14 -0300)]
Bug 28572: Set missing __LOG_DIR__ variable in zebra_config.pl

This patch makes zebra_config.pl create a temporary directory for logs
and sets it in ENV so, when called, rewrite-config.PL sets it correctly.

It also adds the new syspref Reference_NFL_Statuses to the big mock to
silence many warnings introduced by bug 21260.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28572: Fix Search.t
Jonathan Druart [Tue, 22 Jun 2021 14:57:50 +0000 (16:57 +0200)]
Bug 28572: Fix Search.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28572: Fix misc/admin/koha-preferences
Jonathan Druart [Tue, 22 Jun 2021 14:57:29 +0000 (16:57 +0200)]
Bug 28572: Fix misc/admin/koha-preferences

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28598: Update DateFormat and TimeFormat descriptions to remove warnings
Andrew Fuerste-Henry [Fri, 18 Jun 2021 13:15:34 +0000 (13:15 +0000)]
Bug 28598: Update DateFormat and TimeFormat descriptions to remove warnings

To test, confirm that the warnings are present without the patch and gone with it.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28572: Remove C4::Debug
Jonathan Druart [Fri, 18 Jun 2021 09:25:16 +0000 (11:25 +0200)]
Bug 28572: Remove C4::Debug

We are using Koha::Logger when it makes sense to keep the info,
otherwise we simply remove it

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 28572: Replace missing occurrence in misc/admin/koha-preferences

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28591: Don't pass debug to get_template_and_user
Jonathan Druart [Fri, 18 Jun 2021 09:34:54 +0000 (11:34 +0200)]
Bug 28591: Don't pass debug to get_template_and_user

There is a "debug" parameter we are passing from the controller scripts
to C4::Auth::get_template_and_user, but it's not actually used!

Test plan:
Confirm the assumption
Review the changes from this patch

Generated with:
perl -p -i -e 's#\s*debug\s*=\>\s*(0|1),?\s*##gms' **/*.pl

git checkout misc/devel/update_dbix_class_files.pl # Wrong catch
+ Manual fix in acqui/neworderempty.pl

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28590: Remove get_shelves_userenv and set_shelves_userenv
Jonathan Druart [Fri, 18 Jun 2021 08:27:01 +0000 (10:27 +0200)]
Bug 28590: Remove get_shelves_userenv and set_shelves_userenv

They are no longer used since bug 7310, now we are using
Koha::Virtualshelves->get_some_shelves

Test plan:
Create some lists, login at the OPAC and confirm that you see
the list in the navbar (top)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28570: Remove log to /tmp file from bor_issues_top.pl
Jonathan Druart [Wed, 16 Jun 2021 13:24:31 +0000 (15:24 +0200)]
Bug 28570: Remove log to /tmp file from bor_issues_top.pl

This is unusual and must not be done.
Removing it.

Test plan:
Use the "Home > Reports > Patrons with the most checkouts" report and
confirm that it is working correctly after you applied this patch

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28514: Set lang to default is not passed
Jonathan Druart [Tue, 22 Jun 2021 09:57:00 +0000 (11:57 +0200)]
Bug 28514: Set lang to default is not passed

It fixes the following test:
    #   Failed test 'no lang passed, default is returned'
    #   at t/db_dependent/Koha/Notices.t line 105.
    #          got: 'es-ES'
    #     expected: 'default'
    # Looks like you failed 1 test of 7.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28242: added captions to tables and legends to forms
Wainui Witika-Park [Sun, 2 May 2021 09:52:18 +0000 (09:52 +0000)]
Bug 28242: added captions to tables and legends to forms

Ensured that in the OPAC, all tables have relevant captions and all forms have relevant legends.

Many of these have class="sr-only" so they are not visible but will be
available for people who use screen-readers.

To test:
1) Go to OPAC
2) Apply patch and dependencies
3) Check that on all pages, any tables have a caption (many of them will
    not be visible, but will be in the markup code)
4) Check that on all pages, any forms have a legend (many of them will
    not be visible, but will be in the markup code)
5) Check that the captions are appropriate and relevant
6) Check that the legends are appropriate and relevant

Sponsored-by: Catalyst IT
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28563: (QA follow-up) Fix unit test
Katrin Fischer [Mon, 14 Jun 2021 19:24:42 +0000 (19:24 +0000)]
Bug 28563: (QA follow-up) Fix unit test

Add the new preference to the UsageStats.t

To test:
- Run t/db_dependent/UsageStats.t
- Watch it pass :)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28563: Add AllowHoldItemTypeSelection to HEA
Tomas Cohen Arazi [Mon, 14 Jun 2021 15:26:20 +0000 (12:26 -0300)]
Bug 28563: Add AllowHoldItemTypeSelection to HEA

This patch adds the mentioned syspref to the sysprefs list, shared for
statistical purposes.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
2 years agoBug 28508: Use "Invoice number" instead of "Invoice no" on the invoice search filter
Owen Leonard [Wed, 9 Jun 2021 10:59:31 +0000 (10:59 +0000)]
Bug 28508: Use "Invoice number" instead of "Invoice no" on the invoice search filter

This patch corrects instances of the abbreviated phrase "Invoice no."
from the templates, making it "Invoice number." Also corrected: An
instance of "Bookseller" is replaced with "Vendor."

To test, apply the patch and confirm that the phrase is correct in these
cases:

- Acquisitions -> Invoices: Check the "Search filters" form in the
  left-hand sidebar.
  -> View an invoice: Check the label in the form.
- Acquisitions -> Vendor -> Receive shipments: Check the table of
  invoices.
- Acquisitions -> Orders search (in the search header) -> Advanced
  search: Check the labels in the form.

Signed-off-by: Salman Ali <salman.ali@inLibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Note: I fixed Salman's SO line

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28418: Show template_id of MARC modification templates
Owen Leonard [Fri, 21 May 2021 18:10:14 +0000 (18:10 +0000)]
Bug 28418: Show template_id of MARC modification templates

This patch adds an "id" column to the table of MARC modification
templates. The table is now a DataTable with table settings, with the
new column hidden by default to preserve the existing configuration.

To test, apply the patch and restart services.

 - Go to Administration -> MARC modification templates.
 - If necessary, add two or more templates.
 - Confirm that table of templates displays as a DataTable, with all
   associated sorting, filtering, export, etc.
 - The "id" column should be hidden by default.
 - Confirm that column visibility controls work correctly.
 - Confirm that the table settings found under Administration -> Table
   settings work correctly to set the default visibility of the table
   columns.

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>
2 years agoBug 27882: Move external search results links out of page heading
Owen Leonard [Fri, 5 Mar 2021 15:19:40 +0000 (15:19 +0000)]
Bug 27882: Move external search results links out of page heading

This patch modifies the JavaScript which adds search result information
to the OPAC search results page which is returned from OverDrive,
Recorded Books, or Open Library. The information now displays below the
page heading instead of inside it.

To test you must have OpenLibrarySearch enabled, OverDrive-related
preferences populated (OverDriveClientKey, OverDriveClientSecret,
OverDriveLibraryID), or RecordedBooks preferences (RecordedBooksClientSecret,
RecordedBooksDomain, RecordedBooksLibraryID).

This patch was written with OverDrive and Open Library results active.

- Apply the patch and perform a search in the OPAC catalog.
- On the search results page you should see results for your external
  services appear below the page heading ("You search returned..."),
  e.g.

  "Found 20257 results in the library's OpenLibrary collection"
  "Found 337 results in the library's OverDrive collection"

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>
2 years agoBug 27498: (follow-up) Update to display logic
Katrin Fischer [Sun, 21 Mar 2021 13:11:25 +0000 (13:11 +0000)]
Bug 27498: (follow-up) Update to display logic

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Amit Gupta <amitddng135@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27498: Add a link for the Hold Ratios to Acquisitions home page
Owen Leonard [Wed, 3 Feb 2021 12:04:31 +0000 (12:04 +0000)]
Bug 27498: Add a link for the Hold Ratios to Acquisitions home page

This patch adds a link to the hold ratios report in the Acquisitions
sidebar menu under the "reports" heading.

To test, apply the patch and go to Acquisitions. The link to the hold
ratios report should be there and it should work correctly.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Amit Gupta <amitddng135@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26838: Compiled CSS changes
Jonathan Druart [Mon, 21 Jun 2021 11:55:58 +0000 (13:55 +0200)]
Bug 26838: Compiled CSS changes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26838: Improve styling of checkin message
Owen Leonard [Fri, 30 Oct 2020 12:33:54 +0000 (12:33 +0000)]
Bug 26838: Improve styling of checkin message

This patch makes some changes to the style and use of the "problem"
class in the staff interface:

- Remove the background color
- Remove the extra line height

Some changes to the template:

 - Remove the problem class from the checkin message. The checkin
   message configuration determines whether the dialog is an alert or a
   message-style dialog.
 - Add Font Awesome icons to the "problem" messages in patron details
   and serials collection. This is to help emphasize the message for
   users  who might have difficulty seeing the color difference.

To test, apply the patch and rebuild the staff interface CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

 - Go to Administration -> Item types and configure a checkin message
   for an item type: Add a message and select "Message" as the checkin
   message type.
 - Check in an item with that item type and confirm that you see the
   checkin message. It should be displayed in a message-style dialog
   without any additional styling.
 - Change the item type configuration to use "Alert" as the checkin
   message type. Confirm that the correct style is shown in this case as
   well.

 - Locate a patron with a NULL value in borrowers.password. View the
   detail page for that patron.
 - Under the "Library use" heading, the "Password" line should contain a
   link with the text "Undefined," preceded by a red-colored Font
   Awesome  icon.

 - In Serials, locate a subscription which is expired.
 - View the details for the subscription, and then open "serial
   collection" from the sidebar menu.
 - On the serial collection page there should be a cell in the
   subscription summary table showing the message "Subscription expired"
   preceded by a red-colored Font Awesome icon.

Signed-off-by: Salman Ali <salman.ali@inLibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 8280: Add koha set and item fields to pqf.properties
Nick Clemens [Fri, 11 Jun 2021 12:15:35 +0000 (12:15 +0000)]
Bug 8280: Add koha set and item fields to pqf.properties

This patch adds a 'koha' set to the pqf properties and maps some basic
koha fields to all for searchign

To test:
1 - Apply patch
2 - cp etc/z3950/pqf.properties /etc/koha/sites/kohadev/z3950/pqf.properties
3 - sudo koha-z3950-responder --restart kohadev
4 - Test a search:
    curl -XGET "http://localhost:2100/biblios?version=1.1&operation=searchRetrieve&query=koha.itemtype=BK&maximumRecords=60&recordSchema=marcxml"
5 - Test other fields added:
    koha.withdrawn
    koha.lost
    koha.classification-source
    koha.materials-specified
    koha.damaged
    koha.restricted
    koha.cn-sort
    koha.notforloan
    koha.ccode
    koha.itemnumber
    koha.homebranch
    koha.holdingbranch
    koha.location
    koha.barcode
    koha.onloan
    koha.itemtype

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Copied the changes from z3950 to zebradb too.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 8280: Sync whitespace differences between pqf config files
Marcel de Rooy [Fri, 18 Jun 2021 06:48:38 +0000 (06:48 +0000)]
Bug 8280: Sync whitespace differences between pqf config files

Test plan:
Diff etc/zebradb/pqf.properties with the etc/z3950 one.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27600: Remove password check from `add_hold`
Martin Renvoize [Mon, 10 May 2021 15:30:31 +0000 (16:30 +0100)]
Bug 27600: Remove password check from `add_hold`

As suggested in the bugzilla comments, the add_hold method also
doesn't require the password checking code.

Test plan
1/ Run t/db_dependent/SIP/ILS.t and watch it pass

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27600: Remove password check from `cancel_hold`
Martin Renvoize [Mon, 10 May 2021 15:09:17 +0000 (16:09 +0100)]
Bug 27600: Remove password check from `cancel_hold`

As suggested in the bugzilla comments, the cancel_hold method also
doesn't require the password checking code.

Test plan
1/ Run t/db_dependent/SIP/ILS.t and watch it pass

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27600: Remove password check from SIP2 `renew_all`
Martin Renvoize [Wed, 3 Feb 2021 10:03:31 +0000 (10:03 +0000)]
Bug 27600: Remove password check from SIP2 `renew_all`

This patch removes the password check code from the renew_all method for
SIP2. This is required, as many units send an empty AD field in the SIP
message which can cause the transaction to fail.. but the authentication
should have already taken place earlier in the session.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27600: Add unit test
Martin Renvoize [Wed, 3 Feb 2021 10:16:30 +0000 (10:16 +0000)]
Bug 27600: Add unit test

This patch adds a basic unit test to catch the case where patron_pwd is
sent to renew_all as an empty string.

Test plan
1/ Run t/db_dependent/SIP/ILS.t and watch it fail
2/ Apply second patch
3/ Re-run the above test and watch it pass.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 15788: DBRev 21.06.00.004
Jonathan Druart [Mon, 21 Jun 2021 11:56:17 +0000 (11:56 +0000)]
Bug 15788: DBRev 21.06.00.004

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 15788: Make the API require the new permission
Tomas Cohen Arazi [Sat, 12 Jun 2021 13:55:22 +0000 (10:55 -0300)]
Bug 15788: Make the API require the new permission

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>