koha.git
2 months agoBug 34913: Fix a selenium test
Jonathan Druart [Tue, 3 Oct 2023 07:21:35 +0000 (09:21 +0200)]
Bug 34913: Fix a selenium test

t/db_dependent/selenium/administration_tasks.t ....... 3/3 Cannot show all entries from table //div[@id="libraries_wrapper"] at /kohadevbox/koha/t/lib/Selenium.pm line 247.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 204a840a4d71c677d49378588f4ed529cdc83fea)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit ad1c38b58911e0ae72f9cf33feada0be317598b2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 34913: DataTables upgrade: Update CSS and option names
Owen Leonard [Thu, 28 Sep 2023 17:43:32 +0000 (17:43 +0000)]
Bug 34913: DataTables upgrade: Update CSS and option names

This patch makes two categories of changes:

1. CSS changes to accommodate changes in DataTables default CSS and
   markup structure. I've tried to make sure all of our Koha-specific
   styles are still applying.

   This change necessitates a rebuild of staff interface CSS.

2. DataTables option names: In this version of DataTables you can't
   override a default which uses CamelCase (e.g. "pagingType") with one
   in "Hungarian" notation, e.g. "sPaginationType." Since we define many
   default options in prog/js/datatables.js in camel case, any template
   which previously used a Hungarian notation option to override the
   default has now been updated to use the CamelCase version.

   See https://datatables.net/upgrade/1.10-convert#Options for a summary
   of the different option name changes.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 60e3f1024ba485573e53488575afd605a364a8bb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 01d85cfd0baa511354f39b2074463abc3394d121)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 34913: Upgrade staff interface DataTables from 1.10.18 to 1.13.6
Owen Leonard [Thu, 28 Sep 2023 13:46:34 +0000 (13:46 +0000)]
Bug 34913: Upgrade staff interface DataTables from 1.10.18 to 1.13.6

This patch replaces 1.10.18 DataTables assets in the staff interface
with 1.13.6 versions.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 7e6221209cb83a2ad9d0c86e6a3b26a83b667ab0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 33db767d4f0c8d9cf12c6c27c61590e9a4838310)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 36359: [23.05.x] Fix bad rebase of opac-main.tt
Lucas Gass [Tue, 19 Mar 2024 16:12:49 +0000 (16:12 +0000)]
Bug 36359: [23.05.x] Fix bad rebase of opac-main.tt

To test:
1. Add a OPAC news item
2. Go to the OPAC home page, view source, and copy that into an HTML validator. See errors.
3. APPLY PATCH
4. Try step 2 again, errors should be fixed.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35819: (QA follow-up) Prevent warning on uninitialized retries count
Marcel de Rooy [Mon, 5 Feb 2024 11:13:15 +0000 (11:13 +0000)]
Bug 35819: (QA follow-up) Prevent warning on uninitialized retries count

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c86e6ee82d27640c5c66c534d1e93ddbbbc2c4fa)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 17032f89a35715f143529ea128580c33ac952350)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35819: Adjust es_indexer_daemon
Jonathan Druart [Tue, 30 Jan 2024 08:30:38 +0000 (09:30 +0100)]
Bug 35819: Adjust es_indexer_daemon

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Add forgotten module
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7c1d4716beba5aa0d2c77ad460b4e6982cfee236)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit febc2570de8feea490bd53c1f4434eafb3b5d960)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35819: Improve logging
Jonathan Druart [Fri, 26 Jan 2024 13:25:56 +0000 (14:25 +0100)]
Bug 35819: Improve logging

Log (warn) if the job will be processed later, but add a debug however.

Have a specific log for bad status

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 30e69ebc5644f8b3d0a79c5c36aeb5038b632a30)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit f8af6d50280137dfa94a1a04bccaf3139fb3a519)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35819: nack and not requeue if frame is invalid
Jonathan Druart [Tue, 23 Jan 2024 09:14:21 +0000 (10:14 +0100)]
Bug 35819: nack and not requeue if frame is invalid

If a frame cannot be correctly processed (most probably because the body
is not valid JSON) then we are not acking or nacking the frame and the
worker is stuck.

In this specific case we should nack without requeuing the frame.

NOTE that requeue must be 'true' or 'false', not 1 or 0, or the default
'true' will be used.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 83940925685af338be659ef7baa04a40bed9d97d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 87e3d35e84dbfe4f2bc3b7b8d67bd54e38cdc64b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35819: Add simple delay
Marcel de Rooy [Fri, 19 Jan 2024 07:10:02 +0000 (07:10 +0000)]
Bug 35819: Add simple delay

Here I add 500 ms. In my testing with the 1s sleep from the test
plan, I might see one or two 'not found' lines. Obviously things
depend on the time needed before the txn commits. But it will
reduce a flood of these messages.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0feb10df7f9473c8ccd14bea947c0957a839e059)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b1efcf3d15680493828894b7c1c0cb9557be1cb8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35819: Notify NACK and requeue when Job ID not found
Tomas Cohen Arazi [Tue, 16 Jan 2024 17:46:20 +0000 (14:46 -0300)]
Bug 35819: Notify NACK and requeue when Job ID not found

This patch makes the worker reject the incoming frame for putting the
message back in the queue, in the event the job id doesn't exist yet.
Which is the case when some actions are being triggered inside a
transaction which hasn't been commited to the DB yet.

To test you will need 3 KTD shells
(a) mysql:
   $ ktd --shell
  k$ sudo koha-mysql kohadev

(b) logs:
   $ ktd --shell
   # for restarting the worker and looking at the logs
  k$ sudo koha-worker --restart kohadev  ; tail -f /var/log/koha/kohadev/worker-*.log
(c) running the test:
   $ ktd --shell

1. Have (a), (b) and (c) terminals ready
2. On (c), run:
   $ perl -MKoha::Database -MKoha::BackgroundJob::BatchUpdateBiblioHoldsQueue -e 'Koha::Database->schema->txn_do( sub { Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue({ biblio_ids => [ 1 ] }); sleep 1;  } );'
=> FAIL:
   * (b) shows (once) an error about a job not existing
3. On (a) run:
   > SELECT * FROM background_jobs;
=> FAIL: Notice the job ID mentioned on 2 stands as 'new'.
4. Apply this patch
5. Ctrl+c on (b), and re-run to launch the worker with the patch applied
6. Repeat 2
=> SUCCESS (partial): The error about the job not existing is displayed
many times
7. Repeat 3
=> SUCCESS: The job ID mentioned on 6 stands as 'finished'.
8. Sign off :-D

Discussion:

* The `requeue` header I added is correct, but it is the default
  behavior anyway. I prefered to make it explicit, though.

* To avoid that bunch of retries, we should requeue with some delay. I
  didn't manage to make it work (yet) but there's a 'delay' plugin for
  rabbit [1]. We already install the 'stomp' plugin in
  koha-common.postinst. But this plugin requires downloading it. Which
  would require further investigation.

