koha.git
3 years agoBug 25723: (QA follow-up) Remove unused module import
Joonas Kylmälä [Fri, 17 Jul 2020 14:26:15 +0000 (14:26 +0000)]
Bug 25723: (QA follow-up) Remove unused module import

The last usage of this module was removed in the commit
"Bug 25723: Update cache flushing calls" but the import was
not removed along with it.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e8fe7de5be946735b59fdc5cd8e8c6b166ed2475)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25723: (QA follow-up) Handle holiday and exception on same day
Nick Clemens [Fri, 17 Jul 2020 12:34:18 +0000 (12:34 +0000)]
Bug 25723: (QA follow-up) Handle holiday and exception on same day

When a holiday is entered, then exceptions generated on a range, there exists both a holiday and exception in
the special holidays table. We should cache the exception over the holiday instead of both

Also, !1 in perl returns '' rather than 0, so we should explicitly set the value

Add blank line to clear pod error from qa tools

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Re-introduce the blank line mentioned in the commit message, it was accidentally removed by automatic formatting
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 223b603f08267f801860bf5deaaa1884e58eab1e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25723: (QA follow-up) Silent POD warning
Martin Renvoize [Wed, 17 Jun 2020 13:04:14 +0000 (14:04 +0100)]
Bug 25723: (QA follow-up) Silent POD warning

I didn't introduce the method that is warned about, but adding POD for
it seemed reasonable and will silence the QA Script warning.

Signed-off-by: Emma Perks <Emma.Perks2@uhb.nhs.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5851539424d04eda0da52ef8744925227dd6ce0f)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25723: Remove tests for removed method
Martin Renvoize [Wed, 17 Jun 2020 12:46:34 +0000 (13:46 +0100)]
Bug 25723: Remove tests for removed method

We removed the exception_holidays (and single_holidays) methods as part
of this patchset. As such, we should no longer test them ;)

Signed-off-by: Emma Perks <Emma.Perks2@uhb.nhs.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 25f0d425eaa7c66953d02c5a5717b1b2abcb89a6)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25723: Update cache flushing calls
Martin Renvoize [Wed, 17 Jun 2020 12:18:24 +0000 (13:18 +0100)]
Bug 25723: Update cache flushing calls

This patch updates the previous single_holidays and exeption_holidays
cache flushing calls to match the new cache key structure of the updated
routines.

Signed-off-by: Emma Perks <Emma.Perks2@uhb.nhs.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 61141c28b0fcbbb021371bb4c2dd8e818aec0691)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25723: Use the same code for single and exception holidays
Martin Renvoize [Wed, 17 Jun 2020 10:14:30 +0000 (11:14 +0100)]
Bug 25723: Use the same code for single and exception holidays

This patch refactors is_exception_holiday and is_single_holiday to
utilise a single _holidays method which combines the logic of the
previous single_holidays and exception_holidays methods.

As Koha::Calendar is instantiated at a branch level, we also move split
the cache into branches too.

Signed-off-by: Emma Perks <Emma.Perks2@uhb.nhs.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ae0b2befe8c9086df24469cb546c7c5f8d98de95)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25723: Use a hasref for lookup
Martin Renvoize [Fri, 12 Jun 2020 15:30:28 +0000 (16:30 +0100)]
Bug 25723: Use a hasref for lookup

Rather than using an array of dates and iterating them, use a hashref
and do a direct lookup

Signed-off-by: Emma Perks <Emma.Perks2@uhb.nhs.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e1dfe50522a01a7640fcca6e2a015206939579c9)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25723: Drop DateTime::Set from cpanfile
Martin Renvoize [Fri, 12 Jun 2020 15:02:26 +0000 (16:02 +0100)]
Bug 25723: Drop DateTime::Set from cpanfile

Signed-off-by: Emma Perks <Emma.Perks2@uhb.nhs.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit cd862763c9654ded15c1a7d79fafb2ec73e4f20e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25723: (follow-up) Fix Unit Test
Martin Renvoize [Fri, 12 Jun 2020 14:11:52 +0000 (15:11 +0100)]
Bug 25723: (follow-up) Fix Unit Test

The unit test previously relied on the internals of exception_holidays.

Signed-off-by: Emma Perks <Emma.Perks2@uhb.nhs.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5b2990d270fdde9fd7f69f6402db9ee171b6473e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25723: Drop DateTime::Set dependancy
Martin Renvoize [Fri, 12 Jun 2020 10:53:49 +0000 (11:53 +0100)]
Bug 25723: Drop DateTime::Set dependancy

This patch removes our use of DateTime::Set and replaces it with a quick
hashref implimentation

Signed-off-by: Emma Perks <Emma.Perks2@uhb.nhs.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0f0553da225052ff5b8b9bca7a386e04472f32da)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25718: Correct typo in additem.tt
Caroline Cyr La Rose [Wed, 8 Jul 2020 21:24:46 +0000 (17:24 -0400)]
Bug 25718: Correct typo in additem.tt

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>
(cherry picked from commit 2440d480ca24bd1d15731fbd32aec0ea3aa71086)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25717: Improve automatic renewal error messages
David Nind [Sat, 27 Jun 2020 00:38:46 +0000 (00:38 +0000)]
Bug 25717: Improve automatic renewal error messages

Improve wording and grammar for automatic renewal error messages.

Test plan:
1. Review the error message changes and make sure they make sense.

The new message make sense to me.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 379fd6d838d9909ea5784011486f3d184766a833)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25511: Add POD for --force
Jonathan Druart [Mon, 20 Jul 2020 14:57:42 +0000 (16:57 +0200)]
Bug 25511: Add POD for --force

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0c0666c531133a4c743a50ee01a0aada84c2e3cf)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25511: Add --force option to update_dbix_class_files.pl
Martin Renvoize [Fri, 15 May 2020 09:51:46 +0000 (10:51 +0100)]
Bug 25511: Add --force option to update_dbix_class_files.pl

This adds a --force option to the aforementioned script allowing those
in the know to overwrite the schema when changes above the found are
detected.

Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 34666e26902facdc3bc7e46a7ecd539f69f813e5)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25427: Make authority subfield management interface consistent MARC view
Owen Leonard [Fri, 8 May 2020 15:11:19 +0000 (15:11 +0000)]
Bug 25427: Make authority subfield management interface consistent MARC view

This patch makes a couple of minor changes to the authority MARC
subfield structure administration interface to make it more consistent
with the corresponding MARC subfield interface.

To test, apply the patch and go to Administration -> Authority types.

- Pick an authority type to edit, for instance PERSO_NAME, and choose
  'MARC structure' from the Actions menu.
- Pick a tag to edit and select "Subfields" from the Actions menu.
- In the table of subfields for that tag, each subfield in the first
  column should link to the edit interface for that subfield (its tab
  pre-selected).
- The "Edit" button in that table should do the same.

Signed-off-by: Heather Hernandez <heather_hernandez@nps.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f1f3117583a41d02f2ad794622f9becd469720f0)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25984: Compile CSS
Lucas Gass [Mon, 27 Jul 2020 17:23:20 +0000 (17:23 +0000)]
Bug 25984: Compile CSS

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25984: Add minimum height and width to shelf browser covers
Owen Leonard [Mon, 13 Jul 2020 15:18:23 +0000 (15:18 +0000)]
Bug 25984: Add minimum height and width to shelf browser covers

This patch adds a class to the shelf browser cover image links and a
style for these links defining a minimum height and width. This allows
the browser's default tab focus outline to be visible.

This patch also adds a check for an enabled cover image service before
displaying the cover image links.

This patch introduces whitespace changes so diff accordingly.

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).

