Add exception to hook - refs BT#9438

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

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

@ -86,10 +86,9 @@ class HookResubscription extends HookObserver implements HookResubscribeObserver
if (isset($userSessionCourses[$currentSessionCourse['course_code']])) { if (isset($userSessionCourses[$currentSessionCourse['course_code']])) {
$endDate = $userSessionCourses[$currentSessionCourse['course_code']]; $endDate = $userSessionCourses[$currentSessionCourse['course_code']];
$resubscriptionDate = gmdate('Y-m-d', strtotime($endDate." +$resubscriptionLimit year")); $resubscriptionDate = gmdate('Y-m-d', strtotime($endDate." +$resubscriptionLimit year"));
$icon = Display::return_icon('students.gif', get_lang('Student')); $icon = Display::return_icon('students.gif', get_lang('Student'));
$canResubscribeFrom = sprintf(get_plugin_lang('CanResubscribeFromX', 'resubscription'), $resubscriptionDate); $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