From bf5dfd2e0aaed6c82197c7ba0633bf93d44f976f Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 14 Mar 2017 14:16:09 +0000 Subject: [PATCH] Bug 18264 - Course reserves - use itemnumber for editing existing reserve items MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch alters the crouse reserves module to use itemnumber as the lookup method for existing reserves as opposed to barcode To test: 1 - Apply patch 2 - Add some items to a course reserves - all should work as expected 3 - Delete the barcode for an item on reserve 4 - Note the edit link still resolves to the correct item Followed test plan, works as expected. Signed-off-by: Marc Véron Signed-off-by: Jonathan Druart Signed-off-by: Brendan A Gallagher (cherry picked from commit 2ead301181c33f42d3c88abffa8d18b8a416b40a) Signed-off-by: Katrin Fischer --- course_reserves/add_items.pl | 16 +++++++++------- .../en/modules/course_reserves/course-details.tt | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/course_reserves/add_items.pl b/course_reserves/add_items.pl index bcfadc7f0d..ef8605f89d 100755 --- a/course_reserves/add_items.pl +++ b/course_reserves/add_items.pl @@ -31,12 +31,13 @@ use C4::CourseReserves qw(GetCourse GetCourseItem GetCourseReserve ModCourseItem my $cgi = new CGI; -my $action = $cgi->param('action') || ''; -my $course_id = $cgi->param('course_id') || ''; -my $barcode = $cgi->param('barcode') || ''; -my $return = $cgi->param('return') || ''; +my $action = $cgi->param('action') || ''; +my $course_id = $cgi->param('course_id') || ''; +my $barcode = $cgi->param('barcode') || ''; +my $return = $cgi->param('return') || ''; +my $itemnumber = ($cgi->param('itemnumber') && $action eq 'lookup') ? $cgi->param('itemnumber') : ''; -my $item = GetBiblioFromItemNumber( undef, $barcode ); +my $item = GetBiblioFromItemNumber( $itemnumber, $barcode ); my $step = ( $action eq 'lookup' && $item ) ? '2' : '1'; @@ -49,8 +50,9 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( flagsrequired => { coursereserves => 'add_reserves' }, } ); -$template->param( ERROR_BARCODE_NOT_FOUND => $barcode ) - unless ( $barcode && $item && $action eq 'lookup' ); +my $inumber = $itemnumber ? " (itemnumber:$itemnumber)" : ""; +$template->param( ERROR_BARCODE_NOT_FOUND => $barcode . $inumber ) + unless ( $barcode && !$itemnumber && $item && $action eq 'lookup' ); $template->param( course => GetCourse($course_id) ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt index 99aa832eb5..d32343d4a2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt @@ -202,7 +202,7 @@ [% IF CAN_user_coursereserves_add_reserves || CAN_user_coursereserves_delete_reserves %] [% IF CAN_user_coursereserves_add_reserves %] - Edit + Edit [% END %] [% IF CAN_user_coursereserves_delete_reserves %] -- 2.39.5