- Enable the OPACShelfBrowser system preference.
- Enable at least one cover image service (Amazon, Google, Coce, etc).
- Locate a title in the OPAC which has items attached.
- On the bibliographic detail page, click the "Browse shelf" link in the
  table of holdings to display the shelf browser.
- Use the tab key to move the focus to cover images in the shelf
  browser.
- Confirm that the focus outline moves through each cover link whether
  or not there is a cover image available.
- Diable all cover image services.
- Test the shelf browser again and confirm that it's not necessary to
  tap through an empty row.

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>
(cherry picked from commit e722dd1725e113acd79dcb9e8eed2cd4da35aa33)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25244: Add specific aria-label to search results
Martin Renvoize [Mon, 29 Jun 2020 14:55:17 +0000 (15:55 +0100)]
Bug 25244: Add specific aria-label to search results

This patch adds an arai-lebel to the select checkboxes on the search
results page of the OPAC.

Test plan
1/ Perform a search that will yield some results
2/ Inspect the 'checkbox' on the left side of the results table
3/ Note that there is no arai-label
4/ Apply patch
5/ Refresh the search results page
6/ Inspect the 'checkbox' on the left side of the results table
7/ Note that the aria-label now appears and contains relavant
information
8/ Signoff

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Bug 25244: (follow-up) QA corrections

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d1a7112a9054305ead325daedd6bb106a31b346f)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25922: Fix typo 'arial-label' -> 'aria-label'
Julian Maurice [Fri, 3 Jul 2020 13:36:04 +0000 (17:36 +0400)]
Bug 25922: Fix typo 'arial-label' -> 'aria-label'

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 73ff914d5d537947b5fdc4cd602e79f41af5179a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25922: Add aria-label to the allowlist for translation
Martin Renvoize [Fri, 3 Jul 2020 13:07:25 +0000 (14:07 +0100)]
Bug 25922: Add aria-label to the allowlist for translation

This patch adds aria-label to the allowlist for translations.

To test:
- Apply patches from here and bug 25244
- kshell
- cd misc/translator
- perl translate update de-DE
- Check for the aria-label in the diff
- Verify the strings appear in the po files now
- Translate them
- perl translate install de-DE
- Verify the translated strings appear in the template

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 280f1bdeb3cbec9f57d71e980490e32af61eecfb)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25237: Fix semantic heading for opac-details
Martin Renvoize [Thu, 11 Jun 2020 11:45:57 +0000 (12:45 +0100)]
Bug 25237: Fix semantic heading for opac-details

Prior to this patch the opac-details view contained semantically incorrect h3
headings for the author information.

Test plan
1/ Perform a search in the OPAC that will yield results
2/ Navigate to any results detailed view
3/ Inspect the page and note that there are semantically incorrect headings
   H1 (Page title) > H2 (Item title) > H5 (Author)
4/ Apply the patch
5/ Reload the page
6/ Inspect the page and note that the semantically incorrect author block has
   been converted to a span with an 'h3' class for styling
7/ Note the page still appears nicely
8/ Signoff

Bonus points: Check with XSLT views enabled and disabled.

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>
(cherry picked from commit 6b49a70b94d6b5e0e2e1cde3025ade1278814925)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25155: (follow-up) Increase headings levels by 1
Martin Renvoize [Thu, 11 Jun 2020 09:14:03 +0000 (10:14 +0100)]
Bug 25155: (follow-up) Increase headings levels by 1

In the previous patch we reduced the headings levels by 2, but this was
one level too many as we already have an H1 in the navbar and so all
other heading sets should start at level 2 to semantically follow the
title heading.

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>
(cherry picked from commit c9a0243f3abf407e1a89d7bfc125911cc153b3cc)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25155: Fixing semantic headings login modal
Martin Renvoize [Thu, 11 Jun 2020 08:32:45 +0000 (09:32 +0100)]
Bug 25155: Fixing semantic headings login modal

The login modal headings were semantically incorrect prior to this
patch.

Test plan:
1) Click the 'Log in to your account' option to expose the modal
2) Use a headings inspector and note we jump from H1 (Page Title) -> H3
   (Modal Title)
3) Apply the patch and reload the page.
4) Click the 'Log in to your account' option to expose the modal
5) The modal should still appear well formed
6) Use a headings inspector and note we jump from H1 (Page Title) -> H2
   (Modal Title) -> H3 (Shibboleth title if enabled)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 513b226873759ba3df6765dce635fe96cf5a51f3)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25155: Fixing semantic headings in opac-auth.tt
Hayley Mapley [Thu, 11 Jun 2020 01:13:30 +0000 (13:13 +1200)]
Bug 25155: Fixing semantic headings in opac-auth.tt

Test plan:
1) Follow test plan from comment #1
2) Apply the patch
3) Reload the page, and note that is still displays fine
4) Check that the main heading is now an h1, and that the other headings
on the page make sense

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0bc47b5302fba91c1315acee5533ec5917df5761)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 24625: Store showLastPatron information using localStorage
Owen Leonard [Wed, 1 Apr 2020 16:06:33 +0000 (16:06 +0000)]
Bug 24625: Store showLastPatron information using localStorage

This patch removes the use of jquery.cookie to store "last patron"
information, using localStorage instead. jquery.cookie.js is obsolete.
See Bug 24624.

localStorage has been chosen as an alternative in this situation because
it does not require transmission between the client and the server. See
Bug 12410.

Because there is no "session only" option with localStorage, additional
handling of the showLastPatron data is added to the login page. That
takes care of "stale" last patron information if user didn't log out but
the session expired for some reason.

To test apply the patch and enable the showLastPatron system preference.

 1. Load a patron's account for checkout
 2. Navigate away from patron-related pages: Perform a catalog search
    from the search header form and open the detail page from the search
    results. Confirm that the correct last patron information still
    shows.
 3. Load another patron's account for checkout
    - There should now be a "Last patron" link in the breadcrumbs bar
      which links to the patron in step 1. Hovering your mouse over the
      link should display a tooltip containing the patron's name and
      card number.
    - Click the "X" to clear the last patron information. The last
      patron link should go away.
 4. Log out and log back in. The last patron information should be gone.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a512ae01fc7e17385e2d2dd42f53f79ae1f55d3a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 23820: Fix Koha/Club/Hold.t
Jonathan Druart [Tue, 21 Jul 2020 08:08:02 +0000 (10:08 +0200)]
Bug 23820: Fix Koha/Club/Hold.t

kohadev-koha@kohadevbox:/kohadevbox/koha$ prove t/db_dependent/Koha/Club/Hold.t
t/db_dependent/Koha/Club/Hold.t .. Patron(238) Hold cannot be placed. Reason: libraryNotPickupLocation at /kohadevbox/koha/Koha/Club/Hold.pm line 98.
    # Looks like you planned 5 tests but ran 4.
t/db_dependent/Koha/Club/Hold.t .. 1/1
 #   Failed test 'add'
 #   at t/db_dependent/Koha/Club/Hold.t line 86.
Can't call method "borrowernumber" on an undefined value at t/db_dependent/Koha/Club/Hold.t line 83.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4f5f5d88b98c2d1f6cc20bc6be6f5b41fb7d3c48)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 24165: Add ability to send any item field in a library chosen SIP field
Kyle M Hall [Tue, 3 Dec 2019 20:16:57 +0000 (15:16 -0500)]
Bug 24165: Add ability to send any item field in a library chosen SIP field

Some SIP devices need access to item fields that are not sent as item information in the checkin, checkout and item information responses.
It makes sense to allow these fields to be sent in an arbitrary and configurable way, rather than hard code in each special case.

Test Plan:
1) Apply this patch
2) Edit your SIP2 config file, add the following within the login stanza:
   <item_field field="XX" code="<item field 1>" />
   <item_field field="XZ" code="<item fied 2>" />
   where <item field 1> and <item field 2> are item table columns of your choosing
