[Koha-bugs] [Bug 19230] Warn when deleting a course in course reserves

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Dec 19 16:26:54 CET 2017


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19230

Jonathan Druart <jonathan.druart at bugs.koha-community.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jonathan.druart at bugs.koha-c
                   |                            |ommunity.org

--- Comment #3 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
I think it would be better to assign a $course_id variable and reuse it.
Something like:

modified: course_reserves/mod_course.pl
@ mod_course.pl:41 @ my ( $template, $loggedinuser, $cookie ) =
get_template_and_user(
 );

 my $action = $cgi->param('action') || '';
+my $course_id = $cgi->param('course_id');

 if ( $action eq 'del' ) {
-    DelCourse( $cgi->param('course_id') );
+    DelCourse( $course_id );
     print $cgi->redirect("/cgi-bin/koha/course_reserves/course-reserves.pl");
 } else {
     my %params;

-    $params{'course_id'} = $cgi->param('course_id')
-      if ( $cgi->param('course_id') );
+    $params{'course_id'} = $course_id;
     $params{'department'}     = $cgi->param('department');
     $params{'course_number'}  = $cgi->param('course_number');
     $params{'section'}        = $cgi->param('section');
@ mod_course.pl:60 @ if ( $action eq 'del' ) {
     $params{'students_count'} = $cgi->param('students_count');
     $params{'enabled'}        = ( $cgi->param('enabled') eq 'on' ) ? 'yes' :
'no';

-    my $course_id = ModCourse(%params);
+    my $new_course_id = ModCourse(%params);

     my @instructors = $cgi->multi_param('instructors');
     ModCourseInstructors(
         mode        => 'replace',
         cardnumbers => \@instructors,
-        course_id   => $course_id
+        course_id   => $new_course_id
     );
-    print
$cgi->redirect("/cgi-bin/koha/course_reserves/course-details.pl?course_id=$course_id");
+    print
$cgi->redirect("/cgi-bin/koha/course_reserves/course-details.pl?course_id=$new_course_id");
 }

Would it make more sense?

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list