koha.git
9 months agoBug 34847: Fix t/db_dependent/Search.t
Jonathan Druart [Fri, 22 Sep 2023 12:33:31 +0000 (14:33 +0200)]
Bug 34847: Fix t/db_dependent/Search.t

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

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

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

To test (applies to both patches):

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

Other possible combinations to test:

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

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

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

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

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

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

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

The new places the responsive DataTables extension is being used:

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

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

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

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

This depends on EnableOpacSearchHistory system preference being enabled.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Spelling typo fix

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

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

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

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

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

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

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

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

The API route for listing all suggestion:

/api/v1/suggestions

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

This patch fixes this too restrictive restriction.

TO TEST:

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

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

Having a custom status shouldn't cause issues

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

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

Please backport

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

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

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

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

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

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

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

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

When adding and deleting holidays, holidays might return
unexpectedly.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

PA amended patch: Added missing test plan step

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

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

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

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

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

* Adds description
* Adds column names to success messages

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

No test plan (fixing comment).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

To test:

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

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

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

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

This patch removes a useless Template Toolkit tag.

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

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

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

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

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

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

This fixes the failing tests introducd in bug 34223.

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

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

To test, apply the patch and go to Circulation.

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

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

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

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

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

PA amended patch: Added missing test plan step

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

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

To test:
1. Install a new language

   ./misc/translator/translate install xx-XX

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

3. Apply patch

4. Update the po files

   ./misc/translator/translate update xx-XX

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

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

To test:

1. Apply patch

2. Install language

   ./misc/translator/translate install xx-XX

3. Update po files

   ./misc/translator/translate update xx-XX

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

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

5. Change the strings so you know which is which

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

6. Apply translations

   ./misc/translator/translate install xx-XX

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 365121cae2d4df41333d4e2144acfe8c8a82b9a9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34163: Handle both anonymous userenv when generating CSRF tokens
David Cook [Fri, 30 Jun 2023 02:50:17 +0000 (02:50 +0000)]
Bug 34163: Handle both anonymous userenv when generating CSRF tokens

An anonymous session might have a userenv which is undef or which is
a hashref of undef/empty values.

This patch generates the "anonymous" prefix for undef/empty 'id'
values, which prevents CSRF errors when logging in via OAuth2/OIDC
following a Koha logout.

Test plan:
Before applying patch:
1. Go to https://wiki.koha-community.org/wiki/Testing_SSO
2. Set up OpenID Connect realm, user, client, and Koha
integration to Keycloak for koha-testing-docker as noted in the wiki

3. Go to http://localhost:8080/cgi-bin/koha/opac-main.pl?logout.x=1
4. Click on OIDC "Log in with XXXX" button and log into IDP
5. Note that you're not logged in and you instead see an error message like:
"There was an error authenticating to external identity provider wrong_csrf_token"

6. Apply patch
7. Go to "Sessions" section of the test realm in Keycloak
e.g. http://sso:8082/auth/admin/master/console/#/test/sessions
8. Click "Action" on the far right side of the screen
9. Choose "Sign out all active sessions"

After applying patch:
10. koha-plack --restart kohadev
11. Go to http://localhost:8080/cgi-bin/koha/opac-main.pl?logout.x=1
12. Click on OIDC "Log in with XXXX" button and log into IDP
13. Note that you're logged in

14. prove t/Token.t
15. Note all tests pass

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f965db69f1b1aaa0afaf7a3a48723f7e87c5b32c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 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: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 60d6d79b2232893ec84488bf17aa32adde8c01be)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 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: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit c030a5e5408956e16675c03c9412e1f5be45e013)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34731: Don't call SendQueuedMessages if message_id is bad
Kyle M Hall [Thu, 7 Sep 2023 15:15:25 +0000 (11:15 -0400)]
Bug 34731: Don't call SendQueuedMessages if message_id is bad

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 e0b3a6c2aaee82e2af2d817a98db1a749bbd1116)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 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: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 7eb195b6bdd0bdbf5bfa92a71b051935f78d1db4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34448: Update the way we handle response in http-client.js
Pedro Amorim [Mon, 31 Jul 2023 14:57:06 +0000 (14:57 +0000)]
Bug 34448: Update the way we handle response in http-client.js

Test plan:
Before patch:
- Visit a non-existent ID i.e. /cgi-bin/koha/erm/agreements/999
- Visit a char ID i.e. /cgi-bin/koha/erm/agreements/abc

Apply patch:
Repeat above steps.

Run cypress tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34448: Update cypress tests
Pedro Amorim [Mon, 31 Jul 2023 15:04:09 +0000 (15:04 +0000)]
Bug 34448: Update cypress tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34639: Restore order_by
Lari Taskula [Tue, 29 Aug 2023 19:14:56 +0000 (19:14 +0000)]
Bug 34639: Restore order_by