3) Using the sip cli emulator, run checkout, checkin and item information
   messages using that item.
4) Note the values you set for the item columns are sent in the
   corrosponding fields!

Signed-off-by: Jill Kleven <jill.kleven@pueblolibrary.org>
Fixed merge conflict with number of tests (was 5, changed to 7 which is correct)
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ee838b171644e362cceae13ceb732d46a9a8e53b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 23820: (QA follow-up) Make label clickable for checkbox
Katrin Fischer [Wed, 1 Jul 2020 11:30:18 +0000 (11:30 +0000)]
Bug 23820: (QA follow-up) Make label clickable for checkbox

By adding an id the checkbox is selected when the label is clicked
enhancing usability.

Also adds a colon : to the label.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f776354e33a1f2fc24cc0b1fb17132bc3d1c3813)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 23820: Add test for new behaviour
Agustin Moyano [Fri, 29 May 2020 16:16:29 +0000 (13:16 -0300)]
Bug 23820: Add test for new behaviour

To test:
1. prove t/db_dependent/api/v1/clubs_holds.t
2. Sign off

Sponsored-by: Southeast Kansas Library - SEKLS
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 20395eefda56541e6cac8cd51dd6134b7a61486a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 23820: Add checkout to default to patron's home branch on club hold
Agustin Moyano [Mon, 30 Mar 2020 18:56:18 +0000 (18:56 +0000)]
Bug 23820: Add checkout to default to patron's home branch on club hold

This patch adds a checkbox to make holds created by club hold to default to patron's home branch if possible.

To test:
1. Apply this patch
2. Create a club, and add two patrons (from now on called patron A and patron B) to it, each one form a different library..
3. Create a hold for the club, and in the details set pickup location different from any of the patrons.
4. Check "Pickup at patron's home library when possible" checkbox
SUCCESS => when submitted, pickup location of holds defaults to patron's home branch
5. Modify patron A's library and set pickup location to no.
6. Repeat steps 3 and 4.
SUCCESS => when submitted, patron A's hold now points to pickup location setted on step 3, and patron B's hold still points to his home branch.
7. Sign off

Sponsored-by: Southeast Kansas Library - SEKLS
Signed-off-by: Jason Robb <jrobb@sekls.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8ed09ff7de47e7752d2fcb0a5aff183e07f4e5f3)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 23148: DBRev 20.05.02.002
Lucas Gass [Mon, 27 Jul 2020 16:03:12 +0000 (16:03 +0000)]
Bug 23148: DBRev 20.05.02.002

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 23148: Fix bridge image paths in de-DE installer files
Julian Maurice [Fri, 3 Jul 2020 06:58:50 +0000 (10:58 +0400)]
Bug 23148: Fix bridge image paths in de-DE installer files

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d4975885b07db43777afb20dc19ef0e4851adc95)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 23148: (follow-up) Correct image paths in sample data and tests
Owen Leonard [Mon, 29 Jun 2020 11:57:52 +0000 (11:57 +0000)]
Bug 23148: (follow-up) Correct image paths in sample data and tests

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 46372b4bbd6aafae9cb524717f17135cd236bffe)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 23148: (follow-up) Replace gif files in the OPAC with pngs
Owen Leonard [Fri, 26 Jun 2020 16:37:28 +0000 (16:37 +0000)]
Bug 23148: (follow-up) Replace gif files in the OPAC with pngs

This patch removes the old gif files from the OPAC bridge set and
replaces them with png files.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3d3b207fe8bc2d398289bc81090e8d4e92152278)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 23148: Replace Bridge icons with transparent PNG files
Owen Leonard [Fri, 11 Oct 2019 20:14:33 +0000 (16:14 -0400)]
Bug 23148: Replace Bridge icons with transparent PNG files

This patch adds SVG versions of the Bridge item type icon set to
misc/interface_customization/itemtypeimg/bridge. It adds some
new icons, and updates some existing icons. All GIF versions of the
icons are replaced with transparent PNG files.

Icon changes:

- English text has been removed from all icons
- New icon for "Periodical," to differentiate from "Journal"
- New icon, "Controller" for video games
- New icon for "Laserdisk" to differentiate from "DVD"
- New icon for "Kit" to differentiate from "Archive"
- New icon, "Reference books."
- Updated "badges" on "Juvenile book" and "Reserve book" to try to
  express the information without English-specific letters.

Before applying the patch, update some item types or collection codes
with Bridge icons. Apply the patch and run the database update process.

 - Open the advanced search page in the staff client and confirm that
   your item type or collection code icons were updated correctly.
 - Go to Administration -> Item types and edit an item type.
   - Check the "bridge" tab and confirm that the icon options look
     correct.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1625519b9e572e7c2dbe6af8ad813be5ff0a1458)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 23070: Pass no_triggers => 1 to Koha::Objects->update
Jonathan Druart [Wed, 29 Apr 2020 10:19:46 +0000 (12:19 +0200)]
Bug 23070: Pass no_triggers => 1 to Koha::Objects->update

To make sure we will update all the objects in one go (and no trigger
the ->set->store from Koha::Object->update)

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>
(cherry picked from commit 4b299f54aaed64f3ad4ff3a59eae743ed4f17c49)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 23070: Increment all priorities in 1 query
Jonathan Druart [Mon, 27 Jan 2020 13:55:54 +0000 (14:55 +0100)]
Bug 23070: Increment all priorities in 1 query

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>
(cherry picked from commit 6f6f88105db069fb365307f2e2ffaae11c863421)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 23070: Add tests
Jonathan Druart [Mon, 27 Jan 2020 13:53:23 +0000 (14:53 +0100)]
Bug 23070: Add tests

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>
(cherry picked from commit c77f4496b2a9dbc26f59d467032eb74f0d27f328)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 23070: Use Koha::Hold in C4::Reserves::RevertWaitingStatus
Jonathan Druart [Thu, 6 Jun 2019 20:14:28 +0000 (15:14 -0500)]
Bug 23070: Use Koha::Hold in C4::Reserves::RevertWaitingStatus

We are using raw SQL statements, we should use Koha::Hold instead.

This patch does not seem optimal, we would like to increment priority in
only 1 statement and without the need to fetch and loop all holds.

== Test plan ==
- apply patch
- place some holds on the same record
- check that the priorities look good
- mark one hold as waiting by doing a check-in
- revert the waiting status
- confirm that the priorities are recalculated correctly

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>
(cherry picked from commit 563a25d952ee571eb1d626f97eef001c5f646b1f)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 8338: (QA follow-up) Fix test for backdated return
Martin Renvoize [Tue, 21 Jul 2020 10:18:16 +0000 (11:18 +0100)]
Bug 8338: (QA follow-up) Fix test for backdated return

A test for CalculateFinesOnBackdate was introduced since this bug was
written and needed updateing.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 56ee42082f0382d2b5e5a8cef081bef886664d7d)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 8338: (QA follow-up) Clean up warning
Martin Renvoize [Tue, 23 Jun 2020 14:10:50 +0000 (15:10 +0100)]
Bug 8338: (QA follow-up) Clean up warning

This patch moves the accountline->store call below the FinesLog code
such that we return the same 'thing' from _FixOverduesOnReturn as the
other clauses of the routine.

