]> git.koha-community.org Git - koha.git/log
koha.git
3 years agoBug 27621: Remove it-IT installer data
Jonathan Druart [Mon, 8 Feb 2021 12:25:09 +0000 (13:25 +0100)]
Bug 27621: Remove it-IT installer data

With installer data in YAML format and it's translations,
there are no need for localized installer files.

This patch removes it-IT installer files.

1) Apply the patch
2) Translate to it-IT
   cd misc/translator
   ./translate update it-IT
   ./translate install it-IT
3) Do a clean install using it-IT,
   check no problems during install

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28179: (follow-up) Remove console.log
Owen Leonard [Mon, 3 May 2021 18:08:49 +0000 (18:08 +0000)]
Bug 28179: (follow-up) Remove console.log

This patch removes a "console.log" from detail.tt and replaces it with
similar output to the user. It will probably never be triggered, but
better to handle it gracefully than have a hidden log.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Rasmus Leißner <rasmus.leissner@solutions-factory.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28179: (follow-up) Updates to styling of lightbox controls
Owen Leonard [Fri, 23 Apr 2021 13:52:29 +0000 (13:52 +0000)]
Bug 28179: (follow-up) Updates to styling of lightbox controls

This patch fixes a bug and adds some style changes which I think are
nice. The bugfix is to change the z-index of the lightbox footer so that
it isn't hidden when there is a language menu in the footer.

The cosmetic changes replace the Chocolat image icons with new SVG
assets based on Bootstrap Icons (https://icons.getbootstrap.com/). The
color changes I think help the controls to be more visible.

License information about Bootstrap Icons has been added to the About
page.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Rasmus Leißner <rasmus.leissner@solutions-factory.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28179: Adjust chocolat.js to display href
Jonathan Druart [Tue, 20 Apr 2021 14:35:39 +0000 (16:35 +0200)]
Bug 28179: Adjust chocolat.js to display href

In order to display link in the description we need to adjust
chocolat.js

Maybe this needs to be reported upstream

Sponsored-by: Gerhard Sondermann Dialog e.K. (presseplus.de, presseshop.at, presseshop.ch)
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Rasmus Leißner <rasmus.leissner@solutions-factory.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28179: Add a lightbox gallery to display cover images - detail page, staff interface
Jonathan Druart [Mon, 19 Apr 2021 09:37:55 +0000 (11:37 +0200)]
Bug 28179: Add a lightbox gallery to display cover images - detail page, staff interface

This patch adds the ability to display the cover images of a
bibliographic record in a gallery. Cover images attached to items can
also be displayed in separated galleries.

Test plan:
All the cover images are affected, all the different sources will be
tested.
All the steps will be done on the same bibliographic record.
1. Local cover images
 a. Turn on LocalCoverImages and AllowMultipleCovers
 b. Add several local cover images to a bibliographic record
 c. Add several local cover images to an item
 d. Click on an image and confirm that it is displayed in a gallery and
 you can navigate see all the images attached to the bibliographic
 record
 e. Same for items
2. Adlibris
 a. Turn on AdlibrisCoversEnabled
 b. Edit the biliographic record and add an ISBN that will return a
 cover image for this service (9780670026623 for instance)
 c. Display the cover images in the gallery
 d. Note the link to the adlibris.com website at the bottom
3. Amazon
 a. Turn on AmazonCoverImages
 b. Display the cover images in the gallery
4. Coce
 a. Turn on IntranetCoce, set CoceHost to "http://coce.tamil.fr:8080"
 and select some values for CoceProviders.
 b. Display the cover images in the gallery
5. Custom cover images
 a. Turn on CustomCoverImages and set CustomCoverImagesURL to https://covers.openlibrary.org/b/isbn/{isbn}-M.jpg
 of anything else meaningful
 b. Display the cover images in the gallery

Sponsored-by: Gerhard Sondermann Dialog e.K. (presseplus.de, presseshop.at, presseshop.ch)
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Rasmus Leißner <rasmus.leissner@solutions-factory.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28179: Add the Chocolat gallery lightbox JS library
Jonathan Druart [Mon, 19 Apr 2021 09:38:33 +0000 (11:38 +0200)]
Bug 28179: Add the Chocolat gallery lightbox JS library

Chocolat is a lightbox JS library.
https://chocolat.insipi.de
https://github.com/nicolas-t/Chocolat
https://chocolat.gitbook.io

Why Chocolat? It's released under the GPL v3 license, easy to use,
configure and extend, and is still maintained/active.

(and it has a nice name)

Sponsored-by: Gerhard Sondermann Dialog e.K. (presseplus.de, presseshop.at, presseshop.ch)
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Rasmus Leißner <rasmus.leissner@solutions-factory.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27876: changed Your tags title to caption in OPAC
Wainui Witika-Park [Sun, 25 Apr 2021 04:02:04 +0000 (04:02 +0000)]
Bug 27876: changed Your tags title to caption in OPAC

On the tags page, changed the <h2> "Your tags" to a <caption> to reduce
heading redundancy but keep the information available.

To test:
1) Apply patch
2) Go to OPAC
3) Go to opac-tags.pl
4) Ensure that there is a caption above the table that says "Your tags"
and that it is not a heading tag

Sponsored-by: Catalyst IT
Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27876: took away redundant heading in OPAC full serial issues
Wainui Witika-Park [Fri, 23 Apr 2021 03:18:48 +0000 (03:18 +0000)]
Bug 27876: took away redundant heading in OPAC full serial issues

Changed <h2> to <h1> and deleted current <h1> to eliminate redundancy.

To test:
1) Apply patch
2) Go to OPAC
3) Go to opac-serial-issues.pl
4) Check there is only one main heading and it is <h1>

Sponsored-by: Catalyst IT
Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27876: added sr-only to caption of table in Charges page
Wainui Witika-Park [Fri, 23 Apr 2021 03:09:20 +0000 (03:09 +0000)]
Bug 27876: added sr-only to caption of table in Charges page

Made the "Your charges" caption of the table in the Charges page of the
OPAC hidden and for screen-readers only so that it takes out redundancy.

To test:
1) Apply patch
2) Go to OPAC
3) Go to Charges page
4) Ensure that there is no visible caption above the table that says
"Your charges"
5) Check that the code has the caption still with sr-only class

Sponsored-by: Catalyst IT
Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28160: Values from 150$a aren't prefilled in z39.50 search form from an existing...
Phil Ringnalda [Fri, 16 Apr 2021 18:44:14 +0000 (11:44 -0700)]
Bug 28160: Values from 150$a aren't prefilled in z39.50 search form from an existing authority record

For names and uniform titles, when you do a z39.50 search from an authority
record, we prefill what's in the relevant tag's subfield a in the search
form, but for subjects, we don't, both because GetMandatoryFieldZ3950 thinks
the param is topic when it's actually subject, and because
z3950_auth_search.tt doesn't bother putting the value of &subject into the
form.

