diff --git a/plugin/zoom/lib/ZoomPlugin.php b/plugin/zoom/lib/ZoomPlugin.php index c98b6bded3..ce31c37236 100644 --- a/plugin/zoom/lib/ZoomPlugin.php +++ b/plugin/zoom/lib/ZoomPlugin.php @@ -480,33 +480,37 @@ class ZoomPlugin extends Plugin /** * @param Meeting $meeting - * @param string $returnURL + * @param string $returnURL * - * @return false + * @return bool */ - public function deleteMeeting($meeting, $returnURL) + public function deleteMeeting($meeting, $returnURL): bool { if (null === $meeting) { return false; } - $em = Database::getManager(); - try { - // No need to delete a instant meeting. - if (\Chamilo\PluginBundle\Zoom\API\Meeting::TYPE_INSTANT != $meeting->getMeetingInfoGet()->type) { - $meeting->getMeetingInfoGet()->delete(); - } - - $em->remove($meeting); - $em->flush(); + // No need to delete a instant meeting. + if (\Chamilo\PluginBundle\Zoom\API\Meeting::TYPE_INSTANT == $meeting->getMeetingInfoGet()->type) { + return false; + } - Display::addFlash( - Display::return_message($this->get_lang('MeetingDeleted'), 'confirm') - ); - api_location($returnURL); + try { + $meeting->getMeetingInfoGet()->delete(); } catch (Exception $exception) { $this->handleException($exception); } + + $em = Database::getManager(); + $em->remove($meeting); + $em->flush(); + + Display::addFlash( + Display::return_message($this->get_lang('MeetingDeleted'), 'confirm') + ); + api_location($returnURL); + + return true; } public function deleteWebinar(Webinar $webinar, string $returnURL)