koha.git
20 months agoBug 30359: Unit tests
Nick Clemens [Thu, 25 Aug 2022 11:18:18 +0000 (11:18 +0000)]
Bug 30359: Unit tests

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit b1e3398e84674f443d1b3c348058e45291f45e8e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 30359: GetBudgetHierarchy is slow on order receive page
Johanna Raisa [Fri, 25 Mar 2022 10:25:56 +0000 (12:25 +0200)]
Bug 30359: GetBudgetHierarchy is slow on order receive page

This patch adds skiptotals parameter to GetBudgetHierarchy so calculating
totals can be skipped from some pages.

Test plan:
1) Open browser's Inspect -> Network
2) Go to receive orders
3) Check the timings for page load
4) Apply the patch
5) Refresh the page
6) Check the timings again
7) prove t/db_dependent/Budgets.t

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 35724169c11352d4cc1e22fcd50e91d39b7d8c44)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31342: Add execution locking to process_message_queue.pl
Tomas Cohen Arazi [Fri, 12 Aug 2022 09:50:59 +0000 (06:50 -0300)]
Bug 31342: Add execution locking to process_message_queue.pl

This patch makes the script use an execution lock as provided by
Koha::Script. Previous attempt got too complex and contentious, and
given we have a simple way to achieve the same thing, I decided to
submit an alternative approach.

To test:
1. Apply this patch
2. Add the following content to misc/cronjobs/process_message_queue.pl
   on line 83:

  sleep 100;

3. Save the file
4. Have two terminals open
5. On the first one, run:
   $ kshell
  k$ misc/cronjobs/process_message_queue.pl
6. On the second one, run the same
=> SUCCESS: The second one dies telling it had to skip the run
7. Undo your changes:
   $ git checkout misc/cronjobs/process_message_queue.pl
8. Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Liz Rea <liz@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit a80a96b93381a12740b8548b5d92a55bbec0b085)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31531: Remove unnecessary use directives on opac-memberentry.pl
David Cook [Thu, 8 Sep 2022 03:06:59 +0000 (03:06 +0000)]
Bug 31531: Remove unnecessary use directives on opac-memberentry.pl

This patch just removes two redundant use directives in opac-memberentry.pl

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 6c893f7372b6a080435bd493730530c7f275cd06)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31299: Fix duplicate output in search_for_data_inconsistencies.pl
Fridolin Somers [Fri, 5 Aug 2022 18:36:50 +0000 (08:36 -1000)]
Bug 31299: Fix duplicate output in search_for_data_inconsistencies.pl

In search_for_data_inconsistencies.pl when there are several inconsistencies on same framework, the second output of items contains the first one.

Looks like it is since Bug 21466

Test plan using koha-testing-docker :
1) Create 2 inconsistencies on the same item via SQL :
   update items set itemlost = 9 where itemnumber=900;
   update items set notforloan = 8 where itemnumber=900;
2) Without patch
3) Run ./misc/maintenance/search_for_data_inconsistencies.pl
=> You see duplicate output :
== Wrong values linked to authorised values ==
* The Framework *BKS* is using the authorised value's category *NOT_LOAN*, but the following items.notforloan do not have a value defined ({itemnumber => value }):
 {900 => 8}
* The Framework *BKS* is using the authorised value's category *LOST*, but the following items.itemlost do not have a value defined ({itemnumber => value }):
 {900 => 8} {900 => 9}

4) Apply patch
5) Run ./misc/maintenance/search_for_data_inconsistencies.pl
=> Fixed :D
== Wrong values linked to authorised values ==
* The Framework *BKS* is using the authorised value's category *LOST*, but the following items.itemlost do not have a value defined ({itemnumber => value }):
 {900 => 9}
* The Framework *BKS* is using the authorised value's category *NOT_LOAN*, but the following items.notforloan do not have a value defined ({itemnumber => value }):
 {900 => 8}

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 3d0015fe6932f2fed3aba79b1fc99ecb6d1d3504)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31558: Fix image drag and drop in TinyMCE
Fridolin Somers [Tue, 13 Sep 2022 20:27:39 +0000 (10:27 -1000)]
Bug 31558: Fix image drag and drop in TinyMCE

Bug 26949 upgraded JS lib TinyMCE to 5.9.2

This version has a known issue on images drag and drop :
https://stackoverflow.com/questions/64782955/tinymce-inline-drag-and-drop-image-upload-not-working

Test plan :
1) Go to Tools > HTML customizations
2) Create a new entry (not using text editor)
3) Drag and drop an image
=> Without patch you see an error message from TinyMCE 'Dropped file type is not supported'
=> With patch : It works !

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit d0f09eaa6412eb83ebe7e17faa550628fa7e6cab)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 28553: (QA follow-up) default to auto renew email when cron switched used
David Cook [Tue, 13 Sep 2022 06:46:46 +0000 (06:46 +0000)]
Bug 28553: (QA follow-up) default to auto renew email when cron switched used

This patch defaults to using "email" rather than "sms" notices
when AutoRenewalNotices is set to use the --send-notices cron switch

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 88f63e01d29917e9323c57be97aaa91b9e00fd92)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 28553: Patrons can be set to receive auto_renew notices as SMS, but Koha does...
Kyle M Hall [Mon, 18 Jul 2022 16:37:48 +0000 (12:37 -0400)]
Bug 28553: Patrons can be set to receive auto_renew notices as SMS, but Koha does not generate them

Following bug 18532, one can set a patron's messaging prefs to deliver an auto-renew notice via SMS.
However, the auto_renewals cron only knows how to generate email notices. We should not allow the selection of non-functional transport types.

Test Plan:
 1 - Set pref AutoRenewalNotices - 'according to patron messaging preferences'
 2 - Set circ rule with:
    Loan period: 5 days
    No renewal before: 5
    AutoRenewal: Yes
    Renewals allowed: 5
 3 - Set SMS Send driver to Email
 4 - Find a patron and set them to receive auto renewal notices via SMS and no other transport
 5 - Provide a proivder and sms number for the patron
 6 - Checkout an item to the patron, set due date to yesterday
 7 - Run auto renewals:
    perl misc/cronjobs/automatic_renewals.pl -v --send-notices -c
 8 - Item renewed, no message sent
 9 - Check in item, checkout again due yesterday
10 - Apply patch
11 - Browse to Tools->notices and slips
12 - Edit AUTO_RENEWALS and AUTO_RENEWALS_DIGEST to copy email template to sms and add a title
13 - perl misc/cronjobs/automatic_renewals.pl -v --send-notices -c
14 - Item renewed, confirm patron has a notice in their account
15 - Check the digest option, check in item, checkout again as due, repeat cronjob and note digest notic
16 - sign off

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit fef29151e0dd6287f8e4e49effc9d9666bf87582)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31239: (QA follow-up) Fixing ternary formatting
Marcel de Rooy [Fri, 16 Sep 2022 09:41:59 +0000 (09:41 +0000)]
Bug 31239: (QA follow-up) Fixing ternary formatting

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 4481817701f0789f407f8bdfdcaeeb49c5239e5e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31239: Fix incorrect AV linked to a mapped biblio column
Jonathan Druart [Wed, 10 Aug 2022 09:12:06 +0000 (11:12 +0200)]
Bug 31239: Fix incorrect AV linked to a mapped biblio column

If an AV is linked to a MARC field mapped with a biblio column, the
search_for_data_inconsistencies.pl script might explode with

The method Koha::Biblioitem->title is not covered by tests!

Trace begun at /kohadevbox/koha/Koha/Object.pm line 875
Koha::Object::AUTOLOAD('Koha::Biblioitem=HASH(0x556b67fa7168)') called at misc/maintenance/search_for_data_inconsistencies.pl line 246