* As Nick and Marcel pointed, we need to revisit the whole architecture,
  the need of a MQ (DB polling wouldn't have this problem), etc. But
  that's for another place.

[1] https://hevodata.com/learn/rabbitmq-delayed-message/#:~:text=To%20delay%20a%20message%2C%20the,to%20queues%20or%20other%20exchanges.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1a51c2e973a1b6ce1116bbc243853112be96f0ea)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 83fb050b2f18e0f279df505c3ef5eb7942ecc992)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 36140: Correct label for attribute invoice.tt
Lucas Gass [Tue, 20 Feb 2024 23:19:01 +0000 (23:19 +0000)]
Bug 36140: Correct label for attribute invoice.tt

To test:
1. Go to /cgi-bin/koha/acqui/invoice.pl?invoiceid=X  where X is the invoice number.
2. Look at the Invoice number with your dev tools, the for attribute is wrong. ( shippingdate )
3. Apply patch and look again, the attribute should correctly be invoicenumber.

Alternatively, just look at the diff of this trivial change. :)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 214fc675cf8f3d7962aa02c03ee9cfc6f18e7973)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d6bdada36dd0dad4682a09869c21dd630c36ddea)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 36076: paycollect.tt add permission checks for manual credit and invoice
Fridolin Somers [Tue, 13 Feb 2024 09:49:17 +0000 (10:49 +0100)]
Bug 36076: paycollect.tt add permission checks for manual credit and invoice

In members/pay.tt one can see permission checks for manual credit and invoice :
CAN_user_updatecharges_manual_invoice
CAN_user_updatecharges_manual_credit

This is missing from members/paycollect.tt.
HTML is also missing classes manualcredit and manualinvoice.

Test plan :
1) Create a user with permissions to manage accounting
   (remaining_permissions under updatecharges) but without
   manual_invoice and manual_credit
2) Go to a patron account with an invoice
3) Click on "Make a payment", you dont see tabs manual credit/invoice
4) Click on "Pay" in "Actions" column
=> Without patch you see tabs manual credit/invoice
=> With patch you do not see them

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 52e7c8acf450e1b010c384619eca77a0f8846bfa)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c3a12820e3c2cb4f676955921a72c3650dc32f5d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35963: (QA follow-up): tidy up code and fix exec permission
Victor Grousset/tuxayo [Wed, 28 Feb 2024 04:52:41 +0000 (05:52 +0100)]
Bug 35963: (QA follow-up): tidy up code and fix exec permission

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 9b8cbf5c83a8f76f3b5eba5065aa5cb7aa26e1d2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 0126eeda7866d4cfa8321c7b36c20da4742934a8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35963: Fix bundled items table ordering and filtering
Julian Maurice [Wed, 7 Feb 2024 13:36:01 +0000 (14:36 +0100)]
Bug 35963: Fix bundled items table ordering and filtering

Using the many-to-many relationship results in the table alias `me` to
be used for table `item_bundles` instead of the expected table `items`.
This causes ordering and filtering to fail for columns Callnumber and
Barcode.
Using Koha::Items->search does not have this problem.

This patch also disables ordering by status because it does not work
(error message is: "Cannot find Koha::Object class for return_claim'")

Test plan:
1. Create an item bundle
   https://koha-community.org/manual/23.11/en/html/circulation.html#circulating-bundles
2. Add at least 2 items to this bundle
3. Verify that ordering/filtering by callnumber or barcode works
4. Run `prove t/db_dependent/api/v1/items/bundled_items.t`

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2753eec1ce8ce57afc10162936967d1f39c2b0b8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 05742ec900076e546a282fc7d7cd48f584fccf79)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35963: Add tests
Julian Maurice [Wed, 7 Feb 2024 13:36:01 +0000 (14:36 +0100)]
Bug 35963: Add tests

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 9344f4317083e9d70c3ff9e923447e80282ef01c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c23838f24f9b40d188cd662401960d4659b78560)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35952: Remove unnecessary line for OpacSuppressionMessage
Lucas Gass [Tue, 30 Jan 2024 20:38:15 +0000 (20:38 +0000)]
Bug 35952: Remove unnecessary line for OpacSuppressionMessage

To test:
1. Apply patch and restart all
2. Add an additional contetn entry for `OpacSuppressionMessage`, make
   sure it has a publication date in the past.
3. Make sure  OpacSuppression is set to 'hide'.
4. Suppress a record in the OPAC, ( 942$n )
5. Visit the detail page for that record and make sure you
   OpacSuppressionMessage customization displays.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c9f6a4981a69095029cf53a14fc799ed8581b196)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 5e0a2d4eea7e72c1fad5bf256c330d57e5475469)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35554: Authority search popup width 800px
Fridolin Somers [Tue, 12 Dec 2023 19:57:36 +0000 (09:57 -1000)]
Bug 35554: Authority search popup width 800px

Authority search popup is only 700 pixels width.
Most popups use 800 pixels, like the z3950 one.

Test plan :
1) Edit a biblio record
2) Click on value builder in a field linked to authority (ie 700)
3) Check popup is 800 pixels wide
4) Same with advanced editor

Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 112a76650cd8d84e41364fbdbc7610ac9badd511)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 0b4ffdfd2690dc01933bc6a2f90845c72b738460)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 36009: Document background_jobs_worker.pl --queue elastic_index
Julian Maurice [Fri, 23 Feb 2024 09:59:45 +0000 (10:59 +0100)]
Bug 36009: Document background_jobs_worker.pl --queue elastic_index

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 972efe8b5c8d22796437af87bfdf880d2fd659bf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit af3a850160dad9803c21682727c9a643410242bc)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 36009: Document koha-worker --queue elastic_index
Magnus Enger [Wed, 7 Feb 2024 07:51:36 +0000 (07:51 +0000)]
Bug 36009: Document koha-worker --queue elastic_index

To test:
- Copy the koha-worker script to the standard location:
  $ sudo cp debian/scripts/koha-worker /usr/sbin/koha-worker
- Check "sudo koha-worker --help" and verify elastic_index is
  mentioned in the list of "current queues"
- See https://wiki.koha-community.org/wiki/Testing_man_pages for
  how to check the "man" page. There should be a new paragraph
  about "Current queues" under "--queue"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3eff8d02b7ec4435a46972710786630518814cb0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 1a6c28d9c610897acf3fb193ca8356097f9ada42)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35398: (QA follow-up) Tidy code
Kyle M Hall [Tue, 2 Jan 2024 13:58:04 +0000 (08:58 -0500)]
Bug 35398: (QA follow-up) Tidy code

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ab7a8db43dbb240f111e3ea7eef5b9e0a1a62652)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 07a5a2ca59733e95cc0fc4b3adacd26bad74dabb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35398: Fix LRP support for EDI orders with single items
Martin Renvoize [Fri, 24 Nov 2023 13:06:37 +0000 (13:06 +0000)]
Bug 35398: Fix LRP support for EDI orders with single items

This patch corrects a mistake in the original implementaiton of bug
20595 where we introduced support for the LRP segments being used to
automatically assign items ordered via EDI to stock rotation plans.

Signed-off-by: Sophie Halden <sophie.halden@cheshiresharedservices.gov.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 783a58a9d3f26622450c7785182b175c71f50d5e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d96168e38f6ed8cb74967376d8f761f3bfe47900)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35398: Unit test
Martin Renvoize [Wed, 28 Feb 2024 16:40:39 +0000 (16:40 +0000)]
Bug 35398: Unit test

This patch adds the begginings of unit tests for Koha::EDI.  Right now
we only test that a simple QUOTE message creates a basket, adds the item
to said basket and assigns that single item to a corresponding stock
rotation rota as defined by the LRP segment in the QUOTE message.

