From e8a811779db630792b3834ba3b5ecf133afb8fec Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 24 May 2022 18:27:30 +0000 Subject: [PATCH] Bug 30840: Add support for barcode filters to course reserves This bug adds support for barcode filters on the inputs in the course reserves module. To test: 1 - Set itemBarcodeInputFilter to 'Remove spaces from' 2 - Find a barcode in your system and add spaces between each characters e.g. 3 9 9 9 9 0 0 0 0 0 0 8 1 8 3 - Past that barcode into the checkin box, success 4 - Browse to course reserves, ensure you have a course or create on 5 - Test adding a reserve, batch adding a reserve, and batch removing reserves 6 - The pasted barcode does not in any 7 - Apply patch and restart 8 - Pasted barcode with spaces can now successfuly be added, batch added, and batch removed from courses --- course_reserves/add_items.pl | 2 ++ course_reserves/batch_add_items.pl | 2 ++ course_reserves/batch_rm_items.pl | 2 ++ 3 files changed, 6 insertions(+) diff --git a/course_reserves/add_items.pl b/course_reserves/add_items.pl index 10b74a40cc..f8972f88ec 100755 --- a/course_reserves/add_items.pl +++ b/course_reserves/add_items.pl @@ -23,6 +23,7 @@ use Modern::Perl; use CGI qw ( -utf8 ); use C4::Auth qw( get_template_and_user ); +use C4::Circulation qw( barcodedecode ); use C4::Output qw( output_html_with_http_headers ); use C4::Koha qw( GetAuthorisedValues ); use Koha::Items; @@ -43,6 +44,7 @@ my $is_edit = $cgi->param('is_edit') || ''; my $biblionumber = $cgi->param('biblionumber') || ''; $barcode =~ s/^\s*|\s*$//g; #remove leading/trailing whitespace +$barcode = barcodedecode($barcode) if $barcode; $biblionumber =~ s/^\s*|\s*$//g; #remove leading/trailing whitespace my ( $item, $biblio ); diff --git a/course_reserves/batch_add_items.pl b/course_reserves/batch_add_items.pl index 1f66ee82e5..c71ce46f47 100755 --- a/course_reserves/batch_add_items.pl +++ b/course_reserves/batch_add_items.pl @@ -24,6 +24,7 @@ use CGI qw( -utf8 ); use List::MoreUtils qw( uniq ); use C4::Auth qw( get_template_and_user ); +use C4::Circulation qw( barcodedecode ); use C4::Output qw( output_html_with_http_headers ); use C4::CourseReserves qw( GetCourse ModCourse ModCourseItem ModCourseReserve ); @@ -73,6 +74,7 @@ if ( $course_id && $course ) { my @items; my @invalid_barcodes; for my $b (@barcodes) { + $b = barcodedecode($b) if $b; my $item = Koha::Items->find( { barcode => $b } ); if ($item) { diff --git a/course_reserves/batch_rm_items.pl b/course_reserves/batch_rm_items.pl index de0a49d3b0..14d33b905d 100755 --- a/course_reserves/batch_rm_items.pl +++ b/course_reserves/batch_rm_items.pl @@ -23,6 +23,7 @@ use CGI qw( -utf8 ); use List::MoreUtils qw( uniq ); use C4::Auth qw( get_template_and_user ); +use C4::Circulation qw( barcodedecode ); use C4::Output qw( output_html_with_http_headers ); use C4::CourseReserves qw( GetCourse GetCourseItem GetItemCourseReservesInfo DelCourse DelCourseReserve ); @@ -52,6 +53,7 @@ elsif ( $action eq 'batch_rm' ) { my @item_and_count; foreach my $bar (@barcodes) { + $bar = barcodedecode($bar) if $bar; my $item = Koha::Items->find( { barcode => $bar } ); if($item) { my $courseitem = GetCourseItem(itemnumber => $item->id); -- 2.30.2