Bugzilla – Attachment 105360 Details for
Bug 25606
Adds "Remove all reserves" button to course details
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25606: Add remove all reserves button to course details page
Bug-25606-Remove-all-reserve-items-button.patch (text/plain), 4.10 KB, created by
Joe Sikowitz
on 2020-05-26 14:43:17 UTC
(
hide
)
Description:
Bug 25606: Add remove all reserves button to course details page
Filename:
MIME Type:
Creator:
Joe Sikowitz
Created:
2020-05-26 14:43:17 UTC
Size:
4.10 KB
patch
obsolete
>From 70615317bc8b490abc9d30dd0c5c740582af6714 Mon Sep 17 00:00:00 2001 >From: Joseph Sikowitz <joe@flo.org> >Date: Sat, 23 May 2020 17:45:51 -0400 >Subject: [PATCH 2/2] Bug 25606: Remove all reserve items button > >Adds button to course records to remove all attached reserve items. A warning dialog box will appear before executed. > >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..7604e23 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 'rm_all' ); > > 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 'rm_all' ) { >+ 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..421940a 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=rm_all"><i class="fa fa-minus"></i> Remove all 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 25606
:
105360
|
105494
|
107904
|
107905