Test plan:
For a given framework, pick a biblio using it
Link 245$a with an authorised value category
Run the script
=> Notice that with this script applied you will see the warning
=> Without this patch you got the error

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 54711942f1b34fc9d94a61f42734525a03db893a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31154: Avoid unecessary loop
Jonathan Druart [Mon, 17 Oct 2022 14:00:25 +0000 (16:00 +0200)]
Bug 31154: Avoid unecessary loop

We don't need to loop over the subfield and enter this block if there is
no record.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit b582f7d495fceda68a7972f7eab0d4e5d16bdcdf)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31154: Add test
Jonathan Druart [Mon, 17 Oct 2022 13:59:52 +0000 (15:59 +0200)]
Bug 31154: Add test

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit edf8640cff4c929196d1768152a705fb350317a0)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31154: (QA follow-up) Fix UI form builder
Marcel de Rooy [Fri, 16 Sep 2022 08:58:51 +0000 (08:58 +0000)]
Bug 31154: (QA follow-up) Fix UI form builder

The change in batchMod.pl is not needed when we fix the builder.
But we could at least add a comment there!

Note that passing the biblionumber of the first item does not
make sense since we are modifying items from several biblio
records normally. We most probably do not want this MARC
record's itemcallnumber (via the syspref) in all our items.

Test plan:
Test batchMod with and without the Populate fields checkbox.
Fill syspref 'itemcallnumber' with e.g. 084a.
Check Populate, and try again.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit eb292431401a7ed0782427412eb1208fa7716e4c)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31154: Pass biblionumber to Koha::UI::Form::Builder::Item->new from batchMod...
Emmi Takkinen [Tue, 26 Jul 2022 10:18:43 +0000 (13:18 +0300)]
Bug 31154: Pass biblionumber to Koha::UI::Form::Builder::Item->new from batchMod.pl to prevent error 500

When one tries to batch mod items and has "Use default values"
checkbox checked on and they have value in syspref "itemcallnumber",
Koha dies on error 500. In logs it reads:

Can't call method "field" on an undefined value at
.../Koha/Koha/UI/Form/Builder/Item.pm line 164.

This happens because in batchMod.pl line 269 we don't pass
biblionumber as parameter to Koha::UI::Form::Builder::Item->new
and thus Koha fails to fetch biblios marc record.

To test:
1. Confirm you have/set value to syspref "itemcallnumber" e.g. 084a
2. Find some item(s) to modify
3. Provide barcodes of those item(s) and check checkbox "Use default values"
4. Hit "Continue"
=> error 500 is raised
5. Apply patch.
6. Repeat steps 3. and 4.
=> no error is raised

Sponsored-by: Koha-Suomi Oy
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 355ab980cc306a61e5e9e62608c5d9d1bf8e3b37)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31513: (QA follow-up) Keep price formatting on non-editable text fields
Joonas Kylmälä [Thu, 15 Sep 2022 18:06:53 +0000 (18:06 +0000)]
Bug 31513: (QA follow-up) Keep price formatting on non-editable text fields

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit c4e8f0af70344f263f64eccccf8817ddc18f8585)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31513: Remove price formatting form data- attributes
Katrin Fischer [Sun, 11 Sep 2022 14:50:56 +0000 (16:50 +0200)]
Bug 31513: Remove price formatting form data- attributes

We cannot use data formatted with a decimal comma for
calculations. So we need to make sure that the data- attributes
passed to the modals are in 'database format' with decimal .

This will fix the NaN errors on the forms, but might also
negatively effect formatting in some spots.
Formatting should be fixed separately as this is for sure the
right first step, but we need to put in more work for displays.

To test:
* Set CurrencyFormat system preference to FR
* Go to any patron account > accounting tab
* Create a credit
* On Transactions tab: Payout amount at bottom = Verify NaN in input
* On Transactions tab: Issue payout on the credit line = Verify NaN in input
* Create a manual debit and pay it
* On Transactions tab: Issue refund = Verify NaN in input
* Apply patch
* Repeat test plan
* Now all input fields should be set with the correct amounts

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

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 9d02c71166258425f58dc020b9e7a9b95f895bb9)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 29409: Check for data that violates a constraint to avoid update problems
Nick Clemens [Wed, 3 Nov 2021 16:53:47 +0000 (16:53 +0000)]
Bug 29409: Check for data that violates a constraint to avoid update problems

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit e4455a589372e3205f9a7456478ad4585c90bedb)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 29409: Check for existence of constraint before deletion
Nick Clemens [Wed, 3 Nov 2021 16:51:09 +0000 (16:51 +0000)]
Bug 29409: Check for existence of constraint before deletion

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 012e5bff1c79d8a2cc580a43c832ace5e51bec79)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31516: Add error message for viewing enrollments for a non-existent club
Joonas Kylmälä [Fri, 2 Sep 2022 18:51:25 +0000 (18:51 +0000)]
Bug 31516: Add error message for viewing enrollments for a non-existent club

To test:
 1) Go to non-existent club's enrollment page, e.g.
    http://localhost:8081/cgi-bin/koha/clubs/club-enrollments.pl?id=1010101001000
 2) Notice the not fully filled header text and empty table
 3) Apply patch and revisit the page to see the proper error message given

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

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31486: Redirect to proper page after message deletion
Lucas Gass [Mon, 29 Aug 2022 21:48:01 +0000 (21:48 +0000)]
Bug 31486: Redirect to proper page after message deletion

To test:
1. Go to a patron account and create some messages
2. Try deleting some from both the patron details page and the patron checkout page.
3. Notice that is you are on the patron checkout page and delete a message you are then redirected to the patron details page.
4. Apply patch
5. Try deleting messages from both pages and confirm you are redirected back to that same page and the message is properly deleted.

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit a93d6fa8530aa2b92d7b443e1361e4428c1c4f1b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 29658: Fix crash on cancelling cancelled order
Marcel de Rooy [Wed, 8 Dec 2021 13:44:38 +0000 (13:44 +0000)]
Bug 29658: Fix crash on cancelling cancelled order

Found this crash in our 20.11 logs:
Cannot insert order: Mandatory parameter biblionumber is missing at /usr/share/koha/acqui/cancelorder.pl line 60.
 at /usr/share/perl/5.28/Carp.pm line 289
        Carp::croak('Cannot insert order: Mandatory parameter biblionumber is missing') called at /usr/share/koha/Koha/Acquisition/Order.pm line 79
        Koha::Acquisition::Order::store('Koha::Acquisition::Order=HASH(0x55f3760e2860)') called at /usr/share/koha/Koha/Acquisition/Order.pm line 189
        Koha::Acquisition::Order::cancel('Koha::Acquisition::Order=HASH(0x55f3760e2860)', 'HASH(0x55f375a17ec0)') called at /usr/share/koha/acqui/cancelorder.pl line 60

Not sure how to reproduce this one as it happened. But might be related to repeated clicking, backspacing etc.

Test plan:
Create a new basket and order.
Open this same basket in two browser tabs.
Cancel the order line (delete catalog record) in tab 1.
Go to second tab, try again.
Without this patch, it will crash. With this patch, an error message.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 2a3ba5f8253c6bafef17caf03645d70a90a96dea)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31530: Remove HTML tags in TT comments in patron-search.inc
Fridolin Somers [Wed, 7 Sep 2022 20:46:18 +0000 (10:46 -1000)]
Bug 31530: Remove HTML tags in TT comments in patron-search.inc

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
To test:
1) Without patch, search for patron-search.inc in misc/translator/po/xx-XX-staff-prog.po
--> There should be strings with pound signs such as "%%] %s [%%# - branch: "
2) Apply patch
3) Update translation files `translate update xx-XX`
4) Search again for patron-search.inc in
misc/translator/po/xx-XX-staff-prog.po
--> The problematic strings are not there anymore
5) In the staff interface, go to Patrons, the search box and search
function should be unchanged

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 613554edc6c308f2bd97e17ceae13b7069b9fcd9)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31250: (QA follow-up) The future will be easier
Marcel de Rooy [Thu, 18 Aug 2022 14:32:46 +0000 (14:32 +0000)]
Bug 31250: (QA follow-up) The future will be easier

