koha.git
8 months agoUpdate release notes for 23.05.04 release v23.05.04
Fridolin Somers [Thu, 28 Sep 2023 18:42:43 +0000 (08:42 -1000)]
Update release notes for 23.05.04 release

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoIncrement version for 23.05.04 release
Fridolin Somers [Thu, 28 Sep 2023 18:06:57 +0000 (08:06 -1000)]
Increment version for 23.05.04 release

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoTranslation fixes for Koha 23.05.04
Fridolin Somers [Fri, 28 Jul 2023 21:08:22 +0000 (11:08 -1000)]
Translation fixes for Koha 23.05.04

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoMerge remote-tracking branch 'translate/23.05.04-translate-20230928' into 23.05.x...
Fridolin Somers [Thu, 28 Sep 2023 18:02:07 +0000 (08:02 -1000)]
Merge remote-tracking branch 'translate/23.05.04-translate-20230928' into 23.05.x-security

8 months agoTranslation updates for Koha 23.05.04
Koha translators [Thu, 28 Sep 2023 17:59:05 +0000 (14:59 -0300)]
Translation updates for Koha 23.05.04

8 months agoBug 34369: Fix 'Did you mean'
Jonathan Druart [Thu, 3 Aug 2023 08:01:32 +0000 (10:01 +0200)]
Bug 34369: Fix 'Did you mean'

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit ea91896f1531f2c042897849cf313e18aaa5bd64)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34369: Pass csrf token from syspref API client (for Vue app)
Jonathan Druart [Tue, 1 Aug 2023 07:12:10 +0000 (09:12 +0200)]
Bug 34369: Pass csrf token from syspref API client (for Vue app)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 3c6dd02acbfc021c85b23e38d1ef605e09e65764)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34369: Require CSRF token for updating system preferences
David Cook [Tue, 1 Aug 2023 06:56:23 +0000 (06:56 +0000)]
Bug 34369: Require CSRF token for updating system preferences

This patch adds the requirements that updating a system preference
requires a CSRF token. (Also, adding and deleting local system preferences.)

0. Apply patch
1. koha-plack --reload kohadev
2. Add local system preference
3. Update local system preference
4. Delete local system preference
5. Update normal system preference
6. Note no errors

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit c6ef2aba6bf93b3f17b57b384859edee54f99a72)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34761: Prevent XSS for searches and saved search filters
David Cook [Wed, 13 Sep 2023 01:33:43 +0000 (01:33 +0000)]
Bug 34761: Prevent XSS for searches and saved search filters

</script> tags are interpreted in JSON strings as HTML, which can
lead to XSS attacks.

This patch puts HTML escaped JSON in the value of a hidden HTML element.
The Javascript then takes the value as a string, parses it as JSON,
and is able to use it to save search filters without triggering a
XSS attack.

This patch also adds DataTable's built-in HTML escaping for the query
and limits on the admin UI for the search filters.

Test plan:
0. Apply patch
1. Go to
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=SavedSearchFilters
2. Enable the system preference
3. Go to http://localhost:8081/cgi-bin/koha/catalogue/search.pl?q=e
4. Click "Save search as filter"
5. Checkbox "Show in staff interface?"
6. Type "E-TEST" into box and click 'Save'
7. Go to
http://localhost:8081/cgi-bin/koha/catalogue/search.pl?q=e
8. Click "E-TEST" under "Custom search filters"
9. Note that you see search results
10. Go to
http://localhost:8081/cgi-bin/koha/admin/search_filters.pl
11. Note that for "E-TEST" you see a "Query" like
{"operators":[],"operands":["e"],"indexes":[]}
12. Note that for "E-TEST" you see a "Limits" like
{"limits":[]}

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 4e32b761986f5de28df4f1125b5d16c6c2f24306)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34349: Validate/escape inputs for task scheduler
David Cook [Mon, 24 Jul 2023 04:31:15 +0000 (04:31 +0000)]
Bug 34349: Validate/escape inputs for task scheduler

This change validates and escapes inputs for task scheduler.

Test plan:
0. Apply patch
1. koha-plack --reload kohadev
2. Go to http://localhost:8081/cgi-bin/koha/tools/scheduler.pl
3. Input a time a minute in the future and leave the date blank
4. Choose an existing report and output format
5. Type a malicious string which is also a valid email address
into the Email field
6. Click "Save"
7. Note that the job is added but the Email is wrapped in single
quotes
8. Try using a non-malicious email address with a single quote.
9. Note that the single quote is escaped, so that it will still
be used by runreport.pl

JD amended patch: tidy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Removed pars for $email =~ regex, removed old commented lines.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit dcd698a4b4ed7f3a714ef35fe83c007fce9d52ae)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34513: (QA follow-up) Tidy
Nick Clemens [Thu, 24 Aug 2023 18:19:37 +0000 (18:19 +0000)]
Bug 34513: (QA follow-up) Tidy

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 332b95b2507184e20cd70ddfb16c6f5a260d6dc0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34513: Add checkauth unit test for resetting auth state when changing users
David Cook [Wed, 16 Aug 2023 02:51:43 +0000 (02:51 +0000)]
Bug 34513: Add checkauth unit test for resetting auth state when changing users

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit abbbc5924de287a73c7d91c0f8ab70f8d7461508)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34513: Add end-to-end test for authorization check after first failed authorization
David Cook [Wed, 16 Aug 2023 02:21:40 +0000 (02:21 +0000)]
Bug 34513: Add end-to-end test for authorization check after first failed authorization

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit bb581fe78be9dacb9215366f3a54ab9b640f783f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34513: Set auth state correctly when changing auth sessions
David Cook [Fri, 11 Aug 2023 03:03:01 +0000 (03:03 +0000)]
Bug 34513: Set auth state correctly when changing auth sessions

This patch sets the $auth_state to failed when changing auth sessions,
so that the new login attempt gets processed correctly (instead
of skipping the authorization step).

Test plan:
0. Apply the patch
1. koha-plack --reload kohadev
2. Go to
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=baseurl
3. Log in as an OPAC user with 0 permissions
4. Note the auth screen "Error: You do not have permission to access this page"
5. Click "Log in"
6. Note that you're still shown a login screen (and that you've been logged out of
your previous authenticated session)

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 16da12cbbc200d9ef07a87ee7f9bdf8e61ae06f3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34653: Make koha-foreach return the correct status code
Evan Giles [Fri, 1 Sep 2023 06:42:45 +0000 (18:42 +1200)]
Bug 34653: Make koha-foreach return the correct status code

I think the correct behavior for this script should be that koha-foreach
will return 0 (success) if all the commands it tried to run succeeded, but
1 (failure) if any of the commands failed.

To test:
1. $ koha-create --create-db test
2. $ vi test.sh
if [ $USER = 'kohadev-koha' ]; then
    echo "FAILED";
    exit 1;
else
    echo "SUCCESS";
    exit 0;
fi

3. $ debian/scripts/koha-foreach sh test.sh
FAILED
kohadev: 1 status returned by "sh test.sh"
SUCCESS
4. $ echo $?
5. Note that the exit status is 0 (success)

6. Apply patch

7. $ debian/scripts/koha-foreach sh test.sh
FAILED
kohadev: 1 status returned by "sh test.sh"
SUCCESS
8. $ echo $?
9. Note that the exit status is 1 (failure)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit d9849aaa3aa777072c846526c772a896b5424cfb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34748: DBRev 23.05.03.005
Tomas Cohen Arazi [Mon, 25 Sep 2023 13:14:08 +0000 (10:14 -0300)]
Bug 34748: DBRev 23.05.03.005

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit a06396c2826c604fc9dfe79c22256b6d69edc415)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34748: Fix column name in columns configuration for basket table
Katrin Fischer [Tue, 19 Sep 2023 21:33:00 +0000 (21:33 +0000)]
Bug 34748: Fix column name in columns configuration for basket table

The first column was named basket_number, but it's actually the
order_line.

