koha.git
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: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27942: [<=20.05] Add escape_str() in staff-global.js
Victor Grousset/tuxayo [Sat, 8 May 2021 21:30:14 +0000 (23:30 +0200)]
Bug 27942: [<=20.05] Add escape_str() in staff-global.js

It was added in bug 27930 which in not in <= 20.05

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27942: [20.11] Prevent XSS vulnerabilities in quote-upload
Jonathan Druart [Tue, 4 May 2021 09:48:03 +0000 (11:48 +0200)]
Bug 27942: [20.11] Prevent XSS vulnerabilities in quote-upload

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 423421eb64f0130d9cb194e572f4ca89937b02a4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit bac2651c609a04afa5fc802d2f7092e8b4ab76c6)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 0e00dc78e4ed01678f037a970487fd871fa3e70f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b56b902f730cc1178498ae4cbc9ad9f60504f1cc)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit f5bd16410a5c2dc597c265eec46a771cceec72bb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 040861392c39165398aadefb168176d787201d4b)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit db382ebaffd393151e0ebd8e6579f5c11969a90c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 4aaf0b3077ceae65b7da976f9cf47ad273051835)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit aa1d86920bd0392b4894fa2e756dcb41f2f7a5ec)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit bdbd2c7225f347ab23770b0b09f8f86816353ada)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 56d895da8be38bed9587ff480786ed6cf55cacce)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a949b226c26cf66b2aafd0e720a343223325bac3)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 2b1c4c4f65c787e1c6a9548b087d4e0f760a0533)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit cfb76cec33026e42cb9a0d7d30de8593d9dc8547)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 99f67cb04c2bd03e9ac5c6d01688bf9520d10595)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 333e748c3df86aa14b3592cb7a0e76c6a3503d0a)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 97647da9a0541cb02ab0777ead388c8ff99a0424)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit ed682c0f0acc5093dc8198efac3fd770ffea8d86)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 32f2026c1b6d5b97e6594020383940063d2b6fca)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit adac91502fe208a827cec71055bce9d5434c70dd)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit cb3c3d56855e001bf608a3bf157c087e655c5c04)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 4052948d7cada6b3adb38ca41e158a75bd20f406)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 539396fb27e02118d34f3b914fd2baffee752aa7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 43e0ad3fe148cd3d8538ba629d177e45aab9f500)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit ecb0ff8bbef93cabfd7a346254bb928a5af1a915)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 69f55189d1fa26dbe50b5c85d831a1e5df6d73c1)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 21d8298c7708281a9ab87851ea55f75559e57cf4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 794e3b3505464c2da846192b58d3e6a23e939d0c)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 4c004934231e4420ef6ff0a2413a08c269ca26e5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 2b7572984d8efa62c56545b44f3a3191daab5058)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit d85ae826c64ef43d1f606aceb6eaa6d3174cba52)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 06a99ac9bbf163d9186e743e03533bd0ecd74614)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 421fdc3d8f0df2ceba238e1ad23ed9478fd12cec)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d22c47a6cbe3a259cc843939ba22afc88b2c1ffa)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 3faeb901263609aa2a015f446944ef79cbe396c9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 8acb4249b37c9074cddfa90e760a0516fc663853)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 4a3049a8be8dc2d22eac796521a4185f1248282a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 32368e932fc0ec8178176da237bfaa390656f50f)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28248: aqorders.created_by is nullable
Tomas Cohen Arazi [Thu, 29 Apr 2021 18:37:49 +0000 (15:37 -0300)]
Bug 28248: aqorders.created_by is nullable

This patch introduces a change to the spec to acknowledge that the field
is nullable. This is fixed in 21.05+ as part of bug 20212.

To test:
1. Have an order with created_by = NULL
2. Use your favourite REST tool (Advanced REST Client(libre), Postman?) to fetch the order
=> FAIL: It throws a nasty error about non-nullable field being null
3. Apply this patch
4. Reload all
5. Repeat 2
=> SUCCESS: It returns things, created_by is NULL, as it should
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 9ee7a37c331bc866728cfe7cf91c97c2fc33b24b)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 23406: Don't translate suppressed authorised values
Nick Clemens [Mon, 10 May 2021 12:14:08 +0000 (12:14 +0000)]
Bug 23406: Don't translate suppressed authorised values

We have a test in C4/XSLT/transformMARCXML4HTML which is meant to exclude the 942n, however,
it doesn't work because it checks the $subfield parameter against n

$subfield is an arrayref with the code and value as members

we need to check $subfield->[0]

To test:
 1 - Apply only unit tests
 2 - prove -v t/db_dependent/XSLT.t
 3 - It fails
 4 - Confirm 952$n in default framework is tied ot authorised value 'YES_NO' or do so
 5 - Set OpacSuppression to 'Hide'
 6 - Edit a record in the default template, changing 942$n to 'Yes
 7 - Confirm the record is suppressed in opac
 8 - Note there is no suppression notice in the record in staff client
 9 - Apply second patch
10 - Reload and confirm staff side shows suppression notice
11 - Confirm record still suppressed in OPAC
12 - Edit record, set 942$n to 'no'
13 - Confirm there is no suppression notice in staff client
14 - Confirm you can view the record in OPAC
15 - prove -v t/db_dependent/XSLT.t
16 - Tests pass!

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>
(cherry picked from commit 91fb5d6a1548f7b270163d18b05467c6fd45a7f0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 3f7d334455aad215d2befdea48fe4eb26d374b55)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 23406: Unit test
Nick Clemens [Mon, 10 May 2021 12:01:55 +0000 (12:01 +0000)]
Bug 23406: Unit test

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>
(cherry picked from commit 1489950a593fb9caf5db52017580302bca7daf75)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a6b2e6e9413700d3bd78b71807c3270aec46de87)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27562: itiva notices break if record title contains quotes
Kyle M Hall [Mon, 14 Jan 2013 17:02:38 +0000 (09:02 -0800)]
Bug 27562: itiva notices break if record title contains quotes