To test:
1. prove t/db_dependent/Koha/Item.t
2. Observe success

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 066c0b3e0de7b2d49f673cea0eddf67b3b5eb171)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34639: Use coderef for releationship
Nick Clemens [Tue, 29 Aug 2023 12:17:14 +0000 (12:17 +0000)]
Bug 34639: Use coderef for releationship

This patch switches from a simple relationship to a custom join as
illustrated in the DBIx::Class docs

Reference:
https://metacpan.org/pod/DBIx::Class::Relationship::Base#Custom-join-conditions

This does not include an order_by, so I am not sure if it is sufficient

To test:
1 - On command line:
    export DBIC_TRACE=1;
2 - Save simple script:
use Modern::Perl;
use Koha::Items;

my $items = Koha::Items->search( {'me.itemnumber'=>27}, {prefetch => 'current_branchtransfers'} );
my $item = $items->next;

warn $item->_result->current_branchtransfers->count();
warn $item->get_transfer();
3 - run it
4 - Note that the query doesn't include conditions on the transfers
5 - Apply patch
6 - Repeat
7 - Note that query is correct

Test in staf client:
1. Add an item to library A
2. Go to Circulation -> Transfer
3. Transfer the item from library A to another library B
4. Set your currently logged in library to library B
5. Check-in the item
6. Observe message "Item received from A"
7. View the bibliographic record of the item (catalogue/detail.pl)
8. Observe item in "In transit from A to B since xx/xx/xxxx Available"
9. Apply patch
10. Restart all
11. Reload details - item no longer in transit

Signed-off-by: Lari Taskula <lari.taskula@hypernova.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 74b205649bbbf59ab512e71dcad8d13046a13670)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34639: Add tests
Lari Taskula [Tue, 29 Aug 2023 09:34:04 +0000 (09:34 +0000)]
Bug 34639: Add tests

To reproduce:

1. Add an item to library A
2. Go to Circulation -> Transfer
3. Transfer the item from library A to another library B
4. Set your currently logged in library to library B
5. Check-in the item
6. Observe message "Item received from A"
7. View the bibliographic record of the item (catalogue/detail.pl)
8. Observe item in "In transit from A to B since xx/xx/xxxx Available"

To test:
1. prove t/db_dependent/Koha/Item.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1395bc00eb6bd9ec3d3f36d970972dc960ae6de8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34310: Input prompt in datatables column search boxes untranslatable
Owen Leonard [Thu, 20 Jul 2023 11:24:23 +0000 (11:24 +0000)]
Bug 34310: Input prompt in datatables column search boxes untranslatable

This patch corrects the internationalization function wrapped around the
"% search" string in datatables.js. It should be the double-underscore
function instead of the single-underscore.

To test, apply the patch and test that the placeholder string is
translatable. In this example I'm testing fr-FR:

- Update a translation:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for the strings pulled from
  JavaScript  e.g.  misc/translator/po/fr-FR-messages-js.po
  - Locate strings pulled from prog/js/datatables.js for
    translation, e.g.:

    \#: koha-tmpl/intranet-tmpl/prog/js/datatables.js:894
    \#, javascript-format
    msgid "%s search"
    msgstr "%s recherche"

  - Install the updated translation:

    > perl translate install fr-FR

In the staff interface, test a page that has column header filters, e.g.
patron search. Confirm that the table of search results shows the
translated string in the column header placeholders.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit c23f36b81218032ed2aa3f2f476fd880e2d1b704)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 28995: Update aliases
Martin Renvoize [Mon, 15 Nov 2021 09:35:04 +0000 (09:35 +0000)]
Bug 28995: Update aliases

Add an alias for added-before, added-after (Using an alias makes it
backwards compatible) and update the POD.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 8f7d565df51ac65d7b20b489a416355442fb141b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 28995: Add `--added_after` filter to writeoff_debts script
Martin Renvoize [Tue, 9 Nov 2021 10:33:01 +0000 (10:33 +0000)]
Bug 28995: Add `--added_after` filter to writeoff_debts script

This adds, as requested, the `added_after` filter option to
writeoff_debts.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 0a5f4350bdd85f1f8378970c1e7c8fb14f47f1a7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34666: Tidy
Nick Clemens [Tue, 5 Sep 2023 14:38:38 +0000 (14:38 +0000)]
Bug 34666: Tidy

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit fcf0ba17b55be93c4b63b1683ca2960e5edda0cd)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34666: Combine queries in _Findgroupreserve
Nick Clemens [Wed, 30 Aug 2023 18:56:59 +0000 (18:56 +0000)]
Bug 34666: Combine queries in _Findgroupreserve

The queries here are the same except for 2 differences:
1 - They check if the hold was on a particular item
2 - The latter confirms that the reserve item group matches the item's item group