Test plan:

1) Authorities - New authority - Topical Term
2) Tab 1, click on HEADING-TOPICAL TERM to expand subfields
3) In subfield a, type goats
4) Click Z39.50/SRU search and verify that the Subject heading search field
   has goats prefilled

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28159: URI-encode existing values put into query string for z39.50 authority...
Phil Ringnalda [Fri, 16 Apr 2021 16:55:25 +0000 (09:55 -0700)]
Bug 28159: URI-encode existing values put into query string for z39.50 authority search

When you trigger a z39.50 search from an existing authority record,
Koha prefills the search form with the value in the record. But because
that value passes through a URL, if it isn't URI-encoded characters like
& or ; will cut off the value.

Test plan:
1) Authorities - New authority - Corporate Name
2) Tab 1, click "HEADING-CORPORATE NAME" to expand subfields
3) Subfield a, type foo & bar ; baz
4) Click Z39.50/SRU search
5) Ensure the whole string appears in the Author (corporate) field in
   the popup

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28241: Fix regex to allow for content before and after comma
Lucas Gass [Tue, 27 Apr 2021 21:23:55 +0000 (21:23 +0000)]
Bug 28241: Fix regex to allow for content before and after comma

1. Set up the OPACNoResultsFound with the {QUERY_KW} placeholder.
2.Do a search with a comma that will return no results. Like "King, Martin Luther". If the returns results add some additional characters to the search until no results are returns.
3. Look at the #noresultsfound HTML element. Anything before (or after) the comma is omitted. So the placeholder looks something like 'Martin Luther' instead of 'King, Martin Luther'.
4. Apply patch
5. Try the search again, you should see the content before and after a comma

Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26995: DBIC schema changes
Jonathan Druart [Mon, 10 May 2021 13:50:23 +0000 (15:50 +0200)]
Bug 26995: DBIC schema changes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26995: Remove occurrences in sample_patrons.yml
Jonathan Druart [Mon, 10 May 2021 13:41:50 +0000 (15:41 +0200)]
Bug 26995: Remove occurrences in sample_patrons.yml

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26995: DBRev 20.12.00.048
Jonathan Druart [Mon, 10 May 2021 12:45:32 +0000 (12:45 +0000)]
Bug 26995: DBRev 20.12.00.048

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26995: Fix SQL syntax error on the about page
Jonathan Druart [Mon, 10 May 2021 12:27:58 +0000 (14:27 +0200)]
Bug 26995: Fix SQL syntax error on the about page

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26995: (QA follow-up) Fix logic in database update
Martin Renvoize [Tue, 4 May 2021 12:48:23 +0000 (13:48 +0100)]
Bug 26995: (QA follow-up) Fix logic in database update

The logic was reversed.. if the column exists we want to delete it ;)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26995: Remove references to relationship column
Kyle M Hall [Thu, 21 Jan 2021 11:59:00 +0000 (06:59 -0500)]
Bug 26995: Remove references to relationship column

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26995: Drop column relationship from borrowers, deletedborrowers and borrower_mod...
Kyle M Hall [Thu, 21 Jan 2021 11:58:45 +0000 (06:58 -0500)]
Bug 26995: Drop column relationship from borrowers, deletedborrowers and borrower_modifications tables

Bug 14570 added a borrower_relationships table but it didn't remove the relationship column from the following tables:
- deletedborrowers
- borrowers
- borrower_modifications

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28266: fix spelling mistake on registers.tt
Lucas Gass [Fri, 30 Apr 2021 21:40:17 +0000 (21:40 +0000)]
Bug 28266: fix spelling mistake on registers.tt

TO test:
1. look at the cashup modal, see the wrong spelling of 'recieved'
2. Apply patch and see the right spelling

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28286: Replace < 1 with <= 0
Jonathan Druart [Mon, 10 May 2021 12:07:14 +0000 (14:07 +0200)]
Bug 28286: Replace < 1 with <= 0

It's the same but read more natural

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28286: show "Place hold" button if item is holdable
Petro Vashchuk [Wed, 5 May 2021 13:30:26 +0000 (16:30 +0300)]
Bug 28286: show "Place hold" button if item is holdable

This patch adds "filter_by_for_hold" method in "Items.pm" and
uses it in "cat-toolbar.inc" instead of "filter_by_for_load".

Also this patch removes "filter_by_for_loan" method.

To reproduce the bug:
1) go to /cgi-bin/koha/catalogue/detail.pl?biblionumber=XXX that has
item with notforloan value set as "Ordered" (-1)
2) see that button "Place hold" is not present
3) apply the patch
4) refresh the page and ensure that "Place hold" button appears even if
item is "Ordered"

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25760: (bug 15422 follow-up) Display record with hold ratio greater than or equal...
Nick Clemens [Fri, 8 Jan 2021 20:12:28 +0000 (20:12 +0000)]
Bug 25760: (bug 15422 follow-up) Display record with hold ratio greater than or equal to the value entered

On bug 15422 we made it so that only holds with copies to buy to acheive the holds ratio
showed

Users have reported that they want to see record where there are 0 copies to buy i.e.
the holds ration matches the value entered

This patch changes the criteria for returning holds to be if the ratio for a given title
is equal to or greater then the ratio specified in the form

I also renamed 'ratiocalc' to 'copies_to_buy' since that is what is contains

Test plan:
1. Create bibliographic records with 1, 2 and 3 items
2. Place 1 hold on each of them
3. Go to the Hold ratios report and search with ratio = 1, 2 then 3
4. You expect to see:
   the title with 1 item with ratio 1
   nothing otherwise
5. Place another hold on each of the record
6. Repeat 3 you expect to see:
   titles with 1 or 2 items with ratio 1
   title with 1 item for ratio 2
   nothing with ratio 3
7. Place another hold on each of the record
8. Repeat 3 you expect to see:
   titles with 1 or 2 or 3 items with ratio 1
   title with 1 item or 2 items for ratio 2
   nothing with ratio 3
9. Make sure there is no regression in the test plan of bug 15422

Comments from Frank Hansen:

Some comments.
When I adding the third hold on each record in step 7, It will result in
the following result:

titles with 1 or 2 or 3 items with ratio 1
title with 1 items with ratio 2 because the title with 2 items will get
a ratio of 1.50 and not 2.
title with 1 items with with ratio 3

Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28181: Filter out archived debit types in point of sale
Martin Renvoize [Thu, 22 Apr 2021 12:11:59 +0000 (13:11 +0100)]
Bug 28181: Filter out archived debit types in point of sale

The filter for only displaying un-archived debit types on the point of
sale page had been missed.

NOTE: It would be beneficial to move this to a default filter in the
Koha:: objects search method for both debit_types and credit_types.. but
I opted for the quick fix here to resolve the bug and will impliment
default filtering in a subsequent enhancement bug.

