View | Details | Raw Unified | Return to bug 25606
Collapse All | Expand All

(-)a/course_reserves/course-details.pl (-1 / +9 lines)
Lines 34-40 my $action = $cgi->param('action') || ''; Link Here
34
my $course_id = $cgi->param('course_id');
34
my $course_id = $cgi->param('course_id');
35
35
36
my $flagsrequired;
36
my $flagsrequired;
37
$flagsrequired->{coursereserves} = 'delete_reserves' if ( $action eq 'del_reserve' );
37
$flagsrequired->{coursereserves} = 'delete_reserves' if ( $action eq 'del_reserve' or $action eq 'rm_all' );
38
38
39
my $tmpl = ($course_id) ? "course-details.tt" : "invalid-course.tt";
39
my $tmpl = ($course_id) ? "course-details.tt" : "invalid-course.tt";
40
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
40
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 49-54 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
49
if ( $action eq 'del_reserve' ) {
49
if ( $action eq 'del_reserve' ) {
50
    DelCourseReserve( cr_id => scalar $cgi->param('cr_id') );
50
    DelCourseReserve( cr_id => scalar $cgi->param('cr_id') );
51
}
51
}
52
elsif ( $action eq 'rm_all' ) {
53
    my $course_res = GetCourseReserves(course_id => $course_id);
54
    foreach my $cr (@$course_res) {
55
        if(exists $cr->{'cr_id'}) {
56
            DelCourseReserve(cr_id => $cr->{cr_id});
57
        }
58
    }
59
}
52
60
53
my $course          = GetCourse($course_id);
61
my $course          = GetCourse($course_id);
54
my $course_reserves = GetCourseReserves(
62
my $course_reserves = GetCourseReserves(
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt (-1 / +7 lines)
Lines 36-41 Link Here
36
                    <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>
36
                    <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>
37
                    <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>
37
                    <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>
38
                [% END %]
38
                [% END %]
39
                [% IF CAN_user_coursereserves_delete_reserves %]
40
                    <a class="btn btn-default" id="rm_items" href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id | html %]&amp;action=rm_all"><i class="fa fa-minus"></i> Remove all reserves</a>
41
                [% END %]
39
                [% IF ( CAN_user_coursereserves_manage_courses ) %]
42
                [% IF ( CAN_user_coursereserves_manage_courses ) %]
40
                    <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>
43
                    <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>
41
                [% END %]
44
                [% END %]
Lines 263-268 Link Here
263
                return confirmDelete(_("Are you sure you want to remove this item from the course?"));
266
                return confirmDelete(_("Are you sure you want to remove this item from the course?"));
264
            });
267
            });
265
268
269
            $("#rm_items").click(function(){
270
                return confirmDelete(_("Are you sure you want to remove all items from the course?"));
271
            });
272
266
            $("#delete_course").click(function(){
273
            $("#delete_course").click(function(){
267
                [% SET count = course_reserves.size || 0 %]
274
                [% SET count = course_reserves.size || 0 %]
268
                [% IF count == 1 %]
275
                [% IF count == 1 %]
269
- 

Return to bug 25606