From eba92195b6fef397918eb9b94a7782ecbf3878df Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Thu, 31 Aug 2017 22:02:05 +0000 Subject: [PATCH] Bug 19231: Add number of attached items to confirm message when deleting course To test: 1) Ensure UseCourseReserves is enabled 2) Go to Course Reserves and create 3 new courses 3) Add one item to a course, add two items to another course, and add no items to the third course 4) Delete the course with no items. Confirm the error message shows up. No need to say how many attached items there are here (because there are none). 5) Delete the course with one item. Confirm the error message shows and warns of the one attached item and makes grammatical sense 6) Delete the course with two items. Confirm the error message shows and shows the correct number of attached items and makes grammatical sense 7) Confirm clicking 'Cancel' and 'OK' does what is expected Sponsored-by: Catalyst IT Signed-off-by: Claire Gravely Looks good! Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart --- course_reserves/course-details.pl | 1 + .../prog/en/modules/course_reserves/course-details.tt | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/course_reserves/course-details.pl b/course_reserves/course-details.pl index af1eb62337..a9ffe2c421 100755 --- a/course_reserves/course-details.pl +++ b/course_reserves/course-details.pl @@ -60,6 +60,7 @@ my $course_reserves = GetCourseReserves( $template->param( course => $course, course_reserves => $course_reserves, + count => scalar @$course_reserves, ); output_html_with_http_headers $cgi, $cookie, $template->output; 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 e07cbe538e..1600824827 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 @@ -23,7 +23,13 @@ }); $("#delete_course").click(function(){ - return confirm( _("Are you sure you want to delete this course?") ); + [% IF count == 1 %] + return confirmDelete(_("Are you sure you want to delete this course? There is [% count %] attached item.") ); + [% ELSIF count != 1 && count > 0 %] + return confirmDelete(_("Are you sure you want to delete this course? There are [% count %] attached items.") ); + [% ELSE %] + return confirmDelete(_("Are you sure you want to delete this course?")); + [% END %] }); $(".disabled").tooltip().on("click", function(e){ e.preventDefault(); -- 2.39.5