As requested by Jonathan, we need more flexibility ;)
Here it comes.

Test plan:
Run t/CookieManager.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit cffd36bcb47439d80401e52091f0d2808bc52cb6)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31250: Add catalogue_editor_ cookie to koha-conf deny list
Marcel de Rooy [Thu, 28 Jul 2022 12:52:56 +0000 (12:52 +0000)]
Bug 31250: Add catalogue_editor_ cookie to koha-conf deny list

Test plan:
Add this change to your koha-conf.xml.
Flush, restart.
Test if the cookie is kept now in the interface.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit cf8e560e37c24b0cc7fd3e1aeb286de5e370ea37)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31250: Deny clearing cookies with numeric suffix
Marcel de Rooy [Thu, 28 Jul 2022 12:43:20 +0000 (12:43 +0000)]
Bug 31250: Deny clearing cookies with numeric suffix

This change allows us to add catalogue_editor_ to the deny list
in koha-conf.xml and keep cookies like catalogue_editor_123.

Test plan:
Run t/CookieManager.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
To test:
1 - Sign in to staff client
2 - Search for records and edit one
3 - Switch to advanced editor
4 - View cookies (F12/developer panel/storage tab)
5 - Note cookie like 'catalogue_editor_##' with value 'advanced'
6 - Log out
7 - note cookie value deleted
8 - Log in and search/edit a record
9 - Basic editor loads
10 - Apply patch
11 - Add line to koha-conf as described in second patch
12 - Restart all
13 - Switch to advanced editor
14 - Cookie value updated
15 - Logout
16 - Cookie value remains
17 - Log in and search/edit
18 - Confirm advanced editor loads

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit cb036faf2c534a14708b517cea40d98fc6e344c2)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31542: Home page links correct font-family
Fridolin Somers [Fri, 9 Sep 2022 06:17:23 +0000 (20:17 -1000)]
Bug 31542: Home page links correct font-family

In koha-tmpl/intranet-tmpl/prog/css/mainpage.css the rule of
font-family for big links is not complete :
  font-family: verdana, arial;
It is missing sans-serif in case computer has not those fonts.
On my computer I dont have them so I see a serif font.

We can remove this rule, inherited rule is serif fonts.

Test plan :
1) Use a computer without Arial nor Verdana fonts (basically a Linux)
2) Look at home page big links : Circulation, Patrons ...
   => Without patch they have serif font
   => With patch they have sans-serif font

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

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 30483: DBRev 22.05.06.001
Lucas Gass [Mon, 31 Oct 2022 20:33:14 +0000 (20:33 +0000)]
Bug 30483: DBRev 22.05.06.001

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 30483: DBIC
Lucas Gass [Mon, 31 Oct 2022 20:29:39 +0000 (20:29 +0000)]
Bug 30483: DBIC

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 30483: Make issues.borrowernumber and itemnumber NOT NULL
Marcel de Rooy [Thu, 7 Apr 2022 12:51:42 +0000 (12:51 +0000)]
Bug 30483: Make issues.borrowernumber and itemnumber NOT NULL

Note: This change does NOT apply to old_issues, where constraints
may result in nullifying these columns.

Test plan:
Run dbrev.
Try checkout, checkin.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1f44891fd835080133fa1a73634ced0e68b96892)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31401: (QA follow-up) Remove Koha.ArePluginsEnabled, it is no longer needed
Kyle Hall [Fri, 2 Sep 2022 14:27:39 +0000 (10:27 -0400)]
Bug 31401: (QA follow-up) Remove Koha.ArePluginsEnabled, it is no longer needed

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit c5810c360544de96bf3fb2000c135836b6e2ee10)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31401: Update administration sidebar to match entries on administration start...
Katrin Fischer [Thu, 18 Aug 2022 21:26:54 +0000 (21:26 +0000)]
Bug 31401: Update administration sidebar to match entries on administration start page

This makes sure that all entries on the administration start page
have a matching entry in the administration sidebar that shows
on the left side if you are on any of the administration sub pages.

Changes made:
* Rename 'Classification sources' to 'Classification configuration'
* Make Plugins entry show and appear in correct spot
  This relied on the variable plugins_enabled that wasn't available
  in all the different templates. I therefore moved it to Auth.pm
  and cleaned up the code for the admin start page.
* Move 'MARC overlay rules' and rename to 'Record overlay rules'

To test:
* Make sure plugins are enabled and visible on admin start page
* Compare admin start page and sidebar
  * Sequence should be the same
  * All entries should appear on both pages
  * Naming should be the same

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

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 26626: (follow-up) Be consistent with icon and accesskeys
Nick Clemens [Fri, 19 Aug 2022 09:59:24 +0000 (09:59 +0000)]
Bug 26626: (follow-up) Be consistent with icon and accesskeys

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit cc66a51e0730bc73c0e8ecfe970b0c52d63d3d62)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 26626: (follow-up) Update icon selection
Owen Leonard [Wed, 4 Aug 2021 17:06:07 +0000 (17:06 +0000)]
Bug 26626: (follow-up) Update icon selection

This patch changes the "Ignore" button to use an X icon and the "Cancel"
button to use a "Trash" icon.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit e62b8bde068dcac607f155d8267c2bc41cd4f023)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 26626: Add 'Ignore' option to confirmed holds modal
Nick Clemens [Mon, 2 Aug 2021 12:26:29 +0000 (12:26 +0000)]
Bug 26626: Add 'Ignore' option to confirmed holds modal

This patch adds 'Ignore' to the 'Hold already waiting' modal

To test:
To recreate:
 1 - Place a hold for pickup at library A
 2 - Checkin the item at Library A
 3 - Note the modal has 'Ignore' option
 4 - Click it, nothing happens
 5 - Check in the item again, same modal
 6 - Click 'Confirm'
 7 - Check in the item again
 8 - Now 'Ignore' is replaced by 'Cancel'
 9 - Click 'Confirm' to dismiss modal
10 - Apply patch
11 - Check the item in again
12 - Note 'Ignore' button before 'Cancel' button with '-' icon
13 - Go to biblio holds page
14 - Revert waiting status
15 - Check item in again
16 - Note ignore now has '-' (minus) icon

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5e8da261957e98c5a56e37a910adcb943c8cf67f)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31023: Quote authtypecode in FindDuplicateAuthorities
Nick Clemens [Tue, 12 Jul 2022 13:46:55 +0000 (13:46 +0000)]
Bug 31023: Quote authtypecode in FindDuplicateAuthorities

To test:
0 - Have Koha using Elasticsearch
1 - Set  QueryRegexEscapeOptions to 'unescape escaped'
2 - Attempt to add a new 'GENRE/FORM' authority record
3 - On save you get a 500 error
Unable to understand your search query, please rephrase and try again.
 at /kohadevbox/koha/Koha/SearchEngine/Elasticsearch/Search.pm line 102
4 - Apply patch, restart all
5 - Attempt to add a new 'GENRE/FORM' authority record
6 - Success!

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

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31023: Unit tests
Nick Clemens [Tue, 12 Jul 2022 13:46:27 +0000 (13:46 +0000)]
Bug 31023: 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 df184560a5de428ed6eaaff437cb5dd450f45726)

20 months agoBug 28290: (follow-up) Unit test
Nick Clemens [Fri, 2 Sep 2022 06:39:39 +0000 (06:39 +0000)]
Bug 28290: (follow-up) Unit test

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit e36e6c55a7854b7f6e5f7c9d90f57f9b5e5c0f0a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 28290: Don't send subfields to 'as_string' if none to send
Nick Clemens [Tue, 4 May 2021 18:29:05 +0000 (18:29 +0000)]
Bug 28290: Don't send subfields to 'as_string' if none to send

This fixes an error where we send a blank string to
Marc::Field->as_string

The subroutine fails as the regex is marked as incomplete as there is
nothing between the brackets