itiva has reported to us that quotes in the title of a record cause the
call to not be made to the patron. The fix is to remove quotes from
the title, as quotes are not spoken anyway ( That is, "Queens" and
"Queen's" are pronounced the same ).

Test Plan:
1) Set up itiva to send phone notes
2) Find a record with quotes in the title
3) Trigger an itiva notice ( checkout, checkin, place hold, etc )
   using the itiva outbound cronjob
4) View the CSV, note the title has the quotes in it
5) Apply this patch
6) Repeat steps 2-3
7) View the CSV, note the title contains no quotes!

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e7aac53e9a33763724b7f0a0e9ac69518f0a926b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 0c1af441122dbdd3db590de38b55e5158d153f61)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28293: (bug 20443 follow-up) Fix wrong key in Patrons::Import->generate_patron_at...
Jonathan Druart [Thu, 6 May 2021 09:18:55 +0000 (11:18 +0200)]
Bug 28293: (bug 20443 follow-up) Fix wrong key in Patrons::Import->generate_patron_attributes

It generates warnings
Use of uninitialized value in string comparison (cmp) at /kohadevbox/koha/Koha/Patrons/Import.pm line 550, <$fh> line 2.

And does not sort correctly (no fallback on the attribute's value for repeatable attributes)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 2da36e3f175de1fcf23bdfbc96b8053f3a0a7d26)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit e36f7b988043342a4a162df306d7f66b98142cfb)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27203: Calculate tax based on ecost if unitprice not set
Nick Clemens [Thu, 17 Dec 2020 12:21:32 +0000 (12:21 +0000)]
Bug 27203: Calculate tax based on ecost if unitprice not set

There is code in populate_order_with_prices that is intended to use ecost over unitprice,
it just doens't seem to be working.

Making it more explicit seems to take care of the issue.

To test:
1 - Create a basket
2 - Add an order line, don't set 'Actual cost: ', but use vendor price
and a discount.
3 - Save
4 - Display all columns, 'Actual cost tax inc.' are GST columns aren't set.
5 - Apply batch
6 - Redo 1,2, 3
7 - Display all columns, GST is calculated correctly, unitprice remains 0.

Signed-off-by: Marjorie <marjorie.barry-vila@collecto.ca>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 66d26fa301a8e5375998da513a0a18d21974ce94)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a103cdbf1fddc41597ef8b0632fbdd475bad439a)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27203: Adjust unit tests
Nick Clemens [Wed, 5 May 2021 15:28:26 +0000 (15:28 +0000)]
Bug 27203: Adjust unit tests

It seems the issue here is that the price passed in is a string, and not a number, so the tax
value is not calculated when no unitprice is provided

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e5d42896b8076e24c6948009d7552b6cdba964f0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 6eb3790ff489bd9a012960d5abdd5d1fe6e2b20d)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 4d3ee964c9cb2a2737efc1feb184f64911fb8fbf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d6a95c8a8abc8b4ba3d4fbd3872cc986dd8e90cd)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 685fcb1880b5be44283620a0f7eacc3f2064680d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 8bc4e059187a20487c3b1a9c29d4c6ea7555c094)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit dc09de362e927668eb06e8ec90493ed5c7fd17b6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 1b645aaca93edb3132d44073feb38e1654e2b396)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 6754e92c1cab51cf4052cc9278e28ae842e904e7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d6c8dcd09e21596e9e442bca3738085ebdf66a85)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 5b26e5575049738e6ce18eb7a259c64db1ff1334)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d76972802ed246bcf6bc84c36600bbf3d56137bd)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit a197a09febd996176c841fa64080a663a4122e60)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c3ebd948cf95b2de108c48d74b30e0aa8cd5c5db)

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>
(cherry picked from commit f4a8902b79d7cae21cf2647b06a24ef36333810c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c18225cb22b53181cd91848425c02253dd57be90)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit b8a664fe7d3fe210b6f2d798b1ce5c0c0f86f6f0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 9071cbc2523cdbe1fcc0da4a67ac3619856d5cf5)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit b66fbf093505b61089e715d52c168c50172434f8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 95d5e2fa3ad57ad4c991c3c67452ec9fd5668b7d)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit c74f6848ed119b2a2fff687f3bddf87d23e20fd7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 25da495b2d58e9de94a35318a92ba79b778600d5)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 2f522d8ad4d0ce4a05250063bcc1dcba9fabd7ee)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 1440eb532d4bd2abdc76b4955cabb492283737a7)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 1426cfce0e63409f7130fe9e7d510c90c11a356c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c5116ab2ff3fc85b89a82316f869c25146660cb6)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 34858be03581b68ebfdf55ae253b49b6d87cb19c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 7968a7fa3c4a87041c18e0d5fe06ab85d0a28b86)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 3d10b9f16fe339776fdfe484a8d9ac67385d0d3b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit be79e679960fea53f4b30507274d967f703e2daa)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 5fa5632b905ceca5db77197b39987265631c5572)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit dd2a60525d990dadc795b38bf02217145cb105c4)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit cb8f254ebc3b3ed392483cd4008b7b9573c2f832)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 0f6dedf864028cc72e3b678d694707052e7d1e0a)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit b3baca4137ae6d4ef88022d3407d90b9677fcacf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d384e4601828ea8b3ca0c6be653ec372da3a5939)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 9fab281e54d232cf026c838855869e76a7543718)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 2209293fa1d59a4b701362d230743b7756f50726)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
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>
(cherry picked from commit 640ba470cfe2ac82b4ae96dfe3b4f945252a212f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d2eae82201ddc2b9dcab2a9d87e71496cc18b3b8)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28170: Fix upload.tt search result buttons for page two onwards
Lari Taskula [Mon, 19 Apr 2021 14:54:34 +0000 (14:54 +0000)]
Bug 28170: Fix upload.tt search result buttons for page two onwards

From https://datatables.net/faqs/index

