function addExtraOptions() { //$log = Logger::getInstance(JPATH_COMPONENT."/logs/site-log-".date("d-m-Y").'.log',1); //$log->LogDebug("addExtraOptions"); $reservedItems = JRequest::getVar("reservedItems"); $hotelId = JRequest::getVar("hotel_id"); if (!empty($reservedItems)) { UserDataService::updateRooms($hotelId, $reservedItems); } $data = JRequest::get("post"); $current = $data["current"]; $extraOptions = array(); if (isset($data["extraOptionIds"])) { foreach ($data["extraOptionIds"] as $key => $value) { $extraOption = explode("|", $value); if ($extraOption[5] > 0 || $extraOption[6] > 0) { continue; } if (isset($data["extra-option-days-" . $extraOption[3]])) { $extraOption[6] = $data["extra-option-days-" . $extraOption[3]]; } if (isset($data["extra-option-persons-" . $extraOption[3]])) { $extraOption[5] = $data["extra-option-persons-" . $extraOption[3]]; } $extraOptions[$key] = implode("|", $extraOption); } } if (count($extraOptions) > 0) { UserDataService::addExtraOptions($extraOptions); } $userData = UserDataService::getUserData(); if (count($userData->reservedItems) < $userData->rooms) { $extra = implode("#", $extraOptions); $extraParam = ""; if (!empty($extra)) { $extraParam = "&extraOptions=" . $extra; } $this->setRedirect(JRoute::_('index.php?option=com_jhotelreservation&task=hotel.showHotel&hotel_id=' . $hotelId . "&reservedItems=" . $reservedItems . $extraParam, false)); } else { $this->setRedirect(JRoute::_('index.php?option=com_jhotelreservation&view=guestDetails&hotel_id=' . $hotelId . "&reservedItems=" . $reservedItems, false)); } //$log->LogDebug("End addExtraOptions"); }
function addExtraOptions() { //$log = Logger::getInstance(JPATH_COMPONENT."/logs/site-log-".date("d-m-Y").'.log',1); //$log->LogDebug("addExtraOptions"); $reservedItems = JRequest::getVar("reservedItems"); $hotelId = JRequest::getVar("hotel_id"); if (!empty($reservedItems)) { UserDataService::updateRooms($hotelId, $reservedItems); } $data = JRequest::get("post"); $current = $data["current"]; $extraOptions = array(); if (isset($data["extraOptionIds"])) { foreach ($data["extraOptionIds"] as $key => $value) { $extraOption = explode("|", $value); if ($extraOption[5] > 0 || $extraOption[6] > 0 || $extraOption[7] > 0) { continue; } if (isset($data["extra-option-days-" . $extraOption[3]])) { $extraOption[6] = $data["extra-option-days-" . $extraOption[3]]; } if (isset($data["extra-option-persons-" . $extraOption[3]])) { $extraOption[5] = $data["extra-option-persons-" . $extraOption[3]]; } if (isset($data["niños-extras-" . $extraOption[3]])) { $extraOption[7] = $data["niños-extras-" . $extraOption[3]]; } $extraOptions[$key] = implode("|", $extraOption); } } //Código agregado para capturar del metodo POST el itinerariod de viajes y asignarlo a una SESION PHP session_start(); $_SESSION["itinerario"] = $data["extra-option-itinerary"]; $_SESSION["niños_extras"] = $extraOptions; /*echo "<pre>"; var_dump($extraOptions); echo "</pre>"; die;*/ if (count($extraOptions) > 0) { UserDataService::addExtraOptions($extraOptions); } $userData = UserDataService::getUserData(); if (count($userData->reservedItems) < $userData->rooms) { $extra = implode("#", $extraOptions); $extraParam = ""; if (!empty($extra)) { $extraParam = "&extraOptions=" . $extra; } $this->setRedirect(JRoute::_('index.php?option=com_jhotelreservation&task=hotel.showHotel&hotel_id=' . $hotelId . "&reservedItems=" . $reservedItems . $extraParam, false)); } else { $this->setRedirect(JRoute::_('index.php?option=com_jhotelreservation&view=guestDetails&hotel_id=' . $hotelId . "&reservedItems=" . $reservedItems, false)); } //$log->LogDebug("End addExtraOptions"); }