We also take the oportunity to clean up the warning thrown by an errant
call to the routine such that we output the actual itemnumber rather
than a HASH reference marker.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit dae82b191abb87b88e6f455179f5776ce04dc2b8)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 8338: (QA follow-up) Fix perlcritic error
Martin Renvoize [Mon, 22 Jun 2020 07:49:15 +0000 (08:49 +0100)]
Bug 8338: (QA follow-up) Fix perlcritic error

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 312b1c68870aec89eb81b31e7d168421548d2586)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 8338: (follow-up) Fix test
Martin Renvoize [Tue, 2 Jun 2020 16:37:38 +0000 (17:37 +0100)]
Bug 8338: (follow-up) Fix test

This patch moves the previous test introduced with bug 24075 into the
same block as the rest of the AddReturn tests and updates it to test for
the new 'remove accountline' behaviour as well as the reduce and refund
behaviour.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 64bb70d579ffe3a6967103239ba683fd1c0cbd25)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 8338: Remove zero amount overdues on backdated returns where appropriate
Martin Renvoize [Wed, 13 May 2020 13:11:38 +0000 (14:11 +0100)]
Bug 8338: Remove zero amount overdues on backdated returns where appropriate

This patch removes any overdues which would be reversed on a backdated
return if CalcFineOnBackdate is enabled and the user has not already
attempted to pay off the accruing fine.

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>
(cherry picked from commit 3f3534a8eeed87869fd6a858866455c10087d7e1)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 8338: Unit Tests
Martin Renvoize [Wed, 13 May 2020 13:11:16 +0000 (14:11 +0100)]
Bug 8338: Unit Tests

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>
(cherry picked from commit a25b95c2e63a1705f406388f4419aa7972abc3b8)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26005: OPAC cart display fails with error
Owen Leonard [Fri, 17 Jul 2020 13:57:34 +0000 (13:57 +0000)]
Bug 26005: OPAC cart display fails with error

This patch removes the "opac_option" parameter from opac-basket.pl. It
was included in Bug 25402 because the bug was dependent on 5087.

To test, apply the patch and add some items to the Cart in the OPAC.
Click the Cart button to show the cart. The pop-up window should load
correctly without errors.

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 619d7dde80f16cbcae40582b1fa4f5bd9238eac8)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25293: Don't call escapeHtml on null
Didier Gautheron [Tue, 28 Apr 2020 05:43:46 +0000 (07:43 +0200)]
Bug 25293: Don't call escapeHtml on null

 Test Plan:

    1) Create two Checkouts
    2) view patron's checkout list
       cgi-bin/koha/members/moremember.pl?borrowernumber=pp <show
       checkout>
    3) in mysql shell delete a checkout home branch: update items set
       homebranch = null where itemnumber = xx;
    4) view patron's checkout list, again

    Without this patch the list is empty.

    Same if biblio title is null (update biblio set title = null where
    biblionumber = yy;).
    Javascript error:
    TypeError: oObj.title is null

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>
(cherry picked from commit 2b56ae1d4a231a83f52420ec9efc4829226fa86a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25987: Fix alignment of fields in label batch creation form
Owen Leonard [Tue, 14 Jul 2020 21:30:39 +0000 (21:30 +0000)]
Bug 25987: Fix alignment of fields in label batch creation form

This patch makes minor markup changes to the template for the label
batch creation process so that form fields line up correctly.

Unrelated change: A hint has been moved out of the label area to below
the textarea in order to conform with established patterns.

To test, apply the patch and go to Tools > Label creator > New > Label
batch.

 - In the batch creation form the "Enter by itemnumber" and "Enter by
   barcode" should be aligned correctly with each other.
 - The "One number per line..." hint should appear below the textarea.
 - Test that the form fields are still correctly aligned after adding
   some items to the batch and the "description" field is shown in the
   form.

Works for me!

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 00f04146e915b2b1a9881439ac34088e6486921f)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 24473: Add $raw filter for Syndetics content
Lucas Gass [Tue, 21 Jan 2020 17:53:09 +0000 (17:53 +0000)]
Bug 24473: Add $raw filter for Syndetics content

Syndetics offers enhanced content in the OPAC under the tabs 'Title Notes',
'Excerpt', 'About the author', 'Editions'. They provide this info as HTML
therefore we should filter it as $raw so the content shows up without the markup.

Signed-off-by: Stina Hallin <stina.hallin@ub.lu.se>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6b9572e0c8fb9f1ad1e60ed5db50e69c60ac1a00)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25862: Prevent TinyMCE to mangle local url links
Didier Gautheron [Wed, 24 Jun 2020 14:03:16 +0000 (16:03 +0200)]
Bug 25862: Prevent TinyMCE to mangle local url links

To test:
1 create a report 1 if it doesn't exist
2 open /cgi-bin/koha/tools/koha-news.pl
3 create a news
4 add a HTML link with Insert/Edit link tinyMCE dialog box to
  /cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Run%20this%20report "report 1"
5 save
6 on the main page "report 1" link returns a 404 error

Apply patch
7 Modify news' URL
8 Test it works in: tools/koha-new.pl admin/branches.pl and admin/preferences.pl

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>
(cherry picked from commit 2fbe775070637ebdddcc9ea0b455e80dbb85a83d)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 24379: Fix failing tests
Jonathan Druart [Mon, 20 Jul 2020 13:16:29 +0000 (15:16 +0200)]
Bug 24379: Fix failing tests

kohadev-koha@kohadevbox:/kohadevbox/koha$ prove t/db_dependent/Koha/Patrons/Import.t
t/db_dependent/Koha/Patrons/Import.t .. 2/159
 #   Failed test 'No warning raised by import_patrons'
 #   at t/db_dependent/Koha/Patrons/Import.t line 171.
 # found warning: Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018, <$handle_3a> line 2.
 # found warning: Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018, <$handle_3a> line 2.
 # didn't expect to find a warning
Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018, <$handle_2> line 2.
Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018, <$handle_2> line 2.
Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018, <$handle_3> line 2.
Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018, <$handle_3> line 2.
Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018, <$handle_4> line 2.
Argument "" isn't numeric in numeric eq (==) at /usr/share/perl5/DBIx/Class/Row.pm line 1018, <$handle_4> line 2.
t/db_dependent/Koha/Patrons/Import.t .. 152/159 # Looks like you failed 1 test of 159.
t/db_dependent/Koha/Patrons/Import.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/159 subtests

Test Summary Report
-------------------
t/db_dependent/Koha/Patrons/Import.t (Wstat: 256 Tests: 159 Failed: 1)
  Failed test:  39
  Non-zero exit status: 1
Files=1, Tests=159,  3 wallclock secs ( 0.04 usr  0.01 sys +  2.11 cusr  0.24 csys =  2.40 CPU)
Result: FAIL

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 545e03c173c789241eb21773a939b4ab7dcc6da4)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 24379: DBIC changes
Lucas Gass [Fri, 24 Jul 2020 22:13:12 +0000 (22:13 +0000)]
Bug 24379: DBIC changes

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 24379: DBRev 20.05.02.001
Lucas Gass [Fri, 24 Jul 2020 21:55:44 +0000 (21:55 +0000)]
Bug 24379: DBRev 20.05.02.001

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 24379: Make login_attempts not nullable
Nick Clemens [Wed, 8 Jan 2020 20:59:38 +0000 (20:59 +0000)]
Bug 24379: Make login_attempts not nullable

While the column defaults to 0 in Koha::Object->store we set to NULL if NULLABLE

When trying to reset a patrons password we check that the account is not administratively locked:
login_attempts != -1

This query does not return rows where login_attempts IS NULL. It will return accounts where login_attempts = 0

Let's default to 0 like we intend

To test:
1 - Create a new patron
2 - Note their login_attempts is NULL
    SELECT login_attempts FROM borrowers ORDER BY borrowernumber DESC LIMIT 1
3 - Enable  OpacResetPassword
4 - Attempt to reset password before logging in, you cannot
5 - Apply patch, updatedatabase, restart_all, update schema
6 - Create another patron
7 - Their login attempts should be 0
8 - Attempt to reset password, it works!