For 1, it doesn't matter - only 1 item can be mapped ot a reserve, itemnumber is the primary key
for hold_fill_targets - so we are either matching it in the first query or the second, either way we get the same
reserve - the returns are the same so we don't care which query it came from

For 2, this has already been checked when the queue was built. We don't need to verify the match because
it wouldn't be in the targets if they didn't match

To test:
1 - Apply second unit test patch
2 - prove t/db_dependent/Reserves.t
3 - It should pass
4 - Apply this patch
5 - prove t/db_dependent/Reserves.t
6 - It continues to pass

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 72bfb416d3725bd11dc4595ac429d4c510d6d3ee)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34666: Add a second unit test for item level
Nick Clemens [Wed, 30 Aug 2023 18:54:15 +0000 (18:54 +0000)]
Bug 34666: Add a second unit test for item level

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 6f7ccdf6c3d4916ac19b7ace58068ff862a5ee24)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34666: Allow item_group to be null and still match
Nick Clemens [Wed, 30 Aug 2023 18:38:56 +0000 (18:38 +0000)]
Bug 34666: Allow item_group to be null and still match

The current logic requires that the grop ids match, but this eliminates null matches
from the group.

The fallout essentially is that the queue won't be checked to fill holds in cases of title level matches
where holds don't have an item group id. The queue checks the transport cost matrix while the check reserves
check does not, so this may have an impact on holds costs and delivery times

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

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 fe3872f62885b4b0ee483e446c0b2b85e74970f7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34666: Unit test
Nick Clemens [Wed, 30 Aug 2023 18:29:27 +0000 (18:29 +0000)]
Bug 34666: Unit test

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 99d7e55be67332fea1ced61ddf8105b4261923d8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34339: (QA follow-up) Replace new by search in Licenses
Marcel de Rooy [Fri, 8 Sep 2023 06:16:44 +0000 (06:16 +0000)]
Bug 34339: (QA follow-up) Replace new by search in Licenses

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 6f5915cf01b711d3a20af2634c9eb2a07d1bd289)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34339: Avoid relying on $c->validation - ERM
Jonathan Druart [Fri, 21 Jul 2023 14:35:05 +0000 (16:35 +0200)]
Bug 34339: Avoid relying on $c->validation - ERM

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit dd8b3c3da77562569b397c208d112107c4490bf2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34339: (bug 33556 follow-up) Easy ERM-related changes
Tomas Cohen Arazi [Thu, 8 Jun 2023 16:27:13 +0000 (13:27 -0300)]
Bug 34339: (bug 33556 follow-up) Easy ERM-related changes

I left the (easy) ERM cases out because it throws this when running the
QA script:

Processing files before patches
|========================>| 51 / 51 (100.00%)

An error occurred : Inconsistent hierarchy during C3 merge of class 'Koha::REST::V1::ERM::EHoldings::Titles::Local':
current merge results [
Koha::REST::V1::ERM::EHoldings::Titles::Local,
]
merging failed on 'Mojolicious::Controller' at /kohadevbox/qa-test-tools/koha-qa.pl line 112.

and didn't want this to pollute the rest of the changes.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5788f94868bde660179a183382aad42e9e3b40be)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34038: Fix incorrect use of __() in .tt and .inc files
Owen Leonard [Fri, 16 Jun 2023 14:29:42 +0000 (14:29 +0000)]
Bug 34038: Fix incorrect use of __() in .tt and .inc files

This patch corrects instances of the double-underscore function being
used in .tt and .inc files where the single-underscore function should
be used instead.

To test, apply the patch and update a translation, e.g. fr-FR:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for JavaScript strings, in this case
  misc/translator/po/fr-FR-staff-prog.po
- Confirm that the strings are now in the .po file for translation. You
  should find these lines:

- koha-tmpl/intranet-tmpl/prog/en/includes/js-biblio-format.inc: "No
  title."
- koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt:
  "Check in and add to bundle"
  "Ignore holds and add to bundle"
- koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step1.tt:
  "Please enter only a barcode, or only a biblionumber."
- koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/batch_add_items.tt:
  "Please enter only barcodes, or only biblionumbers."
- koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt:
  "Please specify a content for 'Default'"

- Check fr-FR-opac-bootstrap.po for these lines:

- koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc:
  "Please enter a valid date (should match %s)."
- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt:
  "No item was selected"
- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt,
  koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt,
  koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt:
  "No item was selected"

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit d1d9f4698eb2f959964d83d22b2079f07286a7c4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34223: (QA follow-up) Fix file permissions
Tomas Cohen Arazi [Wed, 6 Sep 2023 19:47:09 +0000 (16:47 -0300)]
Bug 34223: (QA follow-up) Fix file permissions

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 93dd749ecaf229a8860ba078668190e5bbfd61c6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34223: (follow-up) Mock backend in tests
Pedro Amorim [Thu, 27 Jul 2023 14:20:11 +0000 (14:20 +0000)]
Bug 34223: (follow-up) Mock backend in tests

