Bugzilla – Attachment 105190 Details for
Bug 14648
Batch remove reserve items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14648: Batch Remove Reserve Items
Bug-14648-Batch-Remove-Reserve-Items.patch (text/plain), 4.13 KB, created by
Joe Sikowitz
on 2020-05-21 13:12:53 UTC
(
hide
)
Description:
Bug 14648: Batch Remove Reserve Items
Filename:
MIME Type:
Creator:
Joe Sikowitz
Created:
2020-05-21 13:12:53 UTC
Size:
4.13 KB
patch
obsolete
>From bb63dcf34227428f31641346da75e41e47aca2aa Mon Sep 17 00:00:00 2001 >From: Joseph Sikowitz <joe@flo.org> >Date: Wed, 20 May 2020 17:11:01 -0400 >Subject: [PATCH 2/2] Bug 14648: Batch Remove Reserve Items > >Adds batch remove reserves button to course-details.tt for users who have the permission to delete reserves and adds Javascript dialog box to warn users about batch remove action. >Adds batch remove functionality to course-details.pl. > >Test plan >1. Install patch >2. Log in as user with permission to delete reserves >3. View a course reserve record with multiple items attached >4. There should now be a button that says "- Batch remove reserves" >5. When you click the button a dialog box should appear with a warning >6. Click "Ok" >7. All course reserves should be removed from the record >8. Add an item to more than course record >9. Redo 3-7 >10. Items should have been removed from that course but remain on all other courses >11. Log in as a user without delete reserves permission >12. You should not see the batch remove option >--- > course_reserves/course-details.pl | 10 +++++++++- > .../prog/en/modules/course_reserves/course-details.tt | 7 +++++++ > 2 files changed, 16 insertions(+), 1 deletion(-) > >diff --git a/course_reserves/course-details.pl b/course_reserves/course-details.pl >index af1eb62..5175840 100755 >--- a/course_reserves/course-details.pl >+++ b/course_reserves/course-details.pl >@@ -34,7 +34,7 @@ my $action = $cgi->param('action') || ''; > my $course_id = $cgi->param('course_id'); > > my $flagsrequired; >-$flagsrequired->{coursereserves} = 'delete_reserves' if ( $action eq 'del_reserve' ); >+$flagsrequired->{coursereserves} = 'delete_reserves' if ( $action eq 'del_reserve' or $action eq 'batch_del' ); > > my $tmpl = ($course_id) ? "course-details.tt" : "invalid-course.tt"; > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >@@ -49,6 +49,14 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > if ( $action eq 'del_reserve' ) { > DelCourseReserve( cr_id => scalar $cgi->param('cr_id') ); > } >+elsif ( $action eq 'batch_del' ) { >+ my $course_res = GetCourseReserves(course_id => $course_id); >+ foreach my $cr (@$course_res) { >+ if(exists $cr->{'cr_id'}) { >+ DelCourseReserve(cr_id => $cr->{cr_id}); >+ } >+ } >+} > > my $course = GetCourse($course_id); > my $course_reserves = GetCourseReserves( >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 a1e04a9..157b4b7 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 >@@ -36,6 +36,9 @@ > <a class="btn btn-default" id="add_items" href="/cgi-bin/koha/course_reserves/add_items.pl?course_id=[% course.course_id | html %]"><i class="fa fa-plus"></i> Add reserves</a> > <a class="btn btn-default" id="add_items" href="/cgi-bin/koha/course_reserves/batch_add_items.pl?course_id=[% course.course_id | html %]"><i class="fa fa-plus"></i> Batch add reserves</a> > [% END %] >+ [% IF CAN_user_coursereserves_delete_reserves %] >+ <a class="btn btn-default" id="rm_items" href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id | html %]&action=batch_del"><i class="fa fa-minus"></i> Batch remove reserves</a> >+ [% END %] > [% IF ( CAN_user_coursereserves_manage_courses ) %] > <a class="btn btn-default" id="edit_course" href="/cgi-bin/koha/course_reserves/course.pl?course_id=[% course.course_id | html %]"><i class="fa fa-pencil"></i> Edit course</a> > [% END %] >@@ -263,6 +266,10 @@ > return confirmDelete(_("Are you sure you want to remove this item from the course?")); > }); > >+ $("#rm_items").click(function(){ >+ return confirmDelete(_("Are you sure you want to remove all items from the course?")); >+ }); >+ > $("#delete_course").click(function(){ > [% SET count = course_reserves.size || 0 %] > [% IF count == 1 %] >-- >2.7.4 >
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 14648
:
105190
|
105607
|
105609
|
105610
|
107043
|
110228
|
110293
|
110294
|
110295
|
110988