Add exception to hook - refs BT#9438

1.10.x
Imanol Losada 11 years ago
parent 8e5286087c
commit 48db79691b
  1. 9
      main/auth/courses_controller.php
  2. 3
      plugin/resubscription/src/HookResubscription.php

@ -502,10 +502,13 @@ class CoursesController
$hook = HookResubscribe::create();
if (!empty($hook)) {
$hook->setEventData(array(
'session_id' => intval($sessionData),
'result' => &$result
'session_id' => intval($sessionData)
));
$hook->notifyResubscribe(HOOK_EVENT_TYPE_PRE);
try {
$hook->notifyResubscribe(HOOK_EVENT_TYPE_PRE);
} catch (Exception $exception) {
$result = $exception->getMessage();
}
}
return $result;

@ -86,10 +86,9 @@ class HookResubscription extends HookObserver implements HookResubscribeObserver
if (isset($userSessionCourses[$currentSessionCourse['course_code']])) {
$endDate = $userSessionCourses[$currentSessionCourse['course_code']];
$resubscriptionDate = gmdate('Y-m-d', strtotime($endDate." +$resubscriptionLimit year"));
$icon = Display::return_icon('students.gif', get_lang('Student'));
$canResubscribeFrom = sprintf(get_plugin_lang('CanResubscribeFromX', 'resubscription'), $resubscriptionDate);
$data['result'] = Display::label($icon . ' ' . $canResubscribeFrom, "info");
throw new Exception(Display::label($icon . ' ' . $canResubscribeFrom, "info"));
}
}
}

Loading…
Cancel
Save