koha.git
6 months agoBug 35103: Add option to gulp tasks to pass a list of tasks
Jonathan Druart [Thu, 19 Oct 2023 07:41:03 +0000 (09:41 +0200)]
Bug 35103: Add option to gulp tasks to pass a list of tasks

You can now generate the messages.po for all languages with:
  gulp po:update --task messages

or for only es-ES
  gulp po:update --task messages --lang es-ES

It may be helpful for the "update po" script that will be used on
weblate.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 months agoBug 35033: (QA follow-up): tidy up code
Victor Grousset/tuxayo [Mon, 30 Oct 2023 17:58:09 +0000 (18:58 +0100)]
Bug 35033: (QA follow-up): tidy up code

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 0a8303c9fac42e16d4ff5c13dd700789d4a438c3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit f50f5a1dccef4de31e1148232bacdf435f8bd156)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35033: Add a validation for biblioitems in about/system information
Blou [Wed, 11 Oct 2023 15:57:28 +0000 (11:57 -0400)]
Bug 35033: Add a validation for biblioitems in about/system information

In the About section, under the System information tab, we get validation between
issues, borrowers, biblio, items, reserves tables, and their deleted/old counterpart.

But there's no validation for biblioitems.

This patch will simply add the same test (and display) as the others, but for biblioitems.

Testing
0) Create a simple biblio entry through cataloguing. Note the biblioitemnumber created.
1) Insert a dummy entry in deletedbiblioitem using the biblioitemnumber.  An simple SQL will do
insert into deletedbiblioitems select * from biblioitems where biblioitemnumber = GIVENbin;
2) Go to about, see there's no warning in systeminformation.
3) apply the patch, validate that an error appears.

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 07ac0b1f72245de6e8ecf2a1a9d2e485ca233f79)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 4579a814bc9b24dfe10f392bad6dd201ef465435)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34424: Add Emily Lamancusa to QA Team
Katrin Fischer [Sun, 29 Oct 2023 14:36:38 +0000 (14:36 +0000)]
Bug 34424: Add Emily Lamancusa to QA Team

Long overdue.

To test:
* Apply patch
* Verify that Emily shows as part on the QA Team
  on the About page

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit e42d5c6e6f5a8d5c958a3dad5583490a550ce862)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 26d592d699850fcff73e1bfc0aac787aefdc7bce)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35180: DBIC schema
Tomas Cohen Arazi [Wed, 1 Nov 2023 18:26:00 +0000 (15:26 -0300)]
Bug 35180: DBIC schema

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 3f1e21bbca753168e194f0d4f23f9c84ebadeeaf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 1fb6975cd12495cdc7dbb7c04ba5bbc89f4dd106)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35180: Fix 246 to 264 in COMMENT of deletedbiblioitems.publishercode
Katrin Fischer [Sun, 29 Oct 2023 09:31:06 +0000 (09:31 +0000)]
Bug 35180: Fix 246 to 264 in COMMENT of deletedbiblioitems.publishercode

This fixes a typo in the comment.

To test:
* Please check diff of the patch closely.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f5d0667f5a1eb6898c14a5cefddfe9c21609762d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a57bc7313125831010d05cba727182f689b93a9b)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35186: Remove unnecessary html tags from PASSWORD notices
Katrin Fischer [Sun, 29 Oct 2023 15:42:36 +0000 (15:42 +0000)]
Bug 35186: Remove unnecessary html tags from PASSWORD notices

In HTML notices we don't need to explicitly use <html></html>.

This removes them from the 2 notices using them:
* PASSWORD_RESET
* STAFF_PASSWORD_RESET

To test:
* Apply patch
* Make sure your Koha can send email (set up SMTP server, KohaAdminLibraryAddress)
* Make sure your patron has an email set
* In patron account, use "More > Send password reset"
* Log out
* In the OPAC, request password reset ("forgot your password?")
* Verify both notices appear nicely formatted (line breaks, bold, etc.)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit e772b96cacb509a54a52427262da03efd4e38015)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 9d4042cfd675be1e05c7a74ff0ffc872f025e00d)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 29811: Add timestamp option on authority record type
Thibaud Guillot [Thu, 6 Jan 2022 13:48:36 +0000 (14:48 +0100)]
Bug 29811: Add timestamp option on authority record type

According to the timestamp option for bibs record type I added the
timestamp option for authority records.
Timestamp is already present in database on field "modification_time"

Test Plan :
1 - Be sure to have authority record type for easiest test create one
2 - Execute script export_records.pl in your koha/misc directory and
choose a date (example yesterday if you just created an authority
right now).(see export_records.pl -h for help)
3 - Timestamp option has no effect on authority record type
4 - Execute script again but choose the date of tomorrow for example
5 - Same result
6 - Apply this patch
7 - Play again steps 2 and 4
8 - On step 2 you will see only your authorities created today (because
script show you authority has changes since the date you choose in
option) and for step 4 you must see an empty file.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 24ee60cb62cfbe5dc80bbb698eb6fa1e99d1cd4e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit e5d014de8c25bcf39dad1b0ee7e77f209b6b0996)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 22712: Make 'Show inactive funds' button on addorderiso2907.pl work for item...
Nick Clemens [Mon, 23 Oct 2023 19:56:21 +0000 (19:56 +0000)]
Bug 22712: Make 'Show inactive funds' button on addorderiso2907.pl work for item budgets

This requires enabling MarcItemFieldsToOrder, see bug 34645

Add an inactive Budget and some funds to your system

Import a file with multiple biblios

Confirm the button hids/displays the funds for all item orders

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 60ed1898a09b638ddbf16c5b0054348cd3967832)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b49fc7ea341f85f04ba478469b4b8df5f38a307f)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 31393: Tidy
Tomas Cohen Arazi [Mon, 30 Oct 2023 12:00:31 +0000 (09:00 -0300)]
Bug 31393: Tidy

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f1bbdee7ac8a49a5ba85686d8a0edb59efecc8ba)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 550bc76328e97244a009be5402f951e8ebea70c3)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 31393: Koha::Config: handle the special case for 'content' attribute
Julian Maurice [Mon, 26 Jun 2023 13:25:12 +0000 (15:25 +0200)]
Bug 31393: Koha::Config: handle the special case for 'content' attribute

<key content="value"></key>

was wrongly parsed as

{ key => 'value' }

whereas it should be

{ key => { content => 'value' } }

The 'content' attribute is used in shibboleth config

