protected function updateBooking() { global $ilTabs; $ilTabs->activateTab('content'); $this->ctrl->setParameter($this, 'bookid', (int) $_REQUEST['bookid']); try { $booking_service = new ilViteroBookingSoapConnector(); $booking = $booking_service->getBookingById((int) $_REQUEST['bookid']); } catch (ilViteroConnectorException $e) { ilUtil::sendFailure($e->getMessage(), true); $this->ctrl->redirect($this, 'showContent'); } $form = $this->initUpdateBookingForm($booking); if (!$form->checkInput()) { $form->setValuesByPost(); ilUtil::sendFailure($this->lng->txt('err_check_input')); $GLOBALS['tpl']->setContent($form->getHTML()); return false; } $room = new ilViteroRoom(); $room->setBookingId($booking->booking->bookingid); $room->setBufferBefore((int) $_POST['buffer_before']); $room->setBufferAfter((int) $_POST['buffer_after']); // Set end date for cafe room if ($booking->booking->cafe) { $start = $form->getItemByPostVar('cstart')->getDate(); $end = clone $start; $end->increment(IL_CAL_DAY, 1); $room->setStart($start); $room->setEnd($end); } else { $start = $form->getItemByPostVar('roomduration')->getStart(); $end = $form->getItemByPostVar('roomduration')->getEnd(); $room->setStart($start); $room->setEnd($end); } try { $con = new ilViteroBookingSoapConnector(); $con->updateBooking($room, $this->object->getVGroupId()); ilUtil::sendSuccess($GLOBALS['lng']->txt('settings_saved'), true); $this->ctrl->redirect($this, 'showContent'); return true; } catch (ilViteroConnectorException $e) { ilUtil::sendFailure($e->getViteroMessage(), true); $form->setValuesByPost(); $GLOBALS['tpl']->setContent($form->getHTML()); } }