Also fixes a missing hidden input for 'item_action' when no items are
staged during import

 1 - Define a new matching rule with no subfields
    Match-threshold: 1000
    Record type: bibliographic record
    Search-index: Other-control-number
    Score: 1000
    Tag: 035
    Subfields:
    Offset:
    Length:
 2 - Attempt to stage a record with an 035 using this rule (i will
     attach example to bug)
 3 - Staging fails
 4 - Stage again with no matching rule
 5 - Manage the staged record, try to apply the matching rule
 6 - It fails, 500 error
 7 - Apply patch
 8 - Restart all the things
 9 - Apply rule again, it works!
10 - Stage the record again using the rule for matching
11 - It stages and matches!

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

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 29608: Made so doesn't require full permission
Isobel Graham [Thu, 1 Sep 2022 11:37:06 +0000 (12:37 +0100)]
Bug 29608: Made so doesn't require full permission

Made so the numbering sequence does not need to require full
permission.

1. Edit number patterns a confirm you don't need full permission

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 36d88b135d072f9335db46093c0e440e0cdfb2c3)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31483: Close <ol> tag properly on password reset page
Lucas Gass [Wed, 31 Aug 2022 20:59:31 +0000 (20:59 +0000)]
Bug 31483: Close <ol> tag properly on password reset page

To test:
1) Enable EnableExpiredPasswordReset
2) Find a patron and change their password so you know what it is supposed to be
3) In the database, expire the patron's password, e.g.
UPDATE borrowers SET password_expiration_date = '2022-08-22' where borrowernumber = 21;
4) Go to the OPAC, try to log in with the patron's credentials
5) Click Reset your password
=> Note that the form is in the grey breadcrumbs box, you can compare with any other OPAC page, the grey box should only contain the breadcrumbs

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 7c8e77771236306a13dba6166a08a18669fca4c3)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 30042: Remove Date::Calc dependency in batch_anonymize.pl
Tomas Cohen Arazi [Tue, 8 Feb 2022 17:45:11 +0000 (14:45 -0300)]
Bug 30042: Remove Date::Calc dependency in batch_anonymize.pl

This patch makes the script use the Koha::DateUtils tools instead.

To test:
1. Run:
   $ kshell
  k$ perl misc/cronjobs/batch_anonymise.pl --verbose --days 7
=> SUCCESS: You see (the date may vary):
Checkouts and holds before 2022-02-15 will be anonymised.
2. Apply this patch
3. Repeat 1
=> SUCCESS: Same output
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit caebb20cbb9f456750390d6494c568536dc1066c)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31364: Check length of the multiple syspref array instead whether it is null
Joonas Kylmälä [Sun, 4 Sep 2022 11:37:46 +0000 (14:37 +0300)]
Bug 31364: Check length of the multiple syspref array instead whether it is null

The multiple systempreferences are always defined as an empty array at
the minimum, so in order to determine whether we need to remove all
the selections from the systempreference we should check whether the
array is empty and not whether the array doesn't exist.

To test:
 1) Set at least 1 value for OPACHoldsIfAvailableAtPickupExceptions
 2) Remove all the values for OPACHoldsIfAvailableAtPickupExceptions
 and notice you get the message "Nothing to save"
 3) Apply patch and repeat, removing all the values should work now.

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

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31488: Update Max checkout text
Isobel Graham [Thu, 1 Sep 2022 09:44:37 +0000 (10:44 +0100)]
Bug 31488: Update Max checkout text

This changes text from "you have checked out too many items" to
"You have reached the maximum limit of items checked out".

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 7a90be2ff221df5e7ab575e89063f6e8dcc99c29)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 30231: (bug 5927 follow-up) See (rejected) forms of series entry visible in searc...
Janusz Kaczmarek [Fri, 4 Mar 2022 21:47:11 +0000 (22:47 +0100)]
Bug 30231: (bug 5927 follow-up) See (rejected) forms of series entry visible in search result (OPAC and intra)

When using zebra with IncludeSeeFromInSearches on, with traced series, the rejected
forms (4XX) of series entries are visible in result lists, both in OPAC and intra
interfaces.

Test plan:
=========
1. Have a MARC 21 installation with zebra, and with IncludeSeeFromInSearches on.
   Have an authority records for series (130, or 100/110/111 with
   title) with rejected forms (4XX fields).  So the auth record should
   contain at least:

   130 _0 $a Series title
   430 _0 $a Some other title under which the series in known

   Use (each) authority record in at least two biblio records (in appropriate
   fields, i.e.  800/810/811/830 or even deprecated 440, if it makes use
   of UNIF_TITLE).
   Don't forget to properly input also 490 (for 8XX). So the biblio record
   shold contain at least:

   245 nn $a Work title.
   490 1_ $a Series title
   830 _0 $a Series entry $9 <koha_id>

   Reindex.
2. Perform a simple biblio search (in OPAC and in intra) with the title
   from auth record.
3. You shold get a list of results.  See the Series information--you
   shold see not only the accepted entry from 1XX in auth but also the
   rejected forms from 4XX.
4. Apply the patch.
5. Repeat 3. You shold see only the entry form of series now.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 3f90b7b43d0ed927ddac92af5be226d1ede6429f)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31356: Use hold expiration date instead of adding days to the waiting date
Nick Clemens [Fri, 12 Aug 2022 16:19:49 +0000 (16:19 +0000)]
Bug 31356: Use hold expiration date instead of adding days to the waiting date

The Talking Tech outbound script currently just adds the
ReservesMaxPickUpDelay to the waiting date to calculate the
"expiration date", but it should use the actual hold expiration
date which may differ from this naive calculation based on
various system preference values.

Test Plan:
1) Create a holiday for tomorrow
2) Set ReservesMaxPickUpDelay to 5
3) Set "Days mode" to "Same week day"
4) Enable ExcludeHolidaysFromMaxPickUpDelay
5) Enable TalkingTechItivaPhoneNotification
6) Create a hold and fill the hold so it is waiting
7) Enable "Hold filled" phone notices for that patron
8) Create a 'phone' version of the HOLD notice
9) Run ./misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl --type RESERVE -w 0
10) Note the output has the expiration date ( 15th colume ) 5 days from now which is *not* the hold's expiration date
11) Apply this patch
12) Repeat the command from step 9
13) Note the expiration date column now matches the holds actual expiration date!

Signed-off-by: Kyle Hall <kyle@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f6a08737c9ad9c85e98887e3a55cf31029c5a8c8)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31177: Fix misplaced import in C4::ILSDI::Services
Tomas Cohen Arazi [Mon, 18 Jul 2022 15:47:49 +0000 (12:47 -0300)]
Bug 31177: Fix misplaced import in C4::ILSDI::Services

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit cb2fd089af2756c91a4839ca23bb6e8c7356a41b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 30262: Trim whitespace off tracklinks.pl URLs
David Cook [Thu, 10 Mar 2022 04:02:49 +0000 (04:02 +0000)]
Bug 30262: Trim whitespace off tracklinks.pl URLs

This patch trims whitespace off tracklinks.pl URLs so that
the URL is in the same format as the URLs returned by
C4::Biblio::GetMarcUrls, which is used by tracklinks.pl internally.

Test plan:
0. Apply patch and koha-plack --restart kohadev
1. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=29
2. Add a 856 with $u of 'https://koha-community.org ' (note the space at the end0
3. Save record
4. Change 'TrackClicks' syspref to 'Track'
5. Go to http://localhost:8080/cgi-bin/koha/opac-detail.pl?biblionumber=29
6. Click on the online resource (eg
http://localhost:8080/cgi-bin/koha/tracklinks.pl?uri=https%3A%2F%2Fkoha-community.org%20&biblionumber=29
)
7. Note you are redirected to https://koha-community.org

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Added the link with a space at the end. Verified that without the
patch, clickin on "Click here to access online" gives a 404. After
applying the patch the redirect works as expected.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5fe49c7db1113026d242ad081c6b100fc8bae76e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31489: Typo in EnableExpiredPasswordReset description
Caroline Cyr La Rose [Tue, 30 Aug 2022 16:10:37 +0000 (12:10 -0400)]
Bug 31489: Typo in EnableExpiredPasswordReset description

This patch corrects a typo in the EnableExpiredPasswordReset system preference description.

To test:
1) Apply patch
2) Go to Administration > Global system preferences
3) Search for EnableExpiredPasswordReset
4) Read the description and make sure there are no errors.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit b715ea28b15ae689571cda0535bd3dac467099bd)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31379: Change results per page text for default
Fridolin Somers [Wed, 17 Aug 2022 06:09:32 +0000 (20:09 -1000)]
Bug 31379: Change results per page text for default