Bug 24379: Fix the test

First we create a patron using TestBuilder to get a hashref of valid
info. Then we delete it and create a new patron using Koha::Patron->new
Once stored, we should call discard_changes to make the calculated
values available in the currenct object.

Bug 24379: Don't drop default of 0 for login attempts

When moving the column we drop the default, this means that DBs upgraded form earlier versions
get the wrong values set

To test:
1 - Checkout 16.11.x
2 - Reset all
3 - Checkout master
4 - updatedatabase
5 - SHOW CREATE TABLE borrowers;
6 - Note the column login_attempts defaults to NULL
7 - Apply patch(es)
8 - Repeat
9 - Now it defaults ot 0 (and has NOT NULL if applied all)

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>
(cherry picked from commit 7bb31cffae27dc398a7b4a4decf3623ec65478ac)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25868: Fix transfers page to show effective itemtype
Fridolin Somers [Wed, 24 Jun 2020 15:05:30 +0000 (17:05 +0200)]
Bug 25868: Fix transfers page to show effective itemtype

In transfers page /cgi-bin/koha/circ/branchtransfers.pl :
Itemtype is always from biblioitems.itemtype, regardless of system preference item-level_itypes.

Patch also changes template to use the object Koha::Item.

Patch also fixes a small typo : closed <form> tag.

Test plan :
1) Test with both values of system preference 'item-level_itypes'
2) Go to Circulation > Transfert
3) Enter a barcode
4) Enter another barcode
5) Check you see in table all datas and that 'Item type' is correct

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>
(cherry picked from commit e441cb35fb13670e65b9437706561c17d1311945)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25869: Fix Coce display for lists
Nick Clemens [Wed, 24 Jun 2020 16:17:19 +0000 (16:17 +0000)]
Bug 25869: Fix Coce display for lists

To test:
1 - Enable Coce for Opac
    CoceHost: https://coce.bywatersolutions.com
    CoceProviders: Select all
    OpacCoce: Enable
2 - Do a search on the Opac, confirm you see some covers
3 - Add some of the items with covers to a public list
4 - View the public list
5 - Note no covers display
6 - Apply patch
7 - Success!

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>
(cherry picked from commit f77a377c939080eed36401746b5d722c91ee964b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25950: Remove <client> in X-Forwarded-For from proxy tests
David Cook [Wed, 8 Jul 2020 07:10:50 +0000 (07:10 +0000)]
Bug 25950: Remove <client> in X-Forwarded-For from proxy tests

This patch removes the <client> ip address in the X-Forwarded-For
header from being tested against koha_trusted_proxies.

Without this patch, REMOTE_ADDR will be set to null, if the <client>
ip address matches against koha_trusted_proxies.

To Test:
1. Run the unit test t/Koha/Middleware/RealIP.t

Signed-off-by: Didier Gautheron <didier.gautheron@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7b84fda33b23347846ae50016f1e4b38b0fd95f4)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25726: make holds to pull ignore holds where found is not null and itemnumber...
Andrew Fuerste-Henry [Fri, 12 Jun 2020 13:51:16 +0000 (13:51 +0000)]
Bug 25726: make holds to pull ignore holds where found is not null and itemnumber is null

To test:
1- place 2 bib-level holds on available items
2- confirm they both show on Holds to Pull
3- edit one hold from the database to set found='T'
4- reload Holds to Pull, confirm it is now empty
5- apply patch
6- Reload Holds to Pull
7- confirm it now shows the hold you did not edit

Signed-off-by: donnab <donna@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Using capitals for SQL reserved words; added a FIXME
Tested with:
    update reserves set found='T', itemnumber=NULL where reserve_id=...
This should be a workaround while we fix the underlying problem.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 56220d211d7b5c4e2622787f9ea38ab12c8868f5)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25944: Schema fix for illrequests route
Martin Renvoize [Tue, 7 Jul 2020 08:27:48 +0000 (09:27 +0100)]
Bug 25944: Schema fix for illrequests route

The illrequests path was missing the `comments` and `status_alias`
embedable relations in the path specification.

Test plan:
1/ Ensure you have the latest Mojolicious + OpenAPI modules installed.
2/ Navigate to the ill requests page and note that the table is empty.
3/ Note that under the networking tab in your browsers developer tools
that the api call fails with a 400 error.
4/ Apply the patch
5/ Refresh the page
6/ The table should now load and the api route should return a proper
200 response.
7/ Signoff

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Magnus Enger <magnus@libriotech.no>
Applied the patch to a production server that was having the 400
error on the main ILL page, and the error was gone.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 40ab030060d6cbacb0be9df981fb28a6ade705ea)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25566: Add option to ignore found holds and use it when checking high holds
Nick Clemens [Thu, 21 May 2020 13:41:23 +0000 (13:41 +0000)]
Bug 25566: Add option to ignore found holds and use it when checking high holds

To test:
 1 - Find or create a record with 10 items
 2 - Set sysprefs:
     decreaseLoanHighHolds - enable
     decreaseLoanHighHoldsDuration - 2
     decreaseLoanHighHoldsValue - 2
     decreaseLoanHighHoldsControl  - 'over the number of holdable items'/dynamic
 3 - Set circ rules to allow 1 hold per record on the relevant record
 4 - Place 3 holds on the record
 5 - Check one item in and confirm hold to set to waiting
 6 - Issue to the patron with the waiting hold
 7 - Get a notice that loan period is decreased
 8 - Don't confirm the checkout
 9 - Apply patch
10 - Restart all the things
11 - Repeat checkout, no decrease this time!

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 96a871035043c7ffd93c61e756ee1ff89e3da0f0)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25850: Add tests for weekday holidays
Martin Renvoize [Fri, 26 Jun 2020 15:24:00 +0000 (16:24 +0100)]
Bug 25850: Add tests for weekday holidays

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 4ed4e468d2ceaf4502b817feb791656d5a159fa5)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25850: (QA follow-up) use dt_from_string
Nick Clemens [Tue, 7 Jul 2020 12:05:42 +0000 (12:05 +0000)]
Bug 25850: (QA follow-up) use dt_from_string

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 92970a9abad312a07d9efba46cc57b27469a0509)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25850: (QA follow-up) Match logic in is_holiday
Martin Renvoize [Mon, 29 Jun 2020 08:54:58 +0000 (09:54 +0100)]
Bug 25850: (QA follow-up) Match logic in is_holiday

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit afd88e1d21a5cb5f2198c058144065b64098c124)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25850: Adapt day of week in Koha::Calendar::get_push_amt to 0..6 with 0 being...
Andreas Jonsson [Tue, 23 Jun 2020 13:57:29 +0000 (15:57 +0200)]
Bug 25850: Adapt day of week in Koha::Calendar::get_push_amt to 0..6 with 0 being Sunday.

1. Go to tools -> calendar and make sure Sundays are holidays by adding
   a holiday on a Sunday and selecting "Holiday repeated every same day
   of the week" and "Copy to all libraries" and save.
2. Go to administration -> system preferences and select "Use the
   calendar to push the due date to the next open matching weekday
   for weekly loan periods, or the next open day otherwise" for the
   system preference "useDaysMode" and save the system preferences.
3. Put the below code in a file name test.pl and execute it using
   the command "sudo koha-shell -c 'perl test.pl' kohadev"

   use Koha::Calendar;

   my $calendar = Koha::Calendar->new( branchcode => 'CPL' );
   $dt = DateTime->new(
       year       => 2020,
       month      => 06,
       day        => 21
   );

   print "This is a sunday: " .
   $dt->day_of_week . "\n";

   my $ndt = $calendar->next_open_days($dt, 0);

   print "This is a monday: " .
   $ndt->day_of_week . "\n";

