Bugzilla – Attachment 73797 Details for
Bug 20467
Add ability to batch add items to a course
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20467 [QA Followup]: Display error if no or invalid course id is passed
Bug-20467-QA-Followup-Display-error-if-no-or-inval.patch (text/plain), 4.19 KB, created by
Kyle M Hall (khall)
on 2018-04-06 18:50:59 UTC
(
hide
)
Description:
Bug 20467 [QA Followup]: Display error if no or invalid course id is passed
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-04-06 18:50:59 UTC
Size:
4.19 KB
patch
obsolete
>From 86c33c0af72322e215ab9509c734c4b8d1b75d21 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatetsolutions.com> >Date: Fri, 6 Apr 2018 14:50:38 -0400 >Subject: [PATCH] Bug 20467 [QA Followup]: Display error if no or invalid > course id is passed > >--- > course_reserves/batch_add_items.pl | 80 ++++++++++++---------- > .../en/modules/course_reserves/batch_add_items.tt | 3 + > 2 files changed, 46 insertions(+), 37 deletions(-) > >diff --git a/course_reserves/batch_add_items.pl b/course_reserves/batch_add_items.pl >index ba16e76904..76d0caa0b5 100755 >--- a/course_reserves/batch_add_items.pl >+++ b/course_reserves/batch_add_items.pl >@@ -52,50 +52,56 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > >-$template->param( course => GetCourse($course_id) ); >+my $course = GetCourse($course_id); > >-if ( !$action ) { >- $template->param( action => 'display_form' ); >-} >-elsif ( $action eq 'add' ) { >- my @barcodes = uniq( split( /\s\n/, $barcodes ) ); >- >- my @items; >- my @invalid_barcodes; >- for my $b (@barcodes) { >- my $item = Koha::Items->find( { barcode => $b } ); >+if ( $course_id && $course ) { >+ $template->param( course => $course ); > >- if ($item) { >- push( @items, $item ); >- } >- else { >- push( @invalid_barcodes, $b ); >- } >+ if ( !$action ) { >+ $template->param( action => 'display_form' ); > } >+ elsif ( $action eq 'add' ) { >+ my @barcodes = uniq( split( /\s\n/, $barcodes ) ); >+ >+ my @items; >+ my @invalid_barcodes; >+ for my $b (@barcodes) { >+ my $item = Koha::Items->find( { barcode => $b } ); >+ >+ if ($item) { >+ push( @items, $item ); >+ } >+ else { >+ push( @invalid_barcodes, $b ); >+ } >+ } > >- foreach my $item (@items) { >- my $ci_id = ModCourseItem( >- itemnumber => $item->id, >- itype => $itype, >- ccode => $ccode, >- holdingbranch => $holdingbranch, >- location => $location, >- ); >+ foreach my $item (@items) { >+ my $ci_id = ModCourseItem( >+ itemnumber => $item->id, >+ itype => $itype, >+ ccode => $ccode, >+ holdingbranch => $holdingbranch, >+ location => $location, >+ ); >+ >+ my $cr_id = ModCourseReserve( >+ course_id => $course_id, >+ ci_id => $ci_id, >+ staff_note => $staff_note, >+ public_note => $public_note, >+ ); >+ } > >- my $cr_id = ModCourseReserve( >- course_id => $course_id, >- ci_id => $ci_id, >- staff_note => $staff_note, >- public_note => $public_note, >+ $template->param( >+ action => 'display_results', >+ items_added => \@items, >+ invalid_barcodes => \@invalid_barcodes, >+ course_id => $course_id, > ); > } >- >- $template->param( >- action => 'display_results', >- items_added => \@items, >- invalid_barcodes => \@invalid_barcodes, >- course_id => $course_id, >- ); >+} else { >+ $template->param( action => 'invalid_course' ); > } > > output_html_with_http_headers $cgi, $cookie, $template->output; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/batch_add_items.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/batch_add_items.tt >index 9ebe71de53..7326485873 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/batch_add_items.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/batch_add_items.tt >@@ -16,6 +16,9 @@ > <div class="main container-fluid"> > <div class="row"> > <div class="col-md-8 col-md-offset-2"> >+ [% IF action == 'invalid_course' %] >+ <div id="invalid-course-error" class="dialog alert">Invalid course!</div> >+ [% END %] > > [% IF action == 'display_form' %] > <form method="post" action="/cgi-bin/koha/course_reserves/batch_add_items.pl"> >-- >2.15.1 (Apple Git-101)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20467
:
73209
|
73213
|
73214
|
73219
|
73220
|
73239
|
73419
|
73453
|
73550
|
73551
|
73705
|
73797
|
76468
|
76469
|
76470
|
76471
|
76472