koha.git
3 years agoFix translation issues
Jonathan Druart [Fri, 28 May 2021 09:03:58 +0000 (11:03 +0200)]
Fix translation issues

    sudo apt-get install translate-toolkit
    junitmsgfmt misc/translator/po/*.po

3 years agoTranslation updates for Koha 21.05.00
Koha translators [Fri, 28 May 2021 07:18:38 +0000 (04:18 -0300)]
Translation updates for Koha 21.05.00

3 years ago21.05.00 - Update history.txt
Jonathan Druart [Fri, 28 May 2021 06:44:04 +0000 (08:44 +0200)]
21.05.00 - Update history.txt

See previous commit to know how to regenerate this

3 years ago21.05.00 - Update contributors.yaml
Jonathan Druart [Fri, 28 May 2021 06:43:50 +0000 (08:43 +0200)]
21.05.00 - Update contributors.yaml

    git reset --hard origin/master
    git remote add kumara https://git.koha-community.org/koha-community/kumara
    git remote add oldkoha https://git.koha-community.org/koha-community/oldkoha_1_0_7
    git merge --no-edit -s subtree kumara/master --allow-unrelated-histories
    git merge --no-edit -s subtree oldkoha/master --allow-unrelated-histories
    perl $releate_tools_dir/koha-update-contributors
    git commit -a -m"21.05.00 - Update contributors.yaml"
    perl $releate_tools_dir/koha-update-history
    git commit -a -m"21.05.00 - Update history.txt"
    git format-patch HEAD -n2

3 years agoBug 28475: Fix searching all headings
Tomas Cohen Arazi [Thu, 27 May 2021 15:36:32 +0000 (12:36 -0300)]
Bug 28475: Fix searching all headings

This patch fixes the value of a hidden input that was mistakenly
changed and prevents search all headings from working.

To test:
1. Open the authorities section in the OPAC
2. Choose the 'Search all headings' tab
3. Search for 'a'
=> FAIL: No results
4. Empty the search box, and make sure 'Search all headings' is selected
=> SUCCESS: There are authority records
5. Apply this patch
6. Reload the page
7. Retry 3 and 4
=> SUCCESS: Searching is back!
8. Sign off :-D

Sponsored-by: Asociación Latinoamericana de Integración
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28364: Make log4perl.conf belong to the instance user
Tomas Cohen Arazi [Mon, 17 May 2021 13:29:01 +0000 (10:29 -0300)]
Bug 28364: Make log4perl.conf belong to the instance user

This patch makes koha-create generate the log4perl.conf file for the
instance, belonging to the instance user. This is done in order to have
the z3950 responder work.

My original idea was to make the responder accept a '-g' parameter but
that is not supported by Net::Z3950::Responder. Also, as the library
insists on handling the PID file on its own, it wont' work to handle the
responsability to start-stop-daemon. The only solution I found was
making the fiel be owned by the instance user.

1. Create a Koha instance:
   $ koha-create --create-db test
2. Initiate all the things
3. Enable and start the z3950 responder
   $ koha-z3950-responder --enable test
   $ koha-z3950-responder --start test
4. Try doing some search:
   $ yaz-client localhost:2100
=> FAIL: you get:
Connecting...OK.
Sent initrequest.
Target closed connection
Z> quit
See you later, alligator.
=> FAIL: No warning or anything on the logs
5. Stop the daemon
   $ koha-z3950-responder --stop test
6. Run it manually:
   $ PERL5LIB=/usr/share/koha/lib KOHA_CONF=/etc/koha/sites/test/koha-conf.xml \
              /usr/bin/perl /usr/share/koha/bin/z3950_responder.pl \
              -c /etc/koha/sites/test/z3950 -u test-koha \
              -p /var/run/koha/test/z3950-responder.pid -d test-koha-z3950
7. Repeat the 4, on a separate terminal (no daemon mode this time)
=> FAIL: You get:
Cannot open /etc/koha/sites/test/log4perl.conf (Permission denied) at /usr/share/perl5/Log/Log4perl/Config/BaseConfigurator.pm line 51.
8. Change the file owner:
   $ chown test-koha /etc/koha/sites/test/log4perl.conf
9. Repeat 6, and 4
=> SUCCESS: It doesn't break anymore!
10. Apply this patch
11. Create a new instance, with the patched koha-create:
    $ debian/scripts/koha-create --create-db test1
12: Check the generated files permissions:
    $ ls -l /etc/koha/sites/test2
=> SUCCESS: You get:
-rw-r----- 1 root       test2-koha 19720 May 17 13:26 koha-conf.xml
-rw-r----- 1 test2-koha test2-koha  2825 May 17 13:26 log4perl.conf
-rw-r----- 1 root       test2-koha  2014 May 17 13:26 zebra-authorities-dom.cfg
-rw-r----- 1 root       test2-koha  2279 May 17 13:26 zebra-biblios-dom.cfg
-rw-r----- 1 root       test2-koha    26 May 17 13:26 zebra.passwd

13. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28463: Add summary to all routes
Tomas Cohen Arazi [Thu, 27 May 2021 13:07:12 +0000 (10:07 -0300)]
Bug 28463: Add summary to all routes

This patch adds a 'summary' entry to all routes and verbs. This way,
ReDoc will display a human-friendly description of the route, instead of
the operationId.

To test, repeat the testing steps in the previous patch, and notice that
we now have good descriptions.

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 28463: Add missing tags
Tomas Cohen Arazi [Thu, 27 May 2021 13:06:38 +0000 (10:06 -0300)]
Bug 28463: Add missing tags

This patch adds entries for:

- Rotas
- Circulation rules
- Macros

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 28463: Add tags definitions in swagger.yaml
Tomas Cohen Arazi [Wed, 26 May 2021 20:29:42 +0000 (17:29 -0300)]
Bug 28463: Add tags definitions in swagger.yaml

This patch starts the work of curating the spec documentation-related
aspects. It doesn't involve any functional change on the API, just
labels (used to render docs) and some descriptions basis is added.

- A top level 'tags' entry is added to swagger.yaml.
- The 'name' attribute is left with double quotes. This is on purpose,
  to differentiate from 'x-displayName' which is the actual text to be
  displayer and should be handled by documentation folks, not us, devs
  :-D
- I add a very limited 'description' attribute there. It is the top
  level description of the section. For example the description for the
  'Biblios' section is 'Manage bibliographic records'. As it expects
  Markdown, anything we want can be added there.
- Some labels have been tweaked in paths, to rollback the decision of
  making the labels in paths more end-user friendly. We don't want them
  to be typed much, and I picked what we use the most: snake_case.
- The order in which things are displayed, is the one we specified on
  the swagger.yaml file. The 'batch import profiles' one is left at the
  bottom on purpose. But this is subject to discussion. As a general
  rule, I put them all in alphabetical order (on the x-displayName label
  I mean).

I submit early before family duties so others can pick where I left in
the morning. So:

TODO:
- I'm not sure what's best for Advanced editor macros. My bet is we
  should define a 'Macros' label, and use a summary on the routes
  themselves to specify this are not just 'macros', but advanced editor
  macros. Look at the return claims paths to understand how I propose to
  use the 'summary' attribtue.
- I understand how we use 'rotas', but someone more familiar with the
  terminology,... please... step in.
- Related to the first item here, we need to add summary to all routes,
  so ReDoc doesn't display the operationId anymore. Again, I put an
  example in Return claims that we can follow.

To test:
1. Have KTD running
2. Open your browser at:
   http://localhost:/8080/api/v1/
3. Save the page as spec.json in some known dir
4. Go to that dir and run:
   $ docker run -it --rm -p 8083:80 \
       -v $(pwd)/spec.json:/usr/share/nginx/html/swagger.json \
       -e SPEC_URL=swagger.json redocly/redoc
5. Open your browser at
   http://localhost:8083
=> SUCCESS: You see the docs
6. Look at the list of 'categories' on the left
=> FAIL: They look a bit weird
7. Apply this patch
8. Ctrl+c on the terminal running docker
9. Reload plack
10. Repeat 2 through 6
=> SUCCESS: Wow, things look better!
11. Sign off :-D

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 agoUpdate kohastructure.sql for 21.05.00
Jonathan Druart [Thu, 27 May 2021 10:07:17 +0000 (12:07 +0200)]
Update kohastructure.sql for 21.05.00

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26734: Rename activethemes with availablethemes
Jonathan Druart [Thu, 27 May 2021 12:25:11 +0000 (14:25 +0200)]
Bug 26734: Rename activethemes with availablethemes

There was an existing call to $self->activethemes that behave as setter:
   85     $self->activethemes($activethemes);

I am not sure what are the side-effects but it does not look good.

It caused warning in the logs:

Use of uninitialized value $interface in string eq at /kohadevbox/koha/C4/Templates.pm line 279.
Use of uninitialized value $interface in string eq at /kohadevbox/koha/C4/Templates.pm line 280.
Use of uninitialized value $interface in string eq at /kohadevbox/koha/C4/Templates.pm line 282.
Use of uninitialized value $lang in concatenation (.) or string at /kohadevbox/koha/C4/Templates.pm line 296.
Use of uninitialized value $lang in concatenation (.) or string at /kohadevbox/koha/C4/Templates.pm line 296.
Use of uninitialized value $lang in concatenation (.) or string at /kohadevbox/koha/C4/Templates.pm line 296

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27899: Missing description for libraryNotPickupLocation on request.pl
Owen Leonard [Mon, 15 Mar 2021 14:07:26 +0000 (14:07 +0000)]
Bug 27899: Missing description for libraryNotPickupLocation on request.pl

This patch adds text to the holds template in the staff client so that
if a particular item is at a library which isn't a hold location the
error message is descriptive.

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

 - Change one of your libraries so that "Pickup location" is set to
   "No."
 - Locate a title in the catalog which has an item at that location.
 - The "pick up at" list will exclude the library so and additional steps
     must be taken to get the message
 - Select a patron and set their library to the one we can't pick up at.
 - Start the process of placing a hold on the title.
 - After selecting the patron to place the hold for, look at the table of
   items under "Place a hold on a specific item."
 - The item located at the library you modified should show an error
   message in the "Hold" column, "Library is not a pickup location."

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: Sort authors by lastname || firstname
Jonathan Druart [Thu, 27 May 2021 12:38:44 +0000 (14:38 +0200)]
Bug 28386: Sort authors by lastname || firstname

If several authors have the same lastname, they are swapped in the list between the different runs.

This is reusing the code from the release_tools, see issue #24

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: Remove _others_ from the contributor list
Jonathan Druart [Thu, 27 May 2021 12:36:48 +0000 (14:36 +0200)]
Bug 28386: Remove _others_ from the contributor list

We arbitrarily use "_others_" for unknown contributors (biblibre,
bywater, ptfs-e teams, etc)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28442: Sort by lastname for array type roles
Martin Renvoize [Tue, 25 May 2021 14:55:52 +0000 (15:55 +0100)]
Bug 28442: Sort by lastname for array type roles

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28442: Fix 'accessibility_advocate' for current release
Martin Renvoize [Tue, 25 May 2021 12:59:31 +0000 (13:59 +0100)]
Bug 28442: Fix 'accessibility_advocate' for current release

The accessibility_advocate block was positioned incorrectly so wasn't
appearing properly for the current stable releases, only the
development/maintainter block.

This patch fixes that issue

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28442: Update template for new roles
Martin Renvoize [Tue, 25 May 2021 08:29:48 +0000 (09:29 +0100)]
Bug 28442: Update template for new roles

We have multiple accessibility advocates this cycle, so we needed to
adapt the template. I've also added the meeting facilitator as a case
but not added to the team block as a whole.. seeking opinions, perhaps
wait and see if it lasts more than a cycle before adding it fully?

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28442: Add 21.11 release team to teams.yaml
Martin Renvoize [Tue, 25 May 2021 08:29:23 +0000 (09:29 +0100)]
Bug 28442: Add 21.11 release team to teams.yaml

Add the 21.11 release team.

Test plan
1/ Check against https://wiki.koha-community.org/wiki/Release_Teams

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28368: Add fallback language for anonymous payment receipts
Martin Renvoize [Tue, 18 May 2021 14:57:29 +0000 (15:57 +0100)]
Bug 28368: Add fallback language for anonymous payment receipts

This adds a fallback for when a payment is made anonymously to allow
printing a receipt in the staff members current session language.

Test plan
1. Set `EnablePointOfSale` and `UseCashRegisters`
2. Add new cash register`
3. New debit type that 'can be sold'
4. Make a sale (via Point of Sale) using the above debit type.
5. Attempt to 'print receipt' from the subsequent prompt
6. Not the ISE: Can't call method "lang"
7. Apply patch
8. Attempt to 'print receipt' again, this time it should work.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28158: Allow batchMod to run under plack
Jonathan Druart [Tue, 25 May 2021 11:55:39 +0000 (13:55 +0200)]
Bug 28158: Allow batchMod to run under plack

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28158: Remove additional backgroundjob related code
Jonathan Druart [Tue, 25 May 2021 07:20:45 +0000 (09:20 +0200)]
Bug 28158: Remove additional backgroundjob related code

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28158: Remove backgroundjob from batchMod
Jonathan Druart [Mon, 24 May 2021 14:53:48 +0000 (16:53 +0200)]
Bug 28158: Remove backgroundjob from batchMod

== Test plan ==
1 - In the default framework make sure the 952$1 is visible in opac & catalog & editor
2 - Set WhenLostChargeReplacementFee to charge
3 - Set MarkLostitemsAsReturned to return from batch modification
4 - Find/edit an item with a replacement cost
5 - Check out the item to a patron
6 - Batch modify the item
7 - Set the lost status
8 - Item is not returned or charged
9 - with the patch, it is

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28419: Remove suspicious occurrence in opac-shelves.tt
Jonathan Druart [Tue, 25 May 2021 12:46:05 +0000 (14:46 +0200)]
Bug 28419: Remove suspicious occurrence in opac-shelves.tt

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28419: Fix addorderiso2709.tt translatability
Jonathan Druart [Tue, 25 May 2021 12:38:27 +0000 (14:38 +0200)]
Bug 28419: Fix addorderiso2709.tt translatability

It seems that the html tag within the TT comment breaks the translate
script

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28461: Fix orders, biblios, holds
Jonathan Druart [Wed, 26 May 2021 13:02:51 +0000 (15:02 +0200)]
Bug 28461: Fix orders, biblios, holds

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28461: Fix SMTP servers and extended attributes
Tomas Cohen Arazi [Wed, 26 May 2021 12:48:06 +0000 (09:48 -0300)]
Bug 28461: Fix SMTP servers and extended attributes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28461: Specify only one tag per route
Jonathan Druart [Wed, 26 May 2021 12:30:00 +0000 (14:30 +0200)]
Bug 28461: Specify only one tag per route

Or the route will be misplaced when generated by redoc

git grep tags api|grep '",'

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: Disambiguate Tomas and Blou
Jonathan Druart [Wed, 26 May 2021 10:30:50 +0000 (12:30 +0200)]
Bug 28386: Disambiguate Tomas and Blou

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 15720: Add connexion user and password options to connexion daemon
Nick Clemens [Thu, 17 Sep 2020 18:34:21 +0000 (18:34 +0000)]
Bug 15720: Add connexion user and password options to connexion daemon

Currently the connexion daemon does not utilize the user and password passed in the requests, it expects a
user and password to be defined in the config file and for that user to be a valid Koha user with
cataloging permissions.

With that user in place all requests to the daemon are authorized.

As the connections are over TCP we allow defining a new connexion user and password to protect Koha account information.

If not defined current behaviour is preserved. Connexion user and password must both be set it either is set.

Sample config file:
host:
port: 8888
koha:http://localhost:8081
log:/var/log/koha/kohadev/connexion.log
match:ISBN
user:kohauser
password:kohapass
overlay_action:replace
nomatch_action:create_new
item_action:always_add
import_mode:redirect
debug:1

To test:
 1 - Create connexion file and save on the Koha serve
 2 - perl misc/bin/connexion_import_daemon.pl -c /kohadevbox/koha/connexion.cnf
 3 - Ensure the user specified above (connexuser) exists and has edit catalogue permissions
 4 - In another terminal make a request to the server:
        echo -en 'U6turtleA9connexionP5shell00024    a62clear00024   4500' | nc -v localhost 8888
 5 - The request should succeed and record added to batch (probably the import fails, but not important)
 6 - Add to config file
        connexion_user:conuser
 7 - Stop and restart the daemon - it should fail on missing connexion_password
 8 - Comment out connexion_user and add
        connexion_password:conpass
 9 - Stop and restart daemon, it fails on missing connexion_user
10 - Uncomment the user and restart
11 - Make another request
        echo -en 'U6turtleA9connexionP5shell00024    a62clear00024   4500' | nc -v localhost 8888
12 - It fails 'Unauthorized request'
13 - Make another request
        echo -en 'U7conuserA9connexionP7conpass00024    a62clear00024   4500' | nc -v localhost 8888
14 - It succeeds!

Signed-off-by: Allison Blanning <ablanning@hotchkiss.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27942: Prevent XSS vulnerabilities in quote-upload
Jonathan Druart [Wed, 17 Mar 2021 10:38:47 +0000 (11:38 +0100)]
Bug 27942: Prevent XSS vulnerabilities in quote-upload

When uploading new quotes the JS variables are not escaped correctly.

Test plan:
Create a new file with the following content (remove the first and last lines containing """):
"""
":this is a source","this is a text"
"this is another ❤one","and another text❤"
"this <script>alert('foo');</script>","and <script>alert('❤');</script>"
"""

Go to Home › Tools › Quote editor
Click Import quote
Select the file
Edit the third line, hit enter
Import quotes

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 20982: Sanitize category to prevent XSS on opac-shelves.pl
Jonathan Druart [Thu, 20 May 2021 06:34:48 +0000 (08:34 +0200)]
Bug 20982: Sanitize category to prevent XSS on opac-shelves.pl

== Test plan ==
1. Go to http://localhost:8080/cgi-bin/koha/opac-shelves.pl?category=function(){window.location.href%20=%20%27https://git.koha-community.org/stats/koha-master/authors.html%27}()
2. Note that you are redirected to another website
3. Apply the patch & restart services
4. Repeat the above and you are not redirected

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 28386: Add more disambiguations to .mailmap
Jonathan Druart [Tue, 25 May 2021 14:16:11 +0000 (16:16 +0200)]
Bug 28386: Add more disambiguations to .mailmap

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28385: Use ldapserver only if exists
Jonathan Druart [Tue, 25 May 2021 08:34:49 +0000 (10:34 +0200)]
Bug 28385: Use ldapserver only if exists

Fix test
t/db_dependent/Auth_with_ldap.t .. 1/4
 #   Failed test 'use C4::Auth_with_ldap;'
 #   at t/db_dependent/Auth_with_ldap.t line 123.
 #     Tried to use 'C4::Auth_with_ldap'.
 #     Error:  No ldapserver "id="ldapserver"" defined in KOHA_CONF: /etc/koha/sites/kohadev/koha-conf.xml at /kohadevbox/koha/C4/Auth_with_ldap.pm line 55.
 # Compilation failed in require at t/db_dependent/Auth_with_ldap.t line 123.
 # BEGIN failed--compilation aborted at t/db_dependent/Auth_with_ldap.t line 123.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28385: Add tests
Jonathan Druart [Fri, 21 May 2021 06:24:51 +0000 (08:24 +0200)]
Bug 28385: Add tests

This does not test bug 28385 directly but 28278 instead.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28385: ldap server configuration broken since migration from XML::Simple
Dobrica Pavlinusic [Wed, 19 May 2021 10:24:53 +0000 (12:24 +0200)]
Bug 28385: ldap server configuration broken since migration from XML::Simple

Bug 28278 removed usage of XML::Simple which had side-affect that
C4::Context->config("ldapserver") returns one more level of hash
based on id of element, so ldap configuration was no longer
available generating error in log:

No ldapserver "hostname" defined in KOHA_CONF: /etc/koha/sites/srvgit/koha-conf.xml

which is very confusing since hostname is there, but we are looking
at wrong place for it.

== Test plan ==
1. Setup an LDAP server with users or use a public one
     See https://wiki.koha-community.org/wiki/Ldap_testing
2. Configure Koha to use it, see example config above
3. Go to OPAC
4. Koha doesn't compile due to LDAP config not parsed correctly
5. Apply the patch
6. Koha compiles and page loads
7. Log in successfully with one of the LDAP users
8. Bonus: Try to log-in with a wrong username & a good password and
     vice-versa

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28414: Fix labels for return claims
Tomas Cohen Arazi [Fri, 21 May 2021 12:55:25 +0000 (09:55 -0300)]
Bug 28414: Fix labels for return claims

The way labels are used with RedDoc, we need to tidy them better. We
should do it with all the routes, but this one is specially noisy on the
UI.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: Add the 3 unknown authors back into the contributors list with a note
Jonathan Druart [Tue, 25 May 2021 07:13:40 +0000 (09:13 +0200)]
Bug 28386: Add the 3 unknown authors back into the contributors list with a note

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: Update history using script
Jonathan Druart [Mon, 24 May 2021 13:51:42 +0000 (15:51 +0200)]
Bug 28386: Update history using script

This is an example of what will be regenerated.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: Update contributors using script
Jonathan Druart [Mon, 24 May 2021 13:50:57 +0000 (15:50 +0200)]
Bug 28386: Update contributors using script

This is an example of what will be regenerated.
It will need to be regenerated once it will be pushed

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: Fix Pawel history notes
Jonathan Druart [Mon, 24 May 2021 13:32:06 +0000 (15:32 +0200)]
Bug 28386: Fix Pawel history notes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: fisheye is certainly Olwen
Jonathan Druart [Mon, 24 May 2021 13:08:55 +0000 (15:08 +0200)]
Bug 28386: fisheye is certainly Olwen

After a chat with Chris it seems that fisheye was Olwen.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: Add sponsors to .mailmap
Jonathan Druart [Wed, 19 May 2021 13:48:11 +0000 (15:48 +0200)]
Bug 28386: Add sponsors to .mailmap

They were in dev_map.yaml, we are cheating with the <sponsor> email but
it seems to work fine in my tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: Disambiguate Séverine (to squash)
Jonathan Druart [Wed, 19 May 2021 13:35:41 +0000 (15:35 +0200)]
Bug 28386: Disambiguate Séverine (to squash)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: Add history_notes
Jonathan Druart [Wed, 19 May 2021 09:10:25 +0000 (11:10 +0200)]
Bug 28386: Add history_notes

The "developer" lines of history.txt will be regenerated using the git
history so we need to add this as a separate info.
See the release_tools changes for more info

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: Update Hector
Jonathan Druart [Wed, 19 May 2021 06:54:04 +0000 (08:54 +0200)]
Bug 28386: Update Hector

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: Meenakshi.R vs Meenakshi R
Jonathan Druart [Wed, 19 May 2021 06:47:46 +0000 (08:47 +0200)]
Bug 28386: Meenakshi.R vs Meenakshi R

Needs to match .mailmap

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: Update Kyle
Jonathan Druart [Wed, 19 May 2021 06:40:21 +0000 (08:40 +0200)]
Bug 28386: Update Kyle

Need to match .mailmap

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: Update Nicole
Jonathan Druart [Wed, 19 May 2021 06:32:50 +0000 (08:32 +0200)]
Bug 28386: Update Nicole

Need to match .mailmap

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: Remove unknown authors
Jonathan Druart [Wed, 19 May 2021 06:09:45 +0000 (08:09 +0200)]
Bug 28386: Remove unknown authors

Those 3 authors are not in the git history, we should remove them from
the author list.
However we could re-add them to the contributor list with a note saying
for instance they were part of the Catalyst Academy (need to double
check that first)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: Some manual removals from contributors.yaml
Jonathan Druart [Wed, 19 May 2021 05:47:30 +0000 (07:47 +0200)]
Bug 28386: Some manual removals from contributors.yaml

Those are not real authors and should be removed from the
contributors.yaml file

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28386: Adjust .mailmap
Jonathan Druart [Tue, 18 May 2021 13:48:48 +0000 (15:48 +0200)]
Bug 28386: Adjust .mailmap

Again, we need to adjust our .mailmap
This time the goal is the use it in place of the dev_map.yaml we have in
the release tools.

This will be generated for the release notes, history.txt and
contributors.yaml file

This can be tested using:
  git check-mailmap "author <email>"

For instance:
  git check-mailmap "Wrong name <jonathan.druart@bugs.koha-community.org>"

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28369: (QA follow-up) Restore PUT with deprecation message
Tomas Cohen Arazi [Tue, 18 May 2021 15:39:39 +0000 (12:39 -0300)]
Bug 28369: (QA follow-up) Restore PUT with deprecation message

This patch restores the PUT route, but adding a deprecation message. The
controller method is the same, and relevant patch tests are duplicated
but calling PUT, so it still gets tested.

To test:
1. Apply this patch
2. Reload plack
3. Open https://<>/api/v1/.html and find the PUT /holds/{hold_id} route
=> SUCCESS: There's a deprecation wargning!
4. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28369: Set additionalProperties: false and fix things
Tomas Cohen Arazi [Tue, 18 May 2021 12:06:45 +0000 (09:06 -0300)]
Bug 28369: Set additionalProperties: false and fix things

This patch performs a cleanup on the holds routes:
- It adds additionalProperties: false to all missing routes
- It syncs the spec with the guidelines
- additionalProperties: false highlighted some attributes read in the
  controlled weren't declared on the spec, adding them
- PUT /holds/:hold_id is moved to PATCH, as it makes more sense and
  gathered opinions lean towards that

To test:
1. Apply the tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> FAIL: Lots of things are wrong with the API
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: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28369: Regression tests
Tomas Cohen Arazi [Tue, 18 May 2021 12:06:34 +0000 (09:06 -0300)]
Bug 28369: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28370: Fix invalid responses in /patrons
Tomas Cohen Arazi [Fri, 21 May 2021 20:16:19 +0000 (17:16 -0300)]
Bug 28370: Fix invalid responses in /patrons

This response codes are not actually used.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28370: (follow-up) More cases
Tomas Cohen Arazi [Fri, 21 May 2021 15:52:02 +0000 (12:52 -0300)]
Bug 28370: (follow-up) More cases

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28370: Rewrite tests
Tomas Cohen Arazi [Fri, 21 May 2021 20:05:27 +0000 (17:05 -0300)]
Bug 28370: Rewrite tests

This patch rewrites the tests, and also doesn't enforce
additionalProperties to be false. We could need it, and there are routes
that need to be reviewed that would break otherwise now: error.json, for
example, is used everywhere, and some routes add some payload to it.

The main change this patch introduces is using the resolved spec instead
of finding each .json file, which wasn't even correct as we have .yaml
files already. Parameters and responses are tested.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove xt/api.t
=> SUCCESS: Tests fail! A nice report on the failures is printed

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28370: Add tests
Jonathan Druart [Fri, 21 May 2021 08:48:44 +0000 (10:48 +0200)]
Bug 28370: Add tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28370: Add missing additionalProperties in spec
Tomas Cohen Arazi [Tue, 18 May 2021 13:03:11 +0000 (10:03 -0300)]
Bug 28370: Add missing additionalProperties in spec

This patch adds missing attribute to the object definitions in the spec.
We wrongly supposed it was the default, but it proved not.

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28424: (follow-up) Do not create account lines manually
Tomas Cohen Arazi [Sat, 22 May 2021 21:03:25 +0000 (18:03 -0300)]
Bug 28424: (follow-up) Do not create account lines manually

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28424: (28370 follow-up) Fix response definition
Tomas Cohen Arazi [Fri, 21 May 2021 21:32:03 +0000 (18:32 -0300)]
Bug 28424: (28370 follow-up) Fix response definition

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28424: Fix patron credits route (POST)
Tomas Cohen Arazi [Fri, 21 May 2021 21:25:12 +0000 (18:25 -0300)]
Bug 28424: Fix patron credits route (POST)

This patch makes the route follow the coding guidelines and thus:
- Return the generated object
- Use the status code 201 for the response

To test:
1. Apply the tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons_accounts.t
=> FAIL: Tests fail. The reponse body and status is incorrect
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: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28424: Regression tests
Tomas Cohen Arazi [Fri, 21 May 2021 21:22:44 +0000 (18:22 -0300)]
Bug 28424: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28302: Update packages to ignore CGI::Compile 0.24 (2)
Mason James [Thu, 20 May 2021 14:50:58 +0000 (02:50 +1200)]
Bug 28302: Update packages to ignore CGI::Compile 0.24 (2)

to test...
 1/ build package
 2/ install package on focal
 3/ check that libcgi-compile-perl 0.24 is not installed

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28273: (follow-up) Remove unused variable
Tomas Cohen Arazi [Thu, 13 May 2021 12:49:16 +0000 (09:49 -0300)]
Bug 28273: (follow-up) Remove unused variable

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28273: Add form validation for pickup locations
Tomas Cohen Arazi [Thu, 13 May 2021 12:03:52 +0000 (09:03 -0300)]
Bug 28273: Add form validation for pickup locations

This patch introduces validation on the new pickup locations column.
This way, if a selected title doesn't have a pickup location set, it
will prevent form submission and a suitable error message will pop-up.

To test:
1. Apply this patch
2. Attempt to place multi-title level holds
3. Make sure some selected titles don't have the pickup location set
4. Submit
=> SUCCESS: Form submission halts, an idiomatic error message shows.
5. Unselect all biblios and repeat 4
=> SUCCESS: You are not allowed to proceed, a message is displayed.
6. Have all selected titles set a pickup location, submit
=> SUCCESS: Holds are placed as they should.
7. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28273: Multi-hold should not offer invalid pickup locations
Tomas Cohen Arazi [Mon, 3 May 2021 14:42:47 +0000 (11:42 -0300)]
Bug 28273: Multi-hold should not offer invalid pickup locations

This patch makes the multi-hold page offer only valid pickup locations
for the selected biblios. Prior to this, all system-wide pickup
locations were offered.

To test:
1. Set 'Hold pickup library match' to 'Item's home branch' so we put a
   constraint on the valid pickup locations for easier testing.
2. Choose two or more biblios from a search, which contain  in total 2
   or 3 item home branches.
3. Click 'Place hold'
4. Choose a patron
=> FAIL: The dropdown offers all system's pickup locations
5. Apply this patches
6. Reload the page
=> SUCCESS: Only valid pickup locations are offered
7. Sign off :-D

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28273: Add Koha::Biblios->pickup_locations
Tomas Cohen Arazi [Mon, 3 May 2021 12:45:41 +0000 (09:45 -0300)]
Bug 28273: Add Koha::Biblios->pickup_locations

https://bugs.koha-community.org/show_bug.cgi?id=26273

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28273: Unit tests
Tomas Cohen Arazi [Mon, 3 May 2021 12:45:25 +0000 (09:45 -0300)]
Bug 28273: Unit tests

https://bugs.koha-community.org/show_bug.cgi?id=26273

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 16785: Remove Autocomplete from overdues report filter
Owen Leonard [Thu, 13 May 2021 15:17:29 +0000 (15:17 +0000)]
Bug 16785: Remove Autocomplete from overdues report filter

This patch removes code and markup related to an autocomplete input
field in the overdues report filter. The autocomplete was intended
to enable easy entry of patron attributes, but it's simpler to use a
Select2-styled <select>

The patch removes circ/ypattrodue-attr-search-authvalue.pl, which was
only used on this page and is now obsolete.

To test, apply the patch and create at least one patron attribute type
which is linked to an authorized value:

 - Administration -> Authorized values -> New category
   - Create a new category to test with
   - Add multiple authorized values under this category
 - Administration -> Patron attribute types -> New patron attribute
   type.
   - Create an attribute which is linked to the authorized value
     category you created AND which is marked "Searchable."
 - Go to Circulation -> Overdues.
   - In the sidebar filter you should see your patron attribute as an
     option, styled as a Select2 dropdown.
   - Clicking the dropdown should trigger a list of the authorized
     values you created above.
   - Test that the search field at the top of the list works correctly
     to filter the results.
   - Test that any repeatable attribute field can be cloned by clicking
     the "Add" link, and that cloned fields can be removed using the
     "Delete" links.
   - Test that cloned fields remain in place after submitting the fitler
     form, and that any selected entry in a Select2 widget is
     preselected.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28272: (QA follow-up) Add 'manager' to cashups definition
Martin Renvoize [Wed, 19 May 2021 15:43:47 +0000 (16:43 +0100)]
Bug 28272: (QA follow-up) Add 'manager' to cashups definition

The embeddable 'manager' relation field was missing from the
specification file and as such calls using this embed would result in a
500 error since we introduced 'additionalProperties: false'.

Test plan
1/ Enable 'UseCashRegisters'
2/ Navigate to the register details page
3/ Inspect the network traffic and note a 500 error on the cashups api
call
4/ Apply the patch
5/ The 500 should have gone away and been replaced with an empty
resultset 200 page.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28302: Update packages to ignore CGI::Compile 0.24
Mason James [Wed, 19 May 2021 15:17:52 +0000 (03:17 +1200)]
Bug 28302: Update packages to ignore CGI::Compile 0.24

to test...
 1/ build package
 2/ install package on focal
 3/ check that libcgi-compile-perl 0.24 is not installed

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28187: Compiled CSS
Jonathan Druart [Wed, 19 May 2021 13:04:07 +0000 (15:04 +0200)]
Bug 28187: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28187: Exclude dtrg-group from row striping.
Martin Renvoize [Fri, 14 May 2021 10:15:58 +0000 (11:15 +0100)]
Bug 28187: Exclude dtrg-group from row striping.

The odd row lowlighting stripe effect added to datatales wasn't
accounting for classes introduced by the rowGroup plugin to denote
grouping header rows. This patch adds the required exclusion rule to
properly highlight rowGroup grouping rows.

Test plan
1/ Enable POS
2/ Create a register and make some transactions.
3/ Have both debits and credits
4/ Have some older tranactions so you can look at the past_sales table.
5/ Apply patch and regenerate the staff CSS:
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_interface)
6/ Look at the sales and past_sales table.
7/ Make sure each row header is the darker shade of gray (#e0e0e0)
7a/ You will need to have made some transactions with even and odd
numbers of items in the sale highlight the problem before applying the
patch
7b/ The rowGroup plugin is also used for the checkouts table and
this patch should also fix that case.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28255: Follow up to bug 23463 - use item_object in misc/cronjobs/delete_items.pl
Nick Clemens [Wed, 28 Apr 2021 17:56:11 +0000 (17:56 +0000)]
Bug 28255: Follow up to bug 23463 - use item_object in misc/cronjobs/delete_items.pl

This looks like just an assumption that the $item variable was an object

Correct the code to use $item_object

To test:
1 - perl misc/cronjobs/delete_items.pl -where="barcode LIKE '%8'" --commit --verbose
2 - Can't call method "safe_delete" on unblessed reference at /usr/share/koha/bin/cronjobs/delete_items.pl line 67.
3 - Apply patch
4 - Repeat
5 - Success! You deleted a bunch of items

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 27837: (follow-up) Do not check subfield unless tag defined
Nick Clemens [Tue, 11 May 2021 11:08:17 +0000 (11:08 +0000)]
Bug 27837: (follow-up) Do not check subfield unless tag defined

This was causing extra warnings when the permanent_location field was
unmapped.

We only need to check if there is a field defined as you can define a mapping
without both a field and subfield, so the existence of one implies the other

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27837: Always pass permanent location from items editor if it was defined
Kyle M Hall [Thu, 6 May 2021 13:09:03 +0000 (09:09 -0400)]
Bug 27837: Always pass permanent location from items editor if it was defined

By always passing permenent location from the items editor, we can know
if permanent location was defined in the framework. This means we can
know if we should update permanent location independently of location
even if permenent location has an empty value.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27837: Check the MARC directly, not the transformed item
Kyle M Hall [Thu, 6 May 2021 12:09:04 +0000 (08:09 -0400)]
Bug 27837: Check the MARC directly, not the transformed item

If permanent location is mapped, it will exist in the MARC.
However, when we are transforming our item hash to MARC,
we are losing our permanent location mapping, at least in unit tests.

By checking the original MARC for the permenent location, we remove the
risk of losing it the "empty" permenent location through the
transformation process. We only need to know that it existed in the
original item marc to know we need to update it in the database.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27837: Permanent location to be empty string, check if key exists
Kyle M Hall [Thu, 4 Mar 2021 15:30:31 +0000 (10:30 -0500)]
Bug 27837: Permanent location to be empty string, check if key exists

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27837: Unit tests for blank permanent location
Nick Clemens [Mon, 3 May 2021 14:44:49 +0000 (14:44 +0000)]
Bug 27837: Unit tests for blank permanent location

Bug 27837: (QA follow-up) Minor Spelling/Typo correction

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27837: Prevent the tests to fail is the field is mapped
Jonathan Druart [Thu, 4 Mar 2021 08:42:23 +0000 (09:42 +0100)]
Bug 27837: Prevent the tests to fail is the field is mapped

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27837: Add unit tests
Kyle M Hall [Wed, 3 Mar 2021 13:54:39 +0000 (08:54 -0500)]
Bug 27837: Add unit tests

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Rhonda Kuiper <rkuiper@roundrocktexas.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27837: Update permanent location if passed into ModItemFromMarc
Kyle M Hall [Wed, 3 Mar 2021 13:33:21 +0000 (08:33 -0500)]
Bug 27837: Update permanent location if passed into ModItemFromMarc

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Rhonda Kuiper <rkuiper@roundrocktexas.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27724: Use lenient also in Elasticsearch authorities search
Fridolin Somers [Thu, 18 Feb 2021 14:37:15 +0000 (15:37 +0100)]
Bug 27724: Use lenient also in Elasticsearch authorities search

In Elasticsearch, query for biblios uses lenient=true.
This is also needed for authorities search.
In case a search field is defined as type numeric.

Test plan :
1) Use Elasticsearch searchengine
2) Define a search field 'local-number' as type 'Number'
3) Be sure to us 'local-number' in autorities mapping
4) Rebuild autorities
5) Performe a search for autorities with 'Search entire record' and
   'contains' with term '123'
=> Without patch you get error :
[query_shard_exception] Can only use prefix queries on keyword and text fields - not on [local-number] which is of type [integer]

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
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 27724: Add unit test
Fridolin Somers [Thu, 18 Feb 2021 14:36:43 +0000 (15:36 +0100)]
Bug 27724: Add unit test

Run t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
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 28351: (bug 26261) Fix datepicker for dateformat ne mm/dd/yyyy
Jonathan Druart [Tue, 18 May 2021 07:10:26 +0000 (09:10 +0200)]
Bug 28351: (bug 26261) Fix datepicker for dateformat ne mm/dd/yyyy

This patch restores the same code we have prior to bug 26261

0. Set dateformat to mm/dd/yyyy
1. Go to a patron detail page
2. Open the 'Restrictions' tab
3. Choose a future date in which the day is higher than 12
=> SUCCESS: The input has the date we chose
4. Set dateformat to dd/mm/yyyy
5. Repeat 3
=> FAIL: It sets the current date, the browser console shows an error.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28317: Use the default CGI::Session serializer
Jonathan Druart [Tue, 11 May 2021 12:27:21 +0000 (14:27 +0200)]
Bug 28317: Use the default CGI::Session serializer

We remove YAML::Syck on bug 22824 and YAML on 27673, to use YAML::XS.
However we need one of them for CGI::Session::Serialize::yaml
It's preferable to change the serializer and use the default one instead
of writing one based on YAML::XS (or patch the existing ::yaml that does
not seem maintained).

There was an encoding bug reported on the default serializer (see commit
a858e8a8b895640f2) but we fail to recreate it.

Test plan:
Create 3 libraries with branchcode=branchname: "CPL", "ÄÄÄ~ÄãÃ" and "✔️ ❤️ ★"
Use the 3 options of SessionStorage and switch from one logged in
library to another.
Confirm that everything is working correctly (ie. no ending issue in the
library name at the top-right corner)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28367: (follow-up) Fix plack condition in C4/Auth_with_shibboleth.pm
Jonathan Druart [Tue, 18 May 2021 09:26:25 +0000 (11:26 +0200)]
Bug 28367: (follow-up) Fix plack condition in C4/Auth_with_shibboleth.pm

There were 2 occurrences!

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28367: Fix plack condition in C4/Auth_with_shibboleth.pm
Jonathan Druart [Tue, 18 May 2021 08:43:05 +0000 (10:43 +0200)]
Bug 28367: Fix plack condition in C4/Auth_with_shibboleth.pm

C4/Auth_with_shibboleth.pm has:
  if ( any { /(^psgi\.|^plack\.)/i } keys %ENV )
When others have:
  if ( any { /(^psgi\.|^plack\.)/i } keys %ENV )

This has been highlighted by https://gitlab.com/koha-community/koha-testing-docker/-/issues/249 that introduces a PLACK_WORKERS env vars, and t/Auth_with_shibboleth.t was failing with

 #   Failed test 'checkpw_shib tests'
 #   at t/Auth_with_shibboleth.t line 335.
 Invalid parameter passed, categorycode= does not exist# Looks like your test exited with 255 just after 5.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28189: Fix PluginRoutes.t
Jonathan Druart [Mon, 17 May 2021 14:07:17 +0000 (16:07 +0200)]
Bug 28189: Fix PluginRoutes.t

So, this one was hidden.

The failures were:
    #   Failed test 'Bad plugins raise warning'
    #   at t/db_dependent/Koha/REST/Plugin/PluginRoutes.t line 75.
    # found warning: Warning: Could not load REST API spec bundle: Invalid JSON specification HASH(0x556972b22da0):
    # found warning: Warning: Could not load REST API spec bundle: Invalid JSON specification HASH(0x5569735b8368):
    # expected to find warning: (?^u:Could not load REST API spec bundle: Invalid JSON specification)
    # expected to find warning: (?^u:The resulting spec is invalid. Skipping Bad API Route Plugin)

And the correct error was (after a debug warn in JSON::Validator):
Warning: Could not load REST API spec bundle: Invalid JSON specification HASH(0x55fd0c3d3160):
- /info/version: Expected string - got number. at /usr/share/perl5/JSON/Validator.pm line 165.

So this patch fixes it, but I don't understand why it's only failing for
plugin routes however.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28305: Remove doc reference to XML::Simple in C4::Context
David Cook [Mon, 10 May 2021 00:30:27 +0000 (10:30 +1000)]
Bug 28305: Remove doc reference to XML::Simple in C4::Context

We don't need a See Also reference to XML::Simple in the C4::Context,
especially since Bug 28278 replaced the parsing of koha-conf.xml
with XML::LibXML.

Test plan:
1. Apply patch
2. perldoc C4/Context.pm

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28345: Patron attributes no longer have option to select empty class
Owen Leonard [Thu, 13 May 2021 10:39:38 +0000 (10:39 +0000)]
Bug 28345: Patron attributes no longer have option to select empty class

This patch adds the "empty" parameter to the PROCESS directive which
builds the "Class" dropdown. This allows the user to choose a blank
option when creating or editing a patron attribute.

To test, apply the patch and go to Administration -> Patron attribute
types -> Add patron attribute type.

In the entry form the "Class" dropdown should have a blank option. When
editing an existing attribute with a class defined, the correct class
should still be preselected.

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 28320: Add DB connection check to the SIP SC status message
Nick Clemens [Tue, 11 May 2021 13:43:51 +0000 (13:43 +0000)]
Bug 28320: Add DB connection check to the SIP SC status message

This patch adds a lookup of the sip user during an SC status, confirming that
our DB ocnnection is working, and that our user is still valid

Additionally, it adds support for SC status to the sip_cli_emulator and adds basic
test coverage for the SC status message

To test:
1 - Apply patch
2 - Restart SP server
3 - perl misc/sip_cli_emulator.pl -a localhost -p 6001 -l CPL -m sc_status_request -su term1 -sp term1
4 - prove -v t/db_dependent/SIP/Message.t

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 28268: Improve memory usage when indexing authorities in Elasticsearch
Ere Maijala [Fri, 30 Apr 2021 07:00:23 +0000 (10:00 +0300)]
Bug 28268: Improve memory usage when indexing authorities in Elasticsearch

Retrieves the complete records one by one to avoid huge memory usage.

Note that this removes the call to GuessAuthTypeCode, but it is done later in Koha::SearchEngine::Elasticsearch::marc_records_to_documents (and was never done if you asked to index a single record with --authid parameter).

Test plan:
1. Apply patch
2. Reindex authorities: perl misc/search_tools/rebuild_elasticsearch.pl -a -d -v
3. Check that indexing completed successfully and results are correct.

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27844: Launch koha-worker systemd service as koha linux user
David Cook [Tue, 2 Mar 2021 23:32:28 +0000 (23:32 +0000)]
Bug 27844: Launch koha-worker systemd service as koha linux user

This patch adds the User directive to the koha-worker systemd unit file

Test plan:
0a. DO NOT APPLY PATCH YET
0b. Start a Koha testing environment running systemd
1. koha-worker --stop kohadev
2. cp debian/templates/koha-worker@.service /etc/systemd/system/.
3. systemctl start koha-worker@kohadev.service
4. ps -efww | grep "background_jobs_worker"
5. Note koha-worker is running as root
6. APPLY THE PATCH
7. cp debian/templates/koha-worker@.service /etc/systemd/system/.
8. systemctl daemon-reload
9. systemctl restart koha-worker@kohadev.service
10. ps -efww | grep "background_jobs_worker"
11. Note that koha-worker is now running as kohadev-koha

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28302: Forbid CGI::Compile 0.24
Julian Maurice [Fri, 7 May 2021 15:57:58 +0000 (17:57 +0200)]
Bug 28302: Forbid CGI::Compile 0.24

CGI::Compile 0.24 has a bug:
https://github.com/miyagawa/CGI-Compile/issues/25

It can cause weird bugs, like breaking the authority detail display
after trying to modify an authority.

Steps to reproduce:
1. Install CGI::Compile 0.24
2. Restart starman with only 1 worker
3. Go to the detail page of an authority (authorities/detail.pl)
4. Go to the edit page (Edit » Edit record)
5. Check starman logs, you should see "Subroutine build_tabs redefined
at [...]"
6. Click on cancel to go back to the detail page, which should now show
a "blank" authority. Now the only way to get the authority back is to
restart starman.

Test plan:
1. Reproduce the bug
2. Install CGI::Compile 0.25 and restart starman
3. Make sure the bug is gone :)

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28220: UI changes
Jonathan Druart [Thu, 6 May 2021 10:38:52 +0000 (12:38 +0200)]
Bug 28220: UI changes

Signed-off-by: Nick Clemens <nick@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 28220: Add more tests
Jonathan Druart [Thu, 6 May 2021 10:31:47 +0000 (12:31 +0200)]
Bug 28220: Add more tests

* Add the transaction when a patron is created
* The changes in merge_and_replace_with prevent the creation of the
patron and so the attributes if several non-repeatable attributes are
passed

Signed-off-by: Nick Clemens <nick@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 28220: Add test for updating an existing patron
Jonathan Druart [Thu, 6 May 2021 09:59:23 +0000 (11:59 +0200)]
Bug 28220: Add test for updating an existing patron

Signed-off-by: Nick Clemens <nick@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 28220: Handle NonRepeatable
Jonathan Druart [Thu, 6 May 2021 08:50:07 +0000 (10:50 +0200)]
Bug 28220: Handle NonRepeatable

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>