From f15f970d90ae5a0f02ee794dde1661c4673146dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georg=20Mai=C3=9Fer?= Date: Fri, 6 Dec 2024 09:42:20 +0100 Subject: [PATCH] Bugfix: Wrong class instantiation --- classes/bo_availability/bo_info.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/classes/bo_availability/bo_info.php b/classes/bo_availability/bo_info.php index 7f5867b0d..cc4953893 100644 --- a/classes/bo_availability/bo_info.php +++ b/classes/bo_availability/bo_info.php @@ -697,7 +697,11 @@ public static function load_pre_booking_page(int $optionid, int $pagenumber, int $template = 'mod_booking/bookingpage/header'; // We get the condition for the right page. - $condition = new $condition(); + if (method_exists($condition, 'instance')) { + $condition = $condition::instance(); + } else { + $condition = new $condition(); + } $object = $condition->render_page($optionid, $userid ?? 0); // Now we introduce the header at the first place. @@ -781,8 +785,11 @@ public static function render_conditionmessage( if ($shownotificationlist && $optionid && $usertobuyfor->id) { $bookinganswer = singleton_service::get_instance_of_booking_answers($settings); $bookinginformation = $bookinganswer->return_all_booking_information($usertobuyfor->id); - $data = new button_notifyme($usertobuyfor->id, $optionid, - $bookinginformation['notbooked']['onnotifylist']); + $data = new button_notifyme( + $usertobuyfor->id, + $optionid, + $bookinginformation['notbooked']['onnotifylist'] + ); $renderedstring .= $output->render_notifyme_button($data); }