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

Signed-off-by: Jason Robb <jrobb@sekls.org>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit b8a18702d2)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2022-05-24 18:27:30 +00:00 committed by Lucas Gass
parent e79fe19e67
commit 93cd916cc1
3 changed files with 6 additions and 0 deletions

View file

@ -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 );

View file

@ -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) {

View file

@ -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);