"When attaching events to cells in a table controlled by DataTables, you need
to be careful how it is done. Because DataTables removes nodes from the DOM,
events applied with a static event listener might not be able to bind
themselves to all nodes in the table."

Before this patch, there were three non-functional buttons on upload search
result page, "+ Choose", "Download" and "Delete".

This patch binds the handlers to a static element so that the three buttons
in upload.tt on page two onwards are functional again.

To test:
1. This test is for the "Download" and "Delete" buttons
1.1. Before applying patch, go to cgi-bin/koha/tools/upload.pl
1.2. Make sure you have at least 21 files uploaded
1.3. Perform a search via "Search term" form so that at least 21 results are
     returned (e.g. a dot (.) as the search term should return all files with
     filetype)
1.4. Press "Download" and "Delete" for the first result row, it should work
     as expected (no need to actually delete the file - as long as it pops up
     a confirmation, it works as expected)
1.5. Go to page 2 of results
1.6. Press "Download" and "Delete" for the first result in page 2
1.7. Observe nothing happening
1.8. Apply patch
1.9. Repeat steps 3-6
1.10. Observe buttons working as expected

2. This test is for the "+ Choose" button
2.1. Go to cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&tagfield=856&frameworkcode=#subufield
2.2. Under "Other options (choose one), for "Plugin", select "upload.pl"
2.3. Find a biblio and click Edit Record
2.4. Go to 856$u and click "Upload"
2.5. Repeat steps 1.1. - 1.10., but this time for the "+ Choose" button

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1b1dbee18fcd0d55065b0758690c0c58296e6029)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 216638e67e1b97405cd67d2842d0774cd6077e42)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28207: Fix biblio_framework.frameworktext isn't in GROUP BY
Jonathan Druart [Mon, 26 Apr 2021 08:49:12 +0000 (10:49 +0200)]
Bug 28207: Fix biblio_framework.frameworktext isn't in GROUP BY

When a new framework is created and "Marc structure" is opened, a SQL
error happened if sql_strict_mode is on.

Test plan:
Create a 2 new biblio frameworks
Click "Marc structure" for one of them
=> You see the list of all frameworks with an existing structure

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f3b28bfe44bfbf1a7d0bf771bb7e3476faa2c117)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 65064e1cdb981fcb0ceeba04334ecba7125f45a7)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28217: Prevent several non-repeatable attributes to be merged
Jonathan Druart [Fri, 23 Apr 2021 13:37:46 +0000 (15:37 +0200)]
Bug 28217: Prevent several non-repeatable attributes to be merged

When using the patron merge feature it's possible to generate a patron
with several non-repeatable attributes.

This patch prevents that.

Test plan:
Create 2 patron attribute types, one repeatable and one non-repeatable
Create 2 patrons and add them repeatable attributes
Add a non-repeatable attribute to one of them
Merge the 2 patrons
=> It succeeds, the resulting patron has all the repeatable attribute
and the non-repeatable one.

Do it again but this time add non-repeatable to both patrons
Merge them
=> It fails, you should see an error on the UI
  Merge failed! The following error was reported: Tried to add more than one non-repeatable attributes. type=TYPE value=VALUE.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 92db5e22474bec148cf4346300bc246bedbc6a7c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 0216a66aca3eb2a9a47a4c5b4a6ea0c2cb98c322)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27061: Remove duplicate permission check in svc/mana/search
Jonathan Druart [Fri, 20 Nov 2020 08:04:30 +0000 (09:04 +0100)]
Bug 27061: Remove duplicate permission check in svc/mana/search

There is a call to check_cookie_auth then another one to get_template_and_user

Test plan:
Use mana to create new report and new subscription.
Confirm that you need the necessary permissions to use it

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 915c5d13bea82d8ff76e2c76525aa70a1f22961e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 3435d22040709509e4e88532881416b0acf13f76)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28244: DBRev 20.05.11.004
Andrew Fuerste-Henry [Tue, 25 May 2021 11:42:52 +0000 (11:42 +0000)]
Bug 28244: DBRev 20.05.11.004

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28244: Fix typo in Ukrainian in history
Victor Grousset/tuxayo [Fri, 30 Apr 2021 01:38:28 +0000 (03:38 +0200)]
Bug 28244: Fix typo in Ukrainian in history

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit eaddf573e9accc603f6a3d56b3570cb62d6fa9b1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit bab6b00917e9d3a5b11fe8293788749aa394a64c)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28244: Fix typo in Ukrainian in language tables in English
David Cook [Wed, 28 Apr 2021 04:53:07 +0000 (04:53 +0000)]
Bug 28244: Fix typo in Ukrainian in language tables in English

This changes the English of Ukranian to Ukrainian.

1) Apply patch
2) Go to http://localhost:8080/cgi-bin/koha/opac-search.pl
3) Click on "Language" drop-down
4) Note near the bottom it says "Ukrainian" instead of "Ukranian"

Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 945548533bac519ff66f9af429954586e58ee883)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 0e6320cde57878b1a565e60c85174bc901c36359)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28258: DBRev 20.05.11.003
Andrew Fuerste-Henry [Tue, 25 May 2021 11:35:46 +0000 (11:35 +0000)]
Bug 28258: DBRev 20.05.11.003

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28258: Fix existing occurrence
Jonathan Druart [Thu, 29 Apr 2021 08:43:31 +0000 (10:43 +0200)]
Bug 28258: Fix existing occurrence

I think it's good to fix the original problem as well

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d299e1ffc6372fb9768b8baaea86d20d5380e009)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 71d1d1b84df8fcb40c5cf6057dbf48d6837b2730)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28258: Update bad formatting in AUTO_RENEWALS notice
Lucas Gass [Wed, 28 Apr 2021 20:48:37 +0000 (20:48 +0000)]
Bug 28258: Update bad formatting in AUTO_RENEWALS notice