4. Without the patch applied, this script
   will freeze after printing "This is a
   sunday ...".  Abort using ctrl-c.
5. Apply patch and run the script again.
   The test script will now complete.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 25127f422821756b030b8f377b3e112b907be5eb)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25850: Regression Test
Martin Renvoize [Fri, 26 Jun 2020 15:52:50 +0000 (16:52 +0100)]
Bug 25850: Regression Test

This patch adds a unit test to test for an infinite loop as highlighted
by the bug.

Test plan
1/ Run the test before applying the fix
2/ The test should fail for 'Sundays'
3/ Apply the subsquent patch
4/ Re-run the test
5/ It should now pass

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 95c8d19530e8bef20e02be0b74d7927764bf7ed1)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25992: Make SIP2 logger subroutines exportable to prevent crash
Joonas Kylmälä [Wed, 15 Jul 2020 11:08:32 +0000 (11:08 +0000)]
Bug 25992: Make SIP2 logger subroutines exportable to prevent crash

If the subroutines are not exportable we get the following crash:

> Undefined subroutine &C4::SIP::SIPServer::set_logger

To test:
 In kohadevbox run for example:
 $ ps -aux # check that no existing sip server is running, kill the process if exists
 $ perl /kohadevbox/koha/C4/SIP/SIPServer.pm /etc/koha/sites/kohadev/SIPconfig.xml
 $ koha/misc/sip_cli_emulator.pl -su koha -sp koha -l CPL -a 127.0.0.1 -p 6001 --item 3999900000001 -m item_information

 After applying this patch the Undefined subroutine error should be gone.
 Note: when using the sip_cli_emulator.pl the credentials can be anything.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 082da615e649146197fbc9e0a20da672a82d4816)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25964: Prevent data loss when editing items from a MARC record
Jonathan Druart [Thu, 9 Jul 2020 08:52:11 +0000 (10:52 +0200)]
Bug 25964: Prevent data loss when editing items from a MARC record

Coming from:
  Bug 23463: Use new method Koha::Object->set_or_blank

We have DB fields that are not mapped with MARC fields, for instance paidfor. They are not handled correctly.

In ModItemFromMarc, we get a MARC record in parameter and update the item in DB. But we are loosing the fields that are not in the MARC record

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 189851fb9bbc831bb2875c2c440877c2562583d0)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25443: (follow-up) surround strings with <span>
Bernardo Gonzalez Kriegel [Sun, 24 May 2020 11:51:27 +0000 (08:51 -0300)]
Bug 25443: (follow-up) surround strings with <span>

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 46d3ec264c4e46cc73ee1713b5c39e6c564e5a1a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25443: Improve translation of 'Select the record to link%s to'
Katrin Fischer [Sun, 24 May 2020 00:04:03 +0000 (02:04 +0200)]
Bug 25443: Improve translation of 'Select the record to link%s to'

Before this patch the title was set in italic, which caused the
translation string to be cut off. Removing the italic formatting in
favor of quotes and splitting the string into 2 sentences (dealing
with title existing and not existing:

Select the host record to link to '[% bibliotitle | html %]'
Select the host record to link

To test:
- Activate EasyAnalyticalRecords system preference
- Search for a record in staff
- Use Edit > Link to host record
- Verify the text is shown as above with the reord's title
- The second case is a bit theoretical:
- Delete 245$a from the record or empty out biblio.title using SQL
- Verify the string still shows but without the 'to...' part.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d53b58cab858f06be7f9762b16b89c8bfbce5625)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25890: Update sorting column for checkouts table
Nick Clemens [Mon, 29 Jun 2020 11:04:59 +0000 (11:04 +0000)]
Bug 25890: Update sorting column for checkouts table

Test plan:
- Check some items out, all from different libraries
- Modify the checkout and due dates, like:
    2018-10-22
    2018-01-23
    2018-05-27
- Sort by checkout date, verify it is actually sorting on homebranch
- Apply patch
- Reload page
- Note you can now sort items 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>
(cherry picked from commit 6250c2dc1556dbf0ef87f2bb36f13534cb2e2368)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25695: merge of similar code blocks after circulation_rules update
Slava Shishkin [Thu, 18 Jun 2020 09:11:29 +0000 (12:11 +0300)]
Bug 25695: merge of similar code blocks after circulation_rules update

In onboarding.pl we have second block with adding just one more
rule parameter (maxissueqty) which can be merged to first one
after all parameters now stored in circulation_rules table.

Also this eliminates the need of adding forgotten "warn $@" after
the second eval block.

Mentored-by: Andrew Nugged <nugged@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5c581265abff940350df83a52228085aa0792fe0)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoUpdate release notes for the 20.05.02 release v20.05.02
Lucas Gass [Wed, 22 Jul 2020 21:05:42 +0000 (21:05 +0000)]
Update release notes for the 20.05.02 release

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoIncrement version for 20.05.02 release
Lucas Gass [Wed, 22 Jul 2020 20:59:18 +0000 (20:59 +0000)]
Increment version for 20.05.02 release

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoTranslation updates for Koha 20.05.02
Koha translators [Wed, 22 Jul 2020 20:41:50 +0000 (17:41 -0300)]
Translation updates for Koha 20.05.02

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25914: Fix incorrect variable name causing relative's checkouts column to be...
Kyle M Hall [Thu, 2 Jul 2020 12:32:51 +0000 (08:32 -0400)]
Bug 25914: Fix incorrect variable name causing relative's checkouts column to be empty in OPAC

In the OPAC, the title column in the relatives checkouts table is always empty.

Test Plan:
1) Enable viewing of relative's checkouts in OPAC
2) Check some items out to a patron
3) Log into the OPAC as a relative of that patron that should be able to
   view them
4) Note the title column is empty in the relative's checkouts tab
5) Apply this patch
6) Reload the page
7) Titles should appear in the title column!

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0b69ff1ed7a775b6fdca8513d1ec5a692e30bbe9)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25752: Stay in cwd after koha-shell
Jonathan Druart [Mon, 15 Jun 2020 14:11:49 +0000 (16:11 +0200)]
Bug 25752: Stay in cwd after koha-shell

After bug 25538, after a koha-shell we are not longer in the current directory:

root@cec7bffd8100:koha(master)$ pwd
/kohadevbox/koha
root@cec7bffd8100:koha(master)$ sudo koha-shell kohadev
kohadev-koha@cec7bffd8100:~$ pwd
/var/lib/koha/kohadev

Test plan:
Repeat the commands above and confirm that with this version of the
script you get /kohadevbox/koha inside the koha-shell

Search for possible regressions

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7555ecaafa3bd8bbf0514f3c2672cb41ff7e0aa7)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25864: Lower case fields for searching
Nick Clemens [Wed, 24 Jun 2020 12:20:03 +0000 (12:20 +0000)]
Bug 25864: Lower case fields for searching

To recreate:
 1 - Have Koha using ES5 and Elasticsearch as search engine
 2 - Enable DumpTemplateVarsIntranet and DumpSearchQueryTemplate
 3 - Do a search in authorities using 'Search entire record' (abduction if using sample db)
 4 - Note no results
 5 - View the page source and find 'search_query'
 6 - Note the uppercased fields
 7 - curl 'es:9200/koha_kohadev_authorities/data/417?pretty'
 8 - Note all fields lower-cased
 9 - Apply patch
10 - Repeat search
11 - It works!