It lays the foundations for much more rigorous tests to be written to
cover the whole of EDI.pm however.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit de79e957ce82d53d9978551f1d7ef593884daa29)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 4bd1aca6a7e4e616cea6a9bb3822922720bc9ee1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35398: Add unit test for extraction of library_rotation_plan
Martin Renvoize [Tue, 27 Feb 2024 13:45:53 +0000 (13:45 +0000)]
Bug 35398: Add unit test for extraction of library_rotation_plan

This unit test addition adds an LRP segment to the test EDI message file
and adds the corresponding test to confirm is it extracted into the
field as expected.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6744b9979a5b7029f9d35d19e680f8a03fcd8a75)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 425bc1240b8786caaa2b414d2f884922b3b1511f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35351: Adjust basket details template to avoid showing empty page-section
Owen Leonard [Thu, 16 Nov 2023 14:12:17 +0000 (14:12 +0000)]
Bug 35351: Adjust basket details template to avoid showing empty page-section

This patch makes a minor change to the markup of the basket details page
so that we don't display an empty div.page-section when there are no
orders.

Note: This patch includes whitespace changes, so please ignore
whitespace when viewing the diff.

To test, apply the patch and go to Acquisitions.

- Search for a vendor and add a basket if necessary.
- View the details of an empty basket.
- Under the "General information" or "Settings" sections there should be
  no empty white box.
- View the details of a basket which has orders (using the "Add to
  basket" process if necessary).
  - Orders should be displayed correctly.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit dde374e2ad1fa69deaebf21c2a569ecdb4c12594)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 1b11a323f5df01ef78a03fa8918ca0c8a4455732)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 36000: Fix CGI::param warning in catalogue search
Marcel de Rooy [Tue, 6 Feb 2024 12:31:28 +0000 (12:31 +0000)]
Bug 36000: Fix CGI::param warning in catalogue search

Speaks for itself.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3cf72dee6b52bbfadbb46b40d6d8fec5f3e2bf48)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a0492b210b38fb9e946e14ada50cc368d54db4d2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 36088: Remove useless code form opac-account-pay.pl
Kyle M Hall [Tue, 13 Feb 2024 20:04:53 +0000 (15:04 -0500)]
Bug 36088: Remove useless code form opac-account-pay.pl

The script opac-account-pay.pl sums the selected accountlines, formats the amount, pulls the currently active currency, and does nothing with any of this data.

Test Plan:
1) Apply this patch
2) Restart all the things!
3) Note there is no change in behavior

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
PA amended title (missing 'Bug ####:'

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit dd7ac62d3f184b7c76296389a16192a45fdadae0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit ebf8d687cc78da22c6bbb5b2bdf49845e3c2f089)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 36099: count and holdcount template vars into JS vars should default to 0 if...
Pedro Amorim [Mon, 26 Feb 2024 10:03:22 +0000 (10:03 +0000)]
Bug 36099: count and holdcount template vars into JS vars should default to 0 if empty

Visit:
http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=4321
Notice you have 2 console errors:
1) Uncaught SyntaxError: Unexpected token ';'
2) Uncaught ReferenceError: biblionumber is not defined

Apply patch. Repeat. Notice no error shows.
Visit an existing biblionumber. Confirm all is well.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f94d763b6a5d671c4860db76263f72d0643b7555)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d4e1ea5d71fd339c800215f95369cfae51c5ade7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 36156: None value selected on clone field/subfield linked to AV
Thibaud Guillot [Fri, 23 Feb 2024 12:12:42 +0000 (13:12 +0100)]
Bug 36156: None value selected on clone field/subfield linked to AV

When a field or subfield is linked to a list of authorized values and cloned, the selected value is repeated in the clone. This is linked to the default behavior of Select2Utils, so I've added a precise index (-1) to ensure that no value is selected in the clone.

Test plan:

1) Create a repeatable field and subfield and link a list of authorised values to the subfield.
2) Edit a record, clone the field and see which value is automatically selected in the clone.
3) Apply the patch
4) Repeat step 2

Sponsored by : BibLibre

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ed037fb2740418816b192abe06a250193ad05e40)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 4d7df951f3572ca7063f5bbd869618b29e6e8607)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 36098: Default to 'file' if pref does not exist
Jonathan Druart [Wed, 21 Feb 2024 08:42:16 +0000 (09:42 +0100)]
Bug 36098: Default to 'file' if pref does not exist

During the installer process there is a bunch of warnings
  "Use of uninitialized value $storage_method in string eq at"

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e2440f2c617c48d77cc416857937b6fb18c34208)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a42bce58b21c32868057dc0a45dde7580efae8f9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 36098: (follow-up) extend test to check driver
David Cook [Thu, 15 Feb 2024 23:07:02 +0000 (23:07 +0000)]
Bug 36098: (follow-up) extend test to check driver

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c42ede262a24503c1f350a8d2639a391b86278bf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 973b3ce069023ca6d06b29de8bdd0cd51736f2e6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 36098: Fix storage_method pass
David Cook [Thu, 15 Feb 2024 22:49:19 +0000 (22:49 +0000)]
Bug 36098: Fix storage_method pass

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5572567143c10b424765149bd97c2aa99d577132)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 941f34626a0720afd2c00bb4990b9eac7bc9eda8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 36098: Allow to pass storage_method
Jonathan Druart [Thu, 15 Feb 2024 13:05:21 +0000 (14:05 +0100)]
Bug 36098: Allow to pass storage_method

Will need this on follow-up bugs.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 56d8ac247698f8755a8215245dffd000877d76e7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit be03ca910f714e8991ff8e2e0163f3c0f9de2b08)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 36098: (QA follow-up) Add POD to Koha::Session
Martin Renvoize [Thu, 15 Feb 2024 11:53:02 +0000 (11:53 +0000)]
Bug 36098: (QA follow-up) Add POD to Koha::Session

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 09de3f820b5333e3f23f149f6b8c101d24ba15ed)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 0ff685f2289ea4e2c7aa1414f8e2e286fd8d6c84)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 36098: Add Koha::Session module to ease session handling
David Cook [Thu, 15 Feb 2024 02:49:18 +0000 (02:49 +0000)]
Bug 36098: Add Koha::Session module to ease session handling

This patch adds a Koha::Session module that makes it easier
to work with Koha sessions without needing the full C4::Auth module.

Test plan:
0. Apply the patch
1. Run the following unit tests:
prove ./t/db_dependent/Auth.t
prove ./t/db_dependent/Auth_with_cas.t
prove ./t/db_dependent/Koha/Session.t
2. Observe that they all pass

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0e6537d199fe49a9e91e1c75f9462ddf1c878fed)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit f927343a88ade7cf3fe860b60c41057e6ff39692)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35935: Ensure login branch will be used after incorrect login
Jonathan Druart [Tue, 30 Jan 2024 08:02:19 +0000 (09:02 +0100)]
Bug 35935: Ensure login branch will be used after incorrect login

If a different branch is selected after an incorrect login, the previous
branch will be used.

To recreate:
* login with foo/bar, select CPL => FAIL
* login with koha/koha, select another branch => OK but CPL is picked!

It was caused by a dup of "branch" in CGI param list (and first was
picked).