Add a new request with a backend specific status

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit b00806774d3353086fc7c7e3def22f4de570c795)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34223: Add unit test for existing_statuses
Martin Renvoize [Thu, 27 Jul 2023 12:20:13 +0000 (13:20 +0100)]
Bug 34223: Add unit test for existing_statuses

This patch adds a unit test for the 'existing_statuses' method.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit cda13a73284ce049535f782dad794c6593e55ba9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34223: (follow-up) Restore status_alias handling
Pedro Amorim [Thu, 27 Jul 2023 11:25:20 +0000 (12:25 +0100)]
Bug 34223: (follow-up) Restore status_alias handling

By reducing the original call to all distinct 'status' we also removed
the status_alias combinations. This patch adds an additional distinct
query to fetch all 'status_alias' and add them to the returned data
structure.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit b67a4f8549d03a43ca771acc205779a78708240d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34223: Work around ONLY_FULL_GROUP_BY in Illbackend
Martin Renvoize [Mon, 10 Jul 2023 17:03:34 +0000 (17:03 +0000)]
Bug 34223: Work around ONLY_FULL_GROUP_BY in Illbackend

This patch re-works the query in the existing_statuses method to remove
the FIXME and improve performance.  We pass an SQL literal into the
query to make it explicit which illrequest_id we're looking for (which
dampens the SQL warning) even though we really don't mind which request
is returned here.

Test plan:

The following command will (hopefully) reset your ILL data and create 10k fake ILL requests (run this in DEV KTD only).

1) On an empty k-t-d, run:
bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev-data.sh)
2) Pet a cat
3) Visit /cgi-bin/koha/ill/ill-requests.pl and select a backend on the left side filters
4) Notice how the status filter takes a while (3-5 secs) to load
5) Apply patch and koha-plack --restart kohadev
6) Repeat 3, notice how the status filter now loads fast

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 87d1b1fdb61ea27effbac654d55923bf6abbe1ab)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34685: Make updatedatabase.pl propagate the error
Jonathan Druart [Fri, 1 Sep 2023 07:10:52 +0000 (09:10 +0200)]
Bug 34685: Make updatedatabase.pl propagate the error

updatedatabase.pl already return 0 even if an error occurred during the upgrade.

Test plan:
Adjust a db rev to make it fail and modify the value of the syspref 'version' in DB to
make the db rev run.

Run updatedabase.pl and `echo $?`

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 531fb2c9fd2e8b38ac1c6ef21be047bbb0358d7a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 34684: Prevent 220600007.pl to fail if run twice
Jonathan Druart [Thu, 31 Aug 2023 15:05:57 +0000 (17:05 +0200)]
Bug 34684: Prevent 220600007.pl to fail if run twice

The error is
  ERROR 1292 (22007): Truncated incorrect DECIMAL value: 'no'

Happens on MariaDB 10.5.22, not MySQL 8

Test plan:
update systempreferences set value="0" where variable="DisplayClearScreenButton";
play installer/data/mysql/db_revs/220600007.pl
select value from systempreferences where variable="DisplayClearScreenButton";
=> "no"

update systempreferences set value="1" where variable="DisplayClearScreenButton";
play installer/data/mysql/db_revs/220600007.pl
select value from systempreferences where variable="DisplayClearScreenButton";
=> "issueslip"

Signed-off-by: Kyle M Hall <kyle@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 027e1e18620e3c790e85ea49b3870f9ee7785871)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 30451: DBIC schema
Tomas Cohen Arazi [Wed, 6 Sep 2023 17:58:28 +0000 (14:58 -0300)]
Bug 30451: DBIC schema

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 9bb23b7d5e3606dad6e9b3976c3a1fad1cc2087a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 23548: (QA follow-up) tidy up code
Victor Grousset/tuxayo [Thu, 31 Aug 2023 21:00:46 +0000 (23:00 +0200)]
Bug 23548: (QA follow-up) tidy up code

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 3c6971d50cefa376df3a760519d1d9a8da1f5d71)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 23548: Set AQ to empty when item not exist
Per Larsson [Wed, 18 Sep 2019 08:50:37 +0000 (10:50 +0200)]
Bug 23548: Set AQ to empty when item not exist

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 2256a8532335f763346f13698cb840dd97ecafa3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
9 months agoBug 23548: Unit test - Set AQ to empty when item not exist
Matthias Meusburger [Thu, 17 Aug 2023 12:26:39 +0000 (12:26 +0000)]
Bug 23548: Unit test - Set AQ to empty when item not exist

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