From e17ac9e5f5e21e04a6b11d97b6adaf8b4cfa1704 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 13 Dec 2024 16:27:51 +0000 Subject: [PATCH 01/17] 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 Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer (cherry picked from commit 70ea004f02b7325e642906aa5ccfecc8d7e1688e) Signed-off-by: Paul Derscheid Signed-off-by: Alex Buckley --- tools/inventory.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/inventory.pl b/tools/inventory.pl index 1c94183596..5af54cadb6 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -216,9 +216,9 @@ if ( $op eq 'cud-inventory' err_data => $err_data ); } my @items = Koha::Items->search( { barcode => { -in => \@barcodes } } )->as_list; - my %items = map { $_->barcode => $_ } @items; + my %items = map { lc($_->barcode) => $_ } @items; foreach my $barcode (@barcodes) { - my $item = $items{ $barcode }; + my $item = $items{ lc($barcode) }; if ( $item ) { if ( $item->withdrawn ) { push @errorloop, { 'barcode' => $barcode, 'ERR_WTHDRAWN' => 1 }; From e0fd76cd1520e0b30bb3da19b8019ab3f12a0b3d Mon Sep 17 00:00:00 2001 From: Mathieu Saby Date: Sat, 7 Dec 2024 18:17:48 +0000 Subject: [PATCH 02/17] 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 Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer (cherry picked from commit 30a1c4bb45f194bc588ac27ac0579852347f00bb) Signed-off-by: Paul Derscheid Signed-off-by: Alex Buckley --- .../mandatory/unimarc_framework_DEFAULT.yml | 116 +++++++++--------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.yml b/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.yml index 854b687d72..afc80b8425 100644 --- a/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.yml +++ b/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.yml @@ -2948,7 +2948,7 @@ tables: liblibrarian: "Originating Source" libopac: "Originating Source" repeatable: 1 - mandatory: 1 + mandatory: 0 authorised_value: frameworkcode: "" @@ -3783,7 +3783,7 @@ tables: liblibrarian: "Country Code" libopac: "Country Code" repeatable: 0 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 0 authorised_value: COUNTRY @@ -3837,7 +3837,7 @@ tables: liblibrarian: "Country Code" libopac: "Country Code" repeatable: 0 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 0 authorised_value: COUNTRY @@ -4035,7 +4035,7 @@ tables: liblibrarian: "Number of work" libopac: "Number of work" repeatable: 0 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 0 authorised_value: @@ -4053,7 +4053,7 @@ tables: liblibrarian: "Number of movement" libopac: "Number of movement" repeatable: 0 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 0 authorised_value: @@ -4071,7 +4071,7 @@ tables: liblibrarian: "Number of incipit" libopac: "Number of incipit" repeatable: 0 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 0 authorised_value: @@ -4845,7 +4845,7 @@ tables: liblibrarian: "Country of publication" libopac: "Country of publication" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 1 authorised_value: COUNTRY @@ -4899,7 +4899,7 @@ tables: liblibrarian: "Monograph Coded Data" libopac: "Monograph Coded Data" repeatable: 0 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 1 authorised_value: @@ -4917,7 +4917,7 @@ tables: liblibrarian: "Form of resource: Coded Data: Medium Designator" libopac: "Form of resource: Coded Data: Medium Designator" repeatable: 0 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 1 authorised_value: @@ -4953,7 +4953,7 @@ tables: liblibrarian: "Coded Data - General" libopac: "Coded Data - General" repeatable: 0 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 1 authorised_value: @@ -5007,7 +5007,7 @@ tables: liblibrarian: "Coded Data for Three-Dimensional Artefacts and Realia" libopac: "Coded Data for Three-Dimensional Artefacts and Realia" repeatable: 0 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 1 authorised_value: @@ -5025,7 +5025,7 @@ tables: liblibrarian: "Cartographic Material Coded Data (General)" libopac: "Cartographic Material Coded Data (General)" repeatable: 0 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 1 authorised_value: @@ -5043,7 +5043,7 @@ tables: liblibrarian: "Cartographic Material Coded Data: Physical attributes (General)" libopac: "Cartographic Material Coded Data: Physical attributes (General)" repeatable: 0 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 1 authorised_value: @@ -5079,7 +5079,7 @@ tables: liblibrarian: "Time period, 9999 B.C. to present" libopac: "Time period, 9999 B.C. to present" repeatable: 0 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 1 authorised_value: @@ -5097,7 +5097,7 @@ tables: liblibrarian: "Type of Scale" libopac: "Type of Scale" repeatable: 0 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 1 authorised_value: @@ -5547,7 +5547,7 @@ tables: liblibrarian: "Sound Recording Coded Data (General)" libopac: "Sound Recording Coded Data (General)" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 1 authorised_value: @@ -5583,7 +5583,7 @@ tables: liblibrarian: "Duration" libopac: "Duration" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 1 authorised_value: @@ -5637,7 +5637,7 @@ tables: liblibrarian: "Microform Coded Data Physical Attributes" libopac: "Microform Coded Data Physical Attributes" repeatable: 0 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 1 authorised_value: @@ -11325,7 +11325,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -11793,7 +11793,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -12261,7 +12261,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -12729,7 +12729,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -13197,7 +13197,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -13665,7 +13665,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -14133,7 +14133,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -14601,7 +14601,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -15069,7 +15069,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -15537,7 +15537,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -16005,7 +16005,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -16473,7 +16473,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -16941,7 +16941,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -17409,7 +17409,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -17877,7 +17877,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -18345,7 +18345,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -18813,7 +18813,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -19281,7 +19281,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -19749,7 +19749,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -20217,7 +20217,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -20685,7 +20685,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -21153,7 +21153,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -21621,7 +21621,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -22089,7 +22089,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -22557,7 +22557,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -23025,7 +23025,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -23493,7 +23493,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -23961,7 +23961,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -24429,7 +24429,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -24897,7 +24897,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -25365,7 +25365,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -25833,7 +25833,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -26301,7 +26301,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -26769,7 +26769,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -27237,7 +27237,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -27705,7 +27705,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -28173,7 +28173,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -28641,7 +28641,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -29109,7 +29109,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: @@ -29577,7 +29577,7 @@ tables: liblibrarian: "Title" libopac: "Title" repeatable: 1 - mandatory: 1 + mandatory: 0 kohafield: "" tab: 4 authorised_value: From 65b73ac349c88e8785b5e8b0eab2b2175b50b7a3 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 10 Dec 2024 13:22:33 +0000 Subject: [PATCH 03/17] 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 Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer (cherry picked from commit 1b1e96a17c0daff55e39a87f982fff896582fc72) Signed-off-by: Paul Derscheid Signed-off-by: Alex Buckley --- .../prog/en/modules/tools/additional-contents.tt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt index 7ae7c79658..91d042a2ed 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt @@ -222,7 +222,7 @@ [% END %] -
+ [% INCLUDE 'csrf-token.inc' %] @@ -262,8 +262,9 @@ [% END %]
  • - - + + + Required
    [% INCLUDE 'date-format.inc' %]
  • From 4470b0f18cc112ef3e2f03e1a219f7b3d8f13f83 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 19 Dec 2024 12:24:01 +0100 Subject: [PATCH 04/17] 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 Signed-off-by: Katrin Fischer (cherry picked from commit 75d9a3880531e27181c2af90d7dd7eaed5fd0e7e) Signed-off-by: Paul Derscheid Signed-off-by: Alex Buckley --- koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt index 35152e50aa..c52e14fe41 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt @@ -451,7 +451,7 @@ [% END %] - [% UNLESS error OR atomic_updates.error OR has_update_errors %] + [% UNLESS error OR atomic_updates.error.size OR has_update_errors %]

    Everything went okay. Update done.

    Continue to log in to Koha

    [% ELSE %] From 921c4a43b54fa957b0b2b446880cc0a761cbf40c Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 6 Nov 2024 20:24:48 +0000 Subject: [PATCH 05/17] 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 Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer (cherry picked from commit e758492d99bd0fbbeedc3d2959b7ad597319ce6e) Signed-off-by: Paul Derscheid Signed-off-by: Alex Buckley --- misc/bin/connexion_import_daemon.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/misc/bin/connexion_import_daemon.pl b/misc/bin/connexion_import_daemon.pl index 0ab2da42ab..47bd449346 100755 --- a/misc/bin/connexion_import_daemon.pl +++ b/misc/bin/connexion_import_daemon.pl @@ -407,8 +407,10 @@ exit; if ( $status == HTTP_UNAUTHORIZED || $status == HTTP_FORBIDDEN ) { # Our token might have expired. Re-authenticate and post again. + $ua = _ua(); # fresh one, needs to authenticate + $self->{ua} = $ua; $self->{csrf_token} = $self->authenticate; - $resp = $ua->post( + $resp = $ua->post( $base_url . IMPORT_SVC_URI, $post_body, csrf_token => $self->{csrf_token}, From e55a2b5bef5d65b834246dc86c06274906da8dc9 Mon Sep 17 00:00:00 2001 From: Mason James Date: Tue, 21 Feb 2023 15:49:51 +1300 Subject: [PATCH 06/17] 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 Not tested, I trust Mason to the right thing. Signed-off-by: David Cook Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer (cherry picked from commit d5ba5c287986dae6742e000ac88d7c82fa85acb5) Signed-off-by: Paul Derscheid Signed-off-by: Alex Buckley --- debian/list-deps | 3 --- 1 file changed, 3 deletions(-) diff --git a/debian/list-deps b/debian/list-deps index 119365aa1b..889c41bda7 100755 --- a/debian/list-deps +++ b/debian/list-deps @@ -27,10 +27,7 @@ use C4::Installer::PerlModules; # apt-file can find, e.g. in the Koha repo rather than the regular # debian one. my %overrides = ( - 'LWP::Protocol::https' => 'liblwp-protocol-https-perl | libwww-perl (<<6.02), libio-socket-ssl-perl', 'HTTP::OAI' => 'libhttp-oai-perl (>= 3.2) | libhttp-oai-3.27-perl, libhttp-oai-perl (<< 4.0) | libhttp-oai-3.27-perl', - 'IO::Socket::IP' => 'perl-modules (>= 5.20.0) | libio-socket-ip-perl', - 'CPAN::Meta' => 'libcpan-meta-perl (>= 2.150010) | perl-modules-5.28 | perl-modules-5.30 | perl-modules (>= 5.20.2)', 'CGI::Compile' => 'libcgi-compile-perl (>= 0.25) | libcgi-compile-perl (<< 0.24)', 'DBD::SQLite' => 'libdbd-sqlite3-perl', 'Starman' => 'starman', From 95f4b5c77a8d8293ecd77e5756d652efbffd1a50 Mon Sep 17 00:00:00 2001 From: Mason James Date: Thu, 27 Apr 2023 21:55:54 +1200 Subject: [PATCH 07/17] Bug 33018: debian package tidy-up (2) remove unrequired module modified: cpanfile Signed-off-by: David Cook Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer (cherry picked from commit 7283fa84b9434c794a3c32f7cc3f5275c9f008ea) Signed-off-by: Paul Derscheid Signed-off-by: Alex Buckley --- cpanfile | 1 - 1 file changed, 1 deletion(-) diff --git a/cpanfile b/cpanfile index 908f9319ce..dee266f1f1 100644 --- a/cpanfile +++ b/cpanfile @@ -13,7 +13,6 @@ requires 'CGI::Carp', '1.29'; requires 'CGI::Compile', '>= 0.17, != 0.24'; requires 'CGI::Emulate::PSGI', '0.20'; requires 'CGI::Session', '4.2'; -requires 'CPAN::Meta', '2.150006'; requires 'Cache::Memcached', '1.30'; requires 'Cache::Memcached::Fast::Safe', '0.06'; requires 'Class::Accessor', '0.3'; From cef370444d535aea2efa19743c2b89dcc1e41276 Mon Sep 17 00:00:00 2001 From: Andrew Fuerste Henry Date: Mon, 25 Nov 2024 20:31:30 +0000 Subject: [PATCH 08/17] 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 Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer (cherry picked from commit d86c662451727eb7e60c7385aa4f74fc0fce8604) Signed-off-by: Paul Derscheid Signed-off-by: Alex Buckley --- C4/Reserves.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index bc96dc9c3c..091bfc7c66 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -2113,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 } }) @@ -2129,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 } ); From 317b4c100435ab8221cfa44ae594085fc046bdad Mon Sep 17 00:00:00 2001 From: Caroline Cyr La Rose Date: Fri, 13 Dec 2024 16:20:37 -0500 Subject: [PATCH 09/17] 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 Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer (cherry picked from commit d350979d6b143efcf687141e6aadf53b3f872e8a) Signed-off-by: Paul Derscheid Signed-off-by: Alex Buckley --- installer/data/mysql/en/mandatory/patron_restriction_types.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/data/mysql/en/mandatory/patron_restriction_types.yml b/installer/data/mysql/en/mandatory/patron_restriction_types.yml index 8486145898..288cc9c123 100644 --- a/installer/data/mysql/en/mandatory/patron_restriction_types.yml +++ b/installer/data/mysql/en/mandatory/patron_restriction_types.yml @@ -22,7 +22,7 @@ description: tables: - restriction_types: - translatable: [] + translatable: [ display_text ] multiline: [] rows: - code: "MANUAL" From b20741c4eb080a904d8652e5673b2117a96efadc Mon Sep 17 00:00:00 2001 From: David Cook Date: Sun, 5 Jan 2025 23:47:37 +0000 Subject: [PATCH 10/17] 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 , , and 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: " -XPOST \ 'http://localhost:8081/cgi-bin/koha/svc/authentication' \ -d "login_userid=&login_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: " \ -XPOST -v 'http://localhost:8081/cgi-bin/koha/svc/bib/29' \ --cookie /tmp/test.cookies --data @rec.marcxml Signed-off-by: Jan Kissig Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer (cherry picked from commit 04dbbcc2f24a57e031dae3e1c9066b8a16234736) Signed-off-by: Paul Derscheid Signed-off-by: Alex Buckley --- C4/Auth.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 4cd0fe80ea..7710ecb55a 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1634,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 { From 28690b3b9b486d295fccf9eeef1637171558c82b Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 11 Dec 2024 14:09:28 -0300 Subject: [PATCH 11/17] Bug 38678: Regression tests Signed-off-by: Tomas Cohen Arazi Signed-off-by: David Nind Signed-off-by: Matt Blenkinsop Signed-off-by: Katrin Fischer (cherry picked from commit 51e42cde5415c5fb70a8917176ad4f055df81f1d) Signed-off-by: Paul Derscheid Signed-off-by: Alex Buckley --- t/db_dependent/api/v1/deleted_biblios.t | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/api/v1/deleted_biblios.t b/t/db_dependent/api/v1/deleted_biblios.t index c5f04b19b3..0eb0639f01 100755 --- a/t/db_dependent/api/v1/deleted_biblios.t +++ b/t/db_dependent/api/v1/deleted_biblios.t @@ -36,6 +36,7 @@ use C4::Circulation qw( AddIssue AddReturn ); use Koha::Biblios; use Koha::Database; +use Koha::DateUtils qw( dt_from_string output_pref ); use Koha::Checkouts; use Koha::Old::Checkouts; @@ -164,7 +165,7 @@ subtest 'get() tests' => sub { subtest 'list() tests' => sub { - plan tests => 17; + plan tests => 21; $schema->storage->txn_begin; @@ -228,6 +229,27 @@ subtest 'list() tests' => sub { $t->get_ok( "//$userid:$password@/api/v1/deleted/biblios?q=$query" => { Accept => 'text/plain' } )->status_is(200); + my $old_biblio_1 = Koha::Old::Biblios->find($biblio_id_1); + my $old_biblio_2 = Koha::Old::Biblios->find($biblio_id_2); + + $old_biblio_1->set( { timestamp => dt_from_string('2024-12-12T17:33:57+00:00') } )->store(); + $old_biblio_2->set( { timestamp => dt_from_string('2024-12-11T17:33:57+00:00') } )->store(); + + $query = encode_json( + { + "-and" => [ + { 'me.deleted_on' => { '>=' => '2024-12-12T00:00:00+00:00' } }, + [ + { biblio_id => $old_biblio_1->id }, + { biblio_id => $old_biblio_2->id }, + ] + ] + } + ); + + $t->get_ok( "//$userid:$password@/api/v1/deleted/biblios?q=$query" => { Accept => 'application/json' } ) + ->status_is(200)->json_is( '/0/biblio_id' => $old_biblio_1->id )->json_is( '/1/biblio_id' => undef ); + # DELETE any biblio with ISBN = TOMAS Koha::Biblios->search( { 'biblioitem.isbn' => 'TOMAS' }, { join => ['biblioitem'] } )->delete; From d2868dd8e7b96f09da45eba24ae5127f76d24b60 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 11 Dec 2024 14:09:40 -0300 Subject: [PATCH 12/17] 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 Signed-off-by: David Nind Signed-off-by: Matt Blenkinsop Signed-off-by: Katrin Fischer (cherry picked from commit 5d59ec0baaa63e4696e29903295f19750aacff1e) Signed-off-by: Paul Derscheid Signed-off-by: Alex Buckley --- Koha/Old/Biblio.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/Old/Biblio.pm b/Koha/Old/Biblio.pm index 204f145647..c2735caa92 100644 --- a/Koha/Old/Biblio.pm +++ b/Koha/Old/Biblio.pm @@ -126,7 +126,7 @@ sub to_api_mapping { seriestitle => 'series_title', copyrightdate => 'copyright_date', datecreated => 'creation_date', - deleted_on => 'timestamp', + timestamp => 'deleted_on', }; } From 8d3c796873a99ceb7c34e4c3f535477d69faa2e7 Mon Sep 17 00:00:00 2001 From: Emily Lamancusa Date: Wed, 23 Oct 2024 15:33:51 -0400 Subject: [PATCH 13/17] 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 Signed-off-by: Martin Renvoize Signed-off-by: Alex Buckley --- circ/circulation.pl | 321 ++++++++++++++++++++++---------------------- 1 file changed, 161 insertions(+), 160 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index a354c1257d..dbc200a81e 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -351,193 +351,194 @@ if (@$barcodes && $op eq 'cud-checkout') { } }; - my $blocker = $invalidduedate ? 1 : 0; + my $blocker = $invalidduedate ? 1 : 0; - $template_params->{alert} = $alerts; - $template_params->{messages} = $messages; + $template_params->{alert} = $alerts; + $template_params->{messages} = $messages; - my $item = Koha::Items->find({ barcode => $barcode }); + my $item = Koha::Items->find({ barcode => $barcode }); - my $biblio; - if ( $item ) { - $biblio = $item->biblio; - } - - if ( $issuingimpossible->{'STATS'} ) { - my ( $stats_return, $stats_messages, $stats_iteminformation, $stats_borrower ) = - AddReturn( $item->barcode, C4::Context->userenv->{'branch'}, undef, undef, 1 ); - - $template->param( - STATS => 1, - CHECKEDIN => $stats_return, - MESSAGES => $stats_messages, - ITEM => $stats_iteminformation, - BORROWER => $stats_borrower, - ); - - #increment items.localuse - my $localuse_count = $item->localuse; - $localuse_count++; - $item->localuse($localuse_count)->store; - } - - # Fix for bug 7494: optional checkout-time fallback search for a book - - if ( $issuingimpossible->{'UNKNOWN_BARCODE'} - && C4::Context->preference("itemBarcodeFallbackSearch") - && not $batch - ) - { - $template_params->{FALLBACK} = 1; - - my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); - my $query = "kw=" . $barcode; - my ( $searcherror, $results, $total_hits ) = $searcher->simple_search_compat($query, 0, 10); - - # if multiple hits, offer options to librarian - if ( $total_hits > 0 ) { - my @barcodes; - foreach my $hit ( @{$results} ) { - my $chosen = # Maybe easier to retrieve the itemnumber from $hit? - TransformMarcToKoha({ record => C4::Search::new_record_from_zebra('biblioserver',$hit) }); - - # offer all barcodes individually - if ( $chosen->{barcode} ) { - push @barcodes, sort split(/\s*\|\s*/, $chosen->{barcode}); - } - } - my $items = Koha::Items->search({ barcode => {-in => \@barcodes}}); - $template_params->{options} = $items; + my $biblio; + if ( $item ) { + $biblio = $item->biblio; } - } - # Only some errors will block when performing forced onsite checkout, - # for other cases all errors will block - my @blocking_error_codes = - ( $onsite_checkout and C4::Context->preference("OnSiteCheckoutsForce") ) - ? qw( UNKNOWN_BARCODE NO_OPEN_DAYS ) - : ( keys %$issuingimpossible ); + if ( $issuingimpossible->{'STATS'} ) { + my ( $stats_return, $stats_messages, $stats_iteminformation, $stats_borrower ) = + AddReturn( $item->barcode, C4::Context->userenv->{'branch'}, undef, undef, 1 ); - if ( $issuingimpossible->{BOOKED_TO_ANOTHER} ) { - $template_params->{BOOKED_TO_ANOTHER} = $issuingimpossible->{BOOKED_TO_ANOTHER}; - $template_params->{IMPOSSIBLE} = 1; - $blocker = 1; - } + $template->param( + STATS => 1, + CHECKEDIN => $stats_return, + MESSAGES => $stats_messages, + ITEM => $stats_iteminformation, + BORROWER => $stats_borrower, + ); - foreach my $code ( @blocking_error_codes ) { - if ($issuingimpossible->{$code}) { - $template_params->{$code} = $issuingimpossible->{$code}; - - $template_params->{IMPOSSIBLE} = 1; - $blocker = 1; + #increment items.localuse + my $localuse_count = $item->localuse; + $localuse_count++; + $item->localuse($localuse_count)->store; } - } - delete $needsconfirmation->{'DEBT'} if ($debt_confirmed); + # Fix for bug 7494: optional checkout-time fallback search for a book - if ( $item && C4::Context->preference('ClaimReturnedLostValue') ) { - my $autoClaimReturnCheckout = C4::Context->preference('AutoClaimReturnStatusOnCheckout'); + if ( $issuingimpossible->{'UNKNOWN_BARCODE'} + && C4::Context->preference("itemBarcodeFallbackSearch") + && not $batch + ) + { + $template_params->{FALLBACK} = 1; - my $claims = Koha::Checkouts::ReturnClaims->search( - { - itemnumber => $item->id, - } - ); - if ( $claims->count ) { - if ($autoClaimReturnCheckout) { - my $claim = $claims->next; + my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); + my $query = "kw=" . $barcode; + my ( $searcherror, $results, $total_hits ) = $searcher->simple_search_compat($query, 0, 10); - my $patron_id = $logged_in_user->borrowernumber; - my $resolution = $autoClaimReturnCheckout; + # if multiple hits, offer options to librarian + if ( $total_hits > 0 ) { + my @barcodes; + foreach my $hit ( @{$results} ) { + my $chosen = # Maybe easier to retrieve the itemnumber from $hit? + TransformMarcToKoha({ record => C4::Search::new_record_from_zebra('biblioserver',$hit) }); - $claim->resolve( - { - resolution => $resolution, - resolved_by => $patron_id, + # offer all barcodes individually + if ( $chosen->{barcode} ) { + push @barcodes, sort split(/\s*\|\s*/, $chosen->{barcode}); } - ); - $template_params->{CLAIM_RESOLUTION} = $claim; - } - } - } - - if( $item and ( !$blocker or $force_allow_issue ) ){ - my $confirm_required = 0; - unless($issueconfirmed){ - # Get the item title for more information - my $materials = $item->materials; - my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({ frameworkcode => $biblio->frameworkcode, kohafield => 'items.materials', authorised_value => $materials }); - $materials = $descriptions->{lib} // $materials; - $template_params->{ADDITIONAL_MATERIALS} = $materials; - $template_params->{itemhomebranch} = $item->homebranch; - - # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed. - foreach my $needsconfirmation_key ( keys %$needsconfirmation ) { - $template_params->{$needsconfirmation_key} = $needsconfirmation->{$needsconfirmation_key}; - $template_params->{getTitleMessageIteminfo} = $biblio->title; - $template_params->{getBarcodeMessageIteminfo} = $item->barcode; - $template_params->{NEEDSCONFIRMATION} = 1; - $confirm_required = 1; - if ( $needsconfirmation_key eq 'BOOKED_TO_ANOTHER' ) { - my $reduceddue = - dt_from_string( $$needsconfirmation{$needsconfirmation_key}->start_date )->subtract( days => 1 ); - $template_params->{reduceddue} = $reduceddue; } + my $items = Koha::Items->search({ barcode => {-in => \@barcodes}}); + $template_params->{options} = $items; } } - unless ($confirm_required) { - my $switch_onsite_checkout = exists $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}; - if ( C4::Context->preference('UseRecalls') && !$recall_id ) { - my $recall = Koha::Recalls->find( - { - biblio_id => $item->biblionumber, - item_id => [ undef, $item->itemnumber ], - status => [ 'requested', 'waiting' ], - completed => 0, - patron_id => $patron->borrowernumber, - } - ); - $recall_id = ( $recall and $recall->id ) ? $recall->id : undef; - } - # If booked (alerts or confirmation) update datedue to end of booking - if ( my $booked = $needsconfirmation->{BOOKED_EARLY} // $alerts->{BOOKED} ) { - $datedue = $booked->end_date; + # Only some errors will block when performing forced onsite checkout, + # for other cases all errors will block + my @blocking_error_codes = + ( $onsite_checkout and C4::Context->preference("OnSiteCheckoutsForce") ) + ? qw( UNKNOWN_BARCODE NO_OPEN_DAYS ) + : ( keys %$issuingimpossible ); + + if ( $issuingimpossible->{BOOKED_TO_ANOTHER} ) { + $template_params->{BOOKED_TO_ANOTHER} = $issuingimpossible->{BOOKED_TO_ANOTHER}; + $template_params->{IMPOSSIBLE} = 1; + $blocker = 1; + } + + foreach my $code ( @blocking_error_codes ) { + if ($issuingimpossible->{$code}) { + $template_params->{$code} = $issuingimpossible->{$code}; + + $template_params->{IMPOSSIBLE} = 1; + $blocker = 1; } - my $issue = AddIssue( - $patron, $barcode, $datedue, - $cancelreserve, - undef, undef, + } + + delete $needsconfirmation->{'DEBT'} if ($debt_confirmed); + + if ( $item && C4::Context->preference('ClaimReturnedLostValue') ) { + my $autoClaimReturnCheckout = C4::Context->preference('AutoClaimReturnStatusOnCheckout'); + + my $claims = Koha::Checkouts::ReturnClaims->search( { - onsite_checkout => $onsite_checkout, auto_renew => $session->param('auto_renew'), - switch_onsite_checkout => $switch_onsite_checkout, cancel_recall => $cancel_recall, - recall_id => $recall_id, + itemnumber => $item->id, + resolution => undef, } ); - $template_params->{issue} = $issue; - $session->clear('auto_renew'); - $inprocess = 1; + if ( $claims->count ) { + if ($autoClaimReturnCheckout) { + my $claim = $claims->next; + + my $patron_id = $logged_in_user->borrowernumber; + my $resolution = $autoClaimReturnCheckout; + + $claim->resolve( + { + resolution => $resolution, + resolved_by => $patron_id, + } + ); + $template_params->{CLAIM_RESOLUTION} = $claim; + } + } } - } - if ($needsconfirmation->{RESERVE_WAITING} or $needsconfirmation->{RESERVED} or $needsconfirmation->{TRANSFERRED} or $needsconfirmation->{PROCESSING}){ - $template->param( - reserveborrowernumber => $needsconfirmation->{'resborrowernumber'}, - reserve_id => $needsconfirmation->{reserve_id}, - ); - } + if( $item and ( !$blocker or $force_allow_issue ) ){ + my $confirm_required = 0; + unless($issueconfirmed){ + # Get the item title for more information + my $materials = $item->materials; + my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({ frameworkcode => $biblio->frameworkcode, kohafield => 'items.materials', authorised_value => $materials }); + $materials = $descriptions->{lib} // $materials; + $template_params->{ADDITIONAL_MATERIALS} = $materials; + $template_params->{itemhomebranch} = $item->homebranch; + + # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed. + foreach my $needsconfirmation_key ( keys %$needsconfirmation ) { + $template_params->{$needsconfirmation_key} = $needsconfirmation->{$needsconfirmation_key}; + $template_params->{getTitleMessageIteminfo} = $biblio->title; + $template_params->{getBarcodeMessageIteminfo} = $item->barcode; + $template_params->{NEEDSCONFIRMATION} = 1; + $confirm_required = 1; + if ( $needsconfirmation_key eq 'BOOKED_TO_ANOTHER' ) { + my $reduceddue = + dt_from_string( $$needsconfirmation{$needsconfirmation_key}->start_date )->subtract( days => 1 ); + $template_params->{reduceddue} = $reduceddue; + } + } + } + unless ($confirm_required) { + my $switch_onsite_checkout = exists $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}; + if ( C4::Context->preference('UseRecalls') && !$recall_id ) { + my $recall = Koha::Recalls->find( + { + biblio_id => $item->biblionumber, + item_id => [ undef, $item->itemnumber ], + status => [ 'requested', 'waiting' ], + completed => 0, + patron_id => $patron->borrowernumber, + } + ); + $recall_id = ( $recall and $recall->id ) ? $recall->id : undef; + } + + # If booked (alerts or confirmation) update datedue to end of booking + if ( my $booked = $needsconfirmation->{BOOKED_EARLY} // $alerts->{BOOKED} ) { + $datedue = $booked->end_date; + } + my $issue = AddIssue( + $patron, $barcode, $datedue, + $cancelreserve, + undef, undef, + { + onsite_checkout => $onsite_checkout, auto_renew => $session->param('auto_renew'), + switch_onsite_checkout => $switch_onsite_checkout, cancel_recall => $cancel_recall, + recall_id => $recall_id, + } + ); + $template_params->{issue} = $issue; + $session->clear('auto_renew'); + $inprocess = 1; + } + } + + if ($needsconfirmation->{RESERVE_WAITING} or $needsconfirmation->{RESERVED} or $needsconfirmation->{TRANSFERRED} or $needsconfirmation->{PROCESSING}){ + $template->param( + reserveborrowernumber => $needsconfirmation->{'resborrowernumber'}, + reserve_id => $needsconfirmation->{reserve_id}, + ); + } - # FIXME If the issue is confirmed, we launch another time checkouts->count, now display the issue count after issue - $patron = Koha::Patrons->find( $borrowernumber ); - $template_params->{issuecount} = $patron->checkouts->count; + # FIXME If the issue is confirmed, we launch another time checkouts->count, now display the issue count after issue + $patron = Koha::Patrons->find( $borrowernumber ); + $template_params->{issuecount} = $patron->checkouts->count; - if ( $item ) { - $template_params->{item} = $item; - $template_params->{biblio} = $biblio; - $template_params->{itembiblionumber} = $biblio->biblionumber; - } - push @$checkout_infos, $template_params; + if ( $item ) { + $template_params->{item} = $item; + $template_params->{biblio} = $biblio; + $template_params->{itembiblionumber} = $biblio->biblionumber; + } + push @$checkout_infos, $template_params; } unless ( $batch ) { $template->param( %{$checkout_infos->[0]} ); From 98b7336d9fef17ddec3a445edd4f609e5334d4d1 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 19 Nov 2024 16:09:43 +0000 Subject: [PATCH 14/17] Bug 38486: [24.05.x] Fix unit tests Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Alex Buckley --- t/db_dependent/SIP/Transaction.t | 44 ++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t index 56a810a736..f422676519 100755 --- a/t/db_dependent/SIP/Transaction.t +++ b/t/db_dependent/SIP/Transaction.t @@ -858,10 +858,27 @@ subtest do_checkout_with_patron_blocked => sub { }; subtest do_checkout_with_noblock => sub { - plan tests => 3; + plan tests => 1; + + my $mockILS = Test::MockObject->new; + my $server = { ils => $mockILS }; my $library = $builder->build_object( { class => 'Koha::Libraries' } ); - my $patron = $builder->build_object( + + my $institution = { + id => $library->id, + implementation => "ILS", + policy => { + checkin => "true", + renewal => "true", + checkout => "true", + timeout => 100, + retries => 5, + } + }; + my $ils = C4::SIP::ILS->new($institution); + + my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { @@ -879,21 +896,15 @@ subtest do_checkout_with_noblock => sub { } ); - my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); - my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); - my $co_transaction = C4::SIP::ILS::Transaction::Checkout->new(); - is( - $co_transaction->patron($sip_patron), - $sip_patron, "Patron assigned to transaction" - ); - is( - $co_transaction->item($sip_item), - $sip_item, "Item assigned to transaction" - ); + my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); + my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); - $co_transaction->do_checkout( undef, '19990102 030405' ); + my $circ = + $ils->checkout( $patron->cardnumber, $item->barcode, undef, undef, + $server->{account}, '19990102 030405' ); - is( $patron->checkouts->count, 1, 'No Block checkout was performed for debarred patron' ); + is( $patron->checkouts->count, + 1, 'No Block checkout was performed for debarred patron' ); }; subtest do_checkout_with_holds => sub { @@ -917,7 +928,8 @@ subtest do_checkout_with_holds => sub { } ); - t::lib::Mocks::mock_userenv( { branchcode => $library->branchcode, flags => 1 } ); + t::lib::Mocks::mock_userenv( + { branchcode => $library->branchcode, flags => 1 } ); my $item = $builder->build_sample_item( { From 56d2ccc3f78c6954cc376a7bb519a9ea04279bcb Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 19 Nov 2024 16:10:14 +0000 Subject: [PATCH 15/17] 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 Signed-off-by: Martin Renvoize Signed-off-by: Alex Buckley --- C4/SIP/ILS.pm | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm index 7b0addd61b..e8f978e998 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -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 From 225746819fea276d61ee2b5de1f3cc52e62e3645 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Thu, 14 Nov 2024 12:34:44 +0000 Subject: [PATCH 16/17] 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 Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer (cherry picked from commit b26b7d740fc1135ed3c286f3faf03210c98a72c2) Signed-off-by: Paul Derscheid Signed-off-by: Alex Buckley --- t/db_dependent/{Illrequest => Koha/ILL/Request}/SupplierUpdate.t | 0 .../{Illrequest => Koha/ILL/Request}/SupplierUpdateProcessor.t | 0 .../{Illrequest => Koha/ILL/Request/Workflow}/Availability.t | 0 .../{Illrequest => Koha/ILL/Request/Workflow}/TypeDisclaimer.t | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename t/db_dependent/{Illrequest => Koha/ILL/Request}/SupplierUpdate.t (100%) rename t/db_dependent/{Illrequest => Koha/ILL/Request}/SupplierUpdateProcessor.t (100%) rename t/db_dependent/{Illrequest => Koha/ILL/Request/Workflow}/Availability.t (100%) rename t/db_dependent/{Illrequest => Koha/ILL/Request/Workflow}/TypeDisclaimer.t (100%) diff --git a/t/db_dependent/Illrequest/SupplierUpdate.t b/t/db_dependent/Koha/ILL/Request/SupplierUpdate.t similarity index 100% rename from t/db_dependent/Illrequest/SupplierUpdate.t rename to t/db_dependent/Koha/ILL/Request/SupplierUpdate.t diff --git a/t/db_dependent/Illrequest/SupplierUpdateProcessor.t b/t/db_dependent/Koha/ILL/Request/SupplierUpdateProcessor.t similarity index 100% rename from t/db_dependent/Illrequest/SupplierUpdateProcessor.t rename to t/db_dependent/Koha/ILL/Request/SupplierUpdateProcessor.t diff --git a/t/db_dependent/Illrequest/Availability.t b/t/db_dependent/Koha/ILL/Request/Workflow/Availability.t similarity index 100% rename from t/db_dependent/Illrequest/Availability.t rename to t/db_dependent/Koha/ILL/Request/Workflow/Availability.t diff --git a/t/db_dependent/Illrequest/TypeDisclaimer.t b/t/db_dependent/Koha/ILL/Request/Workflow/TypeDisclaimer.t similarity index 100% rename from t/db_dependent/Illrequest/TypeDisclaimer.t rename to t/db_dependent/Koha/ILL/Request/Workflow/TypeDisclaimer.t From 1a38aacac3548ee16ad8a3b3ec6717aeb8fffb5b Mon Sep 17 00:00:00 2001 From: Janusz Kaczmarek Date: Tue, 19 Nov 2024 12:22:23 +0000 Subject: [PATCH 17/17] 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 Signed-off-by: Emily Lamancusa Signed-off-by: Katrin Fischer (cherry picked from commit 7c70b09dfccc7d32afc2e4cf6e15550aad13a7c6) Signed-off-by: Paul Derscheid Signed-off-by: Alex Buckley --- C4/Heading.pm | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/C4/Heading.pm b/C4/Heading.pm index 653cd9636d..9a491c8a89 100644 --- a/C4/Heading.pm +++ b/C4/Heading.pm @@ -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', '')) ...