This patch patch also removes "koha_login_context" to not have it twice.
You can also open the source of the page to confirm that form#loginform
contains "branch" and "koha_login_context" in hidden inputs.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Tested in KTD. Works as advertised.
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7c54394383234f33dcf5b6acb8ceabb72d0deca4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b94bb009dca187cba85c072f1d7e00af484bdcea)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35949: Remove useless code pointing to branchreserves.pl in request.tt
Jonathan Druart [Tue, 30 Jan 2024 15:40:17 +0000 (16:40 +0100)]
Bug 35949: Remove useless code pointing to branchreserves.pl in request.tt

messagetransfert is never set (it is from circ/waitingreserves.pl, `git grep messagetransfert`) and branchreserves.pl does not exist!

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4b6508e7ea24dd188090ebc1e6e3dba820ece645)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a2bfc13866a6d1b3b9c877682d594af4157b3bbf)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 36176: Reject cud- for stable branches
Jonathan Druart [Wed, 28 Feb 2024 15:28:33 +0000 (16:28 +0100)]
Bug 36176: Reject cud- for stable branches

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 30999e675f1bb9d0088d1fbd355a552e25b42f20)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35941: (QA follow-up) Tidy clubs-tab.pl v23.05.09-01
Kyle M Hall [Tue, 30 Jan 2024 14:32:12 +0000 (14:32 +0000)]
Bug 35941: (QA follow-up) Tidy clubs-tab.pl

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 7d2204f2ce0c60263b050c72541c71462527fe5b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 7ca06148087b962252eea2f0a57e732ea795aa2d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2 months agoBug 35941: Limit club list to those from the logged in user
Jonathan Druart [Tue, 30 Jan 2024 13:53:03 +0000 (14:53 +0100)]
Bug 35941: Limit club list to those from the logged in user

clubs-tab get the patron's id from the parameter. At the OPAC we must
use the one from the logged in user, to prevent leak to other users

Test plan:
Have 2 clubs: A, B
Enroll to A with patron borrowernumber=1
Enroll to B with patron borrowernumber=2
Log in with patron 1 and hit:
  http://localhost:8080/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=1
=> OK
Now hit
  http://localhost:8080/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=2
=> oops

Apply this patch, try again.
The "borrowernumber" parameter is no longer used to fetch the club list.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit e51ef7ef76a4ee523b302d724d80118185030e60)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit afcb9d027765be35cc476f7e48b514c576a8cea1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoFix release notes for 23.05.09 part 2 v23.05.09
Lucas Gass [Thu, 29 Feb 2024 16:06:56 +0000 (16:06 +0000)]
Fix release notes for 23.05.09 part 2

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoFix release notes for 23.05.09 release
Lucas Gass [Thu, 29 Feb 2024 15:36:09 +0000 (15:36 +0000)]
Fix release notes for 23.05.09 release

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoUpdate release notes for 23.05.09 release
Lucas Gass [Thu, 29 Feb 2024 14:53:13 +0000 (14:53 +0000)]
Update release notes for 23.05.09 release

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoIncrement version for 23.05.09 release
Lucas Gass [Thu, 29 Feb 2024 14:43:00 +0000 (14:43 +0000)]
Increment version for 23.05.09 release

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35518: Follow-up for AutoSwitchPatron - clear $patron variable too
Michael Hafen [Thu, 15 Feb 2024 18:21:28 +0000 (11:21 -0700)]
Bug 35518: Follow-up for AutoSwitchPatron - clear $patron variable too

The AutoSwitchPatron clears the $borrowernumber variable to switch patrons.
With the AuthSwitchPatron block moved, the $patron variable still gets set,
and the patron doesn't get switched.  The clears the $patron variable too.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35518: follow up - clear the barcode list in AutoSwitchPatron block
Michael Hafen [Thu, 15 Feb 2024 17:32:48 +0000 (10:32 -0700)]
Bug 35518: follow up - clear the barcode list in AutoSwitchPatron block

The AutoSwitchPatron block got moved, and now the @$barcodes variable gets
filled and not cleared.  Leading to a 'Barcode not found' error when the
patron is auto switched.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35518: Tidy the moved blocks
Martin Renvoize [Thu, 8 Feb 2024 15:55:43 +0000 (15:55 +0000)]
Bug 35518: Tidy the moved blocks

This patch just tidies the moved blocks to get us past the QA script
check.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35518: Check authentication and set userenv before fetching userenv variables
Nick Clemens [Fri, 26 Jan 2024 14:10:01 +0000 (14:10 +0000)]
Bug 35518: Check authentication and set userenv before fetching userenv variables

Currently we get the userenv before we have set it correctly for the session

To test:
 1 - Sign in as a user with fast cataloging permission
 2 - Bring up a patron, type gibberish into barcode field to get a fast cataloging link
 3 - Check the link, it should have your current signed in barcode
 4 - Sign in to a different browser with a different user and at a different branch
 5 - Bring up a aptron in circulation and type gibberish into barcode field to get a fast cataloging link
 6 - It may have your branch, but it may also have the other user's branch from the other window
 7 - Keep entering gibberish to get a link until one user has the correct branch
 8 - Then switch to the other browser, and keep entering gibberish, watch the branchcode change
 9 - Apply patch, restart all
10 - Test switching between browsers. generating fast cataloging links
11 - Users should now consistently have the correct branch

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35942: OPAC user can enroll several times to the same club [23.05.x]
Kyle M Hall [Tue, 30 Jan 2024 15:58:02 +0000 (10:58 -0500)]
Bug 35942: OPAC user can enroll several times to the same club [23.05.x]

Test Plan:

1) Create 3 clubs, 1 limited to library A, 1 limited to library B and one not limited
2) Use a patron with home library A.
3) Go to the opac-user page, "Clubs" tab show 0/2 (the one from library B is not listed)
4) Browse to /cgi-bin/koha/svc/club/enroll?id=1
5) Reload that page a couple times
6) Note the patron is now enrolled in the same club multiple times
7) Delete those enrollments
8) Apply this patch
9) Restart all the things!
10) Repeat steps 2-7, note the lack of duplicate enrollments!
11) Repeat steps 2-10 for the staff interface

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 29510: (Rmaint follow-up) fix number of tests
Lucas Gass [Wed, 21 Feb 2024 23:42:25 +0000 (23:42 +0000)]
Bug 29510: (Rmaint follow-up) fix number of tests

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 29510: (follow-up) Adapt GET /patrons/:patron_id
Tomas Cohen Arazi [Wed, 17 Nov 2021 21:09:02 +0000 (18:09 -0300)]
Bug 29510: (follow-up) Adapt GET /patrons/:patron_id

This patch makes GET /patrons/:patron_id rely on this new behavior from the
objects.find helper.

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 29510: Make objects.find call search_limited if present
Tomas Cohen Arazi [Wed, 17 Nov 2021 21:03:00 +0000 (18:03 -0300)]
Bug 29510: Make objects.find call search_limited if present

This patch makes objects.find implicitly update the passed
*$result_set* to use search_limited. This way no object leaks could
happen without noticing.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t
=> FAIL: Tests fail because search_limited is not used
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! Results are correctly filtered based on userenv!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 29510: Regression tests
Tomas Cohen Arazi [Wed, 17 Nov 2021 21:02:17 +0000 (18:02 -0300)]
Bug 29510: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 34623: Update jQuery-validate plugin to 1.20.0
Owen Leonard [Wed, 20 Dec 2023 16:12:55 +0000 (16:12 +0000)]
Bug 34623: Update jQuery-validate plugin to 1.20.0