Test plan
1/ Archive a debit type that is marked as 'Can be sold'
2/ Go to the point of sale page and confirm the above debit type appears
3/ Apply the patch
4/ Confirm the debit type no longer appears in the point of sale page.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28229: Count only if needed
Jonathan Druart [Mon, 10 May 2021 10:08:21 +0000 (12:08 +0200)]
Bug 28229: Count only if needed

We don't need to count the number of clubs if we selected a patron or
club already

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28229: (follow-up) Adjust for easier translation
Owen Leonard [Fri, 7 May 2021 11:20:48 +0000 (11:20 +0000)]
Bug 28229: (follow-up) Adjust for easier translation

I think moving the [% IF %] out of the HTML tag makes for easier
translation.

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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28229: Only show clubs on request.tt if clubs exist
Lucas Gass [Wed, 5 May 2021 21:27:25 +0000 (21:27 +0000)]
Bug 28229: Only show clubs on request.tt if clubs exist

1. Have no existing clubs
2. Apply patch
3. Go to request.tt and you will not see the club tab or any mention of clubs
4. Create at least 1 club
5. Go back to request.tt and now see the tab for clubs
6. Make sure you can place holds as an individual with and without clubs.
7. Make sure you can place holds for clubs.
8. rejoice and sign-off

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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28276: Do not fetch config ($KOHA_CONF) from memcached
Julian Maurice [Sun, 2 May 2021 11:37:38 +0000 (13:37 +0200)]
Bug 28276: Do not fetch config ($KOHA_CONF) from memcached

memcached address and namespace are in $KOHA_CONF, so it is required to
read it before being able to access the cache. And after that,
configuration is kept in memory forever. Storing this in memcached is
useless and even counter-productive, since Koha reads both the file and
the cache

This patch addresses this issue by removing the cache-related code from
C4::Context->new.
It means that C4::Context->new will always read the configuration file,
so this patch also replaces inappropriate calls to
C4::Context->new->config by appropriate calls to C4::Context->config

It also fixes a bug where C4::Context->new would ignore the filepath
given in parameters if there was something in cache.

It also removes a problematic call to Koha::Caches->get_instance.
Because this call was outside of any subroutine, it would have happened
before the initialization of $C4::Context::context (which happen in
C4::Context::import)

Test plan:
1. Do not apply the patch yet
2. Add the following line at the beginning of Koha::Config::read_from_file
    warn "read_from_file($file)";
   This will allow you to check how many times the file is read.
3. Flush memcached and restart starman
4. Check the logs, you should see "read_from_file" a bunch of times
5. Apply the patch
6. Re-add the line from step 2
7. Flush memcached and restart starman
8. Check the logs, you should see "read_from_file" only once
9. Make sure the memcached config from $KOHA_CONF (memcached_servers,
   memcached_namespace) is taken into account by checking the About page

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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28272: Prevent api spec to accept extra parameters
Jonathan Druart [Thu, 6 May 2021 13:11:51 +0000 (15:11 +0200)]
Bug 28272: Prevent api spec to accept extra parameters

Some of our definition files are missing { additionalProperties: false }
We must have it to make sure all properties are defined and prevent the
spec to accept extra parameters (being more strict but also allowing to
catch errors more easily)