Since Bug 14715, one can change number of results per page.
The actual text in combobox for default value is : "Library default:
20"

This text is hard to translate correctly.
For example french translation use "site par défaut" wrongly meaning
"default library".

I propose to simply use "20 (defaut)".

Test plan :
1) Go to system preferences and set both 'numSearchResultsDropdown' and
   'OPACnumSearchResultsDropdown' to 'Show'
2) Do a catalogue search in the intranet using a search term that will
   bring lots of results
3) Look at restults per page combobox
4) Same for OPAC

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 29ad53a682f339a6d9fea028b1951898c6dff662)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31112: (QA follow-up) Reduce database queries
Kyle M Hall [Wed, 24 Aug 2022 17:10:18 +0000 (17:10 +0000)]
Bug 31112: (QA follow-up) Reduce database queries

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 73c3c5d2f10751c23156372300239d42e5957c66)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31112: (follow-up) Don't return "on_reserve" when there are 0 possible holds
Joonas Kylmälä [Mon, 22 Aug 2022 19:02:14 +0000 (19:02 +0000)]
Bug 31112: (follow-up) Don't return "on_reserve" when there are 0 possible holds

It's possible that there could be 0 possible reserves, for example
when the hold has already been filled, thus the check would fail as
the item count can never be less than 0.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 507edad61f16d99d4fba4ce343cbaa6eb3950957)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31112: (follow-up) Bring back the check for non-priority holds
Joonas Kylmälä [Mon, 22 Aug 2022 19:02:03 +0000 (19:02 +0000)]
Bug 31112: (follow-up) Bring back the check for non-priority holds

Before the changes from bug 31112 when CheckReserves returned a
non-priority hold we didn't return "on_reserve" status but checked in
addition to that whether there are any priority holds and if there
were, only then we returned the "on_reserve" error.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 8ad992630181413d3be9935309b61d50d2e3a951)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31112: (QA follow-up) Fetch patrons with reserves
Nick Clemens [Fri, 19 Aug 2022 13:23:05 +0000 (13:23 +0000)]
Bug 31112: (QA follow-up) Fetch patrons with reserves

Previously we fetched all in a single call using biblionumbers

Fetching each individually could be a performance hit on systems
with large numbers of holds

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 2eb053603d9df3b03f4ee0ec54f84a697aab8716)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31112: (QA follow-up) Restore check to avoid extra processing
Nick Clemens [Fri, 19 Aug 2022 13:11:09 +0000 (13:11 +0000)]
Bug 31112: (QA follow-up) Restore check to avoid extra processing

We now count all holds for all patrons, we can still eject if we have more
holds than we do items

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 4676ce1a03fee089c4aa51a49ecc646afb91450a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31112: CanBookBeRenewed: take into account patrons with more than 1 hold to a...
Joonas Kylmälä [Mon, 18 Jul 2022 16:29:06 +0000 (16:29 +0000)]
Bug 31112: CanBookBeRenewed: take into account patrons with more than 1 hold to a biblio

If a single patron had more than 1 hold to a biblio and there was only one
available item we allowed incorrectly renewing the checkout when
AllowRenewalIfOtherItemsAvailable was set to "Allow". This
changes CanBookBeRenewed so that it makes sure all the holds are
filled and not just one per patron.

To test:
 1) prove t/db_dependent/Circulation.t
 2) (Optional, as unit test is provided)
    - Set AllowRenewalIfOtherItemsAvailable = Allow
    - Create biblio with three items
    - Checkout one item to patron A
    - Add two biblio-level holds for patron B
    - Try to renew patron A's checkout with and without this patch.
    - Notice that without this patch the renewal succeeds even though we
      one unfilled hold left. After applying the patch the renewal should
      fail.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 15f622ecc1b3d425bf460527398975447cbee62e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31112: Remove unnecessary if-clause
Joonas Kylmälä [Mon, 18 Jul 2022 16:29:06 +0000 (16:29 +0000)]
Bug 31112: Remove unnecessary if-clause

To test:
 1) Please check manually that the logic stays the same, use git's -w command line parameter to
    ignore whitespace changes in the diff output.
 2) prove t/db_dependent/Circulation.t

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 8ba1a9a5345310c54d9225049d470544b56eeb11)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 32011: 2FA - Prevent qr_code to not be generated
Jonathan Druart [Thu, 27 Oct 2022 08:53:06 +0000 (10:53 +0200)]
Bug 32011: 2FA - Prevent qr_code to not be generated

Caught by selenium/authentication_2fa.t

 #   Failed test 'Enforce 2FA setup on first login'
 #   at t/db_dependent/selenium/authentication_2fa.t line 291.Error while executing command: unexpected alert open: Dismissed user prompt dialog: [object Object] at /usr/share/perl5/Selenium/Remote/Driver.pm line 411.
 at /usr/share/perl5/Selenium/Remote/Driver.pm line 356.

There is a 500 in the logs:
 "POST /api/v1/app.pl/api/v1/auth/two-factor/registration HTTP/1.1" 500

That is caused by
[ERROR] POST /api/v1/auth/two-factor/registration: unhandled exception (Mojo::Exception)<<Overflow error. version 8
total bits: 1268  max bits: 1232>>

It's coming from GD::Barcode, in my understanding we should increase 'Version'.

Test plan:
Remove all other subtests from the selenium to speed up its exec, then
run it in a loop. Without this patch the tests fail quite often (1/10),
now it should not fail with this error (maybe another one, see bug
32010)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit edb16022febc4968d172d6e3e96fac295d31579d)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31863: Account for changelanguage element when adjusting editor height
Lucas Gass [Tue, 18 Oct 2022 20:53:03 +0000 (20:53 +0000)]
Bug 31863: Account for changelanguage element when adjusting editor height

To test:
1. Turn on 'EnableAdvancedCatalogingEditor'
2. Go to a record with enough MARC data that it should take up the entire width of your screen,
3. The CodeMirror editor will only be 300px.
4. Resize your screen, nothing happens to the editor height
5. Apply patch
6. Look at the same record in your editor, the editor should go to the bottom of the page now. Resizing your screen should resize the editor.
7. Have some additional language packs installed, and change the language system pref so the '#changelanguage' option will appear.
8. Make sure the editor height is still being properly set.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 9bee75e107178e4ca907cc3a8c7399f3a128fbe6)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31421: Add tests
Jonathan Druart [Thu, 27 Oct 2022 10:39:20 +0000 (12:39 +0200)]
Bug 31421: Add tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f2519aec6fa2a3af0957faa60b7764471fa1305f)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31421: Add a limited option to template plugin
Nick Clemens [Thu, 20 Oct 2022 14:13:37 +0000 (14:13 +0000)]
Bug 31421: Add a limited option to template plugin

This adds a specific 'limited' routine to the Categories plugin, and uses
it for the new patron dropdowns

To test:
1 - Limit a patron category to some branches
2 - Sign in not at one of those
3 - Confirm the new patron dropdowns don't include the category

Bug 31421: (follow-up) Add POD

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1fc56e0e47d07d2eadcdb62c6a5740aa9d51c6b2)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31421: Do not apply library limits to Categories plugin
Nick Clemens [Thu, 6 Oct 2022 19:13:10 +0000 (19:13 +0000)]
Bug 31421: Do not apply library limits to Categories plugin