This patch updates the jQuery validation plugin in both the staff
interface and the OPAC to the latest version, 1.20.0.

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

Test various pages in the staff client to confirm that form validation
works as expected:

 - Patron password change form:
   - Password must conform to minPasswordLength
   - Password must not contain leading/trailing spaces
   - Passwords must match

 - Administration -> Add or edit budget:
   - Description, start date, and end date are required
   - Start date must be before end date

 - Administration -> Add or edit Z39.50/SRU server:
   - Server name, hostname, port, and database are required
   - Port, rank, and timeout must be a number

Perform the same check of the "Change password" form in the OPAC.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 36072: opac-request-article should check syspref
Marcel de Rooy [Tue, 13 Feb 2024 12:36:44 +0000 (12:36 +0000)]
Bug 36072: opac-request-article should check syspref

Note: This is handled now just like opac-reserve.

Test plan:
Disable ArticleRequests and hit the page.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35918: Fix auto library connect (AutoLocation)
Jonathan Druart [Fri, 26 Jan 2024 07:58:17 +0000 (08:58 +0100)]
Bug 35918: Fix auto library connect (AutoLocation)

This code is a bit weird, its purpose it to auto select the library depending on the IP.
A problem appears if the same IP is used, then the user's choice will
might be overwritten randomly by another library.

To recreate the problem:
Turn on AutoLocation
Use koha/koha @CPL for test
And the following config:
*************************** 1. row ***************************
branchcode: CPL
branchname: Centerville
  branchip: 172.18.0.1
*************************** 2. row ***************************
branchcode: FFL
branchname: Fairfield
  branchip: 172.18.0.1
*************************** 3. row ***************************
branchcode: FPL
branchname: Fairview
  branchip: 172.18.0.4

Connect and select CPL. Randomly FFL will be picked instead.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Tested this on top of 35890 and 35904 because git bz said they were required dependencies.
Figured out the IP Koha was seeing me as coming from in /var/log/koha/kohadev/plack.log.
Added that IP to the branchip for Centerville, Fairfield and Fairview. Set AutoLocation = Yes.
After this I could recreate the problem: If i left the "Library" field in the login screen
at "My Library" I got logged into a random library selected from the three i had set
branchip for. Applying the patches fixed this, as expected.
Tests pass, with AutoLocation off.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35918: Add test
Jonathan Druart [Fri, 26 Jan 2024 07:57:03 +0000 (08:57 +0100)]
Bug 35918: Add test

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 36092: Pass sessionID at the end of get_template_and_user
Jonathan Druart [Wed, 14 Feb 2024 08:45:45 +0000 (09:45 +0100)]
Bug 36092: Pass sessionID at the end of get_template_and_user

It seems safer to pass the logged in user and session info at the end of
the sub.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
3 months agoBug 36092: Pass the sessionID from checkauth if we hit auth
Jonathan Druart [Wed, 14 Feb 2024 09:33:11 +0000 (10:33 +0100)]
Bug 36092: Pass the sessionID from checkauth if we hit auth

If we hit the auth page we were not passing sessionID to the template

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
3 months agoBug 36092: Add test
Jonathan Druart [Wed, 14 Feb 2024 09:56:17 +0000 (10:56 +0100)]
Bug 36092: Add test

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
3 months agoBug 35890: Add tests for AutoLocation
Jonathan Druart [Thu, 25 Jan 2024 08:36:01 +0000 (09:36 +0100)]
Bug 35890: Add tests for AutoLocation

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
3 months agoBug 35890: Reject login if IP is not valid
Jonathan Druart [Wed, 24 Jan 2024 15:25:30 +0000 (16:25 +0100)]
Bug 35890: Reject login if IP is not valid

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
3 months agoBug 35890: Remove var loggedin
Jonathan Druart [Wed, 24 Jan 2024 15:24:51 +0000 (16:24 +0100)]
Bug 35890: Remove var loggedin

It is never used and add confusion

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
3 months agoBug 35904: (QA follow-up): tidy up code
Victor Grousset/tuxayo [Thu, 15 Feb 2024 03:18:37 +0000 (04:18 +0100)]
Bug 35904: (QA follow-up): tidy up code

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
3 months agoBug 35904: Make C4::Auth::checkauth testable easily
Jonathan Druart [Thu, 25 Jan 2024 09:35:41 +0000 (10:35 +0100)]
Bug 35904: Make C4::Auth::checkauth testable easily

This patch suggests to add a new flag do_not_print to
C4::Auth::checkauth to not print the headers and allow to test this
subroutine more easily.

We do no longer need to mock safe_exit and redirect STDOUT to test its
return values.

There are still 3 left:
1.
733         # checkauth will redirect and safe_exit if not authenticated and not authorized
=> Better to keep this one, not trivial to replace

2.
806         # This will fail on permissions
This should be replaced but testing $template->{VARS}->{nopermission}
fails, I dont' think the comment is better.

3.
828         # Patron does not have the borrowers permission
Same as 2.

2. and 3. should be investigated a bit more.

This patch also move duplicated code to set patron's password to a
subroutine set_weak_password.

Test plan:
Read the code and confirm that everything makes sense.
QA: Do you have a better way for this? Yes it's dirty!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
3 months agoBug 36034: Add test
Jonathan Druart [Wed, 14 Feb 2024 07:49:33 +0000 (08:49 +0100)]
Bug 36034: Add test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 36034: (bug 34893 follow-up) fix capture of return values from checkpw
Andreas Jonsson [Thu, 8 Feb 2024 10:57:03 +0000 (11:57 +0100)]
Bug 36034: (bug 34893 follow-up) fix capture of return values from checkpw

Adapt code to the change of return value type of checkpw
introduced in bug 34893

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35507: Add verbose parameters in Koha::Plugins
Marcel de Rooy [Fri, 15 Dec 2023 08:31:33 +0000 (08:31 +0000)]
Bug 35507: Add verbose parameters in Koha::Plugins

Yet another approach ;)
Driemaal is scheepsrecht / Third time lucky..

Test plan:
Run prove $(git grep -l Koha::Plugin | grep -P "^t\/db")

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d59bf322e9eb41b38ea35bf0e1a1955177c31cb3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 4fb9fad791f10469eeb43b8f54399c1e37c5c6a6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35507: Plugins.t - Mock SessionStorage, remove KitchenSink
Marcel de Rooy [Tue, 12 Dec 2023 14:07:49 +0000 (14:07 +0000)]
Bug 35507: Plugins.t - Mock SessionStorage, remove KitchenSink

Removing the CGI::Session behavior to auto-commit by mocking
SessionStorage makes that the $plugin->test_template does no
longer commit.

Since KitchenSink includes a CREATE TABLE, removing that code
removes the second implicit commit. We might move that code
to its own script?

Adds a missing rollback too at the end.