To test:
* Edit column configuration for acquisition > basket
* Make sure to set at least one checkbox for 'basket_number'
* Apply patch, run database update
* Verify that the first column is now 'order_line', but your
  settings have been preserved

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f9f9c3a7faeba4a36e233d867019dad495a09c25)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 21828: build $bib_heading_fields only once per invocation
Andreas Roussos [Tue, 1 Aug 2023 18:49:55 +0000 (20:49 +0200)]
Bug 21828: build $bib_heading_fields only once per invocation

In UNIMARC instances, the run time of link_bibs_to_authorities.pl
can be reduced by up to 80% and the number of DBI calls
can be reduced by up to 90% with a very simple fix that
optimises the constructor of the C4::Heading::UNIMARC object.

Currently, the constructor resets the $bib_heading_fields hash
*in each invocation* (i.e. for every field the bibliographic
record contains), then populating it again with the results
fetched from the database! This is inefficient.

The patch/fix is trivial: we take advantage of the fact that
$bib_heading_fields is declared at the top of the
C4::Heading::UNIMARC module and is thus a package variable
that is in scope for the entire execution of the program
(more info here: https://stackoverflow.com/q/75317862).

Placing the section that generates the $bib_heading_fields
hash inside a "unless ( defined $bib_heading_fields )" code
block is enough to cause a significant reduction in the
number of "expensive" SQL SELECT queries that must be run.

Test plan:

0) Have a UNIMARC instance with some sample data (the KTD one
   will do just fine for this experiment).

1) Run the following commands:

    $ ktd --shell
   k$ DBI_PROFILE=1 ./misc/link_bibs_to_authorities.pl -t

   Observe the output from the script and the DBI profiling info.
   [You may want to play with different DBI_PROFILE levels (such as
   2, 4, 6, 8, etc.) to see what's going on under the hood DBI-wise,
   for reference see: https://metacpan.org/pod/DBI::Profile]

2) Apply this patch.

3) Rerun the script from step 1), it should run a lot faster!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit fe18b0569298502dc20ca1322d919baab5526281)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34302: (bug 28653 follow-up) Do not refresh the table if an error happened
Jonathan Druart [Thu, 27 Jul 2023 13:01:24 +0000 (15:01 +0200)]
Bug 34302: (bug 28653 follow-up) Do not refresh the table if an error happened

If checkin or renew failed, we should not refresh the table or it will
hide the error message.

Test plan:
Apply the DO NOT PUSH patch
Do a renew
=> No error in the table
Apply this patch
Do a renew
=> You see the error
Revert the DO NOT PUSH patch
Do a renew
=> The table is refreshed

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 7d80a1df25a1c4e726bcf148e1c2432ea8c9a007)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34835: Highlight logged-in library in patron searches fix for new staff interface
Fridolin Somers [Tue, 19 Sep 2023 22:20:43 +0000 (12:20 -1000)]
Bug 34835: Highlight logged-in library in patron searches fix for new staff interface

Since Bug 30952 the feature from Bug 10902 does not work anymore.
The class "currentlibrary" is there but no background color in CSS.
Bug 30952 removed it :
-    background-color: #E6FCB7;

This patch restores this rule plus '!important' that is used by
class 'ac-currentlibrary'

Test plan:
1) Perform a patrons search
2) Check you see green background color for patrons with same branch as
   currently logged in.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 9f59ea2f61a4660a9e1f5c27a2ecca33bea89b0b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34720: DBRev 23.05.03.004
Tomas Cohen Arazi [Fri, 22 Sep 2023 14:13:44 +0000 (11:13 -0300)]
Bug 34720: DBRev 23.05.03.004

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 2ff3b14e935f4ebe016ab4b1924c6cfb11064b4b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34720: Say if syspref has been inserted
Jonathan Druart [Fri, 22 Sep 2023 06:30:35 +0000 (08:30 +0200)]
Bug 34720: Say if syspref has been inserted

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit cd79c78dbdbddb6b4de548b79975bc68828c4169)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34720: Fix bug 30403 atomic update
Emmi Takkinen [Thu, 21 Sep 2023 08:49:12 +0000 (11:49 +0300)]
Bug 34720: Fix bug 30403 atomic update

Bug 30403 had wrong syspref name in its
atomic update file. This patch fixes this in
db_rev 221200018.pl and adds new atomic
update file.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit d91ea53e901a5bacfb42aa3923e37186cb41c877)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34848: (QA follow-up) Resolve warn on useless constant
Marcel de Rooy [Fri, 22 Sep 2023 08:51:59 +0000 (08:51 +0000)]
Bug 34848: (QA follow-up) Resolve warn on useless constant

Useless use of a constant ("Dies if sip user cannot be found") in void context at t/db_dependent/SIP/Message.t line 582.

We should remove the comma..

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit b07842d243bd45b0c11fa7b4d0b02c0589ee44fb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34848: Fix SIP/Message.t if DB has been upgraded
Jonathan Druart [Wed, 20 Sep 2023 14:00:08 +0000 (16:00 +0200)]
Bug 34848: Fix SIP/Message.t if DB has been upgraded

There were a lot of failures (in the context of bug 34841)

t/db_dependent/SIP/Message.t .. 2/16
    #   Failed test 'Found AH field as timestamp in response'
    #   at t/db_dependent/SIP/Message.t line 820.

    #   Failed test 'Found AH field as SQL date in response'
    #   at t/db_dependent/SIP/Message.t line 825.
    # Looks like you failed 2 tests of 8.
t/db_dependent/SIP/Message.t .. 3/16

    #   Failed test 'Desensitize flag was set for patron category not in inhouse_patron_categories'
    #   at t/db_dependent/SIP/Message.t line 1133.
    #          got: 'N'
    #     expected: 'Y'

    #   Failed test 'Desensitize flag was set for empty inhouse_patron_categories'
    #   at t/db_dependent/SIP/Message.t line 1139.
    #          got: 'N'
    #     expected: 'Y'

Because renewalsallowed is 0 for upgraded DB, when it's 5 for new
install.

We need to set the value.

This patch also adds some missing transaction

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 4fd7857e3fcc0314aba2fe851082e6e125a16650)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34843: DBRev 23.05.03.003
Tomas Cohen Arazi [Fri, 22 Sep 2023 14:12:00 +0000 (11:12 -0300)]
Bug 34843: DBRev 23.05.03.003

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit aea9fce4b0320fa57bc729042286c655580735e3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34843: Fix database comment inconsistency on toc_request
Marcel de Rooy [Fri, 22 Sep 2023 07:33:57 +0000 (07:33 +0000)]
Bug 34843: Fix database comment inconsistency on toc_request

Bug 29093 had a dbrev without comment, but added comment to
kohastructure.

Test plan:
Check (or remove) comment on article_requests.toc_request.
Run dbrev.
Check if comment was added (if you removed).
Run t/db/Koha/Database/Commenter.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f809c272af42864b48d2d650ba5ddd0cf03d6b06)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34054: Allow to embed biblio on GET /items
Jonathan Druart [Tue, 25 Apr 2023 10:06:07 +0000 (12:06 +0200)]
Bug 34054: Allow to embed biblio on GET /items

Test plan:
Request the /items REST API endpoint and ask for the biblio's info to be
embeded into the response passing x-koha-embed

curl -u koha:koha --request GET 'http://localhost:8081/api/v1/items' --header "x-koha-embed: biblio" --header "Content-Type: application/json"

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Andreas Roussos <a.roussos@dataly.gr>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 9afc411a150ab5bdf9337d73e82b2ac39e851e91)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34054: Add tests
Jonathan Druart [Mon, 19 Jun 2023 07:49:08 +0000 (09:49 +0200)]
Bug 34054: Add tests

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Andreas Roussos <a.roussos@dataly.gr>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit bd0380c272e83f7da60f24ab7205a65a693cab7d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34846: Fix SIP/ILS.t if DB has been upgraded
Jonathan Druart [Wed, 20 Sep 2023 14:13:40 +0000 (16:13 +0200)]
Bug 34846: Fix SIP/ILS.t if DB has been upgraded