This patch simply changes from using 'search_with_library_limits'
to 'search'

The limits I think are intended to prevent users from setting a patron to the wrong category,
they are not meant to hide patrons. Or rather, they don't do that, patrons are returned in search
but cannot be processed. The dropdowns as well won't contain the category, so you can see these
patrons, but not filter by the category

Bug 31422 and bug 31032 point out further issues with limits.

For now, let's fix searching

To test:
1 - Edit Patron category 'Patron/PT'
2 - Try to do a patron search that returns patrons in this category
3 - See 'Processing' and error in JS console: Uncaught TypeError: categories_map[data] is undefined
4 - Apply patch
5 - Restart all and repeate
6 - It works now!

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 29754226ea3b6bdaf896e5b8d19f44b1ed551e11)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoUpdate release notes for the 22.05.06 release v22.05.06
Lucas Gass [Tue, 25 Oct 2022 18:06:10 +0000 (18:06 +0000)]
Update release notes for the 22.05.06 release

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoIncrement version for 22.05.06 release
Lucas Gass [Tue, 25 Oct 2022 17:56:35 +0000 (17:56 +0000)]
Increment version for 22.05.06 release

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoMerge remote-tracking branch 'translations/22.05.06-translate-20221025' into rmain2205
Lucas Gass [Tue, 25 Oct 2022 17:39:27 +0000 (17:39 +0000)]
Merge remote-tracking branch 'translations/22.05.06-translate-20221025' into rmain2205

20 months agoBug 31219: Prevent JS injection in patron extended attributes
Jonathan Druart [Mon, 25 Jul 2022 07:23:25 +0000 (09:23 +0200)]
Bug 31219: Prevent JS injection in patron extended attributes

We are sanitizing other attributes but "extended patron attributes".

Test plan:
Make a patron attribute editable at the OPAC
Edit an existing patron, or register a new one
Use a script tag in the new value ("<script>alert("booh!")</script>" for
instance)
With this patch the value is remove if containing an HTML tag that is
not br b i em big small strong (see C4::Scrubber)

Signed-off-by: Mark Hofstetter <koha@trust-box.at>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoTranslation updates for Koha 22.05.06
Koha translators [Tue, 25 Oct 2022 17:22:04 +0000 (14:22 -0300)]
Translation updates for Koha 22.05.06

20 months agoBug 31033: Explicitly define max child processes for SIP server
David Cook [Fri, 24 Jun 2022 01:42:52 +0000 (01:42 +0000)]
Bug 31033: Explicitly define max child processes for SIP server

By default, the SIP server appears to only use 1 child process for
responding to SIP connections.

This change makes this explicit in the configuration, which should
make it so that people who need more than 1 simultaneous SIP connection
can know to just increase the value for the "max_servers" parameter
in the SIPconfig.xml file.

Test plan:
1. Add "max_servers='1'" to your SIP configuration file
2. koha-sip --restart kohadev
3. Open 3 terminals
4. Run "telnet localhost 6001" on 2 terminals
5. On the 3rd terminal, run the following:
ss -l -n -t
ps -efww | grep "sip"
6. Note that there are 2 processes called
kohadev-koha-sip: perl /kohadevbox/koha/C4/SIP/SIPServer.pm /etc/koha/sites/kohadev/SIPconfig.xml
One of these processes is the parent of the other
7. The Recv-Q in the "ss" output should show 1
(This means that 1 of your telnet connections is in the server's TCP backlog)
8. Celebrate as the configuration works as expected

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 4a6567274d944814c432ab7b3697c545e1459800)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 12225: Use ProcessOfflineIssue
Kyle M Hall [Wed, 13 Jul 2022 14:31:09 +0000 (14:31 +0000)]
Bug 12225: Use ProcessOfflineIssue

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 3b0bc03ad46e82d2d813227f46d6e7420bd6c189)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 12225: Add unit tests
Kyle Hall [Tue, 23 Aug 2022 16:15:09 +0000 (12:15 -0400)]
Bug 12225: Add unit tests

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

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 12225: Re-implement no block flag for checkouts
Kyle Hall [Tue, 12 Jul 2022 11:46:31 +0000 (07:46 -0400)]
Bug 12225: Re-implement no block flag for checkouts

Test Plan ( assuming Koha Testing Docker or kohadevbox ):
1) Check out master
2) Start the SIP server ( edit the SIP config koha instutution to be
   "CPL" instead of "kohalibrary" )
3) Telnet to 6001
4) Send 9300CNkoha|COkoha|CPCPL|
5) Send 11YY20220711    16350220250711    163502AOCPL|AA23529000035676|AB39999000001396|ACkoha|BON|BIN|
6) Note the due date for the checkout in Koha is not in the year 2025:
   Henry Acevedo (23529000035676) checked out Philippics. by Cicero, Marcus Tullius. 39999000001396
7) Apply this patch set
8) Restart all the things!
9) Check in the checkout
10) Repeat steps 3 through 5
11) Note the due date is now in 2025!

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 51eb6e65540e0440a28c80343319a8a895d509df)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 12225: Fix SIP message templates
Kyle M Hall [Mon, 11 Jul 2022 16:57:06 +0000 (16:57 +0000)]
Bug 12225: Fix SIP message templates

If a renewal via SIP would produce an error due to being on reserve, or
exceeding maximum renewals, Koha's SIP2 implementation will refuse to
renew the item even if the "no block" flag is set to Y.

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

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31387: Fix othernames required label
Lucas Gass [Wed, 17 Aug 2022 17:09:44 +0000 (17:09 +0000)]
Bug 31387: Fix othernames required label

1. Mark othernames as required via PatronSelfRegistrationBorrowerMandatoryField
2. Go to the self-reg form, the field is required but the span that makes it look required stays hidden. (<div class="required_label required">Required</div>)
3. Mark initials as required via PatronSelfRegistrationBorrowerMandatoryField.
4. Now the label_required field appears for othernames in the self ref form
5. Apply patch
6. Try again, the label should now properly show when othernames is marked as required

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 37002a81c37e759bf80e663d3e75ce7c0700feef)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31348: Make koha-plack stop gracefully
David Cook [Fri, 12 Aug 2022 02:27:52 +0000 (02:27 +0000)]
Bug 31348: Make koha-plack stop gracefully

0. Apply patch
1. cp /usr/sbin/koha-plack /usr/sbin/koha-plack.bak
2. cp debian/scripts/koha-plack /usr/sbin/koha-plack
3. Now at roughly the same time do the following two actions:
    3a. Go to http://localhost:8081/cgi-bin/koha/about.pl
    3b. koha-plack --stop kohadev
4. Note that the HTTP request completes
5. Click on "Home"
6. Note that the error is "Service Unavailable" rather than "Proxy Error",
which would've occurred with an interrupted HTTP request/response

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 5155e43b04a4283bb13eedd39cdcb9e12693630d)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31390: Remove noisy warns in C4::Templates
David Cook [Thu, 18 Aug 2022 01:14:03 +0000 (01:14 +0000)]
Bug 31390: Remove noisy warns in C4::Templates

This patch removes two noisy warnings from C4::Templates

0) Apply patch and koha-plack --restart kohadev
1) Go to http://localhost:8081/
2) Note no warnings in /var/log/koha/kohadev/plack-intranet-error.log
3) Go to http://localhost:8080/
3) Note no warnings in /var/log/koha/kohadev/plack-opac-error.log

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 368b1462e58f02e9636bb9ce5a5ba70a54b5d353)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31673: (QA follow-up) Check if FK exists before attempt to remove
Tomas Cohen Arazi [Tue, 11 Oct 2022 12:08:56 +0000 (09:08 -0300)]
Bug 31673: (QA follow-up) Check if FK exists before attempt to remove

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1c83bd06387a42554f89a21820297970d1377fb4)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31673: (bug 31086 follow-up) Drop and constraint to allow updating column
Nick Clemens [Wed, 5 Oct 2022 10:16:02 +0000 (10:16 +0000)]
Bug 31673: (bug 31086 follow-up) Drop and constraint to allow updating column