Test plan:
Run prove t/db_dependent/Koha/Plugins/Plugins.t
Verify that no records got added to plugin_data/methods table.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit dc62d9bed5799b9583bbc1ed59ea37972d7fe472)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit bfb2a929e30e30e7bf490364fc216ca69c966e62)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35596: Error in writeoff_debts documentation
Caroline Cyr La Rose [Mon, 18 Dec 2023 21:06:28 +0000 (16:06 -0500)]
Bug 35596: Error in writeoff_debts documentation

This patch corrects an error in the documentation of the
writeoff_debts.pl script. The --type parameter accepts debit type codes,
not credit type codes.

To test:
-  Run ./misc/cronjobs/writeoff_debts.pl
-  Make sure the sentence for --type makes sense, grammar and spelling
   are correct

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 633533049ad234f8705390e4b6c78987e90b2802)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 97cc3285bd0ce18541d0fbeef4e6996e33c395eb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35962: (bug 35843 follow-up 2) Fix BackgroundJob.t on D10
Jonathan Druart [Tue, 6 Feb 2024 07:32:31 +0000 (08:32 +0100)]
Bug 35962: (bug 35843 follow-up 2) Fix BackgroundJob.t on D10

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35962: (bug 35843 follow-up) Fix BackgroundJob.t on D10
Jonathan Druart [Wed, 31 Jan 2024 15:44:47 +0000 (16:44 +0100)]
Bug 35962: (bug 35843 follow-up) Fix BackgroundJob.t on D10

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoRevert "Bug 34979: Add unit test for comparing YAMl files with sysprefs.sql"
Lucas Gass [Mon, 12 Feb 2024 16:02:38 +0000 (16:02 +0000)]
Revert "Bug 34979: Add unit test for comparing YAMl files with sysprefs.sql"

This reverts commit 0aa7df0395a5d41a96efb72ddfbd4f51d3305461.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35373: Remove false FIXME comment from gather_print_notices.pl
Katrin Fischer [Fri, 12 Jan 2024 23:23:57 +0000 (23:23 +0000)]
Bug 35373: Remove false FIXME comment from gather_print_notices.pl

Removes a FIXME line mentioning bug 8000 that implemented
SendAllEmailsTo. But the note was added to the "From" line
and the "To" address is taken from a command line parameter.

To test:
* Review change carefully

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 898d96adb99861a639c5985a0a739b02e6decabd)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 1baddec5bebc46760507798a9311acb3a5bed0ec)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35354: Update description of EmailLibrarianWhenHoldisPlaced system preference
Katrin Fischer [Sat, 13 Jan 2024 00:08:04 +0000 (00:08 +0000)]
Bug 35354: Update description of EmailLibrarianWhenHoldisPlaced system preference

This includes more information about the email addresses
used in the system preference description.

To test:
* Search for EmailLibrarianWhenHoldisPlaced in administration >
  system preferences
* Verify description
* Apply patch
* Verify improved description and that the links work as expected

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a2a284c7f56e23174fcc52655273bf5c07282d62)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 3d12b0aa698f78b20977945985eae72d0da78ed4)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35701: (follow-up) Fix last instance of t variable
Owen Leonard [Tue, 9 Jan 2024 16:15:00 +0000 (16:15 +0000)]
Bug 35701: (follow-up) Fix last instance of t variable

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 976f5e7ce69723ddf82a8d3a28c82d7e60551050)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 63dec2431f5bd6b65fb2b1f65f0897371ef50445)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35701: Do not use t
Jonathan Druart [Thu, 4 Jan 2024 15:24:26 +0000 (16:24 +0100)]
Bug 35701: Do not use t

To not interfer with the t from I18N

On bug 35329 we are using the I18N TT plugin that is providing the 't'
subroutine.

This loop is redefining the subroutine, therefore it is not longer
accessible.

Test plan:
Edit a patron and confirm the the "Title" dropdown still contain the
different values of syspref BorrowersTitles.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 50904b219e203857f71985b729774b38121c8ee9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 66bf6e5e0e296c64cb8668ab57fb0c52f3313d71)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35835: Fix shebang in cataloguing/ysearch.pl
Marcel de Rooy [Thu, 18 Jan 2024 15:02:10 +0000 (15:02 +0000)]
Bug 35835: Fix shebang in cataloguing/ysearch.pl

Speaks for itself.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f34a639c58534534efe25dd2b3e98e84e79550ee)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 473bc55a63408a1e446ff4825747df85b006ff49)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 33457: (follow-up) Simplify even further
Martin Renvoize [Thu, 25 Jan 2024 11:55:42 +0000 (11:55 +0000)]
Bug 33457: (follow-up) Simplify even further

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit cd18b2e6fcc1b10bbb521ce1699ca9caeae8fdd8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 17c3b15c2ef7ff5aff47c7e477fe470355b026c4)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 33457: (QA follow-up) Use js-patron-format instead
Martin Renvoize [Tue, 23 Jan 2024 14:44:27 +0000 (14:44 +0000)]
Bug 33457: (QA follow-up) Use js-patron-format instead

This patch updates the code to use the $patron_to_html js function
rather than replicating it locally.. this means if in the future we
introduce further fixes/improvements to the display they're affect here
too.

Test plan
1) As for the original implementation, confirm the fix is still fixed

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4732d1080900b2437b1d30642e4ec6644ad6c900)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 26c27bd65d0a0082ae4f2ed8c13ed8c5a1b92590)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 33457: Improve display of fund users when the patron has no firstname
Owen Leonard [Tue, 16 Jan 2024 12:57:34 +0000 (12:57 +0000)]
Bug 33457: Improve display of fund users when the patron has no firstname

This patch updates the way the fund modification page handles patron
names so that a patron with only a first name or only a surname will
have their name appear correctly when selected as a manager or a user.

To test, apply the patch if necessary, create a patron with only a first
name and one with only a surname and give them acquisitions permissions.

- Go to Administration -> Funds.
- Edit a fund.
- Click 'Add users'.
- Select a user, only staff users will be searchable
- Select one of the patrons you created.
  - The patron name should appear correctly
  - Test with both your first name only patron and your last name only
    patron.
- Perform the same test with the 'Select owner' process.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 00ed806d204f60acb419052f177001d5a76b1310)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c5dc3cf3f49ec8e6ad1b7909ad1db939df8d2ad8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35865: Add missing hint about permissions when adding managers to a basket
Jonathan Druart [Mon, 22 Jan 2024 21:07:24 +0000 (22:07 +0100)]
Bug 35865: Add missing hint about permissions when adding managers to a basket

When searching for managers for an acquisition basket, the list of patrons is
limited to patrons with the baskets_managers permission. For other patron
searches there is a hint about the restriction but it does not appear here.

Test plan;
Edit a basket, click "Add user" to select a manager.
Notice the hint about the permission.

Signed-off-by: Loïc Vassaux--Artur <loic.vassaux-artur@outlook.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8a478f912fcd0eb6018449c8264497e55f9ae77e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a50ab3e6ddc524c2cf9d5100060080729e5aa11b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35817: Fix hint on patron's category when batch update patron
Jonathan Druart [Tue, 16 Jan 2024 12:41:59 +0000 (13:41 +0100)]
Bug 35817: Fix hint on patron's category when batch update patron

When a patron's attribute is limited to a given patron's category, the
batch patron modification tool will display a hint "This attribute will
be only applied to the patron's category %s". But this is followed by
the description of the patron's attribute, not the patron's category.