t/db_dependent/SIP/ILS.t .. 12/15
    #   Failed test 'Renewal succeeded'
    #   at t/db_dependent/SIP/ILS.t line 346.
    #          got: '0'
    #     expected: '1'
    # Looks like you failed 1 test of 2.
t/db_dependent/SIP/ILS.t .. 15/15
 #   Failed test 'renew'
 #   at t/db_dependent/SIP/ILS.t line 348.
 # Looks like you failed 1 test of 15.

Because renewalsallowed is 0 for upgraded DB, when it's 5 for new
install.

We need to set the value.

Test plan:
perl /kohadevbox/misc4dev/run_tests.pl --run-db-upgrade-only

prove t/db_dependent/SIP/ILS.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5f55775f402d4f4b56ab82426588b202d6f327ce)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34844: DBRev 23.05.03.002
Tomas Cohen Arazi [Fri, 22 Sep 2023 13:43:50 +0000 (10:43 -0300)]
Bug 34844: DBRev 23.05.03.002

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit aacbadb22f21dbb427e62ee2a2b6bb2da54012a7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34844: Add db update file
Kyle M Hall [Thu, 21 Sep 2023 12:55:50 +0000 (08:55 -0400)]
Bug 34844: Add db update file

JD amended patch: tidy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 7b46b319980cd236e85e75c88e8a1428e1bb8bbb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34844: Add manage_item_editor_templates to userpermissions.sql
Kyle M Hall [Wed, 20 Sep 2023 13:31:47 +0000 (09:31 -0400)]
Bug 34844: Add manage_item_editor_templates to userpermissions.sql

Test Plan:
1) perl /kohadevbox/misc4dev/run_tests.pl --run-db-upgrade-only; prove t/Koha/Auth/Permissions.t
2) Note failure
3) Apply this patch
4) perl /kohadevbox/misc4dev/run_tests.pl --run-db-upgrade-only; prove t/Koha/Auth/Permissions.t
5) Tests pass!

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5d2f3ffe7d2dfb796a4ec7e0b4503a3266f3ee80)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34847: Fix t/db_dependent/Search.t
Jonathan Druart [Fri, 22 Sep 2023 12:33:31 +0000 (14:33 +0200)]
Bug 34847: Fix t/db_dependent/Search.t

If 01e still exists then the test will fail with
Truncated incorrect DECIMAL value: '01e' at t/db_dependent/Search.t line 945

Test plan:
% perl /kohadevbox/misc4dev/run_tests.pl --run-db-upgrade-only
% prove t/db_dependent/Search.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit ca3243d00ff094c86fcd02406543b6b3d06627ee)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34880: (follow-up) Make condition more specific
Katrin Fischer [Fri, 22 Sep 2023 08:53:23 +0000 (08:53 +0000)]
Bug 34880: (follow-up) Make condition more specific

To test (applies to both patches):

* Add a new basket as 'standing order' and with 'items created in cataloguing'
* Create an order line
* Receive shipment and create an invoice
* Receive your order
* Verify:
  * Quantity ordered: 1
  * Quantity received: 1 (pre-filled)
  * No item form on the right
* Confirm
* Receive error:
  Order X: No quantity to receive set. No items will be created.
* Verify no receive was processed (received orders remains empty)
* Apply patch
* Verify receive works as expected

Other possible combinations to test:

* Standing order, items on receive
* Standing order, items on order (no items are created)
* Standing order + order from subscription + any item setting (no items are created)
* No standing order + items in cataloguing
* No standing order + items on receive
* No standing order + items on order
* No standing oder + order from subscription + all item settings (no items are created)

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit e28ea9c4af380cae9b29b56ebe03ab0f244d2c47)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34880: Fix order receive for standing orders
Jonathan Druart [Fri, 22 Sep 2023 08:25:38 +0000 (10:25 +0200)]
Bug 34880: Fix order receive for standing orders

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 9dd6fa2d8d015b16a60bb1f1cc6bda8dba3ce662)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34730: Add responsive behavior to more tables in the OPAC
Owen Leonard [Tue, 12 Sep 2023 14:52:30 +0000 (14:52 +0000)]
Bug 34730: Add responsive behavior to more tables in the OPAC

This patch adds responsiveness to several DataTables which were not
updated in 32341. The patch removes the CSS-based responsive styling
which was previously used for these tables.

This patch also adds some additional configuration to the tables on the
user home page so that the title column is always prioritized when
DataTables collapses columns in narrow views.

To test, apply the patch and rebuild the OPAC CSS. Ideally this should
be tested with a user who has checkouts, overdues, holds, tags, and a
checkout history.

- Log in to the OPAC and test the user summary page. Check that each
  table adjusts well to narrow browser widths. In each case the column
  containing the title should never be hidden no matter how narrow the
  window:
  - Checkouts
  - Relatives' checkouts (requires that the user is a guarantor for a
    patron with checkouts and that the guarantee's account is set up to
    show checkouts to the guarantor).
  - Overdues
  - Holds
  - Article requests

The new places the responsive DataTables extension is being used:

- Checkout history
- Suggestions
- Tags (in the table of user-submitted tags)
- Most popular

Again, in each case the table should be responsive and the title column
should be prioritized so that it doesn't get hidden at narrow page
widths.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 266194321453d096a1fd1a9f80195dfb77ad5258)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34760: Confirm session ID is set to save OPAC search history to logged in user
Aleisha Amohia [Mon, 11 Sep 2023 20:47:34 +0000 (20:47 +0000)]
Bug 34760: Confirm session ID is set to save OPAC search history to logged in user

This patch confirms that a session ID has been set before trying to save search history to a logged in user on the OPAC.

This depends on EnableOpacSearchHistory system preference being enabled.

Apply the patch and test that you don't see an Error 500 page at any point through this plan:

1. Do an OPAC search, ensure you are not logged in
2. Confirm your search was saved to search history
3. Do another search, then log in
4. Confirm you are brought back to the search results after logging in
5. Confirm all search history from the session is visible

Sponsored-by: Toi Ohomai Institute of Technology
Signed-off-by: Salah Ghedda <salah.ghedda@inLibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit e7707b768ba50f2128e8efc50378ec3117962a60)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 33734: Remove incorrect URL escaping on search filters
David Cook [Wed, 13 Sep 2023 02:25:13 +0000 (02:25 +0000)]
Bug 33734: Remove incorrect URL escaping on search filters

This patch removes an incorrect URL escaping on search filter
facet URLs.

Without this patch, search filters using non-ASCII characters won't
return results.

To test:
0. Apply patch
1. Enable SavedSearchFilters syspref
2. Search for "the"
3. Save as search filter (to show on both OPAC and staff interface)
4. Search for "ü" in staff interface
5. Apply the "the" filter
6. Note that search results appear
7. Search for "ü" in OPAC
8. Apply the "the" filter
9. Note that search results appear

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 51e602e61cc5dc46188aa298f276e6410678fdf7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34732: (QA follow-up): tidy up code
Victor Grousset/tuxayo [Fri, 15 Sep 2023 18:36:38 +0000 (20:36 +0200)]
Bug 34732: (QA follow-up): tidy up code

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 703ecab2c6911175f673565249d7c0c6f13bbe56)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34732: For Code39, append or prepend asterisk if missing from barcode
David Cook [Fri, 8 Sep 2023 02:19:20 +0000 (02:19 +0000)]
Bug 34732: For Code39, append or prepend asterisk if missing from barcode

This patch appends or prepends an asterisk on Code39 barcodes if
they are missing from the input. This is so that they form correct
Code39 barcode images.