grep -rL additionalProperties api/v1/swagger/definitions/*.json

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26471: Remove invalid Map URL
Jonathan Druart [Tue, 9 Feb 2021 15:20:36 +0000 (16:20 +0100)]
Bug 26471: Remove invalid Map URL

There is a warning in the console:
Error en el mapeo fuente: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
URL del recurso: http://kohadev-intra.mydnsname.org:8081/intranet-tmpl/lib/datatables/datatables.min_20.1200011.js
URL del mapa fuente: pdfmake.min.js.map

https://developer.mozilla.org/en-US/docs/Tools/Debugger/Source_map_errors

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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24154: Adjust assignment
Nick Clemens [Wed, 5 May 2021 18:41:47 +0000 (18:41 +0000)]
Bug 24154: Adjust assignment

The code seems to work either way
We have a mix in our code:
git grep "}) %]"

Using '=>' over '=' does look nicer

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24154: (follow-up) Make parameter and variable more explicit, add tests
Nick Clemens [Fri, 23 Apr 2021 10:34:06 +0000 (10:34 +0000)]
Bug 24154: (follow-up) Make parameter and variable more explicit, add tests

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24154: Get rules rather than values to determine if set or not
Nick Clemens [Fri, 16 Apr 2021 16:59:44 +0000 (16:59 +0000)]
Bug 24154: Get rules rather than values to determine if set or not

Template plugin CirculationRules.Search returns "" if a rule doesn't
exist or if the rule exists but is set to ""

To get more info, we add a 'want_rule' parameter and use that to test
if defined but blank

To test:
1 - In circulation rules set the 'Default checkout, hold and return
    policy' without setting values
2 - Unset it
3 - Notice there is no visual difference
4 - Apply patch
5 - Reload the page
6 - note there is no 'Unset button' and first column says 'Not set'
7 - Save the rule with no values
8 - Now 'Defaults' is displayed and the unset button exists

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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24564: Use the same tab as the other subfields within a field
Julian Maurice [Thu, 1 Apr 2021 09:04:35 +0000 (11:04 +0200)]
Bug 24564: Use the same tab as the other subfields within a field

For each subfield added, we check if other subfields exists in the same
field. If that's the case we use the same tab as the first subfield
found.

Test plan:
1. Find a biblio subfield in
   misc/migration_tools/ifla/data/biblio/default.yml that doesn't exist
   in your default biblio MARC framework (or delete one). The field
   should exist and have other subfields with a tab set.
2. Change the tab of all subfields within that field it's different from
   what's in the .yml file
3. Run misc/migration_tools/ifla/update.pl
4. Verify that the subfield has been added and have the same tab as
   others subfields
5. Do the same for authorities (files are in
   misc/migration_tools/ifla/data/auth/)

Signed-off-by: Koha team <koha@univ-lyon.fr>
Signed-off-by: sonia <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24564: Do not modify the tab of existing subfield in ifla/update.pl
Julian Maurice [Wed, 31 Mar 2021 08:44:48 +0000 (10:44 +0200)]
Bug 24564: Do not modify the tab of existing subfield in ifla/update.pl

Test plan:
1. Find a biblio subfield in
   misc/migration_tools/ifla/data/biblio/default.yml that you have in
   your default biblio MARC framework (or create one).
2. Change the tab of this subfield so that it's different from what's in
   the .yml file
3. Run misc/migration_tools/ifla/update.pl --force
4. Verify that the tab of this subfield has not been changed.
5. Do the same for authorities (files are in
   misc/migration_tools/ifla/data/auth/)

Signed-off-by: sonia <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27756: Fork background jobs to prevent memory leak
Jonathan Druart [Tue, 2 Mar 2021 10:22:29 +0000 (11:22 +0100)]
Bug 27756: Fork background jobs to prevent memory leak

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23215: DBRev 20.12.00.047
Jonathan Druart [Fri, 7 May 2021 12:38:35 +0000 (12:38 +0000)]
Bug 23215: DBRev 20.12.00.047

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23215: Remove traces of the PayPal feature
Tomas Cohen Arazi [Wed, 5 May 2021 13:16:50 +0000 (10:16 -0300)]
Bug 23215: Remove traces of the PayPal feature

This patch removes the PayPal payments feature. It has been moved to
its' own plugin.

To test:
1. Apply this patches
2. Run:
   $ updatedatabase
=> SUCCESS: Database updates correctly
3. Run:
   $ koha-mysql kohadev
   > SELECT * FROM systempreferences WHERE variable LIKE 'paypal';
=> SUCCESS: No results
4. On the sysprefs, OPAC section
=> SUCCESS: No PayPal-related sysprefs show up
5. Add some charges to your patron
6. In the OPAC, log in and see your charges
=> SUCCESS: Nothing broken
7. Install the PayPal plugin [1] or any other payment plugin
8. Restart plack (mandatory for the PayPal plugin)
9. Set some random data in the config (or better, real sandbox testing
   data)
10. Go to the OPAC's account page and try to pay your debts (use the
    checkbox to select lines)
=> SUCCESS: The PayPal payment method shows, you can click the button,
    it fails due to bad config, but things work as expected.
11. Sign off :-D

[1] https://gitlab.com/thekesolutions/plugins/koha-plugin-pay-via-paypal/-/releases

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23215: Remove PayPal-related sysprefs
Tomas Cohen Arazi [Wed, 5 May 2021 13:16:18 +0000 (10:16 -0300)]
Bug 23215: Remove PayPal-related sysprefs

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28291: Make koha-translate script produce valid UTF-8 YAML files
Joonas Kylmälä [Wed, 5 May 2021 14:20:38 +0000 (17:20 +0300)]
Bug 28291: Make koha-translate script produce valid UTF-8 YAML files

We had two problems in the LangInstaller.pm module:
 1) the PO file was read as bytes instead of as a UTF-8 text stream
 2) The YAML file being outputted was double encoded, once by setting
    the file handle to output UTF-8 and other time in the DumpFile
    function internally

To test:
1. Before applying patch do the following
$ cd misc/translator
$ ./translate update pl-PL
$ ./translate install pl-PL
$ cd -
$ less installer/data/mysql/pl-PL/marcflavour/marc21/mandatory/authorities_normal_marc21.yml
2. Notice the output of the authorities_normal_marc21.yml contains
invalid looking UTF-8 characters
3. $ git clean -d -f # to remove the old translation files
4. Apply patch and repeat the steps and notice the
authorities_normal_marc21.yml contains valid looking UTF-8 characters

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28281: Add tests
Jonathan Druart [Wed, 5 May 2021 09:50:16 +0000 (11:50 +0200)]
Bug 28281: Add tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28281: Remove double decoding when importing installation data
Joonas Kylmälä [Wed, 5 May 2021 09:12:44 +0000 (12:12 +0300)]
Bug 28281: Remove double decoding when importing installation data

The YAML::XS::Load and YAML::XS::LoadFile functions already decode the
YAML to Perl objects/strings, therefore decoding the output yet
another time is not needed and causes an error to happen.

To test:

1. Go through the following steps and notice without this patch the
error happens and with this patch it doesn't:

$ koha-mysql kohadev < installer/data/mysql/kohastructure.sql
$ restart_all
$ ./translate update pl-PL
$ ./translate install pl-PL
$ restart_all
 --> Go to the Koha web installer page and select pl-PL as the installer
 language, click through it and notice it gives following error at the
 MARC21 step:

 Cannot decode string with wide characters at /usr/lib/x86_64-linux-gnu/perl/5.24/Encode.pm line 202

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28298: fix DB update 19.12.00.076
Alex Arnaud [Fri, 7 May 2021 07:58:09 +0000 (09:58 +0200)]
Bug 28298: fix DB update 19.12.00.076

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27594: (follow-up) don't display "Copy link[...]" when not possible
Victor Grousset/tuxayo [Mon, 3 May 2021 20:42:15 +0000 (22:42 +0200)]
Bug 27594: (follow-up) don't display "Copy link[...]" when not possible

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27594: (follow-up) Check for secure context
Owen Leonard [Fri, 9 Apr 2021 15:44:28 +0000 (15:44 +0000)]
Bug 27594: (follow-up) Check for secure context

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27594: (QA follow-up): Display message only if copy worked
Victor Grousset/tuxayo [Tue, 6 Apr 2021 18:10:22 +0000 (20:10 +0200)]
Bug 27594: (QA follow-up): Display message only if copy worked

And check if writeText is available.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27594: Add access to public download link for publicly-accessible uploads
Owen Leonard [Tue, 2 Feb 2021 14:10:49 +0000 (14:10 +0000)]
Bug 27594: Add access to public download link for publicly-accessible uploads

This patch adds a link to the display of publicly-accessible uploads so
that the user can copy the public link. This will hopefully lead to
easier use of sound file uploads in the Audio Alerts system.

To test, apply the patch and go to Tools -> Upload.

- If necessary, upload a file with the "Allow public downloads"
  checkbox checked.
- Upon upload you should be shown the results of your upload in a table
  with the file details.
- In the "Public" column you should see that "Yes" is a link.
  - When you hover your mouse over the link you should see a tooltip,
    "Copy link to this file."
  - When you click the link the tooltip should say "Link copied to the
    clipboard."
  - Verify that the correct link has been copied.
- Test uploading a file which is not publicly-accessible.
  - Confirm that the information in the "Public" column says "No" and is
    not a link.

Signed-off-by: David Nind <david@davidnind.com>
Bug 27594: (QA follow-up): Use clipboard API

While the Clipboard API doesn't
have 100% coverage (https://www.caniuse.com/?search=clipboard), it has
enough coverage for the "copy" operation that it can be counted on for
use in the staff interface.

This patch removes the global copyToClipboard function and replaces it
with a call to ndavigator.clipboard.writeText() in the template.

To test, follow the previous test plan and confirm that the public
download link is still copied correctly to the clipboard.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27793: Store FTX free text in vendor note
Colin Campbell [Thu, 25 Feb 2021 10:59:24 +0000 (10:59 +0000)]
Bug 27793: Store FTX free text in vendor note

This is important for proquest ordering to distinguish types of
material.

FTX segment from quote is stored as vendor note.
Contents of vendornote are included in the order FTX segment.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28278: Uncomment and test access_dirs
Jonathan Druart [Fri, 7 May 2021 09:31:21 +0000 (11:31 +0200)]
Bug 28278: Uncomment and test access_dirs

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28278: Improve $KOHA_CONF parsing speed by using XML::LibXML
Julian Maurice [Fri, 30 Apr 2021 15:13:48 +0000 (17:13 +0200)]
Bug 28278: Improve $KOHA_CONF parsing speed by using XML::LibXML

- Without the patch:

$ hyperfine --warmup 1 \
  'perl -MKoha::Config -e "Koha::Config->read_from_file(\$ENV{KOHA_CONF}) for (1..1000)"'

  Time (mean ± σ):      3.585 s ±  0.018 s    [User: 3.531 s, System: 0.049 s]
  Range (min … max):    3.547 s …  3.612 s    10 runs

- With the patch:

$ hyperfine --warmup 1 \
  'perl -MKoha::Config -e "Koha::Config->read_from_file(\$ENV{KOHA_CONF}) for (1..1000)"'

  Time (mean ± σ):      1.122 s ±  0.028 s    [User: 1.104 s, System: 0.014 s]
  Range (min … max):    1.095 s …  1.189 s    10 runs

Test plan:
1. Apply the first patch (the one with the unit tests) and make sure
   tests pass: `prove t/Koha/Config.t`
2. Apply the rest of the patches and verify that tests still pass:
   `prove t/Koha/Config.t`.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28278: Add unit test for Koha::Config::read_from_file
Julian Maurice [Fri, 30 Apr 2021 15:11:14 +0000 (17:11 +0200)]
Bug 28278: Add unit test for Koha::Config::read_from_file

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27584: Refactor OAI-PMH paging to improve performance
Ere Maijala [Mon, 1 Feb 2021 11:25:04 +0000 (13:25 +0200)]
Bug 27584: Refactor OAI-PMH paging to improve performance

Includes the following optimizations:
- Use next biblionumber instead of large offset in the queries.
- Use unions instead of subqueries
- Avoid fetching item timestamps when items are not included.

Test plan:

1. Without the patch, try harvesting a Koha database with (and without for good measure) `include_items: 1` in the OAI-PMH configuration file pointed to by preference OAI-PMH:ConfFile and take note of performance. For useful metrics the database must be large enough to not fit in InnoDB buffers or OS file cache.
2. Apply the patch.
3. Run tests: prove -v t/db_dependent/OAI
4. Try again the harvesting from step 1 and compare performance with step 1.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14723: DBIC schema changes
Jonathan Druart [Fri, 7 May 2021 12:17:00 +0000 (14:17 +0200)]
Bug 14723: DBIC schema changes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14723: DBRev 20.12.00.046
Jonathan Druart [Fri, 7 May 2021 11:46:52 +0000 (11:46 +0000)]
Bug 14723: DBRev 20.12.00.046

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14723: Make DB rev idempotent
Jonathan Druart [Fri, 7 May 2021 09:49:40 +0000 (11:49 +0200)]
Bug 14723: Make DB rev idempotent

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14723: Use DATETIME instead DATE
Emmi Takkinen [Mon, 3 May 2021 07:37:02 +0000 (10:37 +0300)]
Bug 14723: Use DATETIME instead DATE

Letters.t tests failed since time_queued didn't
include timecode. Use DATETIME when inserting
into message_queue.

To test prove t/db_dependent/Letters.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14723: (QA follow-up) Fix typo
Kyle M Hall [Thu, 29 Apr 2021 13:48:12 +0000 (09:48 -0400)]
Bug 14723: (QA follow-up) Fix typo

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14723: Add error codes and replace strings with them in template
Emmi Takkinen [Wed, 28 Apr 2021 05:55:02 +0000 (08:55 +0300)]
Bug 14723: Add error codes and replace strings with them in template

This patch adds error codes for delivery notes and replaces English
strings with them in template.

To test confirm everything works as intended.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14723: Make delivery notes translatable
Emmi Takkinen [Thu, 14 May 2020 09:32:13 +0000 (12:32 +0300)]
Bug 14723: Make delivery notes translatable

Delivery notes weren't translatable. This patch adds
them in notices.tt. If note is Mail::Sendmail error generic
'Error occured while sending email' is shown.

Also fixes MySQLisms and adds AFTER to atomicupdate file.

To test prove t/db_dependent/Letters.t

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Stina Hallin <stina.hallin@ub.lu.se>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14723: Additional delivery notes to messages
Lari Taskula [Wed, 12 Apr 2017 11:14:44 +0000 (11:14 +0000)]
Bug 14723: Additional delivery notes to messages

This patch adds additional delivery notes to messages in message queue as there
can be multiple reasons for a delivery to fail.

Currently in message_queue we are given only two delivery statuses for messages,
"sent" and "failed". When the status becomes failed, we have no idea why it fails.

This feature can be useful with SMS gateway providers. Many SMS gateways inform
the application the reason of SMS delivery failure. With this feature, this
information can now be stored. As well as for emails, instead of simply logging
failures, we can now store the reason of failure directly into the message row
of message_queue.

Test plan:

1. Enable EnhancedMessagingPreferences syspref
2. Find a borrower with notices at members/notices.pl
3. Observe that there is no column for Delivery notes
4. Apply patch and run the given database update
5. Repeat step 1.
6. Observe that there is now a column for Delivery notes

Sponsored-by: Hypernova Oy
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21249: DBRev 20.12.00.045
Jonathan Druart [Fri, 7 May 2021 11:46:52 +0000 (11:46 +0000)]
Bug 21249: DBRev 20.12.00.045

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21249: (follow-up) Adding parentheses to fix query
Aleisha Amohia [Wed, 5 May 2021 05:22:06 +0000 (17:22 +1200)]
Bug 21249: (follow-up) Adding parentheses to fix query

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21249: (follow-up) Implement SearchLibraryLimit for individual library
Aleisha Amohia [Tue, 23 Feb 2021 21:48:10 +0000 (10:48 +1300)]
Bug 21249: (follow-up) Implement SearchLibraryLimit for individual library

before this patch, the limit only applies to groups of libraries

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21249: (follow-up) Fixing syspref name, description, get working with OPAC masthe...
Aleisha Amohia [Tue, 21 Apr 2020 11:48:06 +0000 (11:48 +0000)]
Bug 21249: (follow-up) Fixing syspref name, description, get working with OPAC masthead search

Syspref is now called SearchLimitLibrary, and the description better
explains what the feature does. It works with the advanced search on the
staff client and OPAC, and the masthead search on the OPAC when
OpacAddMastheadLibraryPulldown is enabled.

Sponsored-by: Catalyst IT
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21249: Code cleaning
Jonathan Druart [Wed, 6 Nov 2019 11:19:11 +0000 (12:19 +0100)]
Bug 21249: Code cleaning

Trying to make the code a bit more readable removing unecessary
variables and parenthesis.

Code is duplicated but no idea where we could move it to.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21249: Made the SQL INSERT statement idempotent
Alex Buckley [Thu, 27 Dec 2018 01:44:22 +0000 (01:44 +0000)]
Bug 21249: Made the SQL INSERT statement idempotent

Sponsored-BY: Brimbank Library, Australia

Signed-off-by: Amandine Zocca <azocca@ville-montauban.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21249: New syspref controlling branch fields queried against selected library...
Alex Buckley [Mon, 20 Aug 2018 09:49:43 +0000 (21:49 +1200)]
Bug 21249: New syspref controlling branch fields queried against selected library group value in advanced search

This commit allows librarians to choose whether they want to query the
homebranch, holdingbranch or homebranch AND holdingbranch when they set
a library or library group search condition in the staff client and OPAC
advanced searches.

Test plan:
1. Apply patches, update database, restart services
2. Set up a record with one item. Edit the item so that:
home branch = Branch A
holding/current branch = Branch B.
Note the barcode of your item.
3. Go to Administration -> Library Groups. Create a library group that
only contains Branch A.

= homebranch and holdingbranch =

4. Go to Administration -> System preferences and find the new
SearchLimitLibrary syspref. Confirm it is set to 'homebranch and
holdingbranch' by default. Keep this tab open.
5. Go to Advanced Search in the staff client in another tab. Under 'location and
availability', select your library group from the dropdown. Under
'search for', select the barcode option and enter your item's barcode.
6. Submit the search and confirm you are taken to your item as expected.
7. Go back to Advanced Search. Under 'location and availability', select
Branch A from the individual libraries dropdown. Under 'search for',
select the barcode option and enter your item's barcode.
8. Submit the search and confirm you are taken to your item as expected.
9. Go back to Advanced Search. Under 'location and availability', select
Branch B from the individual libraries dropdown. Under 'search for',
select the barcode option and enter your item's barcode.
10. Submit the search and confirm you are taken to your item as expected.

= homebranch only =

11. Go back to your System preferences tab. Set the SearchLimitLibrary
syspref to 'homebranch'. keep this tab open.
12. Go to Advanced Search in the staff client in another tab. Under 'location and
availability', select your library group from the dropdown. Under
'search for', select the barcode option and enter your item's barcode.
13. Submit the search and confirm you are taken to your item as expected,
because the syspref is set to homebranch and the library group contains our item's
homebranch.
14. Go back to Advanced Search. Under 'location and availability', select
Branch A from the individual libraries dropdown. Under 'search for',
select the barcode option and enter your item's barcode.
15. Submit the search and confirm you are taken to your item as expected.
16. Go back to Advanced Search. Under 'location and availability', select
Branch B from the individual libraries dropdown. Under 'search for',
select the barcode option and enter your item's barcode.
17. Submit the search and confirm you are NOT taken to your item and your item
does not show in the search results.

= holdingbranch only =

18. Go back to your System preferences tab. Set the SearchLimitLibrary
syspref to 'holdingbranch'. keep this tab open.
19. Go to Advanced Search in the staff client in another tab. Under 'location and
availability', select your library group from the dropdown. Under
'search for', select the barcode option and enter your item's barcode.
20. Submit the search and confirm you are NOT taken to your item and your
item does not show in the search results, because the syspref is set to
holdingbranch and the library group does not contain our item's holdingbranch.
21. Go back to Advanced Search. Under 'location and availability', select
Branch B from the individual libraries dropdown. Under 'search for',
select the barcode option and enter your item's barcode.
22. Submit the search and confirm you are taken to your item as expected.
23. Go back to Advanced Search. Under 'location and availability', select
Branch A from the individual libraries dropdown. Under 'search for',
select the barcode option and enter your item's barcode.
24. Submit the search and confirm you are NOT taken to your item and your item
does not show in the search results.

25. Repeat the above test plan but do your searching with the OPAC
advanced search.

Sponsored-By: Brimbank Library
Signed-off-by: Amandine Zocca <azocca@ville-montauban.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 16486: Display the timestamp when an accountline is updated
Aleisha Amohia [Tue, 21 Apr 2020 05:15:25 +0000 (05:15 +0000)]
Bug 16486: Display the timestamp when an accountline is updated

This patch updates the Date field to be 'Created' and adds a new column
'Updated' which shows the timestamp of the accountline.

To test:
1) Apply patch, restart services
2) Test the following staff client pages:
- Reports -> Cash register
- Patron Accounting tab -> Transactions
- Create a manual invoice. Click 'Print' on the transactions tab to
generate Invoice slip
- Make a payment. Click 'Print' on the transactions tab to generate
Receipt slip
3) Test the OPAC:
- your charges

Sponsored-by: Catalyst IT
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27577: Autolink biblio after biblionumber is generated
Nick Clemens [Fri, 29 Jan 2021 13:33:34 +0000 (13:33 +0000)]
Bug 27577: Autolink biblio after biblionumber is generated

If BiblioAddsAuthorities and AutoCreateAuthorities are enabled, a new record is auto linked when saving and authorities generated with a 670 field that indicates which record generated the new authority.

The code to do this is called before the biblionumber is generated, so the variable that adds the biblionumber to the citation is empty

This patch moves the linking code to after the biblionumber is generated

To recreate:
1 - Enable BiblioAddsAuthorities and AutoCreateAuthorities
2 - Import or create a new record
3 - Ensure the record has controlled fields that do not have authorities before saving, i.e.:
    Add a 650 with "test_bug_27577_01"
4 - Search for the authority record
5 - Note the 670 field does not contain the biblionumber
6 - Apply patch, restart all the things
7 - Repeat 2-4
8 - Note the 670 now has the biblionumber

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27577: Unit test
Nick Clemens [Wed, 5 May 2021 18:20:05 +0000 (18:20 +0000)]
Bug 27577: Unit test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28288: Prevent XSISBN.t to fail if service is returning 500
Jonathan Druart [Tue, 4 May 2021 14:38:27 +0000 (16:38 +0200)]
Bug 28288: Prevent XSISBN.t to fail if service is returning 500

16:00:45 koha_1       | WARNING: URL Request Failed 500 read timeout
16:00:45 koha_1       | WARNING: URL Request Failed 500 read timeout
16:00:45 koha_1       | WARNING: URL Request Failed 500 Can't connect to www.librarything.com:443
16:00:45 koha_1       | # Looks like you planned 6 tests but ran 5.
16:00:45 koha_1       | [13:59:51] t/db_dependent/XISBN.t
16:00:45 koha_1       | Dubious, test returned 255 (wstat 65280, 0xff00)
16:00:45 koha_1       | Failed 1/6 subtests
16:00:45 koha_1       |  (less 3 skipped subtests: 2 okay)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27740: Compiled CSS
Jonathan Druart [Tue, 4 May 2021 13:24:02 +0000 (15:24 +0200)]
Bug 27740: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27740: (follow-up) changed "User summary" css
Henry Bolshaw [Wed, 21 Apr 2021 15:16:49 +0000 (15:16 +0000)]
Bug 27740: (follow-up) changed "User summary" css

Changed user summary CSS to style H2 not H3 heading

To test:
1) Go to OPAC homepage
2) Login as a user with at least one loan
3) See that the "User summary" heading is not styled
4) Apply patch
5) Run yarn build --view OPAC
6) Confirm the heading is now styled with grey background

Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27740: (follow-up) Added User summary heading
Wainui Witika-Park [Sun, 18 Apr 2021 07:56:55 +0000 (07:56 +0000)]
Bug 27740: (follow-up) Added User summary heading

Added a User summary <h2>

To test:
1) Go to OPAC
2) Go to home page
3) Check that there is a <h2> saying "User summary"

Sponsored-by: Catalyst IT
Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27740: (follow-up) quote of the day to <h2>
Wainui Witika-Park [Fri, 16 Apr 2021 03:19:13 +0000 (03:19 +0000)]
Bug 27740: (follow-up) quote of the day to <h2>

If the quote of the day feature is enabled, a "Quote of the day" heading
is displayed. It was an <h3> which was not proper hierarchy, so this has
been changed to an <h2>.

To test:
1) Go to staff client
2) Enable quote of the day preference
3) Go to the OPAC
4) Observe "Quote of the day" heading
5) Ensure it is an <h2>

Sponsored-by: Catalyst IT
Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27740: (follow-up) changed welcome user to <p>
Wainui Witika-Park [Fri, 16 Apr 2021 03:08:21 +0000 (03:08 +0000)]
Bug 27740: (follow-up) changed welcome user to <p>

In the 'user_summary block', the "Welcome, user" was an <h3>. This has
been changed to a <p> as it isn't really a heading.

The styling can be changed to make it appear as it was before, or to
make it appear more significant on the page.

To test:
1) Go to the OPAC
2) Go to the home page
3) Go to the 'user_summary' block
4) Check that the part where is says "Welcome, user" is now a <p>

Sponsored-by: Catalyst IT
Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27740: (QA follow-up) Fix 'Your purchase suggestions'
Martin Renvoize [Thu, 15 Apr 2021 14:38:16 +0000 (15:38 +0100)]
Bug 27740: (QA follow-up) Fix 'Your purchase suggestions'

On the purchase suggestions page you could end up with two "Your
purchase suggestions" headings, one as an h1 and one as an h2..

Test plan
1/ Add at least one purchage suggestion to a patron
2/ Navigate to 'Purchase suggestions'
3/ Note that just one 'Your purchase suggestsions' heading appears with
a top level '1'.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27740: (QA follow-up) Fix 'Payment method'
Martin Renvoize [Thu, 15 Apr 2021 14:00:52 +0000 (15:00 +0100)]
Bug 27740: (QA follow-up) Fix 'Payment method'

The 'Payment method' heading now needs to be moved to the second level
to ensure consistent header heirarchy.

Test plan
1/ Add some debts to a patrons account
2/ Enable online payments (Paypal is a good example)
3/ Login to the OPAC and navigate to the 'Charges' page
4/ Note the header hierarchy has no gaps... (h1 -> h2, not h1 -> h3)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27740: Corrected tags & hierarchy of headings
Wainui Witika-Park [Thu, 25 Mar 2021 23:49:20 +0000 (23:49 +0000)]
Bug 27740: Corrected tags & hierarchy of headings

Bug 27610 corrected the <h1> tags in each of the OPAC files. This patch
corrects the hierarchy of the rest of the headings on each of the pages.

To test:
1) Go to the OPAC
2) Apply Bug 27610 patch
3) Apply patch (Bug 27740)
4) Go to each of the pages and check that the headings under <h1> are in
   the correct order and hierarchy

Sponsored-by: Catalyst IT
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28134: Replace use of input type number in onboarding templates
Owen Leonard [Mon, 12 Apr 2021 10:49:45 +0000 (10:49 +0000)]
Bug 28134: Replace use of input type number in onboarding templates

This patch changes the instances of input of type="number" to input
type="text" with attributes inputmode="numeric" and pattern="[0-9]*"

To test, apply the patch and run through the process of installing Koha.
When you reach onboarding step 2, "Create a patron category," check the
enrollment period -> "In months" field. The field should not accept any
input except numbers.

Continue onboarding until step 5, "Create a new circulation rule." On
this page, check that these fields accept only numbers:

 - Current checkouts allowed
 - Loan period
 - Renewals allowed
 - Renewals period
 - Holds allowed (total)
 - Holds allowed (daily)
 - Holds per record (count)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27246: Remove obsolete BEGIN code from C4::Context
Jonathan Druart [Wed, 16 Dec 2020 10:04:48 +0000 (11:04 +0100)]
Bug 27246: Remove obsolete BEGIN code from C4::Context

We don't longer enter the HTTP_USER_AGENT conditional in the BEGIN block
of C4::Context. It was used when apache only was used.

I am suggesting to remove it but keep the $CGI::VERSION < 4.08 condition
to keep support of all version (not sure it's needed but won't hurt).

I have not found a lot of occurrences of KOHA_BACKTRACES and I am
assuming not much people are using it, we should prefer the dev_install
flag instead (to set environment="development" when plack is started and
enabled the starman trace)

Test plan:
Regression test what you think is useful
Confirm the above statements

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27865: Pass the x-koha-override header to PUT /holds/:hold_id from the patron...
Tomas Cohen Arazi [Mon, 8 Mar 2021 17:36:41 +0000 (14:36 -0300)]
Bug 27865: Pass the x-koha-override header to PUT /holds/:hold_id from the patron's page

This patch makes the AJAX call to update an existing hold, pass the
'x-koha-override' header with the value of 'any', so any pickup location
policy override that is needed, is applied.

As the override is taken into account only if AllowHoldPolicyOverride is
enabled, this in fact restores the previous behavior.

To test:
1. Have a patron with a hold
2. Have AllowHoldPolicyOverride set to 'yes'
3. Try changing the pickup location to an invalid one
=> FAIL: The options are the same as before 27205, yet the AJAX call
         fails because of invalid pickup location.
4. Apply this patch
5. Repeat 3
=> SUCCESS: The API call succeeds, and the hold is updated (it is
        actually refetch, so just verify it has the value you selected
6. Sign off :-D

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28254: Add missing tests for PUT and POST
Jonathan Druart [Tue, 4 May 2021 13:04:17 +0000 (15:04 +0200)]
Bug 28254: Add missing tests for PUT and POST

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28254: Simplify tests
Jonathan Druart [Tue, 4 May 2021 12:56:24 +0000 (14:56 +0200)]
Bug 28254: Simplify tests

This is only cosmetic, and maybe personal preferences.
It seems easier to create the library object with the pickup_library we
want to use.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28254: (QA follow-up) override -> force
Martin Renvoize [Fri, 30 Apr 2021 13:41:43 +0000 (14:41 +0100)]
Bug 28254: (QA follow-up) override -> force

After some discussion we decided that the parameter should be called
'force' for pushign through an action against policy. (as per the
Transfers work).

We decided to stick to 'override' at the API level however as it
highlights the 'human interaction' element of the call.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28254: Make PUT /holds/:hold_id/pickup_location honour x-koha-override
Tomas Cohen Arazi [Wed, 28 Apr 2021 17:56:33 +0000 (14:56 -0300)]
Bug 28254: Make PUT /holds/:hold_id/pickup_location honour x-koha-override

This patch adds a new parameter (x-koha-override header) to the route,
and makes the controller pass this information (override requested) when
the AllowHoldPolicyOverride syspref is set, to
Koha::Hold->set_pickup_location.

This way, under certain conditions, we can be sure the update wont'
fail.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28254: Unit tests
Tomas Cohen Arazi [Wed, 28 Apr 2021 17:55:52 +0000 (14:55 -0300)]
Bug 28254: Unit tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28254: Add 'override' parameter to Koha::Hold->set_pickup_location
Tomas Cohen Arazi [Wed, 28 Apr 2021 17:37:12 +0000 (14:37 -0300)]
Bug 28254: Add 'override' parameter to Koha::Hold->set_pickup_location

This patch adds a new parameter to the method. If passed+true it makes
the method skip the pickup validation test.

Tests and POD added for this change.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27898: Make PUT /holds/:hold_id accept overrides
Tomas Cohen Arazi [Mon, 8 Mar 2021 16:05:34 +0000 (13:05 -0300)]
Bug 27898: Make PUT /holds/:hold_id accept overrides

This patch makes the route handle overriding pickup locations by passing
the 'x-koha-override' header (set to 'any').

To test:
1. Apply the unit tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> FAIL: Tests fail, because things cannot be overridden ATM.
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27898: Unit tests
Tomas Cohen Arazi [Mon, 8 Mar 2021 16:03:43 +0000 (13:03 -0300)]
Bug 27898: Unit tests

This patch adds unit tests for the PUT /holds/:hold_id route so it
accepts the x-koha-override header and is able to override pickup
location constraints.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27797: (QA follow-up) Pickup locations can be overridden too
Tomas Cohen Arazi [Mon, 8 Mar 2021 15:03:01 +0000 (12:03 -0300)]
Bug 27797: (QA follow-up) Pickup locations can be overridden too

This patch adds regression tests for overridding pickup locations, which
was inadvertedly not covered by the original dev. What this does, is
moving the $can_override variable definition above, and avoid returning
400 if conditions are not met for the passed pickup_library_id, when
$can_override is true.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27797: (QA follow-up) Make tests more robust
Tomas Cohen Arazi [Mon, 8 Mar 2021 14:43:04 +0000 (11:43 -0300)]
Bug 27797: (QA follow-up) Make tests more robust

This patch makes the tests mock things so the complex holds scenarios
where existing data could interfere, don't get in the middle with what
we need to test.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Nothing broke

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27797: (follow-up): Remove stray x-koha-override definition
Tomas Cohen Arazi [Mon, 8 Mar 2021 13:25:06 +0000 (10:25 -0300)]
Bug 27797: (follow-up): Remove stray x-koha-override definition

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27797: (QA follow-up) Additional tests and operator change
Nick Clemens [Thu, 4 Mar 2021 19:50:22 +0000 (19:50 +0000)]
Bug 27797: (QA follow-up) Additional tests and operator change

I added a few tests to cover additional cases and found the operator precedence
was failing, switched 'and' to '&&'

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27797: Make POST /holds use the stashed koha.overrides
Tomas Cohen Arazi [Fri, 26 Feb 2021 13:51:52 +0000 (10:51 -0300)]
Bug 27797: Make POST /holds use the stashed koha.overrides

Bug 26181 introduced a way to override behavior through a new header,
x-koha-override. And bug 27760 introduced a generic approach to handle
x-koha-override.

This patchset makes the POST /api/v1/holds route rely on this new way of
handling x-koha-override instead of doing it manually.

The header is added to the spec as a parameter.

Note: the header should be defined as:

    "type": "array",
    "collectionFormat": "csv",
    "items": {
        "type": "string",
        "enum": [
            "any"
        ]
    }

but the versions of JSON::Validator we use have lots of bugs related to
header type coercion, so it just doesn't work. The changelog for
JSON::Validator is fairly elocuent about it.

The override now takes a list of valid keywords (right now only 'any'
but it would be fairly straight-forward to add a fairly granular set of
options based on each possible AddReserve failure.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Tests pass!
4. Sign off!

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>
3 years agoBug 27797: Unit tests
Tomas Cohen Arazi [Fri, 26 Feb 2021 13:50:46 +0000 (10:50 -0300)]
Bug 27797: Unit tests

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>
3 years agoBug 27760: (QA follow-up) Improve POD
Tomas Cohen Arazi [Thu, 11 Mar 2021 11:03:13 +0000 (08:03 -0300)]
Bug 27760: (QA follow-up) Improve POD

This patch improves the POD for the added helper, and also adds
references to the JSON::Validator issue that explains the current
implementation. A FIXME is added for when we upgrade our used
JSON::Validator version.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27760: Improve readabiliity using map
Jonathan Druart [Thu, 11 Mar 2021 10:15:26 +0000 (11:15 +0100)]
Bug 27760: Improve readabiliity using map

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27760: Make authenticate_api_request call stash_overrides
Tomas Cohen Arazi [Thu, 25 Feb 2021 12:43:11 +0000 (09:43 -0300)]
Bug 27760: Make authenticate_api_request call stash_overrides

By making this method call the helper, we make sure the overrides
hashref is available to any controller to make us of it.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/auth_authenticate_api_request.t \
           t/Koha/REST/Plugin/Query.t
=> SUCCESS: Tests pass! The helper works as expected and the
authenticate_api_request method invokes it!
3. Sign off :-D

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>
3 years agoBug 27760: Add stash_overrides helper
Tomas Cohen Arazi [Thu, 25 Feb 2021 12:35:28 +0000 (09:35 -0300)]
Bug 27760: Add stash_overrides helper

This patch adds a simple helper that reads the x-koha-override request
header, and processes it to stash a hashref with the passed overrides.

No check on the overrides themselves is done, as they should be
validated using the OpenAPI spec.

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

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>