Compare commits

...

996 Commits

Author SHA1 Message Date
Lucas Gass bc2b96d1f5
Bug 41421: [24.05.x] Fix DB update
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-12-10 10:56:58 -07:00
Jesse Maseto fecd3d02f0
Update release notes for 24.05.16 release
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-12-04 19:22:07 +01:00
Jesse Maseto b7b5fb363c
Increment version for 24.05.16 release
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-12-04 19:22:06 +01:00
Paul Derscheid 8ea64e150f
Bug 35830: DBRev 24.05.15.001
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-12-04 19:22:06 +01:00
Brendan Lawlor 111a71085e
Bug 35830: Add merge_borrowers subpermission
Merging patrons only required edit_borrowers permission
but would result in a patron deletion.

This patch requires a new merge_borrowers subpermission

To test:
1. Give a patron the following permissions
    catalogue, edit_borrowers, list_borrowers
2. Log into the staff interface as the patron
3. Do a patron search and select 2 patrons
4. Click merge patron - success - a patron got deleted
5. Apply patch, updatedatabase and restart_all
6. Repeat steps 3 and 4 - you can't
7. Add the new permission for merge_borrowers
8. Repeat steps 3 and 4 - now you can
9. prove t/Koha/Auth/Patrons.t

Sponsored-by: CLAMS
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-12-04 09:59:00 +01:00
David Cook e5d5b050e1
Bug 40524: [24.05.x] Update print format to use built-in formatter
This change updates the print format to use the built-in formatter
for operations like trim, strip HTML, strip newlines, and not
decoding entities.

Test plan:
0. Apply the patch
1. Go to http://localhost:8081/cgi-bin/koha/acqui/basket.pl?basketno=1
2. Click "add to basket"
3. Type "test" next to "From an existing record" and click "Submit"
4. On the "Gairm" row, click "Add order"
5. Fill in the required fields
6. In the "Internal note" put the following:
abc123
7. Click "Save"
8. In the Orders table, click "Export" and then "Print"
9. Note that the print page loads correctly, you can see the internal note,
and you cannot see lines for "Add internal note",
"Edit internal note", or "Add vendor note"

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-12-04 09:58:57 +01:00
Fridolin Somers d7a06b7947
Bug 40525: [24.11] Fix missing use raw
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 69aadbad4b)
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-10-29 15:14:01 -04:00
Jesse Maseto 1248f17d82
generate release notes for 24.05.15
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-10-29 15:13:58 -04:00
Jesse Maseto 6cea33acd6
generate release notes for 24.05.15
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-10-29 15:13:56 -04:00
Jesse Maseto a1c889ae32
increment version for 24.05.15 release
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-10-29 15:13:54 -04:00
Lucas Gass dd17036139
Bug 40818: [24.05.x] Replace raw with html filter for marc_lib
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-10-29 15:13:52 -04:00
Jonathan Druart bcb301c513
Bug 40818: [24.05.x] Remove HTML from marc_lib
Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-10-29 15:13:20 -04:00
David Cook 4dee52666c
Bug 40525: [24.05] Update spreadsheet format to escape formulas
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-10-29 15:12:51 -04:00
Paul Derscheid 6ad5eeefea
Update release notes for 24.05.14 release
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-30 18:22:51 +02:00
Paul Derscheid 9e8c19ef03
Increment version for 24.05.14 release
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-30 18:22:50 +02:00
Lucas Gass 68ed159703
Bug 40766: [24.05.x] Prevent XSS on set-library
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-30 18:22:50 +02:00
Jake Deery 78b0a04d6a
Bug 40748: [24.05.x] Fix RCE in update_social_data.pl
This patch fixes an identified RCE in the update_social_data.pl
social_data, which when executed, allows an attacker to run arbitrary
code on the system's shell.

TO TEST:

a)  In the Babeltheque_url_update syspref, wrap any bash in $(), and then
run the update_social_data.pl script.
    *)  For example, $(whoami >
/tmp/rce.log) will output to a file the username the perl script is
running as.
APPLY PATCH
b)  Run the update_social_data.pl script again. The string is now
meta-escaped, and the RCE no longer works.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Bug 40748: Check for HTTP URLs and skip shell when using system()

This change checks for HTTP(S) URLs and skips the shell when using
system() so that shell metacharacters aren't interpreted.

Test plan:
0. Apply the patch
1. Insert the following into the Babeltheque_url_update system preference:
$(whoami > /tmp/rce.log)
2. koha-shell kohadev
3. perl misc/cronjobs/social_data/update_social_data.pl
4. Note the script says the following:
$(whoami > /tmp/rce.log) is not a HTTP URL. Aborting.
5. Note also that /tmp/rce.log is not created
6. Change Babeltheque_url_update syspref to something like the following:
http://localhost:8080
7. perl misc/cronjobs/social_data/update_social_data.pl
8. Note that the wget succeeds but the bunzip2 fails (as expected) since
we haven't fetched a bzipped file
9. Try to create a payload that passes the HTTP URL test with shell
metacharacters and note that they're not interpetted and instead
just used as part of a URL string.

Signed-off-by: Jake Deery <jake.deery@openfifth.co.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-30 18:22:46 +02:00
Jesse Maseto 193efe1142
Update release notes for 24.05.13 release
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-08-28 12:02:41 -04:00
Jesse Maseto 7ecc047dbd
Increment version for 24.05.13 release
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-08-28 12:02:41 -04:00
Tomas Cohen Arazi 443c067d30
Bug 40579: Fix CSV formula injection vulnerabilities
This patch addresses CSV formula injection vulnerabilities by ensuring
all Text::CSV instances use formula protection.

Changes made:
* Add formula => 'empty' to all Text::CSV constructors in:
  - Koha::Patrons::Import
  - Koha::BackgroundJob::ImportKBARTFile
  - Koha::ERM::EUsage::CounterFile

The 'empty' formula mode causes potentially dangerous formulas (starting
with =, +, -, @) to be treated as empty strings rather than executed,
preventing CSV injection attacks while maintaining data integrity.

Security impact:
* Prevents execution of malicious formulas in CSV imports
* Protects against data exfiltration via CSV formula injection
* Maintains backward compatibility for legitimate CSV data

To test:
1. Apply the previous patch (author test)
2. Run:
   $ ktd --shell
  k$ prove xt/author/Text_CSV_Various.t
=> FAIL: Should show 3 files without formula protection
3. Apply this patch
4. Repeat 2
=> SUCCESS: All tests should now pass
5. Try importing CSV with formula content (=cmd|"/c calc",test,data)
=> SUCCESS: Formula content is rejected/emptied, not executed
6. Import normal CSV data
=> SUCCESS: Normal data imports correctly
7. Sign off :-D

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-08-28 12:02:40 -04:00
Tomas Cohen Arazi a0ef38c4c3
Bug 40579: Add author test for CSV formula injection protection
This test ensures all Text::CSV usage in Koha includes proper formula
injection protection to prevent CSV formula injection attacks.

The test scans all Perl modules and verifies that Text::CSV constructors
include the 'formula' parameter set to a safe mode ('empty', 'die',
'croak', 'diag', or numeric 1-5).

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove xt/author/Text_CSV_Various.t
=> FAIL: Test should fail showing files without formula protection:
   - Koha/Patrons/Import.pm
   - Koha/BackgroundJob/ImportKBARTFile.pm
   - Koha/ERM/EUsage/CounterFile.pm
3. Apply the follow-up patch to fix the violations
4. Repeat 2
=> SUCCESS: All tests should pass
5. Sign off :-D

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-08-28 12:02:40 -04:00
David Cook 81ef0aaccc
Bug 40538: Fix XSS in suspend hold modal
This patch fixes a XSS vulnerability in the
suspend hold modal in the staff interface.

By building our Javascript using Web APIs rather
than with strings and jQuery's html() method,
we're able to securely handle malicious payloads.

Test plan:
0. Apply the patch
1. Go to http://localhost:8081/cgi-bin/koha/reserve/request.pl?biblionumber=29
2. Add a hold for "koha" patron
3. Go to http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=51
4. Click "Holds" tab and click "Suspend"
5. Note the modal loads properly
6. Go to http://localhost:8081/cgi-bin/koha/members/moremember.pl?borrowernumber=51
7. Click "Holds" tab and click "Suspend"
8. Note the modal loads properly

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 40538: Simplify code

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-08-28 12:02:40 -04:00
Marcel de Rooy fa080e6b00
Bug 39906: (QA follow-up) Feature needs to be enabled specifically
See also comment33, point 4.

Test plan:
cp debian/templates/apache-shared-opac-antibot.conf /etc/koha/
Test enabling/disabling by toggling the comment of the SetEnvIf line,
restart apache and remove the KOHA_INIT and CGISESSID cookie.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-08-28 12:02:40 -04:00
David Cook 2f5428cb35
Bug 39906: Add a simple quick Apache-level bot challenge
This patch adds a fast simple bot challenge via Apache.

To test:
0. Apply the patch
1. sudo cp debian/templates/apache-shared-opac-antibot.conf /etc/koha/.
2. sudo cp debian/templates/apache-shared-opac-plack.conf /etc/koha/.
3. curl http://localhost:8080/cgi-bin/koha/opac-search.pl
4. Note an instant response with a very simple HTML response
5. Open an incognito browser and go to http://localhost:8080/cgi-bin/koha/opac-search.pl
6. Note a very brief loading animation before the OPAC search page appearing
7. Do a search
8. Note no more loading animation appears
9. Close the incognito browser
10. Open an incognito browser and go to http://localhost:8080/cgi-bin/koha/opac-main.pl
11. Do a search via the "Library catalog" search bar
12. Note no loading animation appears

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Cornelius Hertfelder <cornelius.hertfelder@bsz-bw.de>
Signed-off-by: Magnus Enger <magnus@libriotech.no>
We have tested this in production on at least three live sites for
several weeks, and it has worked as expected. We have not noticed any
negative side effects.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-08-28 12:02:39 -04:00
Martin Renvoize d077dcb01b
Bug 40022: [24.05.x] Add the 25.11 release team
This patch updates the teams.yaml to include the voted in 25.11
release team.

Test plan
1/ Check against https://wiki.koha-community.org/wiki/Release_Teams

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-08-12 12:38:30 -04:00
Jesse Maseto 111f2d2031
Update release notes for 24.05.12 release
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-07-24 10:05:06 -04:00
Jesse Maseto 44237acacc
Increment version for 24.05.12 release
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-07-24 10:05:06 -04:00
Lucas Gass c8ac0e8255
Bug 39331: If patron category cant be guarantee do not continue with add_guarantors
To test:
1 - Remove age limits from a Child and Adult category in Administration->Patron categories. Ensure Child category can be guarantor and Adult cannot
2 - The above step is to avoid any age checks and form resubmission which removes the guarantor fields
3 - Find/create a child patron
4 - Add a guarantee from the Adult category to the child
5 - Check the DB:
   SELECT * FROM borrower_relationships WHERE guarantee_id={borrowernumber of child};
6 - Note the id colum
7 - Edit the child patron to Adult category
8 - Repeat 5
9 - Note the relationship still exists and the id is incremented
10 - Oof!
11 - APPLY PATCH, restart_all
12 - Try again steps 3 - 8
13 - The relationship should not be re-added
14 - Try with more than 1 guarantor on the record, confirming all are deleted
15 - Try adding some guarantor to patron types that should be able to, they relationship should work.
16 - Try changing some patrons to categories that do allow guarantors, making sure the relationship does stay.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-07-24 09:17:04 -04:00
Owen Leonard 9da8740955
Bug 38184: [24.05] (follow-up) Correct the number of tests
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-07-24 09:17:03 -04:00
Aleisha Amohia 2f8637325c
Bug 38184: [24.05] Show due date on OpacTrustedCheckout modal
This fixes checkout fields being made available to the public API.

Note: This depends on the fix at Bug 39313, so make sure you apply that
first.

To test:

1. Enabled OpacTrustedCheckout system preference
2. Search for an item and get the barcode
3. Go to the OPAC
4. Click the Self-checkout button at the top
5. Enter the barcode and submit
6. Notice that the due date does not show in the modal, even though the
   due date was correctly set

7. Apply the patch and restart services

8. Go to the staff interface and check in your barcode
9. Repeat steps 3-5
10. Confirm the due date does show correctly in the modal

11. Confirm tests pass t/db_dependent/Koha/Checkout.t

Sponsored-by: Reserve Bank of New Zealand
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-07-24 09:17:03 -04:00
David Cook 92ed47e182
Bug 39295: Prevent infinite loop on line wrapping
This change checks that the string width is larger than 0 before
attempting to perform line wrapping on the line.

Test plan:
0. Apply the patch and koha-plack --restart kohadev
1. Follow instructions at end of this message[1]
2. Note that the infinite loop does not happen and that a blank
card is created
3. Export the batch using the test layout and template that come
with koha-testing-docker
4. Note that the patron card is correctly created

[1]
To reproduce:

0. Change Koha test user's firstnameto "Firstname" and surname to "Lastname"

1. Create a template:
Units: PostScript Points
Page height: 60pt
Page width: 60pt
Card height: 60pt
Card with: 60pt

Top page margin: 10pt
Left page margin: 10pt
Number of columns: 1
Number of rows: 1
Gap between columns: 10pt
Gap between rows: 10pt

2. Create a layout:
Units: US inches

Field 1:
Text: Library Name
Font: Times-Roman
Font size: 12 pt
Text alignment: Left
Lower left X coordinate: 100in
Lower left Y coordinate: 100in

Field 2:
Text: <firstname> <surname>
Font: Times-Roman
Font size: 10pt
Text alignment: Left
Lower left X coordinate: 5in
Lower left Y coordinate: 5in

3. Create a batch for borrowernumber 51 (if using "koha" test user in ktd)

4. Export using the above template and layout

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-07-23 16:15:50 -04:00
Jonathan Druart 80edfd9607
Bug 39305: Adjust wording
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-07-23 16:15:50 -04:00
Jonathan Druart b264623e48
Bug 39305: Display a warning on the about page if Plack is not running
CSRF protection is only working if Koha is running under Plack.

The about page is not showing any errors if plack is not running.

Test plan:
0. Do not apply this patch
1. Go to the about page
=> Notice the "PSGI" entry in the "Server information" tab
2. Disable plack
koha-plack --disable kohadev && restart_all
3. Go to the about page
=> Notice that the "PSGI" entry is not displayed, and nothing indicates
that plack is not running
4. Apply this patch
=> "PSGI" now shows "Koha is running in CGI mode. This is a security issue! Use koha-plack --help"

Better wording idea welcome.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-07-23 16:15:49 -04:00
Tadeusz „tadzik” Sośnierz c7cf695279
Bug 39772: Extend background_tasks API to allow for human-readable job names
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-07-23 15:17:20 -04:00
Tadeusz „tadzik” Sośnierz a368406305
Bug 39772: Display package names for plugin jobs rather than "unknown" messages
This slightly improves the current situation, where on background_jobs.pl
each plugin job would be displayed as "Unknown job type 'plugin_...'".
After this patch, we display the implementing package name
(sourced from plugins' background_tasks()), which is slightly more
human-friendly and significantly less error-looking.

Test plan:

1. In KTD, install a plugin implementing background jobs (e.g. the KitchenSink)
2. On http://localhost:8081/cgi-bin/koha/plugins/plugins-home.pl,
   enable the plugin and run a tool/report from it
3. Observe ugly job types column on http://localhost:8081/cgi-bin/koha/admin/background_jobs.pl
4. Apply the patch
5. Observe the improved job types on http://localhost:8081/cgi-bin/koha/admin/background_jobs.pl

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-07-23 15:17:19 -04:00
Owen Leonard 1192a706cb
Bug 38127: Missing column headings in 'Add user' pop-up modal
This patch modifies the template for adding to a basket from a new
(empty) record in order to make the "Add user" patron search results
correct. The patron search results table headers must be defined in the
template before they are used.

To test, apply the patch and go to Acquisitions.

- Search for a vendor.
- Add or create a basket for that vendor.
- Click "Add to basket" and select "From a new (empty) record."
- In the "New order" form, under the "Patrons" heading, click "Add user"
- Search for patrons to add.
- In the patron search results, each column should have a heading: Card,
  Name, Category, Library.

Sponsored-by: Athens County Public Libraries
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>

	modified:   koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
2025-07-07 13:14:39 -04:00
Nick Clemens 25dfb06f9b
Bug 39987: Correct breadcrumbs link to batch item deletion
This patch adds th del=1 param to the batchMod link in the breadcrumbs to ensure we return to batch item
deletion and not modification

To test:
1 - Browse to Cataloging->Batch item deletion
2 - Click the 'Batch item deletion' link in the breadcrumbs
3 - You are now at 'Batch item modification'
4 - Apply patch
5 - Repeat, you stay on the correct page
6 - Complete a batch item deletion and confirm the breadcrum is correct at each stage.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>

	modified:   koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt
2025-07-07 13:13:46 -04:00
Martin Renvoize 2e115a41b1
Bug 39887: Improve documentation for overdue_notices.pl
This patch corrects a few spelling mistakes and missing grammer and adds
a little more detail to the '--date', '--email' and '--frombranch'
options.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>

	modified:   misc/cronjobs/overdue_notices.pl
2025-07-07 13:12:51 -04:00
Jesse Maseto d8893bca20
Update release notes for 24.05.11 release
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>

	new file:   misc/release_notes/release_notes_24_05_11-1.html
	new file:   misc/release_notes/release_notes_24_05_11.md

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-06-24 13:18:41 -04:00
Jesse Maseto 32c7f4d10d
Increment version for 24.05.11 release
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>

	modified:   Koha.pm
	new file:   installer/data/mysql/db_revs/240511000.pl

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-06-24 13:18:40 -04:00
Tomas Cohen Arazi 7fbfc207ae Bug 38101: Make ES indexer split big fields into chunks
This patch makes the `_process_mappings()` method split the index values
in the event of them being bigger than the allowed 32766 bytes size.

To test:
1. Have KTD running with ES:
   $ ktd --proxy --es7 up -d
2. Perform a search
3. Pick the first result for edition
4. Find a cool Wiki page with lots of paragraphs
5. Copy all of the paragraphs and put them on a 500$a field for the record.
6. Repeat 2
=> FAIL: The record is not found
7. Reindex manually:
   $ ktd --shell
  k$ perl misc/search_tools/rebuild_elasticsearch.pl --biblios --where "biblionumber=3"  -v -v
=> FAIL: You get something like:
```
[22229] Committing final records...
One or more ElasticSearch errors occurred when indexing documents at /kohadevbox/koha/Koha/SearchEngine/Elasticsearch/Indexer.pm line 148.
[22229] There were errors during indexing
Record #3 Document contains at least one immense term in field="note.raw" (whose UTF8 encoding is longer than the max length 32766), all of which were skipped.  Please correct the analyzer to not produce such terms.  The prefix of the first immense term is: '[10, 109, 117, 115, 116, 97, 102, 97, 32, 102, 117, 101, 32, 101, 108, 32, 115, 101, 103, 117, 110, 100, 111, 32, 104, 105, 106, 111, 32, 100]...', original message: bytes can be at most 32766 in length; got 32771 (illegal_argument_exception) : max_bytes_length_exceeded_exception (bytes can be at most 32766 in length; got 32771)
[22229] Total 1 records indexed
```
8. Apply this patch
9. Repeat 7
=> SUCCESS: No error!
10. Repeat 2
=> SUCCESS: The record is indexed and can be found!
11. Sign off :-D

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-06-17 19:01:17 +00:00
Tomas Cohen Arazi 0c92fee632 Bug 38101: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Cook <dcook@prosentient.com.au>
2025-06-17 18:57:20 +00:00
Tomas Cohen Arazi a984f17434 Bug 37809: (follow-up) Allow embedding item.biblio too
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-06-13 15:30:07 +00:00
Tomas Cohen Arazi 3b2e93bf1c Bug 37809: (follow-up) Remove wrong embed
It seems to me like a copy and paste error coming from the holds
endpoint.

To test:
1. Use a REST API tool like Postman to ask for some patron's checkouts
2. Add x-koha-emebed: cancellation_requested
=> FAIL: It explodes, cannot embed it
3. Apply this patch
4. Repeat 2
=> SUCCESS: cancellation_requested no longer a valid option
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2025-06-13 15:26:00 +00:00
Tomas Cohen Arazi aa886d0f8d Bug 37809: Add more embed options to checkouts endpoints
This patch adds more embed options to checkouts endpoints.
To test you really need to try them on a REST tool.

* patron
* item
* library

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2025-06-13 15:26:00 +00:00
Nick Clemens 74e3696921 Bug 36736: Load plugins at the start of background job processing
This patch adds a call to get_enabled_plugins before processing background jobs to ensure
that all plugin hooks are loaded and cached

To test:
1 - Install a plugin that adds new objects e.g. the Contracts plugin
    https://github.com/bywatersolutions/fs-koha-plugin-contracts
    or the Koha Advent plugin:
    https://gitlab.com/koha-community/koha-advent/koha-plugin-fancyplugin
2 - Restart all
3 - Tail all your logs
4 - Stage and import a file containing items
5 - Note in the logs
    DBI Exception: DBD::mysql::st execute failed: Lock wait timeout exceeded; try restarting transaction
6 - Apply this patch
7 - Restart all
8 - Stage and import again
9 - Success!

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-06-09 18:54:43 +00:00
Jesse Maseto 82e4ca1288
Merge branch '24.05bug_37820' into 24.05.x 2025-06-09 13:00:16 -04:00
Emmi Takkinen 68e4aa4f48 Bug 37820: Upgrade fails at 23.12.00.023 [Bug 36993]
If table aqbudgets is miissing foreign key
'aqbudgetperiods_ibfk_1' database update fails on
"Can't DROP FOREIGN KEY" error.

To test:
1. Remove changes made in bug 32132, drop foreign key
aqbudgetperiods_ibfk_1 and downgrade your database:
- ALTER TABLE aqbudgets MODIFY COLUMN `budget_period_id` INT(11) NULL;
- UPDATE aqbudgets SET budget_period_id = NULL
WHERE budget_period_id IN(SELECT budget_period_id FROM aqbudgetperiods
WHERE budget_period_description = "Budget for funds without budget");
- DELETE FROM aqbudgetperiods
WHERE budget_period_description = "Budget for funds without budget";
- ALTER TABLE aqbudgets DROP FOREIGN KEY aqbudgetperiods_ibfk_1;
- UPDATE systempreferences SET value="23.1200022" WHERE variable = "Version;
2. Upgrade your database (e.g. running installer/data/mysql/updatedatabase.pl)
=> Update fails on error "Can't DROP FOREIGN KEY `aqbudgetperiods_ibfk_1`;...".
4. Apply this patch.
5. Try to update your database again.
=> Database should now be upgraded succesfully.
=> Confirm table aqbudgets now contains 'aqbudgetperiods_ibfk_1'.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-06-09 16:56:20 +00:00
Martin Renvoize 5b874c8f72 Bug 36978: (Bug 34029 follow-up) Make update idempotent
The update wasn't checking for index pre-existance and as such could
fail in certain cases.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2025-06-09 16:48:50 +00:00
Paul Derscheid 0487fc3499
Update release notes for 24.05.10 release
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-05-26 22:31:36 +02:00
Paul Derscheid 7177fee7b7
Increment version for 24.05.10 release
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-05-26 22:26:29 +02:00
Paul Derscheid f0628f9489
Merge remote-tracking branch 'upstream/24.05.x' into 24.05.x-security
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-05-26 22:25:33 +02:00
Wainui Witika-Park 986573c909 Revert "Bug 38782: Mock userenv->{number}"
This reverts commit de3999c6b8.
2025-05-21 13:44:00 +12:00
Wainui Witika-Park 81963ab452 Revert "Bug 38782: Remove concat in background process"
This reverts commit 1013d5b74e.
2025-05-21 13:43:54 +12:00
Wainui Witika-Park c1bb46670a Revert "Bug 38782: Apply same fix for CounterFile.t"
This reverts commit 549031d41b.
2025-05-21 13:43:48 +12:00
Wainui Witika-Park b9fbacfe60 Revert "Bug 38782: mock_userenv in API tests"
This reverts commit 3b70d648ed.
2025-05-21 13:43:41 +12:00
David Cook 1794924eeb Bug 39184: Turn off ABSOLUTE and EVAL_PERL for user-entered templates
This change turns off ABSOLUTE and EVAL_PERL for user-entered templates,
as these options can allow for arbitrary code execution and information
disclosure.

Test plan:
0. Apply the patch
1. koha-plack --restart kohadev
2. Create a Notice for Reports with a report like:
[% IF ( x == 1 ) %]
One
[% ELSE %]
Two
[% END %]
3. Run a report using this template
4. The report should show "Two"
5. Turn on CHECKOUT emails for a test patron
6. Perform a checkout
7. Look at the CHECKOUT email and note that the email body
is correctly generated

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Would be good to have this fixed as the default.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
The test plan should include PERL blocks or absolute paths! Tested those
instead. Testing x==1 seems irrelevant.
I tried:[% PERL %]print 1;[% END %] and [% INCLUDE /app/Dockerfile_1 %]
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-05-21 01:20:21 +00:00
Nick Clemens fd6d58bb4b Bug 36867: (follow-up) Don't check IP if ILS-DI disabled
When ILS-DI is disabled we still expect to return the correct service name/section in the
xml, but just indicate that it is disabled.

We should skip the check for authorized IPs in this case, as the IP only matters when service is enabled

Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-05-06 00:03:36 +00:00
Wainui Witika-Park 58302e1092 Update release notes for 24.05.09 release
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
2025-04-24 17:06:15 +12:00
Wainui Witika-Park f2954d13c1 Increment version for 24.05.09 release
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
2025-04-24 16:46:46 +12:00
Nick Clemens 7589c3b6d8 Bug 36867: Update preference description
This lists the new syntax for allowing all IPs in the preference

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-04-24 16:46:46 +12:00
Nick Clemens 5fcc519aa3 Bug 36867: Do not allow access to ILS-DI for IPs not explicitly listed in ILS-DI:AuthorizedIPs
This patch forces a check of authorized IPs against the Koha system preference, if nothing is present, no access is allowed

To test:
 1 - Enable ILS-DI, leave  ILS-DI:AuthorizedIPs blank
 2 - In another window:
    http://localhost:8080/cgi-bin/koha/ilsdi.pl?service=GetAvailability&id=1+2+99999&id_type=item
 3 - You get a response
 4 - Apply patch and restart all
 5 - Reload ilsdi page, 'Not authorized'
 6 - Copy the IP listed as refused and paste into ILS-DI:AuthorizedIPs
 7 - Reload the page, you get a response again
 8 - Change ILS-DI:AuthorizedIPs to:
    0:0:0:0/0
 9 - You still have access
10 - Paste your specific IP again, and add a second made up IP (comma separated)
11 - Reload and confirm you still have access

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-04-24 16:46:46 +12:00
Jonathan Druart 6e267dc90f Bug 38969: Prevent XSS in tags/review.pl and Prevent JS error when adding tags with quote at the OPAC
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-04-24 16:46:40 +12:00
Roman Dolny 6ef34a6e3e Bug 38772: Typo 'minPasswordPreference' system preference
Typo in system preference 'minPasswordPreference' -> 'minPasswordLength'
in opac/opac-password-recovery.pl

There is no 'minPasswordPreference' system preference in database.
Bug 23816 added the capability to override minPasswordLength.

Test plan:
==========
1. Check 'minPasswordPreference' appearances:
   git grep -i 'minPasswordPreference' **/*
--> Note: only one in opac-password-recovery.pl; no one in sysprefs.sql
2. Apply the patch.
3. Repeat p. 1. Note there is not 'minPasswordPreference' at all.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4b8db36d2a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-04-17 06:47:17 +00:00
Pedro Amorim 3b70d648ed Bug 38782: mock_userenv in API tests
Reorder logic slightly for each to only create the counter_file after the mock_userenv has taken place

prove t/db_dependent/api/v1/erm_custom_reports.t

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1e7c49ab98)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-04-17 06:40:05 +00:00
Pedro Amorim 549031d41b Bug 38782: Apply same fix for CounterFile.t
prove t/db_dependent/Koha/ERM/EUsage/CounterFile.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit: tidy (tcohen)
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a297c42394)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-04-17 06:40:05 +00:00
Pedro Amorim 1013d5b74e Bug 38782: Remove concat in background process
The ud_provider->{report_type} is only defined on ->harvest_sushi, meaning it'll never be defined here.
We don't need this anyway. The filename should be the filename of the file being manually uploaded. We only need this concat logic for COUNTER files being generated by Koha following a SUSHI harvest, and that works.
This also gets rid of a warning when running the tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0231911c98)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-04-17 06:40:05 +00:00
Pedro Amorim de3999c6b8 Bug 38782: Mock userenv->{number}
prove t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit: tidy (tcohen)
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c3e8b9b851)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-04-17 06:40:05 +00:00
Fridolin Somers 35bee8465a Bug 38653: Remove call on system preference 'OPACLocalCoverImagesPriority'
This is in opac/opac-search.pl a call on system preference
OPACLocalCoverImagesPriority. This preference does not exists elsewhere
and dates back to Koha 3.8 from Bug 1633

This patch removes the call and fixes folding of if.

Check this returns empty : git grep OPACLocalCoverImagesPriority

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

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 bf82831913)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-04-17 06:12:52 +00:00
Matt Blenkinsop 1667d7db42 Bug 38268: (follow-up) Prevent callbacks from being duplicated
This patch moves the logic up one level into the confirmModal function
to prevent future regressions

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 1fc336d6bd)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-04-17 05:50:42 +00:00
Phil Ringnalda 7e5319280a Bug 38268: Callers of confirmModal need to remove the modal as the first step in their callback function
Templates that use confirmModal to show a pretty confirm() need to
remove the modal in their callback function, or they are at risk of
having the first callback called for subsequent calls that think they
will get their own callback called. opac-user.tt is already fixed,
opac-shelves.tt is currently affected, and opace-suggestions.tt,
opac-tags.tt, and sco/sco-main.tt are at risk of being affected if
anyone adds another confirmModal caller.

Test plan:
 1. Without the patch, open the OPAC, log in, search for something that
    will return several results
 2. Select all - Add to list - New list
 3. Lists - {your list name}
 4. Click the checkboxes for the first two items
 5. Instead of clicking Remove from list, accidentally click Delete list
 6. In the confirmation popup, realize it was a mistake and click No, do
    not delete
 7. Click Remove from list
 8. Poof, your whole list is gone
 9. Apply patch
10. Repeat steps 1-7, but instead of the whole list being deleted, see
    that only the selected two items were removed
11. Now intentionally click Delete list and click Yes, delete, you'll
    see that it is deleted rather than getting a message about nothing
    being removed like you would have gotten without the patch if you
    started by removing an item
12. On any bib detail page, click Add tag(s) and add one
13. Your account - Tags, check the checkbox for the tag, Remove selected
    tags, Yes, delete tag and verify that it was deleted
14. Purchase suggestions - New purchase suggestion, fill in a title and
    submit your suggestion, click the checkbox for your suggestion,
    Delete selected, Yes, delete suggestion and verify it was deleted
15. In the staff interface, find and copy the barcode for any item that can
    be checked out, then go to /cgi-bin/koha/sco/sco-main.pl with the
    OPAC hostname and port, not the staff, and log in
16. Paste the barcode in the input, click Submit, then click Finish, and
    in the confirmation popup click Print recept and end session, and
    verify that it tries to print

Sponsored-by: Chetco Community Public Library
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
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 6b470caa92)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-04-17 05:50:42 +00:00
Lucas Gass edcabe5d80 Bug 38512: Fix display of recalls in items table
1. Turn on  UseRecalls
2. Set circ rules to allow for recalls ( Recalls allowed(total) and Recalls allowed(count))
3. Check something out to a patron, choose a record with multiple items on it
4. With another patron recall the item from the OPAC
5. Choose "Recall next available item"
6. Now go back to the item table and see that all items on the bib say something like: "Recalled by koha (42) on 11/21/2024"
7. APPLY PATCH
8. Do steps 3 - 6 again and now the items should correctly show as available.
9. Place a recall again but choose 'Recall a specific item'.
10. Look at the table again, it should accuretly show the recall in the status column. "recalled by koha (42) on 11/21/2024"
11. Turn off UseRecalls, make sure the table still loads properly.

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 52dd7302d2)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-04-16 05:33:14 +00:00
Emily Lamancusa 870fd1805c Bug 38155: (QA follow-up) Fix TT filters and scalar context
data-referer is the url for the current search page, to redirect
back after performing the operation. Since it is a url, variables within
this link all need to use the uri filter, not html or KohaDates.

Also specify scalar context when splitting the input parameter to
prevent param in list context warnings.

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0f01f2b31d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-04-15 09:02:56 +00:00
Brendan Lawlor 27761c09ee Bug 38155: Fix Acquisitions Reopen selected invoices button
This patch updates the reopen selected invoices link button to use
the form-submit.js method from bug 36246. The link needs to have a single
data-invoiceid parameter, so the js on invoices.tt creates a comma
separated list from the checkboxes.

The list of invoiceid is split into an array in invoice.pl

To test:
1. Add some invoices for a vendor using the 'receive shipments' button
2. Go to Acquisitions->Invoices
3. Select multiple invoices using the checkboxes
4. Click the 'Close selected invoices' button
5. Confirm it works
6. Go to the Closed invoices tab
7. Select multiple invoices using the checkboxes
8. Click the 'Reopen selected invoices' button
9. Confirm it works
6. Confirm reopening individual invoices from the Actions button still works

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8b038c880c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-04-15 09:02:13 +00:00
Brendan Lawlor b00dbec4e7 Bug 38155: Fix Acquisitions close selected invoices button
This patch updates the closed selected invoices link button to use
the form-submit.js method from bug 36246. The link needs to have a single
data-invoiceid parameter, so the js on invoices.tt creates a comma
separated list from the checkboxes.

The list of invoiceid is split into an array in invoice.pl

To test:
1. Add some invoices for a vendor using the 'receive shipments' button
2. Go to Acquisitions->Invoices
3. Select multiple invoices using the checkbox
4. Click the 'Close selected invoices' button
5. Confirm it works
6. Confirm closing individual invoices from the Actions button still works

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e15d90563f)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-04-15 09:00:15 +00:00
Alex Buckley 44f39493b8 Update release notes for 24.05.08 release
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-24 08:30:40 +00:00
Alex Buckley 82d3bc63b6 Increment version for 24.05.08 release
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-24 07:58:47 +00:00
David Cook cf3874f8a8 Bug 31165: Scrub "Public note" field for Course Reserves
When displaying the "Public note" for Course Reserves, we scrub the HTML
using the "note" scrubber type.

Test plan:
0. Apply the patch
1. Go to http://localhost:8081/cgi-bin/koha/course_reserves/course-reserves.pl
2. Click "New course"
3. Fill in required fields
4. In staff note and public note add the following:
<script>alert('boo!')</script><p>Hello!</p>
5. Click Save

6. Click "Add reserves"
7. Add "39999000001310" to Item barcode
8. Click "Submit"
9. Fill in all required fields
10. Add the following for Staff note and Public note:
<script>alert('boo2!')</script><p>Item!</p>
11. Click "Save"

12. Go back to your course reserve
13. Note the HTML is scrubbed on "Public note"
14. Go to http://localhost:8081/cgi-bin/koha/course_reserves/course-reserves.pl
15. Note the HTML is scrubbed on "Public note"

16. Go to http://localhost:8080/cgi-bin/koha/opac-course-reserves.pl
17. Note the HTML is scrubbed on "Notes"
18. Click on your course reserves
19. Note the HTML is scrubbed on "Notes"

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-24 07:37:51 +00:00
Alex Buckley 39be4f7911 Merge remote-tracking branch 'upstream/24.05.x' into HEAD 2025-03-24 17:11:13 +13:00
Marcel de Rooy d485d1f2ae Bug 37784: [24.05] (QA follow-up) Add few tables to Koha::Database::Columns
This resolves exceptions like:
Invalid table name accountlines at /usr/share/koha/C4/Reports/Guided.pm line 216.

Test plan:
Go to reports/dictionary.pl
Try to add a new definition for Serials.
Without this patch, you would crash (status 500).
Run t/Koha/Database/Columns.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-21 01:41:35 +00:00
Marcel de Rooy a4888ff9a9 Bug 37784: [24.05] (QA follow-up) Bail out to new definition
The code went back to step 3 but the error message is not there.
It is easier to go back to the start: no need to fetch columns.
And this is now an exception; it will only come up when trying
malicious things.

Also turned foreach and unless forbidden around. No need to go
into the loop when we found a forbidden field.

Test plan:
See first patch. You should see the message now.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-21 01:41:34 +00:00
Aleisha Amohia dbfb62c63b Bug 37784: [24.05] Do not show forbidden columns in reports dictionary
This patch prevents forbidden columns from being selected using the reports dictionary.

To test:

1. Go to Reports -> View dictionary
2. Choose 'new dictionary'
3. After providing a name and description, select the 'patrons' table
4. Select the 'password' column and go Next
5. Notice it is possible to see a list of all the password hashes in the 'choose' selection box when asked to specify a value

6. Apply patch and restart services

7. Repeat steps 1-3
8. Notice the 'password' column and other forbidden columns are not available to be selected

9. Open the Inspector / developer tools in your browser and find the code for the columns selection
10. Change the value of one of the options in the code to "borrowers.password". So it may end up looking like this:

<option value="borrowers.password">Card number</option>

11. Choose that option from the dropdown and click Next.
12. Confirm you are redirected back to this page and warned about the column being used.

13. Ensure tests pass t/db_dependent/Reports/Guided.t

Sponsored-by: Reserve Bank of New Zealand
Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-21 01:41:33 +00:00
Janusz Kaczmarek 1a38aacac3 Bug 38483: C4::Heading::preferred_authorities is not used
C4::Heading::preferred_authorities seems to be not used for ages (maybe
never used?)

Test plan:
$ git grep preferred_authorities
-->   should return nothing

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7c70b09dfc)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-20 21:00:37 +00:00
Pedro Amorim 225746819f Bug 36662: Move test files to the correct folder structure
Trivial leftover house-keeping from bug 35581.

Test plan:
$ prove t/db_dependent/Koha/ILL/*

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 b26b7d740f)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-20 20:43:11 +00:00
Kyle M Hall 56d2ccc3f7 Bug 38486: [24.05.x] For SIP allow noblock checkouts reguardless of normal patron checkout blocks
The purpose of no block checkouts in SIP is to indicate that the SIP machine has made an offline ( "store and forward" ) transaction.
The patron already has the item. As such, the item must be checked out to the patron or the library risks losing the item do to lack of tracking.
As such, no block checkouts should not be blocked under any circumstances.

The sub C4::SIP::ILS::Transaction::Checkout::do_checkout already honors this, but it is wrapped by
C4::SIP::ILS::checkout which has additional checks that do not.

Test Plan:
1) Apply the unit test patch
2) prove t/db_dependent/SIP/Transaction.t will fail
3) Apply the second patch
4) prove t/db_dependent/SIP/Transaction.t will pass!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-20 20:27:47 +00:00
Kyle M Hall 98b7336d9f Bug 38486: [24.05.x] Fix unit tests
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-20 20:27:46 +00:00
Emily Lamancusa 8d3c796873 Bug 38246: [24.05.x] Only check unresolved claims
To test:
1. Set up sysprefs:
   - Set any non-empty value for ClaimReturnedLostValue
   - Set AutoClaimReturnStatusOnCheckout to "found in library"
   - Set AutoClaimReturnStatusOnCheckin to "returned by patron"
2. Check out an item to a patron
3. On the patron's account page, click the "Claim Return" button next to
   that checkout
4. Check the item in. Note the message that the claim was auto-resolved.
5. Return to the patron's account page and open the Claims Returned tab
--> Note that the claim is resolved and hidden
6. Click the "Show all 1 claims" link to view the hidden claim. Make a
   note of the resolution code and timestamp.
7. Check the item out again
--> Note the message saying that the claim was resolved, even though it
    was already resolved previously
8. View the return claim again
--> Note that the timestamp and resolution code have changed
9. Apply patch and restart_all
10. Repeat steps 2-8 with a new item
--> Note you do not get a claim resolved message on checkout this time
--> Note that the timestamp and resolution code remain the same before
    and after the checkout

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-20 04:45:06 +00:00
Tomas Cohen Arazi d2868dd8e7 Bug 38678: Fix wrong attribute mapping in Koha::Old::Biblio
Because the mapping was defined in the wrong direction, it is not
possible to filter results in `GET /deleted/biblios` neither on the
`deleted_on` attribute, or even the fallback to DB fields when mappings
don't exist, on `timestamp`.

To test:
1. Apply the regression tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/deleted_biblios.t
=> FAIL: A 200 returns a 500 instead
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass, behavior is correct
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5d59ec0baa)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-20 04:23:55 +00:00
Tomas Cohen Arazi 28690b3b9b Bug 38678: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 51e42cde54)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-20 04:23:55 +00:00
David Cook b20741c4eb Bug 38826: Make check_api_auth $sessionID consistent
This change makes $sessionID consistently return using the session
ID and not sometimes the session object.

Test plan:
0. Apply the patch
1. koha-plack --restart kohadev
2. curl -v 'http://localhost:8081/cgi-bin/koha/svc/authentication' --cookie-jar /tmp/test.cookies
3. Note the Csrf-Token header value
4. Replace the <CSRF-TOKEN>, <USERID>, and <PASSWORD> tokens in the next step
using the appropriate values (eg the CSRF-TOKEN is from the previous step)
5. curl -v -H "Content-Type: application/x-www-form-urlencoded" \
    -H "Csrf-Token: <CSRF-TOKEN>" -XPOST \
    'http://localhost:8081/cgi-bin/koha/svc/authentication' \
    -d "login_userid=<USERID>&login_password=<PASSWORD>" \
    --cookie /tmp/test.cookies --cookie-jar /tmp/test.cookies
6. curl -XGET -v 'http://localhost:8081/cgi-bin/koha/svc/bib/29' \
    --cookie /tmp/test.cookies > rec.marcxml
7. curl -v 'http://localhost:8081/cgi-bin/koha/svc/authentication' \
    --cookie /tmp/test.cookies --cookie-jar /tmp/test.cookies
8. Note the Csrf-Token header value
9. curl -H "Content-Type: text/xml" -H "Csrf-Token: <CSRF-TOKEN>" \
    -XPOST -v 'http://localhost:8081/cgi-bin/koha/svc/bib/29' \
    --cookie /tmp/test.cookies --data @rec.marcxml

Signed-off-by: Jan Kissig <bibliothek@th-wildau.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 04dbbcc2f2)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-20 02:56:04 +00:00
Caroline Cyr La Rose 317b4c1004 Bug 38707: Patron restriction types from installer files not translatable
This patch makes translatable the default patron restriction
types that come installed with Koha.

To test:

1) Search for "Manual restriction" in the translation files

`git grep "Manual restriction" misc/translator/po/fr-CA-installer.po`

--> No results

2) Apply patch

3) Update translations

`gulp po:update --lang fr-CA`

4) Repeat step 1

--> Manual restrictions (as well as the other restriction types
    i.e. Overdues, Suspension, Discharge, and Notice failure
    suspension) is in the .po file

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 d350979d6b)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-20 02:27:40 +00:00
Andrew Fuerste Henry cef370444d Bug 38531: add diff when reverting hold
To test:
1 - place, capture, and revert a hold
2 - view action logs for your hold via SQL so you can see the diff column
3 - confirm reversion of waiting hold generates a MODIFY line in logs with no diff
4 - apply patch, restart_all
5 - capture and revert your hold again
6 - confirm logs include diff showing change to found and priority

Signed-off-by: Sam Sowanick <sam.sowanick@corvallisoregon.gov>

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 d86c662451)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-20 02:13:06 +00:00
Mason James 95f4b5c77a Bug 33018: debian package tidy-up (2)
remove unrequired module

	modified:   cpanfile

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7283fa84b9)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-20 01:42:27 +00:00
Mason James e55a2b5bef Bug 33018: debian package tidy-up
this patch removes unneeded package dependencies

to test:
 - apply patch
 - build and install koha-common package, note success

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Not tested, I trust Mason to the right thing.
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d5ba5c2879)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-20 01:42:26 +00:00
Nick Clemens 921c4a43b5 Bug 38382: Fresh connection when connexion CSRF token expires
This patch simply generates a new user agent when reauthenticating when the CSRF token
for the session has expired.

To test:
1 - Edit Koha/Token.pm, line 275
from:    { MaxAge => $params->{MaxAge} // ( CSRF_EXPIRY_HOURS * 3600 ) },
to:      { MaxAge => $params->{MaxAge} // ( CSRF_EXPIRY_HOURS ) },
2 - This will make your CSRF tokens expire after 8 seconds
3 - vim /etc/koha/sites/kohadev/connexion.cnf
4 - Set content:
    host:
    port: 8888
    koha:http://localhost:8081
    log:/var/log/koha/kohadev/connexion.log
    match:ISBN
    user:kohauser
    password:kohapass
    overlay_action:replace
    nomatch_action:create_new
    item_action:always_add
    import_mode:direct
    framework:BKS
    overlay_framework:
    debug:1
5 - Save the sample file from this bug into your kohaclone (or copy and paste into a file your koha test site can reach)
6 - On the command line:
    perl misc/bin/connexion_import_daemon.pl -c /etc/koha/sites/kohadev/connexion.cnf
7 - In another terminal:
    cat bug_33418.test  | nc -v localhost 8888
8 - Successful request
9 - Wait 10 seconds (more than 8 anyways)
10 - Repeat 7
11 - Unsuccessful request - Invalid CSRF token
12 - Ctrl+C to stop the connexion daemon
13 - Apply patch
14 - repeat 6
15 - repeat 7, success
16 - Wait more than 8 seconds
17 - repeat 7, success!
18 - repeat again until you are satisfied
19 - Sign off!

WNC amended and tidied

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

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 e758492d99)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-20 00:42:42 +00:00
Jonathan Druart 4470b0f18c Bug 38750: (bug 38385 follow-up) Unblock update process when nothing to do
When we go to installer/install.pl and there is nothing to do we get a "Try again" button and never manage to finish the update.

https://snipboard.io/TplscJ.jpg

Test plan:
Go to installer/install.pl
Login
Click next
=> Without this patch you are stuck with a "Try again" button
=> With this patch applied you get a success screen
 "Everything went okay. Update done."

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 75d9a38805)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-19 20:19:48 +00:00
Owen Leonard 65b73ac349 Bug 31450: Make additional contents publication date required
HTML customizations and news will not display without a publication
date, so we should make it required. This patch adds client-side
validation of the field to check that it's filled.

To test, apply the patch and go to Tools -> News (or HTML
customizations, or Pages).

- Click "New entry"
- Try to submit this new entry without entering a publication date.
- You should be prevented from submitting the form.
- Fill in the publication date and confirm that the form submits
  correctly.

Sponsored-by: Athens County Public Libraries
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 1b1e96a17c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-14 02:42:54 +00:00
Mathieu Saby e0fd76cd15 Bug 32722: Make several subfields and a field non mandatory in default UNIMARC biblio framework
801 should not be mandatory except in data exchange context (IFLA Manual)
In UNIMARC several subfields are mandatory only if the field is used.
This possibility is not available in MAR21, and Koha is currently not
able to manage this information in a useful way : it blocks the
validation of a record if the mandatory subfield is void, regardless
of the mandatory status of the field.
In consequence those subfields must be declared non mandatory in default framework.

Test plan:

1/ Open a UNIMARC Koha without patch. Try to create a record with
minimal information : 200$a and 100$a. A lot a alerts are displayed,
preventing Koha to add the record
2/ Apply the patch
3/ Run reset_all or restart KTD (to remake a fresh koha from scratch)
4/ Try to create a record with minimal information : 200$a and a 100$a.
There should only be 2 alerts, regarding 099$t and 942$c field.

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 30a1c4bb45)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-14 01:26:54 +00:00
Lucas Gass e17ac9e5f5 Bug 38452: Use lc() for case insensitivity
To test:
1. Create an item give it a barcode like 'abc123';
2. Try creating a 2nd item with a barcode: 'ABC123', you get an error 'Error saving item: Barcode must be unique.'
3. Checkin the item 'ABC123', the 'abc123' item successfully checks in.
4. The case doesn't seem to matter elsewhere in Koha ( check-in, checkout, searching, batch tools )
5. Try the inventory tool and use 'ABC123'. The barcode is not found.
6. APPLY PATCH, restart_all
7. Try the inventory tool again with both 'abc123' and 'ABC123', they should now both work.

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 70ea004f02)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-13 21:29:31 +00:00
Alex Buckley faf18a689e Add number of security bugs to the 24.05.07 release notes
Also fix lists in the 24.05.07 HTML release note file.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-26 20:04:32 +00:00
Alex Buckley 32035a90e3 Add executable flag to 24.05.07 db_revs file
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-26 19:49:39 +00:00
Alex Buckley 398c94836b Update release notes for 24.05.07 release
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-26 19:32:21 +00:00
Alex Buckley 62af03e498 Increment version for 24.05.07 release
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-26 11:03:46 +00:00
Alex Buckley 5f73443461 Merge remote-tracking branch 'upstream/24.05.x' into HEAD 2025-02-26 23:22:05 +13:00
Owen Leonard 21f18b629b Bug 37266: [24.05.x] patron_lists/delete.pl should have CSRF protection
This patch adds CSRF protection to patron list deletions.

Also changed: The "Delete selected lists" button is now in a floating
toolbar.

To test, apply the patch and go to Tools -> Patron lists.

- If necessary, create a few patron lists.
- Test the two methods for list deletion available on the page:
  - Check one or more checkboxes and then click the "Delete selected
    lists" at the top of the page.
  - Click the "Actions" button for an individual list and choose "Delete
    list."
- Open the checkout page for a patron.
  - Under the "Patron lists" tab, add the patron to a list.
  - Click the "Actions" button for an that list and choose "Delete
    list."
  - When you are taken to the patron lists page the list should have
    been deleted.
- Perform the same test on the patron details page.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-25 19:21:07 +00:00
David Cook 30bb7607b9 Bug 39170: Improve validation of report ID
This change improves the validation of the report ID passed by the user.

Test plan:
0. Apply the patch
1. koha-plack --restart kohadev
2. Create a SQL report
3. Go to /cgi-bin/koha/tools/scheduler.pl
4. Add in a Time, Date, and Email
5. Choose your report from the list
6. Click "Save"
7. Note that your report is saved

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-24 21:38:47 +00:00
Tomas Cohen Arazi 5b775aee69 Bug 28478: Make opac-*detail.pl scripts use Koha::Biblio->opac_suppressed()
This patch makes the following scripts use the new method for checking
suppression:

* opac/opac-ISBDdetail.pl
* opac/opac-MARCdetail.pl
* opac/opac-detail.pl

In the `opac-detail.pl` case, it is a simple change by removing MARC
data traversal in favor of the new method. The code checking
suppression gets moved up so we don't process or make any other
calculations if the record is suppressed.

The other two scripts where completely missing the check and thus
leaking suppressed records.

To test:
1. Pick two records, one marked as suppressed, and the other not
   suppressed.
2. Try acessing them in the OPAC detail page.
=> SUCCESS: Suppressed records are suppressed, and not suppressed ones
are not.
3. Try the same records on the ISBD and MARC view
=> FAIL: They are not suppressed!
4. Apply this patch
5. Repeat 2
=> SUCCESS: Suppression is still respected
6. Repeat 3
=> SUCCESS: Suppression is respected on the ISBD and MARC views
7. Sign off :-D

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised. Remember to activate OPAC suppression with
OpacSuppression.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-24 21:20:19 +00:00
Tomas Cohen Arazi c1e2a4f164 Bug 28478: Add Koha::Biblio->opac_suppressed()
This patch adds a convenient method at the Koha::Biblio level, as a
wrapper for the extrator added on this bug. Following the established
pattern we adopted a while back.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Biblio.t
=> SUCCESS: Tests pass! All use cases covered!
3. Sign off :-D

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-24 21:20:18 +00:00
Tomas Cohen Arazi b8ff17d259 Bug 28478: Add get_opac_suppression extractor
This patch adds an extractor method for the historically hardcoded field
942$n. This way we have a single place in which we code the extraction
and sanitization of its value.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Biblio/Metadata/Extractor/MARC.t
=> SUCCESS: Tests pass! All use cases are covered!
3. Sign off :-D

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-24 21:20:18 +00:00
Marcel de Rooy a8078a4f3d Bug 36081: (QA follow-up) Resolve IsNotDebit exception in ArticleRequests.t
Resolve (when running ArticleRequests.t):
Exception 'Koha::Exceptions::Account::IsNotDebit' thrown 'Account line 326 is not a debit'

This occurs after switching from ArticleRequest->new to TestBuilder.
TestBuilder creates an account line that has a credit_type_code and
a debit_type_code. (This could be fixed further somewhere else.)
For now, just setting debit_id to NULL.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-24 20:43:48 +00:00
Jonathan Druart 5a8aef083d Bug 36081: Fix some failing tests
Signed-off-by: Magnus Enger <magnus@libriotech.no>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-24 20:43:47 +00:00
Jonathan Druart 05353f0cf0 Bug 36081: Mock format
Signed-off-by: Magnus Enger <magnus@libriotech.no>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-24 20:43:47 +00:00
Jonathan Druart 5ff06fd18d Bug 36081: Force TestBuilder to generate a valid format value
Signed-off-by: Magnus Enger <magnus@libriotech.no>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-24 20:43:46 +00:00
Jonathan Druart 7b0f6f6bc1 Bug 36081: Use multivalue_preference
C4::Context->multivalue_preference is not used so far and split on |
However the values of "multiple" sysprefs are separated by... comma!

Let support both here.

This patch also removes silly JS code in the template.

Signed-off-by: Magnus Enger <magnus@libriotech.no>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-24 20:43:45 +00:00
Marcel de Rooy 3a817ca380 Bug 36081: Check SupportedFormats server side
Test plan:
Add article request with format via OPAC.
Run t/db_dependent/Koha/ArticleRequest.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Magnus Enger <magnus@libriotech.no>
Tests in t/db_dependent/Koha/ArticleRequest.t pass. I can add an
article request with a type. If I allow PHOTOCOPY but change the
HTML in the OPAC form so SCAN is submitted I get a nice (but
somewhat generic) error.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-24 20:43:45 +00:00
Nick Clemens da96f8cfe5 Bug 37810: (QA follow-up) Tidy
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-21 02:59:52 +00:00
Pedro Amorim f8fb37b3fa Bug 37810: Consider ServiceActive on status response
Some SUSHI providers return ServiceActive instead of the documented Service_Active:
https://countermetrics.stoplight.io/docs/counter-sushi-api/f0dd30f814944-server-status

This ensures the test connection does not fail regardless of what is used

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-21 02:59:50 +00:00
Pedro Amorim dfd9bc68cd Bug 37810: Add test
Test plan:
1) Apply only tests patch, run:
prove t/db_dependent/Koha/ERM/EUsage/UsageDataProvider.t
2) Verify tests fail
3) Apply fix patch
4) Run tests again, verify they pass

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-21 02:59:48 +00:00
David Cook 2e0dafcde5 Bug 38913: (QA follow-up) test UTF-8 exceptions in large MARC records
MARC records with over 99999 bytes are invalid by spec, and when you use
UTF-8 encoded characters in your MARC records, there is the potential
to generate fatal errors in MARC::File::USMARC when it runs
"marc_to_utf8" from "MARC::File::Encode" during its "decode" operation.

That is, if you MARC::File::USMARC->encode a MARC record
with over 99999 bytes (including a number of UTF-8 bytes), there
is the potential when you run MARC::File:USMARC->decode on that same
data that you'll generate a fatal exception.

The main patch in bug 38913 wraps the function doing the decode,
so that a bad record doesn't crash processing.

Without the patch, this unit test will fail. With the patch, this
unit test will pass.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 9d41abc1e7)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-20 03:21:05 +00:00
Janusz Kaczmarek 041e4368f9 Bug 38913: (bug 38416 follow-up) Elasticsearch indexing explodes with oversized records
After Bug 38416 Elasticsearch indexing explodes with oversized
records, especially with UTF encoded data.

In Koha::SearchEngine::Elasticsearch::marc_records_to_documents a
following snippet has been introduced:

my $usmarc_record = $record->as_usmarc();
my $decoded_usmarc_record = MARC::Record->new_from_usmarc($usmarc_record);

But if $record is oversized (> 99999 bytes), it is OK for MARC::Record
object, but not for $record->as_usmarc. The produced ISO 2709 string
is not correct and hence cannot be properly converted back to
MARC::Record object by new_from_usmarc.

The result in this case can be like:

UTF-8 "\x85" does not map to Unicode at /usr/share/perl5/MARC/File/Encode.pm line 35.

Since it is done without any eval / try, the whole reindex procedure
(for instance rebuild_elasticsearch.pl) is being randomly interrupted
with no explanation.

Test plan:
==========
Hard to reproduce. But the explanation together with discussion in Bug
38416 (from 2024-12-15) explains and justifies the need of this added
eval.

1. Have a standard KTD installation with Elasticsearch.
2. Use the provided test record - add it to Koha with
   ./misc/migration_tools/bulkmarcimport.pl -b -file test.xml -m=MARCXML
   (have patience).
   During load process you should see a message like:
   UTF-8 "\xC4" does not map to Unicode at /usr/share/perl5/MARC/File/Encode.pm line 35.
3. The record should get biblionumber 439. Check in librarian interface with
   http://<your_addreess>:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=439
   that the record has been imported.
   However, you should not be able to make a search for this record.
4. Try to reindex with:
   ./misc/search_tools/rebuild_elasticsearch.pl -b -bn 439
   You should get a message like:
   UTF-8 "\xC4" does not map to Unicode at /usr/share/perl5/MARC/File/Encode.pm line 35.
   Again, no search results.
5. Apply the patch ; restart_all.
6. Repeat reindex with:
   ./misc/search_tools/rebuild_elasticsearch.pl -b -bn 439
   There should be no warning now and you should be able to find the record.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Followed the test plan. Works as advertised.
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c7127fabf4)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-20 03:21:04 +00:00
Tomas Cohen Arazi 4214c68f17 Bug 38779: Add built record sources assets on install
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1de253eb50)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-19 14:28:04 +13:00
David Cook 89c6e32ee7 Bug 38469: Replace single quotes with double quotes to prevent XSS
This change replaces single quotes with double quotes to prevent XSS
for particular operations on the circ returns page.

Test plan:
0. Apply the patch
1. Go to http://localhost:8081/cgi-bin/koha/circ/returns.pl?print_slip=1&reserve_id=1
2. Note that a pring slip is generated
(you may need to allow popups)

3. To test the XSS is patched, try the proof-of-concept from the
bug report

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-02-17 22:50:15 +00:00
David Cook c536935238 Bug 38488: Add Template::Toolkit filter for C4::Scrubber
This change adds a Template::Toolkit filter which is invoked
via " | scrub_html type => 'note' ".

Test plan:
0. Apply the patch
1. prove t/Koha/Plugins/HtmlScrubber.t

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-02-17 22:41:15 +00:00
Jonathan Druart d6ca069f36 Bug 39007: [24.05] Replace warning_like with is
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-02-17 22:27:54 +00:00
Matt Blenkinsop a4d0fcd68e Bug 39007: [24.05] (follow-up) Fix typo
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-02-17 22:27:53 +00:00
Matt Blenkinsop 020a27cdd7 Bug 39007: [24.05] Update API spec and unit test
Test plan:
1) Run prove t/db_dependent/api/v1/erm_sushi_services.t - FAIL
2) Apply patch
3) Repeat step 1 - PASS
4) Inspect patch diff and note that last_audit has been added to the API definition

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>

 Please enter the commit message for your changes. Lines starting

Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-02-17 22:27:53 +00:00
Lari Taskula 8a1c0af3e4 Bug 28907: REST - Drop support for allow-owner functionality
...and allow-guarantor functionality. Replaced by $c->auth->public($patron_id)
and/or $c->auth->public_guarantor($patron_id), where $patron_id is the patron's
id that owns the requested resource.

Old method, was applicable to both privileged and public routes:

  api/v1/swagger/paths/route.yaml

  x-koha-authorization:
    allow-owner: true
    allow-guarantor: true

New method, use public routes with no x-koha-authorization:

  GET /public/route/{patron_id}
  Koha/REST/V1/Controller#public_action:

  sub public_action {
      my $c = shift->openapi->valid_input or return;
      my $patron_id = $c->param( 'patron_id' );
      try {
          # Throws an exception that will render a response of 401 if not
          # authenticated and 403 if trying to access another user's resources
          $c->auth->public($patron_id); #or $c->auth->public_guarantor($patron_id)
          ...
          # other code
          ...
      }
      catch {
          $c->unhandled_exception($_);
      }
  }

  Another example of retrieving $patron_id when patron_id is not a request
  parameter:
  GET /public/another/object/{another_object_id}

  my $patron_id = Another::Object->find($another_object_id)->borrowernumber;
  try {
      # 403 if $another_object_id does not belong to API user
      $c->auth->public($patron_id);
      ...

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-12 02:05:47 +00:00
Lari Taskula 0470a59c03 Bug 28907: REST - Remove allow-owner from public article requests cancel route
To test:
1. prove t/db_dependent/api/v1/article_requests.t
2. Apply patch
3. prove t/db_dependent/api/v1/article_requests.t

Observe success in both cases.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-12 02:05:46 +00:00
Lari Taskula e6cd5ae59f Bug 28907: REST - Remove allow-owner from public checkout availability route
To test:
1. prove t/db_dependent/api/v1/checkouts.t
2. Apply patch
3. prove t/db_dependent/api/v1/checkouts.t

Observe success in both cases.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-12 02:05:45 +00:00
Lari Taskula e2bc259dda Bug 28907: REST - Remove allow-owner from public patron hold cancellation
To test:
1. prove t/db_dependent/api/v1/patrons_holds.t
2. Apply patch
3. prove t/db_dependent/api/v1/patrons_holds.t

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-12 02:05:44 +00:00
Lari Taskula 91ba054f5e Bug 28907: REST - Remove allow-owner from public guarantors can see charges and checkouts
To test:
1. prove t/db_dependent/api/v1/patrons.t
2. Apply patch
3. prove t/db_dependent/api/v1/patrons.t

Observe success in both cases.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-12 02:05:43 +00:00
Lari Taskula 73283e04f1 Bug 28907: REST - Remove allow-owner from public checkouts route
To test:
1. prove t/db_dependent/api/v1/checkouts.t
2. Apply patch
3. prove t/db_dependent/api/v1/checkouts.t

Observe success in both cases.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-12 02:05:42 +00:00
Lari Taskula 441f7b4d07 Bug 28097: REST - Remove allow-owner from public password route
To test:
1. prove t/db_dependent/api/v1/patrons_password.t
2. Apply patch
3. prove t/db_dependent/api/v1/patrons_password.t

Observe success in both cases.

https://bugs.koha-community.org/show_bug.cgi?id=28907
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-12 02:05:41 +00:00
Lari Taskula e810e4c668 Bug 28907: Add Koha::REST::Plugin::Auth::PublicRoutes
To test:
1. prove t/db_dependent/Koha/REST/Plugin/Auth/PublicRoutes.t

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-12 02:05:40 +00:00
Lari Taskula aa97527c37 Bug 28907: Add REST exceptions for public routes auth
To test:
1. perl -c Koha/REST/Plugin/Exceptions.pm
2. perl -c Koha/Exceptions/REST.pm

More tests coming in following patches.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-12 02:05:39 +00:00
Phil Ringnalda 3371577b42 Bug 38467: (follow-up) Update cpanfile
For use_rfc3986() to work, we need at least Template::Toolkit 2.27.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-10 02:51:26 +00:00
Phil Ringnalda 7f999e0699 Bug 38467: (follow-up) Fix test
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-10 02:50:56 +00:00
Jonathan Druart 49603e9a70 Bug 38467: Add test
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-10 02:50:37 +00:00
David Cook 75e05bdd60 Bug 38467: Make uri and url filters rfc3986 when using C4::Template
This change invokes Template::Filters->use_rfc3986 in the C4::Template
module.

Test plan:
0. Apply the patch
1. Note that "uri" and "url" filters now escape single quotes

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-10 02:50:12 +00:00
Phil Ringnalda a5afd9c9c8 Bug 38961: XSS in vendor search
acqui/booksellers.tt and admin/currency.tt use | $HtmlTags without first
filtering the string they wrap.

Test plan:
1. Without the patch, load the URL in comment 1, note the alert()
2. Apply patch, load the URL in comment 1, no alert()

Sponsored-by: Chetco Community Public Library
Signed-off-by: Magnus Enger <magnus@libriotech.no>
Followed the test plan, works as advertised.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-05 02:14:57 +00:00
Marcel de Rooy 34c0bd2c51 Bug 37816: (QA follow-up) Avoid repetition, typo and pipe test
Combining three regexes into one. Typo replcing.
Adding a test with pipe in pwd.

Test plan:
Run t/SIP/Sip.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-05 01:45:46 +00:00
Magnus Enger cb20df02a8 Bug 37816: Stop SIP2 from logging passwords
Koha's SIP2 server does a lot of logging, including all incoming
requests, in full. This means that passwords are logged, both for
the user the SIP2 client uses for logging into Koha, as well as
for the end users who provide a password to e.g. check something
out. This patch replaces passwords with three asterisks in
log strings, before they are written to the log.

To test, in ktd:
- Run the new tests:
  $ prove t/db_dependent/SIP/Sip.t
- Tail the SIP2 logs:
  $ sudo tail -f /var/log/koha/kohadev/sip*.log
- Telnet into the SIP2 server:
  $ telnet localhost 6001
- Try logging in by pasting this into the telnet session:
  "9300CNterm1|COmypassword|CPCPL|"
- Verify that "mypassword" is replaced by "***" in the logs
- Try different values for the password, including the correct password
  which is "term1" in ktd
- Try other SIP2 messages that include password fields (AC, AD, CO)

Update 2024-12-03: Fix issues pointed out by QA.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-05 01:45:19 +00:00
Julian Maurice 775d609af4 Bug 38454: Flush memory cache before every API request
Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-02-05 01:06:03 +00:00
Jonathan Druart 580fa86f25 Bug 38829: Sanitize GetLateOrMissingIssues inputs
Signed-off-by: Magnus Enger <magnus@libriotech.no>
The new test fails without this patch, and passes
when it is applied.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-02-03 23:20:25 +00:00
Jonathan Druart 6388b14ba0 Bug 38829: Add a test
Signed-off-by: Magnus Enger <magnus@libriotech.no>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Added a shebang line.
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-02-03 23:20:25 +00:00
Wainui Witika-Park c555b06ae4 Update release notes for 24.05.06 release
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
2025-01-06 18:39:43 +13:00
Wainui Witika-Park d94cf7bc93 Increment version for 24.05.06 release
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
2025-01-06 17:34:12 +13:00
Wainui Witika-Park 17ea7afac8 Merge remote-tracking branch 'upstream/24.05.x' into HEAD 2025-01-06 16:23:33 +13:00
David Cook e4295598a2 Bug 38470: Add missing double quotes to some Javascript
This change adds some double quotes where quotes were missing,
and replaces single quotes with double quotes, which prevents XSS.

Test plan:
0. Apply the patch
1. Create a subscription
2. Using the ID from the subscription, go to this page:
http://localhost:8081/cgi-bin/koha/serials/subscription-detail.pl?
print_routing_list_issue=1&subscriptionid=<SUBSCRIPTIONID>

3. Note that you're able to generate a print slip
(You may need to allow popups)

4. To check the security vulnerability is fixed, try the proof-of-concepts
attached to the bug report

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-01-06 01:13:58 +00:00
David Cook 6456c0b98d Bug 38468: Add double quotes to some template strings
This change adds double quotes to some template strings where
quotes are missing all together or single quotes are used incorrectly.

Test plan:
0. Apply the patch
1. Go to http://localhost:8081/cgi-bin/koha/catalogue/search.pl?q=test
2. Click on "Gairm"
3. Use the search result navigation box to go to the next result
   On the left of the page. Just bellow the breadcrumb and
   left of the record title.
4. Note that everything loads correctly

5. To test that the security hole has been fixed, try some of the
proof-of-concept attacks provided for biblionumber and searchid

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-01-06 01:02:29 +00:00
David Cook dcb5cc1051 Bug 37727: Prevent CSV Formula injection via DataTables
This change prevents CSV Formula injection on DataTables exports
by escaping formula with a single quote prefix as per OWASP recommendations.

Test plan:
0. Apply patch
1. Go to http://localhost:8081/cgi-bin/koha/members/memberentry.pl
?op=edit_form&destination=circ&borrowernumber=51
2. Add the following in a "Circulation note"
=SUM(1+1)
3. Go to http://localhost:8081/cgi-bin/koha/members/member.pl
?quicksearch=1&circsearch=1&searchmember=koha
4. Click "Export" and choose "Excel" and "CSV"
5. Open those downloaded files in Excel
6. Note that the =SUM(1+1) function is prefixed with a single quote,
and is not automatically executed

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised. The problematic "cell" is exported as "'=SUM(1+1)".
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2025-01-06 00:35:11 +00:00
David Cook fca32a307c Bug 37087: Add TCP keepalive support to SIP server
This change adds the ability to enable and configure TCP keepalive
support for the SIP server using SIPconfig.xml.

For the sake of backwards compatibility, it defaults to disabled
and additional parameters default match typical kernel defaults.

Technical detail can be found in the perldoc for C4/SIP/SIPserver.pm

Test plan:
0. Apply the patch
1. koha-sip --restart kohadev
2. apt-get update && apt-get install tcpdump
3. In one window, run "tcpdump -A -n -v -i any 'port 6001'"
4. In another window, run the following:
echo -e "9300CNterm1|COterm1|CPCPL|\r" | nc 127.0.0.1 6001 -v
5. Note in tcpdump output that after the initial flood of packets,
nothing more is received

6. vi /etc/koha/sites/kohadev/SIPconfig.xml
7. In the "server-params" element, add attributes like the following:
custom_tcp_keepalive='1'
custom_tcp_keepalive_time='10'
custom_tcp_keepalive_intvl='5'
8. koha-sip --restart kohadev
9. In one window, run "tcpdump -A -n -v -i any 'port 6001'"
10. In another window, run the following:
echo -e "9300CNterm1|COterm1|CPCPL|\r" | nc 127.0.0.1 6001 -v
11. Note in tcpdump output that after the initial flood of packets,
ACK packets are sent out every 10+ seconds for the idle connection

Signed-off-by: Tadeusz „tadzik” Sośnierz <tadeusz@sosnierz.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2024-12-31 16:51:59 +13:00
Alex Buckley 987c61364f Revert "Bug 37478: Add strict mode to bulkmarcimport"
This reverts commit 49fef9bee9.
2024-12-27 09:29:55 +13:00
Alex Buckley 0d08c9d2e4 Revert "Bug 37478: (follow-up) Add MARC::Lint to cpanfile"
This reverts commit 2e252974f8.
2024-12-27 09:29:45 +13:00
Alex Buckley 021257fe2e Revert "Bug 37478: Rename strict to skip_bad_records and add POD"
This reverts commit b3dd152c5e.
2024-12-27 09:29:33 +13:00
Wainui Witika-Park e12fa4769c Revert "Bug 38543: Do not include rowGroup asset files"
This reverts commit ce8bb9def8.
2024-12-19 15:48:22 +13:00
Wainui Witika-Park b936aaf442 Revert "Bug 38536: Patrons requesting modifications: Expand correct panel"
This reverts commit 48da1efed3.
2024-12-19 15:46:13 +13:00
Wainui Witika-Park 9fc5936df2 Revert "Bug 37912: Restore detail-trigger handling"
This reverts commit 71900a9508.
2024-12-19 14:02:22 +13:00
Lucas Gass 4588f793f1 Bug 38680: Dont convert the copynumber
Follow the test plan from Bug 38326.

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2024-12-18 22:56:59 +00:00
wainuiwitikapark 6d11eec626 Bug 38522: DBIC schema update
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2024-12-17 23:38:19 +00:00
wainuiwitikapark 279d05ceae Bug 38522: DBRev 24.05.05.009
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2024-12-17 23:38:19 +00:00
Andrew Fuerste Henry 20c22b5488 Bug 38522: (follow-up) Edit db_rev and preserve comment
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1a4820322e)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2024-12-17 23:38:19 +00:00
Andrew Fuerste Henry 789e57210b Bug 38522: update kohastructure.sql
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 73c7acd33f)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2024-12-17 23:38:19 +00:00
Andrew Fuerste Henry b0693468ff Bug 38522: Increase erm_agreements.license_info length
to test:
1- try to save an agreement with 81+ characters in License Info
2- it does not save
3- apply patch, updatedatabase
4- repeat 1, it works!

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2512392b2a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2024-12-17 23:38:19 +00:00
wainuiwitikapark 42c9ef440f Bug 37292: DBRev 24.05.05.008
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2024-12-17 22:42:28 +00:00
Tomas Cohen Arazi 066b0a3355 Bug 37292: Add an index on oauth_access_tokens.expires
This patch adds a needed index to the column.

To test:
1. On a fresh KTD, run:
   $ ktd --shell
  k$ koha-mysql kohadev
   > SHOW CREATE TABLE oauth_access_tokens;
=> FAIL: There's no 'KEY' entry for the `expires` column
2. Apply this patch
3. Run:
  k$ updatedatabase
=> SUCCESS: A message tells the index was added
4. Repeat 1
=> SUCCESS: The index was actually added to the DB
5. Run:
  k$ reset_all
6. Repeat 1
=> SUCCESS: The index is created at install time too!
7. Run:
  k$ updatedatabase
=> SUCCESS: Nothing explodes, no message about index being created
8. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2e63ece6ae)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2024-12-17 22:42:28 +00:00
Jonathan Druart ce8bb9def8 Bug 38543: Do not include rowGroup asset files
rowGroup plugin is now part of the datatables.min.js bundle. We no
longer need to include its css and js files, and they no longer exist
anyway!

[2024/11/27 08:52:37] [WARN] File not found : lib/jquery/plugins/rowGroup/stylesheets/rowGroup.dataTables.min.css at /kohadevbox/koha/Koha/Template/Plugin/Asset.pm line 107
[2024/11/27 08:52:37] [WARN] File not found : lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js at /kohadevbox/koha/Koha/Template/Plugin/Asset.pm line 84.

Test plan:
Confirm that the checkouts are grouped "today" and "previous" on the
checkout page.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4b82e00416)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2024-12-17 02:55:28 +00:00
Owen Leonard 48da1efed3 Bug 38536: Patrons requesting modifications: Expand correct panel
This patch updates the JavaScript on the patrons requesting modification
page in order to make it work following the upgrade to Bootstrap 5. The
automatic panel expansion is broken.

To test, apply the patch and enable, if necessary, the OPACPatronDetails
system preference.

- Log in to the OPAC and submit changes to your personal details.
- Do this again as a different user so that there is more than one
  pending request.
- From the staff interface home page, follow the link for "Patrons
  requesting modifications"
- Upon loading, the "Update patron records" page should automatically
  expand the first panel.
- Locate the patron record for the second of the patrons you requested
  updates for.
- From that patron's detail page, follow the "Review pending
  modifications" link.
- The panel containing that patron's information should expand by
  default.

Sponsored-by: Athens County Public Libraries
Signed-off-by: David Nind <david@davidnind.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 a42686d891)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2024-12-17 02:02:53 +00:00
Jonathan Druart 63bb6bfd67 Bug 38476: Make DT 'Configure' button a link
So that we can open in a separate bug using right click.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

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 d53784de3a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2024-12-17 01:43:26 +00:00
Lucas Gass 29a6f938e4 Bug 38362: Fix printing lists on opac/opac-shelves.pl
To test from the OPAC:
1 - create a list with more than 10 items
2 - print the list -> there is a pagination and that only 10 items
  are printed
3 - Apply patch
4 - print the list again -> every items are being printed

Signed-off-by: Sam Sowanick <sam.sowanick@corvallisoregon.gov>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Tidied: added a few spaces.
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8d0e7ff906)
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2024-12-17 01:31:45 +00:00
Michał Kula ba49b71340 Bug 37393: fix "In bundle:" link not showing for items in staff interface
The cause was erroneous check `[% IF bundlesEnabled %]` before the parent bundle information is requested+shown. The `bundlesEnabled` variable checks if the current biblio ITSELF is of collection type, so should only be used for whether to show the button to add new items to the bundle items, NOT for querying whether current item is part of a bundle, as the items that make up the bundle aren't of collection type themselves.

The second fixed problem was that `bundle_host` didn't contain `.biblio` subitem (which'd contain the actual host biblio title) as the JavaScript code assumed, and it wasn't possible to request it with the API either.

Test plan: please follow the reproduction instructions from bug and ensure that the described issue is gone.

If you run into an error 400 on the detail page, you need to refresh API definitions, in kts shell you'drun:

redocly bundle --ext json api/v1/swagger/swagger.yaml --output api/v1/swagger/swagger_bundle.json
koha-plack --restart kohadev

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>

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 7df4eda9ec)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2024-12-17 01:08:18 +00:00
Phil Ringnalda a567f9b818 Bug 37293: MARC bibliographic framework text for librarians and OPAC limited to 100 characters
The database columns for liblibrarian and libopac in marc_tag_structure and
marc_subfield_structure are 255 characters, but the HTML maxlength in
/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt and
/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt
limit tags to 100 characters and subfields to 80 characters.

Test plan:
 1. Apply patch, restart_all
 2. Administration - MARC bibliographic framework - for Default, Actions -
    MARC Structure
 3. For the 000 tag, Actions - Edit tag
 4. In both the "Description in staff interface" and "Description in OPAC"
    paste the 255 character string

1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 12

    and click Save changes
 5. Verify that the display shows all 255 characters, then Actions - Edit tag
    and verify that the two inputs reloaded with all 255 characters, and that
    you cannot type a 256th character, then click Cancel
 6. For the 000 tag, Actions - Edit subfields
 7. Paste the same string in both the staff interface and OPAC inputs, Save
    changes, verify that all 255 characters show, click Edit subfields, verify
    that all 255 characters reloaded in the inputs, verify that you cannot
    type a 256th character

Sponsored-by: Chetco Community Public Library
Signed-off-by: Shi Yao Wang <shi-yao.wang@inlibro.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a9044f4b34)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2024-12-17 13:31:06 +13:00
Martin Renvoize 6b06638217 Bug 38517: Expose security release manager
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2024-12-17 00:21:37 +00:00
Martin Renvoize f8ee288523 Bug 38517: Add the 25.05 release team
This patch updates the teams.yaml to include the voted in 25.05
release team.

Test plan
1/ Check against https://wiki.koha-community.org/wiki/Release_Teams

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2024-12-17 00:21:37 +00:00
Wainui Witika-Park 9b0eedd47f Revert "Bug 38272: Additionally fix typo in condition for acquisition orders permission"
This reverts commit be478eeb66.
2024-12-16 14:59:41 +13:00
Wainui Witika-Park e2dfce5b5d Revert "Bug 38272: Add permission check for erm permission to additional-fields.tt"
This reverts commit 8de5dd66e6.
2024-12-16 14:54:28 +13:00
Nick Clemens 37a5cca6cd Bug 37424: Display additional materials note in batch checkout
This patch adds a missing conditional for ADDITIONAL_MATERIALS to the batch checkout table

Test plan:
 1. Set a staff member with circ permissions, including FORCE_CHECKOUT
 2. Turn on: CircConfirmItemParts, BatchCheckouts, BatchCheckoutsValidCategories (all)
 3. Log in as staff member in step 1
 4. Attempt to checkout an item with a 952$3 from the batch checkout tab
 5. The item with a 952$3 displays, but the copy/text of the materials specified note does not.
 6. Do not confirm checkout
 7. Apply patch
 8. Try again, the materials note should show this time
 9. Confirm checkout
10. Success! Item is checked out

Signed-off-by: Catrina Berka <catrina@bywatersolutions.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 03538b59aa)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 23:26:38 +00:00
Jonathan Druart 15c702da91 Bug 38437: Auto-show modal on single receive
Might have been broken by the bootstrap 5 upgrade, but not sure.
Not sure why the click does not trigger the modal.

1. Place an order in acquisitions
   1.1. Go to Acquisitions
   1.2. Click 'Search' next to 'Search vendors'
   1.3. Click 'Add to basket' next to 'My basket'
   1.4. Search for an existing record (e.g. search for Shakespeare)
   1.5. Click 'Add order' next to a result or in the detailed record
   1.6. In the item form, choose an item type
   1.7. Click 'Add item'
   1.8. Choose a fund
   1.9. Enter a price in 'Vendor price'
   1.10. Click 'Save'
   1.11. Click 'Close basket'
   1.12. Click 'Yes, close'
2. Receive the order
   2.1. Click 'Receive shipments'
   2.2. Enter a value in 'Vendor invoice'
   2.3. Click 'Next'
   2.4. Click 'Receive' next to your order
   => The modal is shown

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ef455af344)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 23:24:45 +00:00
Nick Clemens 93ed8bb072 Bug 38495: (follow-up) Add a confirmation message
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT} Added a html filter for qa tools..
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0be0f03d52)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 23:17:57 +00:00
Nick Clemens b6e238909d Bug 38495: Use JS to submit form to cancel background jobs
This patch adjusts the link to cancel jobs to be submitted as a POST with cud-cancel operation

To test:
1 - Stop your long tasks bacground jobs worker
   sudo koha-worker --stop --queue long_tasks kohadev
2 - Stage a file for import
3 - Administration -> Manage jobs
4 - See your new job
5 - Click 'cancel'
6 - It didn't work
7 - Apply patch
8 - Browse to jobs again
9 - Click 'Cancel'
10 - Job is successfully cancelled

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d047776630)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 23:17:57 +00:00
Marcel de Rooy e3f16499be Bug 38513: Fix Biblio.t for Koha_Main_My8
This should do the tric: The test output shows that the second
mapping was not found (field 264); also the expected suspect btw.
So adding that here.

Test plan:
Run t/db_dependent/Biblio.t
See also comment28 on bug 19097.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Simulated the above by removing 264c from Koha to MARC mapping.
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 28d24aaa08)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 23:16:22 +00:00
Jonathan Druart 3b31cf80c3 Bug 38526: (bug 36822 follow-up): Improve datetime comparison in tests
17:39:54 koha_1       |     #   Failed test 'updated_on correctly saved on newly created user'
17:39:54 koha_1       |     #   at t/db_dependent/Auth_with_shibboleth.t line 319.
17:39:54 koha_1       |     #     Structures begin differing at:
17:39:54 koha_1       |     #          $got->[0] = '2024-11-19 16:39:30'
17:39:54 koha_1       |     #     $expected->[0] = '2024-11-19 16:39:29'
17:39:54 koha_1       |     # Looks like you failed 1 test of 54.

We must use t::lib::Dates::compare to compare datetimes in tests.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ed25a48ccf)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 23:14:31 +00:00
Janusz Kaczmarek dd6240343a Bug 38239: Incorrect number of items to pull (in Holds to pull) with partially filled holds
With a over-sufficient number of items, when more than one patron has
placed hold, and the holds have been partially filled (checked-in =
waiting for pick up), the number of items to pull in the Holds
to pull table shows the total number of holds, including those waiting.
This erroneously suggests to the librarian to pull an excessive number
of items from the shelves.

Test plan:
==========

1. For a bibliographic record with more than two items (in ktd, e.g.
   "Lanark a life in four books"), place hold for two patrons.
2. On the Holds to pull page control that there are two items to pull.
3. As a librarian from the library of one of the patrons, Check-in one
   item.
4. Note that in Holds to pull table you still see two items to pull,
   which is misleading.
5. Apply the patch; restart_all.
6. Now you should see only one item to be pulled.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>

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 abfba936fb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 23:11:45 +00:00
George Veranis 5a07b6a869 Bug 28075: (follow-up) adding all choices and values of 135a
Extend patch of 135a to cover all choices with all possible values as
described by IFLA for 135a.

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 9a72d3c757)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 23:10:47 +00:00
Didier Gautheron 4f7327c5c1 Bug 28075: Add missing UNIMARC coded data 135a
This patch add more values to selection of 135a in UNIMARC

Test Plan:
    1) Add on default framework the field 135a and check the Editor option
    2) Set on plugin section the value of unimarc_field_135a.pl
    3) Open cataloguing editor and use 135 field tag editor to select a value
    4) Apply patch
    5) Open cataloguing editor and use 135 field tag editor to select a value,
       after patch you have more options to select

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 3fa03e2e66)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 23:10:47 +00:00
David Cook 42490c2918 Bug 38416: Tidy
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.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 8b952b1a34)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 23:07:52 +00:00
David Cook 464967abbe Bug 38416: Add unit tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.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 a9eaefa3b8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 23:07:52 +00:00
David Cook 714775e370 Bug 38416: Failover to MARCXML if cannot roundtrip USMARC during indexing
This change failsover to MARCXML from USMARC if there are any
warnings generated by MARC::File::USMARC::decode when trying to
roundtrip the record.

Test plan:
0. Apply the patch
1. Setup your koha-testing-docker to use Elasticsearch
2. Create a new record with 15,000 characters in the 500$a field
3. Index that record
(e.g. perl misc/search_tools/rebuild_elasticsearch.pl --biblios -v -v)
4. Note that a warning saying the following appears:
"Warnings encountered while roundtripping a MARC record to/from USMARC.
Failing over to MARCXML"
5. View the "Elasticsearch record" on the detail page and note that the
marc_format is MARCXML
6. Perform a search for the record (the keyword should be something that
brings up other results too)
7. Note that the record appears correctly in the search results

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.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 0d862343dd)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 23:07:52 +00:00
Phil Ringnalda 20c59c0171 Bug 29818: Cannot save subscription frequency without display order
The schema says that subscription_frequencies.displayorder can be null, and
everything else deals with it being null just fine, but if you try to save
a new frequency without specifying display order with strict_sql_modes set,
you get an error.

Test plan:
 1. Without the patch, Serials - Manage frequencies - New frequency
 2. Description is mandatory, so fill it in, then click Save
 3. Boom! Apply patch, restart_all
 4. Repeat steps 1-2, and verify that no error is thrown and the new
    frequency shows up (at the top of the list since nothing comes before
    something)
 5. New frequency, fill in Description, try typing something other than a
    number in Display order and saving. You should be told to follow the
    directions that only numeric characters are allowed

Sponsored-by: Chetco Community Public Library
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 77c003ed54)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 23:05:45 +00:00
Emily Lamancusa cd7f17e968 Bug 38186: Don't initiate transfer when cancelling hold on lost item
To test:
0. In the Circulation Rules, set the default return policy to "item
    returns home (default settings have this already)
1. Find an item belonging to a branch other than the logged-in branch
2. Place a hold on that biblio record for pickup at the logged-in branch
3. Check in the item to set the hold to waiting
4. Set the expiration date to a date in the past
   To do this in KTD:
   ktd --shell
   koha-mysql kohadev
   UPDATE reserves SET expirationdate = < yesterday's date >;
5. Set a lost status on the item
6. Go to Circulation > Holds awaiting pickup
--> The hold should appear on the "holds waiting past their expiration
     date" tab
7. Click the "Cancel and return to <homebranch>" button next to the hold
8. Open the biblio record for the item
--> Note that the lost status is gone and the item shows as in-transit
9. Apply patch
10. Repeat steps 2-8 on the same item
--> This time, the item is still lost and is not in-transit

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1c3ed6e4db)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:59:01 +00:00
David Cook fa90836eda Bug 37854: Re-indent HTML (whitespace-only)
This whitespace only change re-indents the HTML

Signed-off-by: Olivier V <olivier.vezina@inLibro.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 f067830305)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:56:41 +00:00
David Cook b6a5bf7674 Bug 37854: Add fieldset.rows so that Javascript works
This change adds a fieldset.rows that the Javascript produced
by C4/Barcodes/ValueBuilder.pm will work here too like it
does for /cgi-bin/koha/cataloguing/additem.pl and
/cgi-bin/koha/acqui/neworderempty.pl

The fieldset.rows element ruins the styling, so we add some context
specific styling to the styling is preserved.

Test plan:
0. Apply the patch
1. Set "autoBarcode" to "generated in the form <branchcode>yymm0001"
2. Create a vendor
3. Create a backet with "Create items when" set to "receiving an order"
4. Add an order (any order)
5. Close the basket
6. Receive the shipment
7. Click in the barcode field
8. Note that you get a barcode like CPL24090001 and not undefined24090001

Signed-off-by: Olivier V <olivier.vezina@inLibro.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 79b5228116)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:56:41 +00:00
Nick Clemens 1793c53863 Bug 37326: decode barcode file in inventory tool
This patch ensures that barcodes uploaded as a file into batchMod are run through
any transformations to match the behaviour of barcodes entered in a list

To test:
1 - Edit BarcodeSeparators system preference to remove \s
2 - Install barcode transformer plugin:
    https://github.com/bywatersolutions/koha-plugin-barcode-transformer/releases/tag/v1.2.0
3 - Configure the plguin:
item:
  -
    match: "^[A-Z]* \| "
    search: "^[A-Z]* \| "
    replace: ""
  -
    match: " \| .*$"
    search: " \| .*$"
    replace: ""
4 - Go to Cataloging->Batch item modification
5 - Enter a list of barcodes into the 'Scan one by one' box like:
ERR | 12345 | ERR
FOO | 23456 | FOO
BAR | 34567 | BAR
6 - Click 'Continue'
7 - Note the barcodes not found are:
12345
23456
34567
8 - Save the barcodes with extra text into a file
9 - Perform batch mod, supplying the barcodes via the file
10 - Note the barcodes not found are the original strings
11 - Apply patch, restart all
12 - Perform batch modification using file again
13 - Note the not found barcodes are the transformed version
14 - Sign off!

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

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 d794891005)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:55:46 +00:00
Lucas Gass a61cfb1a35 Bug 23426: (Rmaint follow-up) Adjust tests
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:52:36 +00:00
Jan Kissig e849ae175b Bug 23426: (follow-up) Fix failing test to send correct summary flag
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7509681e10)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:50:42 +00:00
Jan Kissig 9d9027cb41 Bug 23426: (follow-up) Enhance sip_cli_emulator.pl for test plan
This follow up enhances the sip_cli_emulator.pl to use start-item and/or end-item as params. With these new params the original test plan can be extended:

Test plan:
a) create several manual invoices for patron 23529000035676 : http://localhost:8081/cgi-bin/koha/members/maninvoice.pl?borrowernumber=19
b) run
     perl misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su term1 -sp term1   -l CPL --patron 23529000035676 -m patron_information -s "   Y      " --start-item=1 --end-item=2
   to get fine 1 and 2 or
     perl misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su term1 -sp term1   -l CPL --patron 23529000035676 -m patron_information -s "   Y      " --start-item=3 --end-item=3
   to retrieve fine 3

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit cfb841f9e6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:50:42 +00:00
Jan Kissig 2685372f23 Bug 23426: (follow-up) This patch reintroduces the former implementation of fine items
The original implementation of fine items was accidently overwritten with this patch. This follow up reverts these changes but keeps additional improvements that were also part of this patch.
These are:
- Returning the active currency as part of the response (BH)
- Fixing the number of items in the response which are specified in BP and BQ when other items as fine items are requested.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e5bd8aec41)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:50:42 +00:00
Jan Kissig 3dec3a9cb8 Bug 23426: (follow-up) Add tests
Test plan:
[1] Prove t/db_dependent/SIP/Message.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
EDIT: Tidied inline.
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit efe0b8c627)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:50:42 +00:00
Jan Kissig d140000c98 Bug 23426: Add fine items to patron information response in SIP2
This patch adds fine items (AV) to patron information response in SIP2
In addition the active currency we be part of the response (BH)
This also fixes the number of items in the response which are specified in BP and BQ in the request

to test:
a) create a manual invoice for patron 23529000035676 : http://localhost:8081/cgi-bin/koha/members/maninvoice.pl?borrowernumber=19
b) in ktd call: perl /usr/share/koha/bin/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su term1 -sp term1   -l CPL --patron 23529000035676 -m patron_information -s "      Y   "
c) verify that no |AV field is in response
d) apply patch
e) in ktd call: perl /usr/share/koha/bin/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su term1 -sp term1   -l CPL --patron 23529000035676 -m patron_information -s "      Y   "
f) verify that response includes fields like '|AVManual fee '

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Tidied inline
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1d80470105)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:50:42 +00:00
Hammat Wele 388186c0ac Bug 36132: Allow to delete multiple patron lists on any page
Plan test :
1. Apply the patch.
2. Create at least 22 patron lists (Navigate to Tools > Patron lists > New patron list).
3. Select the lists you want to delete on the 2nd page
4. Click the "Delete selected lists" button.
5. Confirm that the selected lists have been deleted.
6. Ensure that the button cannot be used if no list is selected.

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 96cc191e10)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:47:32 +00:00
Jonathan Druart 5f5a0b225f Bug 38357: Prevent holidays to be wrongly added
This patch resets @holiday_list to an empty array, to prevent holidays
to be accumulated in worker's memory.

If you added single holidays to library A then others to library B,
holidays from A were also added to B.

Test plan:
Go to /cgi-bin/koha/tools/holidays.pl
Define the holidays for Centerville
 Select a date
 To: another date (pick only 2 days to ease testing)
 Set a title "cpl"
 Tick "Holidays on a range"
 Save
Define the holidays for Fairview
 Select *another* date
 To: another date (pick only 2 days to ease testing)
 Set a title "fpl"
 Tick "Holidays on a range"
 Save

=> Without this patch Fairview has 4 days of holidays instead of 2
=> With this patch applied the dates you selected are considered
holidays for Fairview

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 43e22821a9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:46:15 +00:00
Phil Ringnalda 561b8cdacb Bug 38378: Serial frequency deletion needs to be converted to POST from GET
Deleting a serial frequency is (or can be) a two step process. If you are
deleting a frequency which is in use, you get back a page warning you that it
is in use, which the CSRF changes converted to a form POSTing with a CSRF
token and the new op cud-del. However, to get there you have to go through
the step that's the only step if the frequency isn't in use, clicking a link
that still thinks the op is named del rather than cud-del. That link needs to
instead be a form with a CSRF token and a POST of cud-del.

Test plan:
 1. Without the patch, Serials - Manage frequencies
 2. For any frequency, click Delete, click OK in the confirmation popup
 3. Nothing happened except your URL changing, the frequency is still there
 4. Apply patch, reload Manage frequencies
 5. For any frequency, click Delete, click OK in the confirmation popup
 6. This time, your frequency was deleted

Sponsored-by: Chetco Community Public Library
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit be6e13b50c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:45:06 +00:00
Owen Leonard bf57e14322 Bug 24690: Make OPACPopupAuthorsSearch work with search terms containing parenthesis
This patch updates the OPACPopupAuthorsSearch feature so that it wraps
search terms with quotes. This is the behavior we have in place for
author searches outside the context of OPACPopupAuthorisSearch, e.g.
'au:"Criterion Collection (Firm)"'

To test, apply the patch and enable the OPACPopupAuthorsSearch system
preference.

- Search for a record in the OPAC which has author data containing
  parentheses (it should not be a field linked to an authority record).
- View the detail page for that record.
- Click on one of the problematic author links.
- This should trigger a modal window with a list of authors and
  checkboxes for each.
- With just the single checkbox checked, click "Search."
- The search should return the correct results.
- Test other author searches to confirm that they work too.

Sponsored-by: Athens County Public Libraries
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 d7ae20f0cb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:44:05 +00:00
Nick Clemens 3f2af68a05 Bug 37790: Add skip indexing and holds queue options and verbosity to update localuse script
This patch skips record indexing and real time holds queue updates when updating the localuse field
from statistics. A note is added to the script that the user should reindex if the localuse field is mapped.

Additionally a verbose option is added to the script, and doubled use of GetOptions is removed.

Lastly, a check is added to confirm the items value is being changed before the value is stored.

To test:
 1 - Enable the real time holds queue
 2 - Enable Elasticsearch
 3 - perl misc/maintenance/update_localuse_from_statistics.pl --confirm
 4 - Note all items are touched and reported
 5 - Check the background jobs table - there are many jobs generated
 6 - Apply patch
 7 - perl misc/maintenance/update_localuse_from_statistics.pl --confirm
 8 - Note 0 items are reported updated, no new background jobs
 9 - perl misc/maintenance/update_localuse_from_statistics.pl --confirm --verbose
10 - No items reported
11 - Update some items in the DB
     UPDATE items SET localuse = 99 WHERE itemnumber LIKE '%9';
12 - perl misc/maintenance/update_localuse_from_statistics.pl --confirm
13 - Only the number of items changed above reported
14 - UPDATE items SET localuse = 99 WHERE itemnumber LIKE '%9';
15 - perl misc/maintenance/update_localuse_from_statistics.pl --confirm --verbose
16 - Each item changed reported, and the amounts, and the total items updated.

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 1ba5e028cb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:41:21 +00:00
Phil Ringnalda c64114eef6 Bug 38463: Unnecessary CSRF token in OPAC authority search
Bug 37069 correctly changed OPAC authority searches from a POST to a GET, but
forgot to remove the CSRF token that is only needed for a POST, so now it
clutters up the URL by making the first 107 characters of the query string
meaningless.

Test plan:
 1. Without the patch, in the OPAC, go to Authority search
 2. Change the dropdowns to non-default values so you have meaningful search
    conditions, and search for something that will return results, like
    Topical Term/starts with/a/in any heading/Heading descendant
 3. Copy the URL of your search results, paste it in an email compose window,
    look at what you just pasted and wonder whether that big opaque string is
    actually safe to send to a coworker. Go to lunch. Come back and wonder
    what you searched for, and look at the URL in the browser to try to tell
 4. Apply patch, click the browser back button, reload the page, search again
 5. Copy and paste the URL, notice it looks fine to send, just a search. Look
    at the URL in the browser address bar, notice that within the limits of
    your window size, you can see what you searched for

Sponsored-by: Chetco Community Public Library
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 ddddaf2e3d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:40:18 +00:00
David Nind 8e4413881c Bug 38344: Fix typo - space before exclamation mark in "Thank you !"
In English, there should not be a space before an exclamation mark
in a sentence. For example, "Thank you !" is not correct.

Test plan:
1. Search the codebase for "Thank you !": grep -rn "Thank you !" *
2. Result - one occurance:
   C4/SIP/ILS.pm:317:    return (1, 'Thank you !', '');
3. Apply the patch.
4. Repeat step 1.
5. There should now be no occurances.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1c6dfb5f35)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:38:57 +00:00
Phil Ringnalda d6bc0b103e Bug 38328: Cannot delete ILL batch statuses
You are permitted to delete ILL batch statuses that you (rather than the
system) add, but the UI didn't get the CSRF memo about delete ops needing to
be POSTs with op="cud-delete", so it still uses a GET of ?op="delete" and
fails.

Test plan:
 1. Set the preference ILLModule to 'Enable'
 2. Administration - Interlibrary loan batch statuses - New batch status
 3. Give it a name, an uppercase code, and Save
 4. Click the Delete button to the right of your new status
 5. The page is blank, and if you navigate back to Interlibrary loan batch
    statuses, you'll see that yours was not deleted
 6. Apply patch, reload page
 7. Click the Delete button to the right of your new status, verify it is
    deleted

Sponsored-by: Chetco Community Public Library
Signed-off-by: Sam Sowanick <sam.sowanick@corvallisoregon.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 479df408fc)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:27:55 +00:00
Martin Renvoize 087ceae831 Bug 38322: (QA follow-up) Fix spelling
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a9e7e8f14d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:26:58 +00:00
Nick Clemens 1c2f7e2708 Bug 38322: Adjust tests
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 0e899b8882)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:26:58 +00:00
Jonathan Druart 650ef902d4 Bug 38385: Improve DB update output on error (UI)
When an error occurred during the DB update the UI is not correct.

1. say_success, say_info, etc. show the span tags and are not colored
2. "Everything went okay" shown even if atomic updates failed
3. The same error can be displayed several time (see https://snipboard.io/IGiKgM.jpg)

Test plan:
Create a new db rev and/or atomic update
Have some say_* statement to render messages, and raise an error

For instance:
    say_info( $out, "Use blue for further information" );

    try {
        say_warning( $out, "Use yellow for warning/a call to action" );
        $dbh->do(q{});
    } catch {
        say_failure( $out, "Use red for danger/failure" );
        $_->rethrow;
    };

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0ab32306ee)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:25:02 +00:00
Pedro Amorim fabcb433d7 Bug 37178: Disable sorting on comments column
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0ed10ee3da)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:21:07 +00:00
Martin Renvoize 3d0f11a60c Bug 38390: Add subscriptions+count to vendors embed
This patch adds the subscriptions+count option to the embeddable enum
for the /vendors endpoint.

Test plan
1) Inspect the change to t/db_dependant/api/v1/acquisitions_vendors.t
   and confirm it's testing for the addition of subscriptions_count.
2) Run the above tests and confirm it passes

Note: For the above tests to pass, you will need to ensure your api
bundle is rebuilt after the patches are applied and restart plack.
`yarn build && restart_all` in ktd

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ce5c7695e2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:19:28 +00:00
Andrii Nugged fbdb96e293 Bug 37865: Fix uninitialized value $op warns
[WARN] Use of uninitialized value $op in string eq at /usr/share/koha/intranet/cgi-bin/circ/circulation.pl line 144.
[WARN] Use of uninitialized value $op in string eq at /usr/share/koha/intranet/cgi-bin/circ/returns.pl line 253.
These happen in cases when $op is undef and circulation.pl or returns.pl tries to directly compare it to a string.

To reproduce:
1. Go to "Check Out" and "Check In" circulation pages, or refresh already opened one.
2. Check your logs for "Use of uninitialized value $op" warning.
3. Apply patch.
4. Repeat step 1 and check that no new "Use of uninitialized value $op" error were logged.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8e2b493d67)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:16:43 +00:00
Pedro Amorim 4a460068a8 Bug 38284: Add patron check for TrackLastPatronActivityTriggers
If an invalid or empty cardnumber is supplied to patron status request SIP message, SIP dies silently and no 'READ:' exists on the response.

Test plan:
1) Apply tests plan, run tests:
$ prove t/db_dependent/SIP/Message.t
2) Verify tests fail. Apply 2nd patch. Run tests again. Verify they pass.

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 87256d7ae3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:14:40 +00:00
Pedro Amorim 41e74dd1a1 Bug 38284: Add tests
Sponsored-by: PTFS Europe <https://ptfs-europe.com>
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 5acf88d91d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:14:40 +00:00
Aleisha Amohia d444b97d03 Bug 33348: Tests
prove t/Koha/SearchEngine/Elasticsearch/Search.t

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8e73930408)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:12:00 +00:00
Aleisha Amohia 97477f9258 Bug 33348: (follow-up) Fix if no 008 defined
And copy fix across to Zebra search as well.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7c40544951)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:12:00 +00:00
Aleisha Amohia 8e8979cb4e Bug 33348: Show authority heading use with Elasticsearch
This patch ensures the ShowHeadingUse system preference and feature works as expected when using Elasticsearch as the searchengine.

To test, follow the test plan at Bug 29990 Comment 9. Ensure the SearchEngine system preference is set to Elasticsearch.

Sponsored-by: Education Services Australia SCIS
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0fc9f22a93)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:12:00 +00:00
Paul Derscheid 15e3529648 Bug 38100: (QA follow-up) Tidy changes in C4/XSLT.pm
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8ee8453118)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:09:46 +00:00
Janusz Kaczmarek 1fbd8ebf83 Bug 38100: Unit tests
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit af270fc239)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:09:46 +00:00
Janusz Kaczmarek de82706184 Bug 38100: Items with damaged status are shown in OPAC results as "Not available" even with AllowHoldsOnDamagedItems
Items with damaged status are shown on the OPAC results page as "Not
available" even with AllowHoldsOnDamagedItems set to 'Allow', which is
misleading for the users.  'other/Damaged' status should be assigned
only if AllowHoldsOnDamagedItems is set to 'Don't allow'.

Test plan:
==========

1. Check that AllowHoldsOnDamagedItems system preference is set to
   'Allow'.
2. In librarian interface, change the damaged status of an item by
   setting it to 'Damaged'.
3. In OPAC, make a search for the record with this item attached.  Use
   common words from title to get a list and not a single record.
4. Note that the item in question is labelled as 'Not available'
   (Damaged).
5. Apply the patch; restart_all.
6. Repeat p. 3.  Note that the item is now labelled as 'available for
   loan'.
7. Set AllowHoldsOnDamagedItems system preference is set to 'Don't
   allow'.
8. Repeat p. 3.  Note that the item is now labelled as 'Not available'.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c3dc86286c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:09:46 +00:00
Paul Derscheid 93e9d8dd16 Bug 37998: (QA follow-up) Remove excess whitespace in catalogue/itemsearch_item.json.inc
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 48e7aad1f1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:07:27 +00:00
Janusz Kaczmarek 76f82167f1 Bug 37998: Tabs and backslashes in the data break item search display
If the item data (e.g. callnumber) contains a tab or backslash OR the
title part contains a backslash, the DataTable displaying the item
search results stops throwing an error modal "Something went wrong when
loading the table. 200: OK." and a JS console log: "DataTables warning:
table id=results - Invalid JSON response. For more information about
this error, please see http://datatables.net/tn/1".

Test plan:
==========

1. Make an item search w/o any parameters.
2. From the first result page choose a record and modify the title (245 $a)
   to contain " \ " string. Repeat the item search. You should see a modal
   "Something went wrong when loading the table. 200: OK.".
3. Remove the " \ " from the title.  Verify that the problem no longer occurs.
4. In the same record, insert the string " \ " or a tab (copied from a text
   editor) into item data (itemcallnumber, enumchron, barcode etc.).
5. Repeat the item search. You should see again a modal "Something went wrong
   when loading the table. 200: OK.".
6. Apply the patch; restart_all.
7. Repeat p. 2, 3, 4, and 5.  Verify, that the problem is solved.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d289ebf0b3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:07:27 +00:00
Nick Clemens b3dd152c5e Bug 37478: Rename strict to skip_bad_records and add POD
Option name changed, POD updated.
The reason not to do this by default is that it is an extra record conversion
to check the validity, so may slow down the import.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit cfb72ca7fa)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:06:17 +00:00
Nick Clemens 2e252974f8 Bug 37478: (follow-up) Add MARC::Lint to cpanfile
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 43fd84508d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:06:17 +00:00
Nick Clemens 49fef9bee9 Bug 37478: Add strict mode to bulkmarcimport
This patch adds a conversion from MARC -> XML -> MARC to catch any parsing errors.
If errors are found, we then lint the record to catch any problems, output the
warnings, and skip the record.

To test:
1 - Download the sample records from this bug report
2 - perl misc/migration_tools/bulkmarcimport.pl -b --file=520_nosubfield.mrc -v
    fails!
3 - perl misc/migration_tools/bulkmarcimport.pl -b --file=003_subfielda.mrc -v
    fails!
4 - Apply patch
5 - Repeat 2 & 3 - no change
6 - Add -st switch to the commands:
    perl misc/migration_tools/bulkmarcimport.pl -b --file=520_nosubfield.mrc -v -st
    perl misc/migration_tools/bulkmarcimport.pl -b --file=003_subfielda.mrc -v -st
7 - The records are now skipped, and the script completes
8 - Confirm the warnings generated are useful
9 - Sign off!

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 0306281e41)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:06:17 +00:00
Phil Ringnalda 0b8b8cb782 Bug 38329: Remove orphan confirm_deletion() in supplier.tt
The JavaScript function confirm_deletion() in supplier.tt has either
been an unused orphan since bug 28082 two years ago, or since the switch
from YUI to Bootstrap 12 years ago. Doesn't matter which, nothing calls
it, and if it was called, it would fail by trying to GET with
op="delete" rather than POST with op="cud-delete".

Test plan:
 1. Acquisitions - New vendor, enter a name and Save
 2. Click the name of your new vendor, so your URL is at supplier.pl
 3. Click Delete vendor to verify that deleting still works without this
    unused code which would fail

Sponsored-by: Chetco Community Public Library
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c70946a0be)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:03:25 +00:00
Adolfo Rodríguez 0e2778159d Bug 37863: Fix checking if a patron is already in the list adding users to a patron card batch
If the patron is already in the card batch it won't add it and it will show an error message

Test plan:
1 Create or edit an patron card batch
2 Try adding twice or more the same patron. It will show a success message everytime and you will end up with the same patron several times in the card batch
3 Apply patch, restart services
4 Repeat step 2. The first time you click on add user, it will do it and show the success message (Patron 'Patron name' added.), but after that it won't add the user and it will display an error message (Patron 'Patron name' is already in the list.)

Signed-off-by: Sukhmandeep Benipal <sukhmandeep.benipal@inLibro.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 293afd3de6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 22:00:18 +00:00
Lari Taskula c2606618c0 Bug 35126: Remove onload from opac-addbybiblionumber.pl
To test:

Case a) Adding to a new list

1. Enable virtualshelves system preference
2. Search for any record and click it
3. On the right hand side of record view, click "Save to your lists"
4. A new pop up opens.
5. Under "Add to a new list", give any name to the list
6. Under "Add to a new list", click "Save"
7. Observe popup closing
8. Observe record view page reloading

Case b) Adding to an existing list

1. Enable virtualshelves system preference
2. Search for any record and click it
3. On the right hand side of record view, click "Save to your lists"
4. A new pop up opens.
5. Under "Add to a list", select an existing list
(it can be the same as the one you created in case a, it does not matter here)
6. Under "Add to a list", click "Save"
7. Observe popup closing
8. Unlike case a, observe record view page NOT reloading

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8cfce49d14)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:59:30 +00:00
Phil Ringnalda a60bcd9065 Bug 38325: Cannot delete invoice while viewing it
The link to delete while viewing an individual invoice needs to be updated to
use submit-form-link so it can POST with op='cud-delete'.

Test plan:
 1. Home - Acquisitions, click Search with an empty Vendor: input
 2. Click Receive shipments, enter a number in the Vendor invoice input,
    click Next
 3. In the left sidebar, click Invoices, click Search without any parameters
 4. In the row for your invoice, click the invoice number link
 5. Next to the Save button, click the Delete link, click OK in the
    confirmation alert
 6. You'll see the page reload, and the URL change to include ?op=delete,
    but your invoice remains undeleted.
 7. Apply patch, reload the page
 8. Click Delete, click OK in the confirmation alert
 9. Click Search with no parameters, just to make sure the message about
    "Sorry, but there are no results for your search" really truly means
    that your invoice was deleted and now you don't have any invoices

Sponsored-by: Chetco Community Public Library
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f9bfb4d0ca)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:56:31 +00:00
Phil Ringnalda 783047fb08 Bug 38309: Cannot delete additional fields
Deleting an additional field tries to do a GET of ?op=delete... which no
longer works with CSRF protection. It needs to be a POST with op=cud-delete.

Test plan:
 1. Administration - Additional fields, click any table name
 2. New field, fill in a name and Save
 3. In the row for your field, click Delete
 4. You have a blank page
 5. Apply patch, click the browser Back button, refresh the page
 6. In the row for your undeleted field, click Delete
 7. Your field is deleted

Sponsored-by: Chetco Community Public Library
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d5fbb1e87c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:55:30 +00:00
Emmi Takkinen fda6397bc6 Bug 38257: Do not use js_includes.inc in two different files
Downloading cart didn't work because js_includes.inc file
was included both in basket.tt and intranet-bottom.inc.
This patch removes related codeline from basket.tt.

To test:
1. Search for items and add one or more search results to your cart.
2. Open cart.
3. Attempt to download items from your cart.
=> Either nothing happens.
4. Apply this patch, restart services if needed.
5. Again attempt to download.
=> Download menu should now work as expected.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Sam Sowanick <sam.sowanick@corvallisoregon.gov>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f8e2048913)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:53:48 +00:00
Emmi Takkinen 291b4c074b Bug 38257: Fix cart pop up functionalities
Almost all functionalities in cart pop up were broken
due changes made in bug 37033. Also following errors
were displayed in browsers console:

> Uncaught TypeError: antiClickjack is null
> Uncaught TypeError: $(...).dataTable is not a function

This happens because when 'intranet-bottom.inc' is loaded
after other .inc files in page.

To test:
1. Search for items and add one or more search results to your cart.
2. Open cart.
3. Attempt to use one or more functionalities (download, remove item etc.).
=> Either nothing happens or table is loaded again with no items in
table. However items are still displayed in cart when it's opened again.
4. Apply this patch, restart services if needed.
5. Again attempt to download, remove items, print etc. from cart
=> Everything should now work as expected.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 9cae91c7da)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:53:47 +00:00
Martin Renvoize 71900a9508 Bug 37912: Restore detail-trigger handling
This patch converts our jQuery based click to native JS and restores the
bootstrap modal button click trigger handling.

Signed-off-by: Sam Sowanick <sam.sowanick@corvallisoregon.gov>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 93be319372)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:52:30 +00:00
Baptiste Wojtkowski 1be8a9eedd Bug 37684: Direct link to expired news are broken
When using a direct link to a news (koha.url/cgi-bin/koha/opac-main.pl?news_id=XXX), the link is broken if the news is expired.

Formerly, a using AdditionalContent->get( id => "my_news_id") on an
expired news was returning a news, and calling get without id was
returning all news but the expired ones.

This patch adds tests to check this behaviour by adding one expired news and performing following new tests:
1 - It may not be returned by AdditionalContent.get()
2 - It must be returned by AdditionalContent.get() using its id

This patch fixes the behaviour by addind the new behaviour or
AdditionalContent.get:
1 - Any news must be returned by AdditionalContent.get() using its id;

TEST PLAN:
1 - Apply patch
2 - Remove the changes made to Koha/AdditionalContents.pm
3 - Run tests -> one test must fail
4 - Create a news with a expired expiration date, notice the id of the
  news in the url of the modification panel
5 - Go to "opac.url/cgi-bin/koha/opac-main.pl?news_id=MY_ID" -> notice
  it does not work
6 - Reapply the whole patch
7 - Run test -> all test must pass
8 - Go to "opac.url/cgi-bin/koha/opac-main.pl?news_id=MY_ID" -> notice
  it does work now

Signed-off-by: Olivier V <olivier.vezina@inLibro.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4ad5cbdb97)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:51:37 +00:00
Nick Clemens 7d4399a99f Bug 37550: CheckItemPreSave should run barcodes through barcodedecode
In Koha::Item we run a barcode through barcodedecode before any save.
We should do the same when checking barcodes to avoid a duplicate error
when the barcode is cleaned before it is written to the DB

To test:
1 - Follow previous test plan
2 - Note that after this patch is applied there is no exception
    All items are skipped as duplicate barcodes

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a262ffbdfa)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:50:39 +00:00
Nick Clemens ad83fffffd Bug 37550: Unit test for CheckItemPreSave
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5cab218d91)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:50:39 +00:00
Nick Clemens f7402371c0 Bug 37550: Move item check after error handling
To test:
1 - Grab the sample file on this bug report
2 - perl misc/migration_tools/bulkmarcimport.pl -b --file=spaceditems.pl -v
3 - An exception for 'Duplicate ID' is thrown and script dies
4 - Apply patch
5 - run script again
6 - The script finishes, no items are added, but record is

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5e15ede505)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:50:38 +00:00
Marcel de Rooy c8cab29919 Bug 37365: (QA follow-up) Add error checking around AddFile call
Test plan:
Add a return; in AddFile to simulate a failing db insert.
Verify that an alert pops up.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 35d90969f1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:49:10 +00:00
Marcel de Rooy dd45949443 Bug 37365: (QA follow-up) Add borrowernumber to referrer url
Since we post to add_message, we need to ensure that the
borrowernumber is added to the referrer url. This 'tric' is
already done there for another form.

Test plan:
See original plan.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit fbc2e2e933)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:49:10 +00:00
Jonathan Druart 5c45839b5b Bug 30397: Remove duplicate entry from length menu of patrons search
If you have 20 in PatronsPerPage, there will be two 20 entries in the
length menu of the patrons search.
jQuery.unique is stupid it seems, it requires the array to be sorted (?)

let x = [1, 2, 1, 2]
jQuery.unique(x);
Array(4) [ 1, 2, 1, 2 ]

x = [1, 1, 2, 2]
jQuery.unique(x);
Array [ 1, 2 ]

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 60249a979c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:47:15 +00:00
Lari Strand eada390b35 Bug 35987: Fix broken See highlighted items below link
Signed-off-by: Magnus Enger <magnus@libriotech.no>
Test plan with KTD:
- Issue a couple of items to a patron, and make sure one of them is
  overdue.
- Make sure "Always show checkouts automatically" is not checked
- Reload the page
- Click on the link in "Overdues: Patron has ITEMS OVERDUE See
  highlighted items below"
- Nothing happens
- Apply the patch, restart_all, reload the "Check out" page for the
  patron
- Click on the link again, and the active loans should be shown

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4716b6a43d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:43:05 +00:00
David Cook 4023df1789 Bug 22223: t::lib::QA::TemplateFilters missing built-in TT filter "safe_url" causes false warnings
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 fe495d19df)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:38:47 +00:00
David Cook 629d2a6f6c Bug 22223: Add filter to make item URLs safe in template output
This change adds a "safe_url" filter which takes a text input and
returns a Perl URL object which stringifies to a safe URL.

This change is only needed in the OPAC as the staff interface
handles the item URL display using Javascript not Template Toolkit.

0. Apply patch and koha-plack --restart kohadev
1. Create an item for a record using the following URL
https://koha-community.org?url=https%3A%2F%2Fkoha-community.org
2. Go to the OPAC for that record and verify that the URL is
not double-escaped
3. Create a malicious payload (talk to QA/security team for this if necessary)
4. Note that the malicious payload is escaped
5. prove t/Koha/Plugins/SafeURL.t
6. Celebrate!

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 e8e00cfeb3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:38:46 +00:00
Pedro Amorim fde180efbf Bug 37872: Consider enable_plugins = 0 when fetching plugin backends
This patch builds on top of Andreas patch checking for Koha::Plugins->new() instead as the enable_plugins is already done there.
It also adds a check in reply to Joubu's observation, which is indeed an additional bug.

Test plan:
1) Apply tests patch. Run the tests. Notice it fails
2) Apply the remaining patches. Run the tests. Notice they pass.

Additional (and better) tests can be written, but for now I think this is good enough.
Additional tests should be written on top of bug 36197 (which adds a dummy ILL backend plugin for testing), at:
https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=36197&attachment=171371

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
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 7e336006c2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:34:24 +00:00
Andreas Jonsson 4dfd705f9d Bug 37872: Add guards for enable_plugins
There are ILL-backends that are not implemented as
Koha plugins and does not require plugins to be enabled.

The 'new' method in Koha::Plugins returns undefined if
plugins are disabled.  Therefore, calls to this method
must be guarded by a check that plugins actually are enabled.

Testplan for koha-testing-docker:

- Edit /etc/koha/sites/kohadev/koha-conf.xml and disable plugins by
  setting <enable_plugins>0</enable_plugins>
- sudo koha-mysql kohadev -e "UPDATE systempreferences SET value='1' WHERE variable='ILLModule';"
- Run restart_all.
- In staff interface, go to About koha -> System information. The page
  should load normally (as opposed to returning 500 internal server
  error).

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
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 5ebffcff28)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:34:24 +00:00
Pedro Amorim 264c2ad2f0 Bug 37872: Add tests
$ prove t/db_dependent/Koha/ILL/Request.t
$ prove t/db_dependent/Koha/ILL/Request/Config.t

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
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 6f3a55d2a3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:34:24 +00:00
Aleisha Amohia 57a4503192 Bug 38020: (QA follow-up) Decapitilise 'list'
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a11a866871)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:26:38 +00:00
Yanjun Li 36c8be5dcd Bug 38020: (follow-up) Remove unused delete confirmation code
This follow-up patch removes the unused delete list confirmation dialog in virtualshelves/shelves.tt

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2e8b1e2b5b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:26:38 +00:00
Yanjun Li 9e83ee3ca4 Bug 38020: Change form to submit link
To test:

1. Create a list in the staff interface
2. Go to lists
3. View the list
4. Click the Edit dropdown
5. Notice the two dropdown options for Edit list and Delete list have different formatting and look different
6. Apply patch
7. Try steps 1 through 4 again
8. The delete list button form looks right, and delete function works

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d3488291f6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:26:38 +00:00
Jonathan Druart 848d6e07ef Bug 38303: Set item's replacement price to defaultreplacecost if 0.00
No idea if this is a real bug. This code is fixing the following test
failure:
t/db_dependent/Circulation/CalcFine.t .. 1/7
    #   Failed test 'Amount is calculated correctly'
    #   at t/db_dependent/Circulation/CalcFine.t line 271.
    #          got: '0'
    #     expected: '6'
    # Looks like you failed 1 test of 2.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5776f28efa)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:18:46 +00:00
Matt Blenkinsop 345d1b943a Bug 38297: Add a permissions check to the New vendor button
Test plan:
1) Choose a staff patron and make sure they have permissions to log
   into the staff interface
2) Ensure that the patron does not have the vendors_manage permission
   but give them one other acquisitions permission so that they can see
   the link on the homepage (e.g. budget_manage)
3) In an incognito browser, log in with that patron and go to the
   acquisitions homepage
4) The New vendor button will be visible
5) Click on it and fill in the required fields. Submit the form and it
   will error for lack of permissions
6) Apply patch
7) Return to the acquisitions page and the New vendor button should no
   longer be visible
8) Back in your main browser, give the patron the vendors_manage
   permission and then refresh the incognito window - the button should
   be visible

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 b11b2b213e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:18:02 +00:00
Matt Blenkinsop bf0420b140 Bug 38132: Add data-isbn to shelfbrowser
This patch adds a data-isbn attribute to the shelfbrowser_cover container for use in plugins

Test plan
1) View the patch diff and confirm that the attribute has been correctly added

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 2cca46e611)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:16:35 +00:00
Jonathan Druart 1b27067e9a Bug 33188: Remove warning from Koha::Item->hidden_in_opac
"Use of uninitialized value in string eq"

Test plan:
  prove t/db_dependent/Koha/Item.t
should return green

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit: tidied the tests (tcohen)
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f575d4cd73)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:15:06 +00:00
Jonathan Druart 81ad98eeed Bug 38286: Do not fetch the items if OpacHiddenItemsHidesRecord is set
Koha::Biblio:hidden_in_opac does not need to fetch the items if OpacHiddenItemsHidesRecord is set

Test plan:
  prove t/db_dependent/Koha/Biblio.t t/db_dependent/Koha/Item.t t/db_dependent/api/v1/biblios.t
Should return green

Confirm the assumption above is correct.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit df429e4aba)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:13:12 +00:00
Nick Clemens 5178687b67 Bug 38266: (bug 21083 follow-up) Increment after comparison
To test:
 1 - Define a patron attribute as repeatable
 2 - Add multiple values to a patron (I used borrowernumber 5)
 3 - Tools->Batch patron modification
 4 - Modify the patron from step 1, selecting the attribute you created and checking the box to clear
 5 - View the patron, they look correct
 6 - Check the DB:
    SELECT * FROM borrower_attributes WHERE borrowernumber=5;
 7 - There is one blank value
 8 - Apply patch
 9 - Repeat batch modification
10 - Check the DB, no attribute!
11 - Test with multiple attributes in the batch modification and ensure only the correct one is removed
12 - Sign off

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a62953aa9e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 21:12:08 +00:00
Caroline Cyr La Rose 5b320189f0 Bug 38158: Typo in inventory 'Items has no "not for loan" status'
This patch corrects a typo in the inventory tool when an inventory
is done against not for loan items and an item has no not for loan
status.

To test:
1. Go to Cataloging > Inventory
2. Enter a barcode for an item that has items.notforloan = 0 in the "Or scan items one by one" text box
3. Check all the boxes EXCEPT "For loan" under "Optional filters for inventory list or comparing barcodes" > "items.notforloan"
4. Click "Submit"
   --> In the "Problems" column, it says "Items has no "not for loan" status"
5. Apply patch
6. Reload the page
   --> In the "Problems" column, "Item" should now be singular

Signed-off-by: Sam Sowanick <sam.sowanick@corvallisoregon.gov>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit baf884600d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:17:01 +00:00
Owen Leonard 9007d54b02 Bug 38231: Adjust CSS for search result controls in the OPAC
This patch makes some markup and CSS changes to the OPAC so that
controls are aligned correctly in the "mobile" view's catalog search
results. The patch also removes the border from the controls... I think
the borders looks out of place.

To test apply the patch and rebuild the OPAC CSS.

- Perform a catalog search.
- Check the styling of the controls shown for each search result, e.g.
  Place hold, Add tg, Save to lists, etc.
  - Make sure the controls work well when the browser window is various
    widths, from ~600px and up.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Yanjun Li <yanjun.li@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 b8e69361bd)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:16:09 +00:00
Lucas Gass 5eed8269b2 Bug 37526: DBIC Schema updates
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:07:26 +00:00
Lucas Gass 1fb5bc4d83 Bug 37856: DBRev 24.05.05.007
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:07:26 +00:00
Pedro Amorim aae9a4466c Bug 37856: Add new test to test platform is correctly added to build_url
prove t/db\_dependent/Koha/ERM/EUsage/UsageDataProvider.t

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e7dbd2a8b7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:07:26 +00:00
Pedro Amorim 6b8e7d7152 Bug 37856: Fix existing test
A service_platform value was being randomly to 'service_platform' as is a new attribute.
Assign undef to that to fix existing test

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b3fb2e85fe)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:07:26 +00:00
Nick Clemens 2e9a6b16f9 Bug 37856: (QA follow-up) Tidy
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b7600e4801)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:07:26 +00:00
Pedro Amorim 89de703030 Bug 37856: Add tests
This is using the groundwork from bug 37963.
This is testing the specific error this bug is addressing:
Required parameter Platform is missing

It is also testing that the error message is correctly shown as a background
job report message to the user

Test plan:
prove t/db_dependent/Koha/BackgroundJob/ErmSushiHarvester.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit edb6056a74)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:07:26 +00:00
Pedro Amorim 730ca49e06 Bug 37856: Consider absence of 'Report_Items'
The SUSHI provider in question for this patchset also does not return any
Report_Items entry. This patch accounts for that.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 72b38a1dbf)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:07:26 +00:00
Pedro Amorim c3681fd9ff Bug 37856: Consider 'Exceptions' not being part of 'Report_Header'
When fixing the issue around the missing platform parameter, we
noticed this particular provider also returns 'Exceptions' as
its own thing, not part of 'Report_Header', despite documentation:
https://countermetrics.stoplight.io/docs/counter-sushi-api/7cp0h7n1hm2en-tr-j1-journal-requests-controlled

From the link above, search for 'Exceptions'. Notice it should be under 'Report_Header'.
Either way, this patch accounts for this possibility.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7c175c2160)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:07:26 +00:00
Pedro Amorim c87bb2b3a7 Bug 37856: Add service_platform field
The change from this patch itself should be self-explanatory.
Testing for this requires credentials to a specific provider.
But the parameter is only added to the URL if defined.

Test plan, ktd, apply patch, run:
$ yarn js:build
$ yarn api:bundle
$ koha-plack --restart kohadev

1) Enable ERMModule
2) Create a new provider, visit:
<staff_url>/cgi-bin/koha/erm/eusage/usage_data_providers/add
3) Ensure 'Service platform' now shows. Create the provider and put something in this field.
4) View the provider, ensure the field is shown, visit:
<staff_url>/cgi-bin/koha/erm/eusage/usage_data_providers/1

Ensure all tests are still passing:
$ cypress run --spec t/cypress/integration/ERM/DataProviders_spec.ts
$ prove t/db_dependent/api/v1/erm_usage_*

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b852c042fe)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:07:26 +00:00
Pedro Amorim 8e4ed8d701 Bug 37856: atomicupdate
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2e4b1ca42f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:07:25 +00:00
Pedro Amorim d4a4d38974 Bug 37856: Append platform parameter to SUSHI url if defined
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit dc9a5684f4)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:07:25 +00:00
Nick Clemens 209b685871 Bug 37963: (QA follow-up) Tidy
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5b51ef78d4)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:01:40 +00:00
Pedro Amorim 7baba70b69 Bug 37963: Case 2 - Consider providers returning error messages lower cased
Test plan:
1) Apply only test patch for case 1. Run tests:
prove t/db_dependent/Koha/BackgroundJob/ErmSushiHarvester.t
2) Verify tests fail. Apply the other patch for case 1.
3) Run tests again. Verify they now pass.
4) Repeat the test plan but using patches for case 2

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 23ab84c9b6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:01:40 +00:00
Pedro Amorim d4255bf632 Bug 37963: Case 2 - Add tests for different case error message
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4c76d2b565)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:01:40 +00:00
Pedro Amorim 6987bf779f Bug 37963: Case 1 - Return if sushi_errors even if response code >= 400
This ensures that SUSHI errors, if present, are shown on the UI even if
response->code >= 400.
This means that if, for example, SUSHI provider returns 401 with SUSHI
error like so:
{"Code": 2020, "Severity": "Error", "Message": "API Key Invalid"}

Then, the 'API Key Invalid' will be shown to the user, without having to
check logs.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5d53bb4bff)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:01:40 +00:00
Pedro Amorim 407661f5d3 Bug 37963: Case 1 - Add tests for invalid api key use case
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 05381ba6b1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 19:01:40 +00:00
Mason James 7d17200a38 Bug 37824: remove references to non-existent files in Makefile.PL
to test...

0/ install debhelper tool

1/ run 'DEB_BUILD_OPTIONS=nocheck dh build', observe failure
    make: *** No rule to make target 'koha-tmpl/intranet-tmpl/prog/js/vue/dist/erm.js.LICENSE.txt', needed by 'pm_to_blib'.  Stop.
    dh_auto_build: error: make -j1 returned exit code 2

2/ apply patch

3/ run 'DEB_BUILD_OPTIONS=nocheck dh build', observe success

Signed-off-by: Blou <blou@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c8869aea1c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 18:54:16 +00:00
Paul Derscheid d0de116c8f Bug 37824: (QA follow-up) Fix improper handling of jQuery and DataTables libraries by marking them as externals
This commit addresses an issue where jQuery and DataTables libraries (datatables.net and related extensions) were not functioning correctly when bundled with rspack. These libraries expect to be loaded in the global scope rather than as bundled modules, leading to initialization issues.

To resolve this, jQuery and all related DataTables libraries (datatables.net, datatables.net-buttons, datatables.net-buttons/js/buttons.html5, etc.) are marked as externals in the rspack configuration. This ensures they are treated as global dependencies, preventing conflicts and allowing proper initialization.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit db4f151be5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 18:54:16 +00:00
Katrin Fischer ace4e71eb8 Bug 37824: (follow-up) Add rspack.config.js to Makefile.PL
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 562a240933)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 18:54:16 +00:00
Paul Derscheid babd4f8576 Bug 37824: Replace webpack with rspack for fun and profit
I left the webpack.config.js as well as the devDependencies in place for now.
We can remove them in a follow-up patch on this bug after testing it out.

To test:
1) Run js:build and js:build:prod
2) Note the build time
3) Apply patch
4) Run yarn install
5) Run js:build and js:build:prod again
6) Note the much faster build time
7) Extra credit: take a look at the ERM or preservations module and make sure everything works as expected.
8) Extra credit: run the cypress tests.
9) Sign off or give your opinion

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Looks faster to me. Where webpack failed for me (Killed, error 137), this passed.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 28b6294461)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 18:54:16 +00:00
Jan Kissig 856e522a26 Bug 37209: (QA follow-up) Add default op value to form
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 10687f7c6e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 18:20:35 +00:00
Jan Kissig 84c254f160 Bug 37209: improve Record overlay rules validation and styling
This patch adds jquery form validation to the input named tag. It also changes the behavior for save and edit actions which now both can be triggered by pressing enter. Batch deletion will be only possible if no edit is taking place.

Test plan:
1)
 a) open http://localhost:8081/cgi-bin/koha/admin/marc-overlay-rules.pl
 b) just click + Add rule
 c) the input 'tag' gets highlighted and the form won't submit

2)
 a) edit an existing rule
 b) empty input value for tag
 c) notice the checkboxes for batch deletion on other rules if existing
 d) click Save and check the input 'tag' gets highlighted and the form won't submit

apply patch
1) redo steps and check that form does not get submitted and the input is marked as required via a label that says This field is required.

2) redo steps and check that form does not get submitted and the input is marked as required via a label that says This field is required. Also checkboxes for batchremove actions are gone.

Signed-off-by: Olivier Vezina <olivier.vezina@inLibro.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 a7fb0c431e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 18:20:35 +00:00
David Cook 51daa12f61 Bug 37965: (QA follow-up) fix WYSIWYG in sysprefs
Test plan:
1. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?
op=search&searchfield=UseWYSIWYGinSystemPreferences
2. Enable the system preference to show WYSIWYG in HTML system preferences
3. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?
op=search&searchfield=OPACSearchForTitleIn
4. Add a link for "http://localhost:8081/cool.pl"
5. Note in the source code that the URL gets mangled

6. Apply the patch

7. Repeat the above test plan
8. Note that the URL has NOT been mangled and remains
http://localhost:8081/cool.pl

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6a22ae84fb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 18:19:08 +00:00
Lari Taskula 65eece2670 Bug 37965: Restore Bug 12032 - TinyMCE rewrites urls in a very annoying and unexpected way
To test:
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12032#c3

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7b38dd9a08)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 18:19:07 +00:00
Jonathan Druart d288c5a047 Bug 38234: Remove unused jszip.min.js file
This specific file is not used since Bug 23013 ("Upgrade DataTables in the staff client")

This version is vulnerable and should not be used in the future anyway.

There is a version embedded in our DataTables bundle, which is jszip-3.10.1.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6a00625870)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 18:14:39 +00:00
Fridolin Somers cea77be3c6 Bug 38131: ILS-DI doc must show renewals_count
Since Bug 30275 renamed issues.renewals to issues.renewals_count, the ILS-DI doc needs to be updated in :
koha-tmpl/opac-tmpl/bootstrap/en/modules/ilsdi.tt
Note that service 'RenewLoan' returns 'renewals' this has not changed.

Test plan :
1) Enable ILS-DI webservice
2) Go to opac : /cgi-bin/koha/ilsdi.pl
3) Click on 'GetRecords'
4) Check you see 'renewals_count' in 'Example response'
5) Click on 'GetPatronInfo'
6) Check you see 'renewals_count' in 'Example response'

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 37bd87c6fe)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 18:12:46 +00:00
Pedro Amorim 46c9d1de2c Bug 38233: Add regression tests
prove t/db_dependent/ILSDI_Services.t

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 9ee7673c7e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 18:10:41 +00:00
David Cook 89b6ef3e92 Bug 38233: respect OPAC visibility for ILS-DI GetRecords
This change makes the ILS-DI GetRecords service use the OPAC
version of the MARCXML and filters items based on their OPAC visibility

Test plan:
1. Apply the patch
2. koha-plack --restart kohadev
3. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ILS-DI
and enable syspref
4. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems
and add the following:
withdrawn: [1]
5. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=hidelostitems
Change syspref to "Don't show"
6. Go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=29
7. Add a withdrawn item and a lost item with barcodes of "test1" and "test2" respectively
8. Go to http://localhost:8080/cgi-bin/koha/ilsdi.pl?service=GetRecords&id=29
9. Note the items with barcodes test1 and test2 do not appear in the "items" tree and they don't
appear in the "marcxml" tree.

Signed-off-by: David Nind <david@davidnind.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 369e5ab93a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 18:10:41 +00:00
Lucas Gass 5f8a3f89ea Revert "Bug 38066: Pop-up window footers can block page content"
This reverts commit 4427257af7.
2024-12-05 17:07:39 +00:00
Lucas Gass 49ccb39426 Revert "Bug 38231: Adjust CSS for search result controls in the OPAC"
This reverts commit b8e69361bd.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 17:06:01 +00:00
Owen Leonard 24d58e77a4 Bug 38231: Adjust CSS for search result controls in the OPAC
This patch makes some markup and CSS changes to the OPAC so that
controls are aligned correctly in the "mobile" view's catalog search
results. The patch also removes the border from the controls... I think
the borders looks out of place.

To test apply the patch and rebuild the OPAC CSS.

- Perform a catalog search.
- Check the styling of the controls shown for each search result, e.g.
  Place hold, Add tg, Save to lists, etc.
  - Make sure the controls work well when the browser window is various
    widths, from ~600px and up.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Yanjun Li <yanjun.li@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 b8e69361bd)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 17:04:15 +00:00
Hammat Wele 23adbf215d Bug 37184: Special character encoding problem when importing MARC file from the Acquisitions module
1. Go to Cataloging > "Stage records for import".
2. Upload the file "ExportMemento2024061010532869Marc8.mrc" or a MARC8 encoded file.
3. In the form, select the options :
   - Record type: Bibliographic
   - Character encoding: MARC8
   - Format: MARC
4. Click "Stage for import".
5. Find or create an open basket in the Acquisitions module.
6. Click "add to basket".
7. Select "From a staged file" and select the previous staged file.
9. Click "Select all" to check all records.
10. In the item information tab, choose the Document type.
11. Verify the titles of the records in the basket:
 --> Koha replaces accents with symbols �

12. Apply the patch.
13. Do the same from step 1 and notice there is no more encoding issues.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.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 e8c8b68672)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 16:57:47 +00:00
Jonathan Druart 2c36839323 Bug 30648: deleted_biblio_id can be null
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 63c3b68338)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 16:56:37 +00:00
Owen Leonard 4427257af7 Bug 38066: Pop-up window footers can block page content
The staff interface's default <body> padding is enough to accommmodate
the langugage-selection footer but not the taller fixed footer on pop-up
window pages. This patch adds some CSS to increase the padding on those
pages to prevent page content from being obscured by the footer
navigation.

The patch also adjusts the CSS of the "Back to top" arrow so that it
isn't hidden by fixed footer.

To test, apply the patch and rebuild the staff interface CSS.

- In the staff client, go to Cataloging -> New record.
- In tab one, click the plugin button on tag 100 subfield a.
- Perform an authority search which will return results.
- Scroll down to the bottom of the window and confirm that the last
  lines of the search results are not obscured by the footer.

This change should apply to all pop-up windows which include the same
fixed footer markup, e.g. any cataloging plugin; the transfer order
window; vendor search when adding a subscription, etc.

Sponsored-by: Athens County Public Libraries
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 b09f3a8820)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 16:51:16 +00:00
Katrin Fischer 3a3b285294 Bug 30648: (QA follow-up) Terminology: reserve => hold
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 9c2ec5798b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 16:49:16 +00:00
Lucas Gass 8ec3887b94 Bug 30648: DBIC Schema updates
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 16:47:04 +00:00
Lucas Gass 2d06825508 Bug 30648: DBRev 24.05.05.006
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 16:47:04 +00:00
Nick Clemens ccb75f9815 Bug 30648: Tidy
Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e5b86bb23a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 16:47:04 +00:00
Nick Clemens 1577d3833f Bug 30648: Add new field to REST API
Maybe we just undef it since ti will always be null except for old_hold obecjts
and we don't have that route yet

Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a7ead95c14)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 16:47:03 +00:00
Nick Clemens 368d2c85a1 Bug 30648: Unit tests
Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 69c2abf14b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 16:47:03 +00:00
Nick Clemens 0b0b171558 Bug 30648: Record deleted_biblionumber in holds
This patch ensures the deleted biblionumber is recorded in current and previous holds
before the record is deleted

To test:
1 - Place and fill a few holds on a biblio, completing checkout to patron
2 - Place a few holds on the biblio and do not fulfill them
3 - Delete the items from the biblio via the DB (otherwise you cannot delete last item when there are holds)
    DELETE FROM items WHERE biblionumber={biblionumber}
4 - Delete the biblio
5 - Check the DB and confirm the deleted_biblionumber column has been filled
    SELECT reserve_id,deleted_biblionumber,biblionumber FROM old_reserves WHERE deleted_biblionumber = {biblionumber};
6 - Sign off!

Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7cf1280bee)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 16:47:03 +00:00
Nick Clemens d157ef3f7a Bug 30648: Add deleted_biblionumber column for reserves
Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e289a87111)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 16:47:03 +00:00
Lucas Gass e1c2cf1b6b Revert "Bug 37870: Fix sort order of class sources"
This reverts commit 6cbe190092.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 16:33:26 +00:00
Lucas Gass 15734ad2c3 Revert "Bug 37870: Remove warning if biblionumber is not passed"
This reverts commit 1946bdde6e.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 16:33:26 +00:00
Lucas Gass 146c8327c1 Revert "Bug 37593: Removed all instances of 'this this' in the codebase"
This reverts commit 8297471b3b.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-05 16:26:31 +00:00
Lucas Gass 3f23c156f2 Revert "Bug 38066: Pop-up window footers can block page content"
This reverts commit f10bd3db28.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-12-04 22:43:57 +00:00
David Cook a87e7a3687 Bug 38275: Fix patron card creator image delete
This change changes the patron card creator image delete from a
GET to a POST, and supports single delete and multi-delete.

Test plan:
1. Apply the patch (and refresh browser JS cache)
2. Go to http://localhost:8081/cgi-bin/koha/patroncards/image-manage.pl
3. Upload multiple images
4. Select all the images using the checkboxes
5. Delete one image using the "Delete" button in the row
6. Note that only the image selected using the "Delete" button is
deleted and the other images are de-selected
7. Delete multiple images using the "Delete selected" button
8. Note that the correct images are noted in the confirm message,
and the correct images are deleted

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 f4a25897b0)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-22 21:33:40 +00:00
Lucas Gass 889c351d17 Bug 38274: DBRev 24.05.05.005
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-22 21:33:16 +00:00
Fridolin Somers ec93915064 Bug 38274: Fix typo in arabic language description
In installer/data/mysql/mandatory/subtag_registry.sql we see a missing
char in arabic language description.

Wee see this was correct before Bug 12250 :
&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;

Test plan :
1) Install a fresh Koha with this patch
2) Look in database :
   SELECT * FROM language_descriptions WHERE subtag='ar' AND type='language' AND lang='ar'
=> Check description is correct
3) On a old existing Koha
4) Install patch and run update database
=> Look in database and check description is correct

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 4e1dc5e8b7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-22 21:33:16 +00:00
Matt Blenkinsop 9bf772dd42 Bug 38271: (QA follow-up) Fix testcritic
testcritic was failing due to a 'return undef' so this commit amends that

Test plan:
1) prove t/00-testcritic.t

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 640ce0bc6b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-22 21:30:37 +00:00
Kyle M Hall 5d0a019756 Bug 38271: (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 0f68688b58)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-22 21:30:37 +00:00
Matt Blenkinsop 4eccb57f06 Bug 38271: Handle missing 008 fields in EDI
This patch adds handling to create a default 008 field on MARC records that are missing one when created through EDI.

Test plan:
1) prove t/db_dependent/Koha/EDI.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b00fb3d557)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-22 21:30:37 +00:00
Phil Ringnalda 5ad20d6782 Bug 38251: Make 'Remove selected items' button work when there is one item
There are two ways to remove items from a list: you can remove a single item
by clicking a 'Remove from this list' button below the item, or you can
remove one or more items by checking the checkboxes for them and clicking the
'Remove selected items' button.

Bug 37150 needed to fix 'Remove from this list' for CSRF, because in the wild
old days it just triggered a GET to delete, and instead it needed to POST.
The first patch to do that defined the JS var single_bib, checked the
checkbox for that bib and submitted the form, as though you had used the
checkbox yourself. But if you cancelled the confirmation prompt, it would
need to uncheck the checkbox it checked, so it added a function to do that
if (single_bib). That patch didn't land.

What landed instead was a patch with a separate hidden form that could be
populated with the single biblionumber from 'Remove from this list', but
without single_bib to define that state, it used selected_titles.size() == 1
as the condition to use the hidden form, forgetting that when the user checks
a single checkbox, selected_titles.size() is also 1. The right condition is
the same one used to tell where to get the titles for the confirmation dialog:
if the click event passed along a biblionumber, it's 'Remove from this list.'
Since checking that sets var biblionumber, we can just use that being truthy
as the condition.

Test plan:
 1. Without the patch, open the OPAC and log in
 2. Add any two biblios to a new list
 3. Lists - {your list name}
 4. Click the checkbox for one of the items, click 'Remove selected items'
    and click 'Yes, remove from list' in the confirmation dialog
 5. Note that it wasn't removed
 6. Click the checkboxes for both items, click 'Remove selected items' and
    click 'Yes, remove from list' in the confirmation dialog
 7. Note that both were removed
 8. Apply patch, restart_all
 9. Add any four items to your list
10. Lists - {your list name}
11. For the first item, click the 'Remove from this list' button below the
    details for the item, confirm, make sure it was deleted
12. Click the checkbox for what's now the first item, click 'Remove from
    this list,' confirm, make sure it was deleted
13. Click the checkboxes for what are now the first two items, click 'Remove
    from this list,' confirm, make sure both were deleted

Sponsored-by: Chetco Community Public Library
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f82d8dae0f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-22 21:30:02 +00:00
Johanna Räisä 373099a690 Bug 38188: fix populating the borrowenumberlist from patron_search_selections
This patch fixes the issue of populating the borrowernumberlist from patron_search_selections.
Adding borrowernumbers to the textarea randomly fails because the textarea is populated with the html() function.

To test:
1) Go to the patron search
2) Select a few patrons
3) Click on the "Batch patron modification" button
4) Use browsers back button to go back to the patron search
5) Find patron_batchmod_form from browser inspector, open it.
6) Check that between the <textarea> tags, there are the borrowernumbers of the selected patrons.
7) Apply the patch
8) Repeat steps 1-6
9) Check that <textarea> tags are not populated with the borrowernumbers of the selected patrons.
10) Remove the display:none from the textarea and check that the borrowernumbers are populated there.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Michelle Spinney <mspinney@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 f44a0adb5d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-22 21:23:51 +00:00
Jonathan Druart 4bd535936d Bug 38138: (bug 33398 follow-up) Don't display code for primary contact method
We have several choices for "primary_contact_method", we don't want to
display the code but the label
phone => Primary phone
phonepro => Secondary phone
mobile => Other phone
email => Primary email
emailpro => Secondary email
fax => Fax

Bonus: it will make it translatable.

Test plan:
1. Edit a patron record to add a Main contact method
2. Place a hold for this patron
3. Check the item in
   --> Pop up says "Main contact method:" followed by the choice.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.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 49e09672b5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-22 21:23:21 +00:00
Jonathan Druart 05627133c5 Bug 38128: Fix cypress test
We were mocking the wrong route.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 89b22cc278)
2024-11-22 21:23:04 +00:00
Jonathan Druart 3027cba2da Bug 38128: (Bug 35329 follow-up) Filter ERM users to users with erm permission
There was a silly mistake, we passed the TT var erm_users instead of the
string "erm_users".
It should also be passed to patron_search_modal to display the note.

Test plan:
Confirm that with this patch a patron search in the ERM module returns
only patrons with the erm permission.

Signed-off-by: Pedro Amorim <pedro.amorim@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 0627c092c2)
2024-11-22 21:22:52 +00:00
Owen Leonard f10bd3db28 Bug 38066: Pop-up window footers can block page content
The staff interface's default <body> padding is enough to accommmodate
the langugage-selection footer but not the taller fixed footer on pop-up
window pages. This patch adds some CSS to increase the padding on those
pages to prevent page content from being obscured by the footer
navigation.

The patch also adjusts the CSS of the "Back to top" arrow so that it
isn't hidden by fixed footer.

To test, apply the patch and rebuild the staff interface CSS.

- In the staff client, go to Cataloging -> New record.
- In tab one, click the plugin button on tag 100 subfield a.
- Perform an authority search which will return results.
- Scroll down to the bottom of the window and confirm that the last
  lines of the search results are not obscured by the footer.

This change should apply to all pop-up windows which include the same
fixed footer markup, e.g. any cataloging plugin; the transfer order
window; vendor search when adding a subscription, etc.

Sponsored-by: Athens County Public Libraries
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 b09f3a8820)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-22 21:16:48 +00:00
Lucas Gass 66ee5cfe9f Bug 38041: Pass hide_main for all needsconfirm warnings in SCO
To test:
1. APPLY PATCH and restart_all
2. Make sure the following errors when issuing in SCO show just the error, no other info. on screen:
DEBT
RENEW_ISSUE
ISSUED_TO_ANOTHER
RESERVED
TRANSFERRED
INVALID_DATE ( cant test in SCO )
TOO_MANY
RECALLED

Signed-off-by: CJ Lynce <cj.lynce@westlakelibrary.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 f606e90deb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-22 21:16:28 +00:00
Kyle M Hall 5c72e1f96f Bug 37582: Add unit test
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4d1b0303ff)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-22 21:14:42 +00:00
Kyle M Hall 0845639a8f Bug 37582: Tidy write_msg
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.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 768a5d197c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-22 21:14:41 +00:00
Kyle M Hall d76b6a9b42 Bug 37582: Add ability to for SIP to convert control and separator characters to spaces
This came up with a SIP vendor recently - when reading responses they were only getting part of a patron's information.
It seemed to have been caused by patrons with multiple restrictions and a new line in the response

This patch also does minor refactoring to write_msg to pass the server variable that contains
all the previously passed parameters, and removes the never used "file" parameter.

Test Plan:
1) Add multiple debarments to a patron
2) Run a sip patron information response, note the presence of newlines
3) Apply this patch
4) Add the new option convert_control_characters to your SIP account,
   set the value to " -- "
5) Restart all the things!
7) Run a sip patron information response, note the newlines have been replaced!

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 6a20ac7f99)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-22 21:14:41 +00:00
Fridolin Somers 405ddad65b Bug 36317: Koha::Biblio->host_items must use me.itemnumber
Koha::Biblio->host_items fails with search_ordered() because of ambiguous column 'itemnumber' in where clause.
It must use me.itemnumber like in Koha::Biblio->items

Test plan :
prove t/db_dependent/Koha/Biblio.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a9964bc8a9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-22 21:12:54 +00:00
Fridolin Somers a267e9a25d Bug 36317: Add unit test
If fails it shows :
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'itemnumber' in where clause is ambiguous at /kohadevbox/koha/Koha/Objects.pm line 399

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d193455ec2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-22 21:12:54 +00:00
David Cook 5e7e39e10d Bug 38030: (QA follow-up) Move csrf_token to POST body from URL
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit aec1ad5bab)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-21 14:34:53 +00:00
Janusz Kaczmarek f7dd1d21a8 Bug 38030: stocknumberAV.pl fails with CSRF protection
The value builder stocknumberAV.pl does not work after applying the CSRF
protection. In console, it generates entries like:

POST
http://localhost:8081/cgi-bin/koha/cataloguing/plugin_launcher.pl
[HTTP/1.1 403 Forbidden 188ms]

Test plan:
==========
1. Modify the MARC bibliographic framework for the default framework by
   choosing stocknumberAV.pl as plugin for subfield 952 $i.
2. In Authorized values, add a new category 'INVENTORY'.  Add a new
   entry there, e.g. 'ABC', with any number in Description (eg. 123).
3. Find any bibliographic record, make sure it uses the default framework.
   If not set the framework accordingly.
4. Edit an item linked to this record.  Go to the 'i - Inventory number'
   subfield.  You should see three dots on the right.  In the input field
   put ABC and click the three dots.
5. Nothing happens.  You can check in the browser console--there should
   be a message like:
   POST http://FQDN:8081/cgi-bin/koha/cataloguing/plugin_launcher.pl
   [HTTP/1.1 403 Forbidden 188ms]
6. Apply the patch; restart_all.  Refresh the browser window.
7. Repeat p. 4.  You should now get the next sequence number next to
   the 'ABC' (i.e. ABC 0000000124 or similar).

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit bba164856c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-21 14:34:53 +00:00
Jonathan Druart 82ecc318f9 Bug 38085: Pick multiple_sortable options for translation
Bug 29948 added a "multiple_sortable" type for sysprefs, to have the
options sortable. But the options were not picked for translation.

This patch fixes it.

Test plan:
Run `cd misc/translator && perl translate update LANG` before and after
this patch. Notice that with this patch you see the different options of
OPACAuthorIdentifiersAndInformation in the LANG-pref.po file (eg.
"Associated group (373$a$s$t$u$v$0)")
Translate the options
Install the translated version of the templates and confirm that the
strings appear translated on the interface.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 738c641bcc)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 23:30:45 +00:00
Kyle M Hall 400435d4fb Bug 36560: (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 5f2807b370)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 23:30:20 +00:00
David Cook b8214ffb4a Bug 36560: Add a CSRF exception for ILS-DI API
This change adds an exception for the ILS-DI API for CSRF prevention since there is no way to acquire a CSRF token
for the ILS-DI API.

1. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ILS-DI
2. Enable "ILS-DI"
3. curl -v localhost:8080/cgi-bin/koha/ilsdi.pl -d "service=AuthenticatePatron&username=REALUSER&password=REALPASSWORD"
4. Note the 403 response

5. Apply the patch
6. sudo koha-plack --restart kohadev

7. curl -v localhost:8080/cgi-bin/koha/ilsdi.pl -d "service=AuthenticatePatron&username=REALUSER&password=REALPASSWORD"
8. Note the 200 response

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8472279d5c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 23:30:20 +00:00
Paul Derscheid be478eeb66 Bug 38272: Additionally fix typo in condition for acquisition orders permission
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3ff6ded868)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 23:21:55 +00:00
Paul Derscheid 8de5dd66e6 Bug 38272: Add permission check for erm permission to additional-fields.tt
To test:

1) Create a user with just erm and catalogue permissions.
2) Open additional-fields.pl
3) Notice that nothing is displayed
4) Change the permission of the user to just manage aquisition orders and catalogue
5) Navigate back to additional-fields.pl
6) Notice that nothing is displayed
7) Apply patch
8) Repeat 1-6 but notice this time that the respective entries are displayed
9) Sign off

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 48b938d35c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 23:21:55 +00:00
Tomas Cohen Arazi ec28414168 Bug 38249: Fix typo in koha-list --help
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 85239f0fbf)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:42:39 +00:00
Nick Clemens 5bb19beff8 Bug 38117: Only show 'not checked in' message if item is checked out
To test:
 1 - Enable system preference 'ShowAllCheckins'
 2 - Set system preference 'BlockReturnOfWithdrawnItems' to 'Block'
 3 - Check in an item
 4 - Note 'Item was not checked in message'
 5 - Confirm it happens for any item that is not currently issued
 6 - Check out an item to a patron
 7 - Mark the item as withdrawn
 8 - Check the item in
 9 - Note message 'Item was not checked in' appears too
10 - Apply patch
11 - Confirm checking in an item not checked out only shows 'Not checked out'
12 - Confirm the withdrawn item still shows 'Item was not checked in'
13 - Confirm above message remains whne checking in more items that were not issued

Signed-off-by: Michelle Spinney <mspinney@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 91ba4fcfd7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:42:21 +00:00
Kevin Carnes 2d2e2bbb5a Bug 36171: Fix template toolkit tags split by HTML parser
It appears that the template parser parses HTML tags first and then template
toolkit tags. This can cause a template toolkit tag that contains an HTML tag
to have its start and end markers separated. This causes it to be treated as
text that can be translated instead of a template toolkit tag.

This patch searches for text sections that have a template toolkit end marker
without a start and then searches for the start in previous sections. It then
creates a new template toolkit section with the start and end markers.

The action buttons in the staff Lists view have been changed to allow
translation.

To test:
1. You will need to edit the staff-prog.po for a language and modify the
   the translation for "SET line_break". You can change SET to FOO.
2. Install the translation for the language.
3. View the details of a patron in the staff interface with the language.
4. The page will have an error.
5. Apply the patch.
6. Install the translation for the language.
7. View the details of a patron in the staff interface with the language.
8. The page should now display correctly.

If you want to, you can run "gulp po:update --lang LANGUAGE-CODE" to make sure
that the template tag is no longer included in .po file.

You can also add translations for "Edit", "Delete", and "Transfer" in
messages.po to make sure that the action buttons are translated in the Lists
view.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Amended-by: Jonathan Druart
Tidy

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 cf634fa014)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:42:06 +00:00
Nick Clemens 6264f861a3 Bug 38237: Add POD
This patch adds POD to the script and rpelaces the custom help script with pod2usage

TO test:
perl misc/cronjobs/erm_run_harvester.pl
Confirm you get helpful usage data

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0ff61ab9d9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:41:50 +00:00
Nick Clemens 3bdb9a9624 Bug 38237: Add logging to erm_run_harvester cronjob
This patch simply adds logging to the cronjob

To test:
1 - Enable CronjobLog
    http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=CronjobLog
2 - Enable ERMModule
    http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ERMModule
3 - Home -> E-resource Management -> Data providers -> New data provider
    Fill from registry or create your own, but change the URL and put in any required numbers
    We don't need a real test, just to run the ob
4 - perl misc/cronjobs/erm_run_harvester.pl --begin-date 2024-01-01 --dry-run --debug
5 - View the logs, no log of the script
6 - Apply patches
7 - Run the job again
8 - Check logs
9 - Success!

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6ce5df7f8e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:41:50 +00:00
Phil Ringnalda e890457245 Bug 38200: Remove dead code to delete authorities in authorities/authorities.pl
It has probably never been used. There's no sign of any UI to delete from
the authority editor or auth_finder in the last 13 years of templates, and
it was unused when it landed; the patch that actually made the first patch
work, a month later, put deleting authorities in authorities_home.pl, where
it has been ever since.

It certainly hasn't been used since bug 17600 landed in 2021, since it
doesn't 'use C4::AuthoritiesMarc qw( DelAuthority );' and so if you try to
use it you just get an error for your trouble.

Sponsored-by: Chetco Community Public Library
Signed-off-by: Yanjun Li <yanjun.li@bywatersolutions.com>

Amended-by: Jonathan Druart
tidy

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 3fdf4ebcc1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:34:52 +00:00
Jonathan Druart c746a74674 Bug 38177: Fix lengthMenu by removing extend
$.extend is doing a deep copy of the objects.

```
var dataTablesDefaults = { "lengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, __('All')]] };
var mine = {lengthMenu: [[1, 2, 5, 10], [1, 2, 5, 10]]};
$.extend(true, {}, dataTablesDefaults, mine);
```
Returns:
```
[
  1,
  2,
  5,
  10,
  -1
]
```
Which is ugly and not what we want.

We only need to merge the first level. Using the spread operator (...) will do the trick here.

Note that we certainly want to adjust all the other occurrences of
extend for DT's options.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.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 b1cd9cccd2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:34:36 +00:00
Pedro Amorim b2823543f5 Bug 38177: Fix lengthMenu for components using KohaTable
EBSCO HoldingsIQ doesnt consider a "All" option so neither should we.
At the moment, if we pick 'All', only 100 are listed due to the logic in Providers/EBSCO/build_query_pagination.
The original code hints at trying to do this but its not working.
I think this got lost sometime during KohaTable.vue

This patch should also have the same entry for EHoldingsEBSCOTitlePackagesList but that isnt using KohaTable and for some reason its not picking up on either aLengthMenu or lengthMeny, always shows 'All'.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.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 ca0e745c1d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:34:36 +00:00
Jonathan Druart 8f96db1238 Bug 38177: Do not use stash to retrieve parameters
The pagination for EBSCO's titles, packages and resources is broken. We
shouldn't rely on $c->stash but use params from the request instead.

Test plan:
1) Setup all the system preferences in ERM:
<staff_url>/cgi-bin/koha/admin/preferences.pl?tab=erm
2) Enable EBSCO in ERMProviders. Set the ERMProviderEbscoApiKey and ERMProviderEbscoCustomerID prefs.
3) Do a search that returns more than 20 records. Click on a page other than 1. Notice the records do not change (Page is the same).
4) Apply patch. Repeat. Notice pagination now works.

Search titles, packages and resources
Use the pagination and modify the number of results per page

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.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 61b3aa2aa2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:34:36 +00:00
Magnus Enger 5c70224644 Bug 38173: Fix description of koha-dump --exclude-indexes
To test:
- Look at debian/scripts/koha-dump
- The description of --exclude-indexes reads:
  "Include Zebra indexes on the backup"
- Apply the patch
- Look at the file again. The description is now:
  "Exclude Zebra indexes from the backup"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0c23b98782)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:33:58 +00:00
Magnus Enger 193f5676bf Bug 37787: Remove mention of elastic_index from POD
After the introduction of misc/workers/es_indexer_daemon.pl,
misc/workers/background_jobs_worker.pl should not handle the
elastic_index queue. But the latter script still mentions this
queue in the POD. This patch removes that mention.

To test:
- Run perldoc misc/workers/background_jobs_worker.pl
- Verify "elastic_index" is mentioned under --queue
- Apply this patch
- Run perldoc again and verify the mention of "elastic_index"
  is gone

Signed-off-by: Sukhmandeep Benipal <sukhmandeep.benipal@inLibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 476ae27df0)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:32:53 +00:00
Magnus Enger 30dc2f94f6 Bug 37787: Undocument 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
  not mentioned in the list of "current queues"
- See https://wiki.koha-community.org/wiki/Testing_man_pages for
  how to check the "man" page. elastic_index should not be
  mentioned in the list of "Current queues".
- Both places aboce should have a note about elastic_index not
  being active when koha-es-indexer is running.

Signed-off-by: Sukhmandeep Benipal <sukhmandeep.benipal@inLibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit dba23e4da1)
2024-11-20 18:32:45 +00:00
Jonathan Druart 106e88f281 Bug 37395: Fix columns visibility on Vue tables
On bug 33066 we reworked a lot of datatables.js to make the JS function
reusable from the Vue component (and especially the KohaTable
component). I guess the regression comes from this change, but I am
surprised that we didn't catch it when testing.

The was a mistake for _dt_visibility, we didn't pass the node. Actually
we cannot pass it as we do not have it yet.

This "node" variable is only used when bKohaColumnsUseNames is passed
(ie. we do not rely on the order of the columns but we need to rely on
their data-colname attributes).

There is then a limitation here: we cannot use bKohaColumnsUseNames from
Vue, but we do not yet.

An ideal fix would be too big for now, especially for an hypothetic use
case.

Test plan:
Confirm that the "Columns" button are now back for the tables of the Vue
apps (ERM, Preservation) and that the settings are taken into account
(hide by default, etc.)

Signed-off-by: Olivier V <olivier.vezina@inLibro.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 1a8542f05d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:29:21 +00:00
Jonathan Druart 589cc320fa Bug 35769: Remove extra parenthesis
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 07cf21e6b9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:25:35 +00:00
Katrin Fischer b40117a31b Bug 35769: Fix untranslatable strings in request.tt
This fixes some strings in the JavaScript part of the
template that were missing from the po files.

This is one way to test:
* Apply patch
* Run gulp po:update --lang <language-code>
* Compare strings changed in the patch, with strings
  appearing in <language-code>-staff-prog.po
* Translate the strings and remove "fuzzy" line
* In k-t-d, run:
  sudo koha-translate --install <language-code> --dev <instance>
* Verify that now the translated version of the template contains
  your translated strings
* Verify the translated page works correctly, no errors

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 928b606083)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:25:35 +00:00
Jonathan Druart 006f94a718 Bug 31581: Remove zebra files for NORMARC
Those are leftovers, we should have removed them on bug 18984.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Magnus Enger <magnus@libriotech.no>
Looks good!
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8e5774cdfe)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:25:06 +00:00
Janusz Kaczmarek f1c9a95c3a Bug 38082: Advanced editor does not save the selected framework
When creating a fresh record in the advanced editor, it does not
save the framework selected from the Settings dropdown.

Test plan:
==========

1. Enable the advanced editor feature (EnableAdvancedCatalogingEditor).
2. Start editing a new record in the advanced editor.  Fill in the
   mandatory fields, select a framework (other than Default) from the
   Settings dropdown, save the record.
3. Select view -- note that the record has been saved with the Default
   framework.
4. Apply the patch; restart_all; refresh the browser window.
5. Repeat p. 2.
6. Select view -- you should now see that the record has been saved with
   the correct, selected framework.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 145bc398c1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:24:30 +00:00
David Cook 6bde7f52b9 Bug 38065: (QA follow-up) Move csrf_token to POST body from URL
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a369ace161)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:23:40 +00:00
Janusz Kaczmarek 9acd02725c Bug 38065: Auto control number (001) widget in advanced editor does not work under CSRF protection
Auto control number (001) widget in advanced editor does not work under
CSRF protection.  A token should be passed to POST ...
control_num_sequences call.

Test plan:
==========

1. Verify that the CONTROL_NUM_SEQUENCE category in authorized values is
   present.
3. Add a new authorized value for CONTROL_NUM_SEQUENCE:
     b) authorised value: sprLib0001
     c) in Description - a short string indicating the type of control
     number i.e. "Springfield Library"
4. Create a new bib record using the advanced editor, insert a 001
   field, note that the 001 widget is there.  Click on "Assign next". There
   should be no effect (and you could see [HTTP/1.1 403 Forbidden 706ms] in
   the browser console).
5. Apply the patch ; restart_all ; reload the browser.
6. Repeat p. 4.  You should get the content of the 001 field generated
   by the widget.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit bc1af60e1a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:23:40 +00:00
Lucas Gass 4ac03f9d87 Revert "Bug 36320: Clicking Edit items from catalogue/detail.pl leads to 'Add item' screen"
This reverts commit 71f0dd6ba9.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 18:20:17 +00:00
Matthias Meusburger 0acc0dffb1 Bug 18273: Do not insert authority if there already are duplicates in koha
Test plan:

1) Create an authority with a unique value in a searchable field, for instance a PERSO_NAME authority with 'BZ18273' in the 100$a field.

2) Create a second authority with the same value in the same field.

3) Export this second authority as iso2709 (Save -> MARC (Unicode/UTF-8))

4) Run bulkmarcimport.pl with the following parameters:
perl bulkmarcimport.pl -a --file=/kohadevbox/koha/auth-xxxx.utf8 --match='Heading,100$a' -l /kohadevbox/koha/bulk.log

5) Check in the log file and/or through search that a third authority has been added (despite using the --match option)

6) Apply the patch

7) Delete the 3 authorities and repeat step 1 to 4.

8) Check that a third authority has not been added (--match worked)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2e2fba91bf)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 17:54:43 +00:00
Owen Leonard 71f0dd6ba9 Bug 36320: Clicking Edit items from catalogue/detail.pl leads to 'Add item' screen
This patch updates the catalog toolbar so that the "Edit items"
choice under the "Edit" menu is replaced with a new option: "Manage
items," which takes you to the top of the add/edit items page. The "New
item" menu item has been modified to add the anchor so that the link
jumps the user directly to add item form (past the existing items).

The patch also adds a "Jump to add item form" link at the top of the
add/edit items page.

To test, apply the patch and search for a bibliographic record in the
staff interface.

- View the detail page for the record.
- Click the "Edit" menu button in the toolbar.
- You should see the new menu item, "Manage items."
- Clicking the "Manage items" button should take you to the top
  of the add/edit items page in cataloging.
  - You should see a "Jump to add item form" limk under the page
    heading.
  - Clicking it should jump you to the "Add item" form.
- Clicking the "New item" menu item from the bibliographic detail "New"
  menu should take you directly to the add item form, scrolling down
  past the existing items.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.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 119e5561a3)
2024-11-20 17:44:44 +00:00
Thomas Klausner ca526d63c7 Bug 35466: (follow-up) document skip_indexing parameter to bulkmarciport.pl
Add documentation for the new -si, --skip_indexing parameter

Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e200988cb8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 14:47:19 +00:00
Nick Clemens 9266f2b63f Bug 35466: (follow-up) Go to next if error, add to indexing call if not
Before the previous patch we were indexing with every AddAuthority/ModAuthority call and I assumed
we were also indexing during the commity, however, it appears we were not. This patch ensures we push
the record and ids into the arrays for indexing during commit.

Additionally I add a skip to next record on error, to match biblio behaviour.
I also correct a log referring to biblios during authority importing

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f522fbff32)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 14:47:19 +00:00
Nick Clemens 76c1387263 Bug 35466: Add skip_indexing parameter to bulkmarcimport.pl
This patch adds a new optoin to skip indexing to bulkmarcimport.
It also fixes a bug where authorities were being indexed multiple times
during import.

To test:
 1 - Apply patch
 2 - Download the sample files on this bug
 3 - Perform asearch engine search that should retrieve all records( 'a' in Zebra, '*' in ES)
 4 - Note the total (435 in KTD)
 5 - perl misc/migration_tools/bulkmarcimport.pl -b -v --file=bug_35466_b.mrc
 6 - Search again, note increaed by 100
 7 - perl misc/migration_tools/bulkmarcimport.pl -b -v --file=bug_35466_b.mrc --skip_indexing
 8 - Search again, no increase
 9 - perl misc/search_tools/rebuild_elasticsearch.pl -v
10 - Search again, increase, records were added but not initially indexed
11 - Browse to authorities and search as for biblios
12 - perl misc/migration_tools/bulkmarcimport.pl -a -v --file=bug_35466_a.mrc
13 - Search again, note increase
14 - perl misc/migration_tools/bulkmarcimport.pl -a -v --file=bug_35466_a.mrc --skip_indexing
15 - Search again, no increase
16 - perl misc/search_tools/rebuild_elasticsearch.pl -v
17 - Search again, increase, records were added but not initially indexed
18 - Sign off! Hi5!

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e01fb16455)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 14:47:18 +00:00
Phil Ringnalda 93d5737493 Bug 37977: Fix some issues with labels in inventory form
The inventory form has several issues with labels with a for attribute that
doesn't match the id of the input, so the label doesn't actually get linked
to anything.

Test plan:
 1. Without the patch, go to Cataloging - Inventory
 2. In the section for "Item location filters" click the label for "Shelving
    location (items.location) is", which will focus the select menu, then
    press the down arrow on the keyboard to see that it's focused by opening
    the select menu.
 3. Click in a blank spot to close the select menu, then click the label for
    "Collection" and press the down arrow key, which will scroll the page
    since the label didn't focus the menu, and repeat with "Call number
    classification scheme" which also will scroll the page when you press
    down arrow.
 4. In the section for "Optional filters for inventory list or comparing
    barcodes" click any of the labels below items.notforloan - clicking a
    checkbox label should toggle whether the checkbox is checked, but it
    will not
 5. Apply patch, refresh page
 6. Repeat steps 3 and 4, but this time you will get the proper behavior,
    focusing the select menus and toggling the checkboxes

Sponsored-by: Chetco Community Public Library
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit fa5b7e8260)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-20 14:46:16 +00:00
Phil Ringnalda 6f02fffe11 Bug 38413: Batch operations from item search need to POST to not exceed URL length limits
Batch item modification and deletion accepts either op="show" or op="cud-show"
because sometimes you just have one item and it's saner to GET with one, but
sometimes you've selected 961 items from itemsearch and you need to POST to
not get hit by Apache's "too long" error.

Bug 36630 switched item search from using POST to GET because item search is
confusing. It uses a form with a dummy op and then empties out the form and
adds back contents, and the CSRF protection changed the dummy op to "cud-show"
so it could POST, but didn't notice that the op would be replaced by one that
was still "show." The form needs to go back to POST, the dummy contents need a
comment saying they are just dummies so nobody else gets fooled, and the JS
that replaces the form contents needs to insert a CSRF token and the correct op.

Test plan:
 1. Without the patch, Search - Item search, search with no criteria so you
    get hundreds of items
 2. Change to Show All entries, then Select visible rows
 3. Batch operations - Batch item modification
 4. Apache should give you an error about your overly long URL
 5. Apply patch and repeat steps 1-3
 6. After a long pause while Batch item modification swallows the POST, you
    should get the batch modification form with all your items.

Sponsored-by: Chetco Community Public Library
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 b2ea96e351)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 16:38:46 +00:00
Jonathan Druart db6915c009 Bug 38130: Allow sorting and filtering on library id and name
On the item list of the bib detail page and the patron search we want
the library columns ('holding library', 'home library' and 'library') to
be sorted by library names and to make them searchable on library id and
name.

Concerns about this approach (comment #8):
"""
If we do it for the library names on this view, we need to do it for all the library columns (thinking about patrons right now but I am sure there are others). And to be consistent, for all the other coded values: "special AVs" (item types, cn source), regular AVs, patron category codes, etc.

We will introduce additional JOINs and so maybe performance problems. This needs to be investigated before we take this route IMO.
"""

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1f5e3b66f8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 16:32:52 +00:00
Jonathan Druart 67bba93fd1 Bug 38130: Add the ability to filter item by library name
On the item list of the bibliographic record page you actually can filter
items by library, either using the dropdown list on top of the column
or using the library_id (branchcode) in the global search.

But you cannot search using the library's name in the global search.

This patch add yet other embeds to allow this.

I am not sure this is needed, we won't be able to do the same for item
type and AV, so maybe it is not worth 2 additional JOINS.

Maybe we should tell people you should use the column filters when a
dropdown list is there, instead of: "it works, sometimes".

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4212da8180)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 16:32:52 +00:00
Kyle M Hall cf0a222fb2 Bug 35508: (QA follow-up) Fix qa script issues
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 056abc5321)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 16:03:20 +00:00
Kyle M Hall e5ed5e05f9 Bug 35508: Don't update patron attributes if new list of attributes matches list of existing attributes
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit eed4b0940d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 16:03:20 +00:00
Kyle M Hall 2d340da8f8 Bug 35508: Move logic to Koha::Patron::Attribute::store()
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4624425bf8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 16:03:20 +00:00
Hammat Wele ac1172bf6a Bug 35508: Update borrowers.updated_on when modifying a patron's attribute
Currently, if you have patron attributes and modify the values in a patron's account, the patron's updated_on date is not updated. This patch makes the "Updated on" change when a patron attribute is updated.

To test:

1. Create a patron attribute type
   1.1. Go to Administration > Patron attribute types
   1.2. Click New patron attribute
   1.3. Fill out the code and description
   1.4. Click Save

2. Edit a patron (normal)
   2.1. Go to Patrons and find a patron account
   2.2. Click Edit
   2.3. Change a regular field (e.g. Middle name)
   2.4. Click Save

--> Notice the "Updated on" date in the left column has been updated to now

3. Edit a patron attribute
   3.1. In another patron account*, click Edit
   3.2. Change the value of an attribute
   3.3. Click Save

--> Notice the "Updated on" date did not change

4. Apply the patch
   4.1 Repeat step 3.1, 3.2, 3.3

--> Notice the "Updated on" date has now changed

Signed-off-by: Esther <esther@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ac99bc6db2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 16:03:20 +00:00
Emily Lamancusa 3060f26131 Bug 37505: (QA follow-up) Adjust tests
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c4ac5eb8e8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 15:59:42 +00:00
Emily Lamancusa 5166fb9d3c Bug 37505: (QA follow-up) Don't log return stat if ignore_localuse and no checkout
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 42ba50e1eb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 15:59:42 +00:00
Lucas Gass 6bd354f74d Bug 37505: Remove onloan check when checking out to stats patron
To test:
1.  Create a Statistical Patron
2.  Set BlockReturnOfLostItems to Block.
3..  Mark an item as lost
4. Check it out to the Statistical Patron. You should see the message "Item was lost, cannot be returned."

5. Set BlockReturnOfWithdrawnItems to Block.
6.  Mark an item as withdrawn
7. Check it out to the Statistical Patron. You should see the message "Item was withdrawn, cannot be returned."
8. Turn off BlockReturnOfWithdrawnItems, check out the same item to the Statistical Patron. You should see a message "Item was withdrawn."

9. Place an item on hold.
10. Check it out to the Statistical Patron
11. See the message "Item on hold, please checkin."

12. Make sure  ClaimReturnedLostValue is set to a lost value
13. Claim a return, making sure it is not still checked out to the patron
14. Checkit it out to the Statistical Patron.
15. See the message "Item claimed returned, please checkin."

16. Have an item on a regular patron account that has been recalled.
17. Checkit it out to the Statistical Patron.
18. See the message "Item can fill a recall, please checkin."

Signed-off-by: Kelly <kelly@bywatersolutions.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5ee142c7f7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 15:59:41 +00:00
Andrew Fuerste Henry 40f8e3fb8c Bug 38012: Remove ispermanent from returns and branchtransfers
To test:
There should be no change in behavior, as this code is not referred to elsewhere in Koha. Make sure you can still do checkeckins and transfers.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6760de2d88)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 15:55:13 +00:00
Jonathan Druart 5d390464da Bug 37905: Fix parameter name
It's named enqueued_date on the API side, not enqueued_on (which is the DB
column's name)

No behaviour change expected here.

Signed-off-by: Nick Clemens <nick@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 fac259d2b9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 15:55:13 +00:00
Jonathan Druart c2284dbaf9 Bug 37905: Use correct RFC3339 formatted date to the server
This patch suggests to revert the previous attempt to fix this problem.
The date was using the client-side's tz and so the "last hour" was not
matching the one from the server.

With bug 37831 with simply need to pass a rfc3339-formatted date and the
filtering will be done as expected.

Signed-off-by: Nick Clemens <nick@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 caca6791ce)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 15:55:13 +00:00
Bo Gustavsson 26cbf2492d Bug 37836: Prevent submitting empty barcodes in Self check-in
This patch disbles the "Submit" button when the barcode field is empty.

To test this patch:

Add the patch to your koha clone
Enable the "SelfCheckInModule".
Open the page and the "Submit" button should be disabled when the barcode field is empty.

Signed-off-by: Sam Sowanick <sam.sowanick@corvallisoregon.gov>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 07d212c024)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 15:55:13 +00:00
Baptiste Wojtkowski 9cc99b3eaf Bug 37606: Fix framework export module to escape double quotes
When exporting a framework as csv, the exporter does not check the presence of double quote in the fields. Hence, if there is one double quote, the csv is broken.

TEST PLAN:
1 - Change a framework to add a field containing double quote in name
2 - Export it in csv
3 - Create a new framework
4 - Import the csv in the new framework -> every fields after the one
containing double quotes should be broke. Every other fields should have
no subfield
5 - APPLY PATCH
6 - Repeat 2-5 -> everything should be correctly exported

Signed-off-by: Sukhmandeep Benipal <sukhmandeep.benipal@inLibro.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5f45818cf7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 15:55:13 +00:00
Katrin Fischer 89507ca8d5 Bug 37528: (QA follow-up) Slight rephrase of system preference and warning message
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 55c6df46b7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 15:45:35 +00:00
Baptiste Wojtkowski 0b824af4ed Bug 37528: (follow-up) Add help strings for blank borrowerrelationship
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit dd1bef0ea8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 15:45:35 +00:00
Baptiste Wojtkowski b4855d5c09 Bug 37528: (follow-up) Tidyness
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ec5d2c9ff9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 15:45:35 +00:00
Johanna Räisä 2e7e5c4659 Bug 37528: check if selected relationship is valid
This patch checks if the selected relationship is valid before trying to save the patron record.
It takes the list of valid relationships from borrowerRelationships syspref and checks if the selected relationship is in the list.

Also this patch fixes relationship field required message when BorrowerMandatoryField is not set.
The required message is shown when adding the guarantee from guarantor's detail page.

Test plan:
1) Add at least one option to borrowerRelationships syspref.
2) Leave the relationship unchecked from BorrowerMandatoryField syspref.
3) Create a new guarantee patron.
4) Add a guarantor to the guarantee patron.
5) Leave the relationship field empty and try to save the patron record.
6) Notice the 500 error page.
7) Apply the patch.
8) Repeat steps 3-5.
9) Notice the error message "Guarantor relationship is invalid".

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.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 9ea82b05d5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 15:45:35 +00:00
Hinemoea Viault b99b51deef Bug 37403: Wrong progress quantity in job details
In fact the system adds a previous value to the progress. As if the system keeps a previous value and adds the correct count of records in addition.
This patch removes the previously stored value.

To test:
1. Go to Cataloging > Stage records for import
2. Choose a file with bibliographic records and click Upload file
3. In "Look for existing records in catalog?" choose a record matching rule (e.g. ISBN)
4. Click Stage for import
5. Click View detail of the enqueued job
   --> Progress show 2/1
6. Apply the patch
7. Repeat steps 1 to 4
8. Click View detail of the enqueued job
   --> Progress show 1/1

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>

qa script:
Commit title does not start with 'Bug XXXXX: ' - d1bebb34d7

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Fixed patch subject line
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 929e906187)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 15:43:39 +00:00
Emily Lamancusa 75e1b19ce5 Bug 38146: Display full datetime of datelastseen in item holdings
To test:
1. Check in an item
2. Look at the item holdings table for the bib record that item is on
--> Note the date last seen column displays dates, but not the time
3. Apply patch and restart_all
4. Refresh the page
--> Date last seen column now shows the time you checked the item in

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.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 d60057b429)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 15:43:04 +00:00
Emily Lamancusa c9c44b5c69 Bug 38112: (QA follow-up) Hide description when search is cleared
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ad4ce38551)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 15:42:28 +00:00
Jonathan Druart 9bfea2a66b Bug 38112: Restore description of patrons search
Certainly caused by bug 35329.

We used to display a description of the patrons search, but it is no longer displayed.

Test plan:
On the main patrons search select some values in the form on the left
and search. You should see a "Patrons found for: " h3 that will be
displayed and is supposed to describe the current search.
I don't think it's working very well to be honest, maybe a candidate for
candidate, especially if nobody else noticed its disappearance.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 913052d23c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 15:42:28 +00:00
Jonathan Druart a3206ef0d5 Bug 38240: Do not hide columns if no items to display
If you filter items using the column filters and that no item are displayed, all columns will be hidden (because no data for those columns) and it is then impossible to reset the filters show items again.

Test plan:
http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=4
All items are from CPL
Select another library
=> No items displayed
Without this patch the headers are hidden and it's impossible to modify
the filters
With this patch the columns that were displayed on the last draw are
still there, letting you modify the filters

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7c9ae2d83b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 14:54:00 +00:00
Jonathan Druart f70f31ed5d Bug 38118: Display columns if not empty in drawCallback
Instead of updating only when DT init is complete we are going to update
the visibility when the table will be redrawn.

Test plan:
1 - Find/Add a bib record with no items
2 - Add 20 items from Centerville
    Edit ->Edit items -> enter CENTER1 into barcode ->'Add multiple copies' -> 20
3 - Add 20 items from Fairview as above but enter 'FAIR1' for barcode and 'FAIR ITEM' as callnumber
4 - Add 1 item from Midway with barcode MIDWAY1
5 - Edit a midway patron to grant 'catalogue' and 'edit_items' permission - NOT edit_any_item
6 - Sign in as the patron above
7 - Find the record
8 - Note there is callnumber and actions/edit columns
9 - Go to page 2 of items - callnumber visible
10 - Go to page 3 - edit column

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-19 14:50:49 +00:00
Lucas Gass 491ad084ba Bug 38162: Pass the rota_id correctly when deleting
To test:

1. Enable StockRotation
2. Got to Cataloging -> Stock rotation
3. Create a new Rota
4. Try to delete it
5. See the error "Can't call method "delete" on an undefined value at /kohadevbox/koha/tools/stockrotation.pl line 231"
6. APPLY PATCH
7. Try again, the rota should be deleted properly.

Signed-off-by: Laura ONeil <laura@bywatersolutions.com>
Signed-off-by: Alyssa <alyssa.drake@bywatersolutions.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit dd4822e400)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 23:25:32 +00:00
Brendan Lawlor d59cc9176c Bug 37304: Fix created by filter in Acquisitions advanced search
This patch updates the field for the created by filter from
ui.item.borrowernumber to ui.item.patron_id

Test plan:
1. Add a vendor and a basket
2. Use advanced order search to search for created by 'koha'
3. Use the autofill dropdown to make the selection and click 'Search'
4. Your search returned no results.
5. Apply patch and repeat steps 2 and 3
6. Confirm the search returns the basket you created earlier

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c18f368411)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 23:25:14 +00:00
Kyle M Hall 580cf78aff Bug 37070: (QA follow-up) Fix qa script issues
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit bfe67da62d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 23:24:53 +00:00
Hammat Wele 0cc899ac3d Bug 37070: Incorrect barcode generation when adding orders to basket
When the autoBarcode preference is set to « generated in the form 1, 2, 3 » and the maximum barcode is length 16 (ex 1000000000000000),
when adding orders to the basket,the numbers generated are in the hexadecimal form.

to reproduce:

1- Set the system preference autoBarcode to « generated in the form 1, 2, 3 »
2- Search for a biblio record
3- In the record details, click on New -> New item
4- fill the Barcode field to a number with length 16 (1000000000000000) and add the item
5- Create a suggestion
    5-1- Go to Acquisitions and click on suggestions
    5-2- Create a suggestion and accept it
6- Add a new order to a basket
    6-1- Go to Acquisitions and find a vendor
    6-2- Create a new Basket
    6-3- on the Basket click on 'Add to basket' and select 'From a suggestion'
    6-4- Add the order created on 5-2- to the basket
    6-5- On the item form click on Add item
    6-6- Select a Fund and save the order
7- In the orders table click on the record and check the item Barcode
    ---> the Barcode is in hexadecimal form
8- Cancel order and delete the catalog record
9- Apply the patch
10- Repeat step 6-4, 6-5, 6-6
11- Check the item Barcode
    ---> the Barcode is not in hexadecimal form
12- run prove t/db_dependent/Barcodes.t

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 898cb34fef)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 23:24:53 +00:00
wainuiwitikapark b5ac0ad18b Bug 37838: Fix broken remove button in course reserves
To test:
1) Go to staff client -> Course reserves
2) Create a course or go to an existing course
3) Add reserves to the course (will need at least 21 items to be able to go to a second page of results)
4) Go to the second page of results on the course details page
5) Click the Remove button next to a result
6) Notice how the button just makes the page move to the top
7) Apply patch
8) Repeat steps 1-5
9) Notice how the remove button is working as expected

Sponsored-by: Toi Ohomai Institute of Technology
Signed-off-by: Sam Sowanick <sam.sowanick@corvallisoregon.gov>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit bbd644444f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 23:24:25 +00:00
Lucas Gass 0296350239 Bug 38005: (follow-up) Add/adjust tests
NC amended patch, tidied
Bug 38005: (QA follow-up) Tidy

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0f3d1f3daf)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 23:21:08 +00:00
Lucas Gass e198c2afde Bug 38005: Pass opac_editable to search params when interface is OPAC
1. Create a patron attribute.
2. Check it as Mandatory.
3. Do NOT make it display or editable in the OPAC.
4. Go to OPAC self reg form
5. You will not see the attribute.
6. Submit the form and see the 500 error.
7. Apply patch, restart_all.
8. Try again, now you should be able to submit the OPAC form.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: David Nind <david@davidnind.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 fbdd43a6a1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 23:21:08 +00:00
Andrew Fuerste Henry 718ecb5328 Bug 38097: Add class to not_retuned message
To test:
1: Enable ShowAllCheckins
2: Check in an item that was not checked out
3: Find "Item was not checked in" message in checkin table, confirm its only class is "problem"
4: apply patch, restart_all
5: repeat 2
6: confirm "Item was not checked in" now has the class "not_returned"

Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 01ebb27b5e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 23:19:46 +00:00
Lucas Gass be96ec063f Bug 37954: DBRev 24.05.05.004
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 23:16:08 +00:00
Nick Clemens a58c132a16 Bug 37954: Atomic update
Signed-off-by: Nick Clemens <nick@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 4355f54f5c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 23:16:08 +00:00
Pedro Amorim 7712993222 Bug 37954: Fix barcode column name
Patch https://github.com/Koha-Community/Koha/commit/6cbbfa2 changed
holdings_barcode to holdings_barcodes

I believe this caused the configuration from the table to no longer
work (barcodes!=barcode)

Test plan:
1) Access any bibllio:
   <staff_url>/cgi-bin/koha/catalogue/detail.pl?biblionumber=76
2) On the top right of the table, click 'Configure'
3) Expand 'Catalog', search for 'holdings_barcode'. Tick 'is hidden by
   default'. Save.
4) Visit the biblio again, notice the column is still showing.
5) Apply patch. Restart all + flush_memcached. Repeat.
6) Bonus: On the table, click 'Show filters'. Make sure barcode
   filtering still works.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@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 e89dc927df)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 23:16:08 +00:00
Aleisha Amohia c46e5c782d Bug 36435: Catch harmless errors in koha-dump
tar has exit status 1 if any file has changed while being read, which is likely to happen as the logfiles are included. this patch will catch these harmless errors so that koha-dump will still return a success code.

Test plan:
1. Create a number of backups and edit their modify time to being older than 2 days
2. run the koha-run-backups script and try and write to one of the files it includes while it's being backed up (you'll trigger a warning from tar saying the file changed as it was being read)
3. verify that the older backups are not being cleaned up and deleted despite new backups being made.
4. Apply this patch
5. Complete steps 1-2 again and then go and look to see if the older backups are being deleted.

Sponsored-by: Catalyst IT
Signed-off-by: David Nind <david@davidnind.com>
Co-authored-by: Michał Kula <148193449+mkibp@users.noreply.github.com>
Signed-off-by: Michał Kula <148193449+mkibp@users.noreply.github.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 0119429ac5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 23:13:42 +00:00
Laura Escamilla 464978912b Bug 13945: Prevent multiple dialog modals from popping up when capturing a hold at checkin
1. Select/Create Library Branches:
    - Select or create two library branches: Library A and Library B.

2. Locate/Create Item:
    - Locate or create an item with the "Current library" and "Home library" set to Library A.

3. Place Hold:
    - Place a hold on the item for a patron whose pickup location is Library B.

4. Check-in at Library A - First Attempt:
    - Check in the item at Library A.
    - Verify that the 'Hold found' modal pops up.
    - Click on 'Confirm hold and transfer'.

5. Check-in at Library A - Second Attempt:
    - Check in the item at Library A again.
    - Verify that the 'Hold found' modal pops up.
    - Click on 'Ignore'.
    - Verify that the 'Please return this item to (Library B)' modal has popped up behind it.

6. Apply Patch and Restart:
    - Apply the patch to the system.
    - Restart all relevant services.

7. Repeat Check-in Process:
    - Repeat steps 4 and 5.
    - Verify that no matter how many times you check in the item and hit 'Ignore' or 'Confirm the hold', the second modal does not pop up.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 87a2aa8a62)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:58:56 +00:00
Nick Clemens d3db300f3d Bug 38109: Sort patron category types before display
To test
1 - Patrons -> New patron -> {any category}
2 - Find the category dropdown
3 - Note the order of categories types
4 - Reload the page
5 - Note a new order
6 - Apply patch
7 - Refresh page, category types now ordered (by code)
8 - Refresh again, no change!

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3b438c2b89)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:54:13 +00:00
Martin Renvoize 41fad6a308 Bug 38089: (follow-up) More fixes for errors in original submission
The original submission missed a number of slip types that are print on
demand without queueing.

These all need an "id" passing in to the template and in some cases we
were also missing passing in the new style parameter too (preservation)

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3ab343b67e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:53:55 +00:00
Nick Clemens 160fd0724e Bug 38089: (QA follow-up) Ensure style works on members/printslip.pl
When moving the style up, it was moved before the code that handles printing a single slip, i.e.
taking the variables and forming a slip hash.

This patch moves that code to the top and additionally passes through the CODE of the notice so the ID is not blank

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 03e17cda38)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:53:55 +00:00
Martin Renvoize 002694b9f8 Bug 38089: Move style to head and correct regular expression
This patch moves the local style sections from the body to the head
where they belong and it also updates the regular expression used to
prepend the slip_id id to css selectors rather than replace them

To test:
1 - Create a new notice in the 'Patron (custom slips)' module called 'Testing'
2 - Set print content as:
    Try the  <span class="styled">styling</span> stuff.
3 - Set the 'Format' as:
    .styled {color:red;font-weight: bold;}
4 - Set system preference IntrnaetSlipPrinterJS to "//test"
    http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=IntranetSlipPrinterJS
    This will prevent auto printing popup
5 - Go to a patron and click Print -> Print Testing
6 - Note incorrect styling
7 - Apply patch, restart all
8 - Print Testing again
9 - Confirm styling is correct

Signed-off-by: Nick Clemens <nick@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 4465931242)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:53:55 +00:00
Julian Maurice eb39ce87ca Bug 38027: (QA follow-up) Fix flatpickr onChange when input is cleared
With the onChange event handler fixed, it's ok to call clear() instead
of setDate('')

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b892af285b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:53:14 +00:00
Lucas Gass 11e025e40a Bug 38027: Set date to empty value instead of using flatpickr clear()
1. Find a datetime field in Koha. For example, specifying due dates on the checkout page.
2. Specify a datetime.
3. Use the red 'X' icon to clear the date.
4. Notice a console error 'parsedDate' is undef
5. Now the flatpickr is date, not datetime
6. APPLY patch
7. Try again, this time no console error and the flatpickr remains a datetime one

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4d4337bbed)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:53:14 +00:00
Nick Clemens c41dacb551 Bug 37709: Die and notify if file cannot be opened
1 - perl misc/migration_tools/bulkmarcimport.pl -b --file=notafile.mrc -v
2 - Output:
    Characteristic MARC flavour: MARC21

    0 MARC records done in 0.00804400444030762 seconds
3 - Apply patch
4 - perl misc/migration_tools/bulkmarcimport.pl -b --file=notafile.mrc -v
5 - Output:
    Characteristic MARC flavour: MARC21
    Could not open notafile.mrc: No such file or directory at misc/migration_tools/bulkmarcimport.pl line 262.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0546217cdc)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:52:49 +00:00
Martin Renvoize 26e3f78225 Bug 36375: Fix inconsistencies in content warning display
As suggested by Fridolin, we move the display into a template to improve
consistency and maintanence and whilst doing this we also pick the
suggested subfield selection.

Signed-off-by: Hannah Prince <hannah.prince@uhb.nhs.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e086d2f81d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:49:47 +00:00
Jonathan Druart 671a8b4534 Bug 38035: Exclude "sound" from the list of installed languages
Not sure how this is coming from, neither why we have not noticed that
before, but "sound" is listed under `koha-translate --list`

It's coming from `ls koha-tmpl/intranet-tmpl/prog`

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit e8170909f4)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:49:20 +00:00
Pedro Amorim cae46299c6 Bug 38000: Update imports
Noticed this while debugging a search related problem on a live server. This is cosmetic only.

Signed-off-by: Shi Yao Wang <shi-yao.wang@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit d6fbbf9884)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:49:20 +00:00
Jonathan Druart fab6ee606c Bug 37931: Adjustment for "show fewer" link
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 1b37706679)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:45:34 +00:00
Lari Taskula 79f86508a7 Bug 37931: Fix OPAC item type facet label
To test:
1. Have additional language installed and set up for OPAC
2. Search something
3. Notice "Item types" facet label untranslated
4. Apply patch and make sure translations are updated
5. Observe facet label "Item types" translated
6. See patch [1] "Bug 36750: Fix some labels" in Bug 36750
7. Observe item type change missing for OPAC but present in staff client

[1] https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=166289

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 b217189103)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:45:34 +00:00
Jonathan Druart ccae9199fc Bug 37928: Add missing dropdown-item class to "Upload image"
"Upload image" item not correctly styled

Test plan:
Go to the bib detail page with at least one item.
Open the action dropdown list and notice the "Upload image" is correctly
styled with this patch

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 35111fcf39)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:44:58 +00:00
Owen Leonard c538d2bae6 Bug 37848: Fix "Run with template" dropdown menu style
This patch adds the missing "dropdown-item" class to the "Run with
template" dropdown menu markup in order to correct the menu's style.

The patch also adds a template ID to the menu items' id attributes so
that we don't have duplicate IDs.

To test, apply the patch and go to Tools -> Notices.

(testing steps copied from Bug 36157)

1. Create a notice with the module of "Reports" -- add something to the
   "Print" section. Example from the other bug:

    [% FOREACH b IN data %]
      <div class="panel panel-default">
         <div class="panel-heading">[% b.surname %], [% b.firstname %]</div>
         <div class="panel-body">Expiration: [% b.dateexpiry %]</div>
         <div class="panel-footer">ID: [% b.borrowernumber %]</div>
      </div>
    [% END %]

2. Create and run a saved report. Example from bug 36157:

    SELECT * FROM borrowers

3. Click on the "Run with template" dropdown and confirm that it is
   styled correctly.
4. Click to run the report with the template and confirm that it works
   correctly.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
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 d9be17863a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:44:41 +00:00
Chloe Zermatten 4bb06ac1cb Bug 37730: Batch patron modification header scroll
When scroling down <staff_url>/cgi-bin/koha/tools/modborrowers.pl,
there is a point where the table header leaves the normal flow of
the page to stick to the top of the screen instead. When this
occurs, the header becomes fixed: if scrolling through the table
horizontally, only the body will move. This is an issue as it means
that in this situation, some column headers cannot be viewed and the
data does not necessarily match the header under which it is found.

This patch resolves this issue by allowing the header to scroll
horizontally and ensuring that the width of the column headers
still match that of the columns themselves.

Test plan:

A) Reproduce the bug as per Pedro's intructions:

***
1) Visit "batch patron modification":
<staff_url>/cgi-bin/koha/tools/modborrowers.pl
2) Enter multiple cardnumbers, in k-t-d you may use these:
23529000104159
23529000120056
23529000714163
23529000651225
23529000445172
23529000105040
23529000224510
23529000591678
3) Press "Continue"
4) Scroll down the page enough that the table headers row becomes
   "detached"
   and sticks to the top of the page as you scroll down.
5) Scroll the table horizontally. Notice the headers are stuck even
   though
   the data columns have moved horizontally, causing the headers and
data to
   not match.
***

B) Apply the patch
C) Go through steps 1-5 again. This time, notice that the header scrolls
   along with the table body and that the column headers and data always
match.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 569366e447)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:41:05 +00:00
Lucas Gass 0645773f3d Bug 37446: DBRev 24.05.05.003
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:39:24 +00:00
Aleisha Amohia b2341ea6d0 Bug 37446: Fix search facets for holding and home libraries
This bug ensures that the facet labels for holdingbranch and homebranch are updated, regardless of how the DisplayLibraryFacets system preference is set.

To test:

1. Check out an earlier version of Koha, for example `git checkout v23.11.08-1`
2. Spin up your development environment with elasticsearch, for example `ktd --es7 up`
3. Once it's ready, go to the staff interface and search for the DisplayLibraryFacets system preference in Koha administration. Set to 'holding library' if not already.
4. Do a catalogue search, notice the facets on the side. "Holding libraries" should show as normal. There should be no facet for home libraries.
5. In your terminal, check out 24.05.x, for example `git checkout v24.05.03`
6. Run database updates to upgrade Koha, for example `sudo koha-upgrade-schema kohadev`, and restart services `restart_all`
7. Repeat step 4. Notice the error in the facets "homelibrary"

8. Apply patch from Bug 37446
9. Repeat step 6
10. Repeat step 4. This time the facet should read "Home libraries"

Sponsored-by: Toi Ohomai Institute of Technology
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit bf637c3534)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:39:24 +00:00
Michał Dudzik bb130a573b Bug 37265: Consideration of UniqueItemFields setting when receiving items in an order
When using the Koha acquisition module to receive items (basket receiving
an order), Koha does not consideration of UniqueItemFields setting.
The problem is that you can accidentally attach 3 items to an order with the same values.

Test plan:
1. Set preference UniqueItemFields: Public note (itemnotes)
2. Go to the acquisition module.
3. Create a basket with the option for 'Create items when:' set to receiving an order.
4. Add an order to the basket, for example: From a new (empty) record with the Quantity set to 3 or more.
5. Close the basket.
6. Receive the order.
7. Add a public note: TEST, and receive the first item (Add item).
8. You will see that the next item has the same public note.
9. Apply this patch and repeat step 7 - the public note is not used for the next note.

Sponsored-by: kohawbibliotece.pl
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 1b923e946a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:39:24 +00:00
Fridolin Somers 7b5cacc6ad Bug 37964: Add units test
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Amended-by: Jonathan Druart
Tidy

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 4447352f81)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:30:38 +00:00
Fridolin Somers bd9c430867 Bug 37964: Only show host items when system preference EasyAnalyticalRecords is enabled
After Bug 33496, host items are displayed even when system preference EasyAnalyticalRecords is disabled.

Test plan :
1) Build an analytical record with 773$0 and $9
2) Enable 'EasyAnalyticalRecords'
3) Go to catalogue details page
=> You see the linked item
4) Disable EasyAnalyticalRecords
5) Go to catalogue details page
=> You dont see the linked item

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

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 f27d58f72f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:30:38 +00:00
Owen Leonard fdebb79443 Bug 35087: (follow-up) Accept only values which will be saved correctly
This patch adds a regex (thanks to Katrin for the help) specific to the
range of values which will be accepted by the discount column in the
database which has the type "float(6,4)".

The patch also removes the format() filter from the template so that
values returned from the database won't be truncated:

Using "format ('%.1f')", a value in the db of '9.009' would appear in
the edit form as '9.0', a change which could be missed if the user was
editing some other field in the vendor edit form.

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

- Go to Acquisitions -> Vendors -> Edit vendor.
- Under "Ordering information," test entering various values in the
  "Discount" field. It should accept numbers with up to two digits
   before the decimal and up to three digits after the decimal:

   9, 99, -99, 99.9, 0.99, 99.99, 99.999

- In each of these cases, confirm that a value accepted by the
  client-side validation is also accepted when you submit the form and
  is correctly displayed when you edit that vendor again.

- It should not accept:

   100, 100.001, 100.00001

- The error message has been updated to read, "Please enter a decimal
  number in the format: 0.0"

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Sonia <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 584c02283e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:30:10 +00:00
Thibaud Guillot 1625835375 Bug 35087: Discount rate only accepts a point as decimal separator
When a comma is used to define the discount rate of a vendor,
the data is not recorded (as NULL), it is however recorded if the
separator is a point.

Test plan:

1) Go to acqui module and edit a vendor
2) Set a discount rate with a comma as decimal separator
3) Edit again or request your database to see that there is no data
   saved
4) Do it again with a point as decimal and see it works
5) Apply this patch and reloard the build for the templates
 6) Repeat step 2 and see the warning to inform you that you must use a
    point

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Sonia <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit ebc2568109)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:30:10 +00:00
Jonathan Druart 7449473418 Bug 37983: Restore auto-focus on patron input when "Schedule a pickup" is selected
In the curbside pickup module, when the "Schedule a pickup" tab is selected we expect
the patron search box to get the focus. But it has been broken bug 30965 (which changed the id of the input).

Test plan:
Setup curbside pickup for your library
Go to Circulation > Curbside pickups
Click the last tab
Notice that you can directly search for a patron, the input has the
focus

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 83f542de19)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:29:48 +00:00
Jonathan Druart 9be862601e Bug 37982: Replace edit form with GET
Caught by tests from bug 37728

 # $VAR3 = 'koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt:158';

We don't really need the form to be POSTed, we should not reach the URL maxlength.
The UI will certainly explode if there are lot of items to edit anyway.
The code is not clear on this page as we are sending several forms using
the items selected from this table. But this one form is used to display
the edit form and so can be GET (and better as the URL can be shared).
The other actions have their own form (in modals mostly).

Test plan:
Create a subscription and go to the serial collection page.
Make sure at least one item is select and click the "Edit" button.
No behaviour change expected here, the edit form should still be
displayed.
Try the other actions on top of the table and confirm they are still
working as before.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 520bda9a45)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:29:29 +00:00
Jonathan Druart 7619066759 Bug 37981: Switch installer/step3.tt form from POST to GET
This form does not need to be a POSTed form.

Test plan:
Drop and recreate the DB and run the web installer.
Everything should work, no behaviour change expected.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 5718714ba7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:29:14 +00:00
Caroline Cyr La Rose 6ca8630538 Bug 37871: Remove extraneous 246 subfields from the title mappings (Elasticsearch, MARC21)
This patch limits indexing of field 246 to $a, $b, $n, and $p in
various title indexes.
Previously, all 246 subfields were indexed, including non-title
subfields such as $i (Display text), $g (Miscellaneous information),
and linking subfields, making the title index very large and giving
false results.

To test:

1. Add all the 246 subfields to the default bibliographic framework
   1.1. Go to Administration > MARC bibliographic framework
   1.2. Click Actions > MARC structure next to the Default framework
   1.3. Search for 246
   1.4. Click Actions > Edit subfields
   1.5. For each subfield, make sure Editor is checked
   1.6. Click Save changes

2. Create a new record and fill out all the 246 subfields
   2.1. Go to Cataloging
   2.2. Click New record
   2.3. Fill out the mandatory fields (000, 003, 005, 008, 040$c,
        245$a, 942$c)
   2.4. Fill out all the subfields in 246 (I simply write the name of
        the subfield in the text field e.g. Display text in 246$i)
   2.5. Click Save
   2.6. Click Normal to access the detailed record

3. View the Elastic search record
   --> All the subfields (including "Display text", "Miscellaneous
       information" and other non-title subfields) should be indexed in
       - title
       - title__suggestion
       - title-abbreviated
       - title-abbreviated__sort
       - title expanded
       - title-expanded__sort
       - title-former
       - title-former__sort

4. Make a title or keyword search for "Display" (or whatever you wrote
   in 246$i)
   --> Your record should be in the results

5. Apply patch

6. Rebuild the index using -r

koha-elasticsearch --rebuild -d -r -v kohadev

7. Redo step 3
   --> Only 246 $a, $b, $n, and $p should be indexed

8. Redo step 4
   --> Your record should NOT be in the results

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 118c73b219)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:25:55 +00:00
Oliver Behnke 0185fde274 Bug 37525: [SCO] Regression in 32256: "Return this item" doesn't show up despite SCOAllowCheckin being allowed
There's a regression in bug 32256 and commit bb059abe respectively:

https://gitlab.com/koha-community/Koha/-/commit/bb059abe90#a22dc682a84c41672294c66e441329a451b5cd5a_137_137

The refactoring of "renew" -> "c.renew" missed this line (at least), so the condition is never met.

This fixes the issue and restores the original functionality.

Test plan:
1. log in with a patron at http://localhost:8080/cgi-bin/koha/sco/sco-main.pl
2. check out an item
3. scan it again
4. see that the "return this item" choice isn't proposed. This is the
   bug
5. apply patches
6. rescan the item in the self-check out
7. returning is proposed
8. check it in and confirms that it's not checked out anymore

Signed-off-by: Oliver Behnke <oliver.behnke@aei.mpg.de>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 8e22d67f27)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:25:30 +00:00
Emmi Takkinen f3133f9095 Bug 37369: Fix filtering of search result table in item search
At the moment, the filtering on item results page
requires using the code in the following fields:
- Collection
- Home library
- Current library
- Shelving location
- Itemtype
- item status -fields (not for loan etc)

So e.g. "Centerville" in Home library -field doesn't
bring back results but code "CPL" does. This happens
because "columns" option in search results table
isn't working when its used in function columnFilter.
However option "aoColumns" works.

To test:
1. Navigate to item search and search items.
=> Note that all filters in search result table
are free text fields.
2. Attempt to filter search results by home library
with description of some library.
=> No results are displayed.
3. Now filter results with code of the library.
=> Results are now displayed.
4. Apply this patch and refresh page.
5. Search items again.
=> Note that now some of the filters are now using
dropdown select fields.
6. Attempt to filter results by home library again.
=> Results are now displayed correctly.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Olivier Hubert <olivier.hubert@inlibro.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit a8401e533d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:25:06 +00:00
Raphael Straub a322d170ed Bug 36049: Fix price rounding
This patch only fixes price rounding by using Math::BigFloat.

To test:
0) Enable syspref OrderPriceRounding
1) Create an order line in acquisitions with vendor price 18.90 and a
   discount of 5 %.
2) Verify that the total (tax excl.) in the order table on the basket
   page is 17.95.
3) Apply the patch.
4) Reload the basket page.
5) Verify that the total (tax excl.) in the order table on the basket
   page now is 17.96, which is correct.
6) Run: prove t/Number/Price.t

Sponsored-by: Karlsruhe Institute of Technology (KIT)
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>
(cherry picked from commit 56091d9660)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:17:47 +00:00
Raphael Straub 0e62b0a697 Bug 36049: Add unit test
Sponsored-by: Karlsruhe Institute of Technology (KIT)
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>
(cherry picked from commit 0ca0cd766a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:17:47 +00:00
Fridolin Somers f054a8f4d5 Bug 35442: Script migration_tools/build_oai_sets.pl add ORDER BY
Script migration_tools/build_oai_sets.pl is missing ORDER BY
biblionumber.
This is a problem when using OFFSET and LIMIT, the results may be
differenly orderder between two calls of this script.

Test plan :
1) Create a OAI SET with all records
2) Run migration_tools/build_oai_sets.pl with the first half of records
3) Run migration_tools/build_oai_sets.pl with the second half of records
4) Check all records are in the OAI set

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 996c9d9fdc)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:17:47 +00:00
Phil Ringnalda d01ebca03a Bug 26929: Fetching macros for Advanced Editor should ignore default pagesize
The REST API has a default page size of 20, controlled by the preference
RESTdefaultPageSize. That's fine for things that are fetched to display
in pages of 20, but for things like macros in the Advanced Editor that
don't implement paging, it's awkward, since when you create your 21st
macro, it disappears the next time you open the editor.

The Advanced Editor should instead disable paging by passing the param
_per_page=-1

Test plan:

1. Set the preference EnableAdvancedCatalogingEditor to Enable. While you
   are there, set the preference RESTdefaultPageSize to 2, so you don't have
   to create 21 macros to see one disappear
2. Cataloging - Advanced editor - Macros
3. Click New macro..., give it the name 1, then repeat for 2 and 3
4. You have a list of macros open with all three listed, so far so good.
   Refresh the browser page and reopen Macros. You now have two macros
5. Apply patch, refresh the page, reopen Macros. You now have three macros
6. You should probably reset that RESTdefaultPageSize back to 20 if you
   aren't about to reset ktd

Sponsored-by: Chetco Community Public Library
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit e47be6f895)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:17:47 +00:00
Adolfo Rodríguez edb762a28e Bug 37840: Fix item status in the Intranet detail page when the item has a item type not for loan
When the item type is not for loan, the item status must be "Not for loan". Now in the Intranet status is Available while in the OPAC it's Not for loan.

Test plan:
1 Define an item type as "Not for loan"
2 Add or edit an item so that its item type is "Not for loan"
3 Check that the status in the Intranet detail page shows Available while the OPAC detail page shows "Not for loan"
4 Apply patch, restart services
5 Check that the status is now "Not for loan" in both Intranet and OPAC

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 326c0156f4)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:08:40 +00:00
Phil Ringnalda 94c433565f Bug 37914: Forms for budget planning filters and export should GET rather than POST
Because of the bug 36192 CSRF protection, we intend not to have forms that
POST without a param named 'op' with a value starting with 'cud-'. Because
of bug 37728, a few were missed, including the 'Filters' form that lets you
switch between planning budgets by month or by itemtype or by library, and
the 'Export' form that lets you save your planning as a .csv file. Neither
one has any need to POST, they can just be the GET they naturally are.

Alas, the default data won't let you exercise everything, so there's a lot of
setup before the actual testing.

Test plan:
 1. Patrons - search for Acevedo - More-> Set permissions - check
    Acquisitions management and Save
 2. Administration - Authorized values - Asort1 - New authorized value for
    Asort1 - value Q1, description First Quarter, then repeat for Q2, Q3, Q4
 3. Administration - Budgets - New budget - give it a start date of today,
    end date of a year from today, a description, a total amount of
    100000.00, for Statistic 1 done on choose Asort1
 4. Click the name of your new budget - New-> New fund for (name) - give it
    the code my, name My money, amount 75000.00 and Submit
 5. New-> New fund for (name) - give it the code his, name Henry's money,
    amount 25000.00, and click Select owner, find Henry and Select, then
    Submit
 6. Acquisitions - click Search on an empty search box to find the only
    vendor - New-> Basket - Give it a name and Save
 7. Add to basket - From an existing record (search for something like Perl)
    click any bib record - Add order - set the required item type and click
    Add item
 8. Scroll down to the Accounting details form, change Fund to My money, and
    enter 20.00 for the Vendor price and click Save. You just made that
    fund "active" in the eyes of the Filter form, by spending some of it.
 9. Finally set up. Administration - Budgets - click the name of your budget
10. Planning-> Plan by months
11. In the upper left Filter box, check Show my funds only and Submit - you
    should see Henry's money disappear
12. Uncheck Show my funds only and check Show active funds only and Submit -
    you should see Henry's money disappear
13. Check Show actual/estimated values and Submit, you should see text for
    the actual (only in this month, since that's all you spent) and wee
    little shrunken text boxes for the planning numbers
14. Uncheck all the boxes and change the dropdown from by months to by Asort1
    (either one of it, there being two is bug 34159) and Submit, you should
    have four columns for Q1 - Q4 and only for My money, since Henry doesn't
    use Asort1
15. Click the Auto-fill row button, and Save
16. In the Export form (which isn't much of a form, since you only have a
    choice for the filename) click Submit
17. You should have downloaded a .csv file, and if you open it it should
    have the info from your current planning form.
18. Apply patch, restart_all
19. Repeat steps 9-17, getting the same results you did without the patch

Sponsored-by: Chetco Community Public Library
Signed-off-by: Sukhmandeep Benipal <sukhmandeep.benipal@inLibro.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 e21419b733)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:02:31 +00:00
Phil Ringnalda af8a7d228e Bug 37887: OPAC password recovery needs to use a cud- op while POSTing new password
To pass xt/find-missing-op-in-forms.t after bug 37728 updates it to notice
that there can be more than one form in a template, opac-password-recovery.tt
needs to have a param named 'op' which starts with 'cud-' for the form that
POSTs the new password.

Luckily, testing this doesn't require that you set Koha up to actually send
email (though you can), because you can get the link to reset the password
by looking at the list of notices sent to the patron in the staff interface:
the failure to send notice works just fine.

Test plan:
 1. There's no behavior change to test, you just need to see that resetting
    the password still works, so start with the patch applied.
 2. Administration - System preferences - change OpacResetPassword to allowed
 3. Set a patron so you can use them, which requires that you know the
    username, and they have an email address. I give Acosta, Edna one of
    my email addresses, and copy her cardnumber.
 4. Open the OPAC, and below the login form click the "Forgot your password?"
    link
 5. Enter the cardnumber for Login and the email you used for Email and
    click Submit. If you didn't set up sending email, you'll get an error
    message, but ignore it, not a problem
 6. Back in the staff interface, check out to the patron you are using, and
    on the left sidebar choose Notices and find the Koha password recovery
    notice and click that linked phrase
 7. In the popup with the notice text, open the recovery link in a new tab
 8. Following the instructions for the content of a new password, enter one
    in both fields and click Submit
 9  In the success message, click the link to Log in to your account and
    log in with the new password

Sponsored-by: Chetco Community Public Library
Signed-off-by: Olivier V <olivier.vezina@inLibro.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 9e43658e6f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:02:00 +00:00
Jonathan Druart 01bb93dd91 Bug 37857: Add callnumber and geo_point for new search fields
It is missing "Geo point" and "Call Number" from the options of
"Type" when creating a new search field.

Test plan:
Go to the elastic mapping config page, bottom of the page.
Notice that after this patch you see the 2 options in the dropdown list.

Signed-off-by: Chloe Zermatten <chloe.zermatten@ptfs-europe.com>
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1c82782759)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 22:01:42 +00:00
Phil Ringnalda 8fb9c99b34 Bug 34159: Budget planning shouldn't add every authorized value starting with A
In aqplan.pl there are two different sets of params for things you can plan
by: for the toolbar "Planning" menubutton the script looks up what AVs are
used for "Statistic 1|2 done on" for the budget's fund(s), and passes them to
the template which knows to hardcode the MONTHS, ITEMTYPES, and BRANCHES
choices, but for "Select planning type" in the Filter sidebar box, the
script inserts the harcoded ones itself, adds in the ones used by a fund,
and for no apparent reason adds in every authorized value category that starts
with the letter A and has at least one value. Those things do not actually
work, because for things other than the hardcoded ones the script checks
whether they are in a fund's "Statistic 1|2" and if not refuses to let you
plan by them.

Test plan:
 1. Administration - Budgets
 2. If you don't have a budget, create one and add a fund to it,
    but with the default data click the name Main budget
 3. In the row for Main fund, click Actions->Edit
 4. For Statistic 1 done on choose an authorized value which does not start
    with A, like BOR_NOTES, and Save
 5. In the top toolbar, Planning->Plan by months
 6. In the sidebar Filter box, note that there is an option to plan by
    AR_CANCELLATION even though you didn't select that for Statistic 1
 7. Select the by BOR_NOTE choice and Submit
 8. Note that you now only see Main fund, because that's the only one
    which uses that AV
 9. Select the by months choice and Submit, see that it changes back, then
    select the by AR_CANCELLATION choice and see that nothing is displayed,
    select the by months choice again and Submit, see that the display is
    now completely broken
 9. Apply patch, restart_all, reload the page
10. Note that the AR_CANCELLATION choice is gone, and all the choices
    you do have work correctly

Sponsored-by: Chetco Community Public Library
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.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 db42742a3a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 21:57:02 +00:00
Lucas Gass 5891cce7f5 Bug 37757: DBRev 24.05.05.002
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 21:55:39 +00:00
Tomas Cohen Arazi 5eb905b67a Bug 37757: (follow-up) Adjust existing tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1740a293eb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 21:55:39 +00:00
Tomas Cohen Arazi 9f592cdafd Bug 37757: (follow-up) Warn on bad values and survive
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 d50aa6aa72)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 21:55:39 +00:00
Tomas Cohen Arazi f5c0c34754 Bug 37757: Make notice_email_address() handle EmailFieldPrimary values more robustly
This patchset makes:

* The EmailFieldPrimary value 'OFF' be replaced by an empty string
* Koha::Patron->notice_email_address() handle the empty case more
  gracefully

To test:
1. On main, manually set the EmailFieldPrimary syspref to empty
   $ ktd --shell
  k$ koha-mysql kohadev
   > UPDATE systempreferences SET value='' WHERE variable='EmailFieldPrimary';
2. Enable `AutoEmailNewUser`
3. Create a new user
=> FAIL: Koha explodes like:
```
The method Koha::Patron-> is not covered by tests!

Trace begun at /kohadevbox/koha/Koha/Object.pm line 992
Koha::Object::AUTOLOAD('Koha::Patron=HASH(0xaaaae37ac550)') called at /kohadevbox/koha/Koha/Patron.pm line 1662
Koha::Patron::notice_email_address('Koha::Patron=HASH(0xaaaae37ac550)') called at /kohadevbox/koha/members/memberentry.pl line 448
...

4. Apply this patches
5. Run:
  k$ updatedatabase
=> SUCCESS: Update succeeds
6. Restart all and retry creating a patron
=> SUCCESS: It worked!
7. Sign off :-D

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 b262e350f1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 21:55:39 +00:00
Tomas Cohen Arazi d3de26092e Bug 37757: Update EmailFieldPrimary value
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 79ffb8841b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 21:55:38 +00:00
Tomas Cohen Arazi 5d2b3fe488 Bug 37757: Unit tests
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 24f84f11a2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 21:55:38 +00:00
Nick Clemens bcdec4356d Bug 37396: Add missing cud-checkout op to form
To test:

1. Set the system preference 'OverduesBlockCirc' to 'Ask for Confirmation'
2. Enable the BatchCheckout system preference
3. Checkout an item to a patron and backdate the due date so that it is overdue.
4. Attempt to checkout an item or a set of items using the Batch Checkout feature. The batch checkout page will ask you to confirm the checkouts because the 'Patron has 1 overdue item'.
5. Confirm the checkout and go to the patron's holdings table. The items you checked out via the batch checkout were not issued to the patron.
6. Apply patch
7. Repeate batch checkout
8. Confirm the checkout
9, Items are successfully issued!

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d982cbd2a7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 21:48:19 +00:00
Baptiste Wojtkowski 7ccbcc3037 Bug 37629: Link to news are broken
When browsing news in the opac (opac-main.pl), links in the titles of
news are broken. The id pasted in the link is the id from the
additional_contents_localizations instead of the id from
additional_contents.

TEST PLAN:
1 - In intranet create a news with multiple languages
2 - Create a second news
3 - In OPAC, the link of the title of the second news (and maybe the
    first) should be broken APPLY PATCH
4 - In OPAC, the link of the title of both news should work

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

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 173fee41e7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 21:48:19 +00:00
Tomas Cohen Arazi 1ac8e5515e Bug 37679: Add DC subtypes to allow-list in opac-export.pl
Bug 37370 added an allow-list of formats for exporting in the OPAC. But
it missed the fact there was a modal for choosing DublinCore subtypes
when Dublin Core is chosen in the first place.

This patch fixes this.

To test:
1. On a fresh KTD, make sure `OpacExportOptions` has all options enabled
2. Go to the OPAC and pick a record detail page
3. Choose Save record > Bibtex
=> SUCCESS: The save dialog for bibtext works
4. Repeat for DublinCore, choose any of the sub formats in the modal
=> FAIL: You get a 400 page
5. Go back to 2
6. Apply this patch, and repeat 4
=> SUCCESS: It works!
7. Without refreshing the page, disable DublinCore in the sysprefs
8. Choose any subformat and proceed
=> SUCCESS: You get a 400! This means the subformats are only considered
if DublinCore  itself is enabled
9. Sign off :-D

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f028769af8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:52:12 +00:00
Emmi Takkinen 9b10f3f9ac Bug 37032: Fix typo in holds.yaml
There is a typo in holds.yaml which prevents
fetching item as embeded object. Option
"collectionFormat" should be under "x-koha-embed",
not "items" array.

To test prove t/db_dependent/api/v1/holds.t.

Sponsored-by: Koha-Suomi Oy
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 90cb30c94b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:50:59 +00:00
David Cook 669b096bb0 Bug 34346: Show error message instead of 500 for duplicate tags
This change shows a user-friendly error message instead of a 500 error
if adding a duplicate MARC tag to a MARC bibliographic framework.

Test plan:
0. Add patch and koha-plack --reload kohadev
1. Go to
http://localhost:8081/cgi-bin/koha/admin/marctagstructure.pl?searchfield=264&frameworkcode=
2. Click "New tag"
3. Enter "264" in "Tag:" field
4. Click "Save changes"
5. See error message on screen (instead of 500 error)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 34346: Tidy

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Slightly adjusted error message and added punctuation.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a24829939e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:50:42 +00:00
Jonathan Druart 935ae536c8 Bug 37628: (follow-up) Remove get_opac_news_by_id
Keep the same behaviour, but wondering why we don't return 'content'
when there is no match.

ie.
+    is( $additional_contents, undef );
should certainly be
+    is( $additional_contents->{content}->count, 0 );

WNC amended patch - tidied

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

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 8830cd7eff)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:50:24 +00:00
Noémie Ariste 7776ebc178 Bug 34610: Update deprecated ProtectSuperlibrarian string
Test:
1. Set ProtectSuperlibrarianPrivileges system preference to Allow only
   superlibrarians
2. Give superlibrarian permissions to a user (User 1)
3. Give catalogue, borrowers, permissions, and staffaccess  permissions
   to a second user (User 2)
3. Login as User 2
4. Go to User 1 permission settings page.
5. Hover over the Select all and Clear all links.
6. Check the message that appears contains
   ProtectSuperlibrarianPrivileges and not ProtectSuperlibrarian

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ce24cdc1da)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:46:38 +00:00
Emily Lamancusa b7fe101b57 Bug 37562: (QA follow-up) Remove FIXME
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 003479cc30)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:46:20 +00:00
Nick Clemens 5e9315eee8 Bug 37562: Add patron title to duplicate patron warning and don't show popup if cannot see patron
This patch passes the suspected duplicate to the template and uses patron title to display very brief info.
If the user cannot view the patron there is no longer a link tot he brief popup and they will only see
'A patron from library X"

There is a FIXME asking if we should use search_limited - I believe we should check all branches, so the staff can ask the patron if they
have an exising account in a consortium depending on rules about multiple cards

To test:
 1 - Edit a user to grant catalogue and all borrower permissions except 'view_borrower_infos_from_any_libraries'
 2 - Find a patron from a different library and note surname and firstname
 3 - Login as the patron above
 4 - Enter a new patron with the same surname and firstname
 5 - See the 'Duplicate patron' warning
 6 - Click to view the patron
 7 - No info is listed
 8 - Apply patch
 9 - Reload and resubmit - or fill out form again
10 - Note that you see 'A patron from library XXX' and no popup link
11 - Add view_borrower_infos_from_any_libraries to the staff
12 - Repeat the duplication and confirm the warning now has patron name and the popup link is visible and works

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit bdf224c653)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:46:20 +00:00
Owen Leonard ef7362b62b Bug 37595: Double HTML escaped ampersand in pagination bar
This patch removes escaping of ampersands in the part of
guided_reports.pl that builds information for the pagination routine.
The information is going to be escaped in a later step.

To test, apply the patch and go to Reports.

- If necessary, create a report which will return more than 20 results.
- Run the report. You should see a pagination bar at the top of the
  table of results.
- View the page source and look for the markup for the pagination menu.
  Searching for 'rel="start"' works well.
- Confirm that you see '&amp;' between the link parameters instead of
  '&amp;amp;', e.g.

  guided_reports.pl?id=347&amp;op=run&amp;limit=20&amp;want_full_chart=0&amp;page=1

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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 f8c85ab26b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:44:02 +00:00
CJ Lynce e2181cf1b7 Bug 37580: Unique Holidays Description are not editable
Holiday names and descriptions are not editable after creation in
    tools/holiday.pl.
This patch corrects this regression.

To test:

1) Login to staff client
2) Open Tools -> Calendar
3) Click on a date and create a holiday with name and description.
4) Save holiday.
5) Click on newly created holiday on calendar and edit the name and
   description.
6) Re-Save Holiday.
7) Click again on holiday, and see that name and description changes
   did not save.
8) Apply patch
9) Repeat steps 5-7
10) Verify that changes now save.

Sponsored-by: Westlake Porter Public Library
Signed-off-by: Martha <msulllivan@rcls.org>

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 27d6f65662)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:43:34 +00:00
Jan Kissig 3460eaa617 Bug 37535: Adding a debit via API will show the belated patron as the librarian that caused the debit
This patch fixes the addPatronDebit route so that the librarian that caused the debit is taken from either the requests payload user_id or if not set from the api user.

Test plan:

 a) enable system preference RESTBasicAuth
 b) use a REST client to send a POST request with the following JSON body to http://localhost:8081/api/v1/patrons/5/account/debits

{
  "amount": 1.23,
  "description": "some description",
  "internal_note": "internal_note",
  "type": "MANUAL"
}

 Authentication username and password is "koha"
 c) verify that "user_id" is the same as patron_id in response.
 d) send a different request including user_id to the same endpoint
{
  "amount": 1.23,
  "description": "some description",
  "internal_note": "internal_note",
  "type": "MANUAL",
  "user_id": 19
}

 e) verify that "user_id" is the same as patron_id in response.
 f) apply patch and repeat step b) and d)
 e) verify that user_id in b) is now 51 (which is the borrowernumber of koha user)
 f) verify that user_id in d) is now 19 as defined in request
 g) recheck on http://localhost:8081/cgi-bin/koha/members/accountline-details.pl?accountlines_id=<account_line_id> (from response) that column Librarian now says the user from user_id

 h) sign off :)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1293980793)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:40:08 +00:00
Tomas Cohen Arazi e2cbad134e Bug 37535: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c1fa65d72d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:40:08 +00:00
Nick Clemens 183f6aac15 Bug 37540: Ensure datetime is a string before enqueueing pseudonymization
To test:
1 - Enable Pseudonymization in system preferences
    NOTE: See bug 28911 for bcrypt setup
2 - Issue an item to a patron
3 - View the patrons checkouts
4 - Check the box under 'Renew'
5 - Renew selected items
6 - Internal server error
7 - Apply patch
8 - Restart all
9 - Repeat 4&5
10 - Success!

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1213ad7af7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:40:08 +00:00
Petro Vashchuk 01e325f0f9 Bug 37444: Fix filter for Pickup Location
When trying to filter holds to pull using the dropdown filter for Pickup Location, the dropdown has "None" as the only available option because of incorrect column index in ppendingreserves.tt

To reproduce:
1. Place a hold and go to Circulation -> Holds to pull.
2. Use a dropdown filter for Pickup Location, see that only "None" is available to pick, meaning you can't use the filter.
3. Apply the patch.
4. Do the step 2 again and ensure that there's also an option for that hold's pickup location.

Signed-off-by: Eric Garcia <cubingguy714@gmail.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1bc9d18dd6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:40:08 +00:00
Pedro Amorim 874488c906 Bug 37263: Fix deletion of 'All' patron category in Default article request fees
Follow same test plan as before, but attempt to delete a 'All' entry in 'Default article request fees'.
Notice it blows up before this patch. It works as expected after the patch.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>

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 9dc87a4e6f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:37:27 +00:00
Martin Renvoize df71011424 Bug 37333: (follow-up) Update existing tests
We add a level of bracket nesting. I checked with Nick that this
shouldn't cause any issues in the queries and we agreed it made sense so
I've gone ahead and updated the tests to reflect the change.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 21dc76f35b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:21:38 +00:00
Nick Clemens c0fce5872b Bug 37333: Group search terms in a saved filter
This patch surrounds the expanded query of a search filter in parnetheses to correctly
group the terms when searching

To test:
 1 - Enable system preference SavedSearchFilters
 2 - In staff client, perform an advanced search for:
     subject:internet OR subject:programming
 3 - Note results
 4 - Save search as filter, enabled in staff client and opac
 5 - Search for 'a'
 6 - Apply filter from top of facets on left hand side
 7 - Note results didn't change
 8 - Apply patch, restart all
 9 - Reload search, it now limits correctly
10 - Test on OPAC
11 - Test on both Zebra and Elastic
12 - Sign off :-)

Signed-off-by: Jake Deery <jake.deery@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 6cb3d72f49)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:21:38 +00:00
David Cook b8612daf20 Bug 37357: Map @ to 00 for control field select lists
This change adds the existing @ to 00 mapping for control fields
to work for authorized value select lists as well.

Test plan:
0. Apply the patch
1. koha-plack --reload kohadev
2. Make 001 subfield @ mandatory and give
it an authorised value of branches for Default framework
3. Go to the New record editor for a Default record
4. Click "Save"
5. Note that the editor prompts you to fill in the 001 field
6. Fill in required fields and click "Save"
7. Note that all data is captured correctly
8. prove t/db_dependent/Koha/UI/Form/Builder/Biblio.t

To prove that this wouldn't work without the patch, try the test
plan on a different branch without this patch. You won't be prompted
to fill in mandatory fields and the record will just save (or if a
possible duplicate is detected it will just redirect you back to an empty
editor)

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 0d4e35bf38)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:21:12 +00:00
Martin Renvoize 684c89d314 Bug 37368: Add 'library' to patron search embed
This patch adds the missing library embed from the patron search forms.
This embed is required for the case where a patron is missing both first
and last name or is from a different library group and thus falls into
the 'Patron from library X' block.

I also update the 'Patron from library X' to 'Patron from X' as I feel
it reads more clearly.

Finally, we need to sync the available embeds to ensure 'library' is
embeddable from the different endpoints this search can be triggered on.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 920e4dc4c9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:20:53 +00:00
Caroline Cyr La Rose a858cc7f53 Bug 37404: Typo in intranetreadinghistory description
This patch corrects an error in the description of the
intranetreadinghistory system preference description.

To test:
1. Apply patch
2. Go to Administration > System preferences > Patrons
3. Look at the description of intranetreadinghistory
   --> It should say "... access a patron's checkout history..."
4. Make sure the description's spelling and grammar is correct

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3ef77dbb04)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:20:53 +00:00
Owen Leonard 80d2431d55 Bug 37243: Tag moderation actions should be in the last column
This patch updates the tag review template to make the "actions" column
the last one in the table. This makes it consistent with other pages in
Koha.

To test you should have TagsEnabled turned on and at least one
pending tag in the system.

- Go to Tools -> Tags.
- Confirm that the "Approve" and "Reject" buttons are in the last column
  of the table.
- Approve a tag and click the "Approved" link the the "Terms summary"
  box in the right-hand sidebar.
- In this view the table has a "Reviewer" column visible. The buttons
  should still be in the last column.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 36c1d792b9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:12:13 +00:00
Janusz Kaczmarek 23660524f2 Bug 37271: Recall status should be 'requested' in overdue_recalls.pl
In "Bug 19532: Make recalls.status an ENUM" one-letter statuses were
replaced by their verbal equivalents.  But in overdue_recalls.pl
remained "R".  As a result, recalls never overdue.

No test plan provided--obvious correction.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 771db8c399)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:11:58 +00:00
Janusz Kaczmarek 0990190b26 Bug 37319: Move mappings for 752ad (MARC21) and 210a/214a (UNIMARC) to pl index
In Bug 36578, some fields were added to the pl index, but somehow it
ended up in the other-control-number index. This aims to put fields
752ad (MARC21) and 210a/214a (UNIMARC) in the pl index.

Test plan:
----------
0. Have an installation with Elasticsearch and MARC 21 configuration.
1. Under  Administration > Search engine configuration (Elasticsearch)
   under the tab Bibliographic records check that you have 752ad in
   other-control-number search field.
2. Apply the patch, reindex with:
   sudo koha-elasticsearch --rebuild -r -b kohadev
3. Under  Administration > Search engine configuration (Elasticsearch)
   under the tab Bibliographic records check that you have 752ad in pl
   search field now.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a3f4c9ec8a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:11:40 +00:00
Caroline Cyr La Rose 586a3b734c Bug 37329: Typo: authorised value in patron attribute types
This patch corrects a typo in the patron attribute type form.

Terminology indicates it should be "authorized" and not "authorised".

https://wiki.koha-community.org/wiki/Terminology

To test:
1. Apply patch
2. Go to Administration > Patron attribute types > New patron attribute type
--> The hint next to the Is a date checkbox should say "[...]an authorized
value category"

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3596b457bd)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:11:18 +00:00
Pedro Amorim 4fcbeca3f0 Bug 37275: (QA follow-up): Add &nbsp; to add spacing between selected user and button
Follow original test plan and apply first patch.
Select a user and notice the patron's name and the button have no spacing.
Apply this patch.
Notice there is now spacing.

Signed-off-by: Pedro Amorim <pedro.amorim@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 8aecae09c1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:11:00 +00:00
Eric Garcia b2f3c01ca0 Bug 37275: Removed parenthesis from Select user button in ERM
To test:
1. Apply patch and yarn build
2. In system preferences search and enable ERMModule
3. E-resource management -> Agreements -> New agreement
4. Click Add new user and notice the parenthesis around the +Select user button are removed

Signed-off-by: Pedro Amorim <pedro.amorim@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 a482848d2d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:11:00 +00:00
Pedro Amorim 906f03db19 Bug 37289: Add sorting to test
Ensure the order of embedded records returned.
Dont apply the DONT PUSH patch.
prove ./t/db_dependent/api/v1/authorised_values.t ---> Notice if passes

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 bce37851cf)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:06:42 +00:00
Jonathan Druart 2b0ac7096f Bug 37277: Detach identifiers on the local title list view
If a local title has both ISBN (Print) and ISBN (Online) the 2 values
are concanetate on the same line without space on the the local title
list view.

With this patch they are now separated by a new line.

Signed-off-by: David Nind <david@davidnind.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 618b6986f2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:06:21 +00:00
Pedro Amorim 79eb94bcc4 Bug 37283: Update expected error page title
I dont know how this was working before, but if we do:
cat -n /usr/share/perl5/HTTP/Response.pm | grep Error

We notice that error_as_HTML returns 'An Error Occurred' for page title and that is what we should be expecting?

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Caused by bug 37056.
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6e1f317010)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:05:47 +00:00
Alexandre Noel c4cf8d698e Bug 37108: Cash register statistics wizard is wrongly sorting payment by manager_id branchcode
With this patch, it displays now the accountlines branchcode and not the
manager's branchcode.

(cr: Marie-Luce test plan)

Setup - before test

Staff accounts
    - have a superlibrarian account
    - create 2 limited access staff accounts, one by branches:
        e.g.
        - staff 1 - attached to branch A
        - staff 2 - attached to branch B

    Both restricted staff accounts should have the following permissions:

        - (circulate) ,
        - (borrowers),
        - in the patron fines: (manual_invoice), and (remaining_permissions)
        - ***ability to switch login library (loggedinlibrary)

Debit type
    - Add few debit types in your Koha (administration > debit types) to ease transactions search.
        e.g: "printing cost", "new card", "lost item"

        ***Ensure that each debit type is configured to "can be manually invoiced"

Test plan

1.  Login with "staff 1" in the intranet
    --> Koha should connect to branch A
2.  Find a "branch A" patron
3.  Add a manual invoice    (e.g printing -- 2.50$ )
4.  Pay this invoice
5.  Log out of the intranet
6.  Login with "staff2"
    --> Koha should connect to branch B
7.  Find a "branch B" patron
8.  Add a manual invoice with a unique debit type and amount (e.g. lost item - 12.80$ )
9.  Pay this invoice
10. Stay connect with "staff2" account, and switch to "branch A" at the top right corner of the screen
11. Find another "branch A" patron
12. Add a manual invoice with a unique debit type and amount (e.g. new card - 5.00$ )
13. Pay this invoice
14. Log out
15. Login with a "superlibrarian" account
16. Run the "Cash register" statistics wizards for "branch A"
        - Go to (Reports > Statistics wizards > Cash Registers )
        - dates: select the current date

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit cf2fcbda75)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:05:28 +00:00
Janusz Kaczmarek 70f3a604c0 Bug 37231: (Bug 34940 follow-up) Highlight logged-in library in facets does not work with ES
The highlight logged-in library in facets feature does not work with
Elasticsearch.  This is because facet_title_value contains an additional
" (count)" information and so gives negative results in comparisons made
in facets.inc  (line 107).

Test plan:
==========
1. Have a test installation with Elastiscsearch.
2. Set system preference 'DisplayLibraryFacets' to 'both home and holding libraries'
3. Perform a seach that will find items of your logged-in library.
   In KTD, search for 'branch:CPL'
4. Check the facet (home and holding libraries) of your logged-in
   library is not highlighted
5. Apply the patch ; restart_all.
6. Repeat p. 3.  Check the facet (home and holding libraries)--you
   should see your logged-in branch highlighted now.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1d2b1dff3a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 18:05:21 +00:00
Owen Leonard 47791c8868 Bug 37257: Enable translation of Copy control in OPAC user summary
Currently we define translatable labels for DataTables "export" options
(Copy, CSV, Excel, and Print) in the section of datatables.js for adding
our own configuration to these buttons. This works fine until we
redefine a button without redefining the translatable label as we do in
opac-user.pl.

The correct solution is to define these strings in the default set of
language strings we use for all other DataTable strings. This patch
makes that change in both the staff interface and the OPAC (although the
problem only currently manifests in the OPAC).

To test, apply the patch and start the translation process:

- Install fr-CA or another language in the OPAC
    1. Run the following commands:
        - gulp po:update
        - ./misc/translator/translate update fr-CA
        - ./misc/translator/translate install fr-CA
    2. Go to Administration > System preferences
    3. Search for OPACLanguages and check fr-CA
    4. Set opaclanguagesdisplay to Allow
    5. Click "Save all I18N/L10N preferences"

- Check that "Copy" is translated in the .po files
   1. Open misc/translator/po/fr-CA-messages-js.po
   2. Search for "Copy"
        --> It should be translated as "Copier"

- Log in to the OPAC as a user with checkouts.
- Switch to the language you translated.
- View the user summary page.
  - The controls at the top of the table of checkouts should be
    correctly translated.

- In the staff interface, switch to the language you translated.
- Test any DataTable with export controls, e.g. Administration ->
  Libraries, to confirm that the "Export" menu items are still
  translated correctly.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit cc5fead3be)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:59:09 +00:00
Owen Leonard 42cc47ef24 Bug 37242: Don't use the term branch in cash register administration
This patch replaces the word "branch" with "library" in the cash
register administration template in order to make it consistent with our
terminology guidelines.

To test you must have UseCashRegisters enabled.

- Apply the patch and go to Administration -> Cash registers.
- Confirm that the "Filter by" control at the top of the table reads
  "Filter by library."

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c408ed66bb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:58:44 +00:00
Janusz Kaczmarek 937b39d05b Bug 37233: Library URL broken on in libraries tables
The URL given for a library is badly encoded in the table on the
/cgi-bin/koha/admin/branches.pl page.  As a result, clicking on the link
leads to 404 page.

Test plan:
==========
1. Have a library with a URL defined.
2. In the table on the Libraries page (/cgi-bin/koha/admin/branches.pl)
   click the link with the URL.
   You should get "Error 404".
3. Apply the patch; restart_all.
4. Go to the Libraries page.  Ctrl+R to reload JS.
   You should be able to reach the URL given in the library setup now.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 236075e0da)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:58:27 +00:00
Owen Leonard 11ed36f2b3 Bug 37229: Fix table configuration listings for course reserves
This patch changes the structure of columns_settings.yml so that the
configuration of tables on opac-course-details.pl and
opac-course-reserves.pl are in separate sections. They should not be
grouped under "biblio-detail" (opac-detail.pl).

To test you should have at least one course defined and some items
attached to that course.

- Apply the patch and restart services.
- Go to Administration -> Table settings -> OPAC
- You should see "Jump to" links for biblio-detail, course_items, and
  course_list.
- Make some changes to the course_items and course_list configurations.
- Go to the OPAC and confirm that your changes are reflected in the
  visible columns of those tables.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2af6bbbe5d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:58:05 +00:00
Owen Leonard ddeb8aa16a Bug 37264: Fix delete button on staff interface's suggestion detail page
This patch makes a few minor changes to the suggestion detail page in
the staff interface so that the "Delete" button looks correct and works
correctly.

To test, apply the patch and go to Suggestions in the staff interface.

- If necessary, submit a suggestion. You need at least one.
- From the suggestions management page, click the title of a suggestion.
- At the top of this page should be two buttons, "Edit" and "Delete."
  They should be styled consistently with each other.
- Clicking the "Delete" button should trigger a JavaScript confirmation
  dialog. Confirming should result in the suggestion being deleted.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3f0bf0c1d8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:58:05 +00:00
Eric Garcia 6c9c5d6c14 Bug 36821: Changed Authority Type text limit for librarians and OPAC to match database
To test:
1. Administration -> Authority Types
2. Select Genre -> Actions -> MARC Structure
3. Search or find tag 090 -> Actions -> Edit
4. Don't make any edits just hit submit
5. See the error: Please enter no more than 100 characters
6. Apply patch
7. Repeat steps 1-4
8. Notice error is gone and you can enter up to 255 characters to match database

Extra Credit:
1. Administration -> Authority Types
2. Select Genre -> Actions -> MARC Structure
3. Search or find tag 090 -> Actions -> Subfields
4. Choose any subfield -> Edit
5. Write a description for staff interface or OPAC
6. Notice you enter up to 255 characters to match database

Please enter the commit message for your changes. Lines starting

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit bcb90f92f2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:52:48 +00:00
Phil Ringnalda aa83fa2644 Bug 37252: Use our local copy of MARC21slimUtils.xsl in MARC21slim2MADS.xsl
Our local copy of the Library of Congress stylesheet MARC21slim2MADS.xsl is
our only one which includes MARC21slimUtils.xsl directly from the Library of
Congress rather than including our local copy. That makes it a fragile canary
for whatever reason that it currently isn't loading, but because it's not
exactly the most popular menu choice in all of Koha, it's far from being one
that anyone will notice.

We should instead include our local copy, make the bug 29556 change to
MARC21slim2MADS.xsl, and if someone wants to notice when including xsl from
LoC fails, they should write a test for it rather than depend on someone
noticing that saving authority records as MADS fails.

Test plan:
1. Without the patch, Authorities - search for Smith - click the linked
   name of any result to show authorities/detail.pl
2. Save - MADS (XML)
3. Check your downloaded file, see that it is zero bytes
4. Apply patch, restart_all
5. Repeat step 2, but this time find that your downloaded file is more
   than zero bytes.

Signed-off-by: David Nind <david@davidnind.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 905932e451)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:52:23 +00:00
Pedro Amorim 31d691cf98 Bug 37246: (QA follow-up) DRY Dropdown
If we're using the same dropdown it should be defined once.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ef4efffe46)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:52:00 +00:00
Nick Clemens 8d5604962e Bug 37246: Use the same dropdown for filtering and editing/adding budgets
This patch removes a second fetch of budgets form the db, and clones the dropdown in the template
as we will only ever be displaying one of them at a time.

The JS is moved to fire for both operations.

To test:
 1 - Create an active and inactive budget in acquisitions
 2 - Add funs to both
 3 - Visit - Acquisitions -> Suggestions
 4 - Click 'Acquisition information' under filters on the left
 5 - Note all funds are showing
 6 - Apply patch
 7 - Reload
 8 - Note you only see active budgets
 9 - Check the box to show inactive, verify they show
10 - Filter by an inactive budget
11 - Confirm selection remains
12 - Add a suggestion and verify budget dropdown works
13 - Edit the suggestion and verify budget dropdown works

Signed-off-by: Sam Lau <samalau@gmail.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 12a9e98d2d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:52:00 +00:00
Sam Lau c9a7c054a5 Bug 37194: Improve link from unconfigured ILL module
To test:
1) Enable the ILLModule syspref
2) Go to the ILL module
3) Observe the link that reads "Take a look at the about page" and points to http://localhost:8081/cgi-bin/koha/about.pl#sysinfo_panel
4) Apply patch
5) Observe the link that reads "Take a look at the about page" now points to http://localhost:8081/cgi-bin/koha/about.pl?tab=sysinfo

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 9ae78dd575)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:51:30 +00:00
Katrin Fischer 8eabc09609 Bug 37008: Make "Help" link in vue modules translatable
The "Help" link in the upper right corner was not translatable
in the newer vue modules like ERM and Preservation.

To test in koha-testing-docker:

* Install any language:
  sudo koha-translate --install de-DE --dev kohadev
* Activate the language in the language system preference
* Activate the ERMModule system preference
* Go to the ERM module, verify translation works in general, but Help
  remains in English
* Apply patch
* Run: yarn build
* Run: gulp po:update
* Verify the string "Help" now appears in
  misc/translator/po/de-DE-messages-js.po
* Translate it
* Run:
  sudo koha-translate --update de-DE --dev kohadev
* Verify "Help" is now translated

Signed-off-by: Jake Deery <jake.deery@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e76a5ec5cc)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:51:30 +00:00
Owen Leonard 332cf2f031 Bug 37235: Fix export of single authority record
When viewing an authority record, you have the option to "Save" in
several different formats. This operation is a GET operation and the
script should not be looking for a "cud-" operation.

To test you should have at least one authority record.

- Apply the patch and go to Authorities.
- Perform an authority search which will return one or more records.
- View the details of an authority record.
- From the toolbar, test the "Save" option*

* Note: In my test the export choice "MADS (XML)" resulted in a
  zero-byte file but I'm assuming that is a separate issue.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.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 6d6c4cc12c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:47:35 +00:00
Martin Renvoize 81040b2c21 Bug 37065: Filter expired bookings by default
This patch adds a default filter for the bookings table on the bookings
tab of a biblio.  We also add the option to turn off the filtering after
initial page load.

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 98bcde6143)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:47:18 +00:00
Lucas Gass 910898302f Bug 37249: Disambiguate itemnumber with USING clause
1. Do an item search that returns results
2. Use the column filtering available at the top of the table for each column
3. Try itemnumber, get a 500 error each time
4. As long as there is data in the itemnumber column and you attempt to use another column you'll see a 500 error.
5. APPLY PATCH, restart_all
6. The itemnumber column filtering should now work as expected

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a84a5fc7d0)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:46:48 +00:00
Andreas Jonsson c4721f5798 Bug 37244: Facets should not impact library pulldown.
When parsing the branch limits the regular expression matches
parameters that contains the substring "branch:" rather than the prefix
"^branch:". Consequently, both prefixes homebranch: and holdingbranch:
triggers the branch limit.

Test plan:

- Activate the system preference  IntranetAddMastheadLibraryPulldown.
- In staff interface:
  - Perform a catalogue search (e.g. "book").
  - Click on a facet for holding library or home library
    (e.g. "Fairview").
  - Click on the "more options" icon in the search box and make sure
    that "All libraries" is selected.
- Activate the system preference  OpacAddMastheadLibraryPulldown
- In opac:
  - Perform a catalogue search (e.g. "book").
  - Click on a facet for holding library or home library
    (e.g. "Fairview").
  - Make sure "All libraries" is still selected in the dropdown next
    to the search input.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a6457c14aa)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:46:17 +00:00
Julian Maurice ff40efa0c1 Bug 35959: Add missing use statements in tests
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 25d3e167d6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:44:57 +00:00
Julian Maurice 109cb6a13d Bug 35959: Fix C3 merge of Koha::Old::Hold (part 2)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5f07b8ed52)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:44:57 +00:00
Julian Maurice 841009d50c Bug 35959: Fix C3 merge of Koha::Account::Debit, Koha::Account::Credit
Test plan:

Run the following commands

  perl -c Koha/Account/Debit.pm
  perl -c Koha/Account/Credit.pm

They should all print 'syntax OK'

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 3d1b5932b4)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:44:57 +00:00
Julian Maurice 7068dd1eb4 Bug 35959: Fix C3 merge of Koha::Biblio::Metadata::Extractor::MARC::*
Test plan:

Run the following commands:

  perl -c Koha/Biblio/Metadata/Extractor/MARC/MARC21.pm
  perl -c Koha/Biblio/Metadata/Extractor/MARC/UNIMARC.pm

They should all print 'syntax OK'

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 4190e92f5e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:44:57 +00:00
Julian Maurice 4db70b3d86 Bug 35959: Fix C3 merge of Koha::Old::Hold
Test plan:

Run `perl -c Koha/Old/Hold.pm`
It should print 'syntax OK'

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 c951b02182)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:44:57 +00:00
Julian Maurice 62e4e77fc8 Bug 35959: Fix C3 merge of 5 modules
Test plan:

Run the following commands:

  perl -c Koha/AuthorisedValue.pm
  perl -c Koha/Patron/Category.pm
  perl -c Koha/Patron/Attribute/Type.pm
  perl -c Koha/Account/DebitType.pm
  perl -c Koha/Account/CreditType.pm

They should all print 'syntax OK'

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 86acd6ec61)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:44:57 +00:00
Nick Clemens 3c23516efd Bug 37056: Mount a new intranet_svc api to avoid redirects
When an unauthorized call to svc is made, we use the ErrorDocument middleware to respond with an HTML
page. The API doens't do this, it simply returns its status. We should mount the svc as its own app to avoid
the redirect to HTML for unauthorized responses

To test:
1 - Create a report
2 - Add to IntranetUserJs:
    $(document).ready(function() {
      // Your report ID
      var reportId = '492';

      // Fetch the report
      $.get('/cgi-bin/koha/svc/report?id=' + reportId, function(data) {
        console.log('Kaboom');
      });
    });
3 - Log out
4 - Attempt to login
5 - KO
6 - Apply patch
7 - Reset all (or copy the necessary changes to your plack/apache files)
8 - Generate report and update user js again
8 - Logout, login
9 - Success!

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 edc5caf976)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:42:23 +00:00
Owen Leonard 8f31b36795 Bug 37206: Removing an item from a label batch should be a CSRF-protected POST operation
This patch updates the label batch edit template so that removing a
single or multiple items from a batch is a CSRF-protected POST
operation.

The patch also removes the existing "if ($op eq 'cud-delete') {" section
of label-edit-batch.pl because it was unused.

To test, apply the patch and go to Cataloging -> Labels.

- Create a label batch and add multiple items to it.
- From the list of label batches, click "Edit" on the batch you created.
- Click the "Delete" button for one of the items in the batch.
  - If you confirm, the item should be deleted.
- In the "Select" column, check multiple checkboxes.
- Click the "Remove selected items" button in the toolbar.
  - Verify that confirming this operation results in the items being
    deleted from the batch.

Sponsored-by: Athens County Public Libraries
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a964d98dc8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:41:08 +00:00
Caroline Cyr La Rose d9d5dadb95 Bug 37114: Update MARC21 default framework to Update 38 (June 2024)
This patch updates the MARC21 default bibliographic framework
to reflect the changes brought by Update 38 (June 2024).

To test:
1. Apply patch and reset_all
2. Go to Administration > MARC bibliographic framework
3. Click Actions next to the default framework and choose MARC structure
4. Check for the changes detailed in the update
https://www.loc.gov/marc/bibliographic/bdapndxg.html

- No changes in the framework for 055, changes only affect indicator values and
  field documentation

- There should be two new subfields in 082
  - 0 - Authority record control number or standard number (R)
  - 1 - Real World Object URI (R)

- There should be two new subfields in 083
  - 0 - Authority record control number or standard number (R)
  - 1 - Real World Object URI (R)

- No changes in the framework for 341, changes only affect field documentation

- Field 383 should now be titled NUMERIC DESIGNATION OF MUSICAL WORK OR
  EXPRESSION

- There should be a new subfield in 580
  - 5 - Institution to which field applies (NR)

- There should be two new subfields in 647
  - 4 - Relationship (R)
  - e - Relator term (R)

- There should be two new subfields in 648
  - 4 - Relationship (R)
  - e - Relator term (R)

- There should be a bew subfield in 773
  - 5 - Institution to which field applies (NR)

- There should be a bew subfield in 774
  - 5 - Institution to which field applies (NR)

- There should be a bew subfield in 787
  - 5 - Institution to which field applies (NR)

5. Optional: run the framework test in Administration > MARC
   bibliographic framework test
   --> All should be OK

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 86dc1ce6cd)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:32:02 +00:00
Lucas Gass 24f3583d04 Bug 37027: Remove unnecessary dataTable controls from SCO tables
To test:
1. Have a patron with some checkouts, holds, and charges that can login into the SCO module.
2. Notice the dataTable controls for searching the table, copying the table, exporting as CSV, or printing.
3. APPLY PATCH
4. Try step 2 again, this time the only dataTable control should be the search filter.

Signed-off-by: Sam Lau <samalau@gmail.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 67f18ea834)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:31:45 +00:00
Matt Blenkinsop 707d9b9baf Bug 36935: Add unit test for error handling
prove t/db_dependent/Koha/BackgroundJob/ImportKBARTFile.t

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 0a2c2468a7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:31:15 +00:00
Matt Blenkinsop 52fba8067c Bug 36935: Add a 'die' message to file parsing
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 04a038f6b0)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:31:15 +00:00
Matt Blenkinsop 008b7c72bf Bug 36935: Remove warning if file parsing is successful
This patch removes the logged warning if a file parse is successful.

Test plan:
1) prove t/db_dependent/Koha/BackgroundJob/ImportKBARTFile.t
2) The output will have a logged message - 'EOF - End of data in parsing input stream'
3) Apply patch
4) Repeat step 1
5) The warning will be gone

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 7c0ed91c80)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:31:15 +00:00
Phil Ringnalda d0ac78ee0f Bug 37167: Fix mapping call number searches to Z39.50
When you do an advanced search for call number, your search uses the index
callnum, but the code that maps your search to a possible Z39.50 search
still uses the index lcn,phr which was last used 15 years ago, so it's
treated as an unknown index and mapped to the Title field in the Z39.50
search form.

Test plan:
1. Click Search in the top menu to load Advanced Search
2. Change the dropdown menu for the first input from Keyword to Call
   Number, and paste TT174.3 in the input and search
3. Find the Z39.50/SRU search button in your results and click it
4. Note that your search was filled in the Title field
5. Apply patch, reset_all
6. Repeat steps 1-3, note that your search was filled in the Dewey field
7. Choose the server Library of Congress SRU and search
8. Note that even though we labelled it Dewey and you searched for an
   LC call number, your results are things with that call number in 050,
   the LC call number field.

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 9c4b2c665f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:26:13 +00:00
Owen Leonard 3257b8f6e4 Bug 37158: Make OPAC recalls history table responsive
Some markup errors in the OPAC recalls history template are causing the
table to not be responsive even though the DataTable is configured to be
responsive. This patch corrects it.

Also changed:

- Removed obsolete <span class="tdlabel">, a remnant of the
  way we did responsive tables before the DataTable option
- Removed very obsolete "type" attribute from the <script> tag and very
  obsolete "<![CDATA" marker from the script block.
- Removed <span>s which were used in the obsolete "title-string" method
  of sorting a DataTable.

To test you must have recalls enabled and have at least one circulation
rule which allows for recalls.

- Log in to the OPAC as a user who can place recalls.
- Locate an item which is elligible for recall and place the recall.
- Go to your user summary page, and click the "Recalls history" link in
  the sidebar.
- Confirm that the table of recalls on that page behaves
  correctly. It should adjust well to varying browser widths.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.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 a1cfe67d5e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:25:53 +00:00
Nick Clemens 2e17d1221e Bug 37155: Remove use of unblessed patron
This removes the unblessing of the patron object and uses fields form the patron

To test:
Confirm tests still pass:
prove -v t/db_dependent/Holds.t t/db_dependent/Circulation.t t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t t/db_dependent/Reserves.t t/db_dependent/api/v1/holds.t

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 975a869c49)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:25:31 +00:00
Nick Clemens 7645e165b2 Bug 37155: Refactor GetAgeRestrictions
This routine currently takes the agerestriction value from biblioitems and an unblessed borrower object
and uses the date of birth to calculate whether the ptrons DOB is before or after the minimum value required
against the age restriction

We have a routine in the patron object to get the patron's age - we cna use this against the parsed agerestriction
value in a simple comparison and remove the need to unbless and pass the patron.

FIXME: We should move this to a biblioitems or biblio object method

To test:
0 - In Admin -> Koha to MARC mapping, set biblioitems.agerestriction to 521,a
1 - Set syspref AgeRestrictionMarker to 'Age'
2 - Edit a record and set 521$a to 'Age 14'
3 - Add an item or copy the barcode of the item on that record
4 - Attempt to checkout item to Lisa Charles in sample data, or a 15 year old patron
5 - It should checkout fine
6 - Check in item
7 - Edit patron  Joyce Gaines to set age to 13 DOB:06/20/2011, or create a 13 year old patron
8 - Attempt to checkout item
9 - Item is blocked
10 - Apply patch
11 - Repeat tests, confirm no change

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 11c5abda48)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:25:31 +00:00
Sam Lau b1431c2132 Bug 37104: (Follow-up) Checks for unitialized value of 'anonymous_patron' system pref
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
JD Amended patch: replace '==' with 'eq' for consistency with other
occurrences.
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 9dbd82a1a4)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:21:25 +00:00
Sam Lau e5afec77f2 Bug 37104: (Follow up) Restructure checkpw code
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 99b2fab569)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:21:25 +00:00
Sam Lau 74c9551f91 Bug 37104: Block AnonymousPatron from logging into staff interface and OPAC
This patch blocks the patron set as the anonymous patron from logging into the staff interface and OPAC.

To test:
1) In Administration->sys. pref, make sure AnonymousPatron is pointed to an account.
2) Visit that patron's page and set their permissions to superlibrarian ("Access to all librarian functions")
3) Ensure that you know the username and password for this patron and can log in.
4) Visit the OPAC, attempt to log-in with your anon patron.
5) Note that you can log in and nothing happens.
6) Visit the staff interface, attempt to log-in with anon patron.
7) Once again, note that you are able to log-in with no issue.
8) Apply patch and restart_all
9) Attempt to log into the OPAC and staff interface with the patron again.
10) This time, you should get an error message on both pages saying, "Error: You can't log in as the anonymous patron!"

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 0f2a5bf987)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:21:25 +00:00
Sam Lau 39754b8b99 Bug 37104: Unit tests
prove t/db-dependent/Auth.t

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 ce0fe316b8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:21:25 +00:00
Nick Clemens 9537ba5957 Bug 37057: Restore filtering of unused authorities
Bug 12478 commented this code out, however, we do return the 'used' parameter in ES authority searches. While
we should implement the feature for both ES and Zebra as an index, we can restore this behaviour here.

To test:
1 - Search authorities on OPAC with SearchEngine syspref set to both Elasticsearch and Zebra
    I just searched for 'a'
2 - Confirm results with no usage are included
3 - Test with both values of OPACShowUnusedAuthorities
4 - Apply patch
5 - Repeat searches with both engines and syspref settings
6 - Confirm unused authorities not shown in either engine when syspref is "Don't show"
7 - Conifrm unused authorities shown in both engines when syspref is "Show"

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 30acbb2604)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:20:45 +00:00
Owen Leonard c2b54df8d5 Bug 36950: Improve placement of catalog concern banner in the OPAC
This patch changes the placement of the catalog concern banner in the
OPAC. Changing the way it is added to the DOM will prevent it from
obscuring content.

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

- In the staff interface, make sure the "OpacCatalogConcerns" system
  preference is enabled.
- Locate a bibliographic record and view the detail page.
- Click the "Report a concern" link in the sidebar.
- Submit your concern.
- When the concern is successfully submitted and the modal closes, the
  success banner ("Your concern was successfully submitted.") should
  appear below the breadcrumbs menu and above the biblio view tabs
  ("Normal view, "MARC view", etc.).

Sponsored-By: Athens County Public Libraries
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 43a08f0f1e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:20:01 +00:00
Tomas Cohen Arazi cc8f03cf2b Bug 36901: Add logging for uncaught exceptions in background job classes
This patch adds logging of unhandled exceptions that could occur. This
is happening on busy production sites right now. This is also useful for
plugin jobs that might not be 100% following the guidelines and would
benefit from this.

But as the [DO NOT PUSH] patch highlights, this is something we really
want to have on our current codebase, as a database connection drop
might make us reach that `catch` block we are adding logging to on this
patch.

To test:
1. Apply the [DO NOT PUSH] patch
2. Run:
   $ ktd --shell
  k$ restart_all ; tail -f /var/log/koha/kohadev/worker*.log
3. Pick a valid barcode on the staff UI
4. Use the 'Batch delete items' tool in the cataloguing section
5. Start the job for deleting the item
=> FAIL: The item got deleted, but the job marked as failed and no logs
about the reasons
6. Apply this patch and repeat 2-5
=> SUCCESS: Same scenario but there's a log with the error message
7. Sign off :-D

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 b54c854d24)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:18:00 +00:00
Tomas Cohen Arazi f49de36e81 Bug 36873: Make Koha::Objects->delete pass parameters to the underlying method
This patch makes the generic method pass any parameters it got passed to
the underlying `delete()` method.

To test:
1. Apply the unit tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Objects.t
=> FAIL: Tests fail, parameters are not passed
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: 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 2d4ab2e1bc)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:17:40 +00:00
Tomas Cohen Arazi cf05d5d43a Bug 36873: Unit tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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 2d5b3cb04b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:17:40 +00:00
Owen Leonard 91ea18bf41 Bug 36557: (follow-up) Restore missing "Remove from list" control
This patch restores the "Remove from list" control to the batch
operations toolbar when one is looking at the contents of a list. It was
unintentionally left out of the previous patch.

The patch also corrects some button markup to ensure consisten style of
controls in the batch operations toolbar.

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 e79690ff8a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:15:32 +00:00
Owen Leonard ec7efa67a0 Bug 36557: Convert Cart and Lists controls to buttons and rework logic
This patch tries to address errors in the way features are displayed in
result lists so that controls for holds, tags, lists, etc. are shown or
hidden according to system preferences.

The patch converts the Cart/Lists dropdown to separate buttons, making
the display logic simpler and making the interface more consistent with
updates to the staff interface search results.

To test, apply the patch and rebuild the OPAC CSS.

- In the OPAC, test these pages:
  - Catalog search results
  - List contents
- Test with various combinations of these system preferences:
  - opacbookbag
  - DisplayMultiPlaceHold
  - virtualshelves
  - OPACHoldRequests
  - TagsEnabled
  - TagsInputOnList
  - UseRecalls
  - ArticleRequests

With each different combination of settings the right controls should
appear in the toolbar at the top (if present), and with each search
result.

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 9917b39d9d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:15:32 +00:00
Alexandre Noel 4ab03bac8d Bug 35823: When uploading a MARC file to a basket it is showing inactive funds without the show checkbox button selected
Prerequisites:
    - Have at least 2 budgets with funds
        1. Add several budgets ("Acquisitions" > "Budget") with funds ("Actions" > "Add fund")
        2. Keep one budget active (check the "Make Budget active" box in
           the budget edit page)
    - Have at least one file of records imported into Koha ("Cataloging" >
      "Stage records for import" > "Upload a file")

To test:
    1. Go to Acquisitions page.
    2. Create a vendor and new basket if not already available.
    3. In your vendor, "Add to the basket" > "From a staged MARC file".
    4. Click "Add orders" of one of the MARC file.
    5. Check the checkbox in the "Select for import" tab.
    6. In the dropdown menu of the "Fund" field, verify the budget
       names.
    --> Ensure Koha displays all inactive budgets even if the "Show
    inactive funds" checkbox is not checked.
    7. Apply patch, and refresh the page (crtl + F5)
    8. Verify the budgets in the "Fund" dropdown menu and test it with
       the "Show inactive funds" checked and uncheked"

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2e06546799)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:14:49 +00:00
Pedro Amorim 252aeb74c7 Bug 34920: Add cypress tests
Run the agreements cypress test spec:

cypress run --spec t/cypress/integration/ERM/Agreements_spec.ts

Signed-off-by: Laura Escamilla <laura.escamilla@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 631f146ec3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:12:49 +00:00
Pedro Amorim 98b7afcbb5 Bug 34920: Ensure 'description' property is an empty string if 'lib' is null
Test plan:
1. Enable ERM module
2. Confirm that you can open the ERM module in the staff interface.
3. Go to the authorized values, select 'ERM_AGREEMENT_CLOSURE_REASON' and edit the 'Cancelled' authorized value by removing the description. Making this change with any of the ERM authorized values will result in an error.
4. Go back to the ERM module and notice that there is an error. 'Something went wrong: Error: Expected string - got null.'
5. Apply patch. Run yarn js:build. Repeat test plan
6. Create a new agreement. Pick status 'Closed'.
7. Open 'Closure reason'. Confirm there is an entry for 'Expired' and an empty entry below that.

Signed-off-by: Laura Escamilla <laura.escamilla@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 c81a4bb213)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:12:49 +00:00
Pedro Amorim ce5f044d74 Bug 34920: Add API endpoint tests
prove koha/t/db_dependent/api/v1/authorised_values.t

Signed-off-by: Laura Escamilla <laura.escamilla@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 7a20ef5d1c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:12:49 +00:00
Pedro Amorim 380fa6e121 Bug 34920: Return sorted av_cats to be able to test
Signed-off-by: Laura Escamilla <laura.escamilla@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 4cd81ed3ec)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:12:49 +00:00
David Cook fc50580c29 Bug 32575: Add an empty text body to fix multipart/mixed handling
By adding an empty text body, we force Email::Stuffer/Email::MIME
to use multipart/mixed handling for the attachment instead of forcing
a single part (ie direct attachment) email, which is not consistently
handled by different email clients.

An empty text body is language-neutral (ie not imposing English),
and it allows SMTP servers to inject organisational footers into
the email (e.g. confidentiality notices).

Signed-off-by: Magnus Enger <magnus@libriotech.no>
I have tested this solution in production, and it works for me.

Bug 32575: Tidy patch

Signed-off-by: Magnus Enger <magnus@libriotech.no>

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 3e1d8b0628)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:10:34 +00:00
Marcel de Rooy 0e22b1184a Bug 37038: (QA follow-up) Replace \> by -gt
Note that -gt is the bash integer comparison and > is the
lexical one:
$ if [ '1' \> '09' ]; then echo true; fi
true
$ if [ '1' -gt '09' ]; then echo true; fi

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Added the dev/null redirection to suppress warn in bin/sh.
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit fd7130beca)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:01:10 +00:00
Janusz Kaczmarek 81a1002c00 Bug 37038: koha-elasticsearch creates a file named 0
After execution of koha-elasticsearch command a file named 0 remains in
the current directory.

Inside the single parentheses, the character '>' is treated as a file
redirection, not as a comparison operator.

Test plan:
==========
1. Have a test installation with Elasticsearch.  As root, perform:
   ./debian/scripts/koha-elasticsearch --rebuild kohadev
   When the command finishes, check the contents of the current
   directory (ls -ltr | tail).  You sould notice a fresh file named '0'
2. Apply the patch. Delete the file named 0.
3. Repeat p. 1.  There should be no file named 0 now.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>

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 bc92152e2f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:01:10 +00:00
Janusz Kaczmarek 6e66ea7151 Bug 36976: Warning 'Argument "" isn't numeric in numeric' in log when merging bibliographic records
When merging bibliographic records, Koha generates warning:

[WARN] Argument "" isn't numeric in numeric ge (>=) at /kohadevbox/koha/Koha/Util/MARC.pm line 81.

in [plack-]intranet-error.log.

This is because $tagslib->{$fieldtag}->{'tab'} -- for a tag, not for a
subfield --is (always?) an empty string (cf.
C4::Biblio::GetMarcStructure : $res->{$tag}->{tab} = ""), and in
Koha::Util::MARC::createMergeHash it is compared numerically with 0.

Test plan:
==========
1. From biblio search result page, selact two records with the checkboxes
   and start a merge (Edit -> Merge records).  Proceed with merging.
   After the merge, controll the content of the plack-intranet-error.log
   (when using plack -- standard in ktd).  Note the lines:
   [WARN] Argument "" isn't numeric in numeric ge (>=) at /kohadevbox/koha/Koha/Util/MARC.pm line 81.
2. Apply the patch; restart_all.
3. Repeat p. 1.  There should be no fresh warnings.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>

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 fb2e54b0c3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 17:00:08 +00:00
Marcel de Rooy 15c7c419e0 Bug 36944: Mock AutoLocation in 2FA subtest
Test plan:
Enable AutoLocation in prefs.
Run Auth.t. Should pass now.

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 8a90ec5432)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 16:55:08 +00:00
Tomas Cohen Arazi 13424546a9 Bug 36936: (QA follow-up) Make the test work on MySQL 8.x
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 43985e90db)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 16:53:38 +00:00
Martin Renvoize 0aa28df134 Bug 36936: Squash warning in bookings test
Simple catch for the warning throwing by DuplicateID exceptions in the
bookings.t api tests.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.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 7c5a96e6eb)
2024-11-18 16:53:29 +00:00
Tomas Cohen Arazi 361daca92b Bug 14565: Allow koha-run-backups to backup an instance called `demo`
We all have a `demo` instance somewhere. It is so weird that the default
script for backing up Koha has a hardcoded exclusion for instances
called like that. This patch fixes that.

To test:
1. Add a demo instance:
   $ ktd --shell
  k$ sudo koha-create --create-db demo
2. Run:
  k$ sudo debian/scripts/koha-run-backups
3. Check the backups:
  k$ ls -l /var/spool/koha/demo/
=> FAIL: No backup for the demo instance
3. Apply this patch
4. Repeat 2
=> SUCCESS: Backup made!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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 6caedbfc00)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 16:51:03 +00:00
Owen Leonard b6c631ab2e Bug 36905: Terminology: home locations / home collections
This patch removes the unnecessary word "home" from several aria-lablels
in OPAC facets. I think they were copy-paste errors.

To test, apply the patch and perform a catalog search in the OPAC.

Since the aria-label isn't visible in the interface, you can check the
source to confirm that the "Show more" links for locations, collections,
and languages say "Show more locations," "Show more collections," and
"Show more languages."

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 66981d89c2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 16:50:25 +00:00
Eric Garcia 87885e1b0d Bug 35232: Fix typo on list.tt
1. Go to Patron lists and add patrons to a list.
2. Click the "Add multiple patrons" link
3. Clicking the "Borrowernumbers" label doesn't trigger the corresponding radio button
4. Apply patch
5. Attempt steps 1-3
6. Sign off :)

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0be606f21e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 16:49:59 +00:00
Janusz Kaczmarek 1172e2634f Bug 36970: (Bug 34160 follow-up) Barcode should be html filtered, not uri filtered
If a barcode (in rare cases) contains a space, with bug 34160, it is
converted into %20 in holds queue view (because of mistakenly applied
uri filter).

Nota bene, in parallel lines of view_holdsqueue.tt a right filter is
used for the barcode.

Test plan:
==========
1. Have an item with the barcode containing a space.
2. Make a hold on it, run build_holds_queue.pl
3. Go to Circulation > Holds queue ; select your branch etc.
4. You should see '%20' instead of the space in the barcode.
5. Apply the patch, restart_all.
6. Repeat p. 3.  You should now see the space in the barcode.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5a32d5b059)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 16:48:50 +00:00
Eugene Jose Espinoza 9531bf5407 Bug 35238: Incorrect label markup in patron card creator printer profile edit form
HTML element for Template name is changed from 'label for "template_name"' to 'span with "label" class'.

So from:
<label for="template_name">Template name:</label>
It should now be:
<span class="label">Template name:</span>

To test:
1) Go to: Tools -> Patron card creator -> Edit printer profile.
2) Right click page and choose "View page source".
3) Locate the part with "Template name". It should read:
<span class="label">Template name:</span>

Signed-off-by: Riomar Resurreccion <urslibrary.webinars@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5513213a4f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 16:47:11 +00:00
David Nind f9317882d2 Bug 35257: Change 'Circulation desks' to 'Desks'
The administration page is the only page that uses "Circulation desks" for
navigation elements. All other areas (sidebar menu, breadcrumbs,
adding and editing desks, page titles) all use just "Desks".

This updates the Koha administration page to use "desks" for consistency. It
also updates the UseCirculationDesks system preference description.

Test plan:
1. Enable the UseCirculationDesks system preference.
2. Go to Koha administration > Patrons and circulation
3. Select the Circulation desks option.
4. Note that the sidebar menu, breadcrumbs, and page titles all
   use just "Desks".
5. Note that in the top-right hand menu bar that it says "NO DESK SET". If
   you click the dropdown menu it says "Set library and desk".
6. Apply the patch.
7. Go to Koha administartion > Patrons and circulation.
8. Note that the heading now says just "Desks".
9. Note that the description for the UseCirculationDesks system
   preference is now "Don't use/Use circulation desks".
10. Sign off D:

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5f096c31a7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 16:28:19 +00:00
Kyle M Hall fc09b18ea2 Bug 37075: Message queue processor will fail to send any message unless letter_code is passed
For reasons unknown, GetOptions is inserting an empty string into the letter_code list. If you are running the script with a letter code filter, the empty string is added to the OR so it functions. If no letter_code is passed, the search requires the letter code to be an empty string, which will of course fail. Even more perplexing is that this does not happen for the type list which is essentially identical code.

Test Plan:
1) Generate some messages in the message queue
2) Run `process_message_queue.pl -v -c`
3) Note nothing happens
4) Apply this patch
5) Repeat step 2
6) Messages are sent!

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 a6eab64e53)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 16:26:17 +00:00
Nick Clemens d7499750f1 Bug 27769: Update default key mapping to copy text
When implemented, the keyboard shortcuts could not use the system clipboard so
Citrl-C was mapped to use the editor clipboard. As this now works with the system clipboard
we should allow standard functionality and remap the Koha shortcut.

This will not affect existing installations, however, they can modify the keyboard shortcut if they
wish by visting:
Administration->Keyboard shortcuts
 or
Clicking the 'Redefine shortcuts' link under 'Keyboard shortcuts' in the advanced editor.

To test:
1 - Apply this patch
2 - Reset all
3 - Confirm Ctrl-Alt-C is the command to 'Copy current field' in Keyboard shortcuts in the advanced editor

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>
(cherry picked from commit b34515a2d0)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 16:21:09 +00:00
Paul Derscheid 59ffa74538 Bug 37524: (QA follow-up) Tidy affected block in checkouts.js
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 541199edf8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 16:15:49 +00:00
Emmi Takkinen c815cdd690 Bug 37524: Do not attempt to renew check outs if there is nothing to renew
If patrons loans are not renewable and one hits "Renew all"
button in patrons "Check out" page, Koha is redirected to
"Export data" tool. This happens because when there is
nothing to renew call to function renew_all produces error:
"Uncaught TypeError: renew_all(...) is undefined". This
patch prevents call to this function and adds alert to
inform user that there are no items to be renewed.

To reproduce:
1. Find patron with check outs which renewals count has hit
the maximum limit of renewals.
2. Press "Renew all" button.
=> Koha is redirected to "Export data" tool.
3. Apply this patch.
4. Try to renew check outs again.
=> Alert pop up is displayed.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 45e7bdaff7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 16:15:49 +00:00
Phil Ringnalda c27d242adb Bug 37913: Remove more unreachable code in aqcontract.tt
When you successfully delete an acquisitions contract, you are redirected to
the page with the vendor details, which shows contracts for that vendor, which
shows you that the contract you deleted was deleted.

The aqcontract.tt template has a block in [% IF ( delete_confirmed ) %] (which
is never set) that thinks it will show you a '<h1>Contract deleted</h1>' and
make you click an OK button. That block has never been shown, but the button
is in a form which POSTs without an 'op' param, which is now forbidden by the
CSRF code, and will be caught by a test once bug 37728 updates the test.

There's nothing visible to test, so the test plan just makes sure nothing
blows up and you can still delete a contract.

1. Nothing will change, so start with the patch applied
2. Acquistions - click the Search button to search for vendors
3. New -> Contract
4. Give it a name, a start date, and an end date, and Save
5. In the list of contracts for My Vendor, click the Delete button for
   the contract you created
6. In the confirmation page asking if you wanted to delete, click 'Yes,
   delete contract'
7. Note that you are at acqui/supplier.pl?booksellerid=1, the details page
   for the vendor, and your contract isn't listed at the bottom of the page,
   and especially that you weren't shown a page that just said "Contract
   deleted."

Sponsored-by: Chetco Community Public Library
Signed-off-by: Sukhmandeep Benipal <sukhmandeep.benipal@inLibro.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1264ece1f9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 16:14:00 +00:00
Martin Renvoize c2867900f5 Bug 37916: Convert plugin install button to form
This patch takes the usual approach of converting linked buttons to form
with the csrf token included.

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 711c399222)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 16:12:41 +00:00
Owen Leonard 5baf659996 Bug 37213: (follow-up) Remove stray closing em tag, make title logic consistent with breadcrumbs
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 79464e6224)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 16:04:05 +00:00
Eric Garcia 02b655c6d3 Bug 37213: Improved breadcrumbs in rotating collections
To test:
1. Tools -> Rotating collections -> New collections
2. Add a title and description
3. After adding the new collection notice the breadcrumb isn't right
4. Apply patch
5. Repeat steps 1 and 2
6. After adding the new collection notice the breadcrumb is improved.

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 16234dda5f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 16:04:05 +00:00
Emily Lamancusa 8cdc3ef415 Bug 37823: Remove unreachable code in vendor contract page
The vendor contract management page has a few sections of code that are
meant to display a minimal confirmation message ("Data recorded") after
saving a new or edited vendor contract.

However, aqcontract.pl redirects back to the vendor details page after
saving, so this code is never reached and should be removed.

Test plan:
1. Apply patch
2. Go to the Acquisitions module and find a vendor
3. Click + New > Contract
4. Fill in the information and click Save
5. Click the "Contracts" link in the navigation menu on the left
--> Confirm that the contract was saved correctly
6. Click the Edit button and make changes to all fields
7. Save the information and click "Contracts" again
--> Confirm that the new information saved correctly

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e1b660303f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-18 16:00:21 +00:00
Phil Ringnalda 029498b48b Bug 37827: Switch OPAC download list form from POST to GET
The hidden form that the OPAC uses for downloading a list has no need to be
a POST, which is good because it can't be one without having an op param
that starts with "cud-" which it doesn't have.

Test plan:
1. Nothing visible will change, so start with the patch applied
2. Log in to the OPAC, then do a search for something like Perl which will
   return a couple of results. Select two, With selected titles: Add to
   list - New list - give it a name and Save
3. Lists - choose the one you just created
4. Download - ISBD
5. Verify that the page you were on didn't change, that a file was downloaded,
   and that the file contains the two titles in your list

Sponsored-by: Chetco Community Public Library
Signed-off-by: Chloe Zermatten <chloe.zermatten@ptfs-europe.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 663dd897d5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 21:31:08 +00:00
Phil Ringnalda 24fec8b7f9 Bug 37853: Do not POST a form at the end of changing the password (OPAC)
Rather than having a form that does a POST (without an op, which isn't proper),
the final step in changing your password in the OPAC should just be a link.

Test plan:
1. Without the patch applied, log in to the OPAC as a user that you don't
   mind changing the password for
2. Welcome, {username} - Your account - Change password
3. Type the old password, and a new password twice, click Change password
4. Below the success message is a green button with white text, Return to
   my account - click it
5. Apply patch
6. Change password, type the (new) old password, and a (newer) new password
   twice, click Change password
7. Below the success message is what looks like a green button with white
   text, Return to my account
8. Hover the button, check your browser status bar for a URL showing you
   that it's now a link. Click it to be sure it works.

Sponsored-by: Chetco Community Public Library
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>

Amended-by: Jonathan Druart
Edited commit message

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 c866cb1111)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 21:29:00 +00:00
Katariina Pohto 2f8d5311f1 Bug 35771: Unselecting titles when making multi-hold
When placing a hold on multiple biblios Place Holds page (request.pl) has checkboxes for unselecting some of the listed biblios.
Removing the checkmark does not actually unselect the biblio. Clicking the Place holds button will place a hold for all the biblios on page that can be reserved.
If unchecked biblio does not have a pickup location, it will get past form validation and cause an error.

Test plan:
1. Select several biblios and choose Place hold
2. Choose a patron
3. Select a pickup location for all biblios and unselect one of the checkmarks
4. Place holds and note that even the deselected holds was placed.
5. Repeat steps 1-2.
6. Leave pickup locations empty and try to place the holds.
7. Note alert: "Please make sure all selected titles have a pickup location set"
8. Uncheck one of the biblios and add pickup locations to the checked biblios.
9. Try to place the holds and note that there is no alert, and you get an error 500.
10. Apply patch.
11. Repeat steps 1,2,8 and place holds.
12. Note that there is no error 500, and while all the biblios are shown on page, only the checked biblios have a new hold placed on them.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e0014aeaac)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 21:26:39 +00:00
Owen Leonard 0b01cc23bd Bug 37814: Fix incorrect use of __() in .tt files
This patch corrects instances of the double-underscore function being
used in .tt files where the single-underscore function should
be used instead.

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

  > gulp po:update --lang fr-FR

- Open the corresponding .po file for the affected  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/modules/members/alert-subscriptions.tt:
    "Are you sure you want to unsubscribe %s from email alerts for %s?"
  - koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
    "Click to expand this section"

- Check fr-FR-opac-bootstrap.po for this line:
  - koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-alert-subscriptions.tt:
    "Are you sure you want to unsubscribe %s from email alerts for %s?"

Sponsored-by: Athens County Public Libraries

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 a15841cb11)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 21:20:47 +00:00
Phil Ringnalda 47435e9bbb Bug 37766: Fix forms that POST without an op in MARC bibliographic frameworks
We intend not to have forms with method="post" without an op variable
(so we can check that the op starts with "cud-" as part of the CSRF
protection), but because of bug 37728 some were missed.

In MARC bibliographic frameworks, that's the tag search form, which
should be a GET so the URL includes what you searched for and you can
bookmark it or link to the search, and the cancel "No, do not delete"
button in the page to confirm deleting a subfield, which should also be
a GET to take you back to the page where you were, which was
?tagfield=903&frameworkcode=VR when you clicked Delete.

Test plan:
 1. No visible change in behavior (only the URL), so start with the
    patch applied
 2. Administration - MARC bibliographic framework - choose one other
    than Default, since the "&framework=" of Default could be confused
    with a failure to get the code in there - Actions - MARC structure
 3. Type any three digit number higher than 009 (you want something with
    subfields) in the Search for tag input and hit Enter
 4. Verify that your URL has the searchfield and frameworkcode correct
    and that number or next highest number tag is displayed first
 5. Change the In framework select menu to another non-Default framework
    and click search, and verify that the URL change to that
    frameworkcode, and that framework is displayed
 6. Toggle the Display only used tags/subfields checkbox, search for a
    different tag, and verify that the state of the checkbox persists as
    you do more searches
 7. On any other listed tag - Actions - View subfields
 8. For any displayed subfield click Delete
 9. In the confirmation page click No, do not delete
10. Verify that the page you return to has the correct tagfield and
    frameworkcode for the tag you chose

Sponsored-by: Chetco Community Public Library
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 0677cf5102)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 21:06:47 +00:00
Jonathan Druart 6cbe190092 Bug 37870: Fix sort order of class sources
There are several things going on here.
The tests are failing randomly when some additional class sources are in the
DB. This should never happen on Jenkins, but it happened, see the third
patch of this patch set (spoiler: tests not run within a txn)

There were also a sorting problem: by default sort will show
uppercases first:
  A, B, C, a, b, c
However we want:
  a, A, b, B, c, C
which is what fc does (https://perldoc.perl.org/functions/fc)

Test plan:
0. Checkout the main branch, without patches from this patchset.
1. Run t/db_dependent/ClassSources.t several times
=> Notice that new entries in the DB table 'class_sources' are created
2. Run t/db_dependent/Koha/UI/Form/Builder/Biblio.t and
t/db_dependent/Koha/UI/Form/Builder/Item.t
=> They fail (if not, run t/db_dependent/ClassSources.t again)
3. Apply the patches
4. Run t/db_dependent/ClassSources.t
=> No more additional entries in DB, tests are correctly run within
transactions
5. Run t/db_dependent/Koha/UI/Form/Builder/Biblio.t and
   t/db_dependent/Koha/UI/Form/Builder/Item.t several times
=> They always pass

Note that the sort should actually be done on the description, not the
code. But that's for another bug...

Signed-off-by: CJ Lynce <cj.lynce@westlakelibrary.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 405c2ac6b6)
2024-11-15 21:05:28 +00:00
Jonathan Druart 1946bdde6e Bug 37870: Remove warning if biblionumber is not passed
Not directly related to the failure, only a bit of cleaning before
starting.

Signed-off-by: CJ Lynce <cj.lynce@westlakelibrary.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0472b56a67)
2024-11-15 21:05:18 +00:00
Phil Ringnalda 2686951719 Bug 37794: Fix form that POSTs without an op in Holds to pull
We intend not to have forms with method="post" without an op variable (so we
can check that the op starts with "cud-" as part of the CSRF protection), but
because of bug 37728 some were missed.

In Holds to pull that's the form which lets you change from the default
starting and ending date. Switching that to a GET at least lets you refresh
the page without getting a browser warning about resending a POST and maybe
having your credit card double-charged.

Test plan:
1. Without the patch, Circulation - Holds to pull - change the start date to
   something earlier and click Submit
2. Refresh the page, get a warning about resubmitting data
3. Apply patch, Circulation - Holds to pull - change the start date to
   something earlier and click Submit
4. Refresh the page, no warning

Sponsored-by: Chetco Community Public Library

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 06f17d9f6a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 21:01:05 +00:00
Matt Blenkinsop 07f9382b62 Bug 37491: Remove duplicate asset import
This patch removes a duplicated asset import from import_from_kbart_file.inc

Test plan:
1) Apply patch and look at import_from_kbart_file.inc to observe that where previously there were two uses of "[% Asset.js("js/job_progress.js") | $raw %]" and now there is just one

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5a249bc5ea)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 20:46:34 +00:00
Mason James e4b57f0aa0 Bug 37490: Add a test to detect when yarn.lock is not updated
to test...

1/ set koha repo to state where yarn.lock is not updated

    $ git reset --hard 67db70d4

2/ run test, observe FAIL

    $ prove ./xt/verify-yarnlock.t
    ./xt/verify-yarnlock.t .. error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`.
    ./xt/verify-yarnlock.t .. 1/1
    #   Failed test 'verify yarn.lock file is updated correctly'
    ...
    Result: FAIL

3/ set koha repo to state where yarn.lock is updated

    $ yarn install

4/ note yarn.lock is now updated

    $ git status
    ...
    modified:   yarn.lock

5/ run test, observe SUCCESS

    $ prove -v ./xt/verify-yarnlock.t
    ./xt/verify-yarnlock.t ..
    ok 1 - verify yarn.lock file is updated correctly
    All tests successful.
    Files=1, Tests=1,  1 wallclock secs ( 0.02 usr  0.01 sys +  1.16 cusr  0.27 csys =  1.46 CPU)
    Result: PASS

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 8f0dc36f0d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 20:43:22 +00:00
Owen Leonard 47b703273b Bug 33925: Improve translation of title tags: Serials
This patch updates serials templates so that title tags can be more
easily translated. Some templates have been updated for consistency as
well: Harmonizing page title, breaddrumb navigation, and page headers;
Adding "page-section" <div> where it was lacking.

To test, apply the patch and confirm that the following pages have the
correct title tags:

- Serials home
  - Serials search results
    - Subscription details
      - Subscription edit
        - Search for vendor
        - Search for bibliographic record
      - Subscription renew
      - Serial collection
      - Create and modify routing list
        - Preview routing list
          - View routing slip
      - Claims
      - Check expiration
      - With a subscription which has manual history enabled, click the
        "Edit history" link under the "Planning" tab.
     - Select multiple serial search results and batch edit
  - New subscription
  - Manage frequencies: Create and edit
  - Manage numbering patterns: Create and edit

Signed-off-by: Loïc Vassaux-Artur <loic.vassaux-artur@outlook.fr>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 068d0c43c1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 20:39:48 +00:00
Owen Leonard 4b1ebe2a5b Bug 35239: (follow-up) Correct more missing label inconsistencies
This patch corrects a couple more labels and modifies the process of
cloning a patron attribute field so that each new cloned row has
matching label and input.

To test, apply the patch and, if necessary, create some patron attribute
types:

- Go to Administration -> Patron attribute types
- Create at least two new patron attribute types.
- Go to Tools -> Batch patron modification.
- Submit a batch of patrons for batch modification
- In the list of fields to modify, test that clicking each label gives
  focus to the corresponding field (except date fields, we need to fix
  that globally).
- Click "New" next to the patron attribute field.
  - A copy of the field should be created. Test that the new field also
    has matching label and <select>

Sponsored-by: Athens County Public Libraries
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ca51e5d642)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 20:36:53 +00:00
Catalyst Bug Squasher dba73d1cdb Bug 35239: Missing form field ids in batch patron modification template
Test Plan
1. Tools > Batch patron modification
2. List valid card number in text box
3. [Continue]
4. Edit patrons form, click on input box label
5. Matching input box gets focus

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d5388670c3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 20:36:05 +00:00
David Cook b86cd3ec62 Bug 37741: Do not send cookie back from error pages
This change stops the cookie from being sent back from error pages,
so that backcalls that cause errors don't overwrite the existing cookie
used by the foreground request page.

Test plan:
0. Apply the patch and koha-plack --reload kohadev
1. Set syspref IntranetFavicon to http://localhost:8081/cgi-bin/koha/bad.jpg
2. Open browser developer tools
3. Go to http://localhost:8081/cgi-bin/koha/mainpage.pl
4. Open the Network tab, disable the cache, and shift refresh
5. Notice that bad.jpg fails to load with a 404
6. Try to login to Koha
7. Confirm login works

*. Extra points if you note that the cookie returned by the first
mainpage.pl request is used for the bad.jpg lookup and the second
mainpage.pl request.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e6a1d65c9a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 20:31:16 +00:00
Jonathan Druart 386a823a84 Bug 36919: Remove yet another warning from Koha/Object.t
DBIx::Class::Storage::DBI::insert(): Missing value for primary key column 'currency' on Currency - perhaps you forgot to set its 'is_auto_increment' attribute during add_columns()? Treating 'currency' implicitly as an autoinc, and attempting value retrieval at /kohadevbox/koha/Koha/Object.pm line 172
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 34ff421c1c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 20:28:54 +00:00
Jonathan Druart 43829ee928 Bug 36919: Remove another warning from Koha/Object.t
C4::Context->userenv not defined! at /kohadevbox/koha/Koha/Patron.pm
line 1890.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f14db22d8a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 20:28:54 +00:00
Jonathan Druart 86ca184501 Bug 36919: Remove a warning from Koha/Object.t
Use of uninitialized value in numeric eq (==) at /kohadevbox/koha/Koha/Patron.pm line 446.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5c905109db)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 20:28:54 +00:00
Matt Blenkinsop a5d2239a52 Bug 37620: Fix Total-Count headers
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 e2538b5e83)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 17:50:32 +00:00
Matt Blenkinsop 0a906ca5b8 Bug 37076: Fix incorrect needsconfirmation code
This patch corrects two instances of RESERVED_WAITING to RESERVE_WAITING

Test plan:
1) Navigate to system preferences and search for AllowItemsOnHoldCheckoutSCO
2) Observe from the description that the correct status code is RESERVE_WAITING
3) Search the repository for RESERVED_WAITING - you should find two instances, one in Checkouts.pm and one in checkout.js
4) Apply patch
5) Repeat step 3 - there should be 0 instances

Signed-off-by: Lucas <lchirlias@ville-roubaix.fr>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2b7e770429)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 17:41:19 +00:00
Baptiste Wojtkowski e69480bfb7 Bug 37642: Generated letter should use https in header
_wrap_html returns a header referring to http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd and http://www.w3.org/1999/xhtml. These should be https links.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e27c3a6090)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:26:52 +00:00
Tomas Cohen Arazi 94764f4d70 Bug 37672: Add tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 765c724f98)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:25:15 +00:00
Tomas Cohen Arazi 37c5a96f56 Bug 37672: Make V1/RecordSources.pm use more helpers
This patch adapts the controller class to match the current guidelines
by makiing use of the provided helpers.

The tests are adapted.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e6ef792e10)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:25:15 +00:00
Matt Blenkinsop 613e8137e6 Bug 37687: Restore -not_in operator
Test plan:
1) Compare the API documentation on query parameters and note that'-not_in' is listed as a valid operator.
2) Look at the patch diff - you will see that previously '-not_in' was not included in the list and now is

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7c3c36f2bb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:23:21 +00:00
Jonathan Druart 242b345311 Bug 38071: Ensure search.dt is triggered
I don't really understand why the previous code is not working, but
the search.dt event handler is not correctly set when initComplete is
passed to the constructor (for instance from the patrons search)

Signed-off-by: Pedro Amorim <pedro.amorim@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 503f310a14)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:17:06 +00:00
Emmi Takkinen 42e42bced4 Bug 37987: Speed up downloading reports in .tab format
Downloading SQL report in .tab format was significantly
slower after changes made in bug 37382. Apparently using
HTML::Scrubber to redeclare content variable after
mapping it is slow. Instead sending whole map function
as parameter to module speeds up downloading to couple
of seconds as it was before.

To test:
1. Find or create report that returns several thousand rows
(e.g. SELECT * FROM items LIMIT 4000).
2. Run report and attempt to download it as .tab file.
=> Notice that this takes a lot of time (around 20 seconds).
3. Apply this patch.
4. Download report again.
=> Dowloading should now take couple second.
=> Confirm that the content of .tab file still contains table
data.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5002a0dac9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:15:33 +00:00
Lucas Gass b82e05de36 Bug 36822: DBRev 24.05.05.001
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:30 +00:00
Martin Renvoize 3b20194428 Bug 36822: (follow-up) Catch MySQL 8 failure in update
We add a CAST to the fetch of 0000-00-00 dates in the database. This
prevents an error in MySQL 8.0 throws htat aborts the update.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 36a387db22)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:30 +00:00
Pedro Amorim 5ea41dd507 Bug 36822: (QA follow-up): Fix now time in tests
This is to prevent the scenario of tests failing if they take long to run, e.g.:

    #   Failed test 'updated_on correctly saved on newly created user'
    #   at t/db_dependent/Auth_with_shibboleth.t line 317.
    #     Structures begin differing at:
    #          ->[0] = '2024-11-04 11:20:13'
    #     ->[0] = '2024-11-04 11:20:14

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f945b29ca1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:30 +00:00
Pedro Amorim 4c15fb996d Bug 36822: atomicupdate
Fix any existing updated_on issues

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 473f918ba8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:30 +00:00
Pedro Amorim bc5556acd3 Bug 36822: LDAP - Add discard_changes
Test plan:
1) Apply only LDAP rearrangement patch
2) Run that test file (to prove the rearrangement does not break tests):
$ prove t/db_dependent/Auth_with_ldap.t
3) Verify tests pass
4) Apply LDAP test patch on top
5) Run the test file. Notice it fails.
6) Apply this patch. Run LDAP tests again. Verify tests pass.

Co-authored-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4c1e6b5e71)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:30 +00:00
Pedro Amorim dc8219cfb3 Bug 36822: LDAP - Add test
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e567f78e27)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:30 +00:00
Pedro Amorim 8d9d78493d Bug 36822: LDAP - Rearrange Auth_with_ldap.pm so it picks up on mock config from test file
Without this rearrangement, C4::Context->config('useldapserver') is always 0.
It seems that because its inside a BEGIN block, the mock coming from .t file does not get picked up

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e3d071ac54)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:29 +00:00
Pedro Amorim a9b9f587ce Bug 36822: Shibboleth - Add discard_changes
Test plan:
1) Apply only Shibboleth tests patch
2) Run that test file:
$ prove t/db_dependent/Auth_with_shibboleth.t
3) Verify tests fail with the updated_on error message.
4) Apply this patch. Repeat 2) Verify tests now pass.

Co-authored-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ce9c97cda3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:29 +00:00
Pedro Amorim 701aca8307 Bug 36822: Shibboleth - Add tests
prove t/db_dependent/Auth_with_shibboleth.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 01d149b48a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:29 +00:00
Wainui Witika-Park 4bb4a27fcb Bug 31143: (follow-up) Add description to fix_invalid_dates.pl
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 769b394292)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:01:44 +00:00
Nick Clemens c90b470c3e Bug 31143: (QA follow-up) Tidy
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a900e9307b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:00:29 +00:00
Nick Clemens 698056d183 Bug 31143: (QA follow-up) move script to maintenance
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b598154fbf)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:00:29 +00:00
wainuiwitikapark 0abf2ede21 Bug 31143: Fix/identify all cases where '0000-00-00' may still remain in the database
This patch identifies date fields in the database (timestamp, datetime, date) that are 0000-00-00 and sets them to NULL

Test plan -

Examples of setting up some 0000-00-00 date fields:

e.g. Borrowers table
update borrowers set dateexpiry="0000-00-00" where borrowernumber=49;

e.g. Items table
update items set datelastseen="0000-00-00" where itemnumber=12;

To identify the cases:
1) Set up some 0000-00-00 date fields
2) Run the misc/maintenance/search_for_data_inconsistencies.pl script
3) Run fix_invalid_dates.pl -v

To fix the cases:
1) Run fix_invalid_dates.pl -c -v
2) Notice the value has changed from 0000-00-00 to NULL

e.g. Borrowers table
select dateexpiry from borrowers where borrowernumber=49;

e.g. Items table
select datelastseen from items where itemnumber=12;

Signed-off-by: Shi Yao Wang <shi-yao.wang@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d4bfae0977)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:00:29 +00:00
Pedro Amorim 36d2eb2fa7 Bug 31143: Work around subtracting datetime if date_of_birth undef
To test:
1) Run the following SQL:
update borrowers set dateofbirth = '0000-00-00' where borrowernumber = 45;
2) Access the borrower edit page through staff UI:
http://localhost:8081/cgi-bin/koha/members/memberentry.pl?op=edit_form&destination=circ&borrowernumber=45
3) Notice you get an error
4) Run the script:
perl misc/maintenance/search_for_data_inconsistencies.pl
5) Notice you get an error
6) Apply patch restart plack and repeat -> no errors

This is not perfect but its all I have time for, for now. Follow-ups are welcomed as always.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Shi Yao Wang <shi-yao.wang@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e048144d80)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:00:29 +00:00
Marcel de Rooy 5e07ef7ae7 Bug 37892: (QA follow-up) Fix condition in memberentry
Patron may be undefined. So the test may crash.
Also there is an issue with operator precedence.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit cfc953a411)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-14 14:51:03 +00:00
Marcel de Rooy 74e4173dd8 Bug 37892: (QA follow-up) Add tests for ->is_guarantor/ee
Test plan:
Run t/db_dependent/Koha/Patron.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: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit bc68a17c54)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-14 14:51:03 +00:00
Nick Clemens 812ebf0e1d Bug 37892: Fix guarantor restriction, add tests
[SQUASHED IN QA]

These patches will alter the checks for a patron that prevent a category with
'can_be_guarantee' from being a guarantor.  Two patrons in the same category should be
allowed to have a guarantee/guarantor relationship

The tests below assume you are using the KTD sample data. Update borrowernumbers if not.

To test:
 0 - Apply tests patch
 1 - Set the 'Patron' category as 'Can be a guarantee'
 2 - Add a relationship between two patrons of the same category
     This is restricted from the staff interface
     perl -e 'use Koha::Patrons; my $p = Koha::Patrons->find(5)->add_guarantor({ guarantor_id => 23, relationship => 'father'});'
 3 - Note there is no warning or exception. This should be allowed.
 4 - Checkout an item to Edna (borrowernumber 5)
 5 - Set 'TrackLastPatronActivityTriggers' to 'Checking in an item'
 6 - Try to check the item in, KABOOM
 7 - Set 'TrackLastPatronActivityTriggers' to 'Checking out an item'
 8 - Try to issue an item to Enda, KABOOM
 9 - prove -v t/db_dependent/Koha/Patron.t, fail
10 - Apply second patch
11 - prove -v t/db_dependent/Koha/Patron.t, one more test passes, but then fail
12 - Apply third patch
13 - prove -v t/db_dependent/Koha/Patron.t, pass!
14 - restart_all
15 - Checkout to Enda, OK!
16 - Checkin from Edna, OK!
17 - Find two more patrons in the category and attempt to link them
18 - 'Guarantor cannot be a guarantee'
19 - Apply fourth patch
20 - You can add a guarantor from the same category in interface
21 - Try to add a guarantor to the guarantor assigned in 20
22 - Confirm you cannot add a guarantor - "Guarantor cannot be a guarantee"

Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>

Bug 37892: Fix patron updates

Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>

Bug 37892: Fix patron creation

Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>

Bug 37892: Fix memberentry.pl

Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>

Bug 37892: (follow-up) Fix patron creation

This patch fixes the 22. of the test plan (22 - Confirm you cannot add a guarantor - "Guarantor cannot be a guarantee"
        )

Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Bug 37892: (follow-up) Fix patron creation

TEST PLAN:
1 - Do the 22 parts of the test plan
2 - Add a guarantor to one patron not selected before (let's say A is
  the guarantee, B the guarantor)
3 - Try and add a guarantor to B -> you will success
4 - Remove B's guarantor
5 - Apply this patch
6 - Repeat 3 -> you will not be able to

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Bug 37892: (follow-up) Tidyness

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT]
Renamed a subtest to patron creation tests in Patron.t.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 391e150e07)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-14 14:51:03 +00:00
Lucas Gass 2896429708 Generate release notes for 24.05.05 release
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-07 23:15:54 +00:00
Lucas Gass 65b5fb5bd4 Revert "Bug 32530: When duplicating child card, guarantor is not saved"
This reverts commit 602938a82b.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-07 23:02:54 +00:00
Lucas Gass 251f5b34e6 Increment version for 24.05.05 release
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-07 23:02:54 +00:00
Phil Ringnalda 06acaf74f6 Bug 37786: members/cancel-charge.pl needs CSRF protection
members/cancel-charge.pl will take either a POST or a GET, and as long as the
accountline_id it is passed can be cancelled, will cancel it. That means any
link you click anywhere while logged in to Koha might cancel a charge. It also
takes a borrowernumber which isn't used for the cancelling, only to determine
what account to show after a charge is cancelled, letting a malicious link
show an account other than the one whose charge was just cancelled.

Test plan:
 1. Without the patch, Circulation - Checkout - search for the 'koha' patron
    you log in as
 2. Accounting - Create manual invoice - Make it a Manual fee of 100.00 and
    Save
 3. Pretending it's a well-disguised link in a spear-phishing email, load
    http://localhost:8081/cgi-bin/koha/members/cancel-charge.pl?borrowernumber=5&accountlines_id=1
 4. You are now looking at charges for the patron Acosta, Edna rather than for
    the patron koha, but if you look at the patron koha, its 100.00 charge
    has been cancelled.
 5. Apply patch and reset_all (or if you don't, you'll have to manually adjust
    the link to reflect the charge being accountlines_id 3 rather than 1)
 6. Circulation - Checkout - search for the 'koha' patron you log in as
 7. Accounting - Create manual invoice - Make it a Manual fee of 100.00 and
    Save
 8. Click the link http://localhost:8081/cgi-bin/koha/members/cancel-charge.pl?borrowernumber=5&accountlines_id=1
 9. You got a 403 because you didn't pass the op cud-cancel, but if you did
    pass that op, you would also get a 403 for having a cud- op in a GET (and
    if you POST, you won't have a csrf_token)
10. Checkout - search for koha - Accounting - Cancel charge
11. Having done it the right way, you're now on koha's list of transactions,
    where you can see you just cancelled it

Sponsored-by: Chetco Community Public Library

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-07 23:02:54 +00:00
Magnus Enger e2a31a2e18 Bug 33339: (Follow up) Fix more cases of formula=empty
This patch adds formula=empty to:
- Koha::ERM::EUsage::SushiCounter::_build_COUNTER_report_file()

Updated 2024-09-26: Earlier version also removed unnecessary
use of formula=empty from two places.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-07 23:02:54 +00:00
Kyle M Hall 3d03eff4a4 Bug 33339: Prevent Formula Injection (CSV Injection) in CSV files
The system is vulnerable to Formula Injection attacks as the data
stored within the database and exported as CSV/Excel is not being
sanitized or validated against implanted formula payloads

This patch modifies all uses of Text::CSV and derived classes to pass
the "formula" parameter with value of "empty" which replaces formulas
by empty string.

Test Plan:
1) Apply this patch
2) For guided_reports.pl, attempt to export CSV where you've set a column to a formula somehow
   ( such as "=1+3" )
3) Export that CSV file
4) Note the formula has not been exported
5) Repeat this plan for the remaining scripts that export CSV files
   where users can define the outputted data

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Fixed two conflicts. I have tested that this works as advertised on:
- Reports (Download > Comma separated text (.csv)) [Text::CSV::Encoded]
- Circulation > Overdues > Download file of all overdues [Text::CSV_XS]
- misc/export_borrowers.pl [Text::CSV]
This covers all modules used, and both GUI and command line.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Change none to empty in the commit message ! None is the default,
doing nothing. Empty clears the formulas.
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-07 23:02:54 +00:00
David Cook dbaee28bbe Bug 37724: Remove Koha version number from OPAC
This change removes the Koha version number from the OPAC generator
metadata.

Test plan:
0. Apply patch
1. Enable syspref SelfCheckInModule
2. Visit /cgi-bin/koha/opac-main.pl and confirm meta tag doesn't
include version number
3. Visit /cgi-bin/koha/sci/sci-main.pl and confirm meta tag doesn't
include version number
4. Visit /cgi-bin/koha/sco/sco-main.pl) and confirm meta tag doesn't
include version number
5. Click "Help" and confirm meta tag doesn't include version number

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-07 23:02:54 +00:00
Artur 027758d4c0 Bug 37861: Fix XSS vulnerability in barcode append function
When user inputs were appended directly to the barcode table, the values were not properly escaped, allowing potential XSS attacks. This patch ensures that user inputs are sanitized and safely added to the DOM using .text() and .attr() methods to prevent script injection.

To test:
Enable the "SelfCheckInModule".
Open the barcode input form.
Enter a barcode with HTML or script tags.
Without the patch, observe that the script is executed.
Apply the patch.
Repeat step 2.
Verify that the input is escaped and no script execution occurs.
Check that the barcode is properly appended to the table.

Documentation:
No updates required.

Sponsored-by: KillerRabbitAos

Signed-off-by: Bo Gustavsson <bosse@gustavsson.one>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
2024-11-07 23:02:34 +00:00
Jonathan Druart 7482d093a7 Bug 37953: (bug 35138 follow-up) Fix DisplayLibraryFacets - facet order
Before bug 35138:
DisplayLibraryFacets had priority over the settings in the mappings page.
If you had DisplayLibraryFacets set to "holding library" (only) then only the holding library facet was displayed.

On 231200036 we were not adjusting the facet order/appearance, but the
label, which was wrong. The label must be adjusted for both facets and
the order depending on DisplayLibraryFacets.
Note that bug 37446 is adding a new db rev to adjust the label for
installations that have been updated already.

Test plan:
0. checkout c120975b78 (the commit right before 35138 has been pushed)
1. reset_all
2. holding library is set in DisplayLibraryFacets by default
3. checkout main (so without this patch)
4. updatedatabase
=> ES search result display both facets

5. Repeat 0,1,2 and checkout main + this patch, updatedatabase
=> ES search result display only the holding library facet

Feel free to try with another value in DisplayLibraryFacets

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 80d4d3a586)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 21:38:54 +00:00
Nick Clemens c61e3e9d11 Bug 35125: Respect LinkerConsiderThesaurus in update_cache
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.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 8b691a2b9c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 21:35:48 +00:00
Nick Clemens 88d9ea0ea8 Bug 35125: Respect LinkerConsiderThesaurus in get_link
This patch adds a new key 'notconsidered' to the authority cache when
linking to avoid doubling when creating new authorities and wishing
to ignore thesaurus

To test:
0 - Set LinkerConsiderThesaurus to "don't"
1 - Set AutCreateAuthorities to generate
2 - Set AutLinkBiblios to Do
3 - Set CataloguingModuleRelink to Do
4 - Save a new record in Koha with the same randomized heading repeated
    but from 3 different authority sources
    ensure source is defined by indicators only and by field $2 once
    ensure the heading is random so that no matches will be found
5 - Confirm each authority is linked to a new unique authority
6 - Apply patch, restart all
7 - Repeat 4 with a new subject heading
8 - Confirm all headings are linked to the same authority

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.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 1894fc5101)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 21:35:48 +00:00
Pedro Amorim f66e0c6a82 Bug 37891: (QA follow-up): Fix tt_valid QA test
1) Apply both patches
2) $ qa -c 2 -v 2

Amended-by: Jonathan Druart
Add the different attribute at the end of the node so that we can easily
see what's different between the two lines

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 21:32:30 +00:00
Pedro Amorim 3c46c20dc1 Bug 37891: Submit SMS related data even if SMSSendDriver is empty.
The bug is caused by the SMS data not being submitted as its fieldset is disabled if SMSSendDriver is empty.
This causes the SMS instance of the notice to not be updated when the edit happens, becoming out of sync.
Once it becomes out of sync with the other notices of same code but different transport_type, the 'GROUP BY branchcode,module,code,name,branchname' in letter.pl will fail, as the name no longer matches, listing the same notice twice on the notices table.

This patch updates the logic on the template to have the SMS input elements be disabled/readonly instead of having disabled='disabled' on the SMS fieldset.
This keeps the same functionality i.e. staff member is unable to edit SMS notice if SMSSendDriver is disabled, but ensures that SMS related data is submitted to the controller when the notice edit save happens.

Test plan:
1) Visit notices and slips:
  <staff_url>/cgi-bin/koha/tools/letter.pl
2) Search for a notice code e.g. 'ILL_REQUEST_UPDATE'.
3) Notice only one result is returned. Click 'Edit'.
4) Edit the 'Name'. Click 'Save'.
5) Repeat 2. Notice two results are now returned.
6) Apply patch. Repeat test plan. Notice only one result is returned at the end.

Signed-off-by: Jason Robb <jrobb@sekls.org>

Amended-by: Jonathan Druart
Align

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 21:32:30 +00:00
Nick Clemens 86e453d05d Bug 38126: Skip allocated holds when filling from transport cost matrix
This patch simply weeds out allocated holds before filling from the matrix

To test:
 1 - Enable RealTimeHoldsQueue
 2 - Enable UseTransportCostMatrix
 3 - Enable LocalHoldsPriority Give/Home/Home
 4 - Administration - Transport cost matrix - enable transfers to/from Centreville and other libraries, add a cost, and save
 5 - Find a bib with a Centerville item
 6 - Place a hold for a centerville patron
 7 - Circulation - Holds queue - All libraries
 8 - Note hold is entered twice
 9 - On command line:
    perl misc/cronjobs/holds/build_holds_queue.pl --force
10 - Run holds queue again, still there twice
11 - Apply patch
12 - On command line:
    perl misc/cronjobs/holds/build_holds_queue.pl --force
    Confirm allocated only once
13 - Delete hold, place again from bib record (to test real time allocation)
14 - Confirm allocated only once

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
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 4ed5e6c248)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 21:27:10 +00:00
Lucas Gass 1c2e7237e3 Bug 38183: Get the active tab number from data-attribute
To test:

1. Have more than 1 staff member who can manage suggestions
2. Create some suggestions
3. Move some suggestions to different statuses (Pending/Accepted/Rejected) so you have multiple tabs on the "Suggestions management" page.
4. Go to the first tab, check some suggestions, and click "Select manager" under "Update manager".
5. Pick a new manager, notice nothing changes on that tab.
6. Now look at the last tab in your list of tabs, see the suggestion manager has been set incorrectly to the last tab.
7. APPLY PATCH
8. Try 4-5 again. The manager should be selected correctly.
9. Try setting the manaager from every tab, making sure it works right.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.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 2d28aa403a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 21:22:22 +00:00
Phil Ringnalda be233aadae Bug 37801: Search results with limits create URLs that cause XML errors in RSS and Atom output
The template for RSS and Atom feeds of search results (curiously named
opac-opensearch.tt) is careful to escape ampersands in the query_cgi param
while adding it to URLs, but doesn't escape the limit_cgi param at all. It
should.

Two drive-by fixes for Atom: because the <title> when your search has a limit
includes &nbsp;, which isn't an XML character entity, you couldn't get as far
as the error from the <link> URL, and as long as I was going to have blame for
the line, I couldn't bear to leave the stray undefined SEARCH_RESULT. in the
(hard-coded and bogus) <link rel="last">.

Test plan:
1. In the OPAC, Advanced search - check the boxes to limit by item type Books
   and Mixed Materials and search for the keyword Perl
2. At the top of the search results, click the orange RSS icon
3. That gives you an ugly "not well-formed" error, so in the URL for the page
   change the final "format=rss" to "format=atom"
4. That gives you an ugly "undefined entity" error, so apply the patch
5. Reload the page with the Atom feed, it should change from an error page
   to a garbled display of the feed. Click Back to go back to the RSS feed
   and reload it if it's still cached on the error page. That should give
   a pretty-printed display of the RSS feed without parsing errors

Sponsored-by: Chetco Community Public Library
Signed-off-by: Sukhmandeep Benipal <sukhmandeep.benipal@inLibro.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 8298e708b9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 21:01:38 +00:00
Emmi Takkinen 86fc6301a7 Bug 34585: Add data-code attribute to chargeperiod_charge_at selector
When one tries to edit circulation rule "When to charge"
columns value is always set as "End of interval". This patch adds
data-code attribute to chargeperiod_charge_at selector
to define existing rules value.

To reproduce:
1. Navigate to Circulation and fine rules page.
2. Find or create a rule with a "When to charge" value set as
"Start of interval".
3. Edit rule.
=> Note that "When to charge" value is now "End of interval",
while as the other values should be copied as they were.
4. Apply this patch.
5. Edit rule again.
=> "When to charge" should now be copied correctly.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2ca65e0a06)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 16:43:19 +00:00
Owen Leonard de5cf911bb Bug 37270: (follow-up) Fix mixed quotes in preview modal JS
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 1d6f3c4cbe)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 16:36:41 +00:00
Owen Leonard e68c56745a Bug 37270: Fix deletion of saved reports
This patch fixes deletion of saved reports in two instances which
were broken by the CSRF changes: From the dropdown menu in the table of
saved reports, and in the modal window which appears if you click the
"Preview" dropdown menu in the table of saved reports.

The patch also makes a minor change to form-submit.js so that the event
handler will attach to dynamically-generated elements (as is the case
with the preview modal).

To test, apply the patch and go to Reports -> Use saved.

- Add one or more reports if necessary.
- In the table of reports, click the secondary dropdown link in the
  "Run" button.
- Click "Delete." You should be asked to confirm, and confirming should
  correctly delete the report.
- Now test the "Preview SQL" link in the menu.
- A modal window should appear showing you the SQL of the report.
- In the footer of the modal, test the "Delete" button.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 44d0703b4a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 16:36:41 +00:00
Phil Ringnalda 33fb560cf1 Bug 38056: Search term after deleting an authority shouldn't be URI encoded
Now that deleting an authority record uses a form, rather than building up a
URL in JavaScript, using the filter | uri on the value (confusingly named
value) which passes along the search terms to reload after deleting results
in a bad search. It should instead use the filter | html.

Test plan:
 1. Without the patch, top menu - Authorities
 2. The default search, Main heading ($a only), Authority type Default,
    Operator contains, Order by Heading A-Z will work fine. You need to a
    search which will return more than one of the same thing (not hard in
    ktd) - for MARC21 search for a professional
 3. You should get five results. For one of them, Actions - Delete - Confirm
    that you meant to click it
 4. You now have a%20professional in the search box, and search results for
    whatever ElasticSearch thinks a% means. It's certainly not professional -
    you can change that term to any random string and get the same results
 5. Apply patch, top menu - Authorities
 6. Repeat steps 2 and 3, but this time after deleting another result,
    you will get a professional without the %20 in the search box, and
    your results will be the remaining Addison-Wesley professional computing
    series authorities

Sponsored-by: Chetco Community Public Library
Signed-off-by: David Nind <david@davidnind.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 6eb4d5804b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 15:23:24 +00:00
Lucas Gass 695c411f65 Bug 38199: [24.05.x] Add back missing print class
To test:
1. Find an item to checkout that doesn't belong to the branch you are logged in at.
2. Check the item out.
3. Go to Circulation > Check in
4. Using the check in input in the main area ("Check in"), check the item in
5. A modal should appear, "Please return this item to {branch}"
6. Click "Print slip"
7. Deal with the browsers print dialouge. ( print, cancel, or save should work for testing)
8. After the modal closes focus is not brought back to the barcode field.
9. Check the item in again, this should trigger the "Wrong transfer detected, please return item to: {branch}" modal.
10. Click "Print transfer slip", here the modal closes and properly gives focus to the #barcode input.
11. APPLY PATCH, clear browser cache.
12. Try all the steps again, each time focus should be restored to the #barcode input

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:53:40 +00:00
Tomas Cohen Arazi 3c84a93e36 Bug 38164: Skip fuzzy translations
This patch was envisioned by Julian Maurice.

Test plan:
0. Apply the 1st patch (the revert)
1. Go to `misc/translator/po`
2. es-ES-messages-js.po
3. Mark "Edit" string as fuzzy (around line 48). It should look like:

```
msgid "Edit"
msgstr "Editar"
```

4. Edit ./intranet-main.tt and add the following lines at the bottom,
   inside the `$(document).ready` block:

```javascript
  console.log(_("Edit"));
  console.log(__("Edit"));
```

5. Install the templates
  k$ koha-translate --install es-ES --dev kohadev && restart_all
6. Enable *es-ES* by searching for `language` in the sysprefs and switch
   to it for the staff interface.
7. Go to the Koha home page, open the browser console
=> FAIL: Notice that the second log in the console is displaying the
fuzzy string (i.e. is being translated when it shouldn't)
8. Apply this patch
9. Re-install the translated templates:
  k$ koha-translate --update es-ES --dev kohadev && restart_all
10. Repeat 7
=> SUCCESS: With this patch applied both logs show the English version of the
string.
11. Remove the fuzzy flag on `es-ES-messages-js.po`
12. Repeat 9 and 10
=> SUCCESS: The results are similar to step 7, but in this case they are
expected as the string is not marked fuzzy.
13. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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 5102f708a5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:51:09 +00:00
Tomas Cohen Arazi cfafd7bc2a Bug 38164: Revert "Bug 37303: Replace po2json with a JS version"
This reverts commit 4eb9816354.

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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 b285fd57c8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:51:09 +00:00
Jonathan Druart 9cee6d70f1 Bug 38211: frameworkcode must be set before read
It's a stupid global variable, we MUST have this init line BEFORE we
read it!

Test plan:
See the other bugs linked with this one, confirm the test plan for all
of them still pass.

Test plan for this specific bug report:
1. Cataloging - New record -> Audio Cassettes, CDs
2. Fill in the required fields and save
3. Switch to 'Normal', Edit - Edit record
4. Note that 001 and 003 are not visible, and the Settings menu has a checkmark by Audio Cassettes, CDs
5. Click the browser Back button, then Edit - Edit record
6. Note that 001 and 003 are not visible, and the Settings menu has a checkmark by Audio Cassettes, CDs

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e44927842b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:49:20 +00:00
Tomas Cohen Arazi 3ffb91aa07 Bug 38094: (follow-up) edit_catalogue implies fast_cataloguing
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 51055d892b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:46:35 +00:00
Kyle M Hall 0273b348f9 Bug 38094: Allow librarians with fast add permissions to edit existing fast add records
The ability to create fast add records was fixed on bug 38076, but they still cannot be edited after they are saved.

Test Plan:
1) Create a librarian with only fast add cataloging permissions
2) Create a fast add record, save it
3) Attempt to edit that record, you cannot!
4) Apply this patch
5) Restart all the things!
6) Attempt to edit that record, you can!
7) Attempt to edit a non-FA record, you cannot!

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 664cbb5bc5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:46:35 +00:00
Tomas Cohen Arazi 1f34eff2e6 Bug 38094: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4623dce6f7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:46:35 +00:00
Kyle M Hall d18ab951a9 Bug 38076: (QA follow-up): Make permission edit_catalogue imply fast_cataloging
Any librarian with the edit_catalogue sub-permission should also be able
to edit fast catalog records. If that was not true, a cataloger could
not convert fast adds into full records.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 20c38762b8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:44:52 +00:00
Kyle M Hall aa44165239 Bug 38076: Fix inability of fast catalogers to add/edit FA framework records
If a librarian does not have the editcatalogue permission, but does have the fast_cataloging permission, they should be able to add and edit fast cataloging records. Instead they are presented with a login screen and the message that they do not have sufficient permissions.

Test Plan:
1) Create a librarian with only fast add cataloging permissions
2) Attempt to create a fast cat item from the circ menu
3) Note the login screen and error
4) Apply this patch
5) Restart all the things!
6) Try again, you can now create FA records!

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5b124f7a1e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:44:52 +00:00
Nick Clemens 1a71b12702 Bug 38148: (QA follow-up) Code comments
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 38e33074b6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:31:24 +00:00
Pedro Amorim 36cace8f70 Bug 38148: Revert back to get_effective_rule
And update the first conditional logic.
This patch aims to maintain the logic behind the first patch, but restore get_effective_rule.
get_effective_rule_value is using cache and I believe that is the reason why Items.t fail when using that.

Test plan:
1) Search for 'music' on OPAC
2) Notice records have the 'place hold' link
3) Visit circulation rules on Staff:
<staff_url>/cgi-bin/koha/admin/smart-rules.pl
4) On 'Default checkout, hold and return policy' , under 'Hold policy' pick 'From any library'. Hit 'Save'.
5) Repeat 1). Notice the 'place hold' link is gone.
6) Apply patch. restart plack. Repeat 1). Notice the 'place hold' is shown again

Run:
$ prove t/db_dependent/Koha/Items.t

Signed-off-by: andrewa <andrew.auld@ptfs-europe.com>
Signed-off-by: Ray Delahunty <r.delahunty@arts.ac.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c7c24aa8d3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:31:23 +00:00
Aleisha Amohia 3748fe30df Bug 38148: Check value of holdallowed circ rule properly
It was noted on Bug 29087 that the value of circulation rules needs to be checked differently, so this follow-up addresses that.

To test:

1. Apply patch and restart services
2. Search for a record on the OPAC. Confirm you can see a link to place a hold.
3. Search for this record on the staff interface and place a hold. Go to Circulation -> Holds to pull and confirm your hold shows in the list.
4. Confirm tests still pass t/db_dependent/Koha/Holds.t

Sponsored-by: Whanganui District Council
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: andrewa <andrew.auld@ptfs-europe.com>
Signed-off-by: Ray Delahunty <r.delahunty@arts.ac.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e2be4e00a5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:31:23 +00:00
Nick Clemens f8b6777e50 Bug 38148: Unit tests
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 76352200ca)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:31:23 +00:00
Owen Leonard b5daaf54fe Bug 37150: Can't delete single title from a list using the "Remove from list" link
In the OPAC display of titles on a list, the "Remove from list" control
needs to trigger a POST operation instead of GET. This patch
appends a form for handling single entry deletions, populating
the hidden input upon confirmation.

To test, apply the patch and create a list if necessary, adding multiple
titles to it.

- View the contents of your list.
- Each title on your list should have a "Remove from this list" link.
  - Click one of these. You should see a modal confirmation, "Are you
    sure you want to remove this item from the list?"
    - Confirming should delete the title form the list.
  - Check multiple checkboxes in the list of titles and click "Remove
    from list" at the top of the list.
    - You should see a modal confirmation, "Are you sure you want to
      remove these items from the list?"
      - Confirming should result in all checked titles being removed
        from the list.
  - Check one or more checkboxes and then click a single "Remove from
    list" link. After confirming, you should find that only the one
    title was removed from the list.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Eric Garcia <cubingguy714@gmail.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 ace488e50f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-09 22:07:40 +00:00
Phil Ringnalda 2d038cfda5 Bug 37197: Reports option to send to batch patron modification needs to use POST
When you have an SQL report that selects cardnumber from borrowers, you
get a menuitem to send the results to Batch patron modification. Currently
that fails with a message about no card numbers or borrowernumbers given,
because it tries to do a GET with the op show, when modborrowers.pl is
expecting a POST with the op cud-show.

Test plan:
1. Without the patch, Reports - Create from SQL - name it and paste

select cardnumber from borrowers

   in the SQL textarea and save, then Run report.
2. Above the results is a "Batch operations with 20 visible records" menu,
   choose Batch patron modification
3. Note that instead of modifying the records, you're stuck with a message
   saying "No patron card numbers or borrowernumbers given." even though
   there's a whole string of them in the URL.
4. Apply patch, refresh the page with the results (oddly, no apparent need
   to even restart_all), and choose the menuitem again, but this time with
   a successful result.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit a85086d827)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-09 22:04:22 +00:00
Baptiste Wojtkowski 602938a82b Bug 32530: When duplicating child card, guarantor is not saved
When duplicating a child card with a guarantor, the guarantor information
appears during the card creation process, but disappears as soon as saving
the card. To recreate:

1. Find a card with a guarantor, either patron or non-patron guarantor.
2. Duplicate the card. Note that it appears to be working on the card
   creation screen.
3. Save the patron after completing the form. The guarantor is now gone.

New test plan:
1. Find a card with a guarantor, either patron or non-patron guarantor.
2. Duplicate the card. Note that it appears to be working on the card
   creation screen.
3. Save the patron after completing the form. The guarantor is now gone.
Apply patch and repeat, the guarantor should stay after 3.

Note, I may not have understood the code but it looks like nothing is
searching for the content of the displayed information. Therefore I add
hidden fields that are copies of those provided in guarantor_template
class

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b64a3ce9ba)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-09 22:02:56 +00:00
Nick Clemens 1d72bfe3d2 Bug 37339: Set messaging preferences from default on self registration
The change on bug 30318 prevented setting the default messaging preferences when none were passed.
Self registration relied on this for setting borrower preferences from the defaults.

This patch removes the call to handle_form_action and replaces it with a call to:
SetMessagingPreferencesFromDefault

To test:
 1 - Ensure self registration is enabled
 2 - Set default messaging preferences for the self registration category
 3 - Self register a patron from the OPAC, confirm defaults not set
 4 - Apply patch, restart all
 5 - Self register a patron
 6 - Confirm defaults have been set
 7 - Enable  PatronSelfRegistrationVerifyByEmail
 8 - Self register a patron on OPAC with an email
 9 - Find the email and grab the verification link (unless you have emails enabled)
     SELECT * FROM message_queue;
10 - Visit the link and confirm registration
11 - Confirm messaging defaults are set

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 2accac5fd9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-09 22:00:53 +00:00
Janusz Kaczmarek 576026a27a Bug 37290: Fix data-branch param
1) Add circulation rules for a specific library
2) Attempt to remove one of those library specific rules -> get redirected to 'All'
3) Notice the rule for that specific branch is still there

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 72fd2c580d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-09 21:55:52 +00:00
Phil Ringnalda 607e1ca175 Bug 37961: Inventory problem resolution fails by POSTing without an op or csrf_token
After you upload a file or textarea of barcodes to inventory, the next step is
a list of the things that were missing, with checkboxes to check when you find
them, and buttons to Mark seen, which send a POST to
/cgi-bin/koha/tools/ajax-inventory.pl without an op param (since it doesn't
have an $op) and without a csrf_token, so the POST fails with a 403.

Test plan:
 1. Without the patch, Cataloging - Inventory - in Item location filters
    set Library to Centerville, Shelving location to Audio visual, Collection
    code to Reference, and in Optional filters for inventory list or comparing
    barcodes set Last inventory date to today.
 2. Click Submit, and you'll have a table of 23 items. Check the checkbox for
    the first item, click Mark seen and continue
 3. What was supposed to happen was that you would be taken to the next
    page, but instead you are still in the same page, and if you had the
    browser console open, you would have seen that you sent a POST to
    ajax-inventory.pl, and got a 403 error in response
 4. Apply patch, restart_all
 5. Repeat step 1 and 2, this time getting to the second page. Check the
    checkboxes for the last two items, and click Mark seen and quit
 6. Repeat step 1 and click Submit. You should now have only 20 items, since
    the three you checked now have a Last inventory date of today.

Yeah, when you did Mark seen and continue they ought to have been removed from
the list, I agree. I had to go back to 23.11.x and make sure that was really
how it was supposed to function, but that is the existing behavior. Even
though they get marked as seen, nothing changes about your list until you quit
and go back to it. Maybe because then something that wasn't on the current
page would have moved there. Another bug.

Sponsored-by: Chetco Community Public Library
Signed-off-by: Sonia Bouis <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 801fa43c7c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-09 21:54:02 +00:00
Brendan Lawlor f08d422225 Bug 37536: Update conditional to check for 'cud-saveitem'
In additem.pl and additem.tt all instances of 'saveitem' have been updated to 'cud-saveitem'
The javascript needs to be updated in the same way.

Test plan:
- Make sure acqcreateitem is set to "when placing an order"
- Create a basket with some orders
- Close the basket
- Go to your vendor and receive an order
- On the receive page, try to edit your item
=> Without the patch, the pop up page will open and then close, not allowing the item to be edited.
=> With this patch applied you will see the item edit form. Save and
confirm that the parent window is updated with the new value (actually
it's refreshed)

QA notes:
1. git grep 'saveitem'
2. Notice all instances in additem.pl and additem.tt have been updated to 'cud-saveitem'
3. Notice cataloging_additem.js checks if op != 'saveitem'
4. Check the files and verify the change makes sense

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e6b2b342d2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-09 21:52:14 +00:00
Phil Ringnalda efd54c2bd6 Bug 37979: Toggling Item circulation alerts table cells needs to send csrf_token
When you click on a cell in the Item circulation alerts table, the page sends
a POST to /cgi-bin/koha/admin/item_circulation_alerts.pl without including a
csrf_token, which gets back a 403 error because that's sketchy behavior. It
needs to include the token.

Test plan:
1. Administration - Item circulation alerts
2. Open the browser devtools to the console
3. Click on any green table cell
4. It should have turned red, but instead your console turned red with a 403
5. Apply patch, reload
6. Click on any green table cell, it will turn red

Sponsored-by: Chetco Community Public Library

https://bugs.koha-community.org/show_bug.cgi?id=37959
Signed-off-by: Jan Kissig <jkissig@th-wildau.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-09 20:00:06 +00:00
Jonathan Druart 60003f014e Bug 37947: (bug 37429 follow-up) Fix addbiblio and frameworkcode="Default"
On bug 37429 we reordered the global var to assign them before anything
else. The logic is correct except for $frameworkcode, we want to do some
processings (like defaulting to "" if eq "Default") BEFORE we retrieve
the MARC structure ($tagslib, $usedTagsLib).

This patch also moved this code after get_template_and_user (and so
authentication), like it should be everywhere.

Test plan:
1. Go to Cataloging
2. Click on New from Z39.50/SRU
3. Make a search in the library of congress server for anything (Caroline searched for author: shakespeare)
4. Click on one of the results and choose Import
Without this patch the basic editor appears, but not the record
With this patch applied the bug is fixed and you can edit the record

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 dffc8cdd2c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-09 19:53:24 +00:00
Jonathan Druart 11d42098ee Bug 35191: Make entries per page configurable for items table on staff detail page
The new API driven items view defaults to 20 per page. This is a bit low, it would be great if it could be configurable to a higher value per the table configuration.

Test plan:
1. Apply this patch
2. restart_all (memcached restart is required)
3. Go to Administration > Table settings
4. Catalogue > holdings_table | otherholdings_table
=> Notice the new "Default display length"
5. Select something else than 20
6. Go to the detail page of a record with lot of records
=> Notice that the default value defined in the settings is used.

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8e211a1fef)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-09 19:51:44 +00:00
Nick Clemens 54d20f4446 Bug 37055: Check count of holds, not if defined
To test:
 - enable WaitingNotifyAtCheckout
 - have or create a waiting hold for a patron
 - check out an item to a different patron who does not have a waiting hold
 - Koha says "This patron has waiting holds that are available for checkout"
 - Apply patch
 - Reload patron (click 'Checkout' tab)
 - Check out an item - no warning
 - Find the patron with waiting hold
 - Check out an item - warning
 - Checkout the waiting item - no warning

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b5f122696c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-09 19:49:38 +00:00
Lari Taskula e1778dfef6 Bug 37375: Fix holdings table not loading if MARC framework is missing certain 952 subfields
When you've catalogued a record with MARC framework that is for some reason missing
certain 952 subfields (8, a, b, c, or y), holdings table is no longer loading but
stuck in the "Processing..." loader.

To test, open Koha in two browser tabs:

IN TAB 1 (framework configuration):
1. Create a new MARC framework "TEST", based on the default MARC framework

IN TAB 2 (record view):
2. Create a new record using MARC framework "TEST"
3. Add an item to the newly created record
4. Observe item visible on the record's holdings list

IN TAB 1 (framework configuration):
5. Delete all 952 subfields in framework "TEST" except: 8, a, b, c, y

IN TAB 2 (record view):
6. Refresh page
7. Observe item visible on the record's holdings list
8. Open your browser's console for upcoming error messages

Iterating remaining subfields in following order,
| <FIELD> | <NAME>
------------------------------------------------------
| 952$8   | row._strings.collection_code
| 952$c   | row._strings.location
| 952$a   | row._strings.home_library_id
| 952$b   | row._strings.holding_library_id
| 952$y   | row._strings.item_type_id

IN TAB 1 (framework configuration):
9. Delete subfield <FIELD> in framework "TEST"

IN TAB 2 (record view):
10. Refresh page
11. Observe error "Uncaught TypeError: <NAME> is undefined" (Firefox)
(or Cannot read properties of undefined (reading 'str') (Chromium))

12. Apply patch

IN TAB 2:
13. Refresh page
14. Observe item visible on the record's holdings list

Signed-off-by: David Nind <david@davidnind.com>
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 4c93ed758f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-09 19:37:56 +00:00
Paul Derscheid 8cd346a520 Bug 37587: (QA follow-up) Tidy reserve/placerequest.pl
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6bcc82815d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-09 19:34:22 +00:00
Emily Lamancusa 752118cfd7 Bug 37587: Fix priority of multiple item-level holds
The rank parameter is passed per biblio record, not per item. When
placing multiple item-level holds on one bib record, only $rank[0] is
defined.

To test:
1. System preference and circulation rule setup
    i. Set the system preference DisplayMultiItemHolds to Enable
    ii. Edit the default circulation rule to allow 5 holds per record
2. Find or create a bib with 4 or more items
3. Place several bib-level holds
4. Place 4 or more item-level holds at once on that same record
    i. Search for a patron to place the holds for (not one of the
       patrons you used in step 3)
    ii. Select "Hold a specific item"
    iii. Check the checkboxes for 4 or more items
    iv. Click Place hold
--> Note that one of the new item-level holds is at the end of the list
    as it should be, but the rest are out of order
5. Cancel the item-level holds from step 4
6. Apply patch and restart_all
7. Repeat step 4
--> All the new item-level holds are now at the end of the list

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e1517fc8c8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-09 19:34:22 +00:00
Nick Clemens adb4e1d9d5 Bug 37483: Use cud-list for extend due dates tool
This patch switch the check in the script to 'cud-list' - we use the same form
submission if listing for preview or directly updating dates, so this may or may
not be a cud- action - assuming it is restores script functionality.

See bug 37941 for updating forms to not share actions

To test:
1 - Checkout some items to patrons of at least two libraries
2 - Tools -> Batch extend due dates
3 - Select nothing except 'preview' and submit
4 - Blank screen
5 - Apply patch, repeat
6 - It works!
7 - Filter by library and confirm it still works
8 - Sign off!

Signed-off-by: Janusz Kaczmarek <januszop@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 b2e396f08d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-09 19:30:25 +00:00
Lucas Gass 475cd151c3 Generate release notes for 24.05.04 release
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-02 14:54:10 +00:00
Lucas Gass 052f56ae0b Increment version for 24.05.04 release
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-02 14:03:16 +00:00
Lucas Gass e5c5b1dcb2 Bug 37720: (follow-up) Adjust tests
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-01 13:42:28 +00:00
Jonathan Druart 9480952e2a Bug 37720: Prevent XSS in label creator
Because labels/label-edit-batch.pl fills a DataTable with things that include
a link created by C4/Creators/Lib.pm, it outputs them with the $raw filter,
so HTML in author/title/callnumber is executed in the label batch editor.
While we wait for a fix that moves the link creation into the template and
out of C4, encoding HTML in Lib.pm for the bits going into the link, and
switching from $raw to the html filter for the rest of the things, will at
least get rid of the XSS.

Test plan:
 1. Without this patch, but with the patch from bug 37654 so you don't get
    alert()s in batch import, download attachment 170675 [details]
 2. Cataloging - Stage records for import - browse to the downloaded file -
    Upload file - when the upload finishes Stage for import - when staging
    finishes View batch (get alert()s if you didn't apply bug 37654) - Import
    this batch into the catalog
 3. Once the import finishes, Cataloging - Manage staged records
 4. In the row for your import, in the # Items column, click "(Create label
    batch)"
 5. In the "Label batch #n created" message, click the link to the batch #
 6. Because the batch includes a call number with an open <script>, you'll
    get XSS alert()s and then one about something going wrong while loading
    the table, with only one of the two records showing in the batch editor
 7. Apply patch, restart_all
 8. Cataloging - Label creator - Manage Label batches
 9. In the row for your batch, click Edit
10. You will see both labels, with their attempts at XSS visible as text
    rather than being interpreted as HTML

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-01 13:42:28 +00:00
Lucas Gass 3d8c3cb218 Revert "Bug 37720: Prevent XSS in label creator"
This reverts commit 6b844169fd.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-30 19:05:32 +00:00
Jonathan Druart 6b844169fd Bug 37720: Prevent XSS in label creator
Because labels/label-edit-batch.pl fills a DataTable with things that include
a link created by C4/Creators/Lib.pm, it outputs them with the $raw filter,
so HTML in author/title/callnumber is executed in the label batch editor.
While we wait for a fix that moves the link creation into the template and
out of C4, encoding HTML in Lib.pm for the bits going into the link, and
switching from $raw to the html filter for the rest of the things, will at
least get rid of the XSS.

Test plan:
 1. Without this patch, but with the patch from bug 37654 so you don't get
    alert()s in batch import, download attachment 170675 [details]
 2. Cataloging - Stage records for import - browse to the downloaded file -
    Upload file - when the upload finishes Stage for import - when staging
    finishes View batch (get alert()s if you didn't apply bug 37654) - Import
    this batch into the catalog
 3. Once the import finishes, Cataloging - Manage staged records
 4. In the row for your import, in the # Items column, click "(Create label
    batch)"
 5. In the "Label batch #n created" message, click the link to the batch #
 6. Because the batch includes a call number with an open <script>, you'll
    get XSS alert()s and then one about something going wrong while loading
    the table, with only one of the two records showing in the batch editor
 7. Apply patch, restart_all
 8. Cataloging - Label creator - Manage Label batches
 9. In the row for your batch, click Edit
10. You will see both labels, with their attempts at XSS visible as text
    rather than being interpreted as HTML

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-30 15:34:14 +00:00
Phil Ringnalda 0b1c2ba4b8 Bug 37655: Basic editor needs to HTML-escape the bib record title used as a heading
We stick the title of a bib record you are editing in the basic editor into
an <h1> without escaping any HTML it might contain. We should instead escape
it.

Test plan:

1. Without the patch, search for any record in the catalog and click Edit
   record (if you are in the advanced editor, switch to the basic one)
2. Tab 2, Field 245, Subfield a, paste <script>alert('boo ❤')</script><h2>
   at the end of the subfield
3. Save, then from the record detail page select Edit - Edit record
4. You will have gotten an alert(), and the entire form will be the size
   of an <h2>. That's ugly, so go back to the detail page.
5. Apply patch, restart_all
6. Edit - Edit record
7. Now you should not get an alert, the whole title inluding the <script>
   should display in italics, and the "(Record number nnn)" after it should
   not be italicized.

Signed-off-by: David Cook <dcook@prosentient.com.au>
2024-09-30 15:32:11 +00:00
Phil Ringnalda 1493c9b56e Bug 37656: XSS in Advanced editor from Z39.50 search results
The Advanced editor inserts data from Z39.50 results into the search results
page without escaping HTML. Whether it's German records with "<<A>> Title"
or someone with a compromised catalog or a book with the title "<em> for
emphasis" it shouldn't.

Test plan:
 1. Not a dependency, but you'll avoid getting even more alerts while batch
    importing by starting with the patch from bug 37654
 2. Without this patch applied, download attachment 170421
 3. Administration - set the preference EnableAdvancedCatalogingEditor to
    Enable
 4. Cataloging - Stage records for import - browse to the downloaded file -
    Upload file - Stage for import
 5. Once the background job finishes, View batch (getting alerts if you
    didn't apply the patch from bug 37654) - Import this batch into the
    catalog
 6. When the import finishes, Search the catalog for script, on the imported
    record Edit record (if you wind up in the basic editor, Settings - Switch
    to Advanced editor)
 7. In the left sidebar below the search inputs, click Advanced », check
    the checkbox for Local catalog and uncheck any others, then search for
    the Title script
 8. You'll get five alerts, and the word "edition" displayed in huge text
 9. Close the search popup, apply patch, shift+reload the advanced editor
    page to clear your cache
10. Repeat step 7, but this time you won't get any alerts, and you'll see
    the title and the other <script> inclusions.

Sponsored-by: Chetco Community Public Library
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-30 15:31:31 +00:00
Phil Ringnalda 25672f82f0 Bug 37654: XSS in Batch record import for Citation column
Viewing a staged MARC record batch loads a DataTable from
/tools/batch_records_ajax.pl, and both batch_records_ajax.pl and the
DataTable just trust the author/title/isbn/issn to be free of HTML. They
shouldn't.

Test plan:
1. Without this patch applied, download attachment 170418, then Cataloging
   - Stage records for import - Select the downloaded file - Upload file -
   Stage for import
2. When the background job completes, View batch - you'll get three alert()s
   from the title, author, and ISSN, and the author and ISSN displayed huge
3. Apply patch, restart_all
4. Manage staged records - click HTMLescapingimporttestrecord.mrc - get zero
   alerts and no <h2> display

Sponsored-by: Chetco Community Public Library
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-30 15:30:47 +00:00
David Cook e94a7e34f3 Bug 37681: Fix XSS in staff interface item URLs on detail page
This patch uses Javascript objects and safe sinks to prevent XSS
in the item URLs on the staff interface detail page.

It also makes sure those URLs don't get double-escaped. Yippee!

Test plan:
0. Apply the patch
1. Add/edit an item with the following URL:
http://prosentient.com.au?q=http%3A%2F%2Fprosentient.com.au
2. Add/edit a different item with the following URLs:
http://prosentient.com.au?q=http%3A%2F%2Fprosentient.com.au |
http://prosentient.com.au?q=http%3A%2F%2Fprosentient.com.au
3. Go to the staff interface detail page
4. Notice that the URLs are not double-encoded!
5. Try out a malicious payload (talk to QA/security about this)
6. Confirm that the malicious payload fails to execute the XSS
7. Celebrate!

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>
2024-09-30 15:30:06 +00:00
Hammat Wele 2dc9dcf87a Bug 13342: Not logged user can place a review/comment
We are able to comment a notice even when no user is connected

To test

1. Log in to OPAC.
2. Find a Biblio and open the comments tab.
3. Open another tab/window, and log out from the account.
4. Return to the first tab.
5. Click "Post your comments on this title."
 --> We are able to post a comment
6. Apply the patch
7. Repeat step 1, 2, 3, 4, 5
 --> You should be redirected to the login page.

Signed-off-by: David Cook <dcook@prosentient.com.au>

Bug 13342: Tidy

Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-30 15:29:21 +00:00
Victor Grousset/tuxayo 13b0aa1262 Bug 36598: (QA follow-up): tidy up code
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-30 15:28:48 +00:00
Julian Maurice 460a48cf69 Bug 36598: Add comments asking to keep both CSRF checks in sync
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-30 15:28:48 +00:00
Julian Maurice 0c6ef38fb3 Bug 36598: Prevent use of unsafe HTTP method with non-cud op parameter
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-30 15:28:47 +00:00
Julian Maurice ec02f36f10 Bug 36598: Improve documentation and error message in CSRF plugin
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-30 15:28:47 +00:00
Julian Maurice d4a455425c Bug 36598: Fix CSRF header name (underscore -> hyphen)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-30 15:28:47 +00:00
Julian Maurice ed2873bf45 Bug 36598: Prohibit CUD operations with safe HTTP methods (GET/HEAD/...)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-30 15:28:47 +00:00
Julian Maurice 84054b932c Bug 36598: Enable CSRF protection for Mojolicious apps
Test plan:
1. Run bin/opac daemon -l http://*:3001/
2. Go to http://localhost:3001/cgi-bin/koha/opac-user.pl
3. With browser devtools, locate csrf_token hidden input within the
   login form and remove it or modify it
4. Try to submit the form with correct credentials, it should fail
   ("Wrong CSRF token")
5. Reload the page, try to log in normally without modifying the DOM, it
   should succeed
6. Run bin/intranet daemon -l http://*:3002/
7. Go to http://localhost:3002/cgi-bin/koha/mainpage.pl
8. With browser devtools, locate csrf_token hidden input within the
   login form and remove it or modify it
9. Try to submit the form with correct credentials, it should fail
   ("Wrong CSRF token")
10. Reload the page, try to log in normally without modifying the DOM,
    it should succeed
11. Run prove t/db_dependent/mojo/csrf.t

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-30 15:28:47 +00:00
Nick Clemens ae84680c4d Bug 37775: Spelling and tidy
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit d785fb1c1e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-24 15:25:26 +00:00
Nick Clemens 8fd510cc56 Bug 37775: Remove delayed commits from update_totalissues.pl and add progress option
This patch removes setting AutoCommit to 0 and commiting only every X records.
Instead we commit as we go and report progress using a parameter.

Bug 36474 reduced the numebr of changes that are being committed, so this should be a reasonable change. The
use of commits without transactions was causing problems if the library was active while the script ran.

To test:
1 - perl misc/cronjobs/update_totalissues.pl -c
2 - Script runs, but with unknown parameter
3 - perl misc/cronjobs/update_totalissues.pl -p 10
4 - Script runs and reports every 10 records
5 - per; misc/cronjobs/update_totalissues.pl
6 - Script runs and reports every 100 records by default

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit dba9dd4053)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-24 15:25:26 +00:00
Nick Clemens a40b6d538d Bug 36474: Don't update records when total issues has not changed
This patch adds a new check in UpdateTotalIssues to check that we are changing the number
of total issues before calling ModBiblio

To test:
0 - Enable CataloguingLog
1 - Checkout an item
2 - Run : misc/cronjobs/update_totalissues.pl --use-stats --commit=1000 -v
3 - In report, note all biblios were updated
4 - Check action_logs - note a new entry for every biblio
5 - Apply patch
6 - Repeat
7 - Note no biblios reported updated
8 - Note no new cataloguing log entries
9 - Checkout the item again
10 - Run again
11 - Note biblionumber has updated count in verbose output
12 - Note report only rpeort 1 biblio modified, the rest only processed
13 - Only one line added to action_logs
14 - Run it again
15 - Confirm no updates

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit d7b36d7f69)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-24 15:22:52 +00:00
Nick Clemens 7a9bddd516 Bug 36474: Unit tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 1c875b0157)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-24 15:22:52 +00:00
CJ Lynce 84dfed1982 Bug 37873: [24.05.x] Unable to delete user from routing list or preview/print routing list slip
This patch restores the ability to delete a recipient from a serials routing list.
It also fixes the slip preview when using the "Save and preview slip", and removes
	the koha staff intranet head from the slip when using 'Print list' from the
	Serial collection information screen.

To test:
1) Login to the staff client.
2) Open the Serials module.
3) + New subscription to add a new serial.
4) Create a new subscription.
	a) Search for a record (I searched for 'dog') and chose that record.
	b) Under 'When receiving this serial', select 'Create an item record'
	c) Under the 'Item type' dropdown, select anything.
	d) Click Next -> (and confirm the popup).
	e) Select any 'First issue date'.
	f) Select any 'Frequency'.
	g) Enter a number larger than 5 in the 'Subscription length'.
	h) Select any 'Subscription start date'.
	i) Select your favorite numbering pattern.
	j) Verify your prediction pattern using "Test prediction pattern".
	k) Click "Save subscription".
5) On the 'Subscription details' screen, click "Receive".
6) Under the first volume, click "Add item" then "Save".
7) Repeat step 6 to receive one more issue.
8) On the 'Serial collection information' page click "+ Create routing list"
9) Click "+ Add recipients".
10) Search for and add several recipients.
11) Click "Close" to exit the 'Add recipients' page.
12) Click "Delete" next to any recipient.
	*Note that the recipient is not deleted.
13) Click "Save" on the 'Modify routing list for ...' page.
14) Click "Save and preview routing slip" button.
	*Note you are redirected to the Subscription details page, but no routing
	slip preview appears.
15) Click "Serial collection" from the left-side menu.
16) Click "Print list" on either of the issues you previously received.
	*Note the routing slip includes the staff intranet header, menu, etc.

17) Apply patch.
18) Return to the 'Serial collection information' screen for your subscription.
19) Click "Edit routing list".
20) Repeat steps 12-16 and verify the issues are fixed.
	-"Delete" button works to remove a recipient from a list.
	-"Save and preview routing list" button pops-up a preview before redirecting.
	-"Print list" pops-up a vanilla routing list to print.

Sponsored-by: Westlake Porter Public Library
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-24 15:15:40 +00:00
Julian Maurice be5217b2ef Bug 37763: (QA follow-up): Tidy
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0e359a5981)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-23 20:35:24 +00:00
CJ Lynce f54f6a7b7b Bug 37763: Do not show SQL report editor after 'Update and run'
This patch corrects an error where the SQL editor screen would appear
after the report results when using 'Update and run SQL' when editing
reports.
This also corrects a related issue where the saved_sql.id of the report
would be repeatedly appended to SQL code when using 'Update and run
SQL'.

To test:
1) Login to staff client
2) Navigate to Reports -> Create from SQL
3) Create a short report (SELECT * FROM items), name it and SAVE it.
4) On the resulting "Edit SQL report' page, click 'Update and run SQL'
5) See the report runs, but at the 'Edit SQL report' screen shows at the
   bottom.
6) Apply Patch
7) Return to Reports -> Saved Reports and Edit the report you created.
8) On "Edit SQL report' page, click 'Update and run SQL'
9) Verify that the report runs, but the 'Edit SQL report' section is
   gone.

Sponsored-by: Westlake Porter Public Library
Signed-off-by: Sam Sowanick <sam.sowanick@corvallisoregon.gov>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit bd79cbd858)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-23 20:35:24 +00:00
Owen Leonard 89f3e67a1d Bug 36276: Fix editing of identity provider and domains
This patch fixes identity_providers.pl to remove the "cud-" prefix for
two operations which are not POSTed: editing identity providers and
editing domains.

To test, apply the patch and restart services.

- Go to Administration -> Identity providers.
- If necessary, create an identity provider and then click "Manage
  domains" -> New identity provider domain to create a new domain.
- From the list of domains, click "Edit"
- The edit form should appear with all the correct details prefilled.
  - Check that the page title, breadcrumbs, and page header all show the
    correct domain.
  - Make a change to the domain and confirm that the changes are saved.

- From the list of identity providers, click "Edit"
- This form should also load correctly.
- Submitted changes should be saved correctly.

Sponsored-by: Athens County Public Libraries
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 32578e4f72)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-18 14:21:29 +00:00
Lucas Gass 7f88f09213 Bug 37551: (24.05.x) Only delete price when there is already an itemprice
To test:
1. Have a mrc file with some different prices. In my case I am using the mrc file attached here with different price values in the 975$p and 975$a
2. Set the MarcFieldsToOrder to "price: 975$p" and  MarcItemFieldsToOrder to "price: 975$a"
3. In Acquisitions create a new basket > add to basket > from a new file
4. The value from MarcFieldsToOrder (975$p) is always set as the price when it should be the value from MarcItemFieldsToOrder (975$a)
5. APPLY PATCH, restart_all
6. Try steps 1 - 3 again, this time item price should be correctly handled.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-17 14:41:05 +00:00
Pedro Amorim b10bb5baee Bug 37413: Ensure itemnumber is sent
Fix condition to ensure the itemnumber is sent

Signed-off-by: Sam Lau <samalau@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 99c5e3bae4)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-12 22:35:38 +00:00
Brendan Lawlor a1cd2f859e Bug 37542: Fix patron search when dateofbirth is a DefaultPatronSearchField
This patch updates the call to dayjs to use strict parsing for patron search. See https://day.js.org/docs/en/parse/string-format

To test:
1. Create a patron with dateofbirth 1994-07-27
2. Add dateofbirth to DefaultPatronSearchFields
3. In patron or checkout search, type a cardnumber like '2908800092528'
4. Note the patron with that birth date is found in autocomplete
5. Apply patch and restart_all
6. Repeat step 3 and notice the patron is no longer found
7. In patron or checkout search, try searches using a formatted date
8. Confirm searches for '07/27/1994' and '1994-07-27' find the patron

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 764162cd6d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-12 22:34:03 +00:00
Jonathan Druart 674adef99d Bug 31921: Include the modal code from acquisitions-toolbar.inc
Signed-off-by: Nick Clemens <nick@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 8619598d3b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-12 22:29:32 +00:00
Sam Lau a31c0066c0 Bug 31921: Add confirmation modal when deleting a vendor
This patch adds a new modal for confirming vendor deletion. It fixes
the previous functionality, showing a confirmation modal for each
vendor and appropriately handling the response.

To test:
1) Visit Acquisitions home. Under where it says 'Manage orders', click
   the search bar to bring up the list of vendors.
2) Add a few vendors by clicking 'New' and 'Vendor'. After this, go back
   to the vendor search so that all the vendors are showing.
3) For each vendor, click on 'Delete vendor' and ensure the modal shows
   properly.
4) Attempt to delete one of the vendors. Go back to the vendor search
   and ensure they are deleted correctly.
5) Click on a vendor's name to go their supplier page. Make sure modal
   works properly and attempt to delete a vendor from here.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@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 81af57344d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-12 22:29:32 +00:00
CJ Lynce 888d35626c Bug 37563: Refund, payout, and discount modals in borrower transactions and Point of Sale have broken/bad formatting of values
This patch corrects formatting of amounts in both the POS and member
    accounting module Payment, Discount, and Payout modals.
It also corrects an issue where amounts of a previous modal show up
    when clicking on the same modal for a different accountline
    the member Accounting page.
Finally, it corrects an issue with the member Accounting Discount
    modal in that an amount without both decimal places will not
    display.

Steps to test:
1) Login to staff client
2) Enable the 'EnablePointOfSale' system preference
3) Enable the 'UseCashRegisters' system preference
4) Open POS module and configure a cash register
5) In the POS module -> 'Configure items for purchase', create some
	items with different costs (divisible by .10, e.g 25 or 1.10, etc.))
6) Use the POS module to make a few transactions
7) Open POS -> 'Cash Summary for [BRANCH]', and open your configured
	register
8) Click 'Issue Refund' and check the formatting of the paid and
	returned to patron numbers
*** Issue A) See that numbers are not formatted with two decimal places
9) Pull up the 'Accounting' tab for a borrower
10) Create at least 3 invoices for different amounts (divisible by .10,
	e.g 25 or 1.10, etc.)
11) Pay TWO of your invoices then open the 'Transactions' tab
12) Create a manual credit for an amount (divisible by .10, e.g 25 or
	1.10, etc.)
13)	Click the 'Apply discount' button on one of your invoices
*** Issue B) No 'Amount charged' appears
14) Click 'Issue refund' for one of the	paid invoices.
*** Issue C) The 'Return to Patron' line does not have 2 decimal places
15) Click 'Issue refund' for another paid invoice
*** Issue D) The 'Amount Paid' shows the amount from the first modal
16) Click 'Apply discount' for one of the unpaid invoices
*** Issue E) The 'Amount charged' line is blank
*** Issue F) The discount line is also blank, should at least have a
	0.00 value
17) Click 'Issue Payout' for your manual credit.
*** Issue G) The 'Return to Patron' line does not have 2 decimal places
18) Apply patch
19) Repeat steps 7 & 8 and check the formatting is correct for issue A
20) Repeat steps 13-17 and check behavior and formatting is correct
	for issues B-G
21) Celebrate that you are done with all the steps and looking at
	numbers, and that all is right in the Koha payment world (maybe)

Sponsored by: Westlake Porter Public Library
Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 538c943faa)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-12 22:20:37 +00:00
Laura_Escamilla 92e35a3d17 Bug 37586: Added aria-label for Login icon
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 57dc65bed5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-12 22:17:16 +00:00
Laura_Escamilla b05d36402b Bug 37586: Updated aria-labels for masthead links
Update to my last comment: The Lists aria-label had an accessibility issue as the label did not match the visible text.

New test plan:

Check the OPAC Interface:
* Open the OPAC in a normal-sized browser window.
* You’ll see the text next to the 'Cart', 'Lists', and 'Login' icons clearly.
* Gradually reduce the window size until the text next to these icons disappears.
* Inspect the icon elements. You’ll find that there is no alternative text (like aria-label) provided for 'Cart' and 'Login'. The aria-label for 'Lists' does not match the visible text. It currently says "Show dropdown with detailed list information". This lack of alternative text is an accessibility issue and labels should match visible text.
Apply the Patch:
* Apply the patch
* Restart_all
Verify the Fix:
* Inspect the icons again.
* For the 'Cart' icon, you should see an aria-label attribute with the text "View your shopping cart".
* For the 'Login' icon, you should see an aria-label attribute with the text "Log in to your account".
* For the 'Lists' icon, you should see an updated aria-label attribute with the new text of "Lists".
* These changes will improve accessibility for users relying on screen readers.
Sign Off:
* Sign off and Have an amazing day!

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 8318d27a7d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-12 22:17:16 +00:00
Phil Ringnalda 194d7149ff Bug 37612: Batch patron modification should accept both cud-show and show ops
Just like with batch item modification, batch patron modification can accept
either a POST of a lot of data, which might be more than Apache's default
URL length limit, or a GET of a little data. Or at least it could, if both
the op 'cud-show' and the op 'show' were accepted. Show isn't doing any
creation or updating or deleting, it just has to be cud-show because it needs
to be able to accept large POSTs. So when it is only getting a little data, it
should be willing to take a GET with op=show just like batch item
modification does.

Test plan:
1. Without the patch, Tools - Patron lists - New patron list - give it a
   name and Save
2. Type enough characters in the Patron search input to find a patron (I
   like ace for poor often-used Henry Acevedo) and click on a patron in
   the list of results
3. Click Add patrons
4. Click Patron lists, and in the Actions menu for your list, choose
   Batch edit patrons. Note that the page that loads doesn't show any patrons
   or UI to edit them, only a message about "No patron card numbers or
   borrowernumbers given."
5. Apply patch, restart_all
6. Repeat step 4, but this time get a page with your patron listed, and a
   form to change things about the patron record.

Sponsored-by: Chetco Community Public Library
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 fc5eed80a3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-12 22:12:41 +00:00
Paul Derscheid bce87fac43 Bug 37643: Check for NaN instead of truthiness if calendar.inc accepts_time
To test:
1) Go to circulation.pl (checking out to a patron)
2) Click the settings in the barcode input
3) Set any due date with the time set to 00:00
4) Note that the picker resets the time to 23:59
5) Apply the patch
6) Repeat 1-3
7) Note that the time (00:00) stays put
8) Sign off

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

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 e96a334aa8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-12 22:07:08 +00:00
Matt Blenkinsop b55df97aa8 Bug 37647: Remove Text::CSV_XS import
There is an unnecessary import that has been left over from when KBART file processing logic was being handled directly in the API controller. This patch removes that import as it is no longer needed

Test plan:
1) Look at the patch diff and confirm that the import for Text::CSV_XS has been removed

Signed-off-by: Jake Deery <jake.deery@ptfs-europe.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 3c94b26c66)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-12 22:04:57 +00:00
Pedro Amorim c38db96f3d Bug 36882: Reapply flatpickr to cloned entry
1) Add a patron attribute type:
   http://localhost:8081/cgi-bin/koha/admin/patron-attr-types.pl?op=add_attribute_type
2) Make sure its repeatable + is_date
3) Visit overdues:
   http://localhost:8081/cgi-bin/koha/circ/overdue.pl
4) Click the 'add' button under the date custom attribute
5) Click on the newly created input, notice the flatpickr pop up doesnt
   show
6) Apply patch. Repeat.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

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 4c3ef3b69d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-12 22:01:31 +00:00
Owen Leonard 4f9707dcd1 Bug 36907: Add maxlength to OAI set mapping form fields
This patch adds a maxlength attribute to the field, subfield, and value
fields in the OAI set mapping form. This helps prevent an error when the
form data is too long for the database columns.

Unrelated: The patch also adds quotes around two unquoted name
attributes.

To test, apply the patch and go to Administration -> OAI sets.

- If necessary, create a new set.
- Click Actions -> Define mappings.
- Test that each form field is limited correctly:
  Field: 3
  Subfield: 1
  Value: 80
- Test that the form can be submitted successfully with the maximum
  number of characters in each field.

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 c3f47091de)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-12 21:59:45 +00:00
Janusz Kaczmarek e7a6fe1036 Bug 32696: Unit tests
Added unit tests.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>

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 da5aa7faba)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-12 21:57:38 +00:00
Janusz Kaczmarek 15dc40af39 Bug 32696: Recalls can inadvertently extend the due date
If an item is due sooner than the recall due date interval then placing
a recall on it can inadvertently extend the book's due date, possibly
causing the recalling patron to receive the item later than they would
otherwise.

Test plan:
=========

1. Turn on recalls with UseRecalls.
2. In circulation rules, set the recall due date interval to 7 days
   or any other arbitrary period.
3. Check out an item to one patron & set the due date to be before the
   recall due date interval will have elapsed (e.g. the next day)
4. As a second patron, place a recall on the item in question.
5. See that the item's due date is extended to the current date plus
   the recalls due date interval.
6. Apply the patch, restart_all;
7. Repeat steps 3. and 4. See that the due date has not been extended.

BTW, the calculation of $due_interval has been changed, because with
the current code and empty 'Recall due date interval' $due_interval
is undefined, despite the intention of the author of the code.
(after calling get_effective_rule $recall_due_date_interval is defined, but
$recall_due_date_interval->rule_value is undefined;  the patron gets
a message: '... return the item within days, by ...' - no days count).

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>

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 e584b9adcb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-12 21:57:38 +00:00
Aleisha Amohia ca17ec1ce3 Bug 37623: Make t/db_dependent/Letters.t idempotent
The tests should be unaffected by system preference settings, such as EmailFieldPrimary.

To test:
1. Log into the staff interface
2. Go to Koha Administration -> Global system preferences, and search for EmailFieldPrimary
3. Change the EmailFieldPrimary preference to something other than 'primary email' and 'first valid email address', i.e. any of the following:

* alternate email
* card number
* secondary email
* selected addresses

4. Run tests t/db_dependent/Letters.t and notice they fail

5. Apply the patch

6. Run the tests again t/db_dependent/Letters.t with different settings of EmailFieldPrimary. The tests should always pass.

Sponsored-by: Pymble Ladies' College
Signed-off-by: Paul Derscheid <paul.derscheid@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 0e61e56e57)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-12 21:55:29 +00:00
Matt Blenkinsop a31735fa17 Bug 37620: Improve cypress test to reduce random failures
This patch makes some improvements to the Infinite Scroll cypress test to try and prevent random test failures

- Fixes X-Base-Count and X-Total-Count for intercepted requests
- Makes element selection more precise
- Adds an intercepted request returning the requrired result for the filtered search
- Awaits this request before selecting an element from the dropdown
- Awaits all 10 requests triggered by typing "License 50" rather than just the first one
- Ensures that the select dropdown is closed between operations by clicking into another field to remove focus from the select dropdown

Test plan:
1) yarn cypress run --spec t/cypress/integration/InfiniteScrollSelect_spec.ts
or
1) yarn cypress open and select the InfiniteScrollSelect test from the Cypress GUI

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 538868d5f5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-12 21:53:01 +00:00
Eric Garcia e9e4d37047 Bug 37186: Fixed deletion of rotating collections
To test:
1. Tools -> Rotating collections
2. Create a rotating collection
3. In new collection Actions -> Delete
4. Notice collection is not deleted
5. Apply patch
6. In new collection Actions -> Delete
7. Notice collection is deleted

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 37cb3f35a3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-12 19:01:15 +00:00
Tomas Cohen Arazi a4706d6c77 Bug 37510: Fix Objects.t and remove FIXME
This patch makes the tests check for the added exception instead of the
generic DBIx::Class::Exception.

A FIXME was set in place proposing we should throw a Koha::Exception
instead, so removing the FIXME as that's what this patch actually did.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8da67cec72)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 19:19:22 +00:00
Johanna Räisä 85afecd491 Bug 37591: Fix moredetail.tt performance issue
This patch fixes the performance issue in moredetail.tt by removing the
unnecessary call of checkout_renewals table.

To test:
1. Create lot of checkouts and renewals for a record.
2. Open the moredetail page for the record.
3. Check the timing of the page load.
4. Apply the patch and check the timing of the page load again.
5. The page load should be faster after applying the patch.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5c41c1c657)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 16:44:07 +00:00
Sam Lau 0935e9b30b Bug 37409: Fix 'Edit' button for items in course reserves list
To test:
1) Set the 'UseCourseReserves' sys pref to 'Use'
2) Go to the Course reserves page
3) Create a new course, fill in the required info and make sure the 'Enabled?' is checked
4) Add a reserve to this course
5) From the course details page, select edit on the reserve you just made.
6) Note it brings you back to the add reserves page, and you are required to enter the barcode/biblionumber again to edit
7) Apply patch, restart_all
8) Press the edit button again
9) Now you are directed towards the correct page for editing
10) Make some changes and press save
11) You should be redirected back to the details page and your changes have been made

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 0dad564763)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 16:43:03 +00:00
Tomas Cohen Arazi 3a95803c5e Bug 37510: Make Koha::Object->delete throw Koha::Exception
This patch makes Koha::Object->delete wrap DBIC exceptions on FK
constraints and throw a Koha::Exception::Object::FKConstraint exception
instead. This will allow us better handling it from the callers.

To test:
1. Apply the unit tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Object.t
=> FAIL: A DBIC exception is thrown instead, tests fail
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: David Nind <david@davidnind.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 923dc5e078)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 16:41:16 +00:00
Tomas Cohen Arazi 7edc1c10a8 Bug 37510: Unit tests
Signed-off-by: David Nind <david@davidnind.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 30a5baa706)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 16:41:16 +00:00
Jonathan Druart df9f28f54f Bug 37429: Set default value for global variables
The global variables needs to be assigned with a default value, or the
value from the previous request will be used.

Global variables are persistent from one request to another, in memory.

This patch:
* groups default value for global variables together
* removes $authorised_values_sth from this list (it is not a global var)
* set $changed_framework to 0 (which fix the issue)

Test plan:
1. Open an existing biblio (detail.pl)
2. Click "Edit record"
3. Change the framework (no need to change any details)
4. Change the framework back to the original one (no need to save anything)
5. Go back to the biblio overview page (detail.pl)
=> The form is populated

Signed-off-by: Paul Derscheid <paul.derscheid@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 8aced236e9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 16:38:26 +00:00
Phil Ringnalda 8a899af29e Bug 37614: Printing patron cards from patron lists should be a GET
There's no creating, updating, or deleting about printing patron cards, and
the only time there's a lot of data (selecting individual patrons in a card
creator batch), it doesn't matter if the "Export selected" URL exceeds the
maxlength for Apache since the actual link to create the PDF also will.

Test plan:
 1. Without the patch, Tools - Patron lists - New patron list - Name it and
    Save
 2. Type three characters in the Patron search form (mar works well) to get
    at least three patrons. Click on each of three, then click Add patrons
 3. You can only print cards from the list of lists, so back to Tools -
    Patron lists
 4. In the Actions menu choose Print patron cards, in the popup click Export
 5. Watch the throbber spin around for a while (it will never stop), then
    close the popup, apply the patch, restart_all
 6. Tools - Patron lists - Actions menu - Print patron cards - Export
 7. Click the PDF link, make sure it has all three of your patrons
 8. Tools - Patron card creator - New - Card batch
 9. Without putting anything in the textarea, click Add patrons, in the
    search popup search for your three characters (mar) again, and click
    the checkboxes to the left of three of the names, then Add selected
    patrons, then Close, then Add patrons
10. Click the checkboxes for two of the three patrons, then Export selected
    card(s), then Export in the popup
11. Hover the link to the PDF, verify that it doesn't have stray 'amp;'
    after the & and before label_id= anymore
12. Click the PDF link, verify it has your two patrons
13. Back at the card batch, click Export card batch, then Export
14. Check the PDF to verify it has all three of your patrons
15. Tools - Patron lists - click your list's name to open it
16. Click the card number for a patron, then the Patron lists tab in Checkout
17. Actions menu - Print patron cards - Export, verify the PDF has all three
    patrons

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 0f255728c5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 16:37:03 +00:00
Kyle M Hall 955f724b1d Bug 37308: (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 5a06bd0d73)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 16:36:14 +00:00
Pedro Amorim aceb48f150 Bug 37308: Add user-agent for SUSHI outgoing requests
Signed-off-by: Belal Ahmadi <belal.ahmadi@uwl.ac.uk>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8175cccca2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 16:36:14 +00:00
Fridolin Somers 3a30c004ae Bug 37575: Typo 'AutoCreateAuthorites' in about.pl
Typo in system preference name 'AutoCreateAuthorites' ->  'AutoCreateAuthorit[i]es'

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4c5425bd2f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 16:26:41 +00:00
PerplexedTheta 8297471b3b Bug 37593: Removed all instances of 'this this' in the codebase
To test:
a)  do a grep for 'this this'
    1)  notice that there are five matching files
    2)  notice that all of these instances are in comments, or podfiles
b)  apply this patch
c)  do a grep for 'this this'
    1)  notice now that these instances are gone
d)  apply these changes to schema.koha-community.org
e)  result!

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2cc520cdeb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 16:26:25 +00:00
Matt Blenkinsop a2a2314856 Bug 37607: Only default to manual form if we are editing
This patch fixes an issue where the form to add a provder would automatically default to the manual form. This patch prevents this behaviour and restores the intended functionality.

Test plan:
1) Don't apply the patch
2) In ERM, click to add a new provider
3) Type something in the provider name search box
4) The input will change from a select to a text input and the button next to it will now say "Create from registry"
5) Apply patch
6) Yarn build and hard refresh the browser
7) Repeat steps 1-3, the form should work as intended and return results in the select box

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a73cafda2d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 16:19:49 +00:00
Sam Lau be4cc23a1b Bug 37450: Fix 'Close basket' button from list of baskets
To test:
1) In acquisitions, have a vendor with an item (or items) in their basket. Search for this vendor.
2) From the actions column, select the arrow and then press 'Close this basket'
3) Clicking on this option will not close the basket and brings us to the wrong page
4) Apply patch
5) Try to close the basket again, and this time, it is closed successfully

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a55e20e8c1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 16:15:30 +00:00
Emmi Takkinen d0cb0ff57b Bug 37254: Fix clearing of dropdown values on circulation rules
When one tries to clear the rule they are editing in circulation
rules page via "Clear" button, dropdown selectors aren't populated
with default value (first on the list).

To reproduce:
1. Select a rule to edit.
2. Press "Clear" button to return edit rows values back to default values.
=> Values in dropdowns aren't set back as default, instead they have
same values as rule you edited before pressing "Clear".
3. Apply this patch.
4. Select rule to edit, then press "Clear".
=> Dropdowns now have default values.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f1f08f92c5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 16:15:03 +00:00
Andreas Jonsson ab51747dcc Bug 36879: Spurious warning in QueryBuilder
Test plan:

With ElasticSearch enabled,
* Perform a search using the default  sort order
  (i.e. 'relevance').
* Verify that no warnings are generated in
  plack-intranet-error.log

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 347291727d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 15:58:04 +00:00
Caroline Cyr La Rose b6f09e5b82 Bug 37461: Typo in SMSSendAdditionalOptions description
This patch correct a typo in the SMSSendAdditionalOptions system
preference description.

To test:
1. Apply patch
2. Go to Administration > System preferences
3. Search for SMSSendAdditionalOptions
4. Read the description, make sure there are no spelling or grammar
   error

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.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 41c455fd58)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 15:57:18 +00:00
Catalyst Bug Squasher 482c08bbfa Bug 35792: Use of uninitialized value $sub6
Test plan:

1. Apply patch
2. Rerun and make sure the error "Use of uninitialized value $sub6 in pattern match (m//) at /usr/share/koha/lib/Koha/SearchEngine/Elastricsearch.pm" is no longer present.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Initial testing done, it works well, needs an additional sign off from an external party

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 b8049af6b1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 15:56:14 +00:00
Owen Leonard 7fcda7cfc3 Bug 37030: Use template wrapper for breadcrumbs: Cash register stats
This patch updates the cash register statistics template so that they
use the new WRAPPER for displaying breadcrumbs.

To test, apply the patch and test page and its variations.
Breadcrumbs should look correct, and each link should be correct.

- Reports ->
  - Cash register statistics
    - Results

Sponsored-By: Athens County Public Libraries
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 938053b1cf)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 15:53:07 +00:00
Catalyst Bug Squasher 574f98a64e Bug 35235: Make "Koha module" label match the corresponding <select>
Test Plan
1. Go to Tools -> Notices and slips -> New notice
2. Select Acquisition
3. Click on the Koha module label
4. The corresponding drop down field should activate (greyed)

Signed-off-by: Sam Lau <samalau@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 9ba523f6b6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 15:52:13 +00:00
David Cook b2fcb1a875 Bug 37553: Tidy to make QA tools happy
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 1a747ddcb7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 15:51:31 +00:00
David Cook 3b993d2a14 Bug 37553: Consistently send Csrf-Token in request header
This change consistently sends the Csrf-Token in the request header.
Previously, one POST sent it in the request body, while the other POST
sent it in the request header. Since we're using an API, it's best
for us to always send it in the request header

Test plan:
0. Apply the patch
1. perl ./misc/migration_tools/koha-svc.pl \
	http://localhost:8081/cgi-bin/koha/svc koha koha 29 > bib-29.xml
2. perl ./misc/migration_tools/koha-svc.pl \
	http://localhost:8081/cgi-bin/koha/svc koha koha 29 bib-29.xml
3. Note that the following appears in STDOUT and there is no 403 error:
"update 29 from bib-29.xml"

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 bf427a2947)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 15:51:31 +00:00
David Cook e486a1e28e Bug 37553: Use CSRF token for authenicated session for POSTing
This change fixes the Koha::SVC to store the CSRF token for
the authenticated session for further POSTing.

Test plan:
0. Apply the patch
1. perl ./misc/migration_tools/koha-svc.pl \
    http://localhost:8081/cgi-bin/koha/svc koha koha 29 > bib-29.xml
2. perl ./misc/migration_tools/koha-svc.pl \
    http://localhost:8081/cgi-bin/koha/svc koha koha 29 bib-29.xml
3. Note that the following appears in STDOUT and there is no 403 error:
"update 29 from bib-29.xml"

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 eabd792ee9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 15:51:31 +00:00
Brendan Lawlor b21efc1e4d Bug 37077: Fix report mutli-select for zero and single selections
This patch updates the javascript overriding the form submission when reports have multi select parameters.

When there are more than one multi selects, and the user selcts one value from each, it skips updating the value of the select, so it doens't send duplicate parameters anymore.

If there are no selections made it will pass '%' for all values. This allows the multi select to be optional in the report. If no selections are made it is assumed that you are not using that parameter to limit the report.

Test plan:
1. Go to Reports and create a report from SQL
   select *
   from items
   where
   homebranch in <<Libraries|branches:in>>
   and
   itype in <<Item type|itemtypes:in>>
3. Run the report but pick only 1 library and 1 item type
4. Click the "Show SQL code"
5. Notice that the two parameters were filled correctly
6. Run the report again with zero selections
7. Click the "Show SQL code"
8. Notice that the '%' is used for the parameter
9. Run the report again with combinations of single, multiple and zero selections
10. confirm the SQL code is generated as you would expect.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.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 6c6982b983)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-11 15:46:21 +00:00
Lucas Gass 13c6a4a1bb Bug 37552: (24.05.x) Wrap auto renewal attempt in eval to ensure script does not die
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-09 14:13:06 +00:00
Pedro Amorim e6b23deb4c Bug 37509: Check Elasticsearch info for both 'about' and 'sysinfo' tabs
1) Notice 'Elasticsearch:' entry at  http://localhost:8081/cgi-bin/koha/about.pl?tab=about is empty
2) Apply patch + restart plack
3) Repeat step 1) Notice it now shows elasticsearch info as expected.
4) Verify that Elasticsearch warning http://localhost:8081/cgi-bin/koha/about.pl?tab=sysinfo is the same before and applying patch.

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 63e560a432)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-06 16:52:55 +00:00
Nick Clemens e25b5cf5f7 Bug 37543: (follow-up) Tidy
Tidy the whole thing

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit cf315751cf)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-06 16:40:57 +00:00
Rudolf Byker c850195a67 Bug 37543: Use CSRF tokens in connexion_import_daemon.pl
Since version 24.05, due to the changes mentioned at
https://wiki.koha-community.org/wiki/Koha_/svc/_HTTP_API#Changes_coming_in_Koha_24.05 ,
the `connexion_import_daemon.pl` stopped working. The reason for this is that
it did not use CSRF tokens.

To test:
1. Get a Koha instance on 24.05, before applying the patch.
2. Create a plain text file somewhere on the server containing a raw MARC
   record (not XML). Let's call it `marc.txt`.
3. On the server, create a config file like this:
```
host: 0.0.0.0
port: 5500
koha: http://localhost:82  # Where 82 is the port of the Koha staff interface.
user: foo  # A Koha staff user.
password: Fooo1234  # The Koha staff user's password.
import_mode: stage
```
4. Run `./connexion_import_daemon.pl --config the-config-file-path`
5. In another terminal on the same server (or from anywhere that can reach the
   port opened by the `connexion_import_daemon.pl` script,
   run `nc localhost 5500 < marc.txt`
6. Observe in the stderr of the daemon script: `Response: Unsuccessful request`
7. Stop the daemon script.
8. Apply the patch and repeat steps 4 and 5.
9. Observe in the stderr of the daemon script:
   `Response: Success.  Batch number ... - biblio record number HASH(...) added to Koha`
10. Check at /cgi-bin/koha/tools/manage-marc-import.pl for a batch named
    `(webservice)`. It should contain one record now. This is how we know that
    authentication between the daemon and Koha worked, which is what this
    patch tries to address.

Thanks-to: David Cook <dcook@prosentient.com.au>
Sponsored-by: Reformational Study Centre <www.refstudycentre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0e9ea3c9f5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-06 16:40:56 +00:00
CJ Lynce f66130b020 Bug 37382: Report download is empty except for headers if .tab format is selected
When exporting a report in tab delimited format, the downloaded file
    would have the header rows but no data results.
Also, misc files are created on the server file system in koha/reports
    with data that should have been in the .tab file.
This patch fixes both of these issues.

To test:
1. Login to staff client
2. Go to Reports and create a report from SQL - sample report
    SELECT i.barcode, b.title, b.biblionumber, i.itemnumber
	FROM items i
	LEFT JOIN biblio b on i.biblionumber = b.biblionumber
	WHERE i.itemnumber < 50
3. Run the report
4. Click 'Download'->'Tab separated text'
5. Download file
6. Open file in a text editor or favorite spreadsheet app
    File will have headers rows, but no other item data
6a. If able, check the server filesystem in koha/reports
	There may be files there related to report data. Remove.
7. Apply Patch
8. Repeat steps 3-6,
    File will now have the table data, hooray!
8a. If able, check the server filesystem in koha/reports
	No new files should be created.

Signed-off-by: Laura ONeil <laura@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7d0563e1c5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-06 16:32:53 +00:00
Lucas Gass 7ae41cda1d Bug 37337: Pass the save $op when biblio_exists
To test:
1. Go to suggestions in the staff interface and enter a new suggestion.
2. Enter a title that matches something already in the catalog. In k-t-d I used "Lanark".
3. Submit the suggestion.
4. Get a blank page.
5. APPLY PATCH and restart_all
6. Now after step 3 you should get a page that shows the 'Click on "Confirm your suggestion" to ignore this message." warning, the form, and a Confirm your suggestion button.

Signed-off-by: Jake Deery <jake.deery@ptfs-europe.com>
Signed-off-by: Jan Kissig <jkissig@th-wildau.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8e7208d710)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-06 16:29:00 +00:00
Lucas Gass 57f81a09bd Bug 37192: Adjust template for additem.tt
Test plan:
1. Search the catalog for something that will return results, like Perl
2. On any bib that has at least one item, click Edit items
3. In the Actions menu to the left of any item, choose Print label
4. That opened a popup with a 500 error rather than a label batch editor
5. Apply patch, restart_all
6. Repeat step 3, but this time you'll get a label batch editor with your
   item in it.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.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 e1b78e1e2b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-06 16:27:03 +00:00
Lucas Gass 61dd963360 Bug 37192: Add ability to pass data-new_tab to form-submit.js and open in new tab
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.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 4c244df82a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-06 16:27:03 +00:00
Pedro Amorim 4249454095 Bug 37263: Fix URL param retrieval
This was introduced by bug 34478.
To test:
Follow the test plan as before, but test for several different patron categories

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>

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 40876b7ae1)
2024-09-06 16:23:33 +00:00
Pedro Amorim f6b729cd8d Bug 37263: Fix handling of 'All' values on 'default article request fees'
To test:
1. Enable ArticleRequests sys pref
2. Visit <staff_url>/cgi-bin/koha/admin/smart-rules.pl
3. Under 'Default article request fees' on 'Patron category' select 'All' and input a numeric Free
4. Click 'Add'. Notice it blows up.
5. Apply patch. Repeat.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>

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 84a31260ad)
2024-09-06 16:23:20 +00:00
Emily Lamancusa 77af43830e Bug 37496: Restore parameter to limit to details of one item
To test:
1. Find a bib record with more than one item
2. Click on the barcode of an item to show the item details page
--> The item details page shows the details of all items, though it does
    jump to the correct item
3. Apply patch
4. Reload the bib record, and click the barcode again
--> The item details page shows only the chosen item, with a link above
    to show all items

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 34ac823619)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-06 16:21:42 +00:00
Lucas Gass 8e1ab9522f Bug 37294: Add modal to generate next
To test:
1. Serials -> Create or find a subscription
2. Receive the subscription
3. Save
4. Click 'Generate next'
5. Nothing happens
6. APPLY PATCH
7. Try again, now the "Generate next" button should work as expected.

Signed-off-by: Kelly <kelly@bywatersoutions.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 56cbc1f092)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-06 15:54:54 +00:00
Nick Clemens 1b90c3dc65 Bug 37342: Use get for launching authority popup
This patch simply switches to a GET as the operation is not cud

To test:
 1 - Go to cataloging -> new record
 2 - If not in basic editor, switch
 3 - Go to tab 100
 4 - Enter a name that has no authority in your system: McNotExist, Falsy
 5 - Click 'Link authorities automatically'
 6 - subfield 9 should turn red, and have an X and a + button
 7 - Click the green +
 8 - Boom
 9 - Apply patch
10 - Reload page and repeat (clear cache so js reloads)
11 - Success! Authority window launches

Signed-off-by: Jake Deery <jake.deery@ptfs-europe.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d4f4190f91)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-09-03 14:43:06 +00:00
Tomas Cohen Arazi 819f0db4cc Bug 37389: (QA follow-up) Tidy
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 897f4f319b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:42:21 +00:00
Pedro Amorim 4593ad7751 Bug 37389: ExtendedAttributes mixin
This is what we're doing here:

- Creating a new mixin called ExtendedAttributes.pm
- Moving the extended_attributes 'join' logic out of REST/Plugin/Query and instead applying it to the aforementioned Mixin. Moving this to this level allows for this consistent behavior to happen on all search queries including, but not limited to, search queries happening on the REST API.
- Applying this Mixin to Patrons and ILL::Requests (we don't apply it to AdditionalFields.pm here yet because no AdditionalFields supporting classes have the extended_attributes accessor yet, I'll tackle this when rebasing 35287)

- The aforementioned mixin does the following:
-- Generates dynamic accessors for extended_attributes e.g. if there is a borrower attribute with code 'height', the 'extended_attributes_height' accessor is generated dynamically if a search with 'prefetch'=>'extended_attributes' AND the extended_attribute.code = 'height' is performed.
-- Rewrites the 'join' entries in the query to have the aliases as above.
-- Rewrites the WHERE conditions to match the above ruleset.

Example:

A DBIX search query as follows:

[
        {
            '-and' => [
                [
                    {
                        'extended_attributes.attribute' => { 'like' => 'abc%' },
                        'extended_attributes.code'      => 'CODE_1'
                    }
                ],
                [
                    {
                        'extended_attributes.code'      => 'CODE_2',
                        'extended_attributes.attribute' => { 'like' => '123%' }
                    }
                ]
            ]
        }
    ]

Results in the following SQL:

    SELECT
      `me`.`borrowernumber`
    FROM
      `borrowers` `me`
      LEFT JOIN `borrower_attributes` `extended_attributes_CODE_1` ON (
        `extended_attributes_CODE_1`.`borrowernumber` = `me`.`borrowernumber`
        AND `extended_attributes_CODE_1`.`code` = ?
      )
      LEFT JOIN `borrower_attributes` `extended_attributes_CODE_2` ON (
        `extended_attributes_CODE_2`.`borrowernumber` = `me`.`borrowernumber`
        AND `extended_attributes_CODE_2`.`code` = ?
      )
    WHERE
      (
        (
          (
            `extended_attributes_CODE_1`.`attribute` LIKE ?
            AND `extended_attributes_CODE_1`.`code` = ?
          )
          AND (
            `extended_attributes_CODE_2`.`attribute` LIKE ?
            AND `extended_attributes_CODE_2`.`code` = ?
          )
        )
      )

What fixes the performance issue that originated this work is the 'AND `extended_attributes_CODE_1`.`code` = ?' that was missing on the LEFT JOIN.

All of the above is explained using Borrowers and Borrower attributes, but it all also applies to ILL::Requests and ILL::Request::Attributes.

Co-authored-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3b613fb73f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:42:21 +00:00
Pedro Amorim 44e1714a2e Bug 37389: Add tests
prove t/Koha/REST/Plugin/Query.t
prove t/db_dependent/Koha/Objects/Mixin/ExtendedAttributes.t

Co-authored-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit bbf52b754f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:42:21 +00:00
Vicki McKay 8df2d43102 Bug 33453: Change the button class of the record cashup modal to btn-primary
To test:

1. Go to System Preferences > find and enable "Use cash registers"
2. Go to Administration > "Cash registers" and create a new cash register
3. Go to Tools > "Transaction history for" > "Record cashup"
4. Click "Record cashup"
5. Modal with change: "Confirm" should be yellow and primary.

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 3a3d367922)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:40:01 +00:00
Nick Clemens 0de8272622 Bug 37373: (follow-up) Add id and adjust tests
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d5f0191bda)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:36:02 +00:00
Owen Leonard 3962b68b46 Bug 37373: Combine duplicate class attributes
This patch corrects two instances in patron-search.inc where there were
two class attributes on one input. Combining the two class names under
one class attribute seems to fix the focus problem.

The patch also updates the global JS giving focus to elements with a
"focus" class so that it only targets elements which are visible. This
prevents the browser from trying to put focus on a field in a hidden
modal.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d56226d737)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:36:02 +00:00
Eric Garcia 3c8539bc6b Bug 37411: Fixed exporting to CSV file
To test:
1. Acquistions -> Budgets -> Funds -> Planning, select any option
2. In the toolbar see Export, and click Submit and see a 500 error
3. Apply patch, restart_all
4. Repeat steps 1-2
5. Notice the 500 error is gone and the CSV is exported properly

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 94890a1e55)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:32:58 +00:00
Eric Garcia 1adce64d84 Bug 37411: Fixed 500 error when exporting budget planning
To test:
1. Acquistions -> Budgets -> Funds -> Planning, select any option
2. In the toolbar see Export, and click Submit and see a 500 error
3. Apply patch, restart_all
4. Repeat steps 1-2
5. Notice the 500 error is gone and the CSV is exported properly

Notes:
Is there a reason we call exit(1) after exporting the csv?

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7367b114c9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:32:58 +00:00
Sam Lau 812f268d8a Bug 37489: Separate forms for uploading and deleting a patron image
This patch creats a new form for image deletion that is submitted via the 'Delete' button on the modal.

To test:
1) Turon on the 'patronimages' sys pref
2) Visit a patron page, you should see an image module on the left.
3) Click on the image to edit it. Upload a new image.
4) Edit the image again, press delete and confirm the popup.
5) Note that it will not let you delete because of the required file.
6) Apply patch
7) Attempt to delete again, this time it is successful.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2263d9f3b0)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:30:21 +00:00
Matt Blenkinsop 04b7d7f1ff Bug 37288: Allow manual providers to be edited
There is a bug preventing manually created providers from being edited. This patch fixes that issue and allows providers to be edited if they have been created manually

Test plan:
1) Create a data provider in the ERM manually using the Create manually option
2) Click to edit that provider
3) The form will not load
4) Apply patch and run yarn build
5) Hard refresh the browser
6) The form should now load correctly

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 8872aa91e3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:28:00 +00:00
Matt Blenkinsop c87b670300 Bug 37288: Improve display of data provider edit form
This patch makes some improvements to the edit form for data providers. It delays page display until the counter registry has responded and also improves the display of the "create manually" and "Create from registry" buttons

Test plan:
1) Create a Data provider in the ERM module
2) Click to edit that new provider
3) The page will load and there will be a slight delay before the Data provider name input is populated
4) The "Create manually" button will also be visible
5) Apply patch and yarn build
6) Hard refresh the browser and repeat steps 1 and 2
7) This time when the page loads the provider name should be prepopulated and no manual creation button will be visible

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 b646d8ab65)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:28:00 +00:00
Lucas Gass ee1fb146b2 Bug 37419: Schema updates
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:25:35 +00:00
Lucas Gass b0e692337d Bug 37419: DBRev 24.05.03.003
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:25:35 +00:00
Tomas Cohen Arazi 57046b92a0 Bug 37419: Update FK constraint on record sources to avoid data loss
Without this patch, deleting a record source will delete the associated
biblio_metadata rows, which is a severe data loss.

This patch makes the constraint restrict this action.

To test:
1. Add a record source
2. Set the record source to some records
   $ koha-mysql kohadev
   > UPDATE biblio_metadata SET record_source_id='your source id' WHERE
biblionumber=1;
3. Delete the record source
=> FAIL: Record metadata deleted
4. Apply this patch
5, Run:
   $ ktd --shell
  k$ updatedatabase
=> SUCCESS: DB update goes well
6. Repeat 1~3 with another record
=> SUCCESS: Source cannot be deleted if there are linked records

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Janusz Kaczmarek <januszop@gmail.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 8754458775)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:25:35 +00:00
Phil Ringnalda b603bd91b3 Bug 37093: Searching for reports on Mana should use GET
Searching for reports on Mana currently fails by sending a POST to
svc/mana/search without a CSRF token. There's no reason to POST, it's
just sending a search string.

 1. Enable Mana: Reports - lower right is a blue Knowledgebase box with
    a link to Change your Mana KB settings
 2. Switch Use Mana KB to Yes, click Save, below that give it a name and
    email, Send to Mana KB
 3. Reports - Use saved - New report - New SQL from Mana
 4. Enter any keyword to search, get a 403 forbidden error
 5. Apply patch, restart_all, Shift+Reload the page to clear cache
 6. Enter any keyword likely to return results, like select, get results

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 f4d248f076)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:14:20 +00:00
Owen Leonard 52f928beb0 Bug 37523: CSRF error when modifying an existing patron record
This patch modifies the patron entry template to avoid a CSRF error when
clicking the "Edit existing record" button after a duplicate patron is
found. The operation should be GET and thus can be a link.

To test, apply the patch and go to Patrons.

- If you aren't using the default testing data you should first locate
  an existing patron record so you can refer to the details.
- Start the process of creating a new patron record.
- Use the existing patron's data to fill out the form.
  - With the default data you can use:
    - Surname: Bennett
    - First name: Pamela
    - Date of birth: 09/16/1946
    - Any random new card number
- When you click "Save" you should get a duplicate patron warning:
  "Duplicate patron record?"
  - Click "It is a duplicate. Edit existing record."
  - You should be taken to the edit form for the existing patron.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Johanna Räisä <johanna.raisa@gmail.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2f6226ad69)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:12:32 +00:00
Jennifer Sutton 54e26935e9 Bug 35236: Make "Batch description" label match corresponding <input> field
To test:
  1. Create a new patron.
  2. Go to Tools -> Patron card creator.
  3. Create a new patron card batch.
  4. On the "Edit patron card batch" page, click the "Batch
     description:" label.
  5. Observe that the corresponding <input> field is selected.

Mentored-by: Catalyst Academy
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 558b900895)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:02:20 +00:00
Sam Lau 528db7e928 Bug 36998: Correctly update the 'Amount paid' displayed on the issue refund modal
To test:
1) Enable the 'EnablePointOfSale' sys pref (also requires the 'UseCashRegisters' pref)
2) In the POS module, configure a cash register and also configure some items for purchase with different costs
3) Make multiple sales
4) View the transactions table by clicking the 'Cash summary for ...' tab and then clicking on your cash register's name.
5) Click on the 'Issue refund' button for one of the sales, this should have the correct 'Amount paid'
6) Close the modal and click issue refund on your other item.
7) Note the 'Amount paid' is incorrect and lists the value from the previous item
8) Apply patch
9) Now when clicking issue refund, it displays the correct 'Amount paid'

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 47a3c28473)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 17:01:17 +00:00
Tomas Cohen Arazi 10f8db2470 Bug 37476: Fix reserved word error on Serials.pm on MySQL 8
This patch fixes the fact `RANK` become a reserved word in MySQL 8.0.2
[1]

To test:
1. Launch KTD with MySQL 8:
   $ ktd down
   $ DB_IMAGE=mysql:8 ktd up -d
2. Open the logs
   $ ktd --shell
  k$ tail -f /var/log/koha/kohadev/*.log
3. Create a serial, receive an issue and try to create a routing list
4. Click on `+ Add recipients` and look for Henry
5. Click `Add` and then `Close`
=> FAIL: Henry not added
=> FAIL: The logs show an error about wrong SQL syntax
6. Run:
  k$ prove t/db_dependent/Serials.t
=> FAIL: Tests explode with the same kind of error!
6. Apply this patch
7. Restart plack
8. Repeat 3 through 6
=> SUCCESS: Henry added!
=> SUCCESS: No explosion about the SQL syntax in the logs
=> SUCCESS: Tests pass!
9. Sign off :-D

[1] https://dev.mysql.com/doc/refman/8.0/en/keywords.html

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit a4b9dcaf61)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 16:59:24 +00:00
Tomas Cohen Arazi e92dc8e7ad Bug 37476: Unit tests
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 3d76ccdf94)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 16:59:23 +00:00
Thibaud Guillot a963c6bc14 Bug 36196: Handling NULL data on ajax call
Test plan:

1) Update some data in your cities table, sample for one send:
"UPDATE cities SET city_state=NULL WHERE cityid=<id>"
2) Go on "/cgi-bin/koha/admin/cities.pl" and wait a entire life :)
3) Apply this patch
4) Rebuild your po files if needed
5) Reload the same page and now you get normally the datatable

Sponsored by: BibLibre
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit e0856d0db6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 16:57:11 +00:00
Mason James 90eef22575 Bug 37303: Update yarn.lock after adding new dependency to packages.json
use ./xt/verify-yarnlock.t test in BZ 37490 to confirm

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8ff9e665e4)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 16:49:30 +00:00
Jonathan Druart ca663e5377 Bug 37303: Replace po2json with a JS version
When using __() (ie. Gettext.js) we are seeing the translations that are marked as fuzzy.
This is definitely not the expected behaviour.

It happens because (our version of) po2json are old and no longer maintained,
and just embed them.

It seems that the bin we have has been upgraded to a JS version
(different authors).

Test plan:
(replace LANG with your language code)
0. Do not apply this patch
Edit misc/translator/po/LANG-messages-js.po
Mark a string as fuzzy
Edit ./intranet-main.tt and add the following lines inside $(document).ready
  console.log(_("Your string"));
  console.log(__("Your string"));
Replace "Your string" with the string you are actually testing.

Update the templates: `koha-translate --update LANG --dev kohadev && restart_all`

Go to the Koha home page, open the console.

=> Notice that the second log in the console is displaying the fuzzy string.

1. Apply this patch
Install the new version of po2json using `yarn install`
Repeat the previous steps.

=> With this patch applied both logs show the English version of the
string.

Remove fuzzy, update the templates and try again.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 4eb9816354)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 16:48:45 +00:00
Lucas Gass ca43567e86 Bug 37351: Rework checkbox JS to work with paginating dataTable
To Test:

1. Log in to staff client
2. Place items on items for borrowers
    2-1 Place enough holds as noted above
    2-2 Trap holds for borrowers
3. Open Circulation->Holds Awaiting Pickup (circ/waitingreserves.pl)
4. Click a checkbox for one or mroe holds
    Note->The 'Cancel selected (0)' button changes to 'Cancel
	selected (1)', etc.
5. Cancel selected Holds using the (Cancel selected (#) button)
6. Confirm Cancellation
7. Wait for background processes to complete, then verify holds are cancelled.
8. Return to Open Circulation->Holds Awaiting Pickup (circ/waitingreserves.pl)
9. Ensure button shows "Cancel selected (0)"
10. Click "Next >" to navigate to page 2 of holds
11. Click a checkbox for one or more holds
     Note->The 'Cancel selected (0)' button DOES NOT increase as boxes
	are selected.
12. Cancel selected Holds using the (Cancel selected (#) button)
13. Confirm Cancellation
14. Wait for background processes to complete, then verify holds are cancelled.
     Note-> Holds were not cancelled

15. APPLY PATCH
16. Try step 9-14 again. This time the 'Cancel selected (0)' button should update even when you paginate.
17. Make sure you try all the tables, Holds waiting, Holds waiting over X, Holds with cancellation requests.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit bbd1fa0bfa)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 16:46:00 +00:00
Nick Clemens 2dbf64d7ad Bug 37378: Tidy
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit a0f89e7e98)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 15:07:54 +00:00
Nick Clemens 7ec7fc7ce0 Bug 37378: libraries_where_can_see_things should always return an array
The subroutine libraries_where_can_see_things stores the list of libraries that things
can be viewed from in an internal variable, so we can return this directly if we have already calculated.

When returning if not cached, we dereference the list and return an array. If cached, we are returning
an arrayref. This patch simply ensures we dereference the array even if already cached.

Before this patch, we were fetching the patrons, then redacting all info as their branches didn't match against
an arrayref, rather than checking against each branch we are allowed to view.

To test:
1. Setup a library group and check the "Limit patron data access by group ." option.
2. Add some libraries to the group. ( IN k-t-d I added CPL and MPL )
3. Create a staff account who has staff access permissions and all of the borrower permissions except "view_borrower_infos_from_any_libraries"
4. Set the home library of that staff member to one of the branches in step 2. ( In my test I choose MPL )
5. Log in as that patron and attempt a patron search that would include users from either library in step 2.
6. See the error:

Something went wrong when loading the table.
500: Internal Server Error.
Expected boolean - got null.
Expected boolean - got null.
Expected string - got null.
Expected string - got null.
Expected string - got null.
Expected integer - got null.
Expected integer - got null.
Expected integer - got null.
Expected boolean - got null.
Expected boolean - got null.
Expected string - got null.

7. Apply patch, restart all
8. Search again, you can see the expected patrons

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit ebdf121a7d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 15:07:54 +00:00
Nick Clemens 998416c7a4 Bug 37378: Unit test
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit fb768ebbb8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 15:07:54 +00:00
Laura_Escamilla 1374290f7a Bug 37285: (QA follow-up) Perl Tidy
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit e7a017e663)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 15:06:09 +00:00
Baptiste Wojtkowski 0f8f20a01f Bug 37285: Printing lists only prints the ten first results
GIVEN koha in a version later than 22.11, a list with more than ten entries
WHEN the user tries to print the list
THEN only the ten first results are printed

EXPECTED THEN all results are printed

It looks like it is an undesired effect of BZ36858. Page remains set
even while printing, therefore, however the number of rows is not set,
default value (10) is used.

TEST PLAN

1 - create a list with more than 10 items
2 - print the list -> there is a pagination and that only 10 items
  are printed
Apply patch
3 - print the list again -> every items are being printed

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 64027daadc)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 15:06:09 +00:00
Catalyst Bug Squasher 59d8f236ad Bug 33455: Fix the size of the patron change password heading
The H1 heading on the patron change password page in the staff
interface is too big and should be outside of the area with
form area with the white background.

Test plan:
1. In the staff interface, click on top right of menu and navigate
   to my account.
2. Click the 'Change password' button.
3. Note that title is now outside the legend and font size is
   comparable to other H1 headings (e.g. Duplicate).

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 3eb461bc9b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 15:00:00 +00:00
Eric Garcia 012fd3d0c1 Bug 37435: Fixed renew patron from moremember.pl without circulate permissions
To recreate:
1. Have a staff account with limited permissions:
    -Staff access ( catalouge )
    -Add, modify and view patron information (borrowers)
    -NO circulate permissions
2. Log in as that staff user and find a patron with an expired account.
3. See the warning "Expiration: Patron's card has expired. Renew or Edit details".
4. Try clicking on Renew, you are logged out and see "Error: You do not have permission to access this page."

To test:
1. Apply patch
2. From the expired patron's details page see the warning and click Renew
3. Notice it renews the patron and returns to the patron details page
4. Details -> Edit -> Set the expiration date so that the patron is expired
5. Go back to your staff patron and check 'Check out and check in items' permission
6. In your expired patron's page -> Check out -> See warning -> Renew
7. Notice it renews the patron and returns to the check out page
8. Set the expired patron's expiration date so that it expires soon
9. Uncheck 'Check out and check in items' permission for your staff patron
10. Confirm the warning for your patron now is "Expiration: Patron's card expires on (DATE). Renew or Edit details"
11. Repeat steps 2-7 and notice it returns to the correct pages

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 39ff970544)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 14:55:08 +00:00
Brendan Lawlor efdebe7c2a Bug 37407: Fix automatic checkout for fast cataloging
This patch adds a check for the referrer to the circulation page.
If the referrer is from the same origin's additem.pl then get the
barcode from the url parameters, fill the form and submit.

Test plan:
1. Apply patch
2. Enter a barcode not in the system, eg 99999
3. Click '+ Add record using fast cataloging'
4. Fill required bib fields 000, 008 and 245a and click 'Save'
5. Add required item field y - Koha item type and click 'Add item'
6. Notice the barcode is filled and the form is submitted automatically
7. Confirm the item is checked out and the dutedate specified works
8. Add an html customization somewhere else in koha with a link like
   http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=38&barcode=99999&duedatespec=&stickyduedate=
9. Click on the link to simulate a csrf attack
10. Confirm the checkout page is loaded for that patron but no checkout is made

Signed-off-by: Eric Garcia <cubingguy714@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 620dbcde87)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 14:31:33 +00:00
Nick Clemens b9feb3655f Bug 34147: Load all categories for displaying patron results
Currently we are only loading unlimited categories into the patron search, so when we return
patrons from a category limited to another library we crash because we don't have the descriptions
loaded.

This patch removes the limit from 'categories_map' which is only used for displaying patrons. As patron
visibility is a feature of permissions and groups, I don't think we should enforce if based on category
limitations.

NOTE: the categories for searching are still limited in the left hand filters - but not in the dropdown if you click the options button in the top search form. This is beyond the scope of this bug.

To test:
1. Make sure you are logged in as Centerville
2. Do a patron search for 'Ac' -- there are two patrons: Henry (Staff) and Edna (Patron)
2. Go to Administration > Patron Categories
3. Edit the Patron (PT) category, set the Library limitations to Fairfield only
4. Do the patron search for 'Ac' again - it hangs up with a Processing box
5. Apply patch
6. Reload the page (clear cache) and confirm the results now load

Signed-off-by: Jason Robb <jrobb@sekls.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 476776cc5b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 14:28:42 +00:00
Kyle M Hall b507aad0cb Bug 36362: (QA follow-up) Tidy code
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit a62d39ea11)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 14:27:13 +00:00
David Gustafsson a409b16d5b Bug 36362: Only call Koha::Libraries->search() if necessary in Item::pickup_locations
To test:

1) Make sure the following tests pass:
 - t/db_dependent/Koha/Item.t
 - t/db_dependent/Koha/Biblios.t
 - db_dependent/Koha/Biblio.t

Sponsored-by: Gothenburg University Library
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 2c1e955621)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-29 14:00:51 +00:00
Emmi Takkinen 909987cd4d Bug 36129: Make check on "Hide all columns" persist on item patch modification/deletion
On item patch modification/deletion tool, if one checks
"Hide all columns" checkbox and then reloads the page,
checkbox is no longer selected. Columns are hidden as
they should. This patch adds line to batchMod.js which
sets "checked" attribute and class "selected" to checkbox.

To test:
1. Find items to modify/delete and modify/delete them with
corresponding tool.
2. Check checkbox "Hide all columns".
3. Refresh the page.
=> Note that columns are still hidden, but checkbox is now
unselected.
4. Apply this patch.
5. Check checkbox again and refresh page.
=> Checkbox should be still checked.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 1a154f1f0e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 21:04:59 +00:00
Owen Leonard 19dd5221f3 Bug 36566: Correct eslint errors in OPAC enhanced content JS
This patch fixes various eslint errors in enhanced content JS files:

- Consistent indentation
- Remove variables which are declared but not used
- Add missing semicolons
- Add missing "var" declarations

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

- Go to Administration -> System preferences and enable these
  preferences:
  - OPACAmazonCoverImages
  - BakerTaylorEnabled
  - GoogleJackets
  - OPACLocalCoverImages
  - OpenLibraryCovers
- Go to the OPAC and confirm that covers from these services appear
  correctly in search results and on detail pages.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 3d82116830)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 21:00:05 +00:00
Nick Clemens 4d141a6bb7 Bug 37425: Check for existence of biblio object before fetching cover images
This patch simply adds a conditional to ensure the biblio object has been retrieved and assumes no cover images otherwise

To test:
 1 - Enable system preference LocalCoverImages
 2 - Perform a search in staff interface
 3 - Find the biblionumebr for one of the results and delete it via the SQL backend:
     DELETE FROM biblio WHERE biblionumber=3;
 4 - Search again.
 5 - KO!
     Can't call method "cover_images" on an undefined value at /usr/share/koha/intranet/cgi-bin/catalogue/search.pl line 671.
 6 - Reindex, confirm error is gone
 7 - Apply patch
 8 - Search again
 9 - Delete a record from the results via SQL
10 - Reload and confirm no error
11 - Reindex and repeat search and confirm no error

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 8fdddccffb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:35:18 +00:00
Martin Renvoize 864d666424 Bug 37340: Restore sorting on 'Details' column in edifactmsgs
This patch restores the sorting options on the 'Details' field in the
edifact messages page.

We sort by basket_id followed by type behind the scenes, so the
resulting order for a Descending sort will group by basket id highest to
lowest with Quotes coming before Orders.

This is generally what the end user actually wants to see, even though
it may be somewhat unintuitive intially as it's not a clear alpha sort
for what's displayed in the column in the UI.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Mary Blomley <mary.blomley@uwl.ac.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit e828f5f839)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:33:26 +00:00
Lucas Gass f0c8b02c61 Bug 37383: Use libraries_where_can_edit_items to check if items are editable
To test:
1 - have a system with 2+ branches
2 - have a bib with 2+ items, all with holdingbranch=A
3 - set logged in library to A
4 - go to bib details page, confirm each item has an Edit button in the holdings table
5 - edit one item, set holdingbranch=B
6 - reload bib details page
7 - confirm the item now at branch B does not have an edit button
8 - APPLY PATCH and restart_all
9 - Try 1 - 6 again, this time you should see the proper edit buttons
10 - Set up library group:
    * Create a library group for library A + B
    * Action: Limit item editing by group
11 - Set up test user:
    * Create a staff patron with these permissions:
    * catalogue
    * fast_cataloguing
    * edit_items
    * view_borrower_infos_from_any_libraries
    * edit borrowers
* Home library: library A

12 - Set up test items:
    * Create a record with 3 items with different home libraries:
        * A
        * B
        * C

13 - We expect the use to be able to edit A and B, but not C.
14 - With the same user turn OFF the view_borrower_infos_from_any_libraries permission
15 - Behavior should not change, we expect the use to be able to edit A and B, but not C.
16 - Make sure StaffDetailItemSelection still works as expected for all users. With the sys pref on the checkbox should show up for superlibrarians and users with 'tools' permissions.

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 66c332a789)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:30:53 +00:00
PerplexedTheta bc109f73c4 Bug 37029: Remove 'About Koha' from intranet-main
This patch removes the 'About Koha' link as a module button, and
instead uses the 'Koha xx.xx.xx' version URL on the mainpage as a
shortcut to the 'About Koha' page.

Additionally, a link to the Koha Community website has been added to
the bottom of the 'About Koha' page, in the same place the 'Koha
xx.xx.xx' version URL appears on the mainpage.

To test:
a)  Log in to Koha's staff client
b)  Notice the 'About Koha' module button, and that the 'Koha xx.xx.xx'
    version URL goes to the Koha Community website.
c)  Notice that on the 'About Koha' page, there is no link to the Koha
    Community website.
d)  --> Apply patch <--
e)  Notice that the About Koha module button is now missing
f)  Notice that the 'Koha xx.xx.xx' version URL now goes to 'About
    Koha'
g)  Notice that on the 'About Koha' page, there is now a link for the
    Koha Community website at the bottom of the page.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 4743e4639a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:22:32 +00:00
Lucas Gass c870358e9d Bug 28762: (Rmaint follow-up) Adjust number of tests
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:20:34 +00:00
Victor Grousset/tuxayo 248f81ab49 Bug 28762: (QA follow-up): fix number of tests
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit a5710c49db)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:20:34 +00:00
Martin Renvoize 7e7cf605a9 Bug 28762: (follow-up) Fix missed not_for_loan_status rename
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 56621b9926)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:20:34 +00:00
Nick Clemens 41f690bca2 Bug 28762: (QA follow-up) Restore protection against unknown itemtypes
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 5ff47fc40c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:20:34 +00:00
Martin Renvoize 26d2a3e779 Bug 28762: Rename not_for_loan as effective_not_for_loan_status
This patch updates the method name to follow current conventions.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit fdefef1444)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:20:33 +00:00
Martin Renvoize f42b1a06e5 Bug 28762: Replace is_notforloan with not_for_loan
This patch replaces the use of is_notforloan with not_for_loan and
removes the older is_notforloan method and tests

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 4e6d9d13bf)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:20:33 +00:00
Martin Renvoize 656d39208b Bug 28762: Confirm return of not_for_loan in boolean context matches is_notforloan
This patch is simply here to prove that is_notforloan is just
not_for_loan but in a boolean context.. we'll remove it in the next
patch.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 0d5c224cc3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:20:33 +00:00
Martin Renvoize a38bac4814 Bug 28762: (follow-up) Remove warning in tests
Looks like a recent bug introduced a superflous warning, we just clean
that up here whilst we're in the code.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit e45a595996)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:20:33 +00:00
Martin Renvoize b550d2773e Bug 28762: Unit tests for not_for_loan accessor
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 99b800620e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:20:33 +00:00
Martin Renvoize a305339655 Bug 28762: Add test for new 'instructors' accessor
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit fdd6a01932)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:20:33 +00:00
Martin Renvoize c03137a051 Bug 28762: Move notforloan fallback into object
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 294447d07e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:20:33 +00:00
Martin Renvoize a950062723 Bug 28762: Update item-status include
This patch updates the item-status include so that it expects just an
item object making if simpler and more widely re-usable.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 8ff4d3740e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:20:33 +00:00
Martin Renvoize 140875e681 Bug 28762: Use Koha::Course in course-details controller
This patch updates Koha::Course to include the 'instructors' relation
accessor and then update the course-details controller to use the
Koha::Course object and pass it to the template instead of building a
hash using GetCourse.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 7f38c77d09)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:20:33 +00:00
Lucas Gass b79291db39 Bug 28762: (follow-up) fix template logic with Available
Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 316c14c1bf)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:20:33 +00:00
Lucas Gass 68831834bf Bug 28762: handle notforloan better
Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit e3e306efdb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:20:33 +00:00
Lucas Gass fcd49d218a Bug 28762: add staff item-status.inc and better handle statues on course-details.tt
This patch adds an item-status.inc to the staff side much like what is already in place on the OPAC.

To test:
1. create a course in course reserves, add an item to it.
2. confirm your item shows Available for its status on course-details.pl
3. edit your item to be withdrawn, lost, damaged, notforloan, and restricted use
4. reload course-details.pl, confirm it still shows available
5. apply patch
6. repeat step 3 with each of the statuses and make sure it correctly shows on course-details.pl

Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 38427cc357)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:20:32 +00:00
Martin Renvoize d4c114453f Bug 37374: (follow-up) Add csrf token and op to form
This patch adds a hidden op input and csrf token to the clubs hold
request form.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 83966f4273)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:09:48 +00:00
Sam Lau 938a38f4a2 Bug 37374: Fix functionality of 'Place hold' button for club holds
To test:
1) create a club
2) put 1 patron in your club
3) find a bib
4) Click Holds, then Clubs
5) search for your club, confirm hold detail
6) click Place Hold
7) nothing happens
8) Apply patch
9) Refresh page and click 'Place hold' again
10) Hold is properly placed

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 0f7d3fab6c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:09:47 +00:00
Brendan Lawlor 413e0d5701 Bug 26866: Sort items table on additem by cn_cort
This patch changes the data-order attribute for the item callnumber column
to use the item's cn_sort instead of the callnumber value.

Test plan:
1. Create a bib
2. Add three items with source of classification LLC
    call numbers:
    JC43 .G6 1890
    JC330 .F74 2000
    JC480 .R63 2006
4. On additem.pl sor the items table by 'Full call number'
5. Confirm the items are now ordered correctly by cn_sort
6. Confirm the other columns still sort correctly

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 033e9abc30)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:08:14 +00:00
Martin Renvoize e4f07f12ea Bug 37302: (follow-up) Update yarn.lock
We were having some issues with package building because we missed the
update to the yarn.lock file here.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 5c8baafc61)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:06:11 +00:00
Martin Renvoize 3274e2d680 Bug 37302: Add swagger-cli to devDependancies
This patch adds swagger-cli 4.0.4+ to the devDependancies section of
package.json. This should ensure it gets installed when appropriate

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 86938e11fb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:06:11 +00:00
Martin Renvoize dbbffa1023 Bug 37302: Set test to failed if swagger-cli missing
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit be3924a70f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:06:11 +00:00
Kyle M Hall d7e754ea3c Bug 37400 - In returns.pl don't search for a patron unless needed
In returns.pl we find a patron, then use it in an if statement.

Test Plan:
Cancel a hold with other holds remaining on the record.
No change should be noted.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 82535a4887)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:04:16 +00:00
Owen Leonard c20fede430 Bug 36885: Fix Bootstrap tooltip on budget planning page
This patch finishes the process of adding a Bootstrap tooltip to the
listing of funds which are locked.

To test, apply the patch and go to Administration -> Budgets.

- Edit a budget and make it locked: Check the "Lock budget" checkbox and
  save.
- View the budget you locked.
- From the toolbar, click Planning -> Plan by months.
- In the table of funds, hover your mouse over a fund.
- You should see a Bootstrap-styled tooltip, "Fund locked."

Signed-off-by: David Nind <david@davidnind.com>

Bug 36885: (follow-up) Correct popup hint

Bug 36885: (follow-up) Remove tooltip from unlocked budgets (copy-paste error)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit deb9bf78b8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:01:56 +00:00
Jan Kissig 0729ee131b Bug 37324: Self registration complete login form won't login user
This patch fixes the self registration complete login form which appears after a complete self registration process.

To test:
a) open http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=PatronSelfRegistrationDefaultCategory
b) set PatronSelfRegistration to allow
c) set PatronSelfRegistrationDefaultCategory to Self registration
d) logout or open a private tab
e) http://localhost:8080/cgi-bin/koha/opac-memberentry.pl and enter required fields
f) Registration complete! appears with a prefilled login form. Click Log in.
g) Check you are not logged in

apply patch and redo steps e-f and check that login worked.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 0988be4a59)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 20:00:20 +00:00
Lucas Gass 901c918ff4 Bug 29509: DBRev 24.05.03.002
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:58:39 +00:00
Kyle M Hall 95082c34db Bug 29509: (QA follow-up) Tidy atomic update
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 0505531cde)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:58:39 +00:00
Martin Renvoize b33b9b5f61 Bug 29509: (QA follow-up) Check top level permissions too
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 56c7c3782b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:58:39 +00:00
Martin Renvoize 435211adbc Bug 29509: Update swagger specification and add permissions to users
This patch removes the 'edit_borrowers', 'manage_bookings',
'lable_creator', 'routing' and 'order_manage' permissions from the list
of options in the patrons list endpoint.

We then assign the new 'list_borrowers' permission to any users who have
those removed permissions

Test plan
1) Apply patch and run the database update
2) Users with any of the permissions listed above should now also have
   the 'list_borrowers' permission too.
3) Check that patron searching continues to work from the various
   locations in the UI for the above affected users

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Incorporated second patch and removed 1<<4. 16 reads much better :)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 85ea79c45b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:58:39 +00:00
Emmi Takkinen 120d987d92 Bug 37399: Fix showing itemtype on holdings table
If syspref "noItemTypeImages" is disabled, holdings table won't display
itemtype column. This patch fixes this.

To reproduce:
1. Enable syspref "noItemTypeImages".
2. Find biblio with items.
   => Note that itemtype column is displayed on holdings table.
3. Disable syspref "noItemTypeImages".
   => Itemtype column is no longer displayed on holdings table.
4. Apply this patch.
   => Now column should be displayed correctly.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 313f7e86b8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:53:56 +00:00
Andreas Roussos 8add61d7f3 Bug 37226: append a random number to the `id` attribute of each <li>
When you view the authority details page for a term that contains more
than one terms with broader relationship, clicking on the expand/collapse
arrows next to the top-level terms in the hierarchy tree will not work
properly, i.e. *only one* broader term will show the narrower term under
it at any given time.

This is affecting both the OPAC and the Staff interface.

This is happening because in the HTML source of the page the individual
<li> elements associated with each node do not have unique `id` values,
which confuses the JavaScript library (jsTree) responsible for rendering
the hierarchy tree.

This patch fixes that by appending a random number to each `id` attribute.

Test plan:

0) Enable the AuthDisplayHierarchy System Preference (set to 'Show').

1) Copy the provided MARC21 Authority sample data (sample-data.mrc)
   to your KTD Koha container (it must have MARC21 marc flavour):

   docker cp sample-data.mrc koha-koha-1:/kohadevbox/

2) Import the provided authorities (the sample file contains three
   Geographic Name records):

   WARNING! the --delete switch is passed to bulkmarcimport.pl
   WARNING! this will erase any authority data you have in your instance!
   (this is done to retain the broader/narrower authid associations)

   misc/migration_tools/bulkmarcimport.pl --authorities --file=/kohadevbox/sample-data.mrc --verbose -c=MARC21 --delete -m=ISO2709

3) Visit the authority details page for 'Athens' in OPAC/Staff:

   http://localhost:8080/cgi-bin/koha/opac-authoritiesdetail.pl?authid=3
   http://localhost:8081/cgi-bin/koha/authorities/detail.pl?authid=3

   In the authority hierarchy tree, click the arrows next to 'Europe'
   and 'Greece' to expand and show the narrower term: notice how only
   one item works at any given time.

4) Apply the patch.

5) Repeat step 3) (refresh the pages) -- this time you should be able
   to view 'Athens' as a narrower term of both 'Europe' and 'Greece'
   at the same time.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 24e54b1fd4)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:44:22 +00:00
Eric Garcia d46f5ceaae Bug 37343: Fixed search for vendors when transferring an item in acquistions
To test:
1. Have several vendors in acquistions
2. Add a basket and click "+Add to basket"
3. I used an mrc file to add an order from a new file
4. Stage for import -> add staged files to basket
5. Select the items and choose an item type
6. In the Orders table click 'Transfer' under the 'Modify' column
7. Try searching for vendors, nothing happens.
8. Apply patch restart_all
9. Click 'Transfer' again and try searching for vendors.
10. Notice vendors appear

NOTE:
Vendor search is a GET operation not POST. Use 'do_search' instead of 'cud-do_search'.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 54575f3c30)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:43:10 +00:00
Matt Blenkinsop b7ec2d2131 Bug 29087: (QA follow-up): Fix QA tests
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Conform BZ comment31
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 7f5e1fac86)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:40:41 +00:00
Matt Blenkinsop a35333a327 Bug 29087: Add unit tests
prove t/db_dependent/Koha/Items.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 44d3762a69)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:40:41 +00:00
Jonathan Druart 34be9ab95b Bug 29087: Prevent filter_by_for_hold to crash if default holdallowed is not_allowed
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 8c804c1749)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:40:41 +00:00
Pedro Amorim 54e63c94d7 Bug 37260: Check message broker for both 'about' and 'sysinfo' tabs
Test plan:
1) Apply test patch only
2) Visit <staff_url>/cgi-bin/koha/about.pl
3) Notice it shows 'Using RabbitMQ' (it should show 'Using SQL polling')
4) Apply this patch, repeat 3)
5) Notice it now shows 'Using SQL polling'
6) Remove test patch. Notice it shows 'Using RabbitMQ' again.
7) Repeat test plan but for /cgi-bin/koha/about.pl?tab=sysinfo tab

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 6a321c6ee4)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:38:52 +00:00
Lucas Gass ce2f4219de Bug 37111: Fix renew link on opac-user.tt
To test:
1. Check some items out to a patron
2. Set the username and apssword for the patron so that you can log in as that patron.
3. Log in to the OAPC as that patron.
4. Go to Your account > Summary (the default landing page after you log in).
5. Click "Renew" for one of the items.
6. You get the error as above.
7. APPLY PATCH
8. Try steps 1 -5 again, you should not get an error.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Alexander Wagner <alexander.wagner@desy.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 58838fc263)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:36:00 +00:00
Lucas Gass 15316dda98 Bug 37111: Add submit-form asset to OPAC assets
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Alexander Wagner <alexander.wagner@desy.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 6c56d3d90b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:36:00 +00:00
Lucas Gass 26c27a59e9 Bug 37371: Move Maskito instantiation to onReady ( OPAC )
To test:
1. Find a any date picker in Koha, like DOB in the patron record.
2. Add a date, either manually or using the date picker.
3. Once there is a date like 07/15/2024 try to edit only part of the
   date, or the '15'.
4. The date easily becomes malformed.
5. APPLY PATCHSET, maybe clear your browser cache too
6. Try directly inputing dates. I would suggest the following places:

-Patron record DOB
-Specify due date on circ/circulation.pl as this includes time
-Add item screen, this is the dateaccessioned plugin
-OPAC self reg/self modify

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit bae3203f70)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:34:11 +00:00
Lucas Gass 89f5e8223c Bug 37371: Move Maskito init to onReady in dateaccessioned.pl
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit f723c33d48)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:34:10 +00:00
Lucas Gass 22e7e6f137 Bug 37371: Set overwrite mode to replace
In our case I think overwriteMode needs to be set to replace:

https://maskito.dev/core-concepts/overwrite-mode
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 0f04c9a26a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:34:10 +00:00
Martin Renvoize 26e5625b1d Bug 37371: Move Maskito instantiation to onReady
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 7e1de5b557)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:34:10 +00:00
Lucas Gass 6fc4f3fad9 Bug 37216: DBRev 24.05.03.001
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:26:52 +00:00
Emily Lamancusa 6a65701e22 Bug 37216: (follow-up) Clear invalid value
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 37683ffd69)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:26:51 +00:00
Martin Renvoize e6a48be025 Bug 37216: (QA follow-up) Add update to set existing options
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit fbcdce5e0a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:26:51 +00:00
Emily Lamancusa 5e5b3106b0 Bug 37216: Fix SQL for EmailFieldSelection
Test plan:
Part A: New installation
1. Start a fresh test instance
2. Set EmailFieldPrimary to "selected addresses", and do not touch
    EmailFieldSelection
3. Edit a patron to ensure the following fields are set:
   - Primary email
   - Secondary email
   - Alternate email
   - Enable email notices for item checkout
4. Attempt to check an item out to that patron
--> Koha explodes!
5. Apply patch
6. reset_all
7. Repeat steps 2-4
--> Checkout succeeds!
8. Ensure test plan for bug 12802 still passes

Part B: Upgraded installation
1. Start a fresh test instance at version 23.11
2. Switch to main
3. Install database update
4. Set EmailFieldPrimary to "selected addresses", and do not touch
    EmailFieldSelection
5. Edit a patron to ensure the following fields are set:
   - Primary email
   - Secondary email
   - Alternate email
   - Enable email notices for item checkout
6. Attempt to check an item out to that patron
--> Koha explodes!
7. Go back to 23.11 and reset_all
8. Switch to main and apply patch
9. Repeat steps 4-6
--> Checkout succeeds!
10. Ensure test plan for bug 12802 still passes

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 89a0c62da4)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-08-28 19:26:51 +00:00
Tomas Cohen Arazi 19682f614a
Update release notes for 24.05.03 release
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:17 -03:00
Tomas Cohen Arazi 08e2721c28
Increment version for 24.05.03 release
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:16 -03:00
Nick Clemens 4107765cdb
Bug 37508: Don't return Internal server error when running report
To test:
1 - Create a report like:
SELECT "a"
FROM borrowers
WHERE <<Test>> != ''
2 - Run report
3 - Enter "password"
4 - Internal server error / stacktrace
5 - Apply patch
6 - Repeat
7 - Get a yellow warning box

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:16 -03:00
Marcel de Rooy 4b32d4f531
Bug 37508: (QA follow-up) Use ->check_columns
Add shebang to Guided.t too.

Test plan:
See also previous commits.
Try sql like:
  select access_token from oauth_access_tokens

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:15 -03:00
Marcel de Rooy 6bbea258fb
Bug 37508: (QA follow-up) Move check to Koha::Report, extend
Do not allow password but allow password_expiry_days etc.
Do not allow token, secret and uuid too.

Test plan:
Run t/db_dependent/Koha/Reports.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:15 -03:00
Aleisha Amohia 133b17036b
Bug 37508: (follow-up) Don't pass the column or sql containing password
This patch replaces these variables with a non-translatable message.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:14 -03:00
Aleisha Amohia fe2be0330c
Bug 37508: (follow-up) Throw error is password is in SQL query at all
Confirm tests pass t/db_dependent/Reports/Guided.t

Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:13 -03:00
David Cook 91f7f79fe1
Bug 37508: Test for errors when returning an aliased password column
Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:13 -03:00
Aleisha Amohia 62874e328d
Bug 37508: Throw error if password column is detected in SQL report
This enhancement prevents SQL queries from being run if they would return a password field from the database table.

To test:

1. Run tests and notice they fail t/db_dependent/Reports/Guided.t

2. Apply patch and restart services

3. Create a public report with an SQL report which would access a password column in a database table
4. Try to run the report. Notice you are met with an error and the results are not shown.
5. Access the JSON URL, you should not get the results and should be shown an error
6. Confirm tests pass t/db_dependent/Reports/Guided.t

Sponsored-by: Reserve Bank of New Zealand
Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:12 -03:00
Tomas Cohen Arazi a9a81c97e4
Bug 37370: Return 400 if OpacExportOptions does not contain the passed format
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit a164c51d78f375d9d660e2c079cc7e05d2d1d326)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:11 -03:00
David Cook 8cda1a307d
Bug 37466: Add correct filter for sort_by in results.tt
This patch replaces the $raw filter with the correct uri filter
for the sort_by in results.tt

Test plan:
1. Apply patch
2. Go to /cgi-bin/koha/catalogue/search.pl?count=20&sort_by=popularity_dsc&idx=kw&q=1
3. Click on "Edit this search"
4. Note that the "Popularity (most to least)" Sort by option is selected
5. Go to /cgi-bin/koha/catalogue/search.pl?count=20&sort_by=popularity_dsc&idx=kw&q=24y24ty2498294t9824yt9y23
6. Click on "Edit this search"
7. Note that the "Popularity (most to least)" Sort by option is selected

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5148e05d408b43c0eb330683ffa4c26c90faa696)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:11 -03:00
David Cook 1401959db4
Bug 37464: Validate "type" sent to barcode/svc
This change validates the "type" sent to the barcode/svc. Without this
change, we pass the user input directly to GD::Barcode, which passes
the input into an eval{} block without any validation of its own.

Test plan:
0. Apply the patch
1. koha-plack --reload kohadev
2. Go to http://localhost:8081/cgi-bin/koha/svc/barcode?type=bad&barcode=123456
3. Note that a Code39 barcode is provided for an invalid type
4. Go to http://localhost:8081/cgi-bin/koha/svc/barcode?type=Code39&barcode=123456
5. Note that a Code39 barcode is provided
6. Go to http://localhost:8081/cgi-bin/koha/svc/barcode?type=UPCE&barcode=123456
7. Note that a non-Code39 barcode is provided (presumably UPCE)

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 73b0c3cf621250008845f22f7a36f90a48e00b06)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:10 -03:00
David Cook 838de7c597
Bug 37488: Validate paths in datalink.txt/idlink.txt files
This change validates the paths in datalink.txt/idlink.txt,
so that only images in the unpacked archive directory are allowed

Test plan:
0. Apply the patch
1. koha-plack --reload kohadev
2. Create a datalink.txt file with the following:
42,selfie.jpg
3. Create a jpeg at selfie.jpg
4. ZIP the datalink.txt and selfie.jpg files
5. Upload to the "Upload patron images" tool
(after enabling the "patronimages" system preference)
6. Note that the image uploads correctly

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 8fcb767fe2836c90ceacb5b5d8211524571eb8aa)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:09 -03:00
David Cook 8c948ee349
Bug 37323: Tidy
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 579c28c764257a250c12aa11207772c074c1335e)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:09 -03:00
Chris Cormack df3ecb46ed
Bug 37323: Don't allow symlinks in link files in zip and validate filepaths
Test plan:
0. Apply patch and restart/reload Koha
1. Test that uploading a patron image still works, in single file format and as a zip

Work as suggested

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 9bc0521493fbe2f9fe0dde051d0b2f52c8a14a9a)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:08 -03:00
Amit Gupta 7a15b321a3
Bug 37323: Escape characters in patron image picture upload
To Test
1. Create a file name for example: test.zip`curl xxxxtesting.informaticsglobal.com`.zip
   where the domain is one you can watch the logs from.
2. Go to Tools and click on Upload patron images choose option zip file and upload the file.
3. Check /var/log/apache2/access.log and see the curl with the IP
   "xx.xxx.xx.xxx - - [11/Jul/2024:23:10:33 +0530] "GET / HTTP/1.1" 200 267 "-" "curl/7.68.0"
4. Apply the patch
5. Repeat 2 and 3 step and check no error is coming for the Remote execution error.
6. Test uploading actual zip file and images still works.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5c931e00f73e91467581fd29721e5af8d7fa98ab)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:07 -03:00
Emmi Takkinen 8d1d824436
Bug 37255: Fix handling of "All" values on waiting hold cancellation policy
If one creates a default waiting hold cancellation policy with
patron categories set as "All" and itemtype set as "All", Koha
breaks on 500 error. This happens because in we try to match
template policy with "All" values either in category or itemtype
with *, not undef. This patch fixes this.

To test:
1. Create a new default waiting hold cancellation policy and
set both patron category and itemtype as "All".
2. Save policy.
=> Error page for error 500 is displayed.
3. Apply this patch.
4. Reload page.
=> Page is displayed and policy listing displays new policy
as it should.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:07 -03:00
Andreas Jonsson 29daece9bc
Bug 37533: Fix query in orderreceive.tt
The new validation in the REST API will no longer allow
the operator "in".  Consequently, it has to be replaced
with the allowed "-in".

Test plan:

 * Open an invoice and click "Go to receipt page" and
   on any basket click "receive" and make sure the dialog
   box appears.

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2024-08-12 15:35:06 -03:00
Lucas Gass 4ebbff7390 Generate release notes for 24.05.02 release
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 17:32:07 +00:00
Lucas Gass 576c5381cc Increment version for the 24.05.02 release
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 17:09:44 +00:00
Julian Maurice 64563441af Bug 37210: Properly escape SQL query parameters by using bind values
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 15:17:43 +00:00
Hammat Wele 23a83cf7c2 Bug 37210: Escape single quote in search string in overdue.pl
To Test:
1. Go to /cgi-bin/koha/circ/overdue.pl
2. In the «Name or card number» field, type «Tommy'and(select(0)from(select(sleep(10)))v)and'»
3. Apply the filter
   ==> It takes 10 seconds, sleep(10) is executed
4. Inspect the page, in «Patron category:» field, put «Tommy'and(select(0)from(select(sleep(10)))v)and'» in one of his option's value
5. select the option from the filter and Apply the filter
   ==> It takes 10 seconds, sleep(10) is executed
we can inject SQL to the followin field : borname, itemtype, borcat, holdingbranch, homebranch and branch
6. Apply the patch
7. Repeat step 1,2,3
   ==> it doesn't take 10 seconds, the injected sql is not executed
8. Repeat step 5
==> it doesn't take 10 seconds, the injected sql is not executed
9. Repeat step 5 with the followin field : itemtype, holdingbranch, homebranch and branch
   ==> it doesn't take 10 seconds, the injected sql is not executed

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 15:17:43 +00:00
Martin Renvoize ec20812852 Bug 36481: (follow-up) Add missing library_id parameter
The /libraries/{library_id}/cash_registers endpoint was missing the
library_id parameter definition from the swagger specification.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 466d38f18d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 15:10:22 +00:00
Martin Renvoize 51d15f7ca8 Bug 36480: (follow-up) Add missing library_id parameter
The /libraries/{library_id}/desks endpoint was missing the
library_id parameter definition from the swagger specification.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 6aadc4a423)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 15:10:22 +00:00
Tomas Cohen Arazi b4e3a0aaea Bug 37018: Add 400 response definition to all routes
This patch adds a test for well defined 400 responses on all verbs and
paths on the API spec.

The tests verify:

* Presence of 400 response definition
* The description must start with 'Bad request' (needs coding guideline)
* If DBIC queries are allowed on the route, then `invalid_query` needs
  to be mentioned in the description.

All routes get fixed to make the tests pass.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ yarn api:bundle
  k$ prove xt/api.t
=> SUCCESS: Tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 15:10:22 +00:00
Martin Renvoize e7b3d05bc7 Bug 37018: Clarify operators
This patch clarifies the list of operators both in the validate routine
and in the swagger descrption block where we document this feature for
the end user.

JD amended patch: tidy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 15:10:22 +00:00
Tomas Cohen Arazi b81b388db3 Bug 37018: Silence useless warning
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 15:10:22 +00:00
Tomas Cohen Arazi 21fd44f505 Bug 37018: Handle exception in unhandled_exception() helper
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 15:10:22 +00:00
Hammat Wele 803a554717 Bug 37018: (follow-up) adding some allowed operators
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 15:10:22 +00:00
Martin Renvoize d5f76c58e7 Bug 37018: Use validation in search_rs helper
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 15:10:22 +00:00
Martin Renvoize fea6c06878 Bug 37018: Add validation method to Koha::REST::Plugin::Query.pm
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 15:10:22 +00:00
Tomas Cohen Arazi dead285545 Bug 37018: Add Koha::Exceptions::REST
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 15:10:22 +00:00
Martin Renvoize 1e6def260e Bug 37018: Unit tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 15:10:21 +00:00
Tomas Cohen Arazi 194f48ab55 Bug 37018: Regression tests
This patch adds regression tests. With the current codebase, the
malicious query returns a 200. It should be caught and a 400 needs to be
returned.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/query.t
=> FAIL: It returns a 200
3. Once the rest of the patches are ready, repeat 2
=> SUCCESS: It returns a 400

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 15:10:21 +00:00
Jonathan Druart 3900bba48e Bug 37247: Fix display of "closed"
The subscription was not shown as closed after we closed it.
This is because "closed" is not passed to the template.
It seems more reliable to rely on the subscription object (that is passed to both
serials/serials-collection.tt and serials/subscription-detail.tt, the
others are not showing the Reopen/Close buttons)

Also fetch the subscription object after and reopen/close it to display
accurate values.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 14:24:53 +00:00
Fridolin Somers fc22f96aac Bug 37247: Fix subscriptions operation allowed without authentication
Move close and reopen after get_template_and_user().
Also move Koha::Subscriptions->find(), not a good idea to run DB queries
before authentication.

Test plan :
1) Apply patch
2) Authenticate to staff interface
3) Go to an existing open subscription
4) Open a new browser tab and use it to log-out
5) Go to first tab and click on 'Close'
6) You get login page
7) Authenticate
8) Check subscription is not closed
9) Check you can close and reopen subscription

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 14:24:53 +00:00
Jonathan Druart 62f80f1efe Bug 37146: Add tests
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 14:21:56 +00:00
David Cook 3a2a76726f Bug 37146: Prevent path traversal by validating input
This patch validates the plugin_name passed to plugin_launcher.pl
against the base path containing the "value_builder" directory.

Test plan:
0. Apply the patch
1. koha-plack --reload kohadev
2. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=29
3. Check that the tag editor for leader still works
4. Go to http://localhost:8081/cgi-bin/koha/cataloguing/additem.pl?biblionumber=29
5. Check that the pluginf or "Date acquired" still works

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 14:21:56 +00:00
Victor Grousset/tuxayo ffd03490ac Bug 36863: (QA follow-up): tidy up code
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 14:20:25 +00:00
Jonathan Druart 13e22ae52c Bug 36863: Deal with non-listed methods in CSRF plack middleware
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 14:20:25 +00:00
Jonathan Druart 5673e13c60 Bug 37074: Do no pass biblionumber
It is not used in the controller

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 14:08:54 +00:00
Owen Leonard e12b5150c6 Bug 37074: Comment approval and un-approval should be CSRF-protected
This patch converts the "Approve" and "Unapprove" controls in the staff
client's comment moderation page so that the operations are POST instead
of GET.

To test, apply the patch and restart services.

- If necessary, enable OPACComments and submit a few comments on a few
  titles in the OPAC
- Go to Tools -> Comments
- Test the process of approving, unapproving, and deleting comments

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-25 14:08:54 +00:00
Kyle M Hall f12ddeacbc Bug 37385: Fix Transfer not triggering automatically when cancelling a hold by checking in an item
Upadates for CSRF are inadvertently stopping AddReturn from being trigger
when a hold is canceled. This is necessary to generate the transfer
back to the originating library.

Test Plan:
1) Find item with a waiting hold, and check it in
2) In the popup notifying me of the waiting hold, select 'Cancel hold'
3) Note no second popup appears notifying you of the need to transfer the item to its home library
4) Apply this patch
5) Restart all the things!
6) Repeat steps 1-2
7) Second popup appears!

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 554efbe354)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-24 20:15:28 +00:00
Chris Cormack 1955ec2a7d Bug 37183: Batch edit serial subscriptions sets expiration date to today
Test plan:

Add some serials:
1) Add a new serial, visit:
   /cgi-bin/koha/serials/subscription-add.pl
2) Put a biblionumber in the 'record' field, e.g. '112'.
   Press 'next' and click 'ok' on the alert box.
3) Fill all the required fields and click 'test prediction'.
4) Fill the Subscription end date (= Expiration Date).
5) Click 'save subscription'.
6) Repeat steps 1-5 to create a second serial.

Batch edit serials:
1) Visit serials and hit the 'Search' button:
   /cgi-bin/koha/serials/serials-home.pl
2) Click the 2 checkboxes for the 2 serials we created
   previously and click the new link that pops up
   'Edit selected serials'.
3) Click 'Save' without changing anything.
4) Go back to either of the serials, notice the value
   for Expiration date is changed to TODAY
   (the date of the batch edit).

Apply the patch and retest the batch editing (before
retesting, change the expiration dates of the two
serials back to the original expiration date).

Note that the expiration date now only changes if you
enter a date in the 'Expiration date' field.

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 5a07a04fdb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-24 20:12:55 +00:00
Brendan Lawlor bf7e25afb6 Bug 37377: Fix orders search do_search param
This patch fixes the orders search in Acquisitions.

The form method is GET no need to prepend with cud-

Test plan:
1. Create an order that you can search for
2. Try order search, nothing happens
3. Apply patch restart all, refresh browser
4. Try order seach again and get results

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit f80cc53470)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-24 20:10:50 +00:00
David Cook 51ae7f9b3b Bug 36741: Skip auto_too_soon issues in auto renew digest
This change adds a line to skip auto_too_soon issues/checkouts
in the auto renew digest template.

Since auto_too_soon do not trigger notifications and don't require
any special action, let's skip them in the breakdown of checkouts in
the AUTO_RENEWALS_DGST email.

Test plan:
0. Apply the patch
1. reset_all (in koha-testing-docker)
2. Note the following line in the AUTO_RENEWALS_DGST template:
[% NEXT IF (checkout.auto_renew_error == 'auto_too_soon') %]

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 05432982cf)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 16:00:13 +00:00
Martin Renvoize 46dc45e60c Bug 28664: (follow-up) Throw exception if debt if VOID
This patch adds an exception when an attempt is made to refund against a
VOID debit.

Test plan
1) Run the included unit test

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.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 b18664ec45)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:53:36 +00:00
Martin Renvoize 7f2467cd50 Bug 28664: Prevent refunds against void lines
With the introduction of double entry accounting for VOID actions, we
need to add an additional filter to the 'Issue refund' button appearance

Test plan
1/ Add a debt
2/ Pay the debt
3/ Void the payment
4/ Confirm that with the patch applied the 'Issue refund' button doesn
not appear on the 'Void' accountline.

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 a47474e3d7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:53:36 +00:00
Sam Lau da490f117a Bug 37044: Added library branch to SCO OPAC message
This patch simply adds the correct branch at the end of an OPAC message on the SCO page.

To Test:
1) From the staff interface, click on a patron and add an OPAC message
   to their account.
2) Log into the SCO with this patron.
   (http://localhost:8080/cgi-bin/koha/sco/sco-main.pl)
3) Notice how in the "Messages for you" at the top, you will see the
   message, however, at the timestamp, it says something like "Written
   on 06/06/2024 by " w/o listing the library that sent it.
4) Apply patch
5) Log back into SCO module
6) Note that now in the message timestamp, it correctly lists the
   library that sent the message.
7) Sign-off

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4801037abe)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:50:22 +00:00
Owen Leonard 4e5a77fb9b Bug 37002: Correct several HTML markup errors
This patch makes several minor corrections to HTML markup in the
bibliographic detail page template and related include files. This
corrects the following validator errors:

- Stray end tag a.
- Bad value true for attribute disabled on element select.
- Bad value true for attribute disabled on element input.
- No space between attributes.
- Duplicate attribute class.
- The value of the for attribute of the label element must be the ID of
  a non-hidden form control.

The patch is simple enough that an inspection of the patch is probably
enough, but following is a detailed test plan of the affected areas:

- Apply the patch and view the bibliographic detail page in the
  staff interface.
- Under the "Edit" menu in the toolbar, these options should still work
  correctly:
  - Modify record using template
  - Edit items in a batch
  - Delete items in a batch
- Click the "Items" link in the sidebar and find the "Bookable" setting
  for the title's items. Make at least one item bookable and return to
  the detail page.
- Click the "Place booking" button in the toolbar and confirm that you
  can successfully place the booking.
- If you have access to Novelist, confirm that Novelist content displays
  correctly on the detail page.
- Turn on the "EnableItemGroups" preference.
- On the detail page, open the "Item groups" tab and click the "New item
  group" button.
  - In the modal, the "Name" and "Display order" labels give focus to
    the corresponding form field when clicked.
  - Create an item group.
- Under the holdings tab, select one or more items and click "Add/move
  to item group".
  - In the modal, clicking the "Item group" label should give focus to
    the dropdown.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 928681a24c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:45:48 +00:00
Matt Blenkinsop 29ba527b74 Bug 36895: Fix background job link
This patch fixes the missing job id in the links from the import KBART file page

Test plan:
1) Import a KBART file to get the message at the top of the screen.
2) The message should include a link on the text "see progress"
3) Click the link, it should just take you to the background jobs page
4) Apply patch
5) yarn build
6) Hard refresh the browser
7) Repeat steps 1-3
8) It should correctly take you to the background job

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit dc154e3dd2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:43:59 +00:00
Owen Leonard 1ad2dd1a6a Bug 36909: Eliminate duplicate ID in cookie consent markup
This patch changes markup and CSS in the OPAC and staff client to
eliminate HTML validator warnings about duplicate ids.

To test, apply the patch and rebuild all CSS (Bug 36909: Eliminate
duplicate ID in cookie consent markup).

- If necessary, set the "CookieConsent" system preference to "Require."
- Open the OPAC in a new private window (to prevent previous consents
  from hiding the consent messages).
- You should see a cookie consent bar across the bottom of the page. It
  should look correct, and its contents should reflow well at various
  browser widths.
- Click "Accept all cookies."
- In the header you should now see a "Your cookies" link.
- Click it and confirm that the contents of the modal look correct and
  reflow well at various browser widths.

- Perform the same tests in the staff interface.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 984960351e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:34:35 +00:00
Martin Renvoize 84814bbef3 Bug 37198: Improve GetPreparedLetter documentation
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 149412cb62)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:32:34 +00:00
Fridolin Somers 0d343979bd Bug 36141: Add classes to CAS text on OPAC login page
This enhancement makes it easier for libraries to change the CAS-related messages on the OPAC login page.

It moved the invalid CAS login message above the CAS loging heading,
like for Shibboleth login.

Test plan :
1) Enable system preference 'casAuthentication'
2) Restart all caches (restart_all in koha-testing-docker)
3) Go to OPAC, logged out
4) Click on 'Log in to your account'
5) In the staff interface, edit the OPACUserJS system preference. Add the following JS and Save:
   $(".cas_invalid").text("Test changing the invalid CAS login message.");
   $(".cas_title").text("Test changing the CAS login heading.");
   $(".cas_url").text("Test changing the CAS account link text.");
   $(".cas_url").after(' <i class="fa fa-globe" aria-hidden="true"></i>');
6) Refresh the OPAC and confirm the text changes to reflect your JS.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0e1289d014)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:31:00 +00:00
Owen Leonard 4b1baa722b Bug 36911: (follow-up) Add markup comments
This patch adds comments to the template to highlight the markup
structure.

This patch should have no effect on the page's appearance or
functionality.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8d898f1746)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:29:30 +00:00
Owen Leonard 3f561bd2be Bug 36911: Reindent circ-menu.inc
This patch reindents the circ-menu include file so that it has
consistent indentation. These changes should have no visible effect on
the page.

To test, apply the patch and enable the 'CircSidebar' system
preference if necessary.

- View any circulation page, including the checkout page, to confirm
  that the left-hand sidebar menu is unchanged.
- Test with the 'patronimages' system preference both on and off.

Viewing the diff while ignoring whitespace changes should show only
places where a line break was added.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 002fbdcc62)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:29:29 +00:00
Kyle M Hall 6d9aab06d4 Bug 36498: Tidy cataloguing/additem.pl
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0877dfd16d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:23:51 +00:00
Lucas Gass 57d5ef60de Bug 36498: Add ability to set item group display order from additem.tt
To test:
1. Apply patch, restart_all
2. System preferences -> EnableItemGroups, set to 'Enable'.
3. Find a record and create at least 1 item group.
4. Go to Add item
5. Scroll to the bottom and look for 'Options' underneath 'Add to item group'
6. In the dropdown select 'Create new item group'
7. There should be fields for 'Name' and 'Display order'.
8. Make sure you can add a new item group with and without a display order set. If no display order is set it should default to 0.
9. Try to add a non numerical display order, you should not be able to.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 49c55a03e7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:23:51 +00:00
Martin Renvoize ed17a680ac Bug 36128: (QA follow-up) Add regression test
This patch adds a simple regression test to ensure we don't re-introduce
the errant warning.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 18c97c1456)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:21:50 +00:00
Denys Konovalov 319f954c21 Bug 36128: Use of uninitialized value in string eq at /usr/share/koha/lib/C4/Overdues.pm
Fixes the following error message when running the overdues check cronjob on a
Koha system without defined overdue rules:

/etc/cron.daily/koha-common:
Use of uninitialized value in string eq at /usr/share/koha/lib/C4/Overdues.pm
line 686.

by checking if the variable is defined before comparing it.

Test plan:
1. Go to Tools - Overdue notice/status triggers and verify that for every single
   patron type for both Default and every individual library, you have no value
   set for Delay, so that you will never send anyone an overdue notice
2. Run the cron job which creates and sends overdue notices
3. Confirm the above mentioned error no longer appears

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4c8586270a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:21:50 +00:00
Eric Garcia 27cbe1d0cf Bug 35240: Add missing IDs to input
1. Tools -> Rotating collections -> Edit collection
2. Use browser dev tools to notice that the inputs don't have matching
   IDs
3. Apply patch
4. Do step 2 again and notice IDs are no longer missing.
5. Sign off :)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 21a66bf17c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:19:57 +00:00
Pedro Amorim 519aa84d2b Bug 30372: Fix value->attribute
Test plan:
- Activate patron self registration without email verification
- Create several patron attributes as visible and editable in the OPAC, make one mandatory
- Register as a new patron from the OPAC
- Fill in all required fields but the extended attribute
- Fill in at least one of the non-required extended attributes
- Submit
- Verify that the contents of the other extended attribute fields are still present.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4616ddc8ab)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:17:57 +00:00
David Cook 5bd5de1f1e Bug 36966: Actually fix data-link for local cover images
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5b5a50f0cd)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:15:52 +00:00
David Cook 3ece9f1381 Bug 36966: Fix data-link for local cover images
This patch fixes the data-link so that the "edit" link at the
bottom of the lightbox viewer correctly takes the user to
the editor interface for the local cover image

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e0e179f806)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:15:52 +00:00
David Cook 5d40de56b3 Bug 36966: Fix local cover image links for items
This change fixes the local cover image links for items by removing
unnecessary parameters, an invalid link, and an uninitialised
Template::Toolkit variable.

Test plan:
0. Apply patch
1. Enable syspref 'LocalCoverImages'
3. Go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=29
4. Click on the dropdown next to "Edit" at the item level
5. Upload an image for the item
6. Note that the local cover image appears in the holdings table
7. Click on the image and note that it loads in the light box
8. Success!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4183b073e6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 15:15:52 +00:00
Jan Kissig 4108cb43c3 Bug 36880: Record overlay rules are not validated
This patch fixes validation of rules, confirmation on deletion of rules and removes some unused source code.

1) Validation of record overlay rules on edit and add action
2) Validation when editing an existing rule
3) Adds confirm when deleting multiple rules

Test plan:
1)
 a) open http://localhost:8081/cgi-bin/koha/admin/marc-overlay-rules.pl
 b) just click + Add rule
 c) a new rule with an empty tag is saved

2)
 a) edit an existing rule
 b) empty input value for tag
 c) click Save and check that the rule has now an empty value for tag

3)
 a) delete a rule by checking the checkbox and clicking Delete selected
 b) delete a rule by clicking the Delete button under Actions
 c) notice that b) asks for confirmation

apply patch
1) redo steps and check that form does not get submitted and the input is marked as required

2) redo steps and check that clicking on Save will not submit the form and mark input as required

3) redo steps and check that a standard confirm popup appears

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 909a72c58f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 14:35:16 +00:00
Hammat Wele 5193b6d570 Bug 37157: Fix Malformed UTF-8 character in JSON string before decode_json
When we add a new identity provider and put some special characters in the Config or Mapping field, we got 500 error when we list the identity providers

To test:
1. Apply this patch.
2. Add a new identity provider
    2.1. fill the form
    2.2. click on «Add default Oauth configuration» and on «Add default Oauth mapping»
    2.3. put some special characters in Configuration and Mapping field
3. Save the form
=> Confirm the identity providers list is shown correctly

Also prove t/db_dependent/api/v1/provider.t.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 55b892dca4)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 14:32:44 +00:00
Andreas Jonsson 82f15de4fb Bug 37016: Invalid due date in SIP renew response
Test plan using koha-testing-docker:

1) Make sure SIP is running.  You may need to edit
   /etc/koha/sites/SIPconfig.xml and remove the 8023 connector and
   restart the SIP-server (koha-sip --restart kohadev)
2) Find a patron, say 23529000197047
3) Set a password by selecting "change password", set it to
   "Password1234"
4) Find a book, say 39999000000856
5) Issue book to patron with sip-client:
   sudo koha-shell -c "/usr/share/koha/bin/sip_cli_emulator.pl \
                      --address localhost --port 6001 -t cr \
                      --su term1 --sp term1 --message checkout \
                      --location CPL --item 39999000000856 \
                      --patron 23529000197047 --password Password1234"\
                      kohadev
6) Note the AH-header in the response which for example:
   'AH20240619    235900'
7) Make a renewal with:
   sudo koha-shell -c "/usr/share/koha/bin/sip_cli_emulator.pl \
                      --address localhost --port 6001 -t cr \
                      --su term1 --sp term1 --message renew \
                      --location CPL --item 39999000000856 \
                      --patron 23529000197047 --password Password1234"\
                      kohadev
8) Make sure the AH-header in the response is different from the
   response to the checkout, for example: 'AH20240624 235900'

Signed-off-by: Tadeusz „tadzik” Sośnierz <tadeusz@sosnierz.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3295fd5227)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 14:30:10 +00:00
Nick Clemens 707fd46925 Bug 37016: Unit tests
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6aa2198965)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-19 14:30:09 +00:00
Emily Lamancusa 72b4a36645 Bug 37332: Fix unseen and customer renewal date parameters in svc
To test:
0. Enable unseen renewals
    i. Set the system preference UnseenRenewals to Allowed
    ii. Edit the circulation rules to specify the maximum number of
        unseen renewals allowed
1. Check out an item to a patron
2. In the checkouts table on that patron's account, check the "Renew"
   checkbox for that item
3. Select a custom renewal date using the Renewal due date flatpicker
4. Check the checkbox labeled "Renew as unseen if appropriate"
4. Click Renew selected items
--> The item renews, but its new due date follows the renewal period
    specified in the circulation rules, regardless of what date was
    entered in the Renewal due date field
--> The checkout still has all of its unseen renewals remaining,
    indicating that the renewal was not processed as an unseen renewal
5. Enter another custom renewal date and renew checkout with the Renew
   all button
--> Same result
6. Apply patch and restart_all
7. Repeat test plan
--> Custom renewal date is now respected
--> Number of unseen renewals remaining decreases when "Renew as unseen"
    checkbox is checked
8. Renew the item with the "Renew as unseen" checkbox unchecked
--> Confirm that number of unseen renewals is reset (i.e. the checkout
    once again has all of its unseen renewals remaining), indicating
    that the renewal was processed as a "seen" renewal

Signed-off-by: CJ Lynce <cj.lynce@westlakelibrary.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit baa6814753)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 21:53:53 +00:00
Lucas Gass 75a77a3c82 Bug 37345: Only toggle_onsite_checkout() if OnSiteCheckoutAutoCheck is enabled
To test:
1. Find an item to checkout and a patron to check out to.
2. Set a due manually: "Specify due date (MM/DD/YYYY):"
3. Before checking out click the "Remember for session:" checkbox.
4. Check the item out.
5. The specific due date is not retained.
6. APPLY PATCH
7. Try 1 -4 again, now the date should be sticking.
8. Turn on the OnSiteCheckouts system pref and make sure it still works
9. Turn on the  OnSiteCheckoutAutoCheck system pref and make sure the on-site checkbox is still checked after doing an on-site checkout.

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 3276e0fa0c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 21:52:12 +00:00
Phan Tung Bui fe29c2551f Bug 36527: Patron category or item type not changing when editing another circulation rule
Plan test :
1. Go to Administration > Circulation and fine rules
2. Add a couple of rules with various patron category/item type
   combinations
3. Click on "Edit" next to one of the rules
   --> The line should become highlighted in yellow and the values
       should be copied in the very last row
4. Click on "Edit" next to another rule
5. Click OK in the browser dialog box to confirm you want to edit
   another rule
   --> Depending on the rules, the values for the patron category
       and/or item type might not change in the editing row
6. Repeat steps 4 and 5
   --> The patron category and item type do not always change
7. Apply the batch
8. Redo step from 3 to 6
9. Observe that category and item type change accordingly

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7e8502e087)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 21:30:39 +00:00
Lari Strand 5d059209f7 Bug 36982: Collections facet does not get alphabetized based on collection descriptions
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 83762f6fee)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 20:33:02 +00:00
Tomas Cohen Arazi 500b272632 Bug 37182: Make Koha::Statistic->new preserve 'datetime' if passed
This patch does what the title says. This behavior is tested on the
previous patch. Tests are also added for the background job (which
relies on Koha::Statistic->new and was the evidence of this
overwrite behavior).

To test:

1. Apply the regression tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Statistic.t \
           t/db_dependent/Koha/BackgroundJob/PseudonymizeStatistic.t
=> FAIL: Tests don't pass :-/
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 65375bc34d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 20:26:59 +00:00
Tomas Cohen Arazi 9da2b8b604 Bug 37182: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 386cedeb73)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 20:26:59 +00:00
Phil Ringnalda 4085efac23 Bug 37163: Fix the redirect after deleting a tag from an authority framework to load the right page
When you delete a tag from an authority framework, we intend to redirect you
right back to where you were, on the same page of tags, but because we pick
the wrong variable to set searchfield in the URL, we send you to the first
page instead.

Test plan:
1. Without the patch, Administration - Authority types - in the row for
   CHRON_TERM Actions menu, MARC Structure
2. In the Search for tag: input, type 092 and hit Enter
3. In the row for 092, Actions menu, Delete, in the page that loads click
   Yes, delete
4. In the page you are redirected to, note that you are at Tag 000, and the
   URL is ?searchfield=&authtypecode=CHRON_TERM
5. Apply patch, restart_all
6. Type 092 and hit Enter, Actions menu for the 093 row, Delete, Yes, delete
7. Note that now you have gone to the page where 093 used to be, because
   the URL is ?searchfield=092&authtypecode=CHRON_TERM and you can just
   keep deleting 09x tags one after another

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d3401535b5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 20:25:04 +00:00
Phil Ringnalda f18a07967d Bug 37162: Remove the [% IF ( delete_confirmed ) %] stuff in auth_tag_structure.tt
Since auth_tag_structure.pl redirects after deleting when the op is
delete_confirmed (which is actually cud-delete_confirmed) rather than loading
the template, there's no reason to have dead code for IF ( delete_confirmed )
which is both never set, and is never called when anything like it is set.

Test plan:
1. With the patch applied, Administration - Authority types - Chronological
   Term row - Actions menu - MARC Structure
2. You've already verified that auth_tag_structure.tt isn't malformed, but for
   extra fun choose a tag, Actions menu - Delete - Yes, delete and verify that
   it was deleted

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f9e602ce98)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 20:20:41 +00:00
Phil Ringnalda 98f61265ea Bug 37161: After deleting a tag in a MARC framework, redirect back to the tag list rather than showing a 'Tag deleted' page first
Currently after you delete a tag from a MARC framework, Koha intends to show
you a page with the text "Tag deleted" and an OK button to click to go back to
where you were in the list of tags. But because that depends on the template
variable being set for the name of the op in the script, and the name of the
op is "cud-delete_confirmed" which isn't a legal TT variable name, nothing is
set to tell the template what to display, so it displays a mostly-blank page.

Far better to show, don't tell, and just redirect to the list of tags like
deleting a tag from an authority framework does.

Test plan:
1. Without the patch, Administration - MARC bibliographic frameworks -
   Binders row - Actions menu - MARC structure
2. Type 092 and press Enter in the Search for tag: input
3. 092 row - Actions menu - Delete - Yes, delete this tag
4. Stare blankly at the blank page with only a header
5. Apply patch, restart_all
6. Administration - MARC bibliographic frameworks - Kits row - Actions menu -
   MARC structure
7. Type 092 and press Enter in the Search for tag: input
8. 092 row - Actions menu - Delete - Yes, delete this tag
9. Enjoy the sight of the Kits framework showing a search for 092 that
   doesn't show one, because you just deleted it, and now you can delete
   the 096 tag next

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Eric Garcia <cubingguy714@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 825c6c5edf)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 20:18:43 +00:00
Phil Ringnalda d3383fed5c Bug 36891: Restore returning 404 from svc/bib when the bib number doesn't exist
Changing from GetMarcBiblio to Biblios->find plus metadata->record lost the
way that svc/bib used to return 404 when the bib number wasn't found. This
patch restores that by checking for undef after the Biblios->find step.

Test plan:
1. Load e.g. http://127.0.0.1:8081/cgi-bin/koha/svc/bib/289 which returns an
   XML bib record
2. Load http://127.0.0.1:8081/cgi-bin/koha/svc/bib/99999999 and get a 500 error
2. Appply patch, restart_all
4. Reload http://127.0.0.1:8081/cgi-bin/koha/svc/bib/289 and get the bib again
5. Reload http://127.0.0.1:8081/cgi-bin/koha/svc/bib/99999999 and get a 404

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3d1b38b0ad)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 20:12:47 +00:00
Katrin Fischer 3dc5bd07d5 Bug 25387: (follow-up) Slightly change wording of alert
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1004d47d00)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 20:03:17 +00:00
Nick Clemens 39449c76c4 Bug 25387: (QA follow-up) Tidy
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4c677600f2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 20:03:17 +00:00
Marion Durand 8e7ea9baaf Bug 25387: Warn when merging different authority types
Merging two different authorities types can result in the loss of some
field. This patch adds a warning when merging different type of
authorities and add more display of authorities types during merge.

To test:
1- Find two authorities you what to merge. Be sure that these
authorities have different type
2- Search for these authorities (be sure to have both results on the
results page)
3- For the first authority click on "Actions" then on "Merge", same for
the second one
4- Check that koha is asking you to choose a framework and that
authority types are not displayed
5- Choose a framework, then click on next
6- Check that the authority type is not displayed in the tabs and that
no warning appear
7- Apply the patch
8- Repeat step 1 to 3 again
9- Check that authority type is now displayed next to their ID
10- Repeate setp 5 again
11- Check that the authority types is now displayed in the tabs next to
their ID and that a warning appear

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b2ae5380b0)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 20:03:17 +00:00
David Cook 591da06a39 Bug 33563: Add comments for Elasticsearch security config
This patch adds some commented Elasticsearch security configuration,
which shows how to use username/password with HTTPS.

Test plan:
0. Apply patch
1. cp debian/templates/koha-conf-site.xml.in /etc/koha/koha-conf-site.xml.in
2. koha-create --create-db test
3. vi /etc/koha/sites/test/koha-conf.xml
4. Note that the comments for userinfo and use_https are in the koha-conf.xml

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised.
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ce90d65603)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:57:49 +00:00
Phil Ringnalda a1530f20b1 Bug 37165: Can't edit frequencies due to stray cud- in modify op
The op modify in subscription-frequencies.pl isn't a cud- operation, it's
a GET of the editing form, so it shouldn't have been changed to cud-modify.

Test plan:
1. Don't apply the patch yet
2. Serials - Manage frequencies - for any frequency click Edit
2. Note that the editing form is empty
3. Apply patch, restart_all
4. Repeat step 2, note that now the editing form has the existing data
5. Change anything, Display order is nice, and save to verify that
   cud-savemod still works

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 96d1ad65b4)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:55:40 +00:00
Phil Ringnalda 31478431f5 Bug 37152: Aquisitions basket and OPAC suggestion deletion should use the op cud-delete
Both deleting a basket in Aquisitions and deleting a suggestion in the OPAC
take care of the confirmation in a javascript modal, rather than having a
whole separate page for confirmation, so they should be using the op
cud-delete rather than either cud-delete_confirm (which shouldn't ever be
used) or delete_confirm (which they aren't doing, they already confirmed).

Test plan:
1. There's no wrong behavior to see, so apply patch and restart_all
2. Aquisitions - Vendor search for My Vendor - Click My Basket
3. Click Delete basket, in the popup again Delete basket
4. Click Show baskets for vendor My Vendor and verify the basket is gone
5. OPAC - Your account - Purchase suggestions
6. Create a suggestion, then click the checkbox for it, Delete selected,
   confirm
7. Verify the suggestion was deleted

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit fb9edbcf5c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:52:37 +00:00
Phil Ringnalda 70458e3de7 Bug 37152: Deleting patron categories doesn't warn about categories in use
You can't delete a patron category when it is in use, but because the
script which handles delete confirmation is expecting the wrong op,
cud-delete_confirm rather than delete_confirm, you don't get any warning,
just a failure to delete error message.

Test plan:
 1. Without the patch, Administration - Patron categories
 2. On the row for Staff, click Delete, Delete this category
 3. Note an error message telling you to check the logs for details
 4. Apply patch, restart_all
 5. With the patch, repeat steps 1-2, note that instead of a button for
    Delete this category you get a warning that it is in use
 6. In the list of categories, row for Board, click Delete, Delete this category
 7. Note that the (unused) Board category was deleted

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d913d5ab79)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:52:37 +00:00
Phil Ringnalda 4c4126bdb7 Bug 37152: Deleting framework tags expects a cud-delete-confirm op instead of delete-confirm
The scripts for managing biblio and authority framework tag editing are
expecting an op of cud-delete-confirm, but the op that is passed is the
correct thing, delete-confirm, because it's a GET of a page where the
confirmation will happen, not the later cud- operation. You can only see
that the expected op is wrong because the confirmation page doesn't get
the description of the tag.

Test plan:
 1. Without the patch, Administration - MARC bibliographic framework
 2. Default framework Actions menu, MARC structure
 3. In the row for 025, Actions menu, Delete
 4. Note that the page which loads shows "Tag: 025" and "Description:"
    without actually having a description
 5. Administration - Authority types
 6. Default authority type Actions menu, MARC structure
 7. In the row for 046, Actions menu, Delete
 8. Note that the page that loads shows "Tag: 046" without the tag description
 9. Apply patch, restart_all
10. With the patch, repeat steps 1-8, but this time note that you see the
    description of the tag, not just the number. For both, click Yes, delete,
    and verify that the tag is deleted.

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 11f5db2641)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:52:37 +00:00
Phil Ringnalda 0f86951b3c Bug 37152: Can't delete an Acquisitions contract
admin/aqcontract.pl expects the op cud-delete-confirm, but what's sent is
the op delete-confirm because it's just a GET of the page that will actually
do a cud op once it is confirmed.

Test plan:
1. Without the patch, Acquisitions - Vendor search for My Vendor
2. Left Sidebar menu - Contracts - Add a contract
3. Fill in Name, Start date, End date, Save
4. On the line for the contract, click Delete
5. Note that the page that loads has no button for "Yes, delete contract"
   (or for anything else)
6. Apply patch, restart_all
7. Acquisitions - Vendor search for My Vendor
8. Left Sidebar menu, Contracts, click Delete, then Yes, delete contract
9. Vendor search for My Vendor, Left Sidebar Contracts, verify the contract
   is gone

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2fe6305bd7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:52:37 +00:00
David Nind 58e831ce63 Bug 32313: Update guided reports column descriptions for items and biblioitems tables
This adds missing column descriptions to the items and biblioitems
tables (used in guided reports for the Circulation, Catalog,
Acquisitions, and Serials modules).

It also updates some existing descriptions for consistency, removes
biblioitems columns that no longer exist, and sorts items and statistics
descriptions in the source file in alphabetical order.

Test plan:
1. Go to Reports > Guided reports > Create guided report.
2. Choose 'Catalog' for the module to report on, and then select
   'Next'.
3. Choose 'Tabular' for the type of report and select 'Next'.
4. Note that there are no descriptions for these column names
   (proposed column names shown in brackets):
   - items.itemnumber (Koha item number (autogenerated))
   - items.biblionumber (Biblio number (internal))
   - items.bookable (Bookable)
   - items.localuse (Total local uses)
   - biblioitems.ean (EAN)
   - biblioitems.collectiontitle (Series statement)
   - biblioitems.collectionissn (Series ISSN)
   - biblioitems.collectionvolume (Series volume)
   - biblioitems.editionstatement (Edition statement)
   - biblioitems.editionresponsibility (Edition responsibility)
   - biblioitems.cn_source (Source of classification or shelving scheme)
   - biblioitems.cn_class (Classification part)
   - biblioitems.cn_item (Item part)
   - biblioitems.cn_suffix (Call number suffix)
   - biblioitems.cn_sort (Koha normalized classification for sorting)
   - biblioitems.totalissues (Koha issues (borrowed), all copies)
5. Apply the patch.
6. Restart all the things (restart_all).
7. Reload the page.
8. Note that there are now descriptions for the columns in step 4.
9. Note that the descriptions for these columns are changed (for
   consistency with other tables, or clarification):
   - items.itype => Koha item type (previously Koha itemtype)
   - items.timestamp => Modification date (previously Timestamp)
   - biblioitems.timestamp => Modification date (previously Timestamp)
   - biblioitems.illus => Other physical details (previously
     Illustrations)
   - biblioitems.biblioitemnumber => Biblio item number (internal)
     (previously Biblioitem number)
   - biblioitems.biblionumber (and also acqorders.biblionumber and
     biblio.biblionumber) => Biblio number (internal)
     (previously Biblio number)
10. Sign off :D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Eric Garcia <cubingguy714@gmail.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 50035288b0)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:47:01 +00:00
Martin Renvoize 5e69aef19d Bug 37003: (follow-up) Amend 22.11 RMaint
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 16e35d5f10)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:44:01 +00:00
Martin Renvoize a7b870fdfd Bug 37003: Add the 24.11 release team
This patch updates the teams.yaml to include the voted in 24.11
release team.

Test plan
1/ Check against https://wiki.koha-community.org/wiki/Release_Teams

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a2ebd5ad28)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:44:01 +00:00
Emily Lamancusa 1de20773be Bug 37091: Correct op parameter in systempreferences.pl
To test:
1. Go to Administration > System Preferences > Local Use
2. Attempt to delete a local system preference
--> The confirmation page displays a blank name and value
3. Click "Yes, delete"
--> The system preference is still there
4. Apply patch, restart_all, and reload page
5. Attempt to delete the system preference again
--> The confirmation page displays correct information
6. Click "Yes, delete"
--> The system preference is deleted successfully

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 b0b168b6f8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:42:10 +00:00
Martin Renvoize 1394d31d15 Bug 37047: (QA follow-up) Fix translations
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit cfc47e746f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:40:25 +00:00
Martin Renvoize f889259269 Bug 37047: (QA follow-up) Remove nesting of document ready function
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e9f3a7959a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:40:25 +00:00
Martin Renvoize 95b107e014 Bug 37047: (QA follow-up) Move non-bookings code back
We inadvertantly adding a little more than just the bookings table js
into it's own asset. This patch moves that code back and also renames
the asset file to /tables/bookings.js from /bookings-table.js as is the
scheme we're attempting to follow now (see '/modals/').

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 876aff189a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:40:25 +00:00
Pedro Amorim 60bbccb242 Bug 37047: Make use of DRY bookings-table.js in moremember.tt
Test plan:
No functionality change, follow the original test plan and make sure the
table is displayed correctly on both screens:
<intra>/cgi-bin/koha/circ/circulation.pl?borrowernumber=
<intra>/cgi-bin/koha/members/moremember.pl?borrowernumber=1

Signed-off-by: Pedro Amorim <pedro.amorim@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 5f8c575345)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:40:25 +00:00
Pedro Amorim 020190e62f Bug 37047: Move bookings table JS table to its own file
For reusability

Signed-off-by: Pedro Amorim <pedro.amorim@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 47e9754ec0)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:40:25 +00:00
Sam Lau 096ad6e72a Bug 37047: Make Patron Bookings table visible from Patrons Checkout page
This patch makes it so that the patron bookings table loads properly from teh checkout page. Previously, it was only loading correctly from the details page.

To test:
1. Create an item bookable.
2. Book an item for a patron.
3. Go to the patron's checkout page.
4. See they have a Booking (1) in their tab.
5. Click this tab, but nothing appears.
6. Apply patch, restart_all
7. See they still have a Booking (1) in their tab.
8. Click this tab, table loads as expected.

Signed-off-by: Pedro Amorim <pedro.amorim@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 abb6fdf217)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:40:25 +00:00
David Nind 4f2748b72c Bug 34706: Fix capitalization - Cas to CAS
CAS is an abbreviation and should use capital letters.

Test plan:
1. Enable the casAuthentication system preference.
2. Logout and view the login form.
3. Note that it says "Cas login".
4. Apply the patch.
5. Refresh the login page.
6. Note that it now says "CAS login".
7. Sign off.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 18e8f95bc5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:36:01 +00:00
Lucas Gass 98eef1d2bf Bug 37036: Pass along the branches table for auto renewals
To test:
1. Set up autorenewals bu adjusting circulation rules:
'Automatic renewal' -> 'Yes'
'No automatic renewal before' -> 5

2. Set 'AutoRenewalNotices' to 'according to patron messaging preferences'.
3. Set an  AUTO_RENEWALS and  AUTO_RENEWALS_DGST notice to include branch info. I am using this to test:

Branchcode: [% branch.branchcode %]
Branch name: [% branch.branchname %]
Branch address: [% branch.branchaddress1 %]
Branch address2: [% IF branch.branchaddress2 %][% branch.branchaddress2 %][% END %]
Branch city: [% branch.branchcity %], [% branch.branchstate %] [% branch.branchzip %]

4. Make sure your branch has the proper infro. filled out in Libraries administration.
5. Find a patron and adjust the messaging preferences so they receive automatic renewal notices. Also make sure the patron has an email.
5. Check out some items and make them due with the next 5 days.
6. Run the automatic_renewal cron job:

perl /kohadevbox/koha/misc/cronjobs/automatic_renewals.pl -c -v

7. Notice no branch information displays.
8. APPLY PATCH
9. Checkout items from multiple issuing branches to a single patron.
10. Make sure the patron's messaging prefs are set to revieve NON-digestable notices.
11. Run the automatic renewal job, each notice should include the branch information from the issuing library.
12. Change the patron's messageing preferences to receieve digestable notices.
13. Run the job without the --digest-per-branch flag. You should get a single notice with the branch info. coming from the patron's home branch.
14. Run the job with the --digest-per-branch flag. You should get seperate digested notices with the branch info. coming from the issueing library branch.

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 b793b24f98)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:33:34 +00:00
Emily Lamancusa bcb520d69e Bug 30493: (QA follow-up) Fix for the only_my_library case as well
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 94e1d8ed0c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:31:50 +00:00
Baptiste Wojtkowski 5db98bbd65 Bug 30493: Pending archived suggestions appear on intranet home page
If suggestions are archived before their status is changed to something other than "Pending", they still appear on the intranet home page and the acquisitions home page as suggestions to be managed.

WITHOUT PATCH:
1. Go to Acquisitions > Suggestions
2. Click on New purchase suggestion
3. Fill in the form (title only is fine)
4. Click on Submit your suggestion
5. Go to the home page (click the Koha logo)
   --> Notice it says that there is 1 pending suggestion
6. Go to Acquisitions
   --> Notice it says that there is 1 pending suggestion
7. Go to Suggestions
8. Click on the up arrow to the right of the Edit button and choose Archive
   --> There are no more pending suggestions
9. Go to the home page (click the Koha logo)
   --> Notice it says that there is 1 pending suggestion
10. Go to Acquisitions
   --> Notice it says that there is 1 pending suggestion

The search function was fetching suggestions without considering the
"archived" field. I now pick only suggestion that are pending AND not
archived.

WITH PATCH:
9. Go to the home page (click the Koha logo)
   --> Notice it says that there is no pending suggestion
10. Go to Acquisitions
   --> Notice it says that there is no pending suggestion

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e87f4cd550)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:31:50 +00:00
Martin Renvoize 8f90db7413 Bug 36428: (QA follow-up) Add bookings_count class to patron details
Somewhere along the line we lost the 'bookings_count' class in the
bookings tab display on the patron details and circulation page.

This patch restores is and as such also restores the correct count
numbers on 'place booking' and 'cancel booking' actions on those pages.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ecd1b3fc02)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:29:25 +00:00
Martin Renvoize bb44f6971d Bug 36428: (QA follow-up) Remove filter_by_future
I actually already started to remove this in another bug, but it makes
sense to do it here where we're introducing the 'active' filter.  I'm in
agreement that this should probably always have been an 'active' rather
than 'future' filtering.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 39920e03f1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:29:25 +00:00
Nick Clemens 77e2d0d0f6 Bug 36428: Add Bookings->filter_by_active and use it for display
Currently the bookings tab on a biblio details and patron details use 'filter_by_future'
which lists upcoming bookings.

Libraries would like to see upcoming, and active bookings in these cases, and we should add a filter
for bookings that have not ended.

NOTE: This removes the only uses of filter_by_future, but I preserve this for Martin's decision as the creator
of the bookings module

To test:
 1 - Make an item bookable from the items tab on a record details
 2 - Return to details view and place a booking
 3 - Note sidebar says "Bookings (1)"
 4 - Make the booking current from the DB:
     UPDATE bookings SET start_date=NOW() WHERE biblio_id={biblionumber};
 5 - Reload the page
 6 - Note the count is now "Bookings (0)"
 7 - View the patron's details page - note "Bookings (0)" and none listed
 8 - Apply patch
 9 - Reload biblio details, note Bookings(1)
10 - Reload patron details, note Bookings(1) and booking is listed
11 - End the booking:
     UPDATE bookings SET end_date=NOW() WHERE biblio_id={biblionumber};
12 - Confirm booking no longer listed on biblio or patron details

Signed-off-by: Sam Lau <samalau@gmail.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 859e84417e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:29:25 +00:00
Adolfo Rodríguez fbb2cada89 Bug 36984: Fix "Transit pending from..." message in bibliographic record detail page
Transfering a rotating collection will mark the items contained in the collection as "Transit pending..." and it will trigger a javascript error in the bibliographic record detail page that breaks the holdings table, leaving it caught in the "Processing..." message. This patch fixes that.

The javascript messages gives this error in the console tab:
Uncaught TypeError: Cannot read properties of undefined (reading 'str')

The error comes from using from_library_ insted of from_library in the file koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc

Test plan:
1 Create a rotating collection
2 Add at least an item to the collection
3 Transfer the rotating collection
4 Check the detail page of the bibliography record of any of the items that belong to that collection in the Intranet. Notice that the holdings table gets stuck "Processing..." and that there is a Javascript error
5 Apply patch, restart services
6 Repeat step 4. Now the holdings tab works as intended and the item from the collection shows up with the text "Transit pending from..." in the Status column
7 Sign off

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 0dd1f43547)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:27:57 +00:00
Nick Clemens 3c0cd14586 Bug 37069: OPAC authorities search is stateless
This patch removes cud- from the search op and chanegs the form
submission to GET

To test:
1 - Search authorities on OPAC for 'a'
2 - Click page 2
3 - You get the search form
4 - Apply patch, restart all
5 - Repeat search, confirm it works
6 - Click page 2
7 - Confirm you get next results

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1a2b740569)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:26:29 +00:00
Phil Ringnalda 717d132134 Bug 37127: Authorized value select not working on authority forms
Linking an authority subfield to an authorized value just leaves a blank
in the form rather than creating a <select>, because there's a stray cud-
in the type returned from build_authorized_values_list.

Test plan:
 1. Without the patch, Administration - Authority types - Actions menu for
    Default - MARC Structure
 2. Actions menu for 040 - Subfields
 3. Edit subfields - Tab b - Authorized value - set to LANG - Save changes
 4. Authorities - New authority - Default
 5. In 040 tag, click CATALOGING SOURCE to expand the tag
 6. Note that subfield b has a blank space rather than a dropdown menu
 7. Apply patch, restart_all
 8. Authorities - New authority - Default
 9. In 040 tag, click CATALOGING SOURCE to expand the tag
10. Note that subfield b has a dropdown menu listing language names

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 b0f53c5aff)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:25:23 +00:00
Phil Ringnalda fe2eab3c9a Bug 37129: Patron attributes linked to an authorized value don't show a select menu in batch modification
Test plan:
1. In Administration - Patron attribute types verify you have the default
   SHOW_BCODE using the YES_NO authorized value
2. Tools - Batch patron modification, add a patron card number or
   borrowernumber and continue
3. For Patron attribute select Show barcode on the summary screen item
   listings, and note that you get a blank text input rather than a select
   menu with Yes and No choices
4. Apply patch, restart_all
5. Repeat step 2 and 3, but note that you now get a Yes/No select menu

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 b8614bd579)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:24:08 +00:00
Emily Lamancusa 9bfc29f910 Bug 37089: cud-delete_confirm should not be cud
Adjust aqbudgets.pl and currency.pl to check for the correct op value

To test:
Part 1 - Delete a fund
1. Go to Acquisitions > Funds
2. Try to delete a fund
   --> Confirmation page shows fund name as '' and fund amount as 0.00
3. Click "Yes, delete this fund"
   --> The fund is still there

Part 2 - Delete a currency
3. Go to Acquisitions > Currencies
4. Try to delete a currency
   --> Confirmation shows empty values for currency and rate
5. Click, "Yes, delete this currency"
   --> An error message appears and the currency is not deleted

6. Apply patch and restart_all
7. Repeat steps 1-5
   --> Confirmation pages display correct information, and deletions
       occur successfully

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5083d5752c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:22:52 +00:00
Phil Ringnalda 3e84279d3e Bug 37080: Cannot delete MARC bibliographic frameworks or authority types
The scripts for managing both bib and authority frameworks are now expecting
an op 'cud-delete_confirm' but delete_confirm isn't cud, it's just a GET of a
page asking if you are sure. The scripts just need to expect the op they are
actually getting, delete_confirm.

Test plan:
 1. Administration - MARC bibliographic framework - New framework
 2. Give the framework any code and description and Submit
 3. Actions menu for your new framework - Delete
 4. Note the message says 'Confirm deletion of framework '' ()?" rather than
    having the code and description included.
 5. Click Yes, note that deleting failed
 6. Administration - Authority types - New authority type
 7. Give the authority type any type and description and Submit
 8. Actions menu for your authority type - Delete
 9. Note the message again says '' () rather than 'desc' (FOO)
10. Click yes, note that deleting failed
11. Finally! Apply patch, reset_all
12. Repeat steps 1-10, this time noting that you get 'desc' (FOO) rather than
    '' (), and that deleting works.

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 c81b201dc9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 19:21:37 +00:00
Emily Lamancusa 9edb3346f4 Bug 37090: Correct op parameter in edi_accounts.pl
To test:
1. Go to Acquisitions > EDI Accounts
2. Create an EDI account if one is not already there
3. Try to delete the EDI account
--> Page refreshes and nothing happens
4. Apply patch, restart_all, and refresh the page
5. Try to delete the EDI account again
--> A confirmation page displays with correct information
6. Click "Yes, delete"
--> The EDI account is deleted

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 199b21bfc3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 18:07:16 +00:00
Martin Renvoize 804404ab3f Bug 30623: (RM follow-up) Terminology: settings -> permissions
We're copying permissions not settings here, so it makes sense to make
that clear in the wording.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit ee560652ec)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 18:03:11 +00:00
Brendan Lawlor 96097d8058 Bug 35294: Fix typos in catalogue code comments
Test plan:
1. git grep -n -E 'barocode|preproccess' to find the files and line # of typos
2. Apply the patch
3. git grep -E 'barocode|proccess'
4. See no results

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit e8ef0f9417)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 17:59:04 +00:00
David Nind a0d5b813d5 Bug 25520: Fix the SMS number input hint on the OPAC messaging page
This makes the hint when entering an SMS number on the OPAC messaging
settings page the same as the staff interface hint: "Please enter
numbers only. Prefix the number with + or 00 if including the country
code." For some countries using either +XX or 00XX are accepted,
for example: +49 or 0049.

Test plan:
1. Set the SMSSendDriver system preference to Email
2. View the current hint for entering an SMS number in the staff
   interface:
   2.1 Go to Patrons > + New patron > Patron.
   2.2 Scroll down to the 'Patron messaging preferences' section at the
       end of the page.
   2.3 Note that the hint is "Please enter numbers only. Prefix the
       number with + or 00 if including the country code.".
3. View the current hint for entering an SMS number in the OPAC:
   3.1 Go to the OPAC > Your account (log in if required).
   3.2 Select the 'Messaging' tab/section.
   3.3 Note that the hint is "Please enter numbers only. Prefix the
       number with + if including the country code.".
   3.4 The difference: "..or 00.." is missing.
4. Apply the patch.
5. Refresh the OPAC messaging page.
6. The hint text for the OPAC is now the same as the staff interface.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 313cf37a53)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 17:56:54 +00:00
David Nind 9b8e18657e Bug 36922: Patron attributes - update hint text for "Is a date"
The date field for patron attributes is now repeatable (enhancement made
in Koha 24.05 with bug 32610). This updates the hint text to reflect
the change.

Test plan:
1. Go to add a patron attribute (Administration > Patrons and
   circulation > Patron attribute types > + New patron attribute type )
2. Note that the hint for the "Is a date" field says "...Date attributes
   cannot be repeatable or linked to an authorised value category.".
3. Apply the patch.
4. Reload the page.
5. Note that the hint now says "...Date attributes are repeatable,
   but cannot be linked to an authorised value category."
6. Sign off D:

PA amended: 'are repeatable' -> 'can be repeatable'

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit a8e1d8dc90)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 17:53:58 +00:00
David Nind cbc0d4161b Bug 36338: Update onboarding error message when creating the Koha administrator patron
Update the error message for the web installer onboarding
section when creating the Koha administrator patron (where
the card number or username already exists):
- Fix capitalization
- Use the same label in the error message as used in
  the form

Error message before: The patron has not been created!
Card number or Userid may already exist.

Error message after: The patron was not created! The
card number or username already exists.

Test plan:
1. Option 1:
   1.1 Review the diff for the patch and make sure that
       the updated text makes sense.
       . Previous text: The patron has not been created!
         Card number or Userid may already exist.
       . Updated text: The patron was not created! The
         card number or username already exists.
OR
2. Option 2:
   2.1 Access the database server:
       mysql -uroot -ppassword -hkoha-db-1
   2.2 Drop the koha_kohadev database:
       drop database koha_kohadev;
   2.3 Create the database: create database koha_kohadev;
   2.4 Add privileges (for a real installation this would
       be limited):
       grant all on koha_kohadev.* to koha_kohadev;
   2.5 Restart everything (there may be some errors listed):
       flush_memcached and then restart_all
   2.6 Access the web installer: go to 127.0.0.1:8081
   2.7 Use the database user name and password: get from
       /etc/koha/sites/kohadev/koha-conf.xml
       (default: koha_kohadev, password)
   2.8 Continue through the installation process until you
       reach 'Selecting default settings':
      . Make appropriate selections to use all the sample
        data options and settings
   2.9 For the 'Onboarding' step - Create Koha
       administrator patron:
       . Surname: Acevedo
       . First name: Henry
       . Card number: make up a number that doesn't exist in
         the sample date, for example: 741852963
       . Library: Centerville
       . Patron category: Staff
       . Username: 23529000035676 (this is an existing
         value already in the sample data)
       . Password: a valid password, for example:
         KohaCon2024
       . Confirm password: repeat password used
       . Submit
         ==> Error message before patch: The patron has not
             been created! Card number or Userid may
             already exist.
   2.10 Apply the patch.
   2.11 Repeat step 2.9
   2.12 The error message is now: The patron was not created!
        The card number or username already exists.

3. Sign off.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit bd195784a0)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 17:52:16 +00:00
Janusz Kaczmarek dca760d5b2 Bug 36930: Item search gives irrelevant results when using 2+ added filter criteria
In the Item search the librarian is allowed, in the first step, to define
additional filters like Title, Author, Publisher, Publication date etc.
(in the third fieldset).  This works fine but only for one criterion.
If one adds two or more criteria, the filter does not apply at all.

Test plan
=========
1. Make an Item search with the Pulblisher filter. Put
   %University of California% as the value.
   You should get 5 rows (with standard ktd test data set), three
   from 1982, and two from 1988.
2. Edit search -> add the second criterion: AND Publication date is 1982.
   You would expect three rows but you get 900+ rows.
3. Apply the patch; restart_all.
4. Repeat p. 2. You should get the expected three rows.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit bdc7ac2c93)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 17:50:38 +00:00
David Nind e7acfdbf65 Bug 36961: Fix typo in opacreadinghistory system preference description
Fix a spelling error in the opacreadinghistory system preference
description - 'itms' to 'items'.

Test plan:
1. In the staff interface view the description for the
   opacreadinghistory system preferences (Koha administration >
   System preferences > search for opacreadinghistory).
2. Note that it reads "Allow patrons to see what itms they have
   checked out in the past."
3. Apply the patch.
4. Refresh the page.
5. Note that 'itms' is now spelt correctly as 'items'.
6. Sign off.

Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit cd95ea29c0)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 17:49:37 +00:00
Marcel de Rooy 2d4537ba12 Bug 36940: Resolve two warnings on undefined branchip
If you enabled AutoLocation and have a branch without ip, this
triggers warnings.

Test plan:
Check logs in this situation with/without this patch by logging out
and in again on staff.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 2f1ffbc6ec)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 17:48:12 +00:00
Owen Leonard e7afd54cc8 Bug 34573: (follow-up) Add better logic for add/update title and headers
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 865ca8b1fc)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 17:46:26 +00:00
David Nind 17069dfb1e Bug 34573: (follow-up) Additional updates for modify vendor page
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 58c1f64f77)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 17:46:26 +00:00
Owen Leonard e5600ea8dc Bug 34573: Fix inconsistencies in acquisitions modify vendor title tag
This patch updates the vendor details template so that the title tag
correctly reflects whether the user is viewing the vendor or modifying
it.

To test, apply the patch and go to Acquisitions.

- Locate a vendor and view the details (supplier.pl?booksellerid=X)
  - The title should read "Vendor X > Acquisitions > Koha"
- Edit the vendor.
  - The title should read "Modify vendor X > Acquisitions > Koha"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 3baaf5a324)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 17:46:26 +00:00
Julian Maurice 5b5aa52547 Bug 34077: Allow to use --category-code as the only filter option
--category-code was not checked in the "at least one filter option"
check but it is clearly a filter option.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit d5cb77532e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 17:44:43 +00:00
Julian Maurice 0061ffc6ce Bug 34077: Improve documentation and error messages of writeoff_debts.pl
* Change the SYNOPSIS to better describe the different ways to use the
  script
* Only show the SYNOPSIS when options used are wrong (unknown option,
  no filter options, or neither -c nor -v)
* Show the options details only with --help
* Clarify the fact that -v is required when -c is not supplied in the
  description of both options
* Print a specific error message for the following cases:
  * no filters options
  * neither -c nor -v was supplied

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 215b29a737)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 17:44:43 +00:00
Matt Blenkinsop 227a5619a4 Bug 36937: Remove warning from unit tests
This patch fixes a warning in the unit tests

Test plan:
1) prove t/db_dependent/api/v1/password_validation.t
2) There will be a warning in the output - 'Use of uninitialized value $status in numeric eq (==)'
3) Apply patch
4) Re-run the test
5) The warning will disappear

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 5e7572ad7a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 17:42:16 +00:00
David Nind a4e5980710 Bug 30715: Terminology for the log viewer - use 'Staff interface' instead of 'Intranet'
The log viewer (Tools > Additional tools > Log viewer) uses
'Intranet' as:
- an option for filtering what log entries to display.
- a value in the log entries interface column, for log entries.

Koha's terminology guideline is to use 'Staff interface' instead of
'Interface' (https://wiki.koha-community.org/wiki/Terminology#I).

Test plan:
1. Perform some actions that will create log entries when using the
   staff interface. For example:
   1.1 Enable the UseRecalls system preference.
   1.2 Edit the title for a record.
   1.3 Add an item for a record.
2. Use the log viewer to view the logged changes:
   2.1 Go to Tools > Additional tools > Log viewer.
   2.2 Select Submit.
   2.3 Log entries are displayed for the changes made.
3. Note that:
   3.1 For the log viewer 'Interface' filter options, "All" is
       selected by default, and other options are Intranet, OPAC,
       SIP, Command-line, REST API, and Cron job.
   3.2 For the changes viewed in step 2, the value displayed in
       the 'Interface' column is 'Intranet'.
4. Apply the patch.
5. Refresh the page.
6. Note that:
   5.1 For the interface filter options, 'Intranet' is now changed
       to 'Staff interface'.
   5.2 In the list of log entries, the value in the interface column
       is now 'Staff interface'.
7. Sign off D:

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 540ec4f6dc)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 17:36:11 +00:00
Fridolin Somers e8ab419a99 Bug 36999: Fix 00-strict.t fails to find koha_perl_deps.pl
Since Bug 36323 moved koha_perl_deps.pl it is not needed anymore in 00-strict.t
It fails with :
koha_1       | Can't stat koha_perl_deps.pl: No such file or directory
koha_1       |  at /usr/share/perl5/Test/Strict.pm line 151.

Patch remove koha_perl_deps.pl from @dirs.
It contains misc.

Test plan :
prove t/db_dependent/00-strict.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 325a96a406)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-18 17:33:55 +00:00
Phil Ringnalda 0aa348b665 Bug 37031: Club enrollment from staff interface fails due to Entrollment typo
There is a typo in svc/club/enroll - it tries to call
Koha::Club::Entrollments->search when it should be
Koha::Club::Enrollments. This causes and error when
enrolling patrons in clubs.

Test plan:
1. Without the patch, Tools - Patron clubs - New club template - name it
   and save
2. New club - (your template) - name it and save
3. Circulation - check out to a patron - Clubs tab - Enroll - Finish
   enrollment, get alert() about failure to enroll
4. Apply patch, restart_all
5. Enroll - Finish enrollment, success

Signed-off-by: David Nind <david@davidnind.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 f02d90938d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-17 21:33:49 +00:00
Lucas Gass 739915b547 Bug 37316: Adjust tests
Signed-off-by: Eric Garcia <cubingguy714@gmail.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 e071ba329d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-17 21:11:42 +00:00
Lucas Gass 8bd61eba3d Bug 37316: Treat empty string barcodes as undef
To test:
1.Add the following to MarcItemFieldsToOrder:

homebranch: 949$a
holdingbranch: 949$b
itype: 949$y
nonpublic_note: 949$x
public_note: 949$z
loc: 949$c
ccode: 949$8
notforloan: 949$7
uri: 949$u
copyno: 949$t
price: 949$g|949$j
replacementprice: 949$v
itemcallnumber: 949$o
quantity: 949$k
budget_code: 949$l
coded_location_qualifier: 949$f
enumchron: 949$h

2. Add the following to MarcFieldsToOrder:

price: 949$g
quantity: 949$k
budget_code: 949$l
discount: 949$m
sort1: 949$n
sort2: 949$q

3. Acquisitions > Find a vendor
4. Create a new basket -> Add to basket -> From new file
5. Use the file uplodaded in this bug report.
6. Set format to MARCXML and stage for import.
7. Add staged files to basket
8. Select all, make sure you add an item type, and choose 'Do not look for matching records'
9. Save and kaboom.
10. APPLY PATCH and restart_all
11. Follow the steps again, this time no kaboom.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b68373ae42)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-17 21:11:42 +00:00
Lucas Gass 9a50edfa7f Bug 37316: Add tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7b4bdf286c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-17 21:11:42 +00:00
Brendan Lawlor 3986061572 Bug 37059: Fix insert button in notices and slips
This patch fixes the insert button in notices and slips. The container id needed to be appened with '_panel'

To Test:
1. Edit any notice or slip and try to use the insert button
2. Nothing happens
3. Apply patch and refresh the browser
4. Edit any notice or slip and use the insert button
5. Confirm the parameters are inserted into the tempalte as expected.

Signed-off-by: Eric Garcia <cubingguy714@gmail.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5c5a7d42e6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-17 20:57:00 +00:00
Kyle M Hall a3db039d41 Bug 35942: OPAC user can enroll several times to the same club
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: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c735c027fa)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-11 20:07:29 +00:00
Andrii Nugged 12edba3773 Bug 37014: Fix after-modal-POST to transmit "not_returned" message
The bug report addresses an issue where the message "Item was not checked in" erroneously appears during the second POST after a manual or modal check-in process.

1. In circ/returns.pl:
   - Introduced a new hash `%rinot_returned` to track items not returned across pages.
   - Updated the logic to capture the "not returned" status from the query parameters.
   - Adjusted the input processing loop to include `not_returned` status.
   - Modified the section handling barcode check-ins to appropriately initialize and update the `not_returned` status.

2. returns.tt:
   - Added hidden input fields in the template to include `not_returned` status in the form submissions.

The changes ensure that the "not_returned" status is correctly tracked and displayed, preventing the erroneous message from appearing on subsequent POST requests.

1. Perform a manual check-in of an item, but make some warning modal appear: for ex., transfer: check-in the item in not home library.
2. Press OK on the modal. There will be a POST transition again to redraw the checked-in items list.
3. Verify that the "Item was not checked in" message appears erroneously near the item's row.
4. Apply the patch.
5. Repeat steps 1-3 and check that there will be no erroneous "Item was not checked in" message.

Signed-off-by: Tadeusz „tadzik” Sośnierz <tadeusz@sosnierz.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f567d41b91)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-11 20:03:55 +00:00
Lucas Gass 87d1a6aabc Bug 37005: Fix problem with item_type_description being undefined
To test:
1. Set noItemTypeImages to 'Don't show'
2. Find a record with items and notice the holdings table never loads.
3. APPLY patch, maybe clear borwser cache too.
4. Try again, the holdings table should load.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 37b66a2d7c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-11 20:02:01 +00:00
Owen Leonard 08305283ff Bug 37187: Fix deletion of label batches and label templates
This patch uses the new form-submit JS to convert the label management
deletion link from a GET operation to POST.

To test, apply the patch and go to Cataloging -> Label creator.

- Click Manage -> Label batches. Create a batch if necessary.
- Click the "Delete" button in the "Actions" column. You should get a
  confirmation message, "Are you sure you want to delete this?"
  - Test both the confirming and cancelling.
- Perform the same test with Manage -> Label templates.
- From the Manage -> Label batches page, click "edit" on one of the
  batches.
- Right above the "Items in batch number X" is a toolbar which should
  have a button, "Delete batch." Test that it works correctly to delete
  the batch.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>

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 5f156ad3df)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-11 19:59:10 +00:00
Matt Blenkinsop 642acf7566 Bug 36956: Allow all providers to be displayed in reports
This patch fixes an incorrect usage of the API which was only returning 20 results.

Test plan:
1) Go to ERM module and make sure you have more than 20 data providers stored in your database.
1) (Optional) Run the following command (k-t-d) to create 21 data providers:
  perl -MKoha::Database -e '
      my $schema = Koha::Database->schema;

      $schema->resultset("ErmUsageDataProvider")->create({
          name => "name ".$_
      }) for (1..21)
  '
2) Go to eUsage / reports and create new report (cgi-bin/koha/erm/eusage/reports)
3) Check that only the first 20 data providers are displayed in the drop down
4) Apply patch
5) yarn build or reset_all to rebuild the javascript
6) Repeat steps 1-3, all providers should now be displayed

PA amended patch: Updated commit message test plan

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6afe1e14dc)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-11 19:35:44 +00:00
Phil Ringnalda c4a481a65a Bug 37078: Damaged status not showing in detail.pl
The API returns the fact that an item is damaged in 'damaged_status' but the
code that builds the holdings table is looking for 'damaged' so it doesn't
find that an item is damaged.

Test plan:
1. Administration - Authorized values - DAMAGED row, click Add
2. Give it the Authorized value 2 and the Description Awful
3. On a record with more than one item, like Empress of the blues,
   edit one item to have Damaged status: Damaged and one to have
   Damaged status: Awful
4. On the bib detail view, note that the status column shows both
   as 'Available'
5. Apply patch, refresh
6. Note that now one shows as Damaged and one as Awful (verifying that
   the value is being read from the AV, not the fallback default which
   is also 'Damaged')

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 65e0ffa882)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-11 19:30:18 +00:00
Lucas Gass ad968a00d0 Bug 36459: Do not duplicate duedatespec IDs
To test;
1. Go to circ/circulation.pl and check an item out to a patron.
2. Backdate it to sometime in the past using the "Specify due date
   (MM/DD/YYYY) : " input
3. A modal appears to "Please confirm checkout". The date is no longer
   populated in that field.
4. You must add the date again here.
5. APPLY PATCH
6. Try again and this time the confimration date should be set
   correctly.
7. Follow the test plan from Bug 18885 to make sure on site checkouts
   still work correctly.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit e33714cd0d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-11 19:27:55 +00:00
Pedro Amorim d925cb586a Bug 36424: Remove trailing comma in DBRev 23.06.00.061
This fixes a syntax erorr in the database update for
the bookings tables.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f7e1559a79)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-11 19:23:07 +00:00
Laurae dc92d3aebd Bug 37071: Updated the purchase suggestions link
To test:
1. Go to a patron account and click on “New purchase suggestion” under the “Purchase Suggestions” tab.
    1. Clicking on the button will take you to the suggestions management page.
2. Apply the patch.
3. Go back to the patron account and click on the “New purchase suggestion” link again. This time it will take you to the purchase suggestion form. You are now able to successfully submit a purchase suggestion.
4. Sign off and have an amazing day. :D

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
(cherry picked from commit a7484ed759)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-10 17:02:28 +00:00
Martin Renvoize d0ded0c737 Bug 37037: (RM follow-up) Add hint at end of script run
This patch adds a hint to the end of the script to notify the end user
that they may need to run the build_holds_queue cronjob if they are
using RealTimeHoldsQueue.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 8dd9c94c57)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-10 17:00:00 +00:00
Kyle M Hall 690ee4483b Bug 37037: touch_all_biblios.pl triggers rebuilding holds for all affected records when RealTimeHoldsQueue is enabled
If RealTimeHoldsQueue is on, touch_all_biblios triggers a update_holds_queue_for_biblios background job for each affected record. This will result in a as many background jobs being queued up as records! It makes far more sense for this script to not do that which gives the administrator the option for running the holds queue builder if the changes would affect holdability, or to not run it at all.

Test Plan:
1) Run touch_all_biblios.pl
3) Note a update_holds_queue_for_biblios background job is queued for each record touched
4) Apply this patch
5) Merge touch_all_biblios.pl again
6) Note that no update_holds_queue_for_biblios jobs were queued

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 45bfbd0e2d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-10 17:00:00 +00:00
Sam Lau 4056c1e0c2 Bug 35869: Removes the dismiss button from messages on OPAC SCO module
This removes the "Dismiss" button from the SCO module. Currently, the
"Dismiss" button is present, however it does not function properly and
logs the user out if they press it. As noted on previous chats, keeping
the button would require serious changes, thus it's easier just to remove
the functionallity.

To test:
1) Enable  WebBasedSelfCheck
2) Add an OPAC mesaage to a patron account
3) Login to self check ( http://localhost:8080/cgi-bin/koha/sco/sco-main.pl )
4) See the OPAC message, click dismiss.
5) Notice you are logged out at redirected to:
   ( http://localhost:8080/cgi-bin/koha/opac-dismiss-message.pl )
6) Apply patch
7) Log back into the self checkout module
8) Notice that there is no longer a "Dismiss" button for the message.
9) Log into OPAC into the same user's account
10) On the summary page, note that there is still a dismiss button.
11) Ensure this still works properly
12) sign-off

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 2313bc3103)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-10 16:56:49 +00:00
Emmi Takkinen 310d19e6b3 Bug 37021: Change item_id type as integer in holds endpoint
When one makes a GET call to holds endpoint and hold has
item attached to it, item_id is handled as string not integer
as it should.

To reproduce:
1. Make sure you have hold waiting in your database.
2. Call endpoint api/v1/holds/?q=[{"me.status":"W"}].
=> Note that holds item_id is displayed as item_id: "12345".
3. Apply this patch.
4. Call endpoint again.
=> item_id should now be displayed as 12345.

Also prove t/db_dependent/api/v1/holds.t.

Signed-off-by: Jan Kissig <jkissig@th-wildau.de>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 20e0c056c6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-10 16:54:54 +00:00
Matthias Le Gac f4b73a16ff Bug 36166: Disable select to add to list if opacuserlogin is disabled
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 8d3c3b35e0)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-10 16:52:21 +00:00
Martin Renvoize 38b618c4a5 Bug 36207: (RM follow-up) CSRF correction
I think there was a rebase issue here where we split the form into two
forms instead of one.  This patch returns us to one form with two
different submit options (one for selected tags and one per tag) that
both trigger the confirmation modal before submitting to the controller.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 0ac23a6247)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-10 16:48:00 +00:00
Owen Leonard 8e9652665f Bug 36207: Use confirmation modal when removing tags from titles in the OPAC
This patch changes the process of removing a tag from a title on the
user's tag list. It now uses a confirmation modal dialog instead of a
JavaScript alert.

The patch also makes some minor tweaks to CSS to correct style on
"remove" links.

To test, apply the patch and rebuild the OPAC CSS.

 - Log in to the OPAC as a user who has submitted multiple tags or tags
   on multiple items.
  - Open the "Tags" link in the sidebar of the user summary page.
  - Click the "Remove tag" link next to one of the titles in the table
    of the user's tags.
  - You should see a modal confirmation message, "Are you sure you want
    to remove the selected tag from this title?" It should show the
    title and the tag which will be removed.
  - Test both the "Yes, remove tag" and "No, do not remove tag" choices.

  - Check the box next to one of the tagged titles and click the
    "Remove selected tags" button at the bottom of the table.
  - You should see a modal confirmation message, "Are you sure you want
    to remove this item from the list?" It should show the title and
    the tag which will be removed.
  - Test boh the "Yes" and "No" choices.

  - Check the box next to multiple tagged titles and click the
    "Remove selected tags" button at the bottom of the table.
  - You should see a modal confirmation message, "Are you sure you want
    to remove the selected tags from these titles" It should show the
    titles of all the records you selected and the corresponding tags to be
    removed.
  - Test both the "Yes" and "No" choices.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit e834a575ae)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-10 16:48:00 +00:00
Lari Strand 7102672032 Bug 34718: Input field in fund list (Select2) on receive is inactive
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit cbae441055)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-03 16:24:40 +00:00
Matt Blenkinsop 18a186969e Bug 36983: Fix incorrect required class
This patch fixes an error on the B_address2 field which sets it to be
required incorrectly

Test plan:
1) In PatronSelfRegistrationBorrowerMandatoryField, set B_address to be
   required.
2) In the OPAC, navigate to the self registration form.
3) In the Alternate address section, fill in the Address field that you
   have just set to be required. Ensure that you leave the Address 2
   field blank.
4) Fill in all other required fields and submit the form, it should show
   you that the Address 2 field is required, even though it shouldn't be
5) Apply patch
6) Refresh the page and repeat steps 1-5, it should allow youto submit
   the form

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 009d83648c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-03 16:23:06 +00:00
Matt Blenkinsop b12f880c93 Bug 36894: Display journal article ILL request author
This patch fixes the ILL request table to display authors for journal article request types

Test plan:
1) Create an ILL request with the type of Journal Article and add an author in the Article author field
2) Click on the List requests button to see the table
3) The Author field should be blank for the request you created
4) Apply patch
5) Hard refresh the browser to reload the javascript
6) The author field should now be visible

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 11eb0d1da7)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-03 16:20:46 +00:00
Marcel de Rooy 4f49e37c6e Bug 36948: (follow-up) Add chomp to sip log4perl config
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 8e0d18e35a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-03 16:17:55 +00:00
Marcel de Rooy 309cc9c9d1 Bug 36948: (follow-up) Allow IPv[46] in port config
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit fcd7e884bc)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-03 16:17:55 +00:00
Marcel de Rooy 2c156f8ce1 Bug 36948: (follow-up) Remove log_file param, adjust caller_depth
We keep OPEN when people still use log_file or setsid.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit c0d76f707b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-03 16:17:55 +00:00
Nick Clemens 7076762bba Bug 36948: Resolve SIP issues in D12
My Koha testing docker SIP started dying repeatedly after launch. After investigation, I
found it was a problem with logging and default ports.

In D12 there is no syslog anymore, everythign uses journal. Four our purposes, lets log SIP issues
to sip.log by default

Attaching a patch to clear things up.

To test:
1 - Open KTD/D12
2 - tail -f /var/log/koha/kohadev/*.log
3 - On another terminal 'restart_all'
4 - Wait a bit, notice SIP dying
5 - Apply patch
6 - Update SIPconfig:
    server-params:
    log_file='/var/log/koha/kohadev/sip.log'
    service with port 8023:
    port="127.0.0.1:8023/tcp"
7 - Restart all
8 - Confirm SIP no longer dies

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 5dc1ec387d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-07-03 16:17:55 +00:00
Emily Lamancusa 796300926c Bug 37000: (follow-up) Add foreign key last
Certain configurations of MySQL will not allow a column to be changed
from nullable to non-nullable if the column has a foreign key constraint.
Add the foreign key constraint last to avoid issues from this.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 8e788af50b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 22:12:04 +00:00
Martin Renvoize a4d7767fa4 Bug 37000: (Bug 36120 follow-up) Improve reliability of database update
This patch adds a series of fallthroughs to ensure pickup_library_id is
always set prior to adding the NOT NULL constraint.

We initially only looked at items.homebranch but as that's a nullable
field itself, we now look at items.holdingbranch before finally
defaulting to the first available branch in the branches table in the
worst case.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 8cedcfd5c8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 22:12:04 +00:00
Lucas Gass 710e002b32 Bug 37026: Fix JS error on sco-main.tt
To test:
1. Have a patron with some checkouts, holds, and charges that can login into the SCO module.
2. To go  sco-main.pl and login
3. Try changing tabs and notice the console error:

 dataTables is not defined

 4. APPLY PATCH
 5. Try again, there should be no error.
 6. Make sure you can switch the tabs without any issues.

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit b9ca6b4a36)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 22:09:09 +00:00
Kyle M Hall 12fc84358a Bug 36672: Circulation rules are performing too many lookups
Looking at the template, for every section after the main rules block we loop over categories or itemtypes, and lookup the value for each rule name.

In systems with large numbers of categories and item types this becomes very slow.

In the rules section, we have already built a hash of rules by category and itemtype - we should continue to use this throughout the page.

Test Plan:
1) Apply this patch
2) For each rule section, create and delete a rule
3) No change in behavior should be noted!

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit aa2befcec8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 22:03:51 +00:00
Lucas Gass 58b5228af0 Bug 36679: Prevent SCO login for the AnonymousPatron
1. Make sure AutoSelfCheckAllowed is Allowed and AutoSelfCheckID and AutoSelfCheckPass are in use.
2. Make sure AnonymousPatron is pointed to an account.
3. Set SelfCheckoutByLogin to cardnumber.
4. Verify that if you go to the anonymous patron account in the staff interface, you cannot checkout items.
5. Go to the selfcheck path of the library.  It should auto login.  Put in the cardnumber for the anonymous user.
6. Proceed to check out items!
7. APPLY PATCH, restart_all
8. Try step 5 again, you should not be able to log in as the AnonymousPatron. Instead you should be redirected to OPAC home page
9. Switch SelfCheckoutByLogin to 'username and pasword'.
10. Again try to log in as the AnonymousPatron, you should not be able to.
11. Make sure you can login as a regular patron when SelfCheckoutByLogin is set to 'cardnumber' and when it is set to 'username and pasword'.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 76075976ea)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 22:00:48 +00:00
Nick Clemens fc498772ab Bug 36938: Adjusts tests to remove warns
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 9f8b963616)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 21:57:28 +00:00
George Veranis dda63ffc37 Bug 29539: UNIMARC: authority number in $9 displays for thesaurus controlled fields instead of content of $a
When you try to dislpay a bibliographic record on unimarc that has subjects
linked with authorities then only the $9 is displayed as link instead of the
content of $a and it's subdivisions, if any.

To test:
1) You will need to have a bibliographic record with at least one subject
autority connected in unimarc framework.
2) View that record on OPAC on detail display. The subject will display as
a number ( $9 )  and you cannot see the text/term of the subject ( $a )
3) Apply patch
4) Repeat step 2
5) The subject display in a normal way based on content $a - or more subfields

Sponsored-by: National Library of Greece
Signed-off-by: David Nind <david@davidnind.com>

Bug 29539: (follow-up) remove tag_onesubject template

Also:
Restores the <span class="value">
Replaces "not(position()=last())" with the more used "position() != last()"
Removes unecessary change in <xsl:param name="spanclass" />

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit a7fbe80af1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 21:55:17 +00:00
Owen Leonard 3ab750f9a6 Bug 37039: Update discharge request with CSRF token
The OPAC discharge page used a link with a GET parameter, but the script
expects a POST request. This patch converts the link to a form with CSRF
token included.

To test, apply the patch and enable the useDischarge system preference
if necessary.

- Log in to the OPAC as a user with no checkouts or outstanding fees.
- Click the "Ask for discharge" tab in the sidebar of the user summary
  page.
- Click the "Ask for a discharge" button.
- You should be redirected to a page that says "Your discharge request
  has been sent."

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 67cedc9955)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 21:53:21 +00:00
Pedro Amorim 5cd540f499 Bug 34838: (QA follow-up): TypeDisclaimer tests - Add 'type' to request metadata
This adds a type to the request (mocking it as a new ILL request of type journal being submitted)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7f8e71e82b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 16:21:40 +00:00
Tomas Cohen Arazi 6205b4910d Bug 34838: Use ->set to avoid method redefinition warnings
This patch silences more warnings. To test

1. Be on 23.11.x
2. Apply the patches before this one
3. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Illrequests.t
=> FAIL: Lots of warnings like this:
Subroutine Koha::Illrequest::SUPER::status redefined at /kohadevbox/koha/Koha/Object.pm line 955.
Subroutine Koha::Illrequest::SUPER::status_alias redefined at /kohadevbox/koha/Koha/Object.pm line 955.
illrequestattributes is DEPRECATED in favor of extended_attributes at t/db_dependent/Illrequests.t line 1071.
4. Apply this patch
5. Repeat 3
=> SUCCESS: No more warnings!
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ff42535f96)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 16:21:39 +00:00
Pedro Amorim 7472c619a0 Bug 34838: Tidy
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit fff166679b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 16:21:39 +00:00
Pedro Amorim 0dc1aaf09d Bug 34838: Only check for status in status graph if request has a status
This check is required because when the existing_statuses method checks for the existing status_alias, it'll leave out the status from the query, so the status will be NULL for those particular query results when calling strings_map, throwing a warning

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 3caabe886e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 16:21:39 +00:00
Pedro Amorim 804f8b4fbb Bug 34838: Only call strings_map if status_alias is not undef in status_alias cycle
Because its highly likely that at least one request will have status_alias null in the database, the select MAX query will always return at least one result with NULL status_alias, throwing a warning, so we skip that

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 4231def42e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 16:21:39 +00:00
Pedro Amorim 6909c637bd Bug 34838: Replace SUPER::AUTOLOAD with get_column
I'm not 100% happy with this but I'm out of ideas.

I think the problem warning happens because there is no method status or status_alias directly defined in Object.pm so it tries to define it, but it has already been defined by AUTOLOAD previously.

Test plan:
  prove t/db_dependent/Koha/Illbackend.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit a9f6f47afb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 16:21:39 +00:00
Martin Renvoize 647d5e9a9e Bug 37040: (RMaint follow-up) Restore passing CSRF error
This patch restores the plack.middleware.Koha.CSRF plack env setting to
allow passing to the errorDocument.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 8cd6b43504)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 16:14:34 +00:00
Matt Blenkinsop e708597417 Bug 37040: (QA follow-up) Tidy file
QA tests were failing for tidyness so this patch addresses that

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit aeabe6c9f6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 16:14:34 +00:00
David Cook cd7123734e Bug 37040: Prevent ErrorDocument subrequests from activating CSRF
This change improves the mechanism for preventing the CSRF middleware
being activated by ErrorDocument subrequests.

This change was necessary due to a subtle issue identified by
Bug 37041.

Test plan:
0. Apply the patch
1. Restart Koha
koha-plack --restart kohadev
2. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=9908
3. Log in
4. Note that you get a pretty 403 and not an ugly plain text error
5. Go to http://localhost:8081
6. Fill in the login details, but use the HTML inspector to delete
the csrf_token from the hidden inputs
7. Submit the login
8. Note a pretty 403 page

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit c1ac124176)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 16:14:34 +00:00
Owen Leonard 27ffd9bb8a Bug 36995: Correct parameter name for library EAN deletion
This patches removes the "cud-" prefix from the "delete_confirm"
parameter check in Library EAN management. The confirm step is a GET
operation.

To test, apply the patch and restart services;

- Go to Administration -> Library EANs.
- Add an entry if necessary, then click "Delete."
- You should be taken to a confirmation page: "Confirm deletion of
  EAN..."
- Confirm deletion and verify that the EAN was deleted.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 900a1aecbb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 14:00:16 +00:00
Nick Clemens 572ce3af4a Bug 34444: Correct handling of sort1 and sort2 values
Removed extraneous sort_1 data elements
Update selectors to use field names for statistics field
Updated code to set the value after finding the correct selector

To test:
* Make sure you have at least 2 funds with different stat settings, using AV and not
* Create a basket with an order line
* Close it and receive shipment
* Create an invoice and receive the order line
* Finish receiving

* Click "Modify fund"
* Switch fund, verify the stat fields are updated accordingly
* Change values for statistical values
* Update fund
* Edit fund again, pull downs are correct
* Change values in form and close, do not update
* Click 'Modify fund' - confrim form is filled with the saved values

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 596d6b74ea)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 13:38:55 +00:00
Matt Blenkinsop eff4e19ef8 Bug 35989: (QA follow-up): Fix QA tests
Some file tidying to pass the QA tests

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 361ec4b2ea)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 13:35:23 +00:00
Nick Clemens 4ca639a5f6 Bug 35989: (QA follow-up) Add test and limit variable scope
Before this patch if a record had a 751 and a 781 you could have fields repeated.
This patch reduces the scope of the fields to subdivision variable as it is only used in processing 7xx
fields and should not be shared between fields.

I also add unit tests

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 95f2aecc1b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 13:35:23 +00:00
Matt Blenkinsop 6dfb1dd931 Bug 35989: Stop geographic authority searches crashing
Currently when searching for a geographic authority record the search will fail if the record has a heading in a 78X field. The system tries to do a regex match against an undefined variable causing an error. This patch makes that regex match conditional on the variable being defined to allow the search to succeed.

Test plan:
1) Navigate to Authorities
2) In the search bar at the top of the page, click on the dropdown options and in the 'Authority type' field, select 'Geographic Name'
3) Click search
4) You should have a list of authorities
5) Click on any authority record and then click edit and select to edit the record
6) Click on the "7" button
7) Click on the green text next to the '781' field to get the list of fields
8) In field 'v' enter any string you like
9) Click save
10) Repeat steps 1-3, this time it should display an error message for an Unmatched [ in regex
11) Apply patch
12) restart_all
13) Refresh the page, the results should show and the string you entered in the 'v' field should display on the record you edited

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 6c9482f213)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-27 13:35:23 +00:00
Matt Blenkinsop 31dd31d324 Bug 37043: Update the base URL for the Counter Registry API
Test plan:
1) prove t/db_dependent/api/v1/erm_sushi_services.t
2) t/db_dependent/api/v1/erm_counter_registries.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 8c90b87583)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-06-26 15:19:51 +00:00
Fridolin Somers a89e9124f3 Update release notes for 24.05.01 release
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-10 16:33:10 +02:00
Fridolin Somers e13342c076 Increment version for 24.05.01 release
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-10 16:16:12 +02:00
Marcel de Rooy cf1f726616 Bug 36875: (follow-up) Modify query in translated_content
This removes the MySQLism for FIELD(..).
In this case we just want to get the non-default records in
the front. So we can just test lang=default. And prevent inserting
$lang in the expression. And so prevent execution in ORDER BY.
No longer needing the ->quote call too.

Test plan:
Run Koha/AdditionalContents.t again.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit c16f5c61849460489992977812f020ec7fa5c9f3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:49:20 +02:00
Marcel de Rooy 929becb01d Bug 36875: Unit test
Test plan:
Run Koha/AdditionalContents.t without next patch.
Should fail on the sleep execution.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 58573f139427fa15c2c600edc65d0d263cd00222)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:49:20 +02:00
Marcel de Rooy bd6d907628 Bug 36875: Staff counterpart
Same change.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 73423bd894d5365ac491c92c6d5576052e4732f0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:49:20 +02:00
Marcel de Rooy 2e54e781c5 Bug 36875: Do not pass unsanitized language to $page->translated_content
Test plan:
Try to access opac-page.pl with a language not in OPACLanguages.
Verify that this 'language' was not passed to sql. Simplest perhaps
by debugging AdditionalContent.pm. Something like:
 sub translated_content {
     my ( $self, $lang ) = @_;
+warn "L137: $lang";
Now have a public additional_contents page and hit it:
    /cgi-bin/koha/opac-page.pl?page_id=5&language=badsql
Check your log and find:
[2024/05/16 07:25:53] [WARN] L137: en at [etc] line 137.
So badsql was caught.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 1a9e3647095eaf9563db59bd8b3a759a0875cc39)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:49:20 +02:00
Chris Cormack cbb2fd5c01 Bug 36818: Escape characters in file names uploaded
To test:
1/ create a file named something like 'execute`curl blog.bigballofwax.co.nz`.zip'
   Where the domain is one you can watch the logs from
2/ Upload this file as a cover image
3/ Check /var/lib/koha/sitename/tmp/koha_sitename/ and see unescaped filenames
4/ Choose process, check the logs of the webserver see the connection has been made
5/ Apply the patch
5/ Repeat 2 & 3 and see the filename is now escaped
6/ Choose process and check no errors but no no remote execution occurs
7/ Test uploading actual zip file and images still works

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 14bdaae3f257a321f8ec0d32c6b1e9bc6ed6033d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:49:20 +02:00
Chris Cormack c1c603731d Bug 36520: Sanitize input in opac-sendbasket.pl
To test
1/ Add some items to your cart in the opac
2/ Choose send cart
3/ Open firefox developer tools and switch to the network tab
4/ Send cart
5/ In the network tab, find the post request and choose copy as curl
6/ Edit the curl command to add )+AND+(SELECT+1+FROM+(SELECT(SLEEP(6)))x)--+-  to the bib_list parameter
7/ Run the curl notice it takes a long time to respond, if you want to check run the curl without the above part added
8/ Apply the patch and restart plack
9/ Run the modified curl and notice no longer the slow down
10/ Test in browser and make sure the basket is still sent

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 2f3f42ba98b698871bc473d65a14b5e89d0ae86c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:49:20 +02:00
Jonathan Druart 3098a95c4e Bug 36520: Prevent SQL injection in GetPreparedLetter
Actually in _get_tt_params

The following query will delay the response

SELECT `me`.`biblionumber`, `me`.`frameworkcode`, `me`.`author`, `me`.`title`, `me`.`medium`, `me`.`subtitle`, `me`.`part_number`, `me`.`part_name`, `me`.`unititle`, `me`.`notes`, `me`.`serial`, `me`.`seriestitle`
, `me`.`copyrightdate`, `me`.`timestamp`, `me`.`datecreated`, `me`.`abstract`
  FROM `biblio` `me`
WHERE `biblionumber` = '1) AND (SELECT 1 FROM (SELECT(SLEEP(6)))x)-- -'
ORDER BY field( biblionumber, 1 ) AND (
    SELECT 1
      FROM
    SELECT SLEEP( 6 ) x
   ) -- - )

To test
1/ Add some items to your cart in the opac
2/ Choose send cart
3/ Open firefox developer tools and switch to the network tab
4/ Send cart
5/ In the network tab, find the post request and choose copy as curl
6/ Edit the curl command to add )+AND+(SELECT+1+FROM+(SELECT(SLEEP(6)))x)--+-  to the bib_list parameter
7/ Run the curl notice it takes a long time to respond, if you want to check run the curl without the above part added
8/ Apply the patch and restart plack
9/ Run the modified curl and notice no longer the slow down
10/ Test in browser and make sure the basket is still sent

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 0b3c98b0ba01ea5c886ecfe8eef174b5b7c6ec25)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:49:20 +02:00
Jonathan Druart 33d9bcdd60 Bug 36520: Add tests
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit ebbab1b398a97ecc884d4cbf22d5bd4239e014cb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:49:20 +02:00
Marcel de Rooy 245864a311 Bug 36575: (QA follow-up) Shibboleth POD and checkpw_internal call
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 4cafd512cd31701fa3ee2a19abc4de4488b91e69)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:49:20 +02:00
Nick Clemens bd2cb8582c Bug 36575: Adjust checkpw_internal to return patron
This patch refactors checkpw_internal to remove the SQL code, use patron ojbects, and return the
patron that correctly matches the userid/caerdnumber when auth is successful

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit fe78f06a50c41a7dbac24206e31bc5b1189ee185)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:49:20 +02:00
Nick Clemens e6fbb9b5c1 Bug 36575: (bug 34893 follow-up) Return patron when autocreating in Shibboleth
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit f6fe24bdd8f72cdf09111a93d0ca0a114b5ee570)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:49:20 +02:00
Nick Clemens 2706fd8fbb Bug 36575: (bug 34893 follow-up) Return patron from LDAP
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit e6ce7aded6bc737fd98c2e94aba51abb4581afbb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:49:20 +02:00
Martin Renvoize 45e2302af0 Bug 36575: (QA follow-up)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit fffc5600cad077e8b4d8d5211263f1935c5b07cd)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:49:20 +02:00
Nick Clemens 39aeec0438 Bug 36575: Return correct patron when there is a shared userid / cardnumber
This patch moves some patron fetching code in C4/Auth to use to patron returned from the validation
methods and only try to fetch the patron (to check if locked, update attempts, etc) if we didn't authenticate

To test:
1 - Set a user to have userid = BANANA password = Password1
2 - Set a user to have cardnumber = BANANA password = Password2
3 - Hit the patron authentication API:
    http://localhost:8080/api/v1/auth/password/validation
    with data:
    { "identifier": "BANANA", "password":"Password1" }
    and:
    { "identifier": "BANANA", "password":"Password2" }
4 - Note you receive the same response for both
5 - Apply patch, restart all
6 - Repeat the API and confirm you get the correct patron for the password submitted

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit ff4e0c4293486d2db31d2f48d9f6f31d6470965a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:49:20 +02:00
Emmi Takkinen c97b32a60e Bug 36993: Upgrade fails at 23.12.00.023 [Bug 32132]
Database update fails on some databases because of
foreign key constraint error. This comes from attempt
to make column aqbudgets.budget_period_id not accept
NULL values. Update also fails if there are rows where
column aqbudgets.budget_period_id doesn't match any
values in aqbudgetperiods.budget_period_id.

To test:
1. Remove changes made in bug 32132 and downgrade your database:
- ALTER TABLE aqbudgets MODIFY COLUMN `budget_period_id` INT(11) NULL;
- UPDATE aqbudgets SET budget_period_id = NULL
WHERE budget_period_id IN(SELECT budget_period_id FROM aqbudgetperiods
WHERE budget_period_description = "Budget for funds without budget");
- DELETE FROM aqbudgetperiods
WHERE budget_period_description = "Budget for funds without budget";
- UPDATE systempreferences SET value="23.1200022" WHERE variable = "Version;
2. Upgrade your database (e.g. running installer/data/mysql/updatedatabase.pl)
=> Update fails on foreign key constraint error.
4. Apply this patch.
5. Try to update your database again.
=> Database should now be upgraded succesfully.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 309127226f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:45:45 +02:00
Martin Renvoize 3f1c548ee0 Bug 36986: (follow-up) Ensure idempotency
MySQL/MariaDB checks the primary key/unique constraint before WHERE
clause when performing an UPDATE. As such, the lack of AutoLocation
existing will not prevent a failure on a second run of the update.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 73634e93fd)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:38:07 +02:00
Martin Renvoize d26bc6fba4 Bug 36986L (follow-up) Ensure idempotency
MySQL/MariaDB checks the primary key/unique constraint before WHERE
clause when performing an UPDATE. As such, the lack of AutoLocation
existing will not prevent a failure on a second run of the update.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit dc2388281c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:38:07 +02:00
Martin Renvoize 6016d7eda6 Bug 36986: DBRev 24.05.00.001
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 1c779aaca8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:37:44 +02:00
Martin Renvoize 4dd3df5e1a Bug 36986: (QA follow-up) Catch the case where someone already upgraded
This adds a corresponding atomic update for the case where someone may
have already upgraded past the version we're correcting in the prior
patch.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit d0f1298951)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:37:00 +02:00
Fridolin Somers 09304fe33f Bug 36986: (Bug 26176 follow-up) Fix rename StaffLoginBranchBasedOnIP in BDRev
Test by running upgrade from 23.11.00 to main
Check you see :
Upgrade to 23.12.00.061  [15:34:36]: Bug 26176 - Rename AutoLocation and StaffLoginBranchBasedOnIP system preferences
	Renamed system preference 'AutoLocation' to 'StaffLoginRestrictLibraryByIP'
	Renamed system preference 'StaffLoginBranchBasedOnIP' to 'StaffLoginLibraryBasedOnIP'

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>
(cherry picked from commit ebd4aa6827)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-06-06 10:37:00 +02:00
807 changed files with 30061 additions and 9150 deletions

View File

@ -277,7 +277,15 @@ sub GetBasketAsCSV {
my $delimiter = $csv_profile->csv_separator;
$delimiter = "\t" if $delimiter eq "\\t";
my $csv = Text::CSV_XS->new({'quote_char'=>'"','escape_char'=>'"','sep_char'=>$delimiter,'binary'=>1});
my $csv = Text::CSV_XS->new(
{
quote_char => '"',
escape_char => '"',
sep_char => $delimiter,
binary => 1,
formula => "empty",
}
);
my $csv_profile_content = $csv_profile->content;
my ( @headers, @fields );
while ( $csv_profile_content =~ /

View File

@ -82,14 +82,9 @@ BEGIN {
get_template_and_user haspermission create_basic_session
);
$ldap = C4::Context->config('useldapserver') || 0;
$cas = C4::Context->preference('casAuthentication');
$caslogout = C4::Context->preference('casLogout');
if ($ldap) {
require C4::Auth_with_ldap;
import C4::Auth_with_ldap qw(checkpw_ldap);
}
if ($cas) {
require C4::Auth_with_cas; # no import
import C4::Auth_with_cas qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_if_required multipleAuth getMultipleAuth);
@ -554,9 +549,9 @@ sub get_template_and_user {
my $opac_limit_override = $ENV{'OPAC_LIMIT_OVERRIDE'};
my $opac_name = '';
if (
( $opac_limit_override && $opac_search_limit && $opac_search_limit =~ /branch:([\w-]+)/ ) ||
( $in->{'query'}->param('limit') && $in->{'query'}->param('limit') =~ /branch:([\w-]+)/ ) ||
( $in->{'query'}->param('limit') && $in->{'query'}->param('limit') =~ /multibranchlimit:(\w+)/ )
( $opac_limit_override && $opac_search_limit && $opac_search_limit =~ /^branch:([\w-]+)/ ) ||
( $in->{'query'}->param('limit') && $in->{'query'}->param('limit') =~ /^branch:([\w-]+)/ ) ||
( $in->{'query'}->param('limit') && $in->{'query'}->param('limit') =~ /^multibranchlimit:(\w+)/ )
) {
$opac_name = $1; # opac_search_limit is a branch, so we use it.
} elsif ( $in->{'query'}->param('multibranchlimit') ) {
@ -1218,10 +1213,10 @@ sub checkauth {
my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search->as_list };
if ( C4::Context->preference('StaffLoginRestrictLibraryByIP') ) {
# we have to check they are coming from the right ip range
my $domain = $branches->{$branchcode}->{'branchip'};
my $domain = $branches->{$branchcode}->{'branchip'} // q{};
$domain =~ s|\.\*||g;
$domain =~ s/\s+//g;
if ( $ip !~ /^$domain/ ) {
if ( $domain && $ip !~ /^$domain/ ) {
$cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie(
-name => 'CGISESSID',
-value => '',
@ -1418,6 +1413,11 @@ sub checkauth {
my $auth_error = $query->param('auth_error');
my $auth_template_name = ( $type eq 'opac' ) ? 'opac-auth.tt' : 'auth.tt';
my $template = C4::Templates::gettemplate( $auth_template_name, $type, $query );
my $borrowernumber = $patron and $patron->borrowernumber;
my $anonymous_patron = C4::Context->preference('AnonymousPatron');
my $is_anonymous_patron = $patron && ( $patron->borrowernumber eq $anonymous_patron );
$template->param(
login => 1,
INPUTS => \@inputs,
@ -1452,6 +1452,7 @@ sub checkauth {
opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'},
too_many_login_attempts => ( $patron and $patron->account_locked ),
password_has_expired => ( $patron and $patron->password_expired ),
is_anonymous_patron => ( $is_anonymous_patron ),
auth_error => $auth_error,
);
@ -1633,7 +1634,7 @@ sub check_api_auth {
-secure => ( C4::Context->https_enabled() ? 1 : 0 ),
-sameSite => 'Lax'
);
return ( $return, $cookie, $session ); # return == 'ok' here
return ( $return, $cookie, $session->id ); # return == 'ok' here
} else {
@ -1981,26 +1982,24 @@ sub checkpw {
my $shib = C4::Context->config('useshibboleth') && shib_ok();
my $shib_login = $shib ? get_login_shib() : undef;
my $anonymous_patron = C4::Context->preference('AnonymousPatron');
my @return;
my $patron;
if ( defined $userid ) {
$patron = Koha::Patrons->find( { userid => $userid } );
$patron = Koha::Patrons->find( { cardnumber => $userid } ) unless $patron;
}
my $check_internal_as_fallback = 0;
my $passwd_ok = 0;
my $patron;
# Note: checkpw_* routines returns:
# 1 if auth is ok
# 0 if auth is nok
# -1 if user bind failed (LDAP only)
if ( $patron and ( $patron->account_locked ) ) {
# Nothing to check, account is locked
} elsif ( $ldap && defined($password) ) {
$ldap = C4::Context->config('useldapserver') || 0;
if ( $ldap && defined($password) ) {
my ( $retval, $retcard, $retuserid );
( $retval, $retcard, $retuserid, $patron ) = checkpw_ldap(@_); # EXTERNAL AUTH
require C4::Auth_with_ldap;
import C4::Auth_with_ldap qw(checkpw_ldap);
( $retval, $retcard, $retuserid, $patron ) = C4::Auth_with_ldap::checkpw_ldap(@_); # EXTERNAL AUTH
if ( $retval == 1 ) {
@return = ( $retval, $retcard, $retuserid, $patron );
$passwd_ok = 1;
@ -2012,8 +2011,8 @@ sub checkpw {
# In case of a CAS authentication, we use the ticket instead of the password
my $ticket = $query->param('ticket');
$query->delete('ticket'); # remove ticket to come back to original URL
my ( $retval, $retcard, $retuserid, $cas_ticket, $patron ) =
checkpw_cas( $ticket, $query, $type ); # EXTERNAL AUTH
my ( $retval, $retcard, $retuserid, $cas_ticket );
( $retval, $retcard, $retuserid, $cas_ticket, $patron ) = checkpw_cas( $ticket, $query, $type ); # EXTERNAL AUTH
if ($retval) {
@return = ( $retval, $retcard, $retuserid, $patron, $cas_ticket );
} else {
@ -2033,7 +2032,8 @@ sub checkpw {
# Then, we check if it matches a valid koha user
if ($shib_login) {
my ( $retval, $retcard, $retuserid, $patron ) =
my ( $retval, $retcard, $retuserid );
( $retval, $retcard, $retuserid, $patron ) =
C4::Auth_with_shibboleth::checkpw_shib($shib_login); # EXTERNAL AUTH
if ($retval) {
@return = ( $retval, $retcard, $retuserid, $patron );
@ -2044,20 +2044,31 @@ sub checkpw {
$check_internal_as_fallback = 1;
}
# INTERNAL AUTH
if ($check_internal_as_fallback) {
@return = checkpw_internal( $userid, $password, $no_set_userenv );
push( @return, $patron );
$passwd_ok = 1 if $return[0] > 0; # 1 or 2
# INTERNAL AUTH
@return = checkpw_internal( $userid, $password, $no_set_userenv );
$passwd_ok = $return[0];
$patron = $passwd_ok ? $return[3] : undef;
}
if ( defined $userid && !$patron ) {
$patron = Koha::Patrons->find( { userid => $userid } );
$patron = Koha::Patrons->find( { cardnumber => $userid } ) unless $patron;
push @return, $patron if $check_internal_as_fallback; # We pass back the patron if authentication fails
}
if ($patron) {
if ($passwd_ok) {
if ( $patron->account_locked ) {
@return = ();
} elsif ($passwd_ok) {
$patron->update( { login_attempts => 0 } );
if ( $patron->password_expired ) {
if ( defined($anonymous_patron) && ($patron->borrowernumber eq $anonymous_patron) ) {
@return = ( -3, $patron );
} elsif ( $patron->password_expired ) {
@return = ( -2, $patron );
}
} elsif ( !$patron->account_locked ) {
} else {
$patron->update( { login_attempts => $patron->login_attempts + 1 } );
}
}
@ -2076,41 +2087,28 @@ sub checkpw_internal {
my ( $userid, $password, $no_set_userenv ) = @_;
$password = Encode::encode( 'UTF-8', $password )
if Encode::is_utf8($password);
if Encode::is_utf8($password);
my $dbh = C4::Context->dbh;
my $sth =
$dbh->prepare(
"select password,cardnumber,borrowernumber,userid,firstname,surname,borrowers.branchcode,branches.branchname,flags from borrowers join branches on borrowers.branchcode=branches.branchcode where userid=?"
);
$sth->execute($userid);
if ( $sth->rows ) {
my ( $stored_hash, $cardnumber, $borrowernumber, $userid, $firstname,
$surname, $branchcode, $branchname, $flags )
= $sth->fetchrow;
if ( checkpw_hash( $password, $stored_hash ) ) {
C4::Context->set_userenv( "$borrowernumber", $userid, $cardnumber,
$firstname, $surname, $branchcode, $branchname, $flags ) unless $no_set_userenv;
return 1, $cardnumber, $userid;
my $patron = Koha::Patrons->find( { userid => $userid } );
if ($patron) {
if ( checkpw_hash( $password, $patron->password ) ) {
my $borrowernumber = $patron->borrowernumber;
C4::Context->set_userenv(
"$borrowernumber", $patron->userid, $patron->cardnumber,
$patron->firstname, $patron->surname, $patron->branchcode, $patron->library->branchname, $patron->flags
) unless $no_set_userenv;
return 1, $patron->cardnumber, $patron->userid, $patron;
}
}
$sth =
$dbh->prepare(
"select password,cardnumber,borrowernumber,userid,firstname,surname,borrowers.branchcode,branches.branchname,flags from borrowers join branches on borrowers.branchcode=branches.branchcode where cardnumber=?"
);
$sth->execute($userid);
if ( $sth->rows ) {
my ( $stored_hash, $cardnumber, $borrowernumber, $userid, $firstname,
$surname, $branchcode, $branchname, $flags )
= $sth->fetchrow;
if ( checkpw_hash( $password, $stored_hash ) ) {
C4::Context->set_userenv( $borrowernumber, $userid, $cardnumber,
$firstname, $surname, $branchcode, $branchname, $flags ) unless $no_set_userenv;
return 1, $cardnumber, $userid;
$patron = Koha::Patrons->find( { cardnumber => $userid } );
if ($patron) {
if ( checkpw_hash( $password, $patron->password ) ) {
my $borrowernumber = $patron->borrowernumber;
C4::Context->set_userenv(
"$borrowernumber", $patron->userid, $patron->cardnumber,
$patron->firstname, $patron->surname, $patron->branchcode, $patron->library->branchname, $patron->flags
) unless $no_set_userenv;
return 1, $patron->cardnumber, $patron->userid, $patron;
}
}
return 0;

View File

@ -212,12 +212,13 @@ sub checkpw_ldap {
}
if ($borrowernumber) {
if ($config{update}) { # A1, B1
my $c2 = &update_local($local_userid,$password,$borrowernumber,\%borrower) || '';
($cardnumber eq $c2) or warn "update_local returned cardnumber '$c2' instead of '$cardnumber'";
} else { # C1, D1
# maybe update just the password?
return(1, $cardnumber, $local_userid);
if ( $config{update} ) { # A1, B1
my $c2 = &update_local( $local_userid, $password, $borrowernumber, \%borrower ) || '';
( $cardnumber eq $c2 ) or warn "update_local returned cardnumber '$c2' instead of '$cardnumber'";
} else { # C1, D1
# maybe update just the password?
my $patron = Koha::Patrons->find($borrowernumber);
return ( 1, $cardnumber, $local_userid, $patron );
}
} elsif ($config{replicate}) { # A2, C2
my @columns = Koha::Patrons->columns;
@ -226,6 +227,7 @@ sub checkpw_ldap {
map { exists( $borrower{$_} ) ? ( $_ => $borrower{$_} ) : () } @columns
}
)->store;
$patron->discard_changes;
die "Insert of new patron failed" unless $patron;
$borrowernumber = $patron->borrowernumber;
C4::Members::Messaging::SetMessagingPreferencesFromDefaults(

View File

@ -135,6 +135,8 @@ sub _autocreate {
}
my $patron = Koha::Patron->new( \%borrower )->store;
$patron->discard_changes;
C4::Members::Messaging::SetMessagingPreferencesFromDefaults(
{
borrowernumber => $patron->borrowernumber,
@ -172,7 +174,7 @@ sub _autocreate {
C4::Letters::SendQueuedMessages( { message_id => $message_id } ) if $message_id;
}
}
return ( 1, $patron->cardnumber, $patron->userid );
return ( 1, $patron->cardnumber, $patron->userid, $patron );
}
sub _sync {
@ -409,7 +411,7 @@ This routine is NOT exported
=head2 _autocreate
my ( $retval, $retcard, $retuserid ) = _autocreate( $config, $match );
my ( $retval, $retcard, $retuserid, $patron ) = _autocreate( $config, $match, $patron );
Given a shibboleth attribute reference and a userid this internal routine will add the given user to Koha and return their user credentials.

View File

@ -323,17 +323,17 @@ sub SearchAuthorities {
if ( C4::Context->preference('ShowHeadingUse') ) {
# checking valid heading use
my $f008 = $authrecord->field('008');
my $pos14to16 = substr( $f008->data, 14, 3 );
my $main = substr( $pos14to16, 0, 1 );
$newline{main} = 1 if $main eq 'a';
my $subject = substr( $pos14to16, 1, 1);
$newline{subject} = 1 if $subject eq 'a';
my $series = substr( $pos14to16, 2, 1 );
$newline{series} = 1 if $series eq 'a';
if ($f008) {
my $pos14to16 = substr( $f008->data, 14, 3 );
my $main = substr( $pos14to16, 0, 1 );
$newline{main} = 1 if $main eq 'a';
my $subject = substr( $pos14to16, 1, 1 );
$newline{subject} = 1 if $subject eq 'a';
my $series = substr( $pos14to16, 2, 1 );
$newline{series} = 1 if $series eq 'a';
}
}
$newline{authtype} = defined($thisauthtype) ?
$thisauthtype->authtypetext : '';
$newline{authtype} = defined($thisauthtype) ? $thisauthtype->authtypetext : '';
$newline{summary} = $summary;
$newline{even} = $counter % 2;
$newline{reported_tag} = $reported_tag;
@ -1009,14 +1009,13 @@ sub BuildSummary {
} } $record->field('7..');
} else {
# construct MARC21 summary
# FIXME - looping over 1XX is questionable
# since MARC21 authority should have only one 1XX
# construct MARC21 summary
# FIXME - looping over 1XX is questionable
# since MARC21 authority should have only one 1XX
use C4::Heading::MARC21;
my $handler = C4::Heading::MARC21->new();
my $subfields_to_report;
my $subfields_to_subdivision = "";
my $delimiter = C4::Context->preference('AuthoritySeparator');
my $delimiter = C4::Context->preference('AuthoritySeparator');
foreach my $field ($record->field('1..')) {
my $tag = $field->tag();
@ -1095,7 +1094,8 @@ sub BuildSummary {
push @notes, { note => $field->as_string(), field => $field->tag() };
}
foreach my $field ( $record->field('7..') ) {
foreach my $field ( $record->field('7..') ) {
my $subfields_to_subdivision;
my $tag = $field->tag();
if ( $tag eq '700' ) {
@ -1138,9 +1138,11 @@ sub BuildSummary {
my $heading = $field->as_string($subfields_to_report);
my $subheading = $field->as_string( $subfields_to_subdivision, $delimiter );
if ( length $subheading > 0 ) {
$heading .= $delimiter . $subheading;
if ($subfields_to_subdivision) {
my $subheading = $field->as_string( $subfields_to_subdivision, $delimiter );
if ( length $subheading > 0 ) {
$heading .= $delimiter . $subheading;
}
}
if ($subfields_to_report) {

View File

@ -94,11 +94,12 @@ sub max {
return $self->db_max;
}
sub db_max {
my $self = shift;
my $query = "SELECT max(abs(barcode)) FROM items LIMIT 1"; # Possible problem if multiple barcode types populated
my $sth = C4::Context->dbh->prepare($query);
$sth->execute();
return $sth->fetchrow_array || $self->initial;
my $self = shift;
my $query = "SELECT max(abs(CAST(barcode AS UNSIGNED))) FROM items LIMIT 1"
; # Possible problem if multiple barcode types populated
my $sth = C4::Context->dbh->prepare($query);
$sth->execute();
return $sth->fetchrow_array || $self->initial;
}
sub next_value {
my $self = shift;

View File

@ -555,9 +555,13 @@ sub DelBiblio {
# We delete any existing holds
my $holds = $biblio->holds;
$holds->update( { deleted_biblionumber => $biblionumber }, { no_triggers => 1 } );
my $old_holds = $biblio->old_holds;
$old_holds->update( { deleted_biblionumber => $biblionumber }, { no_triggers => 1 } );
while ( my $hold = $holds->next ) {
# no need to update the holds queue on each step, we'll do it at the end
$hold->cancel({ skip_holds_queue => 1 });
$hold->cancel( { skip_holds_queue => 1 } );
}
# We update any existing orders
@ -3100,19 +3104,21 @@ sub UpdateTotalIssues {
$exception->rethrow unless ( $exception->isa('Koha::Exceptions::Metadata::Invalid') );
warn $exception;
warn "UpdateTotalIssues could not get bibliographic record for biblionumber $biblionumber";
return;
return -1;
}
my $biblioitem = $biblio->biblioitem;
my ($totalissuestag, $totalissuessubfield) = GetMarcFromKohaField( 'biblioitems.totalissues' );
unless ($totalissuestag) {
return 1; # There is nothing to do
return 0; # There is nothing to do
}
my $current_issues = $biblioitem->totalissues // 0;
if (defined $value) {
$totalissues = $value;
} else {
$totalissues = $biblioitem->totalissues + $increase;
}
return 0 if $current_issues == $totalissues; # No need to update if no changes
my $field = $record->field($totalissuestag);
if (defined $field) {

View File

@ -1266,9 +1266,8 @@ sub CanBookBeIssued {
## CHECK AGE RESTRICTION
my $agerestriction = $biblioitem->agerestriction;
my ( $restriction_age, $daysToAgeRestriction ) =
GetAgeRestriction( $agerestriction, $patron->unblessed );
if ( $daysToAgeRestriction && $daysToAgeRestriction > 0 ) {
my $restriction_age = GetAgeRestriction( $agerestriction );
if ( $restriction_age && $patron->dateofbirth && $restriction_age > $patron->get_age() ) {
if ( C4::Context->preference('AgeRestrictionOverride') ) {
$needsconfirmation{AGE_RESTRICTION} = "$agerestriction";
}
@ -1591,7 +1590,7 @@ sub AddIssue {
$issuedate, # here interpreted as the renewal date
}
);
$issue = $item_object->checkout;
$issue = $item_object->checkout->get_from_storage;
}
else {
@ -2461,7 +2460,7 @@ sub AddReturn {
ccode => $item->ccode,
categorycode => $categorycode,
interface => C4::Context->interface,
}) unless ( $skip_localuse && $stat_type eq 'localuse' );
}) unless ( $skip_localuse && !$issue );
# Send a check-in slip. # NOTE: borrower may be undef. Do not try to send messages then.
if ( $patron ) {
@ -4421,21 +4420,15 @@ sub IsItemIssued {
=head2 GetAgeRestriction
my ($ageRestriction, $daysToAgeRestriction) = GetAgeRestriction($record_restrictions, $borrower);
my ($ageRestriction, $daysToAgeRestriction) = GetAgeRestriction($record_restrictions);
if($daysToAgeRestriction <= 0) { #Borrower is allowed to access this material, as they are older or as old as the agerestriction }
if($daysToAgeRestriction > 0) { #Borrower is this many days from meeting the agerestriction }
my $ageRestriction = GetAgeRestriction($record_restrictions);
@PARAM1 the koha.biblioitems.agerestriction value, like K18, PEGI 13, ...
@PARAM2 a borrower-object with koha.borrowers.dateofbirth. (OPTIONAL)
@RETURNS The age restriction age in years and the days to fulfill the age restriction for the given borrower.
Negative days mean the borrower has gone past the age restriction age.
@RETURNS The age restriction age in years.
=cut
sub GetAgeRestriction {
my ($record_restrictions, $borrower) = @_;
my ($record_restrictions) = @_;
my $markers = C4::Context->preference('AgeRestrictionMarker');
return unless $record_restrictions;
@ -4470,26 +4463,7 @@ sub GetAgeRestriction {
last if ( $restriction_year > 0 );
}
#Check if the borrower is age restricted for this material and for how long.
if ($restriction_year && $borrower) {
if ( $borrower->{'dateofbirth'} ) {
my @alloweddate = split /-/, $borrower->{'dateofbirth'};
$alloweddate[0] += $restriction_year;
#Prevent runime eror on leap year (invalid date)
if ( ( $alloweddate[1] == 2 ) && ( $alloweddate[2] == 29 ) ) {
$alloweddate[2] = 28;
}
#Get how many days the borrower has to reach the age restriction
my @Today = split /-/, dt_from_string()->ymd();
my $daysToAgeRestriction = Date_to_Days(@alloweddate) - Date_to_Days(@Today);
#Negative days means the borrower went past the age restriction age
return ($restriction_year, $daysToAgeRestriction);
}
}
return ($restriction_year);
return $restriction_year;
}

View File

@ -364,9 +364,11 @@ sub multivalue_preference {
my ( $self, $preference ) = @_;
my $syspref = $self->preference($preference) // q{};
my $values = [ split qr{\|}, $syspref ];
return $values;
return [ split qr{\|}, $syspref ]
if $syspref =~ qr{\|};
return [ split qr{,}, $syspref ]
}
=head2 enable_syspref_cache

View File

@ -345,8 +345,7 @@ sub get_label_summary {
$record->{'title'} =~ s/\W*$//; # strip off ugly trailing chars
# FIXME contructing staff interface URLs should be done *much* higher up the stack - for the most part, C4 module code
# should not know that it's part of a web app
$record->{'title'} = '<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' . $record->{'biblionumber'} . '"> ' . $record->{'title'} . '</a>';
$label_summary->{'_summary'} = $record->{'title'} . " | " . ($record->{'author'} ? $record->{'author'} : 'N/A');
$label_summary->{'_summary'} = { title => $record->{title}, author => $record->{author}, biblionumber => $record->{biblionumber} };
$label_summary->{'_item_type'} = C4::Context->preference("item-level_itypes") ? $record->{'itype'} : $record->{'itemtype'};
$label_summary->{'_barcode'} = $record->{'barcode'};
$label_summary->{'_item_number'} = $item->{'item_number'};

View File

@ -151,22 +151,6 @@ sub authorities {
return $results;
}
=head2 preferred_authorities
my $preferred_authorities = $heading->preferred_authorities;
Return a list of authority records for headings
that are a preferred form of the heading.
=cut
sub preferred_authorities {
my $self = shift;
my $skipmetadata = shift || undef;
my ( $results, $total ) = _search( 'see-from', $skipmetadata );
return $results;
}
=head2 valid_heading_subfield
if (C4::Heading::valid_heading_subfield('100', 'e', '')) ...

View File

@ -421,7 +421,7 @@ sub _allocateWithTransportCostMatrix {
my @remaining_items = grep { !exists $allocated_items->{ $_->{itemnumber} } && $_->{holdallowed} ne 'not_allowed'; }
@$available_items;
my @requests = grep { !defined $_->{itemnumber} } @$hold_requests;
my @requests = grep { !defined $_->{itemnumber} && !defined $_->{allocated} } @$hold_requests;
my @remaining = ();
my $num_agents = scalar(@remaining_items);

View File

@ -218,7 +218,7 @@ sub GetRecords {
my $biblioitem = $biblio->biblioitem->unblessed;
my $record = $biblio->metadata->record({ embed_items => 1 });
my $record = $biblio->metadata->record({ embed_items => 1, opac => 1, });
if ($record) {
$biblioitem->{marcxml} = $record->as_xml_record( C4::Context->preference('marcflavour') );
}
@ -236,7 +236,7 @@ sub GetRecords {
foreach my $checkout (@$checkouts) {
delete $checkout->{'borrowernumber'};
}
my @items = $biblio->items->as_list;
my @items = $biblio->items->filter_by_visible_in_opac->as_list;
$biblioitem->{items}->{item} = [];
@ -968,7 +968,7 @@ sub _availability {
my $location = $library ? $library->branchname : '';
my $itemcallnumber = $item->itemcallnumber;
if ( $item->is_notforloan ) {
if ( $item->effective_not_for_loan_status ) {
return ( $biblionumber, __('not available'), __('Not for loan'), $location, $itemcallnumber );
} elsif ( $item->onloan ) {
return ( $biblionumber, __('not available'), __('Checked out'), $location, $itemcallnumber );

View File

@ -291,6 +291,7 @@ sub _export_table_csv
for my $field (@fields) {
my $value = $hashRef->{$field} // q||;
$value =~ s/[\r\n]//g;
$value =~ s/"/""/g;
$$strCSV .= '"' . $value . '",';
}
chop $$strCSV;
@ -965,7 +966,7 @@ sub _import_table_csv
shift @fieldsPK;
my $ok = 0;
my $pos = 0;
my $csv = Text::CSV_XS->new ({ binary => 1 });
my $csv = Text::CSV_XS->new( { binary => 1, formula => "empty" } );
while ( my $row = $csv->getline($dom) ) {
my @fields = @$row;
@arrData = @fields;

View File

@ -45,6 +45,7 @@ BEGIN {
}
use Carp qw( croak );
use C4::Circulation qw( barcodedecode );
use C4::Context;
use C4::Koha;
use C4::Biblio qw( GetMarcStructure TransformMarcToKoha );
@ -459,11 +460,15 @@ sub CheckItemPreSave {
my %errors = ();
# check for duplicate barcode
if (exists $item_ref->{'barcode'} and defined $item_ref->{'barcode'}) {
my $existing_item= Koha::Items->find({barcode => $item_ref->{'barcode'}});
if ( exists $item_ref->{'barcode'} and defined $item_ref->{'barcode'} ) {
my $barcode = C4::Circulation::barcodedecode( $item_ref->{'barcode'} );
my $existing_item = Koha::Items->find( { barcode => $barcode } );
if ($existing_item) {
if (!exists $item_ref->{'itemnumber'} # new item
or $item_ref->{'itemnumber'} != $existing_item->itemnumber) { # existing item
if (
!exists $item_ref->{'itemnumber'} # new item
or $item_ref->{'itemnumber'} != $existing_item->itemnumber
)
{ # existing item
$errors{'duplicate_barcode'} = $item_ref->{'barcode'};
}
}
@ -1178,7 +1183,7 @@ sub SearchItems {
LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber
LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber
LEFT JOIN biblio_metadata ON biblio_metadata.biblionumber = biblio.biblionumber
LEFT JOIN issues ON issues.itemnumber = items.itemnumber
LEFT JOIN issues USING (itemnumber)
WHERE 1
};
if (defined $where_str and $where_str ne '') {

View File

@ -115,7 +115,7 @@ sub _get_label_item {
sub _get_text_fields {
my $format_string = shift;
my $csv = Text::CSV_XS->new({allow_whitespace => 1});
my $csv = Text::CSV_XS->new( { allow_whitespace => 1, formula => "empty" } );
my $status = $csv->parse($format_string);
my @sorted_fields = map {{ 'code' => $_, desc => $_ }}
map { $_ && $_ eq 'callnumber' ? 'itemcallnumber' : $_ } # see bug 5653

View File

@ -557,24 +557,30 @@ sub SendAlerts {
=head2 GetPreparedLetter( %params )
%params hash:
module => letter module, mandatory
letter_code => letter code, mandatory
branchcode => for letter selection, if missing default system letter taken
tables => a hashref with table names as keys. Values are either:
- a scalar - primary key value
- an arrayref - primary key values
- a hashref - full record
substitute => custom substitution key/value pairs
repeat => records to be substituted on consecutive lines:
- an arrayref - tries to guess what needs substituting by
taking remaining << >> tokensr; not recommended
- a hashref token => @tables - replaces <token> << >> << >> </token>
subtemplate for each @tables row; table is a hashref as above
want_librarian => boolean, if set to true triggers librarian details
substitution from the userenv
Return value:
letter fields hashref (title & content useful)
my $letter = GetPreparedLetter(
{
module => "letter module", # mandatory
letter_code => "letter code", # mandatory
branchcode => "for letter selection", # if missing default system letter taken
objects => {}, # a hashref with object names as keys and objects as values
tables => {}, # a hashref with table names as keys. Values are either:
# - a scalar - primary key value
# - an arrayref - primary key values
# - a hashref - full record
substitute => {}, # custom substitution key/value pairs
repeat => '', # records to be substituted on consecutive lines, accepts either:
# - an arrayref
# tries to guess what needs substituting by taking remaining
# << >> tokensr; not recommended
# - a hashref token => @tables
# replaces <token> << >> << >> </token> subtemplate for each
# @tables row; table is a hashref as above
want_librarian => '' # boolean, if set to true triggers librarian details substitution
# from the userenv
}
);
Return value: letter fields hashref (title & content useful)
=cut
@ -1563,8 +1569,8 @@ sub _wrap_html {
$css = qq{<link rel="stylesheet" type="text/css" href="$css">} if $css;
return <<EOS;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
"https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xml:lang="en" xmlns="https://www.w3.org/1999/xhtml">
<head>
<title>$title</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@ -1701,8 +1707,8 @@ sub _process_tt {
my $use_template_cache = C4::Context->config('template_cache_dir') && defined $ENV{GATEWAY_INTERFACE};
my $template = Template->new(
{
EVAL_PERL => 1,
ABSOLUTE => 1,
EVAL_PERL => 0,
ABSOLUTE => 0,
PLUGIN_BASE => 'Koha::Template::Plugin',
COMPILE_EXT => $use_template_cache ? '.ttc' : '',
COMPILE_DIR => $use_template_cache ? C4::Context->config('template_cache_dir') : '',
@ -1890,6 +1896,7 @@ sub _get_tt_params {
},
};
my $dbh = C4::Context->dbh;
foreach my $table ( keys %$tables ) {
next unless $config->{$table};
@ -1910,12 +1917,19 @@ sub _get_tt_params {
my $objects = $module->search(
{ $key => $values },
{
# We want to retrieve the data in the same order
# FIXME MySQLism
# field is a MySQLism, but they are no other way to do it
# To be generic we could do it in perl, but we will need to fetch
# all the data then order them
@$values ? ( order_by => \[ "field($key, " . join( ', ', @$values ) . ")" ] ) : ()
# We want to retrieve the data in the same order
# FIXME MySQLism
# field is a MySQLism, but they are no other way to do it
# To be generic we could do it in perl, but we will need to fetch
# all the data then order them
@$values
? (
order_by => \[
sprintf "field(%s, %s)", $key,
join(',', map { $dbh->quote($_) } @$values )
]
)
: ()
}
);
$params->{ $config->{$table}->{plural} } = $objects;

View File

@ -31,6 +31,7 @@ sub get_link {
my $search_form = $heading->search_form();
my $auth_type = $heading->auth_type();
my $thesaurus = $heading->{thesaurus} || 'notdefined';
$thesaurus = 'notconsidered' unless C4::Context->preference('LinkerConsiderThesaurus');
my $authid;
my $fuzzy = 0;
my $match_count;
@ -91,6 +92,7 @@ sub update_cache {
my $search_form = $heading->search_form();
my $auth_type = $heading->auth_type();
my $thesaurus = $heading->{thesaurus} || 'notdefined';
$thesaurus = 'notconsidered' unless C4::Context->preference('LinkerConsiderThesaurus');
my $fuzzy = 0;
$self->{'cache'}->{$search_form.$auth_type.$thesaurus}->{'cached'} = 1;

View File

@ -288,10 +288,12 @@ sub CalcFine {
&& $amount > $issuing_rule->{overduefinescap};
# This must be moved to Koha::Item (see also similar code in C4::Accounts::chargelostitem
$item->{replacementprice} ||= $itemtype->defaultreplacecost
if $itemtype
&& ( ! defined $item->{replacementprice} || $item->{replacementprice} == 0 )
&& C4::Context->preference("useDefaultReplacementCost");
if ( $itemtype
&& ( !defined $item->{replacementprice} || $item->{replacementprice} + .0 == 0 )
&& C4::Context->preference("useDefaultReplacementCost") )
{
$item->{replacementprice} = $itemtype->defaultreplacecost;
}
$amount = $item->{replacementprice} if ( $issuing_rule->{cap_fine_to_replacement_price} && $item->{replacementprice} && $amount > $item->{replacementprice} );
@ -683,7 +685,7 @@ sub GetBranchcodesWithOverdueRules {
WHERE delay1 IS NOT NULL
ORDER BY branchcode
|);
if ( $branchcodes->[0] eq '' ) {
if ( defined $branchcodes->[0] && $branchcodes->[0] eq '' ) {
# If a default rule exists, all branches should be returned
return Koha::Libraries->search({}, { order_by => 'branchname' })->get_column('branchcode');
}

View File

@ -286,7 +286,7 @@ sub draw_text {
# $font_units_width = $m->string_width($line);
# $string_width = ($font_units_width * $text_attribs->{'font_size'}) / $units_per_em;
if ( ( $string_width + $text_attribs->{'llx'} ) < $self->{'width'} ) {
if ( $string_width && ( ( $string_width + $text_attribs->{'llx'} ) < $self->{'width'} ) ) {
( $Tx, $Tw ) = text_alignment(
$origin_llx, $self->{'width'}, $text_attribs->{'llx'}, $string_width, $line,
$text_attribs->{'text_alignment'}

View File

@ -401,7 +401,7 @@ sub marc2csv {
my ($biblios, $id, $itemnumbers) = @_;
$itemnumbers ||= [];
my $output;
my $csv = Text::CSV::Encoded->new();
my $csv = Text::CSV::Encoded->new( { formula => "empty" } );
# Getting yaml file
my $configfile = "../tools/csv-profiles/$id.yaml";

View File

@ -220,10 +220,13 @@ sub _get_columns {
$tablehash{'__first__'} = $first;
push @columns, \%tablehash;
while ( my $data = $sth->fetchrow_arrayref() ) {
my %temphash;
$temphash{'name'} = "$tablename.$data->[0]";
$temphash{'description'} = $columns->{$tablename}->{$data->[0]};
push @columns, \%temphash;
my $forbidden = Koha::Report->new->check_columns( undef, [$data->[0]] );
unless ( $forbidden ) {
my %temphash;
$temphash{'name'} = "$tablename.$data->[0]";
$temphash{'description'} = $columns->{$tablename}->{$data->[0]};
push @columns, \%temphash;
}
}
$sth->finish();
return (@columns);
@ -623,6 +626,11 @@ sub execute_query {
->info("Report finished: $report_id") if $report_id;
return ( $sth, { queryerr => $sth->errstr } ) if ( $sth->err );
# Check if table.* contained forbidden column names
return ( $sth, { passworderr => "Illegal column in results" } )
if Koha::Report->new->check_columns( undef, $sth->{NAME_lc} );
return ($sth);
}

View File

@ -44,7 +44,6 @@ use Koha::Holds;
use Koha::ItemTypes;
use Koha::Items;
use Koha::Libraries;
use Koha::Old::Holds;
use Koha::Patrons;
use Koha::Plugins;
use Koha::Policy::Holds;
@ -485,10 +484,6 @@ sub CanItemBeReserved {
}
}
# we retrieve borrowers and items informations #
# item->{itype} will come for biblioitems if necessery
my $borrower = $patron->unblessed;
# If an item is damaged and we don't allow holds on damaged items, we can stop right here
return _cache { status =>'damaged' }
if ( $item->damaged
@ -497,9 +492,8 @@ sub CanItemBeReserved {
if( GetMarcFromKohaField('biblioitems.agerestriction') ){
my $biblio = $item->biblio;
# Check for the age restriction
my ( $ageRestriction, $daysToAgeRestriction ) =
C4::Circulation::GetAgeRestriction( $biblio->biblioitem->agerestriction, $borrower );
return _cache { status => 'ageRestricted' } if $daysToAgeRestriction && $daysToAgeRestriction > 0;
my $ageRestriction = C4::Circulation::GetAgeRestriction( $biblio->biblioitem->agerestriction );
return _cache { status => 'ageRestricted' } if $ageRestriction && $patron->dateofbirth && $ageRestriction > $patron->get_age();
}
# Check that the patron doesn't have an item level hold on this item already
@ -527,14 +521,14 @@ sub CanItemBeReserved {
}
elsif ( $controlbranch eq "PatronLibrary" ) {
$branchfield = "borrowers.branchcode";
$reserves_control_branch = $borrower->{branchcode};
$reserves_control_branch = $patron->branchcode;
}
# we retrieve rights
if (
my $reservesallowed = Koha::CirculationRules->get_effective_rule({
itemtype => $item->effective_itemtype,
categorycode => $borrower->{categorycode},
categorycode => $patron->categorycode,
branchcode => $reserves_control_branch,
rule_name => 'reservesallowed',
})
@ -547,7 +541,7 @@ sub CanItemBeReserved {
}
my $rights = Koha::CirculationRules->get_effective_rules({
categorycode => $borrower->{'categorycode'},
categorycode => $patron->categorycode,
itemtype => $item->effective_itemtype,
branchcode => $reserves_control_branch,
rules => ['holds_per_record','holds_per_day']
@ -656,7 +650,7 @@ sub CanItemBeReserved {
}
if ( $branchitemrule->{holdallowed} eq 'from_home_library'
&& $borrower->{branchcode} ne $item->homebranch )
&& $patron->branchcode ne $item->homebranch )
{
return _cache { status => 'cannotReserveFromOtherBranches' };
}
@ -685,7 +679,7 @@ sub CanItemBeReserved {
if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup' && !$item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) {
return _cache { status => 'pickupNotInHoldGroup' };
}
if ($branchitemrule->{hold_fulfillment_policy} eq 'patrongroup' && !Koha::Libraries->find({branchcode => $borrower->{branchcode}})->validate_hold_sibling({branchcode => $pickup_branchcode})) {
if ($branchitemrule->{hold_fulfillment_policy} eq 'patrongroup' && !Koha::Libraries->find({branchcode => $patron->branchcode})->validate_hold_sibling({branchcode => $pickup_branchcode})) {
return _cache { status => 'pickupNotInHoldGroup' };
}
}
@ -1602,6 +1596,7 @@ sub _FixPriority {
$hold = Koha::Holds->find( $reserve_id );
if (!defined $hold){
# may have already been checked out and hold fulfilled
require Koha::Old::Holds;
$hold = Koha::Old::Holds->find( $reserve_id );
}
return unless $hold;
@ -2118,6 +2113,8 @@ sub RevertWaitingStatus {
}
)->next;
my $original = C4::Context->preference('HoldsLog') ? $hold->unblessed : undef;
## Increment the priority of all other non-waiting
## reserves for this bib record
my $holds = Koha::Holds->search({ biblionumber => $hold->biblionumber, priority => { '>' => 0 } })
@ -2134,7 +2131,7 @@ sub RevertWaitingStatus {
}
)->store( { hold_reverted => 1 } );
logaction( 'HOLDS', 'MODIFY', $hold->id, $hold )
logaction( 'HOLDS', 'MODIFY', $hold->id, $hold, undef, $original )
if C4::Context->preference('HoldsLog');
_FixPriority( { biblionumber => $hold->biblionumber } );

View File

@ -132,12 +132,36 @@ sub checkout {
# BEGIN TRANSACTION
$circ->patron( $patron = C4::SIP::ILS::Patron->new($patron_id) );
$circ->item( $item = C4::SIP::ILS::Item->new($item_id) );
if ($fee_ack) {
$circ->fee_ack($fee_ack);
}
if ( !$patron ) {
$circ->screen_msg("Invalid Patron");
}
elsif ( !$item ) {
$circ->screen_msg("Invalid Item");
}
elsif ( $no_block_due_date ) {
# A no block due date means we need check this item out to the patron
# regardless if fines, restrictions or any other things that would
# typically prevent a patron from checking out.
# A no block transaction is used for send offline ( store and forward )
# transaction to Koha. The patron already has possession of the item
# so it should be checked out to the patron no matter what.
$circ->do_checkout( $account, $no_block_due_date );
$item->{borrowernumber} = $patron_id;
$item->{due_date} = $circ->{due};
push( @{ $patron->{items} }, { barcode => $item_id } );
$circ->desensitize( !$item->magnetic_media );
siplog(
"LOG_DEBUG", "ILS::Checkout: patron %s has checked out %s via a no block checkout",
$patron_id, join( ', ', map { $_->{barcode} } @{ $patron->{items} } )
);
}
elsif ( !$patron->charge_ok ) {
if ($patron->debarred) {
$circ->screen_msg("Patron debarred");
@ -169,7 +193,9 @@ sub checkout {
$circ->screen_msg("Item type cannot be checked out at this checkout location");
}
else {
$circ->do_checkout($account, $no_block_due_date);
# No block checkouts were handled earlier so there is no need
# to bass the no block due date here.
$circ->do_checkout($account);
if ( $circ->ok ) {
# If the item is already associated with this patron, then
@ -311,7 +337,7 @@ sub end_patron_session {
my ($self, $patron_id) = @_;
# success?, screen_msg, print_line
return (1, 'Thank you !', '');
return (1, 'Thank you!', '');
}
sub pay_fee {

View File

@ -121,6 +121,9 @@ sub new {
}
}
# Get currency 3 chars max
my $currency = substr Koha::Acquisition::Currencies->get_active->currency, 0, 3;
my $circ_blocked =( C4::Context->preference('OverduesBlockCirc') ne "noblock" && defined $flags->{ODUES}->{itemlist} ) ? 1 : 0;
{
no warnings; # any of these $kp->{fields} being concat'd could be undef
@ -164,6 +167,7 @@ sub new {
fine_blocked => $fine_blocked,
fee_limit => $fee_limit,
userid => $kp->{userid},
currency => $currency,
);
}
@ -205,7 +209,7 @@ sub new {
}
}
# FIXME: populate fine_items recall_items
# FIXME: populate recall_items
$ilspatron{unavail_holds} = _get_outstanding_holds($kp->{borrowernumber});
my $pending_checkouts = $patron->pending_checkouts;
@ -390,6 +394,7 @@ sub x_items {
my $item_list = [];
if ($self->{$array_var}) {
if ($start && $start > 1) {
--$start;
}
@ -397,6 +402,7 @@ sub x_items {
$start = 0;
}
if ( $end && $end < @{$self->{$array_var}} ) {
--$end;
}
else {
$end = @{$self->{$array_var}};
@ -430,29 +436,33 @@ sub charged_items {
return $self->x_items('items', @_);
}
sub fine_items {
require Koha::Database;
require Template;
my $self = shift;
my $start = shift;
my $end = shift;
my $self = shift;
my $start = shift;
my $end = shift;
my $server = shift;
my @fees = Koha::Database->new()->schema()->resultset('Accountline')->search(
my @fees =
Koha::Database->new()->schema()->resultset('Accountline')->search(
{
borrowernumber => $self->{borrowernumber},
amountoutstanding => { '>' => '0' },
}
);
);
$start = $start ? $start - 1 : 0;
$end = $end ? $end - 1 : scalar @fees - 1;
my $av_field_template = $server ? $server->{account}->{av_field_template} : undef;
$av_field_template ||= "[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]";
my $av_field_template =
$server ? $server->{account}->{av_field_template} : undef;
$av_field_template ||=
"[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]";
my @return_values;
for ( my $i = $start; $i <= $end; $i++ ) {
for ( my $i = $start ; $i <= $end ; $i++ ) {
my $fee = $fees[$i];
next unless $fee;
@ -462,7 +472,9 @@ sub fine_items {
}
return \@return_values;
}
sub recall_items {
my $self = shift;
return $self->x_items('recall_items', @_);

View File

@ -8,7 +8,7 @@ use FindBin qw($Bin);
use lib "$Bin";
use Net::Server::PreFork;
use IO::Socket::INET;
use Socket qw(:DEFAULT :crlf);
use Socket qw(:DEFAULT :crlf TCP_KEEPIDLE TCP_KEEPINTVL IPPROTO_TCP);
use Scalar::Util qw(blessed);
require UNIVERSAL::require;
@ -90,6 +90,126 @@ push @parms, 'group=' . $>;
# This is the main event.
__PACKAGE__ ->run(@parms);
#
# Server
#
=head3 options
As per Net::Server documentation, override "options" to provide your own
custom options to the Net::Server* object. This allows us to use the Net::Server
infrastructure for configuration rather than hacking our own configuration into the
object.
=cut
sub options {
my $self = shift;
my $prop = $self->{'server'};
my $template = shift;
# setup options in the parent classes
$self->SUPER::options($template);
$prop->{'custom_tcp_keepalive'} ||= undef;
$template->{'custom_tcp_keepalive'} = \$prop->{'custom_tcp_keepalive'};
$prop->{'custom_tcp_keepalive_time'} ||= undef;
$template->{'custom_tcp_keepalive_time'} = \$prop->{'custom_tcp_keepalive_time'};
$prop->{'custom_tcp_keepalive_intvl'} ||= undef;
$template->{'custom_tcp_keepalive_intvl'} = \$prop->{'custom_tcp_keepalive_intvl'};
}
=head3 post_configure_hook
As per Net::Server documentation, this method validates our custom configuration.
=cut
sub post_configure_hook {
my $self = shift;
my $prop = $self->{'server'};
if ( defined $prop->{'custom_tcp_keepalive'} && $prop->{'custom_tcp_keepalive'} ) {
#NOTE: Any true value defined is forced to 1 just for the sake of predictability
$prop->{'custom_tcp_keepalive'} = 1;
}
foreach my $key ( 'custom_tcp_keepalive_time', 'custom_tcp_keepalive_intvl' ) {
my $value = $prop->{$key};
#NOTE: A regex is used here to detect a positive integer, as int() returns integers but does not validate them
#NOTE: We do not allow zero as it can lead to problematic behaviour
if ( $value && $value =~ /^\d+$/ ) {
#NOTE: Strictly, you must convert into an integer as a string will cause setsockopt to fail
$prop->{$key} = int($value);
}
}
}
=head3 post_accept_hook
This hook occurs after the client connection socket is created, which gives
us an opportunity to enable support for TCP keepalives using the SO_KEEPALIVE
socket option.
By default, the kernel-level defaults (in seconds) are used. You can view these in the output of "sysctl -a":
net.ipv4.tcp_keepalive_intvl = 75
net.ipv4.tcp_keepalive_time = 7200
Alternatively, you can use "custom_tcp_keepalive_time" and "custom_tcp_keepalive_intvl" to define
your own custom values for the socket. Note that these parameters are defined at the top server-level
and not on the listener-level.
If you lower "custom_tcp_keepalive_time" below 75, you will also need to set "custom_tcp_keepalive_intvl".
The "tcp_keepalive_time" is the initial time used for the keepalive timer, and the "tcp_keepalive_intvl"
is the time used for subsequent keepalive timers. However, timers only send keepalive ACKs if the idle time
elapsed is greater than "tcp_keepalive_time".
Thus, if "tcp_keepalive_time = 10" and "tcp_keepalive_intvl = 5", a keepalive ACK will be sent every 10 seconds
of idle time. If "tcp_keepalive_intvl = 10" and "tcp_keepalive_time = 5", a keepalive ACK will be sent after 5
seconds of idle time, and the next keepalive ACK will be sent after 10 seconds of idle time. Generally speaking,
it's best to set "tcp_keepalive_time" to be higher than "tcp_keepalive_intvl".
Reminder: once these settings are set on the socket, they are handled by the operating system kernel, and not
by the SIP server application. If you are having trouble with your settings, monitor your TCP traffic using
a tool such as "tcpdump" to review and refine how they work.
=cut
sub post_accept_hook {
my $self = shift;
my $prop = $self->{'server'};
my $client = shift || $prop->{'client'};
my $tcp_keepalive = $prop->{custom_tcp_keepalive};
my $tcp_keepalive_time = $prop->{custom_tcp_keepalive_time};
my $tcp_keepalive_intvl = $prop->{custom_tcp_keepalive_intvl};
if ($tcp_keepalive) {
#NOTE: set the SO_KEEPALIVE option to enable TCP keepalives
setsockopt( $client, SOL_SOCKET, SO_KEEPALIVE, 1 )
or die "Unable to set SO_KEEPALIVE: $!";
if ($tcp_keepalive_time) {
#NOTE: override "net.ipv4.tcp_keepalive_time" kernel parameter for this socket
setsockopt( $client, IPPROTO_TCP, TCP_KEEPIDLE, $tcp_keepalive_time )
or die "Unable to set TCP_KEEPIDLE: $!";
}
if ($tcp_keepalive_intvl) {
#NOTE: override "net.ipv4.tcp_keepalive_intvl" kernel parameter for this socket
setsockopt( $client, IPPROTO_TCP, TCP_KEEPINTVL, $tcp_keepalive_intvl )
or die "Unable to set TCP_KEEPINTVL: $!";
}
}
}
#
# Child
#

View File

@ -1,6 +1,9 @@
#
# Sip.pm: General Sip utility functions
#
=head1 NAME
C4::SIP::Sip - General Sip utility functions
=cut
package C4::SIP::Sip;
@ -187,34 +190,33 @@ sub boolspace {
#
sub write_msg {
my ($self, $msg, $file, $terminator, $encoding) = @_;
my ( $self, $msg, $server ) = @_;
my $terminator = $server->{account}->{terminator};
my $encoding = $server->{account}->{encoding};
$terminator ||= q{};
$terminator = ( $terminator eq 'CR' ) ? $CR : $CRLF;
$msg = encode($encoding, $msg) if ( $encoding );
my $separator = $server->{account}->{convert_nonprinting_characters};
$msg =~ s/[^[:print:]]/$separator/g if defined $separator;
$msg = encode( $encoding, $msg ) if ($encoding);
my $cksum;
# $msg = encode_utf8($msg);
if ($error_detection) {
if (defined($self->{seqno})) {
if ( defined( $self->{seqno} ) ) {
$msg .= 'AY' . $self->{seqno};
}
$msg .= 'AZ';
$cksum = checksum($msg);
$msg .= sprintf('%04.4X', $cksum);
$msg .= sprintf( '%04.4X', $cksum );
}
if ($file) {
$file->autoflush(1);
print $file $msg, $terminator;
} else {
STDOUT->autoflush(1);
print $msg, $terminator;
siplog("LOG_INFO", "OUTPUT MSG: '$msg'");
}
STDOUT->autoflush(1);
print $msg, $terminator;
siplog( "LOG_INFO", "OUTPUT MSG: '$msg'" );
$last_response = $msg;
}
@ -231,8 +233,53 @@ sub siplog {
my $message = @args ? sprintf($mask, @args) : $mask;
$message = remove_password_from_message($message);
my $logger = C4::SIP::Logger::get_logger();
$logger->$method($message) if $logger;
}
=head2 remove_password_from_message
my $safe_message = remove_password_from_message( $message );
Look for the fields AC, AD and CO, and replace contents with three asterisks.
We do this by looking for:
delimiter + AC/AD/CO + something + delimiter
and replacing it with:
delimiter + field name + asterisks + delimiter
Messages and fields that can contain passwords:
23 Patron Status Request - AC terminal password - AD patron password
11 Checkout - AC terminal password - AD patron password
09 Checkin - AC terminal password
01 Block Patron - AC terminal password
93 Login - CO login password
63 Patron Information - AC terminal password - AD patron password
35 End Patron Session - AC terminal password - AD patron password
37 Fee Paid - AC terminal password - AD patron password
17 Item Information - AC terminal password
19 Item Status Update - AC terminal password
25 Patron Enable - AC terminal password- AD patron password
15 Hold - AC terminal password - AD patron password
29 Renew - AC terminal password - AD patron password
65 Renew All - AC terminal password - AD patron password
=cut
sub remove_password_from_message {
my ($message) = @_;
# regex does not work with (AC|AD|CO), probably due to .*? and the g modifier
# NOTE: Does not work correctly if the password contains a field delimiter, but you cannot login either.
$message =~ s/\Q${field_delimiter}\E$_.*?\Q${field_delimiter}\E/${field_delimiter}$_***${field_delimiter}/g
for ( 'AC', 'AD', 'CO' );
return $message;
}
1;

View File

@ -39,8 +39,8 @@ sub new {
my %listeners;
# The key to the listeners hash is the 'port' component of the
# configuration, which is of the form '[host]:[port]/proto', and
# the 'proto' component could be upper-, lower-, or mixed-cased.
# configuration, which is of the form '[host]:[port]/proto[/IPv[46]]'
# The 'proto' component could be upper-, lower-, or mixed-cased.
# Regularize it here to lower-case, and then do the same below in
# find_server() when building the keys to search the hash.
@ -76,6 +76,10 @@ sub find_service {
siplog( "LOG_DEBUG",
"Configuration::find_service: Trying $portstr" );
last if ( exists( ( $self->{listeners} )->{$portstr} ) );
$portstr .= '/ipv4'; # lc, see ->new
last if ( exists( ( $self->{listeners} )->{$portstr} ) );
$portstr .= '/ipv6'; # lc, see ->new
last if ( exists( ( $self->{listeners} )->{$portstr} ) );
}
return $self->{listeners}->{$portstr};
}

View File

@ -504,12 +504,12 @@ sub handle_patron_status {
$ils->check_inst_id( $fields->{ (FID_INST_ID) }, "handle_patron_status" );
$patron = $ils->find_patron( $fields->{ (FID_PATRON_ID) } );
if ( C4::Context->preference('TrackLastPatronActivityTriggers') ) {
if ( C4::Context->preference('TrackLastPatronActivityTriggers') && $patron ) {
my $koha_patron = Koha::Patrons->find($patron->{borrowernumber});
$koha_patron->update_lastseen('connection');
}
$resp = build_patron_status( $patron, $lang, $fields, $server );
$self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
$self->write_msg( $resp, $server );
return (PATRON_STATUS_REQ);
}
@ -649,7 +649,7 @@ sub handle_checkout {
}
}
$self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
$self->write_msg( $resp, $server );
return (CHECKOUT);
}
@ -748,7 +748,7 @@ sub handle_checkin {
$resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
$resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
$self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
$self->write_msg( $resp, $server );
return (CHECKIN);
}
@ -795,7 +795,7 @@ sub handle_block_patron {
}
$resp = build_patron_status( $patron, $patron->language, $fields, $server );
$self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
$self->write_msg( $resp, $server );
return (BLOCK_PATRON);
}
@ -836,7 +836,7 @@ sub handle_request_acs_resend {
# We haven't sent anything yet, so respond with a
# REQUEST_SC_RESEND msg (p. 16)
$self->write_msg( REQUEST_SC_RESEND, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
$self->write_msg( REQUEST_SC_RESEND, $server );
} elsif ( ( length($last_response) < 9 )
|| substr( $last_response, -9, 2 ) ne 'AY' ) {
@ -850,7 +850,7 @@ sub handle_request_acs_resend {
# Cut out the sequence number and checksum, since the old
# checksum is wrong for the resent message.
my $rebuilt = substr( $last_response, 0, -9 );
$self->write_msg( $rebuilt, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
$self->write_msg( $rebuilt, $server );
}
return REQUEST_ACS_RESEND;
@ -932,7 +932,7 @@ sub handle_login {
$status = login_core( $server, $uid, $pwd );
}
$self->write_msg( LOGIN_RESP . $status, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
$self->write_msg( LOGIN_RESP . $status, $server );
return $status ? LOGIN : '';
}
@ -971,7 +971,7 @@ sub summary_info {
my $fid = $summary_map[$summary_type]->{fid};
my $itemlist = &$func( $patron, $start, $end, $server );
siplog( "LOG_DEBUG", "summary_info: list = (%s)", join( ", ", map{ $_->{barcode} } @{$itemlist} ) );
siplog( "LOG_DEBUG", "summary_info: list = (%s)", join( ", ", map { $_->{barcode} } @{$itemlist} ) );
foreach my $i ( @{$itemlist} ) {
$resp .= add_field( $fid, $i->{barcode}, $server );
}
@ -1101,7 +1101,7 @@ sub handle_patron_info {
$resp .= maybe_add( FID_SCREEN_MSG, INVALID_CARD, $server );
}
$self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
$self->write_msg( $resp, $server );
return (PATRON_INFO);
}
@ -1128,7 +1128,7 @@ sub handle_end_patron_session {
$resp .= maybe_add( FID_SCREEN_MSG, $screen_msg, $server );
$resp .= maybe_add( FID_PRINT_LINE, $print_line, $server );
$self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
$self->write_msg( $resp, $server );
return (END_PATRON_SESSION);
}
@ -1210,7 +1210,7 @@ sub handle_fee_paid {
$resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
$resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
$self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
$self->write_msg( $resp, $server );
return (FEE_PAID);
}
@ -1303,7 +1303,7 @@ sub handle_item_information {
$resp .= $item->build_custom_field_string( $server );
}
$self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
$self->write_msg( $resp, $server );
return (ITEM_INFORMATION);
}
@ -1353,7 +1353,7 @@ sub handle_item_status_update {
$resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
$resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
$self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
$self->write_msg( $resp, $server );
return (ITEM_STATUS_UPDATE);
}
@ -1407,7 +1407,7 @@ sub handle_patron_enable {
$resp .= add_field( FID_INST_ID, $ils->institution, $server );
$self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
$self->write_msg( $resp, $server );
return (PATRON_ENABLE);
}
@ -1472,7 +1472,7 @@ sub handle_hold {
$resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
$resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
$self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
$self->write_msg( $resp, $server );
return (HOLD);
}
@ -1559,7 +1559,7 @@ sub handle_renew {
$resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
$resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
$self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
$self->write_msg( $resp, $server );
return (RENEW);
}
@ -1612,7 +1612,7 @@ sub handle_renew_all {
$resp .= maybe_add( FID_SCREEN_MSG, $status->screen_msg, $server );
$resp .= maybe_add( FID_PRINT_LINE, $status->print_line, $server );
$self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
$self->write_msg( $resp, $server );
return (RENEW_ALL);
}
@ -1718,7 +1718,7 @@ sub send_acs_status {
# Do we want to tell the terminal its location?
$self->write_msg( $msg, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
$self->write_msg( $msg, $server );
return 1;
}

View File

@ -27,12 +27,23 @@ sub TIEHANDLE {
sub PRINT {
my $self = shift;
$Log::Log4perl::caller_depth++;
$Log::Log4perl::caller_depth += 3;
my $logger =
Koha::Logger->get( { interface => 'sip', category => 'STDERR' } );
warn @_;
$logger->warn(@_);
$Log::Log4perl::caller_depth--;
$Log::Log4perl::caller_depth -= 3;
}
=head2 OPEN
We need OPEN in case Net::Server tries to redirect STDERR. This will
be tried when param log_file or setsid is passed.
=cut
sub OPEN {
return 1;
}
=head2 BINMODE

View File

@ -1875,6 +1875,8 @@ sub GetLateOrMissingIssues {
my ( $supplierid, $serialid, $order ) = @_;
return unless ( $supplierid or $serialid );
return if defined $supplierid && !looks_like_number($supplierid);
return if defined $serialid && !looks_like_number($serialid);
my $dbh = C4::Context->dbh;
@ -2023,7 +2025,7 @@ sub addroutingmember {
my $rank;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare( "SELECT max(ranking) rank FROM subscriptionroutinglist WHERE subscriptionid = ?" );
my $sth = $dbh->prepare( "SELECT max(ranking) `rank` FROM subscriptionroutinglist WHERE subscriptionid = ?" );
$sth->execute($subscriptionid);
while ( my $line = $sth->fetchrow_hashref ) {
if ( defined $line->{rank} && $line->{rank} > 0 ) {

View File

@ -73,6 +73,26 @@ sub text{
my $line = shift;
my $work = shift; # original text
my $is_cdata = shift;
# If there is a split template toolkit tag
if ( $work =~ m/^(?:(?!\[%).)*?%\]/s ) {
my @strings = ($&);
my $token;
$work = $';
while ( $token = pop @tokens ) {
if ( $token->string =~ m/\[%.*?$/s ) {
push @tokens, C4::TmplToken->new( $`, $token->type, $token->line_number, $token->pathname );
push @strings, $&;
last;
} else {
push @strings, $token->string;
}
}
push @tokens,
C4::TmplToken->new(
join( '', reverse @strings ), C4::TmplTokenType::DIRECTIVE,
$token ? $token->line_number : $line, $self->{filename}
);
}
while($work){
# if there is a template_toolkit tag
if( $work =~ m/\[%.*?%\]/ ){

View File

@ -31,6 +31,7 @@ C4::Templates - Object for manipulating templates for use with Koha
use base qw(Class::Accessor);
use Template;
use Template::Filters;
use C4::Languages qw( get_bidi getTranslatedLanguages regex_lang_subtags );
use C4::Context;
@ -41,6 +42,7 @@ use Koha::Exceptions;
__PACKAGE__->mk_accessors(qw( theme activethemes preferredtheme lang filename htdocs interface vars));
Template::Filters->use_rfc3986();
sub new {
my $class = shift;

View File

@ -320,9 +320,9 @@ sub buildKohaItemsNamespace {
$status = 'other';
$substatus = 'In transit';
}
elsif ($item->damaged) {
$status = 'other';
$substatus = "Damaged";
elsif ( $item->damaged && !C4::Context->preference('AllowHoldsOnDamagedItems') ) {
$status = 'other';
$substatus = 'Damaged';
}
elsif ($item->itemlost) {
$status = 'other';

View File

@ -29,7 +29,7 @@ use vars qw{ $VERSION };
# - #4 : the developer version. The 4th number is the database subversion.
# used by developers when the database changes. updatedatabase take care of the changes itself
# and is automatically called by Auth.pm when needed.
$VERSION = "24.05.00.000";
$VERSION = "24.05.16.000";
sub version {
return $VERSION;

View File

@ -27,7 +27,6 @@ use Koha::Account::Offsets;
use Koha::Database;
use Koha::DateUtils qw( dt_from_string );
use Koha::Exceptions::Account;
use Koha::Items;
use Koha::Patron::Debarments;
use base qw(Koha::Object Koha::Object::Mixin::AdditionalFields);
@ -80,6 +79,7 @@ sub item {
my ( $self ) = @_;
my $rs = $self->_result->itemnumber;
return unless $rs;
require Koha::Item;
return Koha::Item->_new_from_dbic( $rs );
}
@ -497,6 +497,10 @@ sub reduce {
Koha::Exceptions::Account::IsNotDebit->throw(
error => 'Account line ' . $self->id . 'is a payout' );
}
if ( $self->debit_type_code eq 'VOID' ) {
Koha::Exceptions::Account::IsNotDebit->throw(
error => 'Account line ' . $self->id . 'is void' );
}
# Check for mandatory parameters
my @mandatory = ( 'interface', 'reduction_type', 'amount' );

View File

@ -134,9 +134,10 @@ Return the translated content for a given language. The default is returned if n
sub translated_content {
my ( $self, $lang ) = @_;
$lang ||= 'default';
my $content = $self->translated_contents->search(
{ lang => [ 'default', ( $lang ? $lang : () ) ] },
{ ( $lang ? ( order_by => \[ "field(lang, '" . $lang . "', 'default')" ] ) : () ) }
{ lang => [ 'default', $lang ] },
{ order_by => { -asc => [ \'lang="default"', 'id' ] } }
)->next;
return $content;
}

View File

@ -81,12 +81,13 @@ sub search_for_display {
qq|(SELECT COUNT(*) FROM additional_contents_localizations WHERE lang='$lang' AND additional_content_id=me.additional_content_id)=0|;
my $search_params;
$search_params->{location} = $params->{location};
$search_params->{branchcode} = $params->{library_id} ? [ $params->{library_id}, undef ] : undef;
$search_params->{published_on} = { '<=' => \'CAST(NOW() AS DATE)' };
$search_params->{expirationdate} = [ '-or', { '>=' => \'CAST(NOW() AS DATE)' }, undef ];
$search_params->{'additional_content.id'} = $params->{id} if $params->{id};
$search_params->{location} = $params->{location};
$search_params->{branchcode} = $params->{library_id} ? [ $params->{library_id}, undef ] : undef;
$search_params->{published_on} = { '<=' => \'CAST(NOW() AS DATE)' } unless $params->{id};
$search_params->{expirationdate} = [ '-or', { '>=' => \'CAST(NOW() AS DATE)' }, undef ] unless $params->{id};
$search_params->{category} = $params->{category} if $params->{category};
$search_params->{lang} = 'default' if !$lang || $lang eq 'default';
$search_params->{lang} = 'default' if !$lang || $lang eq 'default';
$search_params->{-or} = [ { 'lang' => $lang }, '-and' => [ 'lang', 'default', \$subquery ] ]
if !$search_params->{lang};

View File

@ -38,6 +38,8 @@ sub startup {
# FIXME This generates routes like this: /api/api/v1/...
$self->plugin('RESTV1');
$self->plugin('CSRF');
$self->hook(before_dispatch => \&_before_dispatch);
$self->hook(around_action => \&_around_action);

View File

@ -38,6 +38,8 @@ sub startup {
# FIXME This generates routes like this: /api/api/v1/...
$self->plugin('RESTV1');
$self->plugin('CSRF');
$self->hook(before_dispatch => \&_before_dispatch);
$self->hook(around_action => \&_around_action);

124
Koha/App/Plugin/CSRF.pm Normal file
View File

@ -0,0 +1,124 @@
package Koha::App::Plugin::CSRF;
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
=head1 NAME
Koha::App::Plugin::CSRF
=head1 SYNOPSIS
$app->plugin('CSRF');
=head1 DESCRIPTION
Enables CSRF protection in a Mojolicious app
=cut
use Modern::Perl;
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::Message::Response;
use Koha::Token;
=head1 METHODS
=head2 register
Called by Mojolicious when the plugin is loaded.
Defines an `around_action` hook that will prevent CSRF attacks.
If the HTTP request method is safe (GET, HEAD, OPTIONS, TRACE) and the request
contains an `op` parameter whose value starts with "cud-" (which means it's a
Create, Update or Delete operation), it will immediately return a 400 response.
If the HTTP request method is unsafe (POST, PUT, DELETE, PATCH, CONNECT) and
the request contains an `op` parameter whose value does not start with "cud-",
it will immediately return a 400 response.
If the HTTP request method is unsafe (POST, PUT, DELETE, PATCH, CONNECT) and
the CGISESSID cookie is set, the CSRF token is checked. A 403 response is
immediately returned if the CSRF token is missing or invalid.
If the CGISESSID cookie is missing, it means that we are not authenticated or
we are authenticated to the API by another method (HTTP basic or OAuth2). In
this case, no verification is done.
=cut
# If you need to update the logic here, please also update Koha::Middleware::CSRF
sub register {
my ( $self, $app, $conf ) = @_;
$app->hook(
around_action => sub {
my ( $next, $c, $action, $last ) = @_;
my $method = $c->req->method;
if ( $method eq 'GET' || $method eq 'HEAD' || $method eq 'OPTIONS' || $method eq 'TRACE' ) {
my $op = $c->req->param('op');
if ( $op && $op =~ /^cud-/ ) {
return $c->reply->exception(
'Incorrect use of a safe HTTP method with an `op` parameter that starts with "cud-"')
->rendered(400);
}
} else {
my $op = $c->req->param('op');
if ( $op && $op !~ /^cud-/ ) {
return $c->reply->exception(
'Incorrect use of an unsafe HTTP method with an `op` parameter that does not start with "cud-"')
->rendered(400);
}
if ( $c->cookie('CGISESSID') && !$self->is_csrf_valid( $c->req ) ) {
return $c->reply->exception('Wrong CSRF token')->rendered(403);
}
}
return $next->();
}
);
}
=head2 is_csrf_valid
Checks if a CSRF token exists and is valid
$is_valid = $plugin->is_csrf_valid($req)
C<$req> must be a Mojo::Message::Request object
=cut
sub is_csrf_valid {
my ( $self, $req ) = @_;
my $csrf_token = $req->param('csrf_token') || $req->headers->header('CSRF-TOKEN');
my $cookie = $req->cookie('CGISESSID');
if ( $csrf_token && $cookie ) {
my $session_id = $cookie->value;
return Koha::Token->new->check_csrf( { session_id => $session_id, token => $csrf_token } );
}
return 0;
}
1;

View File

@ -267,6 +267,9 @@ sub store {
$self->created_on( dt_from_string() );
}
Koha::Exceptions::ArticleRequest::WrongFormat->throw
unless grep { $_ eq $self->format } @{ C4::Context->multivalue_preference('ArticleRequestsSupportedFormats') };
return $self->SUPER::store;
}

View File

@ -62,7 +62,7 @@ sub get_config {
my ($self) = @_;
return try {
return decode_json( $self->config );
return decode_json( Encode::encode_utf8( $self->config ) );
}
catch {
Koha::Exceptions::Object::BadValue->throw("Error reading JSON data: $_");
@ -127,7 +127,7 @@ sub get_mapping {
my ($self) = @_;
return try {
return decode_json( $self->mapping );
return decode_json( Encode::encode_utf8( $self->mapping ) );
}
catch {
Koha::Exceptions::Object::BadValue->throw("Error reading JSON data: $_");

View File

@ -132,6 +132,26 @@ sub is_integer_only {
return $self->_result->category->is_integer_only;
}
=head3 to_api
my $json = $av->to_api;
Overloaded method that returns a JSON representation of the Koha::AuthorisedValue object,
suitable for API output.
=cut
sub to_api {
my ( $self, $params ) = @_;
my $response = $self->SUPER::to_api($params);
my $overrides = {};
$overrides->{description} = $self->lib // q{};
return { %$response, %$overrides };
}
=head2 Internal methods
=head3 _check_is_integer_only

View File

@ -26,6 +26,7 @@ use C4::Context;
use Koha::DateUtils qw( dt_from_string );
use Koha::Exceptions;
use Koha::Exceptions::BackgroundJob;
use Koha::Plugins;
use base qw( Koha::Object );
@ -164,6 +165,12 @@ sub process {
return {} if ref($self) ne 'Koha::BackgroundJob';
# Our background jobs are called in forked processes
# to ensure we have all plugin hooks and data we call
# get_enabled_plugins at the star of processing
# to populate the cache
Koha::Plugins->get_enabled_plugins();
my $derived_class = $self->_derived_class;
$args ||= {};
@ -464,14 +471,17 @@ sub plugin_types_to_classes {
my $namespace = $metadata->{namespace};
foreach my $type ( keys %{$tasks} ) {
my $class = $tasks->{$type};
my $class =
( ref $tasks->{$type} eq 'HASH' )
? $tasks->{$type}{class}
: $tasks->{$type};
# skip if conditions not met
next unless $type and $class;
my $key = "plugin_$namespace" . "_$type";
$self->{_plugin_mapping}->{$key} = $tasks->{$type};
$self->{_plugin_mapping}->{$key} = $class;
}
}
}

View File

@ -229,26 +229,29 @@ sub read_file {
my $delimiter = $file->{filename} =~ /\.tsv$/ ? "\t" : ",";
my $quote_char = $file->{filename} =~ /\.tsv$/ ? "\"" : "\"";
open my $fh, "<", \$file_content or die;
open my $fh, "<", \$file_content or die "Could not open file $file->{filename}: $!";
my $csv = Text::CSV_XS->new(
{
sep_char => $delimiter,
quote_char => $quote_char,
binary => 1,
allow_loose_quotes => 1
allow_loose_quotes => 1,
formula => 'empty'
}
);
my $headers_to_check = $csv->getline($fh);
my $column_headers = rescue_EBSCO_files($headers_to_check);
my $lines = $csv->getline_all( $fh, 0 );
my ( $cde, $str, $pos ) = $csv->error_diag();
my $error = $cde ? "$cde, $str, $pos" : "";
warn $error if $error;
close($fh);
return ( $column_headers, $lines, $error );
unless($csv->eof()) {
my ( $cde, $str, $pos ) = $csv->error_diag();
my $error = $cde ? "$cde, $str, $pos" : "";
warn $error if $error;
return ( $column_headers, $lines, $error );
}
return ( $column_headers, $lines );
}
=head3 create_title_hash_from_line_data

View File

@ -144,7 +144,7 @@ sub process {
$matcher_code = $matcher->code();
$num_with_matches =
BatchFindDuplicates( $batch_id, $matcher, 10, 50,
sub { my $job_progress = shift; $self->progress( $self->progress + $job_progress )->store } );
sub { my $job_progress = shift; $self->progress( $job_progress )->store } );
SetImportBatchMatcher( $batch_id, $matcher_id );
SetImportBatchOverlayAction( $batch_id, $overlay_action );
SetImportBatchNoMatchAction( $batch_id, $nomatch_action );

View File

@ -52,6 +52,7 @@ use Koha::Item::Transfer::Limits;
use Koha::Items;
use Koha::Libraries;
use Koha::Old::Checkouts;
use Koha::Old::Holds;
use Koha::Ratings;
use Koha::Recalls;
use Koha::RecordProcessor;
@ -263,8 +264,13 @@ sub can_be_edited {
Koha::Exceptions::MissingParameter->throw( error => "The patron parameter is missing or invalid" )
unless $patron && ref($patron) eq 'Koha::Patron';
my $editcatalogue =
$self->frameworkcode eq 'FA'
? [ 'fast_cataloging', 'edit_catalogue' ]
: 'edit_catalogue';
return (
( $self->metadata->source_allows_editing && $patron->has_permission( { editcatalogue => 'edit_catalogue' } ) )
( $self->metadata->source_allows_editing && $patron->has_permission( { editcatalogue => $editcatalogue } ) )
|| $patron->has_permission( { editcatalogue => 'edit_locked_records' } ) ) ? 1 : 0;
}
@ -457,15 +463,14 @@ the I<OpacHiddenItems> system preference.
sub hidden_in_opac {
my ( $self, $params ) = @_;
return 0 unless C4::Context->preference('OpacHiddenItemsHidesRecord');
my $rules = $params->{rules} // {};
my @items = $self->items->as_list;
return 0 unless @items; # Do not hide if there is no item
# Ok, there are items, don't even try the rules unless OpacHiddenItemsHidesRecord
return 0 unless C4::Context->preference('OpacHiddenItemsHidesRecord');
return !(any { !$_->hidden_in_opac({ rules => $rules }) } @items);
}
@ -608,7 +613,8 @@ sub items {
my $items_rs = $self->_result->items;
return Koha::Items->_new_from_dbic( $items_rs ) unless $params->{host_items};
return Koha::Items->_new_from_dbic($items_rs)
unless $params->{host_items} && C4::Context->preference('EasyAnalyticalRecords');
my @itemnumbers = $items_rs->get_column('itemnumber')->all;
my $host_itemnumbers = $self->_host_itemnumbers();
@ -645,7 +651,7 @@ sub host_items {
my $host_itemnumbers = $self->_host_itemnumbers;
return Koha::Items->search( { itemnumber => { -in => $host_itemnumbers } } );
return Koha::Items->search( { "me.itemnumber" => { -in => $host_itemnumbers } } );
}
=head3 _host_itemnumbers
@ -702,6 +708,21 @@ sub holds {
return Koha::Holds->_new_from_dbic($hold_rs);
}
=head3 old_holds
my $old_holds = $biblio->old_holds();
return the historic holds placed on this record
=cut
sub old_holds {
my ( $self, $params, $attributes ) = @_;
$attributes->{order_by} = 'priority' unless exists $attributes->{order_by};
my $old_hold_rs = $self->_result->old_reserves->search( $params, $attributes );
return Koha::Old::Holds->_new_from_dbic($old_hold_rs);
}
=head3 current_holds
my $holds = $biblio->current_holds
@ -1567,6 +1588,20 @@ sub normalized_upc {
return $self->metadata_extractor->get_normalized_upc;
}
=head3 opac_suppressed
my $opac_suppressed = $biblio->opac_suppressed();
Returns whether the record is flagged as suppressed in the OPAC.
FIXME: Revisit after 38330 discussion
=cut
sub opac_suppressed {
my ($self) = @_;
return $self->metadata_extractor->get_opac_suppression();
}
=head3 normalized_oclc
my $normalized_oclc = $biblio->normalized_oclc

View File

@ -27,9 +27,6 @@ use Modern::Perl;
use Koha::Exceptions;
use Koha::Biblio::Metadata::Extractor::MARC::MARC21;
use Koha::Biblio::Metadata::Extractor::MARC::UNIMARC;
=head1 API
=head2 Class methods
@ -58,6 +55,8 @@ sub new {
unless $valid_schemas->{$schema};
my $sub_class = "Koha::Biblio::Metadata::Extractor::MARC::$schema";
require "Koha/Biblio/Metadata/Extractor/MARC/$schema.pm";
return $sub_class->new($params);
}
@ -77,6 +76,23 @@ sub metadata {
return $self->{metadata};
}
=head2 get_opac_suppression
my $opac_suppressed = $extractor->get_opac_suppression();
Returns whether the record is flagged as suppressed in the OPAC.
FIXME: Revisit after 38330 discussion
=cut
sub get_opac_suppression {
my ($self) = @_;
my $record = $self->metadata;
return $record->subfield( '942', 'n' ) ? 1 : 0;
}
=head3 _normalize_string
my $normalized_string = $self->_normalize_string($string);

View File

@ -32,17 +32,17 @@ Koha::Bookings - Koha Booking object set class
=head2 Class Methods
=head3 filter_by_future
=head3 filter_by_active
$bookings->filter_by_future;
$bookings->filter_by_active;
Will return the bookings starting from now.
Will return the bookings that have not ended.
=cut
sub filter_by_future {
sub filter_by_active {
my ($self) = @_;
return $self->search( { start_date => { '>' => \'NOW()' } } );
return $self->search( { end_date => { '>=' => \'NOW()' } } );
}
=head2 Internal Methods

View File

@ -222,6 +222,21 @@ sub to_api_mapping {
};
}
=head3 public_read_list
This method returns the list of publicly readable database fields for both API and UI output purposes
=cut
sub public_read_list {
return [
'checkin_library', 'issue_id', 'borrowernumber',
'itemnumber', 'date_due', 'branchcode',
'returndate', 'lastreneweddate', 'issuedate',
'notedate', 'noteseen'
];
}
=head3 claim_returned
my $return_claim = $checkout->claim_returned();

View File

@ -17,14 +17,32 @@ package Koha::Course;
use Modern::Perl;
use base qw(Koha::Object);
=head1 NAME
Koha::Course - Koha Course Object class
=head1 API
=head2 Relations
=head3 instructors
my $instructors = $course->instructors();
Returns the related Koha::Patrons object containing the instructors for this course
=cut
sub instructors {
my ($self) = @_;
my $instructors = Koha::Patrons->search(
{ 'course_instructors.course_id' => $self->course_id },
{ join => 'course_instructors' }
);
return $instructors;
}
=head2 Internal methods

View File

@ -34,7 +34,8 @@ Koha::Database::Columns
=head3 columns
Static method that returns a hashref with mappings from column names
to descriptions, for several tables. Currently
to descriptions for several tables.
Should be extended.
=over
@ -60,9 +61,17 @@ to descriptions, for several tables. Currently
sub columns {
return {
# TODO stub for the check in C4::Reports::Guided, get_columns (see BZ 37784)
accountlines => {},
serial => {},
serialitems => {},
subscriptionhistory => {},
subscriptionroutinglist => {},
aqbooksellers => {},
aqorders => {
"basketno" => __("Basket ID (internal)"),
"biblionumber" => __("Biblionumber (internal)"),
"biblionumber" => __("Biblio number (internal)"),
"budget_id" => __("Fund ID (internal)"),
"budgetdate" => __("Not used (deprecated)"),
"cancellationreason" => __("Cancellation reason"),
@ -197,55 +206,59 @@ sub columns {
"zipcode" => __("ZIP/Postal code"),
},
items => {
"biblioitemnumber" => __("Biblioitem number (internal)"),
"barcode" => __("Barcode"),
"dateaccessioned" => __("Date acquired"),
"biblioitemnumber" => __("Biblio item number (internal)"),
"biblionumber" => __("Biblio number (internal)"),
"bookable" => __("Bookable"),
"booksellerid" => __("Source of acquisition"),
"homebranch" => __("Permanent library"),
"price" => __("Price"),
"replacementprice" => __("Replacement price"),
"replacementpricedate" => __("Price effective from"),
"datelastborrowed" => __("Date last checked out"),
"datelastseen" => __("Date last seen"),
"stack" => __("Shelving control number"),
"notforloan" => __("Not for loan"),
"ccode" => __("Collection"),
"cn_sort" => __("Koha normalized classification for sorting"),
"cn_source" => __("Source of classification or shelving scheme"),
"coded_location_qualifier" => __("Coded location qualifier"),
"copynumber" => __("Copy number"),
"damaged" => __("Damaged status"),
"damaged_on" => __("Damaged on"),
"dateaccessioned" => __("Date acquired"),
"datelastborrowed" => __("Date last checked out"),
"datelastseen" => __("Date last seen"),
"deleted_on" => __("Deleted on"),
"enumchron" => __("Serial enumeraton/chronology"),
"exclude_from_local_holds_priority" => __("Exclude from local holds priority"),
"holdingbranch" => __("Current library"),
"homebranch" => __("Permanent library"),
"issues" => __("Total checkouts"),
"itemcallnumber" => __("Call number"),
"itemlost" => __("Lost status"),
"itemlost_on" => __("Lost on"),
"withdrawn" => __("Withdrawn status"),
"withdrawn_on" => __("Withdrawn on"),
"itemcallnumber" => __("Call number"),
"coded_location_qualifier" => __("Coded location qualifier"),
"issues" => __("Total checkouts"),
"renewals" => __("Total renewals"),
"reserves" => __("Total holds"),
"restricted" => __("Use restrictions"),
"itemnotes" => __("Public note"),
"itemnotes_nonpublic" => __("Internal note"),
"holdingbranch" => __("Current library"),
"timestamp" => __("Timestamp"),
"deleted_on" => __("Deleted on"),
"itemnumber" => __("Koha item number (autogenerated)"),
"itype" => __("Koha item type"),
"localuse" => __("Total local uses"),
"location" => __("Shelving location"),
"permanent_location" => __("Permanent shelving location"),
"onloan" => __("Due date"),
"cn_source" => __("Source of classification / shelving scheme"),
"cn_sort" => __("Koha normalized classification for sorting"),
"ccode" => __("Collection"),
"materials" => __("Materials specified"),
"uri" => __("Uniform Resource Identifier"),
"itype" => __("Koha itemtype"),
"more_subfields_xml" => __("Additional subfields (XML)"),
"enumchron" => __("Serial enumeraton/chronology"),
"copynumber" => __("Copy number"),
"stocknumber" => __("Inventory number"),
"new_status" => __("New status"),
"exclude_from_local_holds_priority" => __("Exclude from local holds priority"),
"notforloan" => __("Not for loan"),
"onloan" => __("Due date"),
"permanent_location" => __("Permanent shelving location"),
"price" => __("Price"),
"renewals" => __("Total renewals"),
"replacementprice" => __("Replacement price"),
"replacementpricedate" => __("Price effective from"),
"reserves" => __("Total holds"),
"restricted" => __("Use restrictions"),
"stack" => __("Shelving control number"),
"stocknumber" => __("Inventory number"),
"timestamp" => __("Modification date"),
"uri" => __("Uniform Resource Identifier"),
"withdrawn" => __("Withdrawn status"),
"withdrawn_on" => __("Withdrawn on"),
},
biblio => {
"abstract" => __("Abstract"),
"author" => __("Author"),
"biblionumber" => __("Biblio number"),
"biblionumber" => __("Biblio number (internal)"),
"copyrightdate" => __("Copyright date"),
"datecreated" => __("Creation date"),
"frameworkcode" => __("Framework code"),
@ -261,44 +274,52 @@ sub columns {
"unititle" => __("Uniform title"),
},
biblioitems => {
"agerestriction" => __("Age restriction"),
"biblioitemnumber" => __("Biblioitem number"),
"biblionumber" => __("Biblio number"),
"classification" => __("Classification"),
"dewey" => __("Dewey/classification"),
"illus" => __("Illustrations"),
"isbn" => __("ISBN"),
"issn" => __("ISSN"),
"itemtype" => __("Biblio-level item type"),
"lccn" => __("LCCN"),
"notes" => __("Notes"),
"number" => __("Number"),
"pages" => __("Number of pages"),
"place" => __("Place of publication"),
"publicationyear" => __("Publication date"),
"publishercode" => __("Publisher"),
"size" => __("Size"),
"subclass" => __("Sub classification"),
"timestamp" => __("Timestamp"),
"title" => __("Title"),
"url" => __("URL"),
"volume" => __("Volume number"),
"volumedate" => __("Volume date"),
"volumedesc" => __("Volume information"),
"agerestriction" => __("Age restriction"),
"biblioitemnumber" => __("Biblio item number (internal)"),
"biblionumber" => __("Biblio number (internal)"),
"cn_class" => __("Classification part"),
"cn_item" => __("Item part"),
"cn_sort" => __("Koha normalized classification for sorting"),
"cn_source" => __("Source of classification or shelving scheme"),
"cn_suffix" => __("Call number suffix"),
"collectiontitle" => __("Series statement"),
"collectionissn" => __("Series ISSN"),
"collectionvolume" => __("Series volume"),
"ean" => __("EAN"),
"editionresponsibility" => __("Edition responsibility"),
"editionstatement" => __("Edition statement"),
"illus" => __("Other physical details"),
"isbn" => __("ISBN"),
"issn" => __("ISSN"),
"itemtype" => __("Biblio-level item type"),
"lccn" => __("LCCN"),
"notes" => __("Notes"),
"number" => __("Number"),
"pages" => __("Number of pages"),
"place" => __("Place of publication"),
"publicationyear" => __("Publication date"),
"publishercode" => __("Publisher"),
"size" => __("Size"),
"timestamp" => __("Modification date"),
"totalissues" => __("Koha issues (borrowed), all copies"),
"url" => __("URL"),
"volume" => __("Volume number"),
"volumedate" => __("Volume date"),
"volumedesc" => __("Volume information"),
},
statistics => {
"datetime" => __("Statistics date and time"),
"borrowernumber" => __("Borrower number"),
"branch" => __("Library"),
"value" => __("Value"),
"type" => __("Transaction type"),
"other" => __("SIP mode"),
"categorycode" => __("Patron category"),
"ccode" => __("Collection"),
"datetime" => __("Statistics date and time"),
"interface" => __("Interface"),
"itemnumber" => __("Item number"),
"itemtype" => __("Koha item type"),
"location" => __("Shelving location"),
"borrowernumber" => __("Borrower number"),
"ccode" => __("Collection"),
"categorycode" => __("Patron category"),
"interface" => __("Interface"),
"other" => __("SIP mode"),
"type" => __("Transaction type"),
"value" => __("Value"),
},
subscription => {
"branchcode" => __("Library"),
@ -314,7 +335,7 @@ sub columns {
"collectiontitle" => __("Collection title"),
"copyrightdate" => __("Copyright date"),
"isbn" => __("ISBN"),
"itemtype" => __("Item type"),
"itemtype" => __("Koha item type"),
"note" => __("Note"),
"patronreason" => __("Patron reason"),
"place" => __("Place of publication"),

View File

@ -45,6 +45,7 @@ use Koha::Plugins; # Adds plugin dirs to @INC
use Koha::Plugins::Handler;
use Koha::Acquisition::Baskets;
use Koha::Acquisition::Booksellers;
use Koha::Util::FrameworkPlugin qw( biblio_008 );
our $VERSION = 1.1;
@ -684,6 +685,10 @@ sub quote_item {
if ( !defined $bib ) {
$bib = {};
my $bib_record = _create_bib_from_quote( $item, $quote );
# Check for and add default 008 as this is a mandatory field
$bib_record = _handle_008_field($bib_record);
( $bib->{biblionumber}, $bib->{biblioitemnumber} ) =
AddBiblio( $bib_record, q{} );
$logger->trace("New biblio added $bib->{biblionumber}");
@ -1215,6 +1220,17 @@ sub _create_item_from_quote {
return $item_hash;
}
sub _handle_008_field {
my ($bib_record) = @_;
if ( !$bib_record->field('008') ) {
my $default008 = biblio_008();
$bib_record->insert_fields_ordered( MARC::Field->new( '008', $default008 ) );
}
return $bib_record;
}
1;
__END__
@ -1373,6 +1389,14 @@ Koha::EDI
Returns the Aqbudget object for the active budget given the passed budget_code
or undefined if one does not exist
=head2 _handle_008_field
bib_record = _handle_008_field($bib_record)
Checks whether an 008 field exists on the record and adds a default field it does not
Returns the bib_record
=head1 AUTHOR
Colin Campbell <colin.campbell@ptfs-europe.com>

View File

@ -302,7 +302,7 @@ sub validate {
my ($self) = @_;
open my $fh, "<", \$self->file_content or die;
my $csv = Text::CSV_XS->new( { binary => 1, always_quote => 1, eol => $/, decode_utf8 => 1 } );
my $csv = Text::CSV_XS->new( { binary => 1, always_quote => 1, eol => $/, decode_utf8 => 1, formula => 'empty' } );
$csv->column_names(qw( header_key header_value ));
my @header_rows = $csv->getline_hr_all( $fh, 0, 12 );
@ -329,7 +329,7 @@ sub _set_report_type_from_file {
my ($self) = @_;
open my $fh, "<", \$self->file_content or die;
my $csv = Text::CSV_XS->new( { binary => 1, always_quote => 1, eol => $/, decode_utf8 => 1 } );
my $csv = Text::CSV_XS->new( { binary => 1, always_quote => 1, eol => $/, decode_utf8 => 1, formula => 'empty' } );
$csv->column_names(qw( header_key header_value ));
my @header_rows = $csv->getline_hr_all( $fh, 0, 12 );
@ -352,7 +352,7 @@ sub _get_rows_from_COUNTER_file {
my ($self) = @_;
open my $fh, "<", \$self->file_content or die;
my $csv = Text::CSV_XS->new( { binary => 1, always_quote => 1, eol => $/, decode_utf8 => 1 } );
my $csv = Text::CSV_XS->new( { binary => 1, always_quote => 1, eol => $/, decode_utf8 => 1, formula => 'empty' } );
my $header_columns = $csv->getline_all( $fh, 13, 1 );
$csv->column_names( @{$header_columns}[0] );

View File

@ -86,7 +86,7 @@ sub _build_COUNTER_report_file {
my @report = ( @{$header}, @{$column_headings}, @{$body} );
#TODO: change this to tab instead of comma
csv( in => \@report, out => \my $counter_file, encoding => "utf-8" );
csv( in => \@report, out => \my $counter_file, encoding => "utf-8", formula => 'empty' );
return $counter_file;

View File

@ -27,6 +27,7 @@ use Koha::Exceptions;
use base qw(Koha::Object);
use Koha;
use Koha::ERM::EUsage::CounterFile;
use Koha::ERM::EUsage::CounterFiles;
use Koha::ERM::EUsage::UsageTitles;
@ -173,13 +174,17 @@ sub harvest_sushi {
$self->{report_type} = $args->{report_type};
$self->{begin_date} = $args->{begin_date};
$self->{end_date} = $args->{end_date};
my $url = $self->_build_url_query;
my $request = HTTP::Request->new( 'GET' => $url );
my $ua = LWP::UserAgent->new;
my $url = $self->_build_url_query;
my $request = HTTP::Request->new( 'GET' => $url );
my $ua = LWP::UserAgent->new;
$ua->agent( 'Koha/' . Koha::version() );
my $response = $ua->simple_request($request);
my $result = decode_json( $response->decoded_content );
if ( $response->code >= 400 ) {
my $result = decode_json( $response->decoded_content );
return if $self->_sushi_errors($result);
my $message;
if ( ref($result) eq 'ARRAY' ) {
@ -197,7 +202,6 @@ sub harvest_sushi {
}
}
#TODO: May want to add a job error message here?
warn sprintf "ERROR - SUSHI service %s returned %s - %s\n", $url,
$response->code, $message;
if ( $response->code == 404 ) {
@ -206,7 +210,6 @@ sub harvest_sushi {
Koha::Exceptions::Authorization::Unauthorized->throw($message);
} else {
#TODO: May want to add a job error message here?
die sprintf "ERROR requesting SUSHI service\n%s\ncode %s: %s\n",
$url, $response->code,
$message;
@ -215,12 +218,10 @@ sub harvest_sushi {
return;
}
my $decoded_response = decode_json( $response->decoded_content );
return if $self->_sushi_errors($decoded_response);
return if $self->_sushi_errors($result);
# Parse the SUSHI response
my $sushi_counter = Koha::ERM::EUsage::SushiCounter->new( { response => $decoded_response } );
my $sushi_counter = Koha::ERM::EUsage::SushiCounter->new( { response => $result } );
my $counter_file = $sushi_counter->get_COUNTER_from_SUSHI;
return if $self->_counter_file_size_too_large($counter_file);
@ -275,10 +276,11 @@ sub test_connection {
$url .= 'status';
$url .= '?customer_id=' . $self->customer_id;
$url .= '&requestor_id=' . $self->requestor_id if $self->requestor_id;
$url .= '&api_key=' . $self->api_key if $self->api_key;
$url .= '&api_key=' . $self->api_key if $self->api_key;
my $request = HTTP::Request->new( 'GET' => $url );
my $ua = LWP::UserAgent->new;
my $request = HTTP::Request->new( 'GET' => $url );
my $ua = LWP::UserAgent->new;
$ua->agent( 'Koha/' . Koha::version() );
my $response = $ua->simple_request($request);
if ( $response->{_rc} >= 400 ) {
@ -298,10 +300,10 @@ sub test_connection {
my $status;
if ( ref($result) eq 'ARRAY' ) {
for my $r (@$result) {
$status = $r->{Service_Active};
$status = $r->{Service_Active} // $r->{ServiceActive};
}
} else {
$status = $result->{Service_Active};
$status = $result->{Service_Active} // $result->{ServiceActive};
}
if ($status) {
@ -393,9 +395,10 @@ sub _build_url_query {
$url .= lc $self->{report_type};
$url .= '?customer_id=' . $self->customer_id;
$url .= '&requestor_id=' . $self->requestor_id if $self->requestor_id;
$url .= '&api_key=' . $self->api_key if $self->api_key;
$url .= '&api_key=' . $self->api_key if $self->api_key;
$url .= '&begin_date=' . substr $self->{begin_date}, 0, 7 if $self->{begin_date};
$url .= '&end_date=' . substr $self->{end_date}, 0, 7 if $self->{end_date};
$url .= '&end_date=' . substr $self->{end_date}, 0, 7 if $self->{end_date};
$url .= '&platform=' . $self->service_platform if $self->service_platform;
return $url;
}
@ -456,19 +459,24 @@ Additionally, adds background job report message(s) if that is the case
sub _sushi_errors {
my ( $self, $decoded_response ) = @_;
if ( $decoded_response->{Severity} ) {
my $severity = $decoded_response->{Severity} // $decoded_response->{severity};
my $message = $decoded_response->{Message} // $decoded_response->{message};
my $code = $decoded_response->{Code} // $decoded_response->{code};
if ($severity) {
$self->{job_callbacks}->{add_message_callback}->(
{
type => 'error',
code => $decoded_response->{Code},
message => $decoded_response->{Severity} . ' - ' . $decoded_response->{Message},
code => $code,
message => $severity . ' - ' . $message,
}
) if $self->{job_callbacks};
return 1;
}
if ( $decoded_response->{Report_Header}->{Exceptions} ) {
foreach my $exception ( @{ $decoded_response->{Report_Header}->{Exceptions} } ) {
my $exceptions = $decoded_response->{Report_Header}->{Exceptions} // $decoded_response->{Exceptions};
if ($exceptions) {
foreach my $exception ( @{$exceptions} ) {
$self->{job_callbacks}->{add_message_callback}->(
{
type => 'error',
@ -480,7 +488,7 @@ sub _sushi_errors {
return 1;
}
if ( scalar @{ $decoded_response->{Report_Items} } == 0 ) {
if ( $decoded_response->{Report_Items} && scalar @{ $decoded_response->{Report_Items} } == 0 ) {
$self->{job_callbacks}->{add_message_callback}->(
{
type => 'error',

View File

@ -210,10 +210,10 @@ sub embed {
sub build_query_pagination {
my ( $self, $params ) = @_;
my $per_page = $params->{per_page}
my $per_page = $params->{_per_page}
// C4::Context->preference('RESTdefaultPageSize') // 20;
if ( $per_page == -1 || $per_page > 100 ) { $per_page = 100; }
my $page = $params->{page} || 1;
my $page = $params->{_page} || 1;
return ( $per_page, $page );
}

View File

@ -27,6 +27,10 @@ use Exception::Class (
isa => 'Koha::Exceptions::ArticleRequest',
description => 'Article request limit was reached'
},
'Koha::Exceptions::ArticleRequest::WrongFormat' => {
isa => 'Koha::Exceptions::ArticleRequest',
description => 'Passed format is not locally supported'
},
);
=head1 NAME

View File

@ -33,6 +33,11 @@ use Exception::Class (
description => "Foreign key constraint broken",
fields => ['broken_fk', 'value'],
},
'Koha::Exceptions::Object::FKConstraintDeletion' => {
isa => 'Koha::Exceptions::Object',
description => "Foreign key constraint broken on deleting resource",
fields => [ 'column', 'fk', 'table', 'constraint' ],
},
'Koha::Exceptions::Object::MethodNotFound' => {
isa => 'Koha::Exceptions::Object',
description => "Invalid method",

39
Koha/Exceptions/REST.pm Normal file
View File

@ -0,0 +1,39 @@
package Koha::Exceptions::REST;
use Modern::Perl;
use Koha::Exception;
use Exception::Class (
'Koha::Exceptions::REST' => {
isa => 'Koha::Exception',
},
'Koha::Exceptions::REST::Public::Authentication::Required' => {
description => "This public route requires authentication",
},
'Koha::Exceptions::REST::Public::Unauthorized' => {
description => "Unprivileged user cannot access another user's resources",
},
'Koha::Exceptions::REST::Query::InvalidOperator' => {
description => "Invalid operator found in query",
fields => ['operator']
},
);
=head1 NAME
Koha::Exceptions::REST - Base class for REST API exceptions
=head1 Exceptions
=head2 Koha::Exceptions::REST
Generic REST API exception.
=head2 Koha::Exceptions::REST::Query::InvalidOperator
The passed query is not allowed.
=cut
1;

View File

@ -111,6 +111,7 @@ Koha::FrameworkPlugin - Facilitate use of plugins in MARC/items editor
=cut
use Modern::Perl;
use Cwd qw//;
use base qw(Class::Accessor);
@ -213,7 +214,16 @@ sub _load {
my ( $rv, $file );
return $self->_error( 'Plugin needs a name' ) if !$self->{name}; #2chk
$self->{path} //= _valuebuilderpath();
#NOTE: Resolve symlinks and relative path components if present,
#so the base will compare correctly lower down
my $abs_base_path = Cwd::abs_path( $self->{path} );
$file= $self->{path}. '/'. $self->{name};
#NOTE: Resolve relative path components to prevent loading files outside the base path
my $abs_file_path = Cwd::abs_path($file);
if ( $abs_file_path !~ /^\Q$abs_base_path\E/ ) {
warn "Attempt to load $file ($abs_file_path) in framework plugin!";
return $self->_error('File not found');
}
return $self->_error( 'File not found' ) if !-e $file;
# undefine oldschool subroutines before defining them again

View File

@ -34,7 +34,6 @@ use Koha::Biblios;
use Koha::Hold::CancellationRequests;
use Koha::Items;
use Koha::Libraries;
use Koha::Old::Holds;
use Koha::Calendar;
use Koha::Plugins;
@ -1014,6 +1013,7 @@ Move a hold to the old_reserve table following the same pattern as Koha::Patron-
sub _move_to_old {
my ($self) = @_;
my $hold_infos = $self->unblessed;
require Koha::Old::Hold;
return Koha::Old::Hold->new( $hold_infos )->store;
}
@ -1026,25 +1026,26 @@ on the API.
sub to_api_mapping {
return {
reserve_id => 'hold_id',
borrowernumber => 'patron_id',
reservedate => 'hold_date',
biblionumber => 'biblio_id',
branchcode => 'pickup_library_id',
notificationdate => undef,
reminderdate => undef,
cancellationdate => 'cancellation_date',
reservenotes => 'notes',
found => 'status',
itemnumber => 'item_id',
waitingdate => 'waiting_date',
expirationdate => 'expiration_date',
reserve_id => 'hold_id',
borrowernumber => 'patron_id',
reservedate => 'hold_date',
biblionumber => 'biblio_id',
deleted_biblionumber => 'deleted_biblio_id',
branchcode => 'pickup_library_id',
notificationdate => undef,
reminderdate => undef,
cancellationdate => 'cancellation_date',
reservenotes => 'notes',
found => 'status',
itemnumber => 'item_id',
waitingdate => 'waiting_date',
expirationdate => 'expiration_date',
patron_expiration_date => undef,
lowestPriority => 'lowest_priority',
suspend => 'suspended',
suspend_until => 'suspended_until',
itemtype => 'item_type',
item_level_hold => 'item_level',
lowestPriority => 'lowest_priority',
suspend => 'suspended',
suspend_until => 'suspended_until',
itemtype => 'item_type',
item_level_hold => 'item_level',
};
}

View File

@ -89,9 +89,9 @@ sub existing_statuses {
}
);
while ( my $request = $ill_requests->next ) {
my $status_data = $request->strings_map;
my $status_data = $request->status_alias ? $request->strings_map : undef;
if ( $status_data->{status_alias} ) {
if ( $status_data && $status_data->{status_alias} ) {
push @data, {
$status_data->{status_alias}->{str} ? ( str => $status_data->{status_alias}->{str} )
: $status_data->{status_alias}->{code} ? ( str => $status_data->{status_alias}->{code} )

View File

@ -184,7 +184,7 @@ sub statusalias {
return Koha::AuthorisedValues->search(
{
category => 'ILL_STATUS_ALIAS',
authorised_value => $self->SUPER::status_alias
authorised_value => $self->get_column('status_alias'),
},
{},
$self->branchcode
@ -299,7 +299,7 @@ correct category and records the fact that the status has changed
sub status_alias {
my ($self, $new_status_alias) = @_;
my $current_status_alias = $self->SUPER::status_alias;
my $current_status_alias = $self->get_column('status_alias');
if ($new_status_alias) {
# Keep a record of the previous status before we change it,
@ -315,7 +315,7 @@ sub status_alias {
# We need a way of accepting implied undef, so we can nullify
# the status_alias column, when called from $self->status
my $val = $new_status_alias eq "-1" ? undef : $new_status_alias;
my $ret = $self->SUPER::status_alias($val);
my $ret = $self->set( { status_alias => $val } );
my $val_to_log = $val ? $new_status_alias : scalar $self->status;
if ($ret) {
my $logger = Koha::ILL::Request::Logger->new;
@ -334,7 +334,7 @@ sub status_alias {
my $alias = Koha::AuthorisedValues->search(
{
category => 'ILL_STATUS_ALIAS',
authorised_value => $self->SUPER::status_alias
authorised_value => $current_status_alias
},
{},
$self->branchcode
@ -360,8 +360,8 @@ and sends a notice if appropriate
sub status {
my ( $self, $new_status) = @_;
my $current_status = $self->SUPER::status;
my $current_status_alias = $self->SUPER::status_alias;
my $current_status = $self->get_column('status');
my $current_status_alias = $self->get_column('status_alias');
if ($new_status) {
# Keep a record of the previous status before we change it,
@ -369,7 +369,7 @@ sub status {
$self->{previous_status} = $current_status_alias ?
$current_status_alias :
$current_status;
my $ret = $self->SUPER::status($new_status)->store;
my $ret = $self->set( { status => $new_status } )->store;
if ($current_status_alias) {
# This is hackery to enable us to undefine
# status_alias, since we need to have an overloaded
@ -401,20 +401,23 @@ sub status {
my $backend_plugin = $self->get_backend_plugin($backend_name);
Returns the installed I<Koha::Plugin> corresponding to the given backend_id
Returns the installed I<Koha::Plugin> corresponding to the given backend_id or undef if no plugin is found
=cut
sub get_backend_plugin {
my ( $self, $backend_id ) = @_;
my @backend_plugins = Koha::Plugins->new()->GetPlugins(
my $koha_plugins = Koha::Plugins->new();
my @backend_plugins = $koha_plugins
? Koha::Plugins->new()->GetPlugins(
{
method => 'ill_backend',
metadata => { name => $backend_id },
all => 1,
}
);
)
: ();
return $backend_plugins[0];
}
@ -1174,7 +1177,7 @@ sub get_type {
my $attr = $self->extended_attributes->find({ type => 'type'});
return if !$attr;
return $attr->value;
};
}
=head3 get_type_disclaimer_value
@ -2073,21 +2076,25 @@ sub strings_map {
}
my $status_string =
( exists $status_graph_union->{ $self->status } && defined $status_graph_union->{ $self->status }->{name} )
? $status_graph_union->{ $self->status }->{name}
: $self->status;
( $self->status
&& exists $status_graph_union->{ $self->status }
&& defined $status_graph_union->{ $self->status }->{name} )
? $status_graph_union->{ $self->status }->{name}
: $self->status;
my $status_code =
( exists $status_graph_union->{ $self->status } && defined $status_graph_union->{ $self->status }->{id} )
? $status_graph_union->{ $self->status }->{id}
: $self->status;
( $self->status
&& exists $status_graph_union->{ $self->status }
&& defined $status_graph_union->{ $self->status }->{id} )
? $status_graph_union->{ $self->status }->{id}
: $self->status;
my $strings = {
status => {
backend => $self->backend, # the backend identifier
str => $status_string, # the status description, taken from the status graph
code => $status_code, # the status id, taken from the status graph
type => 'ill_status', # fixed type
backend => $self->backend, # the backend identifier
str => $status_string, # the status description, taken from the status graph
code => $status_code, # the status id, taken from the status graph
type => 'ill_status', # fixed type
}
};

View File

@ -113,14 +113,17 @@ Returns a list of names for all the installed ILL backend plugins.
=cut
sub get_backend_plugin_names {
my ( $self ) = @_;
my ($self) = @_;
my @backend_plugins = Koha::Plugins->new()->GetPlugins(
my $koha_plugins = Koha::Plugins->new();
my @backend_plugins = $koha_plugins
? $koha_plugins->GetPlugins(
{
method => 'ill_backend',
all => 1
}
);
)
: ();
return map { $_->{metadata}->{name} } @backend_plugins;
}

View File

@ -23,7 +23,7 @@ use Koha::Database;
use Koha::ILL::Request;
use Koha::ILL::Request::Config;
use base qw(Koha::Objects);
use base qw(Koha::Objects::Mixin::ExtendedAttributes Koha::Objects);
=head1 NAME
@ -106,6 +106,19 @@ sub search_incomplete {
} );
}
=head3 extended_attributes_config
=cut
sub extended_attributes_config {
my ($self) = @_;
return {
'id_field' => { 'foreign' => 'illrequest_id', 'self' => 'illrequest_id' },
'key_field' => 'type',
'schema_class' => 'Koha::Schema::Result::Illrequestattribute',
};
}
=head2 Internal methods
=head3 _type

View File

@ -56,7 +56,7 @@ sub get_marc_record {
$format = 'UNIMARCAUTH';
}
my $record = MARC::Record->new_from_xml($self->marcxml, $self->encoding, $format);
my $record = MARC::Record->new_from_xml( $self->marcxml, 'UTF-8', $format );
return $record;
}

View File

@ -98,6 +98,9 @@ sub store {
$self->itype($self->biblio->biblioitem->itemtype);
}
# Ensure barcode is either defined or undef
$self->barcode(undef) if ( defined($self->barcode) && $self->barcode eq '' );
$self->barcode( C4::Circulation::barcodedecode( $self->barcode ) );
my $today = dt_from_string;
@ -917,7 +920,7 @@ sub hidden_in_opac {
foreach my $field ( keys %{$rules} ) {
if ( any { $self->$field eq $_ } @{ $rules->{$field} } ) {
if ( any { defined $self->$field && $self->$field eq $_ } @{ $rules->{$field} } ) {
$hidden_in_opac = 1;
last;
}
@ -994,23 +997,29 @@ sub pickup_locations {
my $patron = $params->{patron};
my $circ_control_branch = Koha::Policy::Holds->holds_control_library( $self, $patron );
my $branchitemrule =
C4::Circulation::GetBranchItemRule( $circ_control_branch, $self->itype );
my $branchitemrule = C4::Circulation::GetBranchItemRule( $circ_control_branch, $self->itype );
return Koha::Libraries->new()->empty if $branchitemrule->{holdallowed} eq 'from_local_hold_group' && !$self->home_branch->validate_hold_sibling( {branchcode => $patron->branchcode} );
return Koha::Libraries->new()->empty if $branchitemrule->{holdallowed} eq 'from_home_library' && $self->home_branch->branchcode ne $patron->branchcode;
if ( $branchitemrule->{holdallowed} eq 'from_local_hold_group'
&& !$self->home_branch->validate_hold_sibling( { branchcode => $patron->branchcode } )
|| $branchitemrule->{holdallowed} eq 'from_home_library'
&& $self->home_branch->branchcode ne $patron->branchcode )
{
return Koha::Libraries->new()->empty;
}
my $pickup_libraries = Koha::Libraries->search();
if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup') {
my $pickup_libraries;
if ( $branchitemrule->{hold_fulfillment_policy} eq 'holdgroup' ) {
$pickup_libraries = $self->home_branch->get_hold_libraries;
} elsif ($branchitemrule->{hold_fulfillment_policy} eq 'patrongroup') {
my $plib = Koha::Libraries->find({ branchcode => $patron->branchcode});
} elsif ( $branchitemrule->{hold_fulfillment_policy} eq 'patrongroup' ) {
my $plib = Koha::Libraries->find( { branchcode => $patron->branchcode } );
$pickup_libraries = $plib->get_hold_libraries;
} elsif ($branchitemrule->{hold_fulfillment_policy} eq 'homebranch') {
$pickup_libraries = Koha::Libraries->search({ branchcode => $self->homebranch });
} elsif ($branchitemrule->{hold_fulfillment_policy} eq 'holdingbranch') {
$pickup_libraries = Koha::Libraries->search({ branchcode => $self->holdingbranch });
};
} elsif ( $branchitemrule->{hold_fulfillment_policy} eq 'homebranch' ) {
$pickup_libraries = Koha::Libraries->search( { branchcode => $self->homebranch } );
} elsif ( $branchitemrule->{hold_fulfillment_policy} eq 'holdingbranch' ) {
$pickup_libraries = Koha::Libraries->search( { branchcode => $self->holdingbranch } );
} else {
$pickup_libraries = Koha::Libraries->search();
}
return $pickup_libraries->search(
{
@ -1022,7 +1031,8 @@ sub pickup_locations {
) unless C4::Context->preference('UseBranchTransferLimits');
my $limittype = C4::Context->preference('BranchTransferLimitsType');
my ($ccode, $itype) = (undef, undef);
my $ccode;
my $itype;
if( $limittype eq 'ccode' ){
$ccode = $self->ccode;
} else {
@ -1734,9 +1744,7 @@ sub to_api {
$overrides->{effective_item_type_id} = $self->effective_itemtype;
my $itype_notforloan = $self->itemtype->notforloan;
$overrides->{effective_not_for_loan_status} =
( defined $itype_notforloan && !$self->notforloan ) ? $itype_notforloan : $self->notforloan;
$overrides->{effective_not_for_loan_status} = $self->effective_not_for_loan_status;
return { %$response, %$overrides };
}
@ -1832,6 +1840,21 @@ sub item_type {
return shift->itemtype;
}
=head3 effective_not_for_loan_status
my $nfl = $item->effective_not_for_loan_status;
Returns the effective not for loan status of the item
=cut
sub effective_not_for_loan_status {
my ($self) = @_;
my $itemtype = $self->itemtype;
my $itype_notforloan = $itemtype ? $itemtype->notforloan : undef;
return ( defined($itype_notforloan) && !$self->notforloan ) ? $itype_notforloan : $self->notforloan;
}
=head3 orders
my $orders = $item->orders();
@ -2382,34 +2405,6 @@ sub check_recalls {
return $recall;
}
=head3 is_notforloan
my $is_notforloan = $item->is_notforloan;
Determine whether or not this item is "notforloan" based on
the item's notforloan status or its item type
=cut
sub is_notforloan {
my ( $self ) = @_;
my $is_notforloan = 0;
if ( $self->notforloan ){
$is_notforloan = 1;
}
else {
my $itemtype = $self->itemtype;
if ($itemtype){
if ( $itemtype->notforloan ){
$is_notforloan = 1;
}
}
}
return $is_notforloan;
}
=head3 is_denied_renewal
my $is_denied_renewal = $item->is_denied_renewal;

View File

@ -51,7 +51,10 @@ Koha::Items - Koha Item object set class
my $filtered_items = $items->filter_by_for_hold;
Return the items of the set that are *potentially* holdable.
Return the items of the set that are *potentially* holdable. This routine
checks only rules defined in the 'Standard rules for all libraries' and
should only be used in the context where we don't have a patron to check
policies for specifically.
Caller has the responsibility to call C4::Reserves::CanItemBeReserved before
placing a hold on one of those items.
@ -61,15 +64,40 @@ placing a hold on one of those items.
sub filter_by_for_hold {
my ($self) = @_;
my @hold_not_allowed_itypes = Koha::CirculationRules->search(
my $default_rule = Koha::CirculationRules->get_effective_rule(
{
rule_name => 'holdallowed',
branchcode => undef,
categorycode => undef,
rule_value => 'not_allowed',
}
)->get_column('itemtype');
);
my @hold_not_allowed_itypes;
if ( defined $default_rule && $default_rule->rule_value eq 'not_allowed' ) {
# If the default rule is not allowed we get all itemtypes as not allowed
@hold_not_allowed_itypes = Koha::ItemTypes->search->get_column('itemtype');
my @hold_allowed_itypes = Koha::CirculationRules->search(
{
rule_name => 'holdallowed',
rule_value => { '!=' => 'not_allowed' },
branchcode => undef,
categorycode => undef,
}
)->get_column('itemtype');
# We then only allow those explicitly defined in hold policies at the all libraries level
@hold_not_allowed_itypes = array_minus( @hold_not_allowed_itypes, @hold_allowed_itypes );
} else {
# If there is no default 'not_allowed' rule, then only those explicitly forbidden at the all libraries level are forbidden
@hold_not_allowed_itypes = Koha::CirculationRules->search(
{
rule_name => 'holdallowed',
branchcode => undef,
categorycode => undef,
rule_value => 'not_allowed',
}
)->get_column('itemtype');
}
# We also forbid holds on any marked not for loan at the item level
push @hold_not_allowed_itypes, Koha::ItemTypes->search({ notforloan => 1 })->get_column('itemtype');
@hold_not_allowed_itypes = uniq @hold_not_allowed_itypes;
my $params = {
itemlost => 0,

View File

@ -20,6 +20,8 @@ use Modern::Perl;
use parent qw(Plack::Middleware);
use Plack::Response;
# If you need to update the logic here, please also update Koha::App::Plugin::CSRF
sub call {
my ( $self, $env ) = @_;
my $req = Plack::Request->new($env);
@ -42,6 +44,20 @@ sub call {
my $request_method = $req->method // q{};
my $uri = $req->uri // q{};
my $referer = $req->referer // q{No referer};
my $request_path = $req->path // q{};
my %path_exceptions = (
'/ilsdi.pl' => 1,
);
#NOTE: Ignore ErrorDocument requests for CSRF
if ( $env->{'psgix.errordocument.SCRIPT_NAME'} ) {
return $self->app->($env);
} elsif ( $path_exceptions{$request_path} ) {
#NOTE: Ignore path exceptions for CSRF
return $self->app->($env);
}
my ($error);
if ( $stateless_methods{$request_method} && defined $original_op && $original_op =~ m{^cud-} ) {
@ -71,16 +87,15 @@ sub call {
$error = "wrong_csrf_token";
}
}
} elsif ( !exists $stateless_methods{$request_method} && !exists $stateful_methods{$request_method} ) {
$error = sprintf "unknown or unsupported method %s", $request_method;
}
#NOTE: It is essential to check for this environmental variable.
#NOTE: If we don't check for it, then we'll also throw an error for the "subrequest" that ErrorDocument uses to
#fetch the error page document. Then we'll wind up with a very ugly error page and not our pretty one.
if ( $error && !$env->{'plack.middleware.Koha.CSRF'} ) {
if ($error) {
#NOTE: Other Middleware will take care of logging to correct place, as Koha::Logger doesn't know where to go here
warn $error;
$env->{'plack.middleware.Koha.CSRF'} = $error;
$env->{'plack.middleware.Koha.CSRF'} = $error if !$env->{'plack.middleware.Koha.CSRF'};
my $res = Plack::Response->new( 403, [ 'Content-Type' => 'text/plain' ], ["Wrong CSRF token"] );
return $res->finalize;
}

View File

@ -19,6 +19,7 @@ package Koha::Number::Price;
use Modern::Perl;
use Math::BigFloat;
use Number::Format;
use C4::Context;
use Koha::Acquisition::Currencies;
@ -83,12 +84,7 @@ sub round {
my $format_params = $self->_format_params;
# To avoid the system to crash, we will not format big number
# We divide per 100 because we want to keep the default DECIMAL_DIGITS (2)
# error - round() overflow. Try smaller precision or use Math::BigFloat
return $self->value if $self->value > Number::Format::MAX_INT/100;
return Number::Format->new(%$format_params)->round($self->value);
return Number::Format->new(%$format_params)->round( Math::BigFloat->new( $self->value ) )->bdstr();
}
sub _format_params {

View File

@ -233,11 +233,32 @@ Returns:
sub delete {
my ($self) = @_;
my $deleted = $self->_result()->delete;
my $deleted;
try {
$deleted = $self->_result()->delete;
} catch {
if ( ref($_) eq 'DBIx::Class::Exception' ) {
if ( $_->{msg} =~
/Cannot delete or update a parent row\: a foreign key constraint fails \(\`(?<database>.*?)\`\.\`(?<table>.*?)\`, CONSTRAINT \`(?<constraint>.*?)\` FOREIGN KEY \(\`(?<fk>.*?)\`\) REFERENCES \`.*\` \(\`(?<column>.*?)\`\)/
)
{
Koha::Exceptions::Object::FKConstraintDeletion->throw(
column => $+{column},
constraint => $+{constraint},
fk => $+{fk},
table => $+{table},
);
}
$_->rethrow();
}
};
if ( ref $deleted ) {
my $object_class = Koha::Object::_get_object_class( $self->_result->result_class );
my $object_class = Koha::Object::_get_object_class( $self->_result->result_class );
$deleted = $object_class->_new_from_dbic($deleted);
}
return $deleted;
}

View File

@ -19,7 +19,6 @@ use Modern::Perl;
use Koha::Database;
use Koha::Exceptions;
use Koha::Libraries;
use Try::Tiny qw( catch try );
@ -87,6 +86,8 @@ sub get_library_limits {
return unless @branchcodes;
require Koha::Libraries;
my $filter = [ map { { branchcode => $_ } } @branchcodes ];
my $libraries = Koha::Libraries->search( $filter );

View File

@ -167,17 +167,19 @@ sub search_related {
=cut
sub delete {
my ($self) = @_;
my ( $self, $params ) = @_;
if ( Class::Inspector->function_exists( $self->object_class, 'delete' ) ) {
my $objects_deleted;
$self->_resultset->result_source->schema->txn_do( sub {
$self->reset; # If we iterated already over the set
while ( my $o = $self->next ) {
$o->delete;
$objects_deleted++;
$self->_resultset->result_source->schema->txn_do(
sub {
$self->reset; # If we iterated already over the set
while ( my $o = $self->next ) {
$o->delete($params);
$objects_deleted++;
}
}
});
);
return $objects_deleted;
}

View File

@ -0,0 +1,234 @@
package Koha::Objects::Mixin::ExtendedAttributes;
# Copyright 2024 PTFS Europe Ltd
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use Scalar::Util qw( reftype );
=head1 NAME
Koha::Objects::Mixin::ExtendedAttributes
=head2 Class methods
=head3 search
Overwrites the search method to include extended attributes rewrite and dynamic relation accessors
=cut
sub search {
my ( $self, $params, $attributes ) = @_;
my $class = ref($self) ? ref($self) : $self;
$self->handle_query_extended_attributes(
{
attributes => $attributes,
filtered_params => $params,
}
);
my $rs = $self->_resultset()->search( $params, $attributes );
return $class->_new_from_dbic($rs);
}
=head3 handle_query_extended_attributes
Checks for the presence of extended_attributes in a query
If present, it builds the dynamic extended attributes relations and rewrites the query to include the extended_attributes relation
=cut
sub handle_query_extended_attributes {
my ( $self, $args ) = @_;
my $attributes = $args->{attributes};
my $filtered_params = $args->{filtered_params};
if ( reftype( $attributes->{prefetch} )
&& reftype( $attributes->{prefetch} ) eq 'ARRAY'
&& grep ( /extended_attributes/, @{ $attributes->{prefetch} } ) )
{
my @array = $self->_get_extended_attributes_entries($filtered_params);
# Calling our private method to build the extended attributes relations
my @joins = $self->_build_extended_attributes_relations( \@array );
push @{ $attributes->{join} }, @joins;
}
}
=head3 _get_extended_attributes_entries
$self->_get_extended_attributes_entries( $filtered_params, 0 )
Recursive function that returns the rewritten extended_attributes query entries.
Given:
[
'-and',
[
{
'extended_attributes.code' => 'CODE_1',
'extended_attributes.attribute' => { 'like' => '%Bar%' }
},
{
'extended_attributes.attribute' => { 'like' => '%Bar%' },
'extended_attributes.code' => 'CODE_2'
}
]
];
Returns :
[
'CODE_1',
'CODE_2'
]
=cut
sub _get_extended_attributes_entries {
my ( $self, $params, @array ) = @_;
if ( reftype($params) && reftype($params) eq 'HASH' ) {
# rewrite additional_field_values table query params
@array = _rewrite_related_metadata_query( $params, 'field_id', 'value', @array )
if $params->{'extended_attributes.field_id'};
# rewrite borrower_attributes table query params
@array = _rewrite_related_metadata_query( $params, 'code', 'attribute', @array )
if $params->{'extended_attributes.code'};
# rewrite illrequestattributes table query params
@array = _rewrite_related_metadata_query( $params, 'type', 'value', @array )
if $params->{'extended_attributes.type'};
foreach my $key ( keys %{$params} ) {
return $self->_get_extended_attributes_entries( $params->{$key}, @array );
}
} elsif ( reftype($params) && reftype($params) eq 'ARRAY' ) {
foreach my $ea_instance (@$params) {
@array = $self->_get_extended_attributes_entries( $ea_instance, @array );
}
return @array;
} else {
return @array;
}
}
=head3 _rewrite_related_metadata_query
$extended_attributes_entries =
_rewrite_related_metadata_query( $params, 'field_id', 'value', @array )
Helper function that rewrites all subsequent extended_attributes queries to match the alias generated by the dbic self left join
Take the below example (patrons):
[
{
"extended_attributes.attribute":{"like":"%123%"},
"extended_attributes.code":"CODE_1"
}
],
[
{
"extended_attributes.attribute":{"like":"%abc%" },
"extended_attributes.code":"CODE_2"
}
]
It'll be rewritten as:
[
{
'extended_attributes_CODE_1.attribute' => { 'like' => '%123%' },
'extended_attributes_CODE_1.code' => 'CODE_1'
}
],
[
{
'extended_attributes_CODE_2.attribute' => { 'like' => '%abc%' },
'extended_attributes_CODE_2.code' => 'CODE_2'
}
]
=cut
sub _rewrite_related_metadata_query {
my ( $params, $key, $value, @array ) = @_;
if ( ref \$params->{ 'extended_attributes.' . $key } eq 'SCALAR' ) {
my $old_key_value = delete $params->{ 'extended_attributes.' . $key };
my $new_key_value = "extended_attributes_$old_key_value" . "." . $key;
$params->{$new_key_value} = $old_key_value;
my $old_value_value = delete $params->{ 'extended_attributes.' . $value };
my $new_value_value = "extended_attributes_$old_key_value" . "." . $value;
$params->{$new_value_value} = $old_value_value;
push @array, $old_key_value;
}
return @array;
}
=head3 _build_extended_attributes_relations
Method to dynamically add has_many relations for Koha classes that support extended_attributes.
Returns a list of relation accessor names.
=cut
sub _build_extended_attributes_relations {
my ( $self, $types ) = @_;
return if ( !grep ( /extended_attributes/, keys %{ $self->_resultset->result_source->_relationships } ) );
my $ea_config = $self->extended_attributes_config;
my $result_source = $self->_resultset->result_source;
for my $type ( @{$types} ) {
$result_source->add_relationship(
"extended_attributes_$type",
"$ea_config->{schema_class}",
sub {
my $args = shift;
return {
"$args->{foreign_alias}.$ea_config->{id_field}->{foreign}" =>
{ -ident => "$args->{self_alias}.$ea_config->{id_field}->{self}" },
"$args->{foreign_alias}.$ea_config->{key_field}" => { '=', $type },
};
},
{
accessor => 'multi',
join_type => 'LEFT',
cascade_copy => 0,
cascade_delete => 0,
is_depends_on => 0
},
);
}
return map { 'extended_attributes_' . $_ } @{$types};
}
1;

View File

@ -126,7 +126,7 @@ sub to_api_mapping {
seriestitle => 'series_title',
copyrightdate => 'copyright_date',
datecreated => 'creation_date',
deleted_on => 'timestamp',
timestamp => 'deleted_on',
};
}

View File

@ -20,7 +20,7 @@ package Koha::Patron;
use Modern::Perl;
use List::MoreUtils qw( any uniq );
use List::MoreUtils qw( any none uniq );
use JSON qw( to_json );
use Unicode::Normalize qw( NFKD );
use Try::Tiny;
@ -315,7 +315,7 @@ sub store {
}
foreach my $guarantor (@$guarantors) {
if ( $guarantor->is_child or $guarantor->category->can_be_guarantee ) {
if ( $guarantor->is_child ) {
Koha::Exceptions::Patron::Relationship::InvalidRelationship->throw( invalid_guarantor => 1 );
}
}
@ -372,7 +372,7 @@ sub store {
}
foreach my $guarantor (@$guarantors) {
if ( $guarantor->is_child or $guarantor->category->can_be_guarantee ) {
if ( $guarantor->is_child ) {
Koha::Exceptions::Patron::Relationship::InvalidRelationship->throw( invalid_guarantor => 1 );
}
}
@ -443,7 +443,7 @@ sub delete {
Koha::Exceptions::Patron::FailedDeleteAnonymousPatron->throw() if $anonymous_patron && $self->id eq $anonymous_patron;
# Check if patron is protected
Koha::Exceptions::Patron::FailedDeleteProtectedPatron->throw() if $self->protected == 1;
Koha::Exceptions::Patron::FailedDeleteProtectedPatron->throw() if defined $self->protected && $self->protected == 1;
$self->_result->result_source->schema->txn_do(
sub {
@ -499,7 +499,7 @@ Returns a Koha::Library object representing the patron's home library.
sub library {
my ( $self ) = @_;
return Koha::Library->_new_from_dbic($self->_result->branchcode);
return Koha::Library->_new_from_dbic($self->_result->library);
}
=head3 sms_provider
@ -533,6 +533,18 @@ sub guarantor_relationships {
return Koha::Patron::Relationships->search( { guarantee_id => $self->id } );
}
=head3 is_guarantee
Returns true if the patron has a guarantor.
=cut
sub is_guarantee {
my ($self) = @_;
return $self->guarantor_relationships()->count();
}
=head3 guarantee_relationships
Returns Koha::Patron::Relationships object for this patron's guarantors
@ -557,6 +569,18 @@ sub guarantee_relationships {
);
}
=head3 is_guarantor
Returns true if the patron is a guarantor.
=cut
sub is_guarantor {
my ($self) = @_;
return $self->guarantee_relationships()->count();
}
=head3 relationships_debt
Returns the amount owed by the patron's guarantors *and* the other guarantees of those guarantors
@ -1527,6 +1551,7 @@ sub get_age {
my $date_of_birth = dt_from_string( $self->dateofbirth, undef, 'floating' );
my $today = dt_from_string(undef, undef, 'floating')->truncate( to => 'day' );
return 0 unless $date_of_birth;
return $today->subtract_datetime( $date_of_birth )->years;
}
@ -1584,6 +1609,7 @@ Return all the historical holds for this patron
sub old_holds {
my ($self) = @_;
my $old_holds_rs = $self->_result->old_reserves->search( {}, { order_by => 'reservedate' } );
require Koha::Old::Holds;
return Koha::Old::Holds->_new_from_dbic($old_holds_rs);
}
@ -1629,23 +1655,27 @@ sub return_claims {
=head3 notice_email_address
my $email = $patron->notice_email_address;
my $email = $patron->notice_email_address;
Return the email address of patron used for notices.
Returns the empty string if no email address.
=cut
sub notice_email_address{
my ( $self ) = @_;
sub notice_email_address {
my ($self) = @_;
my $which_address = C4::Context->preference("EmailFieldPrimary");
# if syspref is set to 'first valid' (value == OFF), look up email address
if ( $which_address eq 'OFF' ) {
return $self->first_valid_email_address;
if ( $which_address && ( none { $_ eq $which_address } qw{email emailpro B_email cardnumber MULTI} ) ) {
warn "Invalid value for EmailFieldPrimary ($which_address)";
$which_address = undef;
}
# if syspref is set to 'first valid', look up email address
return $self->first_valid_email_address
unless $which_address;
# if syspref is set to 'selected addresses' (value == MULTI), look up email addresses
if ( $which_address eq 'MULTI' ) {
my @addresses;
@ -1654,11 +1684,10 @@ sub notice_email_address{
my $email_address = $self->$email_field;
push @addresses, $email_address if $email_address;
}
return join(",",@addresses);
return join( ",", @addresses );
}
return $self->$which_address || '';
}
=head3 first_valid_email_address
@ -1946,7 +1975,7 @@ sub libraries_where_can_see_things {
my $subpermission = $params->{subpermission};
my $group_feature = $params->{group_feature};
return $self->{"_restricted_branchcodes:$permission:$subpermission:$group_feature"}
return @{ $self->{"_restricted_branchcodes:$permission:$subpermission:$group_feature"} }
if exists( $self->{"_restricted_branchcodes:$permission:$subpermission:$group_feature"} );
my $userenv = C4::Context->userenv;
@ -2179,17 +2208,22 @@ sub extended_attributes {
}
# Check globally mandatory types
my @required_attribute_types =
Koha::Patron::Attribute::Types->search(
{
mandatory => 1,
category_code => [ undef, $self->categorycode ],
'borrower_attribute_types_branches.b_branchcode' =>
undef,
},
{ join => 'borrower_attribute_types_branches' }
)->get_column('code');
for my $type ( @required_attribute_types ) {
my $interface = C4::Context->interface;
my $params = {
mandatory => 1,
category_code => [ undef, $self->categorycode ],
'borrower_attribute_types_branches.b_branchcode' => undef,
};
if ( $interface eq 'opac' ) {
$params->{opac_editable} = 1;
}
my @required_attribute_types = Koha::Patron::Attribute::Types->search(
$params,
{ join => 'borrower_attribute_types_branches' }
)->get_column('code');
for my $type (@required_attribute_types) {
Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute->throw(
type => $type,
) if !$new_types->{$type};

View File

@ -59,6 +59,11 @@ sub store {
Koha::Exceptions::Patron::Attribute::InvalidAttributeValue->throw( attribute => $self )
unless $self->value_ok();
C4::Context->dbh->do(
"UPDATE borrowers SET updated_on = NOW() WHERE borrowernumber = ?", undef,
$self->borrowernumber
);
return $self->SUPER::store();
}

View File

@ -29,7 +29,7 @@ use Koha::Patron;
use Koha::Exceptions::Patron;
use Koha::Patron::Categories;
use base qw(Koha::Objects);
use base qw(Koha::Objects::Mixin::ExtendedAttributes Koha::Objects);
=head1 NAME
@ -566,6 +566,19 @@ sub filter_by_have_permission {
);
}
=head3 extended_attributes_config
=cut
sub extended_attributes_config {
my ($self) = @_;
return {
'id_field' => { 'foreign' => 'borrowernumber', 'self' => 'borrowernumber' },
'key_field' => 'code',
'schema_class' => 'Koha::Schema::Result::BorrowerAttribute',
};
}
=head3 _type
=cut

View File

@ -61,7 +61,7 @@ has 'today_iso' => ( is => 'ro', lazy => 1,
default => sub { output_pref( { dt => dt_from_string(), dateonly => 1, dateformat => 'iso' } ); }, );
has 'text_csv' => ( is => 'rw', lazy => 1,
default => sub { Text::CSV->new( { binary => 1, } ); }, );
default => sub { Text::CSV->new( { binary => 1, formula => 'empty' } ); }, );
sub import_patrons {
my ($self, $params) = @_;
@ -627,7 +627,7 @@ sub generate_patron_attributes {
push (@$feedback, { feedback => 1, name => 'attribute string', value => $string });
return [] unless $string; # Unit tests want the feedback, is it really needed?
my $csv = Text::CSV->new({binary => 1}); # binary needed for non-ASCII Unicode
my $csv = Text::CSV->new( { binary => 1, formula => "empty" } ); # binary needed for non-ASCII Unicode
my $ok = $csv->parse($string); # parse field again to get subfields!
my @list = $csv->fields();
my @patron_attributes =

View File

@ -0,0 +1,119 @@
package Koha::REST::Plugin::Auth::PublicRoutes;
# Copyright Hypernova Oy 2024
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use Mojo::Base 'Mojolicious::Plugin';
use Koha::Exception;
use Koha::Exceptions;
use Koha::Exceptions::REST;
use Koha::Patrons;
use Module::Load::Conditional;
=head1 NAME
Koha::REST::Plugin::Auth::PublicRoutes
=head1 API
=head2 Mojolicious::Plugin methods
=head3 register
=cut
sub register {
my ( $self, $app ) = @_;
=head2 Helper methods
=head3 auth.public
$c->auth->public( $public_user_id );
=cut
$app->helper(
'auth.public' => sub {
my ( $c, $public_user_id ) = @_;
unless ( $c->stash('is_public') ) {
Koha::Exception->throw( error => "This is not a public route!" );
}
my $user = $c->stash('koha.user');
unless ($user) {
Koha::Exceptions::REST::Public::Authentication::Required->throw( error => "Authentication failure." );
}
unless ($public_user_id) {
Koha::Exceptions::REST::Public::Unauthorized->throw(
error => "Unprivileged user cannot access another user's resources" );
}
if ( $user->borrowernumber == $public_user_id ) {
return 1;
} else {
Koha::Exceptions::REST::Public::Unauthorized->throw(
error => "Unprivileged user cannot access another user's resources" );
}
}
);
=head3 auth.public_guarantor
$c->auth->public_guarantor( $public_user_id );
=cut
$app->helper(
'auth.public_guarantor' => sub {
my ( $c, $public_user_id ) = @_;
unless ( $c->stash('is_public') ) {
Koha::Exception->throw( error => "This is not a public route!" );
}
my $user = $c->stash('koha.user');
unless ($user) {
Koha::Exceptions::REST::Public::Authentication::Required->throw( error => "Authentication failure." );
}
unless ($public_user_id) {
Koha::Exceptions::REST::Public::Unauthorized->throw(
error => "Unprivileged user cannot access another user's resources" );
}
my $guarantees = $user->guarantee_relationships->guarantees->as_list;
foreach my $guarantee ( @{$guarantees} ) {
if ( $guarantee->borrowernumber == $public_user_id ) {
return 1;
}
}
Koha::Exceptions::REST::Public::Unauthorized->throw(
error => "Unprivileged user cannot access another user's resources" );
}
);
}
1;

View File

@ -59,6 +59,33 @@ sub register {
my $path = $req->url->to_abs->path;
my $type = "";
if ( blessed $exception && ref($exception) eq 'Koha::Exceptions::REST::Query::InvalidOperator' ) {
return $c->render(
status => 400,
json => {
error => printf( "Invalid operator in query: %s", $exception->operator ),
error_code => 'invalid_query',
}
);
}
elsif ( blessed $exception
&& ref($exception) eq 'Koha::Exceptions::REST::Public::Authentication::Required' )
{
return $c->render(
status => 401,
json => {
error => $exception->error,
}
);
} elsif ( blessed $exception && ref($exception) eq 'Koha::Exceptions::REST::Public::Unauthorized' ) {
return $c->render(
status => 403,
json => {
error => $exception->error,
}
);
}
if ( blessed $exception ) {
$type = "(" . ref($exception) . ")";
}

View File

@ -287,13 +287,7 @@ controller, and thus shouldn't be called twice in it.
$c->stash('koha.pagination.base_total' => $result_set->count);
$c->stash('koha.pagination.query_params' => $args);
# Check and handle related metadata table joins
$c->dbic_extended_attributes_join(
{
attributes => $attributes,
filtered_params => $filtered_params
}
);
$c->dbic_validate_operators( { filtered_params => $filtered_params } );
# Generate the resultset
my $objects_rs = $result_set->search( $filtered_params, $attributes );

View File

@ -23,6 +23,7 @@ use Scalar::Util qw( reftype );
use JSON qw( decode_json );
use Koha::Exceptions;
use Koha::Exceptions::REST;
=head1 NAME
@ -159,31 +160,18 @@ Generates the DBIC prefetch attribute based on embedded relations, and merges in
}
);
=head3 dbic_extended_attributes_join
=head3 dbic_validate_operators
$attributes = $c->dbic_extended_attributes_join({ attributes => $attributes, result_set => $result_set });
$attributes = $c->dbic_validate_operators( { filtered_params => $filtered_params } );
Generates the DBIC join attribute based on extended_attributes query entries, and merges into I<$attributes>.
Validate operators in the passed query.
=cut
$app->helper(
'dbic_extended_attributes_join' => sub {
'dbic_validate_operators' => sub {
my ( $c, $args ) = @_;
my $attributes = $args->{attributes};
my $filtered_params = $args->{filtered_params};
if ( reftype( $attributes->{prefetch} )
&& reftype( $attributes->{prefetch} ) eq 'ARRAY'
&& grep ( /extended_attributes/, @{ $attributes->{prefetch} } ) )
{
my $ea_entries = $self->_get_extended_attributes_entries( $filtered_params, 0 );
while ( $ea_entries > 0 ) {
push( @{ $attributes->{join} }, 'extended_attributes' );
$ea_entries--;
}
}
_validate_query( $args->{filtered_params} );
}
);
@ -516,129 +504,57 @@ sub _parse_dbic_query {
}
}
=head3 _get_extended_attributes_entries
$self->_get_extended_attributes_entries( $filtered_params, 0 )
Recursive function that returns the number of extended_attributes entries present in a query.
Example: Returns 2 if given a $filtered_params containing the below:
{
"-and":[
[
{
"extended_attributes.value":{
"like":"abc%"
},
"extended_attributes.code":[
[
"arbitrary_attr_code",
"another_attr_code"
]
]
}
],
[
{
"extended_attributes.value":{
"like":"123%"
},
"extended_attributes.code":[
[
"arbitrary_attr_code",
"another_attr_code"
]
]
}
]
]
}
=head3 _validate_operator
=cut
sub _get_extended_attributes_entries {
my ( $self, $params, $extended_attributes_entries ) = @_;
if ( reftype($params) && reftype($params) eq 'HASH' ) {
# rewrite additional_field_values table query params
$extended_attributes_entries =
_rewrite_related_metadata_query( $params, $extended_attributes_entries, 'field_id', 'value' )
if $params->{'extended_attributes.field_id'};
# rewrite borrower_attributes table query params
$extended_attributes_entries =
_rewrite_related_metadata_query( $params, $extended_attributes_entries, 'code', 'attribute' )
if $params->{'extended_attributes.code'};
# rewrite illrequestattributes table query params
$extended_attributes_entries =
_rewrite_related_metadata_query( $params, $extended_attributes_entries, 'type', 'value' )
if $params->{'extended_attributes.type'};
foreach my $key ( keys %{$params} ) {
return $self->_get_extended_attributes_entries( $params->{$key}, $extended_attributes_entries );
}
} elsif ( reftype($params) && reftype($params) eq 'ARRAY' ) {
foreach my $ea_instance (@$params) {
$extended_attributes_entries =
+$self->_get_extended_attributes_entries( $ea_instance, $extended_attributes_entries );
}
return $extended_attributes_entries;
} else {
return $extended_attributes_entries;
}
sub _validate_operator {
my ($operator) = @_;
my %allowed_operators =
map { $_ => 1 }
qw(= != < > <= >= -in -ident -bool -not_bool -or like -like -not_like -between -not_between -not -and -regexp -not_in);
Koha::Exceptions::REST::Query::InvalidOperator->throw( operator => $operator )
unless exists $allowed_operators{$operator};
return;
}
=head3 _rewrite_related_metadata_query
$extended_attributes_entries =
_rewrite_related_metadata_query( $params, $extended_attributes_entries, 'field_id', 'value' )
Helper function that rewrites all subsequent extended_attributes queries to match the alias generated by the dbic self left join
Take the below example (patrons), assuming it is the third instance of an extended_attributes query:
{
"extended_attributes.value":{
"like":"123%"
},
"extended_attributes.code":[
[
"arbitrary_attr_code",
"another_attr_code"
]
]
}
It'll be rewritten as:
{
"extended_attributes_3.value":{
"like":"123%"
},
"extended_attributes_3.code":[
[
"arbitrary_attr_code",
"another_attr_code"
]
]
}
=head3 _validate_query
=cut
sub _rewrite_related_metadata_query {
my ( $params, $extended_attributes_entries, $key, $value ) = @_;
sub _validate_query {
my ($query) = @_;
$extended_attributes_entries++;
if ( $extended_attributes_entries > 1 ) {
my $old_key_value = delete $params->{ 'extended_attributes.' . $key };
my $new_key_value = "extended_attributes_$extended_attributes_entries" . "." . $key;
$params->{$new_key_value} = $old_key_value;
if ( ref $query eq 'HASH' ) {
for my $field ( keys %$query ) {
my $value = $query->{$field};
my $old_value_value = delete $params->{ 'extended_attributes.' . $value };
my $new_value_value = "extended_attributes_$extended_attributes_entries" . "." . $value;
$params->{$new_value_value} = $old_value_value;
if ( ref $value eq 'HASH' ) {
# Hash reference with operators
for my $operator ( keys %$value ) {
_validate_operator($operator);
}
} elsif ( ref $value eq 'ARRAY' ) {
# Array reference with operator as the first element
_validate_query($value);
} else {
# Simple key-value pairs (no operator to validate)
}
}
} elsif ( ref $query eq 'ARRAY' ) {
# Top-level OR combination or nested AND combination
for my $element (@$query) {
if ( ref $element eq 'ARRAY' && scalar @{$element} && $element->[0] eq '-and' ) {
_validate_query( $element->[1] );
} else {
_validate_query($element);
}
}
}
return $extended_attributes_entries;
}
1;

View File

@ -62,6 +62,17 @@ sub startup {
if C4::Context->preference('AccessControlAllowOrigin');
}
);
$self->hook(
around_action => sub {
my ($next, $c, $action, $last) = @_;
# Flush memory caches before every request
Koha::Caches->flush_L1_caches();
Koha::Cache::Memory::Lite->flush();
return $next->();
}
);
# Force charset=utf8 in Content-Type header for JSON responses
$self->types->type( json => 'application/json; charset=utf8' );
@ -159,6 +170,7 @@ sub startup {
$self->plugin('Koha::REST::Plugin::Exceptions');
$self->plugin('Koha::REST::Plugin::Responses');
$self->plugin('Koha::REST::Plugin::Auth::IdP');
$self->plugin('Koha::REST::Plugin::Auth::PublicRoutes');
$self->plugin( 'Mojolicious::Plugin::OAuth2' => $oauth_configuration );
}

View File

@ -73,22 +73,23 @@ Controller function that handles cancelling a patron's Koha::ArticleRequest obje
sub patron_cancel {
my $c = shift->openapi->valid_input or return;
my $patron = Koha::Patrons->find( $c->param('patron_id') );
return $c->render_resource_not_found("Patron")
unless $patron;
# patron_id has been validated by the allow-owner check, so the following call to related
# article requests covers the case of article requests not belonging to the patron
my $article_request = $patron->article_requests->find( $c->param('article_request_id') );
return $c->render_resource_not_found("Article request")
unless $article_request;
my $reason = $c->param('cancellation_reason');
my $notes = $c->param('notes');
my $patron_id = $c->param('patron_id');
return try {
$c->auth->public($patron_id);
my $patron = Koha::Patrons->find($patron_id);
return $c->render_resource_not_found("Patron")
unless $patron;
# patron_id has been validated by the $c->auth->public check, so the following call to related
# article requests covers the case of article requests not belonging to the patron
my $article_request = $patron->article_requests->find( $c->param('article_request_id') );
return $c->render_resource_not_found("Article request")
unless $article_request;
my $reason = $c->param('cancellation_reason');
my $notes = $c->param('notes');
$article_request->cancel(
{

View File

@ -319,9 +319,7 @@ sub authenticate_api_request {
my $permissions = $authorization->{'permissions'};
# Check if the user is authorized
if ( ( defined($permissions) and haspermission($user->userid, $permissions) )
or allow_owner($c, $authorization, $user)
or allow_guarantor($c, $authorization, $user) ) {
if ( ( defined($permissions) and haspermission($user->userid, $permissions) ) ) {
validate_query_parameters( $c, $spec );
@ -360,158 +358,6 @@ sub validate_query_parameters {
) if @errors;
}
=head3 allow_owner
Allows access to object for its owner.
There are endpoints that should allow access for the object owner even if they
do not have the required permission, e.g. access an own reserve. This can be
achieved by defining the operation as follows:
"/holds/{reserve_id}": {
"get": {
...,
"x-koha-authorization": {
"allow-owner": true,
"permissions": {
"borrowers": "1"
}
}
}
}
=cut
sub allow_owner {
my ($c, $authorization, $user) = @_;
return unless $authorization->{'allow-owner'};
return check_object_ownership($c, $user) if $user and $c;
}
=head3 allow_guarantor
Same as "allow_owner", but checks if the object is owned by one of C<$user>'s
guarantees.
=cut
sub allow_guarantor {
my ($c, $authorization, $user) = @_;
if (!$c || !$user || !$authorization || !$authorization->{'allow-guarantor'}){
return;
}
my $guarantees = $user->guarantee_relationships->guarantees->as_list;
foreach my $guarantee (@{$guarantees}) {
return 1 if check_object_ownership($c, $guarantee);
}
}
=head3 check_object_ownership
Determines ownership of an object from request parameters.
As introducing an endpoint that allows access for object's owner; if the
parameter that will be used to determine ownership is not already inside
$parameters, add a new subroutine that checks the ownership and extend
$parameters to contain a key with parameter_name and a value of a subref to
the subroutine that you created.
=cut
sub check_object_ownership {
my ($c, $user) = @_;
return if not $c or not $user;
my $parameters = {
accountlines_id => \&_object_ownership_by_accountlines_id,
borrowernumber => \&_object_ownership_by_patron_id,
patron_id => \&_object_ownership_by_patron_id,
checkout_id => \&_object_ownership_by_checkout_id,
reserve_id => \&_object_ownership_by_reserve_id,
};
foreach my $param ( keys %{ $parameters } ) {
my $check_ownership = $parameters->{$param};
if ($c->stash($param)) {
return &$check_ownership($c, $user, $c->stash($param));
}
elsif ($c->param($param)) {
return &$check_ownership($c, $user, $c->param($param));
}
elsif ($c->match->stack->[-1]->{$param}) {
return &$check_ownership($c, $user, $c->match->stack->[-1]->{$param});
}
elsif ($c->req->json && $c->req->json->{$param}) {
return 1 if &$check_ownership($c, $user, $c->req->json->{$param});
}
}
}
=head3 _object_ownership_by_accountlines_id
Finds a Koha::Account::Line-object by C<$accountlines_id> and checks if it
belongs to C<$user>.
=cut
sub _object_ownership_by_accountlines_id {
my ($c, $user, $accountlines_id) = @_;
my $accountline = Koha::Account::Lines->find($accountlines_id);
return $accountline && $user->borrowernumber == $accountline->borrowernumber;
}
=head3 _object_ownership_by_borrowernumber
Compares C<$borrowernumber> to currently logged in C<$user>.
=cut
sub _object_ownership_by_patron_id {
my ($c, $user, $patron_id) = @_;
return $user->borrowernumber == $patron_id;
}
=head3 _object_ownership_by_checkout_id
First, attempts to find a Koha::Checkout-object by C<$issue_id>. If we find one,
compare its borrowernumber to currently logged in C<$user>. However, if an issue
is not found, attempt to find a Koha::Old::Checkout-object instead and compare its
borrowernumber to currently logged in C<$user>.
=cut
sub _object_ownership_by_checkout_id {
my ($c, $user, $issue_id) = @_;
my $issue = Koha::Checkouts->find($issue_id);
$issue = Koha::Old::Checkouts->find($issue_id) unless $issue;
return $issue && $issue->borrowernumber
&& $user->borrowernumber == $issue->borrowernumber;
}
=head3 _object_ownership_by_reserve_id
Finds a Koha::Hold-object by C<$reserve_id> and checks if it
belongs to C<$user>.
TODO: Also compare against old_reserves
=cut
sub _object_ownership_by_reserve_id {
my ($c, $user, $reserve_id) = @_;
my $reserve = Koha::Holds->find($reserve_id);
return $reserve && $user->borrowernumber == $reserve->borrowernumber;
}
=head3 _basic_auth
Internal method that performs Basic authentication.

View File

@ -73,7 +73,7 @@ sub validate {
return try {
my ( $status, $THE_cardnumber, $THE_userid, $patron ) = C4::Auth::checkpw( $identifier, $password );
unless ( $status && $status > 0 ) {
my $error_response = $status == -2 ? 'Password expired' : 'Validation failed';
my $error_response = ($status && $status == -2) ? 'Password expired' : 'Validation failed';
return $c->render(
status => 400,
openapi => { error => $error_response }

View File

@ -36,8 +36,9 @@ sub list {
my $c = shift->openapi->valid_input or return;
return try {
my $authorised_value_categories_set = Koha::AuthorisedValueCategories->new;
my $authorised_value_categories = $c->objects->search( $authorised_value_categories_set );
my $authorised_value_categories_set =
Koha::AuthorisedValueCategories->search( {}, { order_by => 'category_name' } );
my $authorised_value_categories = $c->objects->search($authorised_value_categories_set);
return $c->render( status => 200, openapi => $authorised_value_categories );
}
catch {

View File

@ -27,6 +27,7 @@ use Koha::Checkouts;
use Koha::Old::Checkouts;
use Koha::Token;
use Scalar::Util qw( blessed );
use Try::Tiny qw( catch try );
=head1 NAME
@ -120,7 +121,7 @@ sub _check_availability {
# Upgrade some confirmations to blockers
my @should_block =
qw/TOO_MANY ISSUED_TO_ANOTHER RESERVED RESERVED_WAITING TRANSFERRED PROCESSING AGE_RESTRICTION/;
qw/TOO_MANY ISSUED_TO_ANOTHER RESERVED RESERVE_WAITING TRANSFERRED PROCESSING AGE_RESTRICTION/;
for my $block (@should_block) {
if ( exists( $confirmation->{$block} ) ) {
$impossible->{$block} = $confirmation->{$block};
@ -152,7 +153,16 @@ sub get_availability {
my $c = shift->openapi->valid_input or return;
my $user = $c->stash('koha.user');
my $patron = Koha::Patrons->find( $c->param('patron_id') );
my $patron_id = $c->param('patron_id');
return if try {
$c->auth->public($patron_id) if $c->stash('is_public');
return 0; # authorization successful, do not "return" after try-catch
} catch {
return $c->unhandled_exception($_);
};
my $patron = Koha::Patrons->find($patron_id);
my $item = Koha::Items->find( $c->param('item_id') );
my ( $impossible, $confirmation, $warnings ) =
@ -190,19 +200,19 @@ sub add {
my $patron_id = $body->{patron_id};
my $onsite = $body->{onsite_checkout};
if ( $c->stash('is_public')
&& !C4::Context->preference('OpacTrustedCheckout') )
{
return $c->render(
status => 405,
openapi => {
error => 'Feature disabled',
error_code => 'FEATURE_DISABLED'
}
);
}
return try {
if ( $c->stash('is_public') ) {
$c->auth->public($patron_id);
return $c->render(
status => 405,
openapi => {
error => 'Feature disabled',
error_code => 'FEATURE_DISABLED'
}
) if !C4::Context->preference('OpacTrustedCheckout');
}
my $item = Koha::Items->find($item_id);
unless ($item) {
return $c->render(

View File

@ -35,12 +35,7 @@ sub list {
my $result = $ebsco->request( GET => '/packages' . $params );
my $base_total = $result->{totalResults};
my ( $per_page, $page ) = $ebsco->build_query_pagination(
{
per_page => $c->stash('koha.pagination.per_page'),
page => $c->stash('koha.pagination.page'),
}
);
my ( $per_page, $page ) = $ebsco->build_query_pagination( $c->req->params->to_hash );
my $additional_params =
$ebsco->build_additional_params( $c->req->params->to_hash );

View File

@ -73,12 +73,7 @@ sub list {
my $base_total = $result->{totalResults};
my ( $per_page, $page ) = $ebsco->build_query_pagination(
{
per_page => $c->stash('koha.pagination.per_page'),
page => $c->stash('koha.pagination.page'),
}
);
my ( $per_page, $page ) = $ebsco->build_query_pagination( $c->req->params->to_hash );
my $additional_params = $ebsco->build_additional_params( $c->req->params->to_hash );
my $searchfield = 'titlename';

View File

@ -41,12 +41,7 @@ sub list {
my $ebsco = Koha::ERM::Providers::EBSCO->new;
# We cannot get base_total as a search kw is required by the API
my ( $per_page, $page ) = $ebsco->build_query_pagination(
{
per_page => $c->stash('koha.pagination.per_page'),
page => $c->stash('koha.pagination.page'),
}
);
my ( $per_page, $page ) = $ebsco->build_query_pagination( $c->req->params->to_hash );
my $additional_params = $ebsco->build_additional_params( $c->req->params->to_hash );

View File

@ -27,7 +27,6 @@ use Scalar::Util qw( blessed );
use Try::Tiny qw( catch try );
use MIME::Base64 qw( decode_base64 encode_base64 );
use POSIX qw( floor );
use Text::CSV_XS;
=head1 API

View File

@ -47,7 +47,7 @@ sub list {
my $search_string = $query_params_array[0]->{name};
my $url = 'https://registry.projectcounter.org/api/v1/platform/';
my $url = 'https://registry.countermetrics.org/api/v1/platform/';
my $request = HTTP::Request->new(
GET => $url,
);

View File

@ -456,6 +456,8 @@ sub guarantors_can_see_charges {
my $c = shift->openapi->valid_input or return;
return try {
$c->auth->public( $c->param('patron_id') );
if ( C4::Context->preference('AllowPatronToSetFinesVisibilityForGuarantor') ) {
my $patron = $c->stash( 'koha.user' );
my $privacy_setting = ($c->req->json->{allowed}) ? 1 : 0;
@ -492,6 +494,8 @@ sub guarantors_can_see_checkouts {
my $c = shift->openapi->valid_input or return;
return try {
$c->auth->public( $c->param('patron_id') );
if ( C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') ) {
my $patron = $c->stash( 'koha.user' );
my $privacy_setting = ( $c->req->json->{allowed} ) ? 1 : 0;

View File

@ -207,14 +207,14 @@ sub add_debit {
my $c = shift->openapi->valid_input or return;
my $patron = Koha::Patrons->find( $c->param('patron_id') );
my $user = $c->stash('koha.user');
return $c->render_resource_not_found("Patron")
unless $patron;
unless $patron;
return try {
my $data =
Koha::Account::Debit->new_from_api( $c->req->json )
->unblessed;
Koha::Account::Debit->new_from_api( $c->req->json )->unblessed;
$data->{library_id} = delete $data->{branchcode};
$data->{type} = delete $data->{debit_type_code};
@ -223,11 +223,10 @@ sub add_debit {
$data->{transaction_type} = delete $data->{payment_type};
$data->{interface} = 'api'
; # Should this always be API, or should we allow the API consumer to choose?
$data->{user_id} = $patron->borrowernumber
; # Should this be API user OR staff the API may be acting on behalf of?
$data->{user_id} = delete $data->{manager_id} || $user->id;
my $debit = $patron->account->add_debit($data);
$debit = Koha::Account::Debit->_new_from_dbic($debit->{_result});
$debit = Koha::Account::Debit->_new_from_dbic( $debit->{_result} );
$c->res->headers->location(
$c->req->url->to_string . '/' . $debit->id );
@ -248,13 +247,13 @@ sub add_debit {
}
elsif ( $_->isa('Koha::Exceptions::Account::AmountNotPositive') ) {
return $c->render(
status => 400,
status => 400,
openapi => { error => $_->description }
);
}
elsif ( $_->isa('Koha::Exceptions::Account::UnrecognisedType') ) {
return $c->render(
status => 400,
status => 400,
openapi => { error => $_->description }
);
}

View File

@ -21,6 +21,8 @@ use Mojo::Base 'Mojolicious::Controller';
use Koha::Patrons;
use Try::Tiny;
=head1 NAME
Koha::REST::V1::Patrons::Holds
@ -72,6 +74,8 @@ sub delete_public {
my $c = shift->openapi->valid_input or return;
return try {
$c->auth->public( $c->param('patron_id') );
my $hold = $c->objects->find_rs( Koha::Holds->new, $c->param('hold_id') );
unless ( $hold and $c->param('patron_id') == $hold->borrowernumber ) {

View File

@ -91,34 +91,25 @@ sub set_public {
my $user = $c->stash('koha.user');
unless ( $user->borrowernumber == $patron_id ) {
return $c->render(
status => 403,
openapi => {
error => "Changing other patron's password is forbidden"
}
);
}
unless ( $user->category->effective_change_password ) {
return $c->render(
status => 403,
openapi => {
error => "Changing password is forbidden"
}
);
}
my $old_password = $body->{old_password};
my $password = $body->{password};
my $password_2 = $body->{password_repeated};
unless ( $password eq $password_2 ) {
return $c->render( status => 400, openapi => { error => "Passwords don't match" } );
}
return try {
unless ( checkpw_internal($user->userid, $old_password ) ) {
$c->auth->public($patron_id);
unless ( $user->category->effective_change_password ) {
return $c->render(
status => 403,
openapi => { error => "Changing password is forbidden" }
);
}
my $old_password = $body->{old_password};
my $password = $body->{password};
my $password_2 = $body->{password_repeated};
unless ( $password eq $password_2 ) {
return $c->render( status => 400, openapi => { error => "Passwords don't match" } );
}
unless ( checkpw_internal( $user->userid, $old_password ) ) {
return $c->render(
status => 400,
openapi => { error => "Invalid password" }
@ -126,19 +117,20 @@ sub set_public {
}
## Change password
$user->set_password({ password => $password });
$user->set_password( { password => $password } );
return $c->render( status => 200, openapi => "" );
}
catch {
} catch {
if ( blessed $_ and $_->isa('Koha::Exceptions::Password') ) {
return $c->render(
status => 400,
openapi => { error => "$_" }
);
} elsif ( blessed $_ and $_->isa('Koha::Exceptions::REST::Public::Unauthorized') ) {
return $c->render( status => 403, json => { error => "Changing other patron's password is forbidden" } );
} else {
$c->unhandled_exception($_);
}
$c->unhandled_exception($_);
};
}

Some files were not shown because too many files have changed in this diff Show More