Test plan:
0. Apply the patch
1. koha-plack --reload kohadev
2. Go to http://localhost:8081/cgi-bin/koha/labels/barcode-print.pl
3. Type 39999000001310 into "Barcode" and click "Show barcode"
4. Note that the barcode text on the right includes asterisks around it
5. Type *39999000001310 into "Barcode" and click "Show barcode"
6. Note the same as above
7. Type 39999000001310* into "Barcode" and click "Show barcode"
8. Note the same as above
9. Type *39999000001310* into "Barcode" and click "Show barcode"
10. Note the same as above

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 0f888f48fa0f839aa62eda7a457ed5c6f50c5a8a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34622: Fix store default query
Pedro Amorim [Fri, 25 Aug 2023 16:26:10 +0000 (16:26 +0000)]
Bug 34622: Fix store default query

Exclude self smtp server from all the servers being updated to not default if self is_default

Signed-off-by: Émily-Rose Francoeur <emily-rose.francoeur@inLibro.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 6d54d2419f98d7d473c0a0ef888aea00be5f9eb7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 32942: (follow-up) Restore missing statuses
Martin Renvoize [Tue, 19 Sep 2023 15:37:08 +0000 (16:37 +0100)]
Bug 32942: (follow-up) Restore missing statuses

At some stage we lost some of the core statuses. This patch simply
adds them back into the list.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 4e33042105435078222aab1b72a1e7a1d0a8ff56)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 32942: (follow-up) Fix typo
Martin Renvoize [Tue, 19 Sep 2023 15:23:29 +0000 (16:23 +0100)]
Bug 32942: (follow-up) Fix typo

Spelling typo fix

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 07a602d995db1aec4067a47116cfa5d91800747f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 32942: (follow-up) Fix test
Martin Renvoize [Tue, 19 Sep 2023 15:19:53 +0000 (16:19 +0100)]
Bug 32942: (follow-up) Fix test

I missed a test case when doing follow-ups before.. this patch catches
that case and create the required authorized value to allow
ModSuggestion to succeed.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 078e98a7a35d6e5f598c51cd7c94b917f68128d1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 32942: (QA follow-up) Fix regression test
Martin Renvoize [Mon, 18 Sep 2023 11:59:50 +0000 (12:59 +0100)]
Bug 32942: (QA follow-up) Fix regression test

With the move to checking status during store, we broke the api
regression test introduced earlier in the patch set.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 8eb27c40e6fd771e8d4c2bff28cc1a45838af712)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 32942: (QA follow-up) Moving Suggestion->STATUS check to Suggestion::store
Arthur Suzuki [Fri, 18 Aug 2023 11:16:53 +0000 (13:16 +0200)]
Bug 32942: (QA follow-up) Moving Suggestion->STATUS check to Suggestion::store

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 40ca7aa06c166b005fda5b6ff38f4cbf20b3d081)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 32942: (QA follow-up) Add tests for STATUS checking in Suggestion::store
Arthur Suzuki [Fri, 18 Aug 2023 11:11:45 +0000 (13:11 +0200)]
Bug 32942: (QA follow-up) Add tests for STATUS checking in Suggestion::store

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 672e8a9d715d144812329aeb07cea5c915c50377)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 32942: (QA follow-up) Document possible values
Tomas Cohen Arazi [Mon, 13 Feb 2023 18:11:17 +0000 (15:11 -0300)]
Bug 32942: (QA follow-up) Document possible values

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 54c8aa9471e83b380e455dafe2e8cbf208cb6f36)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 32942: Suggestion API route when non 'standard' status are present
Frédéric Demians [Fri, 10 Feb 2023 17:23:11 +0000 (18:23 +0100)]
Bug 32942: Suggestion API route when non 'standard' status are present

The API route for listing all suggestion:

/api/v1/suggestions

send back an error message when there is a suugestion with non standard
status (ASKED, CHECKED, ACCEPTED, REJECTED).

This patch fixes this too restrictive restriction.

TO TEST:

1. Add a status in SUGGEST_STATUS AV list.
2. Create a suggestion, and assign it to the previsous status.
3. Call /api/v1/suggestion
3. You get an error message:
   {
    "errors": [ {
      "message":"Not in enum list: ASKED, CHECKED, ACCEPTED, REJECTED.",
      "path":"\/1\/status"
    }],
    "status":200
   }
4. Apply the patch. Call /api/v1/suggestion

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 3dc9bf900bd666eb17272060e071422a35267ada)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 32942: Regression tests
Tomas Cohen Arazi [Mon, 13 Feb 2023 14:54:07 +0000 (11:54 -0300)]
Bug 32942: Regression tests

Having a custom status shouldn't cause issues

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit e13f68965efab9b5f25daf1ec9926386fd386800)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34789: (follow-up) Fix atomic update file
Matt Blenkinsop [Tue, 19 Sep 2023 09:24:04 +0000 (09:24 +0000)]
Bug 34789: (follow-up) Fix atomic update file

Atomic update file had a versioning issue - now changed to be compatible with older versions

Please backport

(cherry picked from commit b593f6b806c8f2ec000470b9221ffcdb22aa7ac6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34694: Only check for IsAvailableForItemLevelRequest if is authenticated
Pedro Amorim [Fri, 1 Sep 2023 16:12:56 +0000 (16:12 +0000)]
Bug 34694: Only check for IsAvailableForItemLevelRequest if is authenticated

- Go to circulation rules and set On shelf holds allowed to If all unavailable
- Log out
- Visit a bib record on OPAC:
http://localhost:8080/cgi-bin/koha/opac-detail.pl?biblionumber=76
- Notice it blows up with error 500
- Apply patch. Repeat

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1742913a0522c589705c5e54ce13c6ef1c7463ea)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34740: Update sort options in ES config to by Yes/No
Nick Clemens [Thu, 7 Sep 2023 17:13:46 +0000 (17:13 +0000)]
Bug 34740: Update sort options in ES config to by Yes/No

At some point the option for 'undef' was removed from te sort options
and was collapsed to yes/no

The dropdowns when adding a new field were missed, this patch corrects that.

While undef in a mappings file wil stil load, when saving we should not privde undef any longer

To test:
1 - Browse to bottom to add a new field on the 'Bibliographic records' tab in
    Administration > Search engine configuration (Elasticsearch)
2 - Set sortable column to undef, set other columns and provide a valid field
3 - Click '+Add'
4 - Click 'Save'
5 - At top of page you receive an error:
 An error occurred when updating mappings: DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'sort' cannot be null at /kohadevbox/koha/Koha/SearchField.pm line 37 .
6 - Apply patch, restart all
7 - Add a new mapping, your only choices are Yes/No
8 - Save mapping
9 - Confirm it saves correctly

Signed-off-by: Salah Ghedda <salah.ghedda@inLibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5f6e1a1cf77dfc893de08b66840f2ea16abf1998)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 32048: Added clear cache routine to delete_holiday_range_repeatable
Laura Escamilla [Mon, 28 Aug 2023 14:20:17 +0000 (14:20 +0000)]
Bug 32048: Added clear cache routine to delete_holiday_range_repeatable

When adding and deleting holidays, holidays might return
unexpectedly.

To test:
1 - Enter a holiday repeated yearly on a range from the 1st of the month to the 5th
2 - Delete it
3 - Add a new holiday from the 20th to the 25th
4 - When saved, the holiday from the 1st to the 5th is also added again.
5 - Apply patch and restart_all.
6 - Repeat steps 1-3. Notice that the holiday from the 1st to the 5th is no longer added and it has properly been cleared from the cache.
7 - Sign off! :D

Signed-off-by: Salah Ghedda <salah.ghedda@inLibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit d4be7b10aca91a5af3e9614f465429c78a28fb13)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34728: (QA follow-up) Remove o modifier, bit more compact
Marcel de Rooy [Fri, 15 Sep 2023 07:01:24 +0000 (07:01 +0000)]
Bug 34728: (QA follow-up) Remove o modifier, bit more compact

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit bda428399aa76057f0596883d5a619a27520a7c7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34728: Make pre tag conditional
Matt Blenkinsop [Wed, 6 Sep 2023 10:50:30 +0000 (10:50 +0000)]
Bug 34728: Make pre tag conditional