Signed-off-by: Heather Hernandez <heather_hernandez@nps.gov>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 2ab6018b6e14ae2153093db148f04f71405f4493)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25864: Unit test adjustment
Nick Clemens [Wed, 24 Jun 2020 12:22:48 +0000 (12:22 +0000)]
Bug 25864: Unit test adjustment

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 579a3c11edf77d36488f352d88ae373cc4cbfa21)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25851: DBRev 20.05.01.003
Lucas Gass [Fri, 17 Jul 2020 19:52:49 +0000 (19:52 +0000)]
Bug 25851: DBRev 20.05.01.003

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25851: (bug 18928 follow-up) Remove holdallowed rule is value is an empty string
Jonathan Druart [Wed, 24 Jun 2020 06:37:18 +0000 (08:37 +0200)]
Bug 25851: (bug 18928 follow-up) Remove holdallowed rule is value is an empty string

On the interface, if "Hold policy" is "Not set", the rule does not exist
in the table. We should reflect that during the update DB process.

Test plan:
1. Set "Hold policy" to "Not set"
2. Confirm that you can place holds
3. Confirm that the rule does not exist in the DB table
4. Set the value to an empty string (manually)
5. Confirm that you cannot longer place holds
6. Go to the circulation rules page and confirm that the value of "Hold
policy" is "Not set"
7. Execute the update DB entry
8. Confirm that you can place holds
9. Confirm that the rule does not exist in the DB table

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c1e1c233ca69fe9f73efb1c939148f8c7afcf11e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 21395: Fix misc/admin/koha-preferences
Julian Maurice [Mon, 29 Jun 2020 13:23:35 +0000 (17:23 +0400)]
Bug 21395: Fix misc/admin/koha-preferences

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d3f0fc135b0b73b7dcf7fee09ca30a42e2e514a3)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 21395: Fix C4/Barcodes/ValueBuilder.pm
Julian Maurice [Mon, 29 Jun 2020 13:13:10 +0000 (17:13 +0400)]
Bug 21395: Fix C4/Barcodes/ValueBuilder.pm

$DEBUG variable was always set to 0, so it was useless

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3b06780fb29467fd4276dd25d92fca375a382471)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 21395: Ignore .perlcriticrc in t/Makefile.t
Julian Maurice [Mon, 29 Jun 2020 13:01:25 +0000 (17:01 +0400)]
Bug 21395: Ignore .perlcriticrc in t/Makefile.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 343a866b6fd6850edde89a79b0c534ee2f494f4b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 21395: Fix creation of PO file
Julian Maurice [Mon, 29 Jun 2020 12:57:11 +0000 (16:57 +0400)]
Bug 21395: Fix creation of PO file

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 133a3ef168af12897ba4c670db25d674fc876864)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25440: Fixed list of 'show_rule' forming variables in the template
Andrew Nugged [Wed, 17 Jun 2020 20:18:01 +0000 (23:18 +0300)]
Bug 25440: Fixed list of 'show_rule' forming variables in the template

In smart-rules.tt we have `SET show_rule = ...` section which filled
with 'all used in the loop' variables. Because if historical reasons it
seems that there are some missing, few old, and even doubled ones.
This list is fixed now by:

  - variable names 'article_requests' and 'renewalsallowed' repeated
    so duplicates are removed;

  - 'hardduedatebefore' and 'hardduedateexact' not present in the whole
    site code anywhere anymore;
    IMPORTANT NOTE: these 'hardduedatebefore/hardduedateexact' also
                    exists as remnants in .po-translation files, a lot.

  - 'note', 'hardduedatecompare', 'renewalperiod', 'rentaldiscount'
    template variables were missing from this 'show_rule =' checking
    code so they are added.

Order of fields updated to match with above "SET field = ..." pack.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 25440: (QA follow-up) Correction for typo

'engthunit -> lengthunit

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d11e16aec74ad694bd56ce3810954091b0bf1259)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25440: Fix for "uninitialized $maxsuspensiondays" in smart-rules.pl
Andrew Nugged [Tue, 19 May 2020 08:20:41 +0000 (11:20 +0300)]
Bug 25440: Fix for "uninitialized $maxsuspensiondays" in smart-rules.pl

This warning emitted:

Use of uninitialized value $maxsuspensiondays in string eq
at /admin/smart-rules.pl line 257.

But that not just undef-warning, there is broken logic,
these two lines are mutually contradictory and goes one-by-one:

    $maxsuspensiondays = undef if $maxsuspensiondays eq q||;
    $maxsuspensiondays = '' if $maxsuspensiondays eq q||;

Fix is simple: to make it '' if it comes undef.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit cb09303e11b11de2b25852a707211a054fb2b8e1)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25440: Fix for "uninitialized value in string eq" in smart-rules.pl
Andrew Nugged [Tue, 19 May 2020 08:03:13 +0000 (11:03 +0300)]
Bug 25440: Fix for "uninitialized value in string eq" in smart-rules.pl

This warning emitted:

Use of uninitialized value in string eq at /admin/smart-rules.pl line 289.

It is solved by one line added to exclude comparison with 'on' string
when variable is 'undef'.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5eebfcf68747b4886b23a9d4c8df37ea7d103edb)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25440: Fix for "uninitialized value in hash" warning in smart-rules.pl
Andrew Nugged [Sun, 10 May 2020 15:18:35 +0000 (18:18 +0300)]
Bug 25440: Fix for "uninitialized value in hash" warning in smart-rules.pl

This warning emitted:

Use of uninitialized value in hash element
at /admin/smart-rules.pl line 569.

that happened because we have NULLs in SQL results for 'categorycode'
and 'itemtype' which later used as 'any' kind of category/item in the
template, so for the template it passed this way:

    $rules->{ $r->{categorycode} }->{ $r->{itemtype} }->...

but undef will stringify as "" to become a hash key ("Hashes are
unordered collections of scalar values indexed by their associated
string key" https://perldoc.perl.org/perldata.html),

that's why "undef warning". To prevent warning here is the simple fix:

    $rules->{ $r->{categorycode} // '' }->{ $r->{itemtype} // '' }->...

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b48162f1be1853a89e0ffc898bc0927edef93f95)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25440: Fix for "CGI::param called in list context" in smart-rules.pl
Andrew Nugged [Sun, 10 May 2020 10:28:40 +0000 (13:28 +0300)]
Bug 25440: Fix for "CGI::param called in list context" in smart-rules.pl

This warning emitted:

CGI::param called in list context from /admin/smart-rules.pl line 262,
this can lead to vulnerabilities. See the warning in "Fetching the value
or values of a single named parameter" at CGI.pm line 412.

Explained here: https://metacpan.org/pod/CGI#Fetching-the-value-or-values-of-a-single-named-parameter

And because all these params are not multi-params, so simple "scalar .."
forcing for CGI->param is the fix. Changes are transparent and same
values should be assigned as before, just no more warnings.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit eb8a0ffcc1bb4d751daa4221bd37faa815904db8)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25440: Extra duplicated call to CGI->param method removed
Andrew Nugged [Sun, 10 May 2020 10:54:29 +0000 (13:54 +0300)]
Bug 25440: Extra duplicated call to CGI->param method removed

In code CGI param 'no_auto_renewal_after_hard_limit' assigned to
"$no_auto_renewal_after_hard_limit" var, and then just in the next line
again variable "$no_auto_renewal_after_hard_limit" reassigned with
call to same "$input->param('no_auto_renewal_after_hard_limit')".

Fixed. No logic or results should be changed.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b9ba7151667bc6481bc97335b94e44487c9701bd)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 21395: Remove 'variable $DEBUG masks earlier declaration in same scope' warning
Jonathan Druart [Mon, 29 Jun 2020 11:42:55 +0000 (13:42 +0200)]
Bug 21395: Remove 'variable $DEBUG masks earlier declaration in same scope' warning