Test plan:
Create a patron's attribute "Color of hair" and select a patron
category (Patron).
Batch edit batch and select "Color of hair"
A hint will be display.
=> Without this patch the hint is "This attribute will be only applied
   to the patron's category Color of hair"
=> With this patch it will be corrected to "This attribute will be only
   applied to the patron's category Patron"

Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 074684eaf4f7845e6ad3cb50bd5f941dc5783746)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 5809d746d4f148817812de2b685083664e8b6806)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35695: Remove useless JS from cataloging_additem.js
Lucas Gass [Wed, 3 Jan 2024 22:57:32 +0000 (22:57 +0000)]
Bug 35695: Remove useless JS from cataloging_additem.js

To test:
1. APPLY PATCH
2. Turn on EnableItemGroups
3. Go to a record with item groups, or create some.
4. Add an item, making sure items can be added to a group. ( Bug 33639 must be applied )

If I am wrong and this code should stay, tell me. I'll fix the jQuery instead of removing it. :)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit cbc97f5c685e4e97f2d5f5c834f489869d5e2e4c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 5ab508d792c84d884eb349df44c54eeea544a7de)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35461: Fix function call parameters causing the HASH to show in the renew all...
Kyle M Hall [Tue, 2 Jan 2024 17:59:39 +0000 (12:59 -0500)]
Bug 35461: Fix function call parameters causing the HASH to show in the renew all responses

"Renew All" -function aka. 65-66-messages work like this: 66-return messages has renewed items in BM-fields and non-renewables go into BN-fields.

If all items were renewable, then the reply message looks like:

Reply:
13.07.2022 10:06:17:530 OUTESTI1 6610005000020220713 100616AOOUPK|BM564N15977171|BM564N09203960|BM564N23261720|BM564N25161958|BM564N23455012|C4::SIP::SIPServer=HASHC4::SIP::SIPServer=HASHAY6AZCEFE

If items include renewables and non-renewables, the response includes the renewed  items first, then a HASH mixed into the first BN-field, then rest of the renewed ones like they should show in BN-fields and after that, anohter HASH:

13.07.2022 14:41:32:610 OUTESTI1 6610003000420220713 144130AOOUPK|BM564N23455012|BM564N23261720|BM564N25161958|C4::SIP::SIPServer=HASHBN564N09203960|BN564N04191259|BN564N15977171|BN564N13788332|C4::SIP::SIPServer=HASHAY8AZC7C5

If all loans were unrenewable (this test included just one item), you first get a HASH in a BN-field, and another at the end.

13.07.2022 14:49:00:037 OUTESTI1 6610000000120220713 144858AOOUPK|C4::SIP::SIPServer=HASHBN564N19874533|C4::SIP::SIPServer=HASHAY9AZDD3B

Our self checkout/checkin machine can handle/parse these reply messages correctly, but this might not be the case with all self checkout/checkin devices.

Test Plan:
1) Unit test patch
2) prove t/db_dependent/SIP/Message.t
3) Note failures
4) Apply this patch
5) prove t/db_dependent/SIP/Message.t
6) Tests pass!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: lmstrand <lmstrand@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit bb7fc5025b6b76e06283d872fd50ac9a65ff25cf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a51094a715b60d75dd23c8e47f9f6b3ef41ce5f2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35461: Add unit tests
Kyle M Hall [Tue, 2 Jan 2024 18:01:57 +0000 (13:01 -0500)]
Bug 35461: Add unit tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e70e1f8a17f1a7aa507cc0fc5982b423612b1c98)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 52d43922b86ac11c413a17a1a4c1aad66b9399a5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35360: Make HTML/buttons consistent on waitingreserves.tt
Lucas Gass [Tue, 12 Dec 2023 22:48:22 +0000 (22:48 +0000)]
Bug 35360: Make HTML/buttons consistent on waitingreserves.tt

To test:
0. Turn on hold cancellation requests in Administration -> Circulation rules.
1. Have some holds that are waiting, waiting over expiration date, and cancelled waiting holds. In order to create holds waiting over expiration date, if you are in ktd, you can use SQL to update the expirationdate in reserves: UPDATE reserves SET expirationdate="2022-01-01" WHERE reserve_id=1; (make sure it's the correct reserve_id!)
1a. If you are not using ktd, you will need to set ReservesMaxPickUpDelay to 0 days, then return the reserved item and then wait one day before it will be marked as over expiration date.
1b. In order to create cancelled waiting holds, you will need to send a cancel request over the OPAC, that is, reserve something after logging in to the OPAC, return it in the staff interface, and then go to the OPAC -> Your Account -> Holds -> click Cancel on the waiting hold.
2. Notice the differences between the 3 tables and their related buttons:
-Holds waiting
-Holds waiting past their expiration date
-Holds with cancellation requests

-Holds waiting includes a 'Canceled selected' button at the top of the table. It is with in a #toolbar.

-Holds waiting past their expiration date includes a 'Cancel selected' and a 'Cancel all' button. None are within a #toolbar. The 'Cancel selected' here lacks a Bootstrap .btn class. The 'Cancel all' button does have a .btn class.

-Holds with cancellation requests has neither a 'Cancel selected' or a 'Cancel all' button.

3. APPLY PATCH
4. Look again and the tables/buttons should be more consistent.
5. The 'Holds with cancellation requests: X' tab should now include a 'Cancel selected (X)' button. Make sure is works.
6. Make sure TransferWhenCancelAllWaitingHolds is set to "Don't transfer" and make sure the hint displays well in the Holds over table.

Signed-off-by: Philip Orr <philip.orr@lmscloud.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit fea69c86079fddcbd4f339c87a03356a9ab4551d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit e0d5c13cf1c897ce1b12488992f9f9166ee508ba)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 34979: Add unit test for comparing YAMl files with sysprefs.sql
Katrin Fischer [Sun, 7 Jan 2024 21:54:29 +0000 (21:54 +0000)]
Bug 34979: Add unit test for comparing YAMl files with sysprefs.sql

The unit tests will help to detect any discrepancies
and missing entries in the YAML and sysprefs.sql files.

To test:
* Apply only this patch
* prove -v t/db_dependent/check_sysprefs.t
* It will fail.
* Apply other patches
* Run database update
* Re-run test. It should pass now.
* Recreate your database or reset_all with patches applied.
* System preferences should be installed correctly.
* Test should still pass.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 06ba28556254e443d0cc678c0f3d6aabd20f6767)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a1da7ef8f84db98b57fc443e6ea0603f1b014a72)

3 months agoBug 34647: (follow-up) Minor fixes
Owen Leonard [Wed, 24 Jan 2024 16:32:23 +0000 (16:32 +0000)]
Bug 34647: (follow-up) Minor fixes

This patch fixes the functionality of the <select> menu for jumping to a
particular vendor, "Choose a vendor in the list to jump directly to the
right place."

The patch also removes the empty anchor tag on the "Items with no
checkouts" report. It appears to be unused.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f3a069ad7fa1604a5e9996546e6ef8828bd9dc05)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b545b9424cec60d58924f11fc11965560c1334a9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 34647: Delete unnecessary anchor tag
Matt Blenkinsop [Wed, 24 Jan 2024 15:11:40 +0000 (15:11 +0000)]
Bug 34647: Delete unnecessary anchor tag