It seems that we cannot edit the column while it has a constraint.
If we remove it, update the oclumn, then re-add it, the update succeeds

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 0bd87ce0642e873c98b5ca8fe1a0f92aeef7511a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31351: (QA follow-up) Trivial string fix
Tomas Cohen Arazi [Wed, 7 Sep 2022 21:04:41 +0000 (14:04 -0700)]
Bug 31351: (QA follow-up) Trivial string fix

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 14f52725d362623bd2efc772356f0bc00926eeca)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31351: (QA follow-up) Extend the encode/decode test
Marcel de Rooy [Wed, 7 Sep 2022 13:51:07 +0000 (13:51 +0000)]
Bug 31351: (QA follow-up) Extend the encode/decode test

Adding some Unicode stuff.
And missing txn couple.

Test plan:
Run t/db_dependent/Koha/BackgroundJob.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 99b15ee5df0e3c91f74dbb05a6b5424297caf62b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31351: (QA follow-up) Adjust tests accordingly
Marcel de Rooy [Wed, 7 Sep 2022 12:29:52 +0000 (12:29 +0000)]
Bug 31351: (QA follow-up) Adjust tests accordingly

Test plan:
Run t/db_dependent/Koha/BackgroundJob.t
Run t/db_dependent/Koha/BackgroundJobs.t
Prove t/db_dependent/Koha/BackgroundJobs

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 727193deade2795db350b84bec0ca2e28163124a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31351: (QA follow-up) Use $self->json in Background modules
Marcel de Rooy [Wed, 7 Sep 2022 12:05:17 +0000 (12:05 +0000)]
Bug 31351: (QA follow-up) Use $self->json in Background modules

Making the disabling utf8 flag explicit instead of depending on
the default of the CPAN module.

Incorporating the change in background_jobs_worker too.

Test plan:
See next patches when we look at unit tests.
Restart koha-worker.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 202db89f83bdc9b6a72ebaa90f00898698856ee8)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31351: Koha::BackgroundJob: Let database connection object handle utf8 transcoding
Joonas Kylmälä [Tue, 6 Sep 2022 19:32:11 +0000 (22:32 +0300)]
Bug 31351: Koha::BackgroundJob: Let database connection object handle utf8 transcoding

Our database connections have been set up so that they will
automatically convert perl encoded strings to utf8 encoded strings
when sending data to database tables and decode the utf8 encoded
strings from the tables back to internal perl strings. As we can see
from a call in Koha/BackgroundJob.pm we are encoding the perl internal
string to utf8 and then decoding it back to perl internal string:

my $data_dump = decode_json encode_utf8 $self->data;

We can skip this unnecessary encode<->decode step (as the database
object has done the decoding for us) by simply calling the
JSON->new->decode() method which doesn't perform any string decoding.

Furthermore, the original code was buggy and didn't always remember to
encode the unencoded strings, in Koha::BackgroundJob::process we can
see

my $context = decode_json($self->context);

is missing the encode step. Now after this change encoding before
decoding is not necessary as we are using the methods from the JSON
module that do not perform any transcoding.

Note to those concerned whether the old data in the database is
compatible with this new code:
 Luckily our database connection object seems to be smart and
 didn't utf8 encode the utf8 returned data from the old encode_json()
 calls (probably checks the utf8 flag for the string (Encode::is_utf8($str))).

To test whether this fixes the original bug reported of not being able
to schedule background jobs with koha user having non-ASCII letters in
their surname:
 1) Change your staff users surname/lastname to "ääää"
 2) Log out and back in.
 3) Go to a biblio record detail page and click "Select all" in the
 items table
 4) Click Delete selected items and proceed with the deletion
 5) Notice the batch item deletion job has failed status
 6) Apply patch and repeat but this time the deletion job should finish.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit d95805c6aacc28490c17b42d22277e966f1292c1)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31355: Add paging = false to items table on opac-reserve
Nick Clemens [Fri, 12 Aug 2022 15:51:13 +0000 (15:51 +0000)]
Bug 31355: Add paging = false to items table on opac-reserve

Moving to an ajax datatable and paging would be a future fix, this restores
lost functionality

To test:
1 - Find or create a title with 20 items
2 - Place a hold in opac
3 - Attempt to select a specific item
4 - Note only 10 show
5 - Apply patch
6 - All items show

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 20108c837e639ce9fa4e2401a61779865bc942d1)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31425: Minor correction to patron categories admin title
Owen Leonard [Fri, 19 Aug 2022 18:00:37 +0000 (18:00 +0000)]
Bug 31425: Minor correction to patron categories admin title

This patch corrects the patron categories administration template so
that an extra angle bracket isn't included in the page title on the main
view.

To test, apply the patch and go to Administration -> Patron categories.
The page title should read:

Patron categories › Administration › Koha

...with no extra "›" at the beginning.

Check that other views (new, edit, delete) are unaffected.

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 9c11c588c11bf50888796a6d1fe175a2ddc853bd)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31352: Change 'Borrower name' to 'Patron name'
Alex Buckley [Tue, 16 Aug 2022 01:10:43 +0000 (13:10 +1200)]
Bug 31352: Change 'Borrower name' to 'Patron name'

Test plan:
1. Go to Tools > Patron card creator > New > Card batch
2. Enter a borrowernumber and click 'Add patron(s)'
3. Observe a table with the leftmost column name 'Borrower name' loads
4. Apply patch
5. Refresh page
6. Observe the leftmost column name is 'Patron name'

Sponsored-by: Catalyst IT, New Zealand
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 d128466dac1711e28f30b556f000f3ae0173bb4b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31076: Handle year limits with equal sign or colon
Nick Clemens [Fri, 1 Jul 2022 11:08:57 +0000 (11:08 +0000)]
Bug 31076: Handle year limits with equal sign or colon

To test:
1 - Enable ES and index
2 - Set expandedSearchOption to 'show'
3 - Advanced search on staff and opac using Year field on staff and Publication date range on OPAC for:
    2005
    2005-
    -2005
    <2005
    >2005
    2005-2010
4 - Confirm ranges don't work on staff side, but do on opac
5 - Apply patch
6 - Repeat searches - they work on both staff and opac
7 - prove t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit a11633379f8d9f6a933da7fa887b2e7966e3765a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 28327: (follow-up) Comma as default CSV delimiter
Fridolin Somers [Fri, 24 Jun 2022 07:38:11 +0000 (21:38 -1000)]
Bug 28327: (follow-up) Comma as default CSV delimiter

Looks like most of existing code wants comma as default value.

Also impact installer/data/mysql/mandatory/sysprefs.sql.

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

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 28327: Unify CSV delimiter special behavior for tabulation
Fridolin Somers [Wed, 12 May 2021 10:00:31 +0000 (12:00 +0200)]
Bug 28327: Unify CSV delimiter special behavior for tabulation

System preference 'CSVdelimiter' has a special case for tabulation.
Preference value contains string 'tabulation' but string '\t' must be used in CSV file.

This is OK in many places, for exemple Bug 17590.

This patch adds C4::Context->csv_delimiter to add a uniq metod dealing
with this behavior.
Also create Koha::Template::Plugin::Koha->CSVDelimiter for calls from
Toolkit Templates.

Test plan :
1) Set system preference 'CSVdelimiter' = 'tabs'.
2) Create CSV export in impacted pages
3) Check columns are separated by tabulation character and not string 'tabulation'
4) Check with another delimiter

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 381b79593e2a86c4d856242a1f6e955d95ae1f24)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 28327: Add unit tests
Fridolin Somers [Tue, 22 Mar 2022 07:48:50 +0000 (21:48 -1000)]
Bug 28327: Add unit tests

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

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31282: Fix broken characters in patron_emailer.pl verbose mode
Tomas Cohen Arazi [Tue, 2 Aug 2022 12:24:57 +0000 (09:24 -0300)]
Bug 31282: Fix broken characters in patron_emailer.pl verbose mode