To test:
-Look at the AUTO_RENEWALS notice and see the syntax [% checkout.date_due as_due_date => 1 %]
-Apply patch, updatedatabase
-Look at the AUTO_RENEWALS notice and see the syntax [% checkout.date_due | $KohaDates as_due_date => 1%]

Additional test:
1 - Checkout an item to a patron
2 - Find their borrowernumber, the itemnumber, and the biblionumber
3 - Use the get_prepared_letter script to test the letter content
    perl misc/devel/get_prepared_letter.pl --module circulation --letter-code AUTO_RENEWALS --tables="{\"borrowers\": 5,\"issues\": 1040,\"items\": 1040,\"biblio\": 2 }"

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d8491c6eb294a3cfb77665daa444682e7bee8dd5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 2412990733dda49253715facd470d6d8ec5c170f)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28250: Remove upload of debug for Selenium failures
Jonathan Druart [Wed, 28 Apr 2021 10:18:36 +0000 (12:18 +0200)]
Bug 28250: Remove upload of debug for Selenium failures

We added an upload of the source page and of the screenshot but both services are discontinued.

If we need them back we must host them ourselves.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a4da4b75686015a2a25f3ed81768d18023561c40)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit f77b351cc60228caabe33e6b1e02691bbc8ca675)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28249: Prevent Selenium->wait_for_element_visible to fall in an infinite loop
Jonathan Druart [Wed, 28 Apr 2021 12:52:20 +0000 (14:52 +0200)]
Bug 28249: Prevent Selenium->wait_for_element_visible to fall in an infinite loop

Stop if max_retries is reached

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e751ce8cf2be1648fe424d08d9eefeb75d639967)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 1fa3bb0e23bba97bba101841e1e0ea988cf6c602)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27811: Hide the Accounting tab if needed
Jonathan Druart [Thu, 22 Apr 2021 12:23:05 +0000 (14:23 +0200)]
Bug 27811: Hide the Accounting tab if needed

Same as the previous patch for the "Accounting" tab of the circulation
module.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit df9d0a849d204b2216827262532a8f2957d187e2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 3f0b3340e561c3e8ca923926e07c7e5483c15a7b)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27811: Hide payment buttons if not enough permission
Jonathan Druart [Thu, 22 Apr 2021 12:20:27 +0000 (14:20 +0200)]
Bug 27811: Hide payment buttons if not enough permission

If the logged in librarian does not have the updatecharges >
remaining_permissions subpermission, we should hide the 2 "Make payment"
and "Pay all fines" button from the patron detail/circ page.

Test plan:
1 - Grant an account circulation/staffaccess permissions and any subpermissions in updatechagres but NOT 'remaining_permissions'
2 - Add some charges to a patron account
3 - Sign in with the account created in #1
4 - Bring up the patron you added charges to
=> The two buttons are not displayed

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ffbb0fd3c2238991baa09728bc0da64610de6bfc)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 7221b6860cee3a723817e5195bc5faa331b03b47)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28202: Pickup libraries must be sorted by name when placing hold
Fridolin Somers [Fri, 23 Apr 2021 09:10:15 +0000 (11:10 +0200)]
Bug 28202: Pickup libraries must be sorted by name when placing hold

When placing hold, the pickup libraries are not sorted by name but by code.

You can see in other places : pickup_locations() calls
Koha::Libraries->search with { order_by => ['branchname'] }

Test plan :
1) Go to staff interface
2) Create a new libary with code 'AAA' and name 'ZZZ'.
2) Select a record
3) Begin placing hold
4) Look at list in "Pickup at:"
=> Without patch library 'ZZZ' is first
=> With patch library 'ZZZ' is last

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>
(cherry picked from commit 4a6dd5f82da1f45456b953421e699abc179a6fb9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit ebe12231a4d1a3ec56b44b1929c122f4afcdba1b)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28202: Unit test
Fridolin Somers [Fri, 23 Apr 2021 10:49:33 +0000 (12:49 +0200)]
Bug 28202: Unit test

Run prove t/db_dependent/Koha/Biblio.t

Note that sort must be case insensitive.

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>
(cherry picked from commit 061c4c3f115cd15c669edbbdc6f4d54a9db850a0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit f478695215f19d3fbb6aee05a2be6f957314a3ea)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28148: Remove 'print' class from 'Print transfer slip' when transfer exists
Nick Clemens [Wed, 14 Apr 2021 15:17:53 +0000 (15:17 +0000)]
Bug 28148: Remove 'print' class from 'Print transfer slip' when transfer exists

The 'print' class triggers JS to create the transfer and update a form

When a transfer exists we have no form and use 'openWin' to trigger the
print

Also, I remove a stray '1' in the template

To test:
1 - Set AutomaticItemReturn to "Don't"
2 - Check in an item from another branch
3 - Confirm the transfer
4 - Check it in again
5 - Click 'Print slip'
6 - Note error in console:
    Uncaught TypeError: this.form is null
7 - apply patch
8 - Repeat
9 - No error!

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>
(cherry picked from commit 011ee862d375d1aceb694159cebe5b54d6e0f6b5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit ebe355759a691aaf5c6b8798287866584b427abd)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27819: Fix Object POD
Nick Clemens [Sat, 27 Feb 2021 17:48:29 +0000 (17:48 +0000)]
Bug 27819: Fix Object POD

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>
(cherry picked from commit 680a3323fa2588b07fc034c4a9c534b1c6095065)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a4adb984b36d1fc5d4039a623a4a8d2b3846954d)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27819: Spurious item deletion errors from delete_records_via_leader.pl
Nick Clemens [Sat, 27 Feb 2021 17:24:56 +0000 (17:24 +0000)]
Bug 27819: Spurious item deletion errors from delete_records_via_leader.pl

The job reports errors when deleting items.

The issue seems to be that Koha::Object->delete claims in the POD to
return -1, 0, or 1 as a result, but it in fact returns the Object
itself on a successful deletion

The errors are reported as:
ERROR DELETING ITEM 501740: Koha::Item=HASH(0x55ce407a1a78)