Test plan:
1 Run `prove t/Koha/Config.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 6973625e7a06e66ee731ea8f5b69f296943c580f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 35ae7b467e54c38b8f99e392b02838e9fd53e9e0)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 32312: Add missing column descriptions to the statistics table
David Nind [Sun, 4 Dec 2022 01:33:32 +0000 (01:33 +0000)]
Bug 32312: Add missing column descriptions to the statistics table

This adds missing descriptions to the existing statistics database
columns.

It also improves some existing descriptions.

1. Go to Reports > Guided reports > Create guided report.
2. Choose 'Circulation' for the module to report on and select
   'Next'.
3. Choose 'Tabular' for the type of report and select 'Next'.
4. Scroll down to the statistics table section and note that there
   are no descriptions for:
   - statistics.other
   - statistics.location
   - statistics.ccode
   - statistics.categorycode
5. Note that:
   - the description for statistics.type is 'Type'
   - the description for statistics.itemtype is 'Item type'
6. Apply the patch.
7. Restart all the things (restart_all).
8. Reload the page.
9. Note that:
   . there are now descriptions for the columns in step 4
   . the description for statistics.type is now 'Transaction type'
     (to more clearly indicate what it contains)
   . the description for statistics.itemtype is now 'Koha item type'
     (consistent with other tables where this is used, such as items)
10. Sign off :D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@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 b0a8372c2f5eec6dd1671c0557bb82e3a71436db)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a530cf3088195da651e4cccd09809e898f9e0ee2)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35147: (QA follow-up) Capitalzation: Shibboleth Login
Katrin Fischer [Sat, 28 Oct 2023 22:44:56 +0000 (22:44 +0000)]
Bug 35147: (QA follow-up) Capitalzation: Shibboleth Login

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 9cea8312a5e2444ed142e44e2ca5041ba7373b7b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 6f383a05bf8c4644f49e2cef8bf9241dc2eb92f7)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35147: Add classes to Shibboleth text on OPAC login page
Aleisha Amohia [Wed, 25 Oct 2023 00:40:26 +0000 (00:40 +0000)]
Bug 35147: Add classes to Shibboleth text on OPAC login page

This enhancement makes it easier for libraries to change the Shibboleth-related messages on the OPAC login page.

Libraries can employ OPACUserJS to change the text. For e.g., I can replace the message "If you do not have a Shibboleth account, but you do have a local login, then you may login below." by putting the following in OPACUserJS:

$(".shib_local_text").text("If you do not have a staff member account, but are a member of the library, then you may log in below.");

To test:

1. Go to <your-opac-url>/cgi-bin/koha/opac-user.pl , or disable the OpacPublic system preference. Ensure you are logged out of the OPAC.
2. In the staff interface, search for the OPACUserJS system preference under Koha Administration. Add the following JS and Save:

$(".shib_invalid").text("Test changing the invalid Shibboleth login message.");
$(".shib_title").text("Test changing the Shibboleth login heading.");
$(".shib_url").text("Test changing the Shibboleth account link text.");
$(".shib_local_title").text("Test changing the local login heading.");
$(".shib_local_text").text("Test changing the message that shows if you do not have a Shibboleth account.");

3. Refresh the OPAC and confirm the text changes to reflect your JS. Note: The invalid Shibboleth login will be a bit harder to test, so if you can't test, confirm the HTML in the patch looks correct.

Sponsored-by: New Zealand Council for Educational Research
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 184299c9c84ee35cdd31149214710778648729ad)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 7eebf895b9f0f033134be303d5cb71e2028af5c7)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 32853: Fix cataloguing/value_builder/unimarc_field_125.pl
Julian Maurice [Fri, 3 Feb 2023 10:58:53 +0000 (11:58 +0100)]
Bug 32853: Fix cataloguing/value_builder/unimarc_field_125.pl

Use event parameter

This is part of the refactoring happening in bug 30975

Test plan:
1. Verify that the plugin continues to work as before

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 826aeaf22f36fb3ebacafdacf7c270cc72d8c5fe)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit dd34d7df04c8674cf32cf8d7daa001d773213535)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 32856: Fix cataloguing/value_builder/unimarc_field_126.pl
Julian Maurice [Fri, 3 Feb 2023 10:58:53 +0000 (11:58 +0100)]
Bug 32856: Fix cataloguing/value_builder/unimarc_field_126.pl

Use event parameter

This is part of the refactoring happening in bug 30975

Test plan:
1. Verify that the plugin continues to work as before

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 4fa7d59c61b524238b2e30f383ccda44e61e1096)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 57da913eae938a4968d4a9d3074ff807fef0b8cd)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35173: Correctly concat error strings
Martin Renvoize [Fri, 27 Oct 2023 10:48:07 +0000 (11:48 +0100)]
Bug 35173: Correctly concat error strings

This patch moves the call to $sftp->error outside of the double quote
string and into a . concat to properly expose the error message as
apposed to outputting 'Net::SFTP::Foreign=HASH(0x559c9118f0c8)->error'

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 43bd124f873ac118a9f87a5b5160ee99dc8b8a47)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 4c0191b69023167dba27830904ea6503f248f858)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35003: Make cancelled hold requests filter by branch
Lucas Gass [Fri, 6 Oct 2023 15:15:39 +0000 (15:15 +0000)]
Bug 35003: Make cancelled hold requests filter by branch

To recreate:
1. Make sure you have the "Default waiting hold cancellation policy" set to allow via circulation rules.
2. Make several holds at different branches  holds and set them to waiting
3. Request to cancel those holds, making sure you cancel some for different branches.
4. Go to waitingreserves.tt and notice that you see all of the holds from all branches.
5. APPLY PATCH and restart services
6. Vist the waitingreserves.tt page and notice that the "Holds with cancellation requests" table can now filters by branch.
7. Use the "View all libraries" and make sure you can see all the holds with a cancellation request.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 67f4fcc204c11998f9110d8ed723fa826c62a5ce)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit cb99c788f7c581b148a872c9ed3dcb013c369796)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35141: (QA follow-up) Increment the bad count
Marcel de Rooy [Fri, 27 Oct 2023 07:21:03 +0000 (07:21 +0000)]
Bug 35141: (QA follow-up) Increment the bad count

Also move earlier print to warn for consistency.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 3439185bb0b901e5a902cc8887fa07526f33ea55)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c3fda28fc565bbf5aad2031919681d63dca99640)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35141: Prevent link_bibs_to_authorities from dying on invalid metadata
Nick Clemens [Tue, 24 Oct 2023 12:01:09 +0000 (12:01 +0000)]
Bug 35141: Prevent link_bibs_to_authorities from dying on invalid metadata

When fetching the record we need to eval in case of exception

To test:
1 - Apply first patch
2 - perl misc/link_bibs_to_authorities.pl
3 - Note it dies on parser error at record 369
4 - Apply this patch
5 - perl misc/link_bibs_to_authorities.pl
6 - The process completes - with warning thrown on record 369

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 706641e747336eeb341172ed3d794d86551a45a9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit ed2bb9534a143b6ab894e6ab4e24d8c7dc9fd58e)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35141: Catch ES search exceptions in link_bibs_to_authorities, warn, and continue
Nick Clemens [Tue, 24 Oct 2023 11:51:29 +0000 (11:51 +0000)]
Bug 35141: Catch ES search exceptions in link_bibs_to_authorities, warn, and continue

This patch simplay adds an eval and a warning to link_bibs_to_authorities to catch any errors while searching and continue linking.

To test:
1 - edit /etc/kohia/sites/kohadev/koha-conf.xml and add to elasticsearch stanza
    <request_timeout>0</request_timeout>
2 - perl misc/link_bibs_to_authorities.pl
3 - It dies immediately
4 - Apply patch
5 - perl misc/link_bibs_to_authorities.pl
6 - Now it tries every record, throwing warnings along the way, but completes

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 22c0be31c73249fa534afb209f2a0229f84b7568)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 07cf6fccc0afdab10ac39ae33d6a9841cb1abf30)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34678: Allow new entries to overwrite hold_fill_targets
Nick Clemens [Wed, 13 Sep 2023 17:03:32 +0000 (17:03 +0000)]
Bug 34678: Allow new entries to overwrite hold_fill_targets

When using background jobs, there is a possibility of a race condition where two jobs will be updating the holds queue for the same biblio. We should try to minimize those cases (see bug 34596)

In the meantime though, we should prevent jobs possibly dying, and allow the most recent update to succeed.

There is a possibility two updates wil assign different items to the same reserve, and that a reserve could end up in the queue twice, however, whichever one is filled first will delete both entries. as filling the hold deletes by reserve id (see bug 24359)

This patch adds a transaction to delete and then inset the new row

To test:
1 - prove -v t/db_dependent/Reserves.t
2 - It fails
3 - Apply patch
4 - t/db_dependent/Reserves.t
5 - It succeeds!

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit bbeab36789d8dd020bc5395d76c54cc2910caf49)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a65964c35b2d38ec7bcd87182e00ae4567aa0ae4)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34678: Unit test
Nick Clemens [Wed, 13 Sep 2023 17:01:09 +0000 (17:01 +0000)]
Bug 34678: Unit test

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit dfad12d0790e38e739c610dd2a5f2345a053ed52)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b4a5c3213fb455e9795a3abf8a79531f10100f1b)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 33662: Add link to acq advanced search to acq navigation
Katrin Fischer [Fri, 15 Sep 2023 15:11:21 +0000 (15:11 +0000)]
Bug 33662: Add link to acq advanced search to acq navigation

Right now 3 clicks are needed to open the advanced search page
in the acquisitions module.

This adds a link to the advanced search to the left hand
module navigation.

To test:
* Go to acquisitions
* Verify the way is long to advanced search:
  At the top: Orders search > config icon > advanced search link
* Apply patch
* Notice new 'Order search' link on the left
* Verify it's way shorter now :)

Sponsored-by: The Research University in the Helmholtz Association (KIT)
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
  Renamed link from 'Advanced search' to 'Order search'
  Adjusted test plan

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 67930244ad5dc4e65e9e040b38d0080cb80b23b9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 156f0eac1e3ca3ff1b33453df2c71849685bd60c)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 33810: Opac advanced search fields need aria-labels
Matt Blenkinsop [Tue, 23 May 2023 14:49:08 +0000 (14:49 +0000)]
Bug 33810: Opac advanced search fields need aria-labels

The OPAC advanced search fields need aria-labels to assist with screen reading. This patch adds labels to both the dropdown selects and the text inputs

Signed-off-by: joubu <xxx@example.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 933c779b7d49525a561070dd8d60941f5f000c06)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 62fa8773c19f87c48ce70eb0c4ff8f7e46142a3a)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34954: Fixed typo to 'dateexpiry'
Laura Escamilla [Thu, 19 Oct 2023 18:25:51 +0000 (18:25 +0000)]
Bug 34954: Fixed typo to 'dateexpiry'

To test:

1. In KTD use grep -rn --exclude=*.po "datexpiry" *
2. Notice that the four locations below are showing the typo:
    1. git add koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt
    2. git add misc/release_notes/release_notes_18_05_00.html
    3. git add misc/release_notes/release_notes_18_05_00.md
    4. git add t/db_dependent/Koha/Patrons/Import.t
3. Apply patch. Repeat step 1.
4. Notice that no results show. All instances of the typo have been fixed to dateexpiry.
5. Sign off and have a great day :)

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 d742f29d77ee1e8a6f825678ce879d4a04037c92)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 9b87ae61ad81e056ff7f8972ee8deca86666e17b)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34910: (follow-up) alert in patron details
Fridolin Somers [Tue, 26 Sep 2023 08:11:39 +0000 (22:11 -1000)]
Bug 34910: (follow-up) alert in patron details

The anonymous patron details page should show an alert message.

1) Configure an existing borrowernumber in system preference 'AnonymousPatron'
2) Go to details page of this borrower :
   /cgi-bin/koha/members/moremember.pl?borrowernumber=x
3) Check you see alert 'This is the anonymous patron.'

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Johanna Miettunen <johanna.miettunen@haaga-helia.fi>
Signed-off-by: Päivi Knuutinen <paivi.knuutinen@joensuu.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit a8e770d9c49a88fbfd46c27b31d3eb2a413a1618)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 83b251e91d418e85d236c945e0edd52e601a7513)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34910: Do not allow checkout for anonymous patron
Fridolin Somers [Tue, 26 Sep 2023 07:53:45 +0000 (21:53 -1000)]
Bug 34910: Do not allow checkout for anonymous patron

The anonymous patron circulation page should show an alert message and not allow check-out.

1) Configure an existing borrowernumber in system preference
   AnonymousPatron
2) Go to circulation page of this borrower :
   /cgi-bin/koha/circ/circulation.pl?borrowernumber=x
3) Check you see alert 'This is the anonymous patron, so circulation is disabled.'

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Johanna Miettunen <johanna.miettunen@haaga-helia.fi>
Signed-off-by: Päivi Knuutinen <paivi.knuutinen@joensuu.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit aca49ca14b9f2d009f469144f975cd9fbf098181)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 9a64d2c93a97f387f89ae157bc379bf7b1261a4a)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34966: Terminology - fix add item form (& to and)
David Nind [Sat, 30 Sep 2023 06:27:39 +0000 (06:27 +0000)]
Bug 34966: Terminology - fix add item form (& to and)

This patch updates the add item form in the staff interface to
change the 'Add & duplicate' button to 'Add and duplicate'.

In our terminology guide, & should only be used when
it is part of a proper noun or a common abbreviation:
https://wiki.koha-community.org/wiki/Terminology

Test plan:
1. In the staff interface, search for and select a record.
2. Select New > New item.
3. Note that "Add & duplicate" is one of the action buttons at the
bottom of the add item form.
4. Apply the patch.
5. Refresh the page.
6. Note that the action button is now labelled 'Add and duplicate'.
7. Sign off! 8-)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katariina Hanhisalo <katariina.hanhisalo@xamk.fi>
Signed-off-by: Reetta Pihlaja <reetta.pihlaja@siilinjarvi.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 34897afc593148f30fd1cd6249f34a43643589bb)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 33606: (QA follow-up) Cosmetic changes
Marcel de Rooy [Fri, 23 Jun 2023 07:11:23 +0000 (07:11 +0000)]
Bug 33606: (QA follow-up) Cosmetic changes

Even the POD name wasnt changed after copying :)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 9c1dcfea13d6ac24bc9bceda601a95eb3f1a7623)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b702d1c6e713d0d5de458a88fe95ad5d8a33a3c1)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 33606: Fix settings
Pedro Amorim [Wed, 17 May 2023 16:28:23 +0000 (16:28 +0000)]
Bug 33606: Fix settings

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit e98eb4e0ad643fc57ce82b71caab2056284b1d45)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit e89d5599e0bc2b549e6632d931c6c6a2f91e5852)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 33606: Mark the endpoint as experimental
Jonathan Druart [Tue, 16 May 2023 12:33:29 +0000 (14:33 +0200)]
Bug 33606: Mark the endpoint as experimental

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 42eb2fd2c98275e979c44fa8b65dd9d7b128357e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d0c2829f1065c14c385675a7ed88c3a8e47b6bd4)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 33606: Add a erm/config route to retrieve the ERM config needed for the Vue app
Jonathan Druart [Tue, 25 Apr 2023 13:56:51 +0000 (15:56 +0200)]
Bug 33606: Add a erm/config route to retrieve the ERM config needed for the Vue app

This could be extended later in bug 32968 to pass the permission of the
logged in user.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit cda3c377a20c401ef9a755f24eb839d515a8af72)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 5078f9f4dff2788318bee544e00724fa2fbf1dad)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 33169: (QA follow-up) Fix some icons for lower FA version
Katrin Fischer [Wed, 25 Oct 2023 11:38:27 +0000 (11:38 +0000)]
Bug 33169: (QA follow-up) Fix some icons for lower FA version

In the navigation some icons were missing, because they had changed
names between versions, this restores them. Fixed icons concerned
the navigation items:

* Local
* Local > Titles
* EBSCO > Titles

(cherry picked from commit 102b21d2aed8b305a3ea3811804f1f334e3b86e5)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 33169: Add support for FA styles
Tomas Cohen Arazi [Wed, 21 Jun 2023 19:05:26 +0000 (16:05 -0300)]
Bug 33169: Add support for FA styles

Font awesome now provides a different approach to icon styles so you can
specify things like:

```
<i class="fa fa-camera-retro"></i>
```

but also

```
<i class="fa-solid fa-camera-retro"></i>
```

The original implementation had a hardcoded `fa` and having an extra
parameter for the *style* seemed overkill, as we would need to handle
even a list of styles like on this example:

```
<i class="fa-sharp fa-solid fa-camera-retro"></i>
```

So I chose to just explicitly require the full FA icon class and pass it
thru. With no manipulation on the Vue side.

This patch does that, and adjusts the 'style' for some icons, as
introduced by the FA v6 patchset.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 19221dc960532084e3e72e611403f4d2a43adfc9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 6079d70e2d3c519b0759174b2e48b2221d82830e)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 33169: Build breadcrumbs and left-hand side menu from routes definition
Agustin Moyano [Mon, 6 Mar 2023 19:44:44 +0000 (16:44 -0300)]
Bug 33169: Build breadcrumbs and left-hand side menu from routes definition

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit e3f88f0438232ab2c61129466aaa1fb205f4f720)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 31f48a6d19cb6023af7c2fe023b5f39a237d17d0)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35199: (bug 34448 follow-up) Fix error handling in http-client.js
Jonathan Druart [Tue, 31 Oct 2023 13:45:08 +0000 (14:45 +0100)]
Bug 35199: (bug 34448 follow-up) Fix error handling in http-client.js

From bug bug 34448.

386         // Submit the form, get 500
387         cy.intercept("POST", "/api/v1/erm/agreements", {
388             statusCode: 500,
389             error: "Something went wrong",
390         });
391         cy.get("#agreements_add").contains("Submit").click();
392         cy.get("main div[class='dialog alert']").contains(
393             "Something went wrong: SyntaxError: Unexpected end of JSON input"
394         );

This is wrong: we are now showing a JS error (SyntaxError) instead of the expected 500: internal server error!

The problem was that a regular 500 does not have anything in the body,
and _fetchJSON didn't handle that ( JSON.parse(text) ).
If the body of the response does not contain anything we need to get the
text from statusText (which contains "Internal Server Error" in case of
500).

Test plan:
1. Make sure all cypress tests pass
2. Confirm the above:
Raise an exception from a given route (/agreements for instance) and
confirm that the error displayed on the interface is correct (ie. not
SyntaxError, but "Error: Internal Server Error")

For QA:
* This change is covered properly in Dialog_spec.ts, no need to redo it in
every other test files.
* Without the following change in count, we see:
"Something went wrong: Error: Error: Internal Server Error" because
setError is called twice. We don't need to set the error from count, it
has been set from _fetchJSON already.
-            error => {
-                setError(error.toString());
-            }
+            error => {}

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit df3acf3d68cd24d3b1015432206236b563aaa5d1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit ae3804270d09e19be26e853e349f37de4e7b1c62)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35167: Make 'effective_not_for_loan_status' fallback to 0 if itype has it undef
Tomas Cohen Arazi [Thu, 26 Oct 2023 17:58:40 +0000 (14:58 -0300)]
Bug 35167: Make 'effective_not_for_loan_status' fallback to 0 if itype has it undef

This patch makes the effective not for loan status be set the item value
if not defined at itype level.

To test:
1. Apply the regressions tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/items.t
=> FAIL: Tests fail!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit b9ea3eb988b116ffc912fad9315533c7774a3754)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 34d08324fcc20c8c83bbbb87f0f1eff0481638f5)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35167: Regression tests
Tomas Cohen Arazi [Thu, 26 Oct 2023 17:56:35 +0000 (14:56 -0300)]
Bug 35167: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit c67d28c5f9136a96bfb665cd13f354af492e3233)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d37fbdb665e598cc630ac351d833d213be222f82)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35111: Ignore SIGPIPE in background jobs worker
David Cook [Fri, 20 Oct 2023 01:15:00 +0000 (01:15 +0000)]
Bug 35111: Ignore SIGPIPE in background jobs worker

This change explicitly ignores SIGPIPE signals in the background jobs
worker.

Daemons like Starman ignore SIGPIPE so it makes sense to explicitly set this.
Differences in the inner workings of MySQL vs MariaDB client libraries have yielded
different behaviours in automatic reconnections and potentially SIGPIPE handling,
so this helps to make the overall behaviour more consistent.

Test plan:
0. Apply patch and run "restart_all"
1. Go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=29
2. Click "Save" > "MARCXML"
3. Go to http://localhost:8081/cgi-bin/koha/tools/stage-marc-import.pl
4. Click "Choose file", choose the MARCXML file, click "Upload file"
5. Click "Stage for import"
6. Note the job is marked as "100% Finished"

7. In a separate window run "docker restart koha-db-1"
8. Repeat steps 3-5 for uploading file and running stage for import
9. Note that the job is marked as "100% Finished" as you'd expect

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Added comment on the SIG PIPE line.
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 2988c549719197a5a46a94039f7881b3e74e6e19)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b57dfb84bccd81c92e0c9176acf42043e0ac8363)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34520: DBIC schema
Tomas Cohen Arazi [Wed, 1 Nov 2023 18:24:43 +0000 (15:24 -0300)]
Bug 34520: DBIC schema

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit c7571c6a3295835c5016d02360af6ba7c4aecdeb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 9250630098cdad674baaf0d6b71a437099a362e7)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34520: DBRev 22.11.11.001
Tomas Cohen Arazi [Tue, 31 Oct 2023 14:02:20 +0000 (11:02 -0300)]
Bug 34520: DBRev 22.11.11.001

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 486d3582f2f6ec73982dca2082797c55ef78e5e2)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34520: Fix FK for item_groups in reserves for new installations
Katrin Fischer [Sun, 29 Oct 2023 14:14:37 +0000 (14:14 +0000)]
Bug 34520: Fix FK for item_groups in reserves for new installations

There was a discrepancy between the database update for reserves
and the kohastructure.sql definition. This makes sure that the
FK is always "ON DELETE SET NULL".

To test:
* Before applying this path
* sudo koha-mysql kohadev
* show create table reserves;

CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE

* Apply patch
* Run database update
* Check database again:

CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE

* reset_all (create a new database)
* Check database again:

CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 6dd4626711866fbf92b49f88770a6b3bfb75ddca)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d0090275b0fd2cd728183c072765a5a7cfdbbe54)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34908: Sort item types alphabetically by description when adding a new empty...
Aleisha Amohia [Tue, 26 Sep 2023 22:40:01 +0000 (22:40 +0000)]
Bug 34908: Sort item types alphabetically by description when adding a new empty record as an order to a basket

To test:

1. Go to Koha administration -> Item types. Add a new item type "B" with the description "Test" so it will be obvious if it is sorted by the code "B" instead of the description "Test".
2. Go to Acquisitions. Add to a basket from a new empty record
3. In the Catalog details section, note the Item type dropdown. Confirm your "Test" item type, is showing near the top of the list, indicating it has been sorted based on the code "B"
4. Apply patch and restart services. Refresh the page.
5. Open the Item type dropdown again and confirm your "Test" item type is showing in the expected alphabetical order.

NC amended patch - tidied

Sponsored-by: South Taranaki District Council
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 0ef83c041d55cb95a4fd839101135126c3d9854a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 0237ad8eb48d7bdeac9648d37ebdbccbb87cf2bc)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35148: before_send_messages plugin hook does not pass the --where option
Kyle M Hall [Wed, 25 Oct 2023 13:34:53 +0000 (09:34 -0400)]
Bug 35148: before_send_messages plugin hook does not pass the --where option

The before_send_messages plugin hook currently sends all the non-smtp related options with the exception of the --where option. This should be added.

Test Plan:
1) Install the latest version of the kitchen sink plugin (
   https://github.com/bywatersolutions/dev-koha-plugin-kitchen-sink/releases
   )
2) Apply this patch
3) Run process_message_queue.pl with a --where option
4) Run the command: ./misc/cronjobs/process_message_queue.pl --where "letter_code='test'"
5) Note the output looks like:
Plugin hook before_send_message called with the params: $VAR1 = {
          'verbose' => 0,
          'where' => 'letter_code=\'test\'',
          'letter_code' => [],
          'type' => [],
          'limit' => undef
        };

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1508e81505f978b473f06b9f8e71a8f22721a7f5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 247b9da1723d08d14a4f413f78b582f5eba8ed63)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35069: Fix hold ratios items needed column sorting
Lucas Gass [Mon, 16 Oct 2023 23:03:03 +0000 (23:03 +0000)]
Bug 35069: Fix hold ratios items needed column sorting

This patch adds the data-sort attribute to the "Items needed" column to
ensure proper sorting.

To test:
1. Make a lot of holds.
2. On some holds have a high enough holds/copies ratio so the "Items
   needed" has values greater than 10.
3. Sort by that column. Notice the copies with an "Items needed" higher
   than 10 do not get sorted correctly.
4. APPLY PATCH
5. Try steps 1 -3 again. Everything should sort properly.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 2ce68244991fc90b4606e1aa06e874c9854107a2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a6c53078a633db278b8a16b5ef7303e34446ee65)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35127: Fix 'Search type' for patron search
Jonathan Druart [Tue, 24 Oct 2023 13:32:53 +0000 (15:32 +0200)]
Bug 35127: Fix 'Search type' for patron search

We need to fallback on the syspref DefaultPatronSearchMethod but keep
the value when one is passed!

Test plan:
Search for patrons, and use the "search type". Set it to different
values than DefaultPatronSearchMethod and confirm that the value is
kept.
Fix is expected when searching for patrons in the header (use the
options to select a different value and run the search)

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 e08bf3bb4c4ef8208f7895c000397e4122664c57)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit e9363693e026ebea2117a750c078dd71d4c0a1bb)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35072: Fix invalid usage of "&amp;" in JavaScript intranet-tmpl script redirects
Michał Kula [Mon, 23 Oct 2023 13:51:40 +0000 (15:51 +0200)]
Bug 35072: Fix invalid usage of "&amp;" in JavaScript intranet-tmpl script redirects

These escapes were invalid in these places, as HTML entity escapes
are meant to be used only inside of HTML elements/attributes, not
inside of JavaScript code.

These URLs would be sent out by the browser as-is, and that'd usually
work on the default install only coincidentally. Unfortunately, on some
setups (such as when using reverse proxies), this would break, and the
URL after "&amp;" would have been truncated.

This small patch adjusts the URLs in templates to not use wrong escapes,
and makes them consistent with how URLs are formatted for JavaScript
redirects in most of the templates already.

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 da9f74e56aa3fcaab2a53f0211113d7600263806)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 37eb3092c19361c88ab0442219cd523832b24d2f)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34983: Force a sort order in JSON output of po2json
Marcel de Rooy [Wed, 4 Oct 2023 13:04:27 +0000 (15:04 +0200)]
Bug 34983: Force a sort order in JSON output of po2json

This patch does so by default. If you do not want them sorted,
export CANONICAL-0 on the command line.

Test plan:
Copy a staff PO file from misc/translator to test.po
Now run:   time misc/translator/po2json test.po > json1
And do:    time misc/translator/po2json test.po > json2
Run:       diff json1 json2; #They should be the same.
Now:       export CANONICAL=0
And run:   time misc/translator/po2json test.po > json3
And again: time misc/translator/po2json test.po > json4
And run:   diff json3 json4; # Lots of changes
Remove the created cruft. And signoff :)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
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 a5fc346403665cf6eb692f401bf1cca5ece3cb81)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 82d4eff906cf0b88b001cfe2f43f15d8e63f6ca6)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34731: (follow-up) Fix conditional variable declaration
Martin Renvoize [Mon, 11 Sep 2023 11:47:48 +0000 (12:47 +0100)]
Bug 34731: (follow-up) Fix conditional variable declaration

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34731: Use Koha::Notice::Message in EnqueueLetter
Kyle M Hall [Thu, 7 Sep 2023 15:40:59 +0000 (11:40 -0400)]
Bug 34731: Use Koha::Notice::Message in EnqueueLetter

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Letters.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34731: Throw exception if SendQueuedMessages is passed a bad message_id
Kyle M Hall [Thu, 7 Sep 2023 15:04:32 +0000 (11:04 -0400)]
Bug 34731: Throw exception if SendQueuedMessages is passed a bad message_id

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Letters.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35112: Fix return claims table showing on other patron tabs
Aleisha Amohia [Fri, 20 Oct 2023 01:02:30 +0000 (01:02 +0000)]
Bug 35112: Fix return claims table showing on other patron tabs

This patch fixes some unintentional changes introduced by Bug 25023.

To test:

1. Set a LOST authorised value in the ClaimReturnedLostValue to enable return claims.
2. Check out an item
3. Submit a return claim for the checkout
4. Refresh the patron page
5. Notice the return claims table is showing strangely when viewing the other patron tabs i.e. Checkouts, Holds, Restrictions.
6. Apply the patch and refresh the page
7. Confirm the return claims table only shows when viewing the Claims tab, as expected.

Sponsored-by: Pymble Ladies' College
Signed-off-by: Kelly <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35105: Fix patron accessor in Illrequest.pm
Pedro Amorim [Thu, 19 Oct 2023 10:42:48 +0000 (10:42 +0000)]
Bug 35105: Fix patron accessor in Illrequest.pm

Patron is nullable, so we need to consider undef return

Test plan, k-t-d:
1) Install FreeForm and enable ILLmodule, run:
bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh)
2) Visit /cgi-bin/koha/ill/ill-requests.pl
3) Create 'New ILL request'
4) Select the request type, input cardnumber '42' and select a library
5) Hit 'Create'
6) Manage the request created just now: click the request id or 'manage request' button from the table
7) Click "Edit request" from the top actions toolbar
8a) Input text in Patron ID e.g. 'asdasdasf'. Notice you get redirected to the table - now renders correctly.
8b) Input a patron id that doesn't exist e.g. '987654'. Notice you get an error upon saving "FK Constraint error",
go back to the table and verify it renders correctly.

In both instances, the request is saved with borrowernumber as NULL,
this was preventing the table from rendering because the 'patron' API
embed was trying to retrieve a patron - getting an empty resultset instead
of undef.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 540626ef1510f9cae567efe646bb72f520cfbf2e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 049285b441641d917c1d17bceff27a5f583db936)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35105: Regression tests
Tomas Cohen Arazi [Thu, 19 Oct 2023 18:05:59 +0000 (15:05 -0300)]
Bug 35105: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit c91e02a4d6b7ec75137fcd1fe17f1acf6d3b3236)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit adeb074491d5728f831e97d9e47417dda0368e40)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35124: Incorrect item groups table markup
Owen Leonard [Fri, 20 Oct 2023 17:01:00 +0000 (17:01 +0000)]
Bug 35124: Incorrect item groups table markup

This patch corrects the markup of the item groups table which is found
under the "Item groups" tab on the bibliographip detail page in the
staff interface.

The patch also adds the "NoSort" class to the "actions" column to
prevent it from being sortable.

To test, apply the patch and make sure the "EnableItemGroups" system
preference is enabled.

- In the staff interface, locate a record with items and view the detail
  page.
- Under the "Item groups" tab confirm that the table looks correct: The
  heading labels should be centered bold text.
- You should see sorting indicators on the "Display order" and "Description"
  headings but not on the last one.

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 174cd59cea0e9a69aa3d690ef25190c293345a83)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 0c3807caa01e6ffcf01028928fc226081f5d9c61)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34946: Remove the use of event attributes from self checkout and check-in
Owen Leonard [Thu, 28 Sep 2023 12:48:36 +0000 (12:48 +0000)]
Bug 34946: Remove the use of event attributes from self checkout and check-in

This patch removes the use of event attributes from the self checkout
and self check-in templates. These events are defined now along with the
other in-page JS.

To test you must have SelfCheckInModule and WebBasedSelfCheck
preferences enabled. And SelfCheckoutByLogin = cardnumber.

- Navigate to the self checkout interface
  (/cgi-bin/koha/sco/sco-main.pl).
- When the page loads, cursor focus should be automatically placed in
  the barcode field.
- Test the "munge history" feature from Bug 10016:
  [1] Start a web-based self-check session.
  [2] Enter a patron barcode.
  [3] Allow the self-check session to time out.
  [4] Use the back button.  You should get the patron barcode
      entry form; you should not be prompted to resubmit form input.
  [5] Enter a patron barcode, perform some transactions, then
      use the finish button.
  [6] Next, use the back button.  You should get the patron barcode
      entry form.
- Test the updated checkout_confirm function by submitting the "magic"
  barcode for checkout: __KOHA_NEW_CIRC__. The user's session should be
  ended.

- Navigate to the self check-in interface
  (/cgi-bin/koha/sco/sci-main.pl).
- Test the cursor focus and "munge history" feature on this page too.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 76d522a90346ccbdb38793c048d61e73e869d9a0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b27a2a2eb09a7390d9e56af2b03c42df6d692dcf)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35110: Authorities editor with JS error when only one tab
Fridolin Somers [Thu, 19 Oct 2023 19:17:57 +0000 (09:17 -1000)]
Bug 35110: Authorities editor with JS error when only one tab

Exactly like Bug 34251 for biblios :
When using the an authorities framework with all fields in the same tab, there is thrown a JS error in selectTab( "#tab0XX_panel" );
This is because no nav tabs are build in authorities/authorities.tt as BIG_LOOP has a length(size) of 1

Test plan :
1) Edit an authority framework, for example 'Meeting Name', to set all sufields in tab 0
   You may use SQL : UPDATE auth_subfield_structure SET tab=0 WHERE authtypecode='MEETI_NAME'
   Don't forget to restart memcached
2) Go to 'Authorities'
3) Click on 'New authority' then 'Meeting Name'
4) Check you don't see any JavaScript error
5) Check you can save

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 35110: (follow-up) Fix comment in addbiblio.tt

Change comment in addbiblio.tt since any biblio framework may use only
one tab.
Also fixes indenting using 4 spaces.

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>
Edit: squashed because follow-up fixes code introduced by the same
author.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 32e301df15d2eb73d43cb4cdbbb4b5b45bd3e784)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 748ea28983d1407686e42cd29c4cfedf821bf1bb)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35000: Fix OPACMandatoryHoldDates feature in opac-reserve
Marcel de Rooy [Tue, 10 Oct 2023 11:36:45 +0000 (13:36 +0200)]
Bug 35000: Fix OPACMandatoryHoldDates feature in opac-reserve

Somewhere (perhaps after bug 29012) this feature has been broken
somehow.
The fact that we have two inputs for the date and the active one
is one level deeper, requires a few adjustments in the jquery
selectors etc. (Note that two Required lines were visible too.)
The corrected jquery constructs become a bit complexer now.

Test plan:
Enable AllowHoldDateInFuture + OPACAllowHoldDateInFuture.
Set circ rule for book to test with allows item level holds.
Set OPACMandatoryHoldDates to no hold dates.
Place hold on a book in OPAC. Check that More options is collapsed.
(If you force item level holds, it will open.)
Set OPACMandatoryHoldDates to Hold start date.
Refresh place hold page. More options is expanded now.
Click Place hold. You should see an alert and focus goes to start date.
Set OPACMandatoryHoldDates to Hold end date. Repeat place hold.
Set OPACMandatoryHoldDates to Both hold dates. Fill one. Place hold.
Bonus: Place hold on multiple biblios. Repeat former steps.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit cd7a8840d54a8db00096e1e9044e600c226935a8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 28320fe33aab11f3ec4fd4ee33e80ca4c6c70fae)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35019: Add a CSRF token when deleting news
Emily-Rose Francoeur [Tue, 10 Oct 2023 17:30:43 +0000 (13:30 -0400)]
Bug 35019: Add a CSRF token when deleting news

I add a CSRF token as a parameter in the link for deleting a news
entry, which solves the problem.

TEST PLAN
1) Apply the patch
2) Go to "Tools > News > New entry"
3) "Display location" should be set to "Staff interface"
4) Fill in the fields
5) Return to the homepage
6) Delete the created news entry
7) The "Additional contents" page is displayed, and the deleted news
   entry no longer appears
8) Return to the homepage; the news entry no longer displays

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>
Edit: adapted the template change to latest master inline
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f4b858778268730d49dc9f11d9d2d9bf6faf3f6e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d9d95873427cff8347d2a8d83cbfff4cb3d7f89c)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 26994: List names in alphabetical order in Suggestion filter
Shi Yao Wang [Wed, 26 Jul 2023 16:58:39 +0000 (12:58 -0400)]
Bug 26994: List names in alphabetical order in Suggestion filter

Display list of names in alphabetical order when using the Suggestion information filter in Suggestions management

Test plan:
1. Add different purchase suggestions from various patron's names
2. Go to Acquisition > Suggestions
3. Click on the Suggestion information filters on the left-hand side
4. Use one of these drop-down menus: "Suggested by" or, "Managed by" or "Accepted by"
--> notice the list of names in menus, names aren't displayed from A to Z
5. Apply patch and refresh page
6. Redo step 4
--> notice now it's sorted alphabetically

Signed-off-by: Kelly <kelly@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit bcaaffa838c3276b8590863c826cb133dae03258)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 099d25a44a2e659eefb263f01e9f3efee5c843b4)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34171: Use barcodedecode when attaching items to another record
Katrin Fischer [Fri, 21 Jul 2023 15:25:00 +0000 (15:25 +0000)]
Bug 34171: Use barcodedecode when attaching items to another record

Bug 26351 added barcodecode that transforms scanned barcodes either
by using itemBarcodeInputFilter  or via a plugin to various pages in
Koha, including checkout and checkin. But the feature for attaching
items to a new record was missed.

To test:
* Add an item with barcode "ab" to any record
* Set itemBarcodeInputFilter to "Remove spaces from"
* Search for another record in the catalog
* Edit > attach item > "a b"
* The item is not found.
* Apply patch, restart_all
* Try again with "a b"
* Verify that the item is found and attached to the record

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit cd033bfc60f9700d0d52986a95da55a92c88ee01)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit e65437199ae3c2abb0467c14b2a3884be524b087)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34990: Add persistent header when sending msg to RabbitMQ
Marcel de Rooy [Thu, 5 Oct 2023 09:56:30 +0000 (09:56 +0000)]
Bug 34990: Add persistent header when sending msg to RabbitMQ

Test plan:
NOTE: It is very hard to add a Koha unit test for adding this
single header when communicating to RabbitMQ via Stomp plugin.
When we would mock the send, we are only testing if perl can
pass a hashref to a subroutine ;)

Do NOT yet apply this patch.
Make sure that RabbitMQ runs.
Stop the koha-worker for long_tasks:
  koha-worker --stop --queue long_tasks myclone
Stage a MARC file.
Check queues with rabbitmqctl list_queues.
Look for: koha_myclone-long_tasks 1  (at least 1)
Stop rabbitmq (something like /etc/init.d/rabbitmq-server stop)
Start rabbitmq (/etc/init.d/rabbitmq-server start)
Check queue again with with rabbitmqctl list_queues.
Look for: koha_myclone-long_tasks 0
Your messages have been gone.

Now apply this patch.
Reiterate the former steps. But note that you will still see
a non-empty queue in the last step:
koha_myclone-long_tasks 1 (at least 1)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5797f5095ecb9fc1eab3fe129eab83c048cc422b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 8c0ee5ce0dbeb5427b214060483e5235d8a6fa73)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 32305: Counterpart for es_indexer_daemon.pl
Marcel de Rooy [Wed, 18 Oct 2023 13:58:17 +0000 (13:58 +0000)]
Bug 32305: Counterpart for es_indexer_daemon.pl

This is a kind of copy-and-paste variant of background worker.
We probably could do better than having two scripts here ;)

Test plan:
See former test plan. Apply it to ES indexing.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Removed queue from query at MQ side. Discussed on IRC.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 709dabb7e8c6285d5c93ece3baed845123cd3a8e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 17560ba44333f23e611f74f3879287575c116d4c)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 32305: Worker should ignore wrong status or queue in MQ mode
Marcel de Rooy [Tue, 17 Oct 2023 14:43:32 +0000 (14:43 +0000)]
Bug 32305: Worker should ignore wrong status or queue in MQ mode

MQ mode: The worker has seen that MQ is running and consumes messages
instead of polling db only.

Test plan:
Stop worker for long tasks.
Make sure that Rabbit MQ runs.
Stage a file. (This adds a long task.)
Goto staff view of jobs and cancel this job.
Check if job is still in MQ with rabbitmqctl list_queues.
Now start worker for long tasks.
Check if job is gone in MQ with rabbitmqctl list_queues.
And check logfile for the adjusted warning like:
  [WARN] Job 5 not found, or has wrong status/queue main:: /usr/share/koha/misc/workers/background_jobs_worker.pl (134)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Removed queue from query at MQ side. Discussed on IRC.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f1edd8fe77897c0f293f3d11ac20fd9ddb8bde8f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 20b0687b74f923a65b5db0bee2a8a4d39af4e849)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35053: Make sure request is checked as an item-level request if item_id passed
Tomas Cohen Arazi [Tue, 17 Oct 2023 12:07:28 +0000 (09:07 -0300)]
Bug 35053: Make sure request is checked as an item-level request if item_id passed

This patch makes the validation code have the `$item` variable defined
when checking holdability, in the case both `item_id` and `biblio_id`
params are passed.

Otherwise, if the requested item is not holdable, but a biblio-level
hold *could* be placed, the item-level hold is placed.

This is highlighted by the regression tests.

To test:
1. Apply the regression tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/holds.t
=> FAIL: Tests don't pass. A request that should be rejected is allowed
because biblio-level hold is allowed.
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! Item-level rules are checked and thus the
request rejected (code 403)
5. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 82e0edd87606ce05511b33ddeeea10f2b9e68f3d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 8a945f3e811cfb39c0a0212554b1adfca2b041bb)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35053: Regression tests
Tomas Cohen Arazi [Tue, 17 Oct 2023 12:03:33 +0000 (09:03 -0300)]
Bug 35053: Regression tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 683b74d202d57f4c3fdad62d81b92bf49f7d1fc4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 6de7575caee576335b2a764a117b70cc1171c472)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35101: Stop screen from jumping back to top when using barcode.pl plugin
Lucas Gass [Wed, 18 Oct 2023 20:31:32 +0000 (20:31 +0000)]
Bug 35101: Stop screen from jumping back to top when using barcode.pl plugin

To test:
1. Set 'autoBarcode' to something other than 'don't generate automatically'
2. If the a framwwork make sure some 952 fields have the barcode.pl plugin enabled
3. Add a new item and click the '...' next to the 952 field with the barcode.pl plugin enabled.
4. The screen jumps back to the top, annoying.
5. Apply patch
6. Try again, it should not jump anymore!

Signed-off-by: Barbara Johnson <barbara.johnson@swbell.net>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit eec5d7e4be7d092f07e47468c50a4ec48b842dc1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 85d38e5ef587657ba5681825cbd0c5fda5094047)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34531: Fix template logic to not hide patron restrictions
Lucas Gass [Mon, 16 Oct 2023 19:37:41 +0000 (19:37 +0000)]
Bug 34531: Fix template logic to not hide patron restrictions

To test:
1. From BorrowerUnwantedFields Hide Gone no address flag (gonenoaddress) and Lost card flag (lost).
2. Got to memberentrygen.tt and see that Patron restrictions is now hidden
3. Apply patch, now the Patron restrictions field should not be hidden.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 7e23abcccb4868637d542147f25e6ca437ec5622)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 40a45f6d7545304bd4687a1c1673e5b0801eca46)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34980: Remove the use of event attributes from title-actions-menu.inc in OPAC
Owen Leonard [Sat, 14 Oct 2023 14:20:00 +0000 (14:20 +0000)]
Bug 34980: Remove the use of event attributes from title-actions-menu.inc in OPAC

This patch updates the include file used to show actions with each
search result, removing two instances of "onclick" in favor of an event
handler class which was already in use elsewhere.

To test, apply the patch and log in to the OPAC.

- Perform a catalog search which will return results.
- Test the "Save to lists" link under any search result. The "Save to
  lists" pop-up window should appear.
- View the contents of a list which contains some titles.
- Test the "Save to another list" control. The same pop-up window should
  be triggered.
- Tag at least one title in the catalog and view the "Tag cloud" page.
- Perform the same test with the "Save to lists" button in the table of
  our tags.

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 5dd4043b06b462080858061dc5bf6b1b193d5c33)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 743538abe787c98b36926518926968a00557b051)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35055: Exclude actions column from patron search results DataTables export
Owen Leonard [Mon, 16 Oct 2023 12:50:06 +0000 (12:50 +0000)]
Bug 35055: Exclude actions column from patron search results DataTables export

This patch updates the markup of the patron search results table so that
the "actions" column (Edit, Check out) are excluded when using the
DataTables "Export" button. The configuration was already in place but
the column header lacked the required class.

To test, apply the patch and perform a patron search which will return
multiple results.

Click the "Export" control at the top of the patron search results
table and choose "Print." In the print preview there should be no final
column containing "Edit" and "Check out."

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 5bad6a6d4963010c43f14f8af7c9dff7c03d36d4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c2970fd838688e6ac861a9e9e5595122ca1d7b00)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34462: (follow-up) Shorten card experiation message
David Nind [Thu, 28 Sep 2023 22:14:29 +0000 (22:14 +0000)]
Bug 34462: (follow-up) Shorten card experiation message

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 ab14e7f8ebe200de748a38f1d795c2588048aa3a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 28b8522ac62a29b78912980654ba94dac303ce98)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34462: Display the patron's expiration date
emilyrose [Thu, 28 Sep 2023 14:10:26 +0000 (10:10 -0400)]
Bug 34462: Display the patron's expiration date

The problem is in the patron_messages.inc file on line 25. The variable "expiry" is used, but it should be "patron.dateexpiry" because the patron's card isn't expired yet.

TEST PLAN
1) Go to “Patrons > + New patron”
2) Create a patron with an expiry date that is less than 30 days in the future
3) Go to the "details" tab of this account
4) Notice that the date is missing after "expires on":
"Expiration: Patron's card will expire soon. Patron's card expires on Renew or Edit details"
5) Apply the patch
6) Reload the page; the expiry date should now be displayed

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 7d4e5a66bd8ce72a997f7c4285efa84d4ee5c04f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 0231f8d14444a18fd8db2de1f5e5d4365ec2f1b7)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34204: Fix koha-shell under debian 12
Jonathan Druart [Wed, 11 Oct 2023 07:58:34 +0000 (09:58 +0200)]
Bug 34204: Fix koha-shell under debian 12

In Debian 12/Bookworm:
root@kohadevbox:koha$ koha-shell kohadev
This account is currently not available.

This is because /etc/passwd has /usr/sbin/nologin as shell, which is coming from the --disabled-login param we passed to adduser in koha-create.

Looks like a bug has been fixed in adduser, because we didn't have this behavior in bullseye.

Context:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=625758#72

"""
- change and document (adduser(8)) that --disabled-password will behave
  like --disabled-login and additionally set the shell to
  /usr/sbin/nologin.
"""
https://salsa.debian.org/debian/adduser/-/commit/427ade7d9116af5af7baa9d0c538e14fa86560cf

Test plan:
Confirm the above and that the change makes sense.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1c03352ae57a3c8f6f77d64a026a5d87d6f6830e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c3d30dc4e86aecbcbd87a5f5a2a057cdf86eb215)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34271: Remove a few Logger statements from REST API
Marcel de Rooy [Thu, 13 Jul 2023 14:23:22 +0000 (14:23 +0000)]
Bug 34271: Remove a few Logger statements from REST API

See also bug 22678.
We should call app->log->warn, ->debug, etc. instead of Logger.

Test plan:
The simplest way I tested V1, is add a app->log->warn in the try
blocks, restart all and check that your log4perl is set correctly
too.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit a3ce05012b8a2ee6b47c82d14f61c082798ab8a1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c2f1a41670f52835d1d0b00f12eb8faebc2ad636)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35064: Extra parenthesis in db_revs/220600072.pl
Blou [Mon, 16 Oct 2023 15:07:39 +0000 (11:07 -0400)]
Bug 35064: Extra parenthesis in db_revs/220600072.pl

See Bug 34332.

The same error it corrected is also present in the update process.

This patch simply removes an extra parenthesis in the tt instruction.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f0f860a43dd7bc32af36caf941a31efb8e24aca6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 1de535046a9285ddc5f1baf9d36f11b6fe71180c)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34119: Improve staff interface print stylesheet following redesign
Owen Leonard [Tue, 10 Oct 2023 15:12:12 +0000 (15:12 +0000)]
Bug 34119: Improve staff interface print stylesheet following redesign

This patch makes some updates to the staff interface print stylesheet in
order to make it work better following the staff interface redesign.

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

In the staff client, go to various pages and view the print preview. The
print view should exclude the header navigation, header search, page
toolbars and page sidebars.

- Pages with tabbed displays should show content from all tabs: e.g.
  bibliographic details, MARC editor.
- In Reports, check that report results print well.
- Pages with DataTables should print with table information visible but
  table controls hidden.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit c8748cd289f37cfa871b8fe368422c4ea58f1c0d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b95cde78ba81ff379e2384cdb4c973f506e9761b)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34119: (Preliminary) Run stylelint fixes on print.css
Owen Leonard [Tue, 10 Oct 2023 14:24:22 +0000 (14:24 +0000)]
Bug 34119: (Preliminary) Run stylelint fixes on print.css

This patch corrects errors raised by the new stylelint configuration in
print.css. Most of the fixes were made automatically by using the
"--fix" option:

npx stylelint koha-tmpl/intranet-tmpl/prog/css/print.css --fix

Some examples of errors fixed automatically:

- Expected indentation of 4 spaces
- Unexpected whitespace before ":"
- Unexpected unit
- Expected single space before "{"
- Expected newline after ";" in a multi-line declaration block

Errors from use of "!important" have been ignored.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit e8f6a3bfee47d90ad3db7f3a934e3f6af5c17032)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit dad427b2d6791383800bcf19cd2c3eed09c466f3)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34901: Display transit status on patron holds tab only if hold found value is "T"
Emily Lamancusa [Wed, 27 Sep 2023 16:35:58 +0000 (12:35 -0400)]
Bug 34901: Display transit status on patron holds tab only if hold found value is "T"

Check the transit status of the *hold* in addition to the transit status
of the *item*, to avoid displaying a misleading transit status on
item-level holds when the item is actually in transit for a different
hold

To test:
1. Create a record-level hold for Patron A for pickup at a library other
   than the logged-in library
2. Check in an item to fill that hold
3. Put an item-level hold on that same item for Patron B at a different
   library other than the logged-in library
4. Open Patron A's and Patron B's account details pages in separate tabs
--> Note that the Holds tab on Patron A's account detail page correctly
    shows that their hold is in-transit
--> Note that the Holds tab on Patron B's account detail page incorrectly
    shows that their hold on the same item is also in-transit
4. Apply patch
5. Clear browser cache
6. Refresh both patrons' account details pages
--> Confirm that the holds tab on Patron A's account still correctly
    says their hold is in-transit
--> Confirm that the holds tab on Patron B's account now correctly shows
    a blank status for their hold
7. Cancel Patron A's hold
8. Check in the item again to put it in transit for Patron B's hold
9. Reload Patron B's account page
--> Confirm that the holds tab on Patron B's account now correctly says
    their hold is in-transit

Signed-off-by: Katariina Hanhisalo <katariina.hanhisalo@xamk.fi>
Signed-off-by: Tuomas Kunttu <tuomas.kunttu@kouvola.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit fa1485639b6727061572c310731f9b5a3f79adcd)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 9411b66eaa35b415c670216ab8e695baa21f9e08)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35042: Remove set datelastseen to null on table in Members.t
Marcel de Rooy [Thu, 12 Oct 2023 09:56:25 +0000 (09:56 +0000)]
Bug 35042: Remove set datelastseen to null on table in Members.t

Non-trivial was adding the category_type <> S.

Test plan:
Run t/db_dependent/Members.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f08fc018670a356103a80a41ea83aa67e33476fa)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 6dbbbef3e9481d611c616e3af12f16316ea608e6)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35006: OPAC holdings table - Fix sort for library columns
Owen Leonard [Tue, 10 Oct 2023 12:03:18 +0000 (12:03 +0000)]
Bug 35006: OPAC holdings table - Fix sort for library columns

This patch updates the holdings table on the OPAC's bibliographic detail
page so that home and current library columns can be sorted correctly by
library name. There have been changes to the way the template shows
these values, but the DataTables "data-sort" attribute on the table cell
had not been updated accordingly.

To test, apply the patch set the OpacLocationBranchToDisplay system
preference to "home and holding libraries."

- Make sure home and holding library columns are not hidden in the
  table settings under Administration -> Table settings -> OPAC ->
  holdingst.
- Locate a bibliographic record in the OPAC which has multiple items
  from different libraries.
- Test that the home and current library columns sort correctly by
  library name.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 06d182bc82b40872970d99055c449d3c406724fa)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 4ebfdba0cb9513631c12454f81bcddc7228120a6)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34881: (QA follow-up) Remove stray paren
Nick Clemens [Thu, 12 Oct 2023 14:53:50 +0000 (14:53 +0000)]
Bug 34881: (QA follow-up) Remove stray paren

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 0128ce5b100df4f96a9b79076077459d3ea8b6c2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 43ab6e2825aee6c11c73b53981eb6963af580928)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34881: Improve idempotency of DBRev
Emily Lamancusa [Wed, 11 Oct 2023 13:40:05 +0000 (09:40 -0400)]
Bug 34881: Improve idempotency of DBRev

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit d9463f82c4344b93e4b5d0aea64339bb6c3d492a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit bcc160ebb659d5fdb70cef5322b44f41c5eff5d9)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 27249: Replace DateTime->now by dt_from_string
Julian Maurice [Tue, 10 Oct 2023 09:53:17 +0000 (11:53 +0200)]
Bug 27249: Replace DateTime->now by dt_from_string

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1a2288052dab4709ba5c1236bc8141384e2d1aa5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit ff565dd3b839199ce2a152f353cba882392080ac)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 27249: Add missing POD for Koha::Exceptions::Calendar
Julian Maurice [Tue, 10 Oct 2023 09:53:00 +0000 (11:53 +0200)]
Bug 27249: Add missing POD for Koha::Exceptions::Calendar

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 9e2a258f6f6213629c33bbc838b4fbac5366c544)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 1ddb79448ce1655005e322118bcedda4b86b567f)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 27249: Fix code style
Julian Maurice [Tue, 10 Oct 2023 09:52:26 +0000 (11:52 +0200)]
Bug 27249: Fix code style

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 4b4028d783a3660b9e16e647ef0e51c624ef3ff6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 7cb8e222e41e3ecab9ee678534f1ee046debb028)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 27249: Catch NoOpenDays exception while checking out an item
Julian Maurice [Thu, 24 Aug 2023 07:27:28 +0000 (09:27 +0200)]
Bug 27249: Catch NoOpenDays exception while checking out an item

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 4eec4020fa66f789f77637234aab81c46c3e6972)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b1feff4228b68260221fdad1d9fb2bee3904378a)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 27249: Prevent infinite loop when searching for an open day
Julian Maurice [Tue, 18 Jul 2023 08:26:03 +0000 (10:26 +0200)]
Bug 27249: Prevent infinite loop when searching for an open day

Calendars can be configured in a way that all days are closed.
The simplest way to do that is to configure a repeatable holiday for
every day of the week.
With such calendars, searching for an open day will literally take
forever.

This patch sets a hard limit on how many iterations are allowed before
giving up. This limit is set to the arbitrary value of 5000, which
should be large enough to be able to consider there is no open days if
we haven't found any with that many iterations, and small enough to
allow the loop to end quickly

Test plan:
1. Set system preference 'useDaysMode' to 'Use the calendar to push the
   due date to the next open day' ('Datedue'). Make sure the existing
   circulation rules do not conflict with that setting.
2. Browse to Tools » Calendar
3. Set every day of the week to "Holiday repeated every same day of the
   week"
4. Issue an item to a patron
5. Check the box and select 'Renew selected items'
6. The renewal should fail pretty quickly

Signed-off-by: Sam Lau <samalau@gmail.com>
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 2b58f4d89ca2d71c8979e4d87759fc45d63795f4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 0f304c55e23ab382237846acb80ce94838f3e3f8)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 34800: Adding openhub links for Koha contributors
Aleisha Amohia [Fri, 15 Sep 2023 03:41:56 +0000 (03:41 +0000)]
Bug 34800: Adding openhub links for Koha contributors

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 2a7be7d6c86926226dab4356be3f760f5c166d19)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 458517fe0c3351c748dc50e2916ba4cc118620f1)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoRmaint fix: Add exec flag to atomic update file for 22.11.11.000
Matt Blenkinsop [Mon, 13 Nov 2023 10:09:09 +0000 (10:09 +0000)]
Rmaint fix: Add exec flag to atomic update file for 22.11.11.000

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoBug 35079: Replace --force-extract by --generate-pot={always,auto,never}
Julian Maurice [Tue, 17 Oct 2023 15:13:55 +0000 (17:13 +0200)]
Bug 35079: Replace --force-extract by --generate-pot={always,auto,never}

This restores the original behaviour of always building the POT file
in order to not break existing workflows
Option --force-extract is deleted in favor of a new option
--generate-pot that can have 3 values:

* always: always build the POT file. This is the default value
* auto: build the POT file only if it does not exist
* never: never build the POT file

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 months agoBug 35079: Rebuild POT files only if necessary or asked explicitely
Julian Maurice [Tue, 17 Oct 2023 14:33:37 +0000 (16:33 +0200)]
Bug 35079: Rebuild POT files only if necessary or asked explicitely

By default, gulp tasks po:create and po:update won't rebuild the POT
files if they already exist.
Both tasks gained a new option --force-extract to rebuild them
unconditionally

This makes it possible to create/update PO files for multiple languages
sequentially without rebuilding the POT file for each language.
For instance:

    gulp po:update --lang fr-FR
    # do something with the PO files
    gulp po:update --lang en-GB
    # ...

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
6 months agoBug 35043: Do not have \n or \t appear in PO files
Jonathan Druart [Thu, 12 Oct 2023 10:35:12 +0000 (12:35 +0200)]
Bug 35043: Do not have \n or \t appear in PO files

This is a trick, so that we won't have to deal with \t in PO files.
\n is not a problem, but it seems consistent to use the same method for
both.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
6 months agoBug 35043: Use Locale::PO->quote
Jonathan Druart [Thu, 12 Oct 2023 09:44:16 +0000 (11:44 +0200)]
Bug 35043: Use Locale::PO->quote

We have our own "quote_po" sub that is stating that Locale::PO::quote
is buggy because it does not deal with quoting new lines correctly.
However it seems that it is fixed now.

Ideally we could use Locale::PO::quote everywhere, but it does not
escape tab characters:
  $string =~ s/\\(?!t)/\\\\/g;           # \t is a tab

This means the following:
msgid "Tabulation (\\t)"
msgstr "Tabulation (\\t)"
become:
-msgid "Tabulation (\t)"
-msgstr "Tabulation (\t)"

And we are seeing the following on Weblate:
https://snipboard.io/BjQmDC.jpg

Note that Locale::PO has not been updated since 2014...

The real problem behind this is that we have 2 methods to quote strings.
At first glance it seems that Locale::PO::quote was not used before, but
with the introduction of the koha-i18n project we will have scripts that
will use Locale::PO->save_file_fromarray, which uses Locale::PO->quote
=> Those scripts will be used on the translation server for post
processing (security reason, marking potential XSS strings as fuzzy).

Test plan:
0. Do not apply the patch
1. gulp po:update --lang LANG # Replace LANG with your favorite language
   code
2. git commit -a -m"init PO files"
3. Apply this patch
4. Repeate 1.
5. git diff
   => The change is about the "Tabulation" and "New line" strings from
      tools/csv-profiles.tt
6. Translate them (replace the \t and \n with %s) and remove the fuzzy
   flag
7. install the template: cd misc/translator && perl translate install
   LANG
8. Enable the language, use it and go to the "Nouveau profil CSV" view
   => Notice that the \t and \n are correctly displayed.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
6 months agoBug 35024: Do not wrap translations
Jonathan Druart [Wed, 11 Oct 2023 09:35:41 +0000 (11:35 +0200)]
Bug 35024: Do not wrap translations

PO files wrap differently depending on versions.

Looks like (thanks Julian!) it's coming from libunistring, between 0.9.10 and 1.0 I am seeing a change in how the strings in the PO files are wrapped.

Debian 11 (using libunistring 0.9):
"%s %sPrintemps%s %s %sÉté%s %s %sAutomne%s %s %sHiver%s %s %sPrtps%s %s %sÉté"
"%s %s %sAut%s %s %sHiv%s %s %s %s"

Debian 12, Ubuntu 22.04(using libunistring 1.0)
"%s %sPrintemps%s %s %sÉté%s %s %sAutomne%s %s %sHiver%s %s %sPrtps%s %s "
"%sÉté%s %s %sAut%s %s %sHiv%s %s %s %s"

It *could* come from this changes:
https://git.savannah.gnu.org/gitweb/?p=libunistring.git;a=blob;f=NEWS;h=5a43ddd7011d62a952733f6c0b7ad52aa4f385c7;hb=HEAD
   * The functions u*_possible_linebreaks and u*_width_linebreaks now make it
     easier to work with strings that contain CR-LF sequences: In this case,
     in the returned array, it will return UC_BREAK_CR_BEFORE_LF followed by
     UC_BREAK_MANDATORY (instead of twice UC_BREAK_MANDATORY).

The command used is:
% msgmerge --backup=off --quiet -F --update misc/translator/po/fr-FR-staff-prog.po misc/translator/Koha-staff-prog.pot

No matter the value of --width.

One solution is to use --no-wrap, and never wrap :)

I sent an email to the list about this suggestion https://lists.katipo.co.nz/pipermail/koha/2023-October/060143.html

Test plan:
% gulp po:update --lang LANG

And notice that the lines are no wrapped anymore.

Note that in master there were already not wrapped (?)
commit edd378f4d14d79107d662b053c8e6f750326dd23
Translation updates for Koha 23.05.00

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
6 months agoBug 34959: Sort PO files correctly
Jonathan Druart [Fri, 6 Oct 2023 14:48:57 +0000 (16:48 +0200)]
Bug 34959: Sort PO files correctly

The PO files are not sorted when we update them which leads to
unnecessary changes that are commited: hard to see differences and
make git index grow superfluously.

Test plan:
0. Do not apply this patch
1. gulp po:update --lang es-ES
2. git commit -a -m"First PO update"
3. Run again the gulp update command
4. git diff
=> You have a lot of changes generated here, the po:update is not
idempotent.

5. Apply this patch
6. Run the gulp update command
7 git commit -a -m"PO update after 34959"
8. Run the gulp update command
9. git diff
=> No changes are generated

Note that this patch will all the entries by files, and per line
numbers.
It fixes a bug in some condition, where we add information/context about
the string. For instance search for "For the first occurrence" in the
file. Prior to this patch this was not correct, we didn't add info about
the first occurrence (but whichever in the list).

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
6 months agoBug 34959: Remove unused sub
Jonathan Druart [Fri, 6 Oct 2023 15:17:51 +0000 (17:17 +0200)]
Bug 34959: Remove unused sub

Nothing special here, this sub is not used and we can remove it.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
6 months agoUpdate release notes for 22.11.11 release v22.11.11
Matt Blenkinsop [Tue, 7 Nov 2023 11:45:34 +0000 (11:45 +0000)]
Update release notes for 22.11.11 release

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoIncrement version for 22.11.11 release
Matt Blenkinsop [Tue, 7 Nov 2023 11:37:23 +0000 (11:37 +0000)]
Increment version for 22.11.11 release

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
6 months agoFix translations for Koha 22.11.11
Matt Blenkinsop [Tue, 7 Nov 2023 11:34:18 +0000 (11:34 +0000)]
Fix translations for Koha 22.11.11

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>