This patch makes the pre-formatting of notice templates conditional on the content type.

Test plan:
1) Navigate to tools > Notices and slips
2) Edit the notice with the code of HOLD
3) Under print, paste the following
<p>Please collect within 10 days from the date of this letter and don't forget to bring your library card with you.</p>
<p>Be aware that opening hours vary at different library branches so if in doubt double check the times before you visit.</p>
<p>Should you no longer require this item please contact us so we can make it available for another customer.</p>

<p>Thank you</p>
4) Check the box that says HTML message and save the notice
5) In Patrons, select a patron and in Patron messaging preferences, check the box in the Email column for Hold filled
6) Find a record in the catalogue
7) Copy the barcode for one of the items
8) Place a hold on the item for the patron you selected
9) Navigate to Circulation > Check-in
10) Paste the barcode in the Check-in box and click Check-in
11) In the pop-up box, click Confirm hold
12) In the command line, run perl misc/cronjobs/gather_print_notices.pl --letter_code=HOLD --html /tmp
13) cd /tmp
14) There should be a file in there called 'notices_HOLD-date.html
15) cat this file
16) The html you pasted in the template will be wrapped in a <pre> tag
17) Apply patch and restart_all
18) rm the notices file that was created
19) cd /kohadevbox/koha
20) Select a new record from the catalogue and repeat steps 7-15 for this record, using the same patron
21) This time, the html file should not contain the <pre> tag
22) Sign off!

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit d947ae3c1a62a8abaabcba67d655084ecff8aa58)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34333: Add embed option for `cancellation_requested` for holds
Tomas Cohen Arazi [Thu, 20 Jul 2023 23:18:27 +0000 (20:18 -0300)]
Bug 34333: Add embed option for `cancellation_requested` for holds