To test:
1. Have a report containing:
   SELECT tomascohen@theke.io;
2. Have a members notice containing ¡ and other non-ASCII characters.
3. Run (changing the report number and notice code accordingly):
   $ kshell
  k$ perl misc/cronjobs/patron_emailer.pl --report 4 \
           --notice BIRTHDAY --from tomascohen@theke.io --module members
=> FAIL: non-ASCII characters are broken
4. Apply this patch
5. Repeat 3
=> SUCCESS: Things print correctly!
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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 9afbe872b7e63ce1d88cf6896df3b1046529212b)

20 months agoRevert "Bug 29012: Add default values for blank circulation rules that weren't saved...
Lucas Gass [Thu, 13 Oct 2022 17:31:41 +0000 (17:31 +0000)]
Revert "Bug 29012: Add default values for blank circulation rules that weren't saved to the database"

This reverts commit 387900a65c7cafcf28ad0da415e4136ffa7e0443.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoRevert "Bug 29012: (QA follow-up) Use q{} instead of '' in smart-rules.pl"
Lucas Gass [Thu, 13 Oct 2022 17:31:03 +0000 (17:31 +0000)]
Revert "Bug 29012: (QA follow-up) Use q{} instead of '' in smart-rules.pl"

This reverts commit 294ed32d06101b57f07838910165f75b039e5dea.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoRevert "Bug 29012: DBRev 22.05.05.001"
Lucas Gass [Thu, 13 Oct 2022 17:29:54 +0000 (17:29 +0000)]
Revert "Bug 29012: DBRev 22.05.05.001"

This reverts commit 2256a16b9b1ff51a2c7ccf9453d9c4b7a03f6630.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31473: Fix fragile test about bad OpacHiddenItems conf
Tomas Cohen Arazi [Fri, 26 Aug 2022 19:45:10 +0000 (16:45 -0300)]
Bug 31473: Fix fragile test about bad OpacHiddenItems conf

There's been a behavior change in recent MariaDB that made some cases
deal with truncated data in DOUBLE context instead of DECIMAL.

Probably this:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-27380

This made the affected test fail consistently on those versions.

This trick for checking OpacHiddenItems is correct (as introduced on bug
28125 doesn't really make use of the warning, just prints it in
about.pl) so one option was to just check for a warning.

I decided to keep the test, but add the optional DECIMAL|DOUBLE check on
the qr. This way other eventual changes will make it fail and serve as a
warning in case something more relevant changes.

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 3a5fb22ad88790673d6d8fbc483f6e219f25f33d)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 30779: Remove _update_import_record_marc and update tests
Nick Clemens [Wed, 17 Aug 2022 11:56:37 +0000 (11:56 +0000)]
Bug 30779: Remove _update_import_record_marc and update tests

This patch removes the now unused: _update_import_record_marc

Additionally, as items are already present in import biblio we no longer need to embed
them, so that parameter is removed and the option removed from the sub and pod and everywhere
it was used

In all cases, we were embedding, so we don't need a way to get without

Tests updated

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit b02b66acf5ddac1af00215fbcc1d842777b67c3b)

20 months agoBug 30779: Do not update import marc after importing items
Nick Clemens [Mon, 16 May 2022 19:57:23 +0000 (19:57 +0000)]
Bug 30779: Do not update import marc after importing items

We are stripping the marc item tags at import - we save them when not importing items, but
strip when importing items

I think we can save on writes by leaving them in the record. This also allows comparison to what was staged
versus items created

To test:
 1 - Stage a marc record with items, but do not look for items
 2 - Confirm the item tags remain in staged marc
 3 - Import the record
 4 - Confirm items are nto in imported marc record
 5 - Stage the record again, but look for items
 6 - Confirm the item tags are stipped from imported record
 7 - Import and confirm imported record has no item tags
 8 - Apply patch and repeat 1-5
 9 - Confirm item tags remain in record
10 - Import and confirm item tags not in imported marc

Signed-off-by: Andrew <andrewfh@dubcolib.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit b1ec071866de33ef0eb37cc74b62c8ed77d6afad)

20 months agoBug 31217: OPAC coce.js is not hiding the coce-coverimg div for single-pixel images
Alex Buckley [Tue, 26 Jul 2022 04:38:29 +0000 (16:38 +1200)]
Bug 31217: OPAC coce.js is not hiding the coce-coverimg div for single-pixel images

This is because opac-detail.tt has coce-coverimg as an ID, but OPAC
coce.js targets coce-coverimg as a class.

opac-detail.tt should be changed to have coce-coverimg as a class.

Test plan:
1. Set your system preferences:
- CoceHost = https://coce.mykoha.co.nz
- CoceProviders = Select all
- OpacCoce = Enable

2. Add the ISBN of '9780262336499' to a biblio

3. Open a "Incognito" window in your browser (recommended to use Google
Chrome to test this)

4. View the biblio detail page in the OPAC. Observe a 'Coce image from
Amazon' box loads with a spinner

5. Apply patch and restart services

6. Clear your browser cache

7. Reload the same biblio detail page in the OPAC. Observe no image is
displayed.

8. View another OPAC biblio detail page that does have a successfully
loading coce image and confirm the source of that image is listed: For
example 'Coce image from Amazon.com' is displayed

Sponsored-by: Toi Ohomai Institute of Technology, New Zealand
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit cbe50d798a42b65d4439d30df6bbf2ab6623bbcd)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31382: Pass password_has_expired param to templte
Nick Clemens [Wed, 17 Aug 2022 11:09:14 +0000 (11:09 +0000)]
Bug 31382: Pass password_has_expired param to templte

This patch restores the param, while still leaving the check against invalid
login credentials to ensure we don't leak information.

To test:
 1 - enable  EnableExpiredPasswordReset
 2 - Edit a patron to set password to expire in the past
 3 - Attempt opac login as patron
 4 - It fails, but you are redirected to login screen with no info
 5 - Apply patch
 6 - Attempt login
 7 - You are notified password expired and given reset link
 8 - Go back to login screen
 9 - Login with correct username,, wrong password
10 - You are notified of incorrect credentials, not password expiration

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 218419ce2c2502bcad0f8285173b4493d7e9e8fc)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31382: Regression tests
Tomas Cohen Arazi [Wed, 17 Aug 2022 18:40:07 +0000 (15:40 -0300)]
Bug 31382: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 217e953ffb81cbac7f57521d3c0c7568995bb11d)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 31222: Reduce query size for batchMod
Nick Clemens [Fri, 22 Jul 2022 14:47:36 +0000 (14:47 +0000)]
Bug 31222: Reduce query size for batchMod

The object search is currently:
Koha::Items->search({ barcode => \@contentlist }

Which generate code like:
barcode = 1 OR barcode = 2 OR barcode = 3 ....

This can get quite large

We can reduce the query size by using -in:
Koha::Items->search({ barcode => { -in => \@contentlist } }

Which generates code like:
barcode in ( 1, 2, 3 )

To test:
1 - Apply patch
2 - Perform batch modifications
3 - Confirm nothing has changed

Signed-off-by: Rachael Laritz <rachael.laritz@inlibro.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 7343e404b7b486c52a150613f308e452f4f5da05)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20 months agoBug 29782: Fix handling records without title or content
Marcel de Rooy [Tue, 16 Aug 2022 12:02:13 +0000 (12:02 +0000)]
Bug 29782: Fix handling records without title or content

Test plan:
Save a new record with only a title in the non-default tab (english).
Check if you see it on the list. Edit.
Save a new record without title but only content in non-default lang.
Check if you see it.
Do the same 2 edits on the default tab only. Verify too.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 89e65657b106570b717dede6476a6d6f65511b67)

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