To recreate:
 1 - Find or create a record with some items
 2 - Ensure those  items can be deleted (not on loan, etc.)
 3 - Edit the record leader and set position 5 to 'd'
 4 - perl misc/cronjobs/delete_records_via_leader.pl -i -v --confirm
 5 - Deletion succeeds, but reports failure on items
 6 - Apply patch
 7 - Find or create a new record as above, but this time add an
     additional item and check it out to a patron
 8 - perl misc/cronjobs/delete_records_via_leader.pl -i -v
 9 - Test mode should report 1 item to be deleted, one with error
10 - perl misc/cronjobs/delete_records_via_leader.pl -i -v --confirm
11 - One item should be deleted, one item not, record not deleted
12 - check the item in
13 - perl misc/cronjobs/delete_records_via_leader.pl -i -v --confirm
14 - Successful deletion with no error reported

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>
(cherry picked from commit 02a404ef42683b3c19bb937cdd3bd7449c5fbd3a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 92e69e25eefd6a603d6bb9f094a27a10c749154a)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28213: Prevent crash if patron or club deleted after search to hold
Jonathan Druart [Mon, 26 Apr 2021 09:10:11 +0000 (11:10 +0200)]
Bug 28213: Prevent crash if patron or club deleted after search to hold

Deleting a patron or patron club causes server error on searching.

To recreate:
- create a club template
- create a club
- enroll a patron in the club
- from the clubs page, select Search To Hold for your club
- do a search, see that it says "Hold for [club name]" in your search results page
- go back to the clubs page and delete your club
- try to perform a search
=> Without this patch you get "Can't call method "name" on an undefined value at /kohadevbox/koha/catalogue/search.pl line 207"

Same when placing a hold for a patron (check the search result and the
detail pages)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0633590f55b2dcf0c515e50469b034e563819ced)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit f307bc2786ddd1a31d09a52913a047b04ac2bed3)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27842: (follow-up) Correct existing serail/subscriptionhistory before deletion
Nick Clemens [Thu, 4 Mar 2021 12:42:59 +0000 (12:42 +0000)]
Bug 27842: (follow-up) Correct existing serail/subscriptionhistory before deletion

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f29a41288c67015f28b0fe56c0de531ee247e139)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 7fadc22cd0ae1327a33a2467aa9c9e972ef058d0)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27842: Update serial.biblionumber when a subscription is linked with another...
Jonathan Druart [Wed, 3 Mar 2021 11:21:33 +0000 (12:21 +0100)]
Bug 27842: Update serial.biblionumber when a subscription is linked with another record

It seems that a librarian can edit the biblionumber for a given subscription, however, when receiving serials the biblionumber is pulled from the existing serials, so all new received issues are received on the old biblionumber.

This is problematic in light of bug 21901 - you can change the biblionumber, the serials still point to the old biblionumber - and deleting the biblio deletes the serials. Additionally, the update will delete serials where this was the case

Test plan:
1 - Create a new subscription
2 - Receive an issue
3 - Edit the subscription and change the biblionumber
4 - Receive another issue
5 - SELECT biblionumber FROM serial
=> the biblionumber link must have been updated

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7e6f30e60eabcf3a18690fbe5eff3ec901d6f067)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 9f16f42953b106ed5fc249b2e41365d2bd5732f9)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27842: Add tests
Jonathan Druart [Wed, 3 Mar 2021 11:21:20 +0000 (12:21 +0100)]
Bug 27842: Add tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 46b2f5b488c7a8879c3d457cf82ac7e0a1dfcc0e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit fd5090a415e217144ce334d4d611ddb556ddfb8a)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28234: TestBuilder->build_sample_biblio should set UTF-8 encoding for record
Tomas Cohen Arazi [Tue, 27 Apr 2021 11:24:57 +0000 (08:24 -0300)]
Bug 28234: TestBuilder->build_sample_biblio should set UTF-8 encoding for record

This patch makes the build_sample_biblio method, correctly set the UTF-8
flag for the MARC::Record object.

Tests are added.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/TestBuilder.t
FAIL: Tests fail! An unexpected encoding warning shows
3. Apply this patch
4. Repeat 2
=> SUCCESS: No warning! Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8fce3401e75604b36cf0aad2ccb4ce65941e0f55)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit af4c23186bc3f205b4f3d0f2bcde0ab13daac370)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28234: Regression tests
Tomas Cohen Arazi [Tue, 27 Apr 2021 12:47:43 +0000 (09:47 -0300)]
Bug 28234: Regression tests

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

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 26405: Prevent Circulation.t failing on 'AddRenewal left both fines'
Emmi Takkinen [Thu, 3 Dec 2020 08:41:47 +0000 (10:41 +0200)]
Bug 26405: Prevent Circulation.t failing on 'AddRenewal left both fines'

Bug 23051 added option to skip calculating fines even when
"CalculateFinesOnReturn" is enabled. Due this Circulation.t
fails on  test  "AddRenewal left both fines" if
"CalculateFinesOnReturn"  is disabled on ones system.
Mocking syspref while testing fixes failig tests.

To test:
1. Disable "CalculateFinesOnReturn".
2. Run prove t/db_dependent/Circulation.t
=> Tests fail
3. Apply patch.
4. Run prove t/db_dependent/Circulation.t again
=> Tests are succesful

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>
(cherry picked from commit 95cbefe12d5b5d901d545b602627224dfc2c7034)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit e9caf93ad51874333348cf784c8e569793fec554)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28223: Add data elements to negative budgets
Nick Clemens [Mon, 26 Apr 2021 12:40:48 +0000 (12:40 +0000)]
Bug 28223: Add data elements to negative budgets

