Bug 19231: No need to pass the size to the template
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 27 Oct 2017 18:29:22 +0000 (15:29 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 27 Oct 2017 19:05:55 +0000 (16:05 -0300)
We have the array already, we just need to call .size on it

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
course_reserves/course-details.pl
koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt

index a9ffe2c..af1eb62 100755 (executable)
@@ -60,7 +60,6 @@ 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;
index 1600824..29f0132 100644 (file)
         });
 
         $("#delete_course").click(function(){
+            [% SET count = course_reserves.size %]
             [% IF count == 1 %]
                 return confirmDelete(_("Are you sure you want to delete this course? There is [% count %] attached item.") );
-            [% ELSIF count != 1 && count > 0 %]
+            [% ELSIF count > 1 %]
                 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?"));