MDL-61249 enrol_manual: Fix end date calculation
authorSara Arjona <sara@moodle.com>
Fri, 2 Feb 2018 13:53:56 +0000 (14:53 +0100)
committerSara Arjona <sara@moodle.com>
Fri, 23 Feb 2018 07:19:49 +0000 (08:19 +0100)
This patch has been given by Bruno Malaval.

enrol/manual/ajax.php

index 5f21c65..3f182fd 100644 (file)
@@ -91,7 +91,7 @@ switch ($action) {
         }
 
         $roleid = optional_param('roletoassign', null, PARAM_INT);
-        $duration = optional_param('duration', 0, PARAM_FLOAT);
+        $duration = optional_param('duration', 0, PARAM_INT);
         $startdate = optional_param('startdate', 0, PARAM_INT);
         $recovergrades = optional_param('recovergrades', 0, PARAM_INT);
 
@@ -125,7 +125,7 @@ switch ($action) {
         if ($duration <= 0) {
             $timeend = 0;
         } else {
-            $timeend = $timestart + intval($duration*24*60*60);
+            $timeend = $timestart + $duration;
         }
 
         $instances = $manager->get_enrolment_instances();