To test:
1 - Have a parent fund and a child fund
2 - Order an amount from the child fund that is greater than the amount available
3 - Browse to acquisitions
4 - Confirm the totals look right
5 - Click on the over spent fund to go to 'Funds for main budget'
6 - Note the totals are incorrect
7 - Apply patch
8 - Reload
9 - Totals are now correct

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 92f69a01936a361456b962f114e168c48539ee87)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 891b50ff812be248be5b99de1103a02bc5389466)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoRevert "Bug 27566: Add generic font family to prevent unstyled select tags"
Andrew Fuerste-Henry [Mon, 24 May 2021 18:41:01 +0000 (18:41 +0000)]
Revert "Bug 27566: Add generic font family to prevent unstyled select tags"

This reverts commit 699c1db92586cc530e9c37620f87251d48b86e3b.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28144: Add a regression test
Jonathan Druart [Tue, 27 Apr 2021 13:04:35 +0000 (15:04 +0200)]
Bug 28144: Add a regression test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0140f1e626471c10b487c65e2db91766d31ac225)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 9bed1f59bf022c9a3f1a9f3b46217d98fa416e87)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28144: Check if issue_id defined
Nick Clemens [Tue, 13 Apr 2021 15:14:11 +0000 (15:14 +0000)]
Bug 28144: Check if issue_id defined

Historical OVERDUE fines may not have an issue_id - this causes
flooding of the logs when calling update fine

Trivial change, reading the code should be enough, but test plan below

To test:
1 - Create some fines without an issue_id
  - Either checkout an old version of Koha and add manually or
  - Checkout some items (backdated) to a patron, run fines.pl then
    UPDATE accountlines SET issue_id = NULL;
2 - Checkout a backdated item with fines in the circ rule to the same patron
3 - Run fines.pl
4 - Note the errors
5 - Apply patch
6 - Repeat and note no errors

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit bf13a36c8a80d2b7b38c897b4ae3bdf2c91fb934)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit f76e8409707fe8da1f35e3ae6192dbe81c8a0448)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28221: Script process_message_queue.pl uses Try::Tiny but doesn't 'use' it
Kyle M Hall [Mon, 26 Apr 2021 10:30:17 +0000 (06:30 -0400)]
Bug 28221: Script process_message_queue.pl uses Try::Tiny but doesn't 'use' it

The message queue processor has a try/catch block, but does not have a 'use Try::Tiny' line. Because of this the following error ocurrs if an instance has any plugins installed that use the before_send_messages hook:

Can't locate object method "catch" via package "1" (perhaps you forgot to load "1"?) at /usr/share/koha/bin/cronjobs/process_message_queue.pl line 86.

Test Plan:
1) Install a plugin that uses the before_send_messages hook
2) Run the message queue processor
3) Note the error message
4) Apply this patch
5) Run the message queue processor again
6) No error!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 808d9a9f81a65921b70af92dba83d407e8e71caf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 5a6afac654c2141829f7ab0ec44a4f5f4eaf1c43)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 21818: Replace AutoCommit flag with DBIx transaction in stage-marc-import.pl
Fridolin Somers [Thu, 11 Mar 2021 10:46:46 +0000 (11:46 +0100)]
Bug 21818: Replace AutoCommit flag with DBIx transaction in stage-marc-import.pl

Like it was done in Bug 18806.

Test plan :
Use stage-marc-import.pl with and without patch, with a matcher to find
duplicates

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ff849fadbade8b72faec52284b58e6f5dd8a71c9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit e78a027a148dc44ab41d1f3ac0d06a959f99bc22)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27566: Add generic font family to prevent unstyled select tags
Owen Leonard [Thu, 28 Jan 2021 16:37:13 +0000 (16:37 +0000)]
Bug 27566: Add generic font family to prevent unstyled select tags

This patch adds a default font family "sans-serif" to the OPAC CSS as a
workaround for this Firefox bug:

font-family isn't honored in `<option>` element within `<select>`
dropdown
https://bugzilla.mozilla.org/show_bug.cgi?id=1536148

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

 - Open the OPAC main page in Firefox.
 - Click the search type dropdown. The options should be styled using
   your system's default sans-serif font rather than a serif font.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit dee61a7c3e30629f8651823a6dd761e98560d60c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d736d8908c90cba6b075235f9de5b256e1d2cb46)

3 years agoBug 27968: Fix framework import if isurl has an incorrect value
Jonathan Druart [Wed, 17 Mar 2021 08:18:48 +0000 (09:18 +0100)]
Bug 27968: Fix framework import if isurl has an incorrect value

If isurl is set to undef in the DB, it will be exported as an empty
string, which is an invalid value for isurl (int)

Incorrect integer value: '' for column 'isurl'

Test plan:
Export framework structure in CSV and ODS, then reimport it and check that
all the subfields are important correctly

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 01f0e04172432e28f37a94bf6df51a3fd6cdc960)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 5b4dd72d3a1772be1a7f9b0745663a2b3c6ecdf8)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28064: (QA follow-up) Remove value from button
Martin Renvoize [Thu, 22 Apr 2021 10:45:01 +0000 (11:45 +0100)]
Bug 28064: (QA follow-up) Remove value from button

To clarify that the value is not used on buttons that are not submit
type we remove the value entirely.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e77fa64e31cdf026030c4a354bf73e4ee7e2bb14)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c9c0f8c65dc655306af94a2dd890389180e3d5fb)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28064: Add dotransfer field to slip print submission
Martin Renvoize [Wed, 31 Mar 2021 12:06:49 +0000 (13:06 +0100)]
Bug 28064: Add dotransfer field to slip print submission

By changing the code to only do a javascript triggered submission from
the from button we lose the original buttons name and value elements
upon submission.

This patch checks for those fields in the JS capture and triggers the
addition of a new hidden form field to contain the dotransfer data.

Test plan
1/ Set AutomaticItemReturn system preference is set to "Don't"
2/ Check in an item that belongs to another library, a dialog will ask
   you if you want to transfer.