% prove t/db_dependent/Serials.t
t/db_dependent/Serials.t .. 8/49 "my" variable $DEBUG masks earlier declaration in same scope at /kohadevbox/koha/C4/Barcodes/ValueBuilder.pm line 45.
"my" variable $DEBUG masks earlier declaration in same scope at /kohadevbox/koha/C4/Barcodes/ValueBuilder.pm line 87.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 61aa3f794240443f5c2c99adc016f0d80c7251d9)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 21395: (QA follow-up) POD fixes
Martin Renvoize [Thu, 25 Jun 2020 12:48:36 +0000 (13:48 +0100)]
Bug 21395: (QA follow-up) POD fixes

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b9e526a12fb338736e149934526e38da782f048f)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 21395: (QA follow-up) Remove some introduced issues
Martin Renvoize [Thu, 25 Jun 2020 10:31:49 +0000 (11:31 +0100)]
Bug 21395: (QA follow-up) Remove some introduced issues

This patch removes some new error cases introduced during rebase

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e968af43777d47c9134ea1875270af9661ef2f5a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 21395: Fix QA errors
Julian Maurice [Mon, 27 Apr 2020 08:31:19 +0000 (10:31 +0200)]
Bug 21395: Fix QA errors

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1682341b5849c34e59597cda780d4c877d6f3278)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 21395: Make perlcritic happy
Julian Maurice [Fri, 21 Sep 2018 16:05:42 +0000 (18:05 +0200)]
Bug 21395: Make perlcritic happy

This patch adds a .perlcriticrc (copied from qa-test-tools) and fixes
almost all perlcrictic violations according to this .perlcriticrc
The remaining violations are silenced out by appending a '## no critic'
to the offending lines. They can still be seen by using the --force
option of perlcritic
This patch also modify t/00-testcritic.t to check all Perl files using
the new .perlcriticrc.
I'm not sure if this test script is still useful as it is now equivalent
to `perlcritic --quiet .` and it looks like it is much slower
(approximatively 5 times slower on my machine)

Test plan:
1. Run `perlcritic --quiet .` from the root directory. It should output
   nothing
2. Run `perlcritic --quiet --force .`. It should output 7 errors (6
   StringyEval, 1 BarewordFileHandles)
3. Run `TEST_QA=1 prove t/00-testcritic.t`
4. Read the patch. Check that all changes make sense and do not
   introduce undesired behaviour

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b168f4a2e9a03ed56ce857353d4dde940980caba)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25322: fix for not selected "relationship" defaults to father
Petro Vashchuk [Wed, 17 Jun 2020 13:44:42 +0000 (16:44 +0300)]
Bug 25322: fix for not selected "relationship" defaults to father

When a user creates a patron's guarantor on /cgi-bin/koha/members/memberentry.pl but doesn't select the relationship from a dropdown, the relationship defaults to first value, which in default sysprefs is "father". This may or may not be correct as this is not a conscious choice from the user.

The solution is to make the "Relationship" field mandatory when there is no empty entry in the system preferences, always starting with an empty option but not allowing the user to save an empty entry.
And if there is an empty option in sysprefs, it allows to save empty, as well as makes it default choice.

To reproduce with default system preferences:
    1) Create a new patron who is assumed to have a guarantor or modify the existing one.
    2) Under "Guarantor Information" click on "Search to add" button. After performing the search, select a user to act as guarantor. Don't use the dropdown menu to select a relationship. Save your changes.
    3) Observe that relationship is set as "father".
    4) Apply the patch.
    5) Repeat steps 1 and 2.
    6) Observe that it doesn't allow you to save the form until you pick a relationship type.

To reproduce with empty entry added to system preferences:
    1) Add an empty entry to borrowerRelationship at /cgi-bin/koha/admin/preferences.pl?tab=patrons in Patron relationships section (example: "|father|mother").
    2) Create a new patron who is assumed to have a guarantor or modify the existing one.
    3) Under "Guarantor Information" click on "Search to add" button. After performing the search, select a user to act as guarantor. Don't use the dropdown menu to select a relationship. Save your changes.
    4) Observe that relationship is set as "father".
    5) Apply the patch.
    6) Repeat steps 1, 2 and 3.
    7) Observe when you save the empty entry it does set the relationship as empty.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 029f41a667da8f054633432997bc818c1b26a27f)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 22672: Change <i> to <em> and <b> to <strong> in templates, includes, xslt
Lucas Gass [Wed, 27 May 2020 21:35:16 +0000 (21:35 +0000)]
Bug 22672: Change <i> to <em> and <b> to <strong> in templates, includes, xslt

This patch attempts to replace <i> with <em> AND <b> with <strong> in
order to more accessible to screen readers. This patch makes no attempt
to change Font Awesome icons which typically use <i>. I found templates,
includes and XSLT by using 'git grep ‘<b>’
koha-tmpl/opac-tmpl/bootstrap/en/' and git grep ‘<i>’
koha-tmpl/opac-tmpl/bootstrap/en/

TEST PLAN:
There should be no visible difference on the changed pages. The files
changed are:
koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc
koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-note.inc
koha-tmpl/opac-tmpl/bootstrap/en/modules/clubs/enroll.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth-MARCdetail.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-authoritiessearchresultlist.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-browser.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-overdrive-search.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-review.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shareshelf.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl
koha-tmpl/opac-tmpl/bootstrap/en/xslt/NORMARCslim2OPACResults.xsl
koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl
koha-tmpl/opac-tmpl/xslt/OAI.xslt

Read the changes and make sure everything looks correct, try to visit as
many pages as possible and confirm that everything looks as it should.
grep around for cases of <b> or <i> that I could have missed.

Signed-off-by: Timothy Alexis Vass <timothy_alexis.vass@ub.lu.se>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d3036d46ba4b26df040a25f960c3bc3081734c26)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25875: Unit test
Nick Clemens [Thu, 25 Jun 2020 10:38:16 +0000 (10:38 +0000)]
Bug 25875: Unit test

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a804d4be437a5df3641f854a506642afe3501046)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25875: Move check for module_bit and code to the JOIN
Nick Clemens [Thu, 25 Jun 2020 10:38:26 +0000 (10:38 +0000)]
Bug 25875: Move check for module_bit and code to the JOIN

If we limit the JOIN to rows with the correct subpermission we won't
duplicate the returned patrons

To test:
 1 - Give a patron full acquisitions permissions
 2 - Also give them several subpermissions on other areas
 3 - Go to Acquisitions
 4 - Edit a fund
 5 - Add a user to the fund
 6 - Search for user above
 7 - They return multiple times in results
 8 - Apply patch
 9 - Restart all the things
10 - Repeat search
11 - Patron appears once

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>
(cherry picked from commit 721876785142fea84f02c7dbe4f325e2a605bd0f)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25793: OAI 'Set' and 'Metadata' dropdowns broken by OPAC jQuery upgrade
Owen Leonard [Mon, 22 Jun 2020 23:57:29 +0000 (23:57 +0000)]
Bug 25793: OAI 'Set' and 'Metadata' dropdowns broken by OPAC jQuery upgrade

This patch modifies the OAI XSLT file, correcting the path to jQuery
assets and adds a link to jquery-migrate.

To test, apply the patch and make sure the "OAI-PMH" system preference
is enabled.

1. Go to: <OPACBaseURL>/cgi-bin/koha/oai.pl?verb=ListRecords&metadataPrefix=marc21
   e.g.
   localhost:8080/cgi-bin/koha/oai.pl?verb=ListRecords&metadataPrefix=marc21
2. Click on the 'Sets' and 'Metadata' links. The corresponding
   panels with set and metatdata information should be shown.

Tested against master, works as described.
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 23ed2e110e16f04a34c01ac866b470ec725b7522)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>