This patch removes an anchor tag from the form that does not seem to
serve any purpose. The form has an id attribute and it is this that
appears to be used for navigation to and displaying the form.

Test plan:
1) Navigate to Cataloging > marc modification templates
2) Add a new template or edit an existing one
3) The form to add a new action should be displayed when either the
   "New action" button is clicked or you select to edit an existing
   action

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a317923bfd0c13e3a46b50f6195f2d2efd8513bc)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 68336a8d4b7560dae9dea465569dc805bd1fdba3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 34647: Replace name attributes with ids
Matt Blenkinsop [Wed, 24 Jan 2024 15:08:56 +0000 (15:08 +0000)]
Bug 34647: Replace name attributes with ids

This patch replaces name attributes on <a> tags as this is now obsolete
in HTML 5. The recommended practice is to substitute these for ids, as
has been done in this patch

Test plan:
1) Navigate to each page where the link has been amended
2) Check that the link still works as expected

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8a07455e3beeb58ec934665d301bc76e4ef562a4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 7317b66b5a311f677107ba9333664bef3a55d317)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35894: Remove duplicate link
Matt Blenkinsop [Wed, 24 Jan 2024 14:09:19 +0000 (14:09 +0000)]
Bug 35894: Remove duplicate link

This patch deletes a link that appears to be an unnecessary duplicate
in the template file. The link does not appear in the UI and serves no
obvious purpose

Test plan:
1) Navigate to Acquisitions and click Search next to the vendors field
2) Click on a vendor name and the navigation should still work as
   intended, taking you to the Vendor's details page.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f931a0ac8089dc92cec46e1a66d92a8a1bafada4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b2e5be2b13ecf20949d8a27fcb181caecc0ac614)

3 months agoBug 30627: Verify --days parameter and use find command to select old backups for...
Andreas Jonsson [Mon, 6 Nov 2023 14:18:42 +0000 (15:18 +0100)]
Bug 30627: Verify --days parameter and use find command to select old backups for deletion

Test plan

* Create some old fake backups:

backuproot=/var/spool/koha
instance=kohadev

backupdir="$backuproot"/"$instance"

for i in 1 2 3 4 ; do
   for j in sql tar xxx ; do
      file="$backupdir"/"$instance"-$(date -I -d "- $i day").${j}.gz
      if ! test -e "$file" ; then
         touch -t "$(date +%Y%m%d%H%M -d "- $i day")" "$file"
      fi
   done
done

* Verify that --days parameter is validated

sudo koha-run-backups --days 0
sudo koha-run-backups --days foo

* Run backup

sudo koha-run-backups --days 3

* Verify that backups from 3 days have been preserved and older backups have been deleted
* Verify that filenames that do not match the pattern (the .xxx.gz files) are preserved

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b2e5efbdae0d607f6264235ca82d884b95c1a9ef)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit cadf36dc5fbf26640efc718f4e2a3f8dd4964753)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 29930: Cardnumber incorrectly set to userid on LDAP auth if cardnumber not mapped
Janik Hilser [Sun, 20 Feb 2022 17:14:31 +0000 (18:14 +0100)]
Bug 29930: Cardnumber incorrectly set to userid on LDAP auth if cardnumber not mapped

In the sub the userId was given, but the cardnumber was expected, therefore at every login the cardnumber changed to the userId.

To test:
1. Login to the OPAC with an LDAP account that has a cardnumber which is different to the userId
2. Check the patron record's cardnumber.
3. The cardnumber should equal to the userId
4. Apply the patch.
5. Login to the OPAC with an LDAP account that has a cardnumber which is different to the userId
6. Check the patron record's cardnumber.
7. The cardnumber should be the same as before

Signed-off-by: Alexander Wagner <alexander.wagner@desy.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Extra test plan:
1. Apply the regression tests
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Auth_with_ldap.t
=> FAIL: Tests fail! 'cardnumber' incorrectly overwritten
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests now pass!
5. Sign off :-D

Signed-off-by: Alexander Wagner <alexander.wagner@desy.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6341d520ac0a09baa5b005abb3d8d81273a6e310)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 884e3d5fe026c254ed1d2467f536e385ec2e7bf4)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 29930: Regression tests
Tomas Cohen Arazi [Tue, 16 Jan 2024 23:01:22 +0000 (20:01 -0300)]
Bug 29930: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Alexander Wagner <alexander.wagner@desy.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit fe006e535d5b95445905c0f9c48e04ec31de0476)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 49c4b0fee0a10d09b0ac35586c6d03fb4c9031df)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35843: Correct invalid exception
Marcel de Rooy [Fri, 19 Jan 2024 09:36:23 +0000 (09:36 +0000)]
Bug 35843: Correct invalid exception

Test plan:
Run background job tests. Especially the changed one.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Magnus Enger <magnus@libriotech.no>
All test pass when running this:
prove t/db_dependent/Koha/BackgroundJobs*
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 291268f3185cb48b6498a9d9121d9567bc0d3419)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 73577f17ad8f652e8364dc9e3f553faaf0b85b47)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 35663: Reword default privacy option in opac-privacy.pl
Owen Leonard [Tue, 2 Jan 2024 13:50:54 +0000 (13:50 +0000)]
Bug 35663: Reword default privacy option in opac-privacy.pl

This patch updates the description of the OPAC privacy page, replacing:

"Default: keep my history according to local laws. This is the default
option : the library will keep your history for the duration permitted
by local laws."

...with:

"Default: keep my history according to library policy. This is the
default option : the library will keep your history for the duration set
by library policy."

This correctly reflects the fact that privacy is managed according to a
Koha cron configuration.

To test, apply the patch and make sure the OPACPrivacy and related
preferences are enabled.

- Log in to the OPAC and click the "Privacy" tab in the left-hand
  sidebar.
- Confirm that the description of the default privacy option is correct.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8e8d4aaef71040a90b1052cc3970ff4ccb36a0ae)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 20ef488a8488f86126ca24a449b7ee92e53e22d8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 months agoBug 34479: (RMaint follow-up) Correct selectors for 23.05.x
Martin Renvoize [Wed, 7 Feb 2024 11:50:22 +0000 (11:50 +0000)]
Bug 34479: (RMaint follow-up) Correct selectors for 23.05.x

We renamed patron_search_selected to table_search_selections in
upstream, but missed that when backporting this bug.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
3 months agoBug 35474: (RMaint follow-up) Revert, depends on enhancement
Martin Renvoize [Wed, 7 Feb 2024 11:24:51 +0000 (11:24 +0000)]
Bug 35474: (RMaint follow-up) Revert, depends on enhancement

This reverts commit c8c9d21c694375227d38c2af65c0fb04fc3bbb69.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
3 months agoBug 34893: (RMaint follow-up) Fix test plan
Martin Renvoize [Wed, 7 Feb 2024 11:02:51 +0000 (11:02 +0000)]
Bug 34893: (RMaint follow-up) Fix test plan

Looks like we missed the test plan increment here, simple fix.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
3 months agoBug 34479: Update syntax for translatable string
Katrin Fischer [Tue, 16 Jan 2024 14:11:48 +0000 (14:11 +0000)]
Bug 34479: Update syntax for translatable string

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 63ec52160879b789e206d8bff533910d9b5abe91)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 79944eb6ee1014720aceb77b8feba6f9ec7c79ae)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>