3/ Click 'Yes, print slip'
4/ Look at the item record and note the status is 'Available'.
5/ Apply patch
6/ Follow steps 2 - 4
7/ Note the status is now 'In transit to...'
8/ Signoff

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
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>
(cherry picked from commit ccd72425327d50ec7595f48021f9e53a30c0b90d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 9f57b8dcc5e1d50298a645880c7e459f8e38ae6a)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 23195: (follow-up) One text invoice should be open
Nick Clemens [Wed, 21 Apr 2021 11:16:18 +0000 (11:16 +0000)]
Bug 23195: (follow-up) One text invoice should be open

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0cabe5e184fb1d02464eda4de859bb6ebf2109d9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit f82407e91776cf0336eade2d5b0b0a478986d661)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 23195: Always count shipping costs as 'spent'
Nick Clemens [Mon, 12 Apr 2021 18:13:47 +0000 (18:13 +0000)]
Bug 23195: Always count shipping costs as 'spent'

As shipping costs are created when an invoice is created, and creation
of an invoice implies that items have been received, the shipment costs
are always assumed to be 'spent'

This logic is true in GetBudgetSpent/GetBudgetOrdered, however, GetBudgetHierarchy
treats open invoices shipping costs as 'ordered' and closed invoice shipping costs
as 'spent'

This leads to inconsistencies in acqui-home vs spent.pl and ordered.pl

To test:
 1 - Find a vendor
 2 - Click 'Receive shipments'
 3 - Create a new invoice with a shipping cost on budget A
 4 - Repeate and create a new invoice with a shipping cost on budget B
 5 - Close the second invoice
 6 - View acquisitions ome
 7 - Note budget A includes the shipping under ordered
 8 - Note budget B includes the shipping under spent
 9 - Click the 'ordered' column on budget A - no shipping is listed on ordered page
10 - Click the spent column on budget A - the shipping is listed here
11 - Apply patch
12 - Both budgets list the shipping as 'spent'
13 - Both 'spent' pages include the shipping
14 - Neither 'ordered' page includes shipping

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 83941d2ee18c4c94485b0feea510d5899c1ee050)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit abbdf0323373a1cbb45ae2671defaafe9cc308e2)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 23195: Unit tests
Nick Clemens [Mon, 12 Apr 2021 18:13:21 +0000 (18:13 +0000)]
Bug 23195: Unit tests

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 2d505e5ba06ba12194676b5183bed4827d4b9eea)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 1c4b8ca01c507ab32e8968b167db824dbc9da4b8)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27120: (follow-up) also send biblionumber
Fridolin Somers [Thu, 11 Mar 2021 08:14:38 +0000 (09:14 +0100)]
Bug 27120: (follow-up) also send biblionumber

Like in after_biblio_action hook

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>
(cherry picked from commit c3625010bbf4e1eff428d9d1d7c5db2cd24045aa)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit eb8636f089dc01028b0a905a472a027e499cf218)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27120: Send biblio to Koha plugins hook 'intranet_catalog_biblio_tab'
Fridolin Somers [Tue, 1 Dec 2020 08:27:01 +0000 (09:27 +0100)]
Bug 27120: Send biblio to Koha plugins hook 'intranet_catalog_biblio_tab'

Koha plugins hook 'intranet_catalog_biblio_tab' should have the datas of the current biblio record.
Koha::Biblio is aleady in template, send it with hooks call.

This will be very usefull to be able to fetch external datas
(wikipedia, youtube, ...) depending on current biblio record.

Test plan :
1) Enable Koha plugins
2) Install plugin attached to this bug
3) Go to staff interface on a biblio record details page
4) Check you see tab 1 containing 'Tab for record {title}'
5) Check you see tab 2 containing 'Tab for record {isbn}'

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>
(cherry picked from commit 3e4d37b03158aa24c5bd01a13a7acd53df8e2213)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit ab6e421152a763270e6d1e0083c433a38c86a277)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27114: (QA follow-up) Add missing POD
Martin Renvoize [Tue, 9 Mar 2021 16:47:35 +0000 (16:47 +0000)]
Bug 27114: (QA follow-up) Add missing POD

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b385e1f529a26e1c592355b9f7c2cec3259812df)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit f05e6296bd49cc97b3b1c427966bdc432d7348a2)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27114: Use Template Toolkit plugin for Koha plugins hook 'intranet_catalog_biblio...
Fridolin Somers [Mon, 30 Nov 2020 07:39:41 +0000 (08:39 +0100)]
Bug 27114: Use Template Toolkit plugin for Koha plugins hook 'intranet_catalog_biblio_tab'

Koha plugins hook 'intranet_catalog_biblio_tab' is for a template,
it will be better it uses Template Toolkit plugin like intranet_js, ...
It will allow using it in other places like MARC details page for example.

Test plan uses a plugin from git.biblibre.com because this hook is not
yet in KitchenSink.

Test plan :
1) Enable Koha plugins
2) Download and install the latest version of this plugin
https://git.biblibre.com/biblibre/koha-plugin-intranet-detail-hook
3) Browse to catalogue/detail.pl for a record
4) Note you see two new tabs with content

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d0fecf3ff77da1344e915fe027a6fb11af475bb5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 20bbaf12a61ba91e80a0f5094b75a2cade36213f)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27282: fix all occurrences
Lucas Gass [Thu, 7 Jan 2021 15:57:16 +0000 (15:57 +0000)]
Bug 27282: fix all occurrences

This patch fixes all the occurrences, staff and OPAC. The problem only happens on some versions of Chrome.
TO TEST:
-set up a new list with a few items
-go to /cgi-bin/koha/virtualshelves/shelves.pl and view that list.
-Click 'Print List' in Chrome.
-The tab opens but immediately closes itself.
-Apply patch and clear cache
-Try again, the print dialouge remains open