This patch adds the `cancellation_requested` attribute to the hold
object definition, and allows embeding it as on the different holds
endpoints that migt be useful.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Hold.t \
           t/db_dependent/api/v1/*holds.t
=> SUCCESS: Tests pass!
3. Play with your REST tool (Postman?) on the following endpoints:
   GET http://localhost:8081/api/v1/holds
   GET http://localhost:8081/api/v1/patrons/:patron_id/holds
on both, pass and not pass the `x-koha-embed` header with
`cancellation_requested` on it.
=> SUCCESS: It is easy! You see the attribute and you don't, and the
content makes sense!
4. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 4ce7ce2a158d9c61ac176660e341b4111e76a2ca)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34333: Add Koha::Hold->cancellation_requested
Tomas Cohen Arazi [Thu, 20 Jul 2023 23:16:39 +0000 (20:16 -0300)]
Bug 34333: Add Koha::Hold->cancellation_requested

This patch adds a helper method for telling if a hold has cancellation
requests. To be used for embedding such information.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Hold.t
=> SUCCESS: Tests pass, the new method is covered by tests.
3. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 23cfdf97e379255139a6a3a73d74ee60f36aa5a2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34786: after_biblio_action hooks - No find when action is delete
Marcel de Rooy [Thu, 14 Sep 2023 09:11:56 +0000 (09:11 +0000)]
Bug 34786: after_biblio_action hooks - No find when action is delete

Test plan:
Run t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit ac7581e90a79961a4de915f0592834eb9f2611c5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34613: Replace onclick attributes in midiplayer.js
David Cook [Fri, 25 Aug 2023 01:26:01 +0000 (01:26 +0000)]
Bug 34613: Replace onclick attributes in midiplayer.js

This patch replaces the onclick attributes in midiplayer.js
with Javascript click handlers.

To test:
0. Apply patch
1. Clear browser cache (it may be necessary to go into the
   Network tab and explicitly disable cache)
2. Add 031 subfields 2gopnu to Default framework
3. Create a catalogue record with a 031 like follows:
2: pe
g: G-2
o: 4/4
p: 4bB''C2bE/2F4GbB/'bB2''C4D/F2.bE/4GG2bB/4'''C2C4''bB/4bE2G4bB/4bE2.F/
n: xFCGD
4. Enable the following sysprefs:
   OPACShowMusicalInscripts
   OPACPlayMusicalInscripts
5. Go to OPAC record view and click "Play this sample"
6. Play with the "Pause/Start" and "Stop" buttons
7. If the buttons work, it means the patch worked

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit a4bdd27fd9d953a8ae086a6f3e8b7960f9b7160b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 33876: Add class for styling
Lucas Gass [Wed, 31 May 2023 22:38:50 +0000 (22:38 +0000)]
Bug 33876: Add class for styling

To test:
1. Checkout and item that has a public and nonpublic note.
2. In the checkout table ( Title column ) notice the notes display. If you use the browser dev tools to inspect you'll notice a "-" outside of any HTML element.
3. Apply patch.
4. See the '-' is now inside of a html element with class of seperator.

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 6091a938c1c148cbeab6ff27f5261c6fe64d1463)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34552: Don't exclude payments with no status
Nick Clemens [Fri, 25 Aug 2023 15:51:12 +0000 (15:51 +0000)]
Bug 34552: Don't exclude payments with no status

Bug 29664 removed payments with a void status, however, the query also
removed any payments with no status set

Test Plan:
1 - Set up your cash registers and enable POS and add a debit type that is able to be sold
2 - Take 2 payments via POS
3 - Void one payment
4 - Go to Reports->Statistics wizards->Cash register
4) Verify neither shows for the "All payments to the library" and
   "Payment" transaction type filters
5) Apply this patch
6) Restart all the things!
7) Verify the non-voided fee shows for the "All payments to the library" and
   "Payment" transaction type filters and the voided fee does not

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 6ee6bea6bfee301146dc2f631480b227d237e43a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34711: Remove use of onclick for opac-privacy.pl
David Cook [Tue, 5 Sep 2023 04:58:52 +0000 (04:58 +0000)]
Bug 34711: Remove use of onclick for opac-privacy.pl

This change removes the "onclick" attribute for the buttons
on opac-privacy.pl.

Note: The Javascript is placed in a separate file, which is
the preferred way for Javascript to be handled by
Content-Security-Policy

Test plan:
0. Apply the patch
1. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACPrivacy
2. Set syspref to "Allow"
3. Go to http://localhost:8080/cgi-bin/koha/opac-privacy.pl
4. The confirmation modal appears and "OK" and "Cancel" buttons work as
   expected

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit c997fe863f70fa951c71dca73296ed1f497aeca7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34724: (QA follow-up):
Pedro Amorim [Fri, 8 Sep 2023 16:01:03 +0000 (16:01 +0000)]
Bug 34724: (QA follow-up):

Replace href from thumbnail link with a # to keep pointer event. The href link gets reconstructed by showCover anyway
Remove return false from on click event, its not triggering a location change anymore because of the above
Remove check for imagenumber, its a non-null primary key, if the image exists, then the imagenumber must also exist

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit bc8a0620012a79567c44d863c029a4b0025a2fbd)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34724: Remove inline onclick handler for opac-imageviewer.pl
David Cook [Wed, 6 Sep 2023 06:40:21 +0000 (06:40 +0000)]
Bug 34724: Remove inline onclick handler for opac-imageviewer.pl

This patch moves the click handler for thumbnails for opac-imageviewer.pl
out of the inline HTML and out to an existing <script> element.

Test plan:
0. Apply the patch (including dependent patches)
1. Go to
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=localcover
2. Change both *LocalCoverImages sysprefs to "Show"
3. Go to
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=AllowMultipleCovers
4. Change "AllowMultipleCovers" to "Allow"
5. Go to
http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=29
6. Click "Images (0)" tab
7. Download or make two JPEG images
8. Upload the images
9. Go to http://localhost:8080/cgi-bin/koha/opac-imageviewer.pl?biblionumber=29
10. See one large image in the centre and two smaller thumbnails on the right side
11. Click on the thumbnail of the image that isn't displayed in the centre
12. Note that the image changes
13. Click the other thumbnail and note that the image changes back

PA amended patch: Added missing test plan step

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 847b5f0777c51a56100108ac44351de8a81660e0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34725: Remove use of onclick for OPAC cart
David Cook [Wed, 6 Sep 2023 06:57:15 +0000 (06:57 +0000)]
Bug 34725: Remove use of onclick for OPAC cart

This patch moves the click handler in the OPAC cart from the inline HTML
and out to an existing <script> element.

Test plan:
0. Apply the patch
1. Go to http://localhost:8080/cgi-bin/koha/opac-search.pl?idx=&q=test&weight_search=1
2. Add the results to the cart
3. Click on the "Cart"
4. One by one click on the title of each row
5. Notice how the parent window changes to the detail record for that title

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 9e39d2d67135186b2202d42004b31f9fcfa9eb58)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34789: DBRev 23.05.03.001
Tomas Cohen Arazi [Mon, 18 Sep 2023 14:56:35 +0000 (11:56 -0300)]
Bug 34789: DBRev 23.05.03.001

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit b952d2eb9922ed1afc5c52a2706290f94bb83e03)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34789: (QA follow-up) Improve output of database update
Katrin Fischer [Sun, 17 Sep 2023 13:18:49 +0000 (13:18 +0000)]
Bug 34789: (QA follow-up) Improve output of database update

* Adds description
* Adds column names to success messages

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit c1b344b002b3ff2471c72f18a9746f71f7900978)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34789: Update unit tests
Matt Blenkinsop [Thu, 14 Sep 2023 12:27:20 +0000 (12:27 +0000)]
Bug 34789: Update unit tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 4ec7c6a62ec12abe1ea092e0fbbdcc6e7ecee110)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34789: Update usage throughout Koha modules and Vue components
Matt Blenkinsop [Thu, 14 Sep 2023 12:26:53 +0000 (12:26 +0000)]
Bug 34789: Update usage throughout Koha modules and Vue components

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 7d2ce611f71958d31b6b3592e305bea415e50ef5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34789: DBIC file
Matt Blenkinsop [Thu, 14 Sep 2023 12:25:21 +0000 (12:25 +0000)]
Bug 34789: DBIC file

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 6989d25df7dcb1bc1f4a9b2897b107c38a583053)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34789: Database and API update
Matt Blenkinsop [Thu, 14 Sep 2023 12:23:49 +0000 (12:23 +0000)]
Bug 34789: Database and API update

Currently the erm_eholdings_titles table has a field called preceeding_publication_title_id. This should be preceding_publication_title_id

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit cf94eae1ff89d1c99604dd68429c77f7247aa9a7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 33406: (follow-up) Mock SearchEngine to ensure using ES
Nick Clemens [Mon, 18 Sep 2023 13:24:53 +0000 (13:24 +0000)]
Bug 33406: (follow-up) Mock SearchEngine to ensure using ES

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 766bdd638acbf8870c3f6eb21d03d8195040e54f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34719: Add middle_name to patron autocomplete
Lucas Gass [Thu, 7 Sep 2023 21:19:26 +0000 (21:19 +0000)]
Bug 34719: Add middle_name to patron autocomplete

To test:
1. Apply patch and clear browser cache.
2. Find some patrons with middle_name populated or add new patrons with a middle_name.
3. Make sure PatronAutoComplete is on
4. Try searching for a part of one of the patron's names who has a middle_name.
5. It should appear in the autocomplete dropdown

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit a6c77f664c6b21b3d7c9ee4590a8b8b21a18a9b2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 33406: (QA follow-up) Adjust tests and tidy
Nick Clemens [Thu, 14 Sep 2023 13:21:44 +0000 (13:21 +0000)]
Bug 33406: (QA follow-up) Adjust tests and tidy

Rather than test that nothing is returned, we want to test that the terms are filtered as expected. This also avoids the possibility of the tests failing in a db where there is a record for Donald Duck

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 3d7b60dc90142b171b6aaa268bdf2abf917b3739)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 33406: Filter out some known isolated trouble makers
Janusz Kaczmarek [Tue, 8 Aug 2023 08:41:53 +0000 (08:41 +0000)]
Bug 33406: Filter out some known isolated trouble makers

Test plan:
1) Launch k-t-d with ES:
-- ktd --es7 pull
-- ktd --es7 up
2) Visit /cgi-bin/koha/authorities/authorities-home.pl and search for 'tim'
3) Edit that, add a dash '-' to 100$a, like 'Bunce, Tim - name'"
4) Do a authority search for 'tim - name', notice it errors out
5) Apply patch
6) Perform the same search, notice it doesn't error and returns the correct record

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 27c6171222bf3abb5ed91e399bb2663579e8e367)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 33406: Handle ES search errors for authorities
Jonathan Druart [Thu, 11 May 2023 10:38:53 +0000 (12:38 +0200)]
Bug 33406: Handle ES search errors for authorities

We are dealing ok with ES exceptions for biblio records search,
catching them and raising them to the end user. But we don't for
authorities, where we explode with an ugly 500.

Test plan:
Search for "(term_1*) AND (-) AND (term_2*)" in the authority search and
notice that you don't get a 500 but an error instead saying that you
should try again

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 09b29d06da5fac2bd1315d849f1b9bf924576700)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 33406: Add tests
Pedro Amorim [Mon, 4 Sep 2023 12:28:29 +0000 (12:28 +0000)]
Bug 33406: Add tests

Test plan:
1) Apply this tests patch only
2) Run: prove t/Koha/SearchEngine/ElasticSearch/Search.t
3) Notice it fails with nasty ES "Failed to parse query" error
4) Apply the other patches
5) Repeat 2) - notice theres no nasty error

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit fbd62562e0d67d22738435e44adf9f03900a147e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34589: Only update users if permission is added
Nick Clemens [Tue, 22 Aug 2023 15:09:17 +0000 (15:09 +0000)]
Bug 34589: Only update users if permission is added

To test:
1 - Assign a user 'edit_items' permission
2 - Manually run the update
    perl -e 'use C4::Installer; warn Data::Dumper::Dumper(C4::Installer::run_db_rev("installer/data/mysql/db_revs/221200003.pl"));'
3 - Edit patron permissions
4 - Note they now have edit_any_item permission
5 - Remove that permission
6 - Run the update again
7 - Edit patron permissions
8 - They have edit_any_item again - remove it
9 - Apply patch
10 - Run the update
11 - Edit patron permissions
12 - No new permissions added!
13 - sudo koha-mysql kohadev
     DELETE FROM permissions WHERE code = 'edit_any_item'
14 - Run the update again
15 - Edit patron permissions
16 - They do have edit_any_item

Signed-off-by: Émily-Rose Francoeur <emily-rose.francoeur@inLibro.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 2bdfe69df80d2028563eda175d6f9a0db4d0b19d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34787: Fix typo gorup
Marcel de Rooy [Thu, 14 Sep 2023 09:31:00 +0000 (09:31 +0000)]
Bug 34787: Fix typo gorup

No test plan (fixing comment).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5797079fc5e5b1e9a4d883f0ceb5a344b8cdbd36)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34743: Fix POD description
Matt Blenkinsop [Fri, 8 Sep 2023 11:04:56 +0000 (11:04 +0000)]
Bug 34743: Fix POD description

Currently --expiration-from-today has the same definition as --update-expiration. The description has now been updated to reflect the fact that it will set the date from today, and not the patron's enrollment date

Test plan:
Look at the patch file and confirm that the POD now mentions today's date rather than the patron's enrollment date

Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 91dd8dd16f11f721d109f240eb9928b7383f9b15)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34656: (QA follow-up) perltidy
Emily Lamancusa [Thu, 31 Aug 2023 14:52:52 +0000 (10:52 -0400)]
Bug 34656: (QA follow-up) perltidy

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 4988bcdb93008b44e2ce0517c0441f08c61958b2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34656: Do not update real Time Holds Queue when moving from cart to shelf
Nick Clemens [Wed, 30 Aug 2023 13:46:52 +0000 (13:46 +0000)]
Bug 34656: Do not update real Time Holds Queue when moving from cart to shelf

To test:
1 - Enable RealTimeHoldsQueue system preference
2 - Set UpdateItemLocationOnCheckin to _ALL_: CART
3 - Check in an item
4 - Check the background jobs - the RTHQ is updated
5 - perl -e 'use C4::Items; C4::Items::CartToShelf(##);' -- substitute the itemnumber from above
6 - Check the background jobs - no new update to RTHQ
7 - Confirm item was set back to correct permanent_location

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 84521918d93878ffa314decc4eb3b67afe46dca3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34656: Unit test
Nick Clemens [Wed, 30 Aug 2023 13:46:17 +0000 (13:46 +0000)]
Bug 34656: Unit test

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit aff84104127552fe5f5e4394f84b501dafcbc497)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34767: Pass fee_ack into ::Transaction::Renew(All)
Martin Renvoize [Tue, 12 Sep 2023 15:24:19 +0000 (16:24 +0100)]
Bug 34767: Pass fee_ack into ::Transaction::Renew(All)

This patch copies the $fee_ack field into the generated
::Transaction::Renew|All objects such that the fee acknowldegement flag
is respected for renewals.

Test plan
To test:
1) Add a rental charge to an itemtype
2) Checkout an item of that itemtype to a user
3) Attempt a renewal of that item via SIP2 and note that it fails
   sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --patron 23529000035676 --item 39999000007756 -m renew
4) Pass the fee_acknowledgement bit in renewal and note the renewal
   still fails.
   sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged Y --patron 23529000035676 --item 39999000007756 -m renew
5) Apply patch and note the above now succeeds
   sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged Y --patron 23529000035676 --item 39999000007756 -m renew

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 3a2dcf0733733a92ddbf46fb863434a46060e279)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34768: Remove checkbox column from relatives fines on OPAC
Nick Clemens [Tue, 12 Sep 2023 15:28:34 +0000 (15:28 +0000)]
Bug 34768: Remove checkbox column from relatives fines on OPAC

When a patron has a guarantee and can see their fines on the opac and
an opac payment plugin is enabled there is an error on the 'Charges'
tab.

The table uses a 'COLSPAN' variable which is set to 5 or 6 depending on
if OPAC payments are enabled. The guarantees table has one less column
than the patron's however, so it is going out of range and causing a JS
error. Additionally, we are adding a column to the child's table which
is not used as their fines cannot be selected for payment at this time.

This patch removes the checkbox column and sets the colspan directly to
4

I also fix an issue where the table is not being set as we need to
reference the patron object in the guarantor info to obtain the id.

To test:
1 - Set system preference: AllowStaffToSetFinesVisibilityForGuarantor to
    allow
2 - Find a patron
3 - Add some fines to their account
4 - Install and enable an opac payment plugin
    (https://github.com/bywatersolutions/koha-plugin-pay-via-govolution
    for example)
5 - Sign in to OPAC as borrower
6 - Go to 'Charges' tab
7 - Select a fee
8 - Confirm 'Make payment' button enabled and 'amount to pay' is
    updated
9 - Add a guarantee to patron in staff interface
10 - Set 'Show charges to guarantors' to 'Yes'
11 - Add and pay a fine for the child
12 - View guarantor account on the OPAC
13 - Confirm you now see child's charges
14 - Confirm selecting your own fees does not enable the button or
     update amount to pay
15 - Note JS error in console
16 - Apply patch
17 - Reload patrons page
18 - Confirm the table loads correctly (no JS error)
19 - Confirm selecting a fine updates the total and enables button
20 - Disable the payment plugin
21 - Confirm the display is still correct, no errors

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit a3e40408ea6792186e87e95a7de1dff515981432)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34764: Set fee_acknowledged to expect a string
Martin Renvoize [Tue, 12 Sep 2023 13:18:37 +0000 (14:18 +0100)]
Bug 34764: Set fee_acknowledged to expect a string

For consistency with other options I opted to have the fee acknowledged
parameter to expect a string and as it's an optional parameter I've
dropped the default value of 'N' too.

Test plan
1) Prior to this patch
1a) Attempt a checkout without passing -fa/--fee_acknowledged flag
    `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --patron 23529000035676 --item 39999000007756 -m checkout`
    The final field of the SIP request will be '|BON', the default
1b) Attempt a checkout passing -fa/--fee_acknowledged flag
    `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged --patron 23529000035676 --item 39999000007756 -m checkout`
    The final field of the SIP request will still be '|BON', failure
1c) Attempt a checkout passing a string for fee_acknoewledeged flag
    `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged Y --patron 23529000035676 --item 39999000007756 -m checkout`
    The final field of the SIP request will still be '|BON', failure
2) Apply the patch
2a) Attempt a checkout without passing -fa/--fee_acknowledged flag
    `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --patron 23529000035676 --item 39999000007756 -m checkout`
    The optional `|BO` element should not be present
2b) Attempt a checkout passing -fa/--fee_acknowledged flag
    `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged N --patron 23529000035676 --item 39999000007756 -m checkout`
    The final field of the SIP request will now be '|BON', success
2c) Attempt a checkout passing a string for fee_acknoewledeged flag
    `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged Y --patron 23529000035676 --item 39999000007756 -m checkout`
    The final field of the SIP request will now be '|BOY', success

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 0e9603bb49436e4bb74e893f74a63ef31065f798)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34736: Don't trigger quantity change on loading order
Nick Clemens [Thu, 7 Sep 2023 19:02:08 +0000 (19:02 +0000)]
Bug 34736: Don't trigger quantity change on loading order

We have a change event to automatically check or uncheck the first items on a list when
the value is changed directly.

The code is calling this when setting the quantity when loading an order, but this is causing a problem
in that we are setting the quantity to load.switch orders and triggering the checkboxes wrongly

To test:
 1 - Create a new basket, create items on placing the order
 2 - Create an order line with 4 items
 3 - Create another order line with 2 items
 4 - Close the basket
 5 - Receive shipment and create an invoice
 6 - Select both orders via the checkboxes got multi-receive
 7 - Click "receive selected"
 8 - Edit first order line, quantity received = 1 (1 out of 4)
 9 - Verify that one item is also selected in the table
10 - Switch to "next order"
11 - Quantity received is 0, no items checked in the second order
12 - Switch to "Previous order"
13 - ERROR: Item checkbox was lost, quantity received still correct
14 - Switch to next order
15 - ERROR: item is now checked, quantity received 0
16 - Note: We see a mix up of the information entered, one has the checkbox now, the other the quantity.
17 - Save changes
18 - Click confirm
19 - Continue (complaint about the second order left unchanged)
20 - You are back on the summary:
     * pending order: quantity changed from 4 to 3 - correct
     * received order: quantity shows 1 - correct
21 - Click on receive for your updated order line (with 3 items)
     * 4 items show to be received (should be 3)
22 - Apply patch
23 - Cancel receipt of items
24 - Repeat 1-12
25 - Items are loaded correctly
26 - Try with various checkboxes and switch back and forth
27 - Confirm that manually adjusting quantity received checks the first n boxes
28 - Confirm setting quantity to 0 unchecks the boxes

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 08858b161c597b329d21815f8ae0d787e71d7e2e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34532: Silence warns in Patroncard.pm
Lucas Gass [Mon, 14 Aug 2023 21:11:52 +0000 (21:11 +0000)]
Bug 34532: Silence warns in Patroncard.pm

To test:

1. Go to patron card creator and make a patron card batch, card layout, and card template.
2. In the card layout leave some values blank for Lower left X coordinate and Lower left Y coordinate.
3. Now go create a card batch while tailing the plack-intranet-error log/
4. Notice in the logs:

[2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 109.
[2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 248.
[2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 249.

5. Apply patch, restart_all
6. Try again and notice the WARNS should be gone from the logs now.
7. Make sure you can still create patron cards and the PDF's the generate look right.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1164402b49bfb775a7aafab55b629ae443bddf1c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34502: Remove useless SEARCH_RESULT.localimage
David Cook [Wed, 9 Aug 2023 01:06:05 +0000 (01:06 +0000)]
Bug 34502: Remove useless SEARCH_RESULT.localimage

This patch removes a useless Template Toolkit tag.

To test:
0. Apply the patch
1. Go to
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=LocalCoverImages
2. Change to "Show"
3. Go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=29
4. Upload an image
5. Go to http://localhost:8081/cgi-bin/koha/catalogue/search.pl?q=test
6. Note that the local cover image appears even without the TT tag

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 9da5895d79163a518825fbb102526aef119a93fe)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 32765: Retry transfer after cancelling hold
Julian Maurice [Tue, 31 Jan 2023 08:20:15 +0000 (09:20 +0100)]
Bug 32765: Retry transfer after cancelling hold

When trying to manually transfer an item that is on hold, we have the
choice to cancel the hold and try the transfer again. When choosing
this option, the hold is correctly cancelled but the transfer is not
tried again.
This patch fixes that

Test plan:
1. Place a hold on a specific item
2. Try to transfer it manually (Circulation » Transfer)
3. Choose the option to "Cancel hold and then attempt transfer"
4. See that the hold was cancelled, but no transfer was made
5. Apply the patch
6. Repeat step 1-3
7. See that the hold was cancelled, and the transfer was made

Signed-off-by: Nicolas Giraud <nicolas.giraud@inlibro.com>
Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 68b97cc7e4c60e6b84b9a7554e29c1c32453f685)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34223: (follow-up) Ensure consistent ordering of statuses
Martin Renvoize [Mon, 11 Sep 2023 13:50:43 +0000 (14:50 +0100)]
Bug 34223: (follow-up) Ensure consistent ordering of statuses

This patch adds an order_by clause to ensure consistent ordering of the
returned status and status_alias statuses from the database between
MySQL 8 and other DB engines.

This fixes the failing tests introducd in bug 34223.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 7f9ff906d9c2800fc5bf3d38db23a77e1f3745ab)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34572: Simplify template logic around check-in input form
Owen Leonard [Fri, 18 Aug 2023 07:40:16 +0000 (07:40 +0000)]
Bug 34572: Simplify template logic around check-in input form

This patch makes a minor simplifying change to the check-in template
around how to style the barcode input field in dropbox or fine-exempt
mode.

To test, apply the patch and go to Circulation.

- If necessary, check some items out to patrons so that you have items
  to check in.
- Go to the check-in page and click the icon inside the barcode field to
  expand the panel of options.
- Check the "book drop mode" checkbox. The barcode field should now be
  highlighted yellow.
- Check in an item. When the page redisplays, the barcode field should
  have the same highlighted style.

- If necessary, enable the finesMode system preference.
- On the check-in page, in the panel of options, check the "Forgive
  overdue fines" checkbox. Test checking in again, confirming the same
  style consistency in the barcode field.

Signed-off-by: Inkeri <inkeri.hakulinen@helsinki.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit edb9787fc85752c636e0d982871c4b715a2e57d8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34723: Show thumbnails on opac-imageviewer.pl when imagenumber not provided
David Cook [Wed, 6 Sep 2023 06:28:45 +0000 (06:28 +0000)]
Bug 34723: Show thumbnails on opac-imageviewer.pl when imagenumber not provided

This patch fixes a method call in the opac-imageviewer.pl so that thumbnails
correctly appear.

Test plan:
0. Apply the patch
1. Go to
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=localcover
2. Change both *LocalCoverImages sysprefs to "Show"
3. Go to
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=AllowMultipleCovers
4. Change "AllowMultipleCovers" to "Allow"
5. Go to
http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=29
6. Click "Images (0)" tab
7. Download or make two JPEG images
8. Upload the images
9. Go to http://localhost:8080/cgi-bin/koha/opac-imageviewer.pl?biblionumber=29
10. See one large image in the centre and two smaller thumbnails on the right side

PA amended patch: Added missing test plan step

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 00edf9a541c6d512682f19db7120c808d60a4bf2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34079: The phrase "Displaying [all|approved|pending|rejected] terms" was separated
Caroline Cyr La Rose [Wed, 21 Jun 2023 14:59:47 +0000 (10:59 -0400)]
Bug 34079: The phrase "Displaying [all|approved|pending|rejected] terms" was separated

This patch reunites the words for the sentence "Displaying
[all|approved|pending|rejected] terms" in order to facilitate
translating in languages that have a different syntax.

To test:
1. Install a new language

   ./misc/translator/translate install xx-XX

2. Check the xx-XX-staff-prog.po file for the sentence
   --> All the words are individual strings

3. Apply patch

4. Update the po files

   ./misc/translator/translate update xx-XX

5. Check the xx-XX-staff-prog.po file again
   --> The sentence is reunited for each status (Displaying all terms,
       Displaying approved terms, etc.)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 272a080cb35fe83e9f11ab8401effb7223f5d94c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34081: Contextualization of "Approved" (one term) vs "Approved" (more than one...
Caroline Cyr La Rose [Wed, 21 Jun 2023 16:27:12 +0000 (12:27 -0400)]
Bug 34081: Contextualization of "Approved" (one term) vs "Approved" (more than one term), and other tag statuses

To test:

1. Apply patch

2. Install language

   ./misc/translator/translate install xx-XX

3. Update po files

   ./misc/translator/translate update xx-XX

4. View the xx-XX-messages.po file

   --> Strings for tag statuses for one tag should be separated from
       strings for statuses for multiple tags, with context Tags
       (single) or Tags (multiple)

5. Change the strings so you know which is which

   For example, in French, the approved status for a single tag would
   be "Approuvé" and for multiple tags would be "Approuvés" (with the
   plural s at the end)

6. Apply translations

   ./misc/translator/translate install xx-XX

7. Add tags through the OPAC
   7.1. In another tab, go to the OPAC
   7.2. Log in
   7.3. Search for a record
   7.4. From the detailed record, click Add tags
   7.5. Enter a tag and click Add

8. In the staff interface, go to Tools > Tags

9. Approve/Reject the tag
   --> The status in the table and on the button should be the singular
       status, the status in the summary on the right should be plural

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5d23be933f958bf4b3343c41802530088afc0b1d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34257: (QA follow-up): tidy up code
Victor Grousset/tuxayo [Sun, 3 Sep 2023 23:06:23 +0000 (01:06 +0200)]
Bug 34257: (QA follow-up): tidy up code

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 9254af7b41349d563d526a0eeac946464dfef7b4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34257: Limit item types by branch in batchMod.pl
Lucas Gass [Fri, 18 Aug 2023 14:45:14 +0000 (14:45 +0000)]
Bug 34257: Limit item types by branch in batchMod.pl

To test:
1. Go to Item types administration.
2. Set some items types to be limited to a branch you are not logged in as.
3. Find some items from the branch you are logged in at and go to Batch item modification.
4. Add the barcodes and attempt to edit the item type to the one you limited in step 2.
5. You can change these item types to ones that your branch should not be able to.
6. Apply patch
7. Try steps 4 -5 again but this time you should not see item types in the dropdown that are limited to other branches.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 13d5ff94248df32623853ed2d87258f81edc0a8f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
8 months agoBug 34402: Sorting holds on patron account includes articles
Owen Leonard [Wed, 26 Jul 2023 12:25:11 +0000 (12:25 +0000)]
Bug 34402: Sorting holds on patron account includes articles

This patch adds some configuration to the table of holds shown on the
checkout and patron detail pages so that sorting by title correctly
excludes articles.

To test, apply the patch and clear your browser cache.

- Check out to a patron who has multiple holds on titles which include
  leading articles like "a" "an" and "the."
- Click the holds tab and click the "title" column to sort by title.
  - The titles should be correctly sorted alphabetically while ignoring
    articles.

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 365121cae2d4df41333d4e2144acfe8c8a82b9a9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>