-Go to cgi-bin/koha/sco/sco-main.pl in Chrome, make sure you can finish and print successfully
-In the staff client in Chrome makes sure printing works in the following areas:
    1. /cgi-bin/koha/circ/circulation.pl Print Slip and Print Quick Slip
    2. /cgi-bin/koha/members/boraccount.pl Make a payment and make sure you can print the invoice
    3. cgi-bin/koha/labels/spinelabel-home.pl Make a quick spine label in Chrome and make sure that prints.

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>
(cherry picked from commit 55b050b607869169aae2c52d1f89fd79f62af400)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b4ccde1133d1040d6f6094aa1d3ddcd2b91e9174)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27282: Add window.onafterprint function
Lucas Gass [Fri, 18 Dec 2020 17:28:54 +0000 (17:28 +0000)]
Bug 27282: Add window.onafterprint function

TO TEST:
-set up a new list with a few items
-go to /cgi-bin/koha/virtualshelves/shelves.pl and view that list.
-Click 'Print List' in Chrome.
-The tab opens but immediately closes itself.
-Apply patch and clear cache
-Try again, the print dialouge remains open

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
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>
(cherry picked from commit fae72d031a080f840b39d892c95f3a9ee6f659ab)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 5fe3e6592d43668a6648fb1f99471e8a892bb705)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 27232: Add missing space between : and </label> in member-alt-contact-style.inc
Jonathan Druart [Mon, 14 Dec 2020 13:44:53 +0000 (14:44 +0100)]
Bug 27232: Add missing space between : and </label> in member-alt-contact-style.inc

It caused the strings to appear twice in the po file

Test plan:
Apply this patch and regenerate the PO for a given language.
Notice that the string "%s State: " only appears once in the PO file

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 61d8ec5075ba95c1fd84be6bfefd547749eaae1d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit e3bb1444356a9f9f64d368cabe49922731bdeed6)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 26533: Fix 'is exactly' search for authorities
Aleisha Amohia [Tue, 9 Mar 2021 21:33:16 +0000 (10:33 +1300)]
Bug 26533: Fix 'is exactly' search for authorities

The exact search 6=3 is implemented, but it isn't used as expected when
you select 'is exactly' from the authorities search dropdown. This patch
remedies that.

To test:
1) Ensure you have an authority with more than one word in the name,
    i.e. Electric power production
2) Go to Authorities in the staff client.
3) Change the dropdown to 'is exactly' and search for one of the words
in your record's title, i.e. 'power' in the 'main heading' search
4) Confirm your authority shows in the results, even though it is not an
exact match.
5) Search for a biblio record and go to edit the record.
6) Go to Tab 6 and click the plugin button next to one of the 6xx$a
fields to trigger the authority finder plugin
7) Repeat Step 3 and Step 4
8) Go to the OPAC and go to Authority Search
9) Repeat Step 3 and Step 4

Apply patch

10) Repeat Steps 1 to 9, confirm that this time the record does NOT show
in search results.
11) Repeat Steps 1 to 9 but this time search for the authority record's
full title, i.e. 'Electric power production'. Confirm the record does
show in the search results because the search term now matches title exactly.

Sponsored-by: Education Services Australia SCIS
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>
(cherry picked from commit a58cf90a3146f385671e6d82ae65de4f36d33316)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c62ca48c5619ceaa7f02d9aaf29bc029701885ac)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 28054: DBRev 20.05.11.002
Andrew Fuerste-Henry [Mon, 24 May 2021 15:55:09 +0000 (15:55 +0000)]
Bug 28054: DBRev 20.05.11.002

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 20854: (QA follow-up) Rephrase of the new casServerVersion pref description
Katrin Fischer [Sat, 17 Apr 2021 13:38:43 +0000 (13:38 +0000)]
Bug 20854: (QA follow-up) Rephrase of the new casServerVersion pref description

For another related change, see:
https://en.wikipedia.org/wiki/Central_Authentication_Service

CAS = Central Authentication Service

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6aa6f115bd2330342675781400199a2f3152abf1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a54e729319ea03baae1b8e65f409a8916ff77ba8)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 20854: (QA follow-up) Improve readability
Tomas Cohen Arazi [Tue, 16 Mar 2021 19:50:34 +0000 (16:50 -0300)]
Bug 20854: (QA follow-up) Improve readability

The logout_cas method does too little tasks. In this case, I consider we
should not split it into a separate method. As the CAS implementation
lacked tests, it made sense to do it like this, so it is testable. But
now we have higher-level tests for logout_cas, we can bake the behavior
inside of it, and it is testable.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7c3c066714ce568e507348f1e3a9a6b7db0c4815)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 9b3538678ee758632a5d945e3c8d3e5870465a67)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 20854: Add more CAS tests
Tomas Cohen Arazi [Tue, 16 Mar 2021 19:46:14 +0000 (16:46 -0300)]
Bug 20854: Add more CAS tests

This patch aims to add full test coverage for 'logout_cas' the way we do
it nowadays (in a subtest, mocking things, etc). It is provided as a
separate patch so we can test the follow-up tidy and see no behavior
change.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Auth_with_cas.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
4. Apply the refactoring follow-up
5. Repeat 3
=> SUCCESS: Tests still pass!
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c71dda04c605b68b439e1a0ea3132447eeb28b45)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 225517a0f3dfed730c1afe38e8a262f8fe02d28e)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
3 years agoBug 20854: Allow correct redirect on logout for Cas servers 3.0 and superior.
Matthias Meusburger [Mon, 12 Oct 2020 13:58:31 +0000 (15:58 +0200)]
Bug 20854: Allow correct redirect on logout for Cas servers 3.0 and superior.

Test plan:

 1) Apply the patch
 2) Set the system preference casLogout to "Yes"
 3) Set the new system preference CasServerVersion to "CAS 3 or superior"
 4) Check that you are redirected to Koha after a CAS logout from a CAS 3 server
 5) Set the new system preference CasServerVersion to "CAS 2 or inferior"
 6) Check that you are redirected to Koha after a CAS logout from a CAS 2 server

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 91307707ed2ff874ec5e2f25658a286019204e54)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 26e7262963c2744bdec91a1f7487a830c9017120)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>