function getFactura($idFactura) { try { $factura = DAOFactory::getFacturaDAO()->load($idFactura); $hotel = getHotelById($factura->hotelId); $campania = getCampania($hotel->campaniaId); $frs = DAOFactory::getFacturaReservaDAO()->queryByFacturaId($idFactura); $reservas = array(); foreach ($frs as $fr) { $reservas[] = getReserva($fr->reservaId); } $factura->reservas = $reservas; $factura->moneda = getMoneda($factura->monedaId); return $factura; } catch (Exception $e) { var_dump($e); return false; } }
function updateDireccionByHotelId($idHotel, $data = array()) { try { $transaction = new Transaction(); $hotel = getHotelById($idHotel); if ($hotel->direccion) { updateDireccion($hotel->direccion->id, $data); } else { $dir = DAOFactory::getDireccionDAO()->prepare($data); $dir_id = DAOFactory::getDireccionDAO()->insert($dir); $hd = DAOFactory::getHotelDireccionDAO()->prepare(array('hotelId' => $hotel->id, 'direccionId' => $dir_id)); DAOFactory::getHotelDireccionDAO()->insert($hd); } $transaction->commit(); return $idDireccion; } catch (Exception $e) { print_r($e); if ($transaction) { $transaction->rollback(); } return false; } }
<?php $logged = $usuario_core->validateUser(); if ($logged) { $usuario_core->hasAdminAccess('hotel'); $idiomas = getAllIdiomas(); $monedas = getAllMonedas(); $destinos = getAllDestinos(); $condiciones = getCondicionesByDistribuidor($usuario_core->getUsuario()->id); $smarty->assign('logged_user', $usuario_core->getUsuario()); if (isset($_GET["id"])) { getWordsInBlacklistToRemove($_GET["id"]); getWordsInBlacklistToRemoveResult($_GET["id"]); $acceso = userCanAccessHotel($_GET["id"], $usuario_core->getUsuario()->id); if ($acceso) { $hotel = getHotelById($_GET["id"], false); if ($hotel->campaniaId) { $hotel->campania = getCampania($hotel->campaniaId); $hotel->dominioCampania = $hotel->campania->subdominio; } if ($hotel->idiomas && count($hotel->idiomas)) { foreach ($hotel->idiomas as $i) { foreach ($idiomas as $idioma) { if ($idioma->id == $i->id) { $idioma->selected = true; } } } } if ($hotel->monedas && count($hotel->monedas)) { foreach ($hotel->monedas as $m) {
$hoteles[$p]['acciones'] = $smarty->fetch('admin/hotel/acciones.tpl'); } if (isset($_POST['table'])) { $_SESSION['lastHoteles'] = $hoteles; $result = array("iTotalRecords" => $cont, "iTotalDisplayRecords" => $cont, 'aaData' => $hoteles); } else { $smarty->assign('hoteles', $hs); $html = $smarty->fetch('admin/hotel/filtros.tpl'); $result['html'] = $html; $result['msg'] = 'ok'; } } else { if (strcmp($action, 'urlValidacion') == 0) { if (isset($_POST['id'])) { $id = $_POST['id']; $hotel_v = getHotelById($id); $login_code = getLoginCodeByHotelId($id); $nombre = $hotel_v->nombre; $body = "\n Hotel: {$nombre} <br>\n Para validar sus reservas haga click en el siguiente link o copie y pegue la dirección en su navegador:<br>\n <a href='{$vikahotel_url}/validar?login_code={$login_code}'>{$base_url}/validar?login_code={$login_code}</a><br>\n <i>Enviado desde " . $smarty->getConfigVariable('sistema_nombre') . "</i>\n "; try { $mail = new Core_Mailer(); $mail->send_email($hotel_v->distribuidor->emailReservas, 'Url de validación de reservas de ' . $nombre, $body); } catch (Exception $e) { print_r($e); } $result = array('msg' => 'ok', 'data' => 'Se le ha enviado un email al hotel con la url de validación de reservas'); } } else { if (strcmp($action, 'updatefields') == 0) { if (isset($_POST['edit'])) { $edit = $_POST['edit'];
<?php if (isset($_REQUEST['login_code'])) { $login_code = $_REQUEST['login_code']; $hotelId = getHotelIdByLoginCode($login_code); if ($hotelId) { $moneda = 'EUR'; $reservas = getReservasActualesByHotel($hotelId, $moneda); $hotel = getHotelById($hotelId); $smarty->assign('hotel', $hotel); $smarty->assign('reservas', $reservas); $smarty->display('admin/validar.tpl'); } else { header('Location:' . $base_url . '/admin-login'); } } else { header('Location:' . $base_url . '/admin-login'); }
<?php $logged = $usuario_core->validateUser(); if ($logged) { $usuario_core->hasAdminAccess('reservas'); $smarty->assign('estadosReserva', array('Pendiente', 'Cancelada por el cliente', 'Cancelada por el administrador', 'Aprobada', 'Confirmada', 'CheckOut', 'Stayed', 'No show')); if (isset($_GET['id'])) { $hotel = getHotelById($_GET['id']); $smarty->assign('hotel', $hotel); $smarty->assign('edit', 1); } $smarty->display('admin/reserva/lista.tpl'); }
<?php $reserva = getReserva(decryptId($_GET['id'])); if (!$reserva) { header('Location:' . $base_url); } else { $reserva->id = $_GET['id']; $hotel = getHotelById($reserva->hotelId); $smarty->assign('hotel', $hotel); if ($reserva->alojamiento && count($reserva->alojamiento)) { $apartamento = $reserva->alojamiento[0]; } else { $apartamento = NULL; } $smarty->assign('id', $_GET['id']); $smarty->assign('usuario', $usuario); $smarty->assign('apartamento', $apartamento); $smarty->assign('cart', $reserva->cart); $usuario = getUsuario($reserva->usuarioId); $smarty->assign('usuario', $usuario); $smarty->assign('reserva', $reserva); $inicio = $apartamento->inicio; $salida = $apartamento->final; $time_inicio = strtotime($inicio); $time_salida = strtotime($salida); $noches = ceil(($time_salida - $time_inicio) / (24 * 60 * 60)); $inicio = date('l, d-F-Y', strtotime($inicio)); $salida = date('l, d-F-Y', strtotime($salida)); $smarty->assign('inicio', $inicio); $smarty->assign('salida', $salida); $smarty->assign('noches', $noches);
<?php if ($hotel) { require_once 'Logic/paises.php'; if (isset($_POST['cartID'])) { /** registrar reserva **/ $invalid = false; $cartId = $_POST['cartID']; $cart = getCart($cartId); $apartamento = $cart->apartamentoObj; $excursiones = $cart->excursionesArray; $hotel = getHotelById($cart->hotelId); $offline = $hotel->tipoReserva == 'offline'; if ($offline) { if ($excursiones) { if (is_array($excursiones) && count($excursiones)) { foreach ($excursiones as $excur) { if ($excur->forma_cobro == 'online') { $offline = false; break; } } } } } if ($offline) { if (isset($_POST["recaptcha_response_field"])) { require_once 'Lib/recaptcha/recaptchalib.php'; $resp = recaptcha_check_answer($reprivatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { $smarty->assign('error_msg', 'Captcha incorrecto, por favor, escriba de nuevo la frase de la imagen, o vuelva a recargarla.');
if (isset($_GET["id"])) { $widget = getWidget($_GET["id"]); $usuario_id = $usuario->id; $afiliado = getAfiliadoByIdUsuario($usuario_id); $afiliado_id = $afiliado->id; $configuracion = $widget->configuracion; $smarty->assign("configuracion", (object) $configuracion); $afiliado_id_encriptado = urlencode(Encrypter::encrypt($afiliado_id, 'afiliado')); $smarty->assign("code", $afiliado_id_encriptado); $enlace = $base_url . '?a=' . $afiliado_id_encriptado; $smarty->assign("enlace", $enlace); if ($widget->tipo == 'banner') { $rgb = Core_Util_General::hex2rgb($configuracion['backgroundBody']); $images = getAllHotelImages($configuracion['hotelId']); $smarty->assign('image', array_pop($images)); $hotel_h = getHotelById($configuracion['hotelId']); $smarty->assign("hotel_h", $hotel_h); $destino = getDestino($hotel->destinoId); $smarty->assign("destino", $destino); $smarty->assign("rgb", implode(",", $rgb)); $enlace = 'http://' . $hotel_h->dominioCampania . '?a=' . $afiliado_id_encriptado; $smarty->assign("enlace", $enlace); $widget_html = $smarty->fetch('admin/widget/banner.tpl'); } else { $destinos = getAfiliadoDestinos($afiliado_id); $smarty->assign("destinos", $destinos); $widget_html = $smarty->fetch('admin/widget/widget.tpl'); } $smarty->assign('widget', $widget_html); } $smarty->display('admin/widget/ver.tpl');
function getParametrosVikaByHotelId($id) { try { $hotel = getHotelById($id); if ($hotel->config && $hotel->config->sincronizacionVika) { $distribuidor = array('email' => $hotel->config->vikaEmail, 'password' => $hotel->config->vikaPassword, 'empresaId' => $hotel->config->vikaEmpresa, 'canal' => $hotel->config->vikaCanal); return $distribuidor; } return false; } catch (Exception $e) { var_dump($e); return false; } }
<?php include 'Lib/ganon.php'; ob_implicit_flush(true); ini_set('memory_limit', '2048M'); $result = array('msg' => 'error', 'data' => 'Seleccione el hotel'); if (isset($_REQUEST['id'])) { $hotel_id = $_REQUEST['id']; $hotel = getHotelById($hotel_id); $opciones = array('http' => array('method' => "GET", 'header' => "Accept-language: es\r\n")); set_time_limit(9999999999); $hotel_url = $hotel->url; if (!isset($_REQUEST['imagenes'])) { if ($hotel) { deleteHotelServicios($hotel->id); //deleteHotelImages($hotel->id); } $codigos = array('es', 'en', 'it', 'de', 'fr', 'ru', 'pt'); $blacklist = getWordsInBlacklist(); if ($hotel->idiomas) { foreach ($hotel->idiomas as $idioma) { if (!in_array($idioma->codigo, $codigos)) { array_push($codigos, $idioma->codigo); } } } $descripciones_array = array(); $descripciones_largas_array = array(); $nombreHotel = ''; $servicios_array = array(); $condiciones_array = array();
<?php $logged = $usuario_core->validateUser(); if ($logged) { $usuario_core->hasAdminAccess('hotel'); $idiomas = getAllIdiomas(); $monedas = getAllMonedas(); if (isset($_GET["id"])) { $hotel = getHotelById($_GET["id"]); if ($hotel->campaniaId) { $hotel->campania = getCampania($hotel->campaniaId); $hotel->dominioCampania = $hotel->campania->subdominio; } if ($hotel->idiomas && count($hotel->idiomas)) { foreach ($hotel->idiomas as $i) { foreach ($idiomas as $idioma) { if ($idioma->id == $i->id) { $idioma->selected = true; } } } } if ($hotel->monedas && count($hotel->monedas)) { foreach ($hotel->monedas as $m) { foreach ($monedas as $moneda) { if ($moneda->id == $m->id) { $moneda->selected = true; } } } }
<?php $logged = $usuario_core->validateUser(); if ($logged) { if (isset($_GET['id'])) { $factura = getFactura($_GET['id']); $hotel = getHotelById($factura->hotelId); if ($hotel && $factura) { $moneda = 'EUR'; $reservas = $factura->reservas; if (count($reservas)) { $hotel->empresa = getEmpresaById($hotel->empresaId); $totalFacturado = $factura->total; $totalComisiones = $factura->comision; $smarty->assign('factura', $factura); $smarty->assign('hotel', $hotel); $smarty->assign('reservas', $reservas); $smarty->assign('totalFacturado', $totalFacturado); $smarty->assign('totalComisiones', $totalComisiones); $smarty->assign('backUrl', $base_url . '/admin-factura-lista'); $smarty->display('admin/factura1.tpl'); } else { // header('Location:' . $base_url . '/admin-login'); } } else { // header('Location:' . $base_url . '/admin-login'); } } else { //header('Location:' . $base_url . '/admin-login'); } }
} //$hoteles = getHotelesCampaniasActivas($term, ((isset($_POST['paginar_otros'])) ? 0 : $start), 10, $hotelId, $_POST); $hoteles = getHotelesCampaniasActivas($term, isset($_POST['paginar_otros']) ? 0 : $start, 9, $hotelId, $_POST); if (count($hoteles) == 4) { foreach ($hoteles as $hotel) { if ($hotel['nombre'] == $term && $hotel['destino']['nombre']) { $un_hotel = $hotel; $smarty->assign('un_hotel', $un_hotel); break; } } } if (isset($un_hotel)) { $hoteles = getHotelesCampaniasActivas($un_hotel['destino']['nombre'], $start, 10, $un_hotel['id'], $_POST); } $smarty->assign('hoteles', $hoteles); $html = $smarty->fetch('admin/hoteles_filtros.tpl'); $result = array('msg' => 'ok', 'html' => $html, 'hoteles' => $hoteles); if (!isset($_POST['paginar_otros']) && !$start) { $locations = getLocationsHotelesCampaniasActivas($term); $result['locations'] = $locations; } } if (strcmp($action, 'informacionMapa') == 0) { $id = $_POST['id']; $hotel = getHotelById($id); $smarty->assign('hotel', $hotel); $html = $smarty->fetch('admin/hotel_info.tpl'); $result = array('msg' => 'ok', 'html' => $html); } echo json_encode($result);
function enviarEmailNuevaReserva($idReserva) { try { global $smarty; $reservacion = getReserva($idReserva); $reservacion->id = encryptId($idReserva); $smarty->assign('reserva', $reservacion); $cart = $reservacion->cart; $data_user = array('nombre' => $reservacion->usuario->nombre, 'apellido' => $reservacion->usuario->apellido, 'email' => $reservacion->usuario->email, 'telefono' => $reservacion->usuario->telefono); $smarty->assign('usuario', $data_user); $hotel = getHotelById($reservacion->hotelId); $subject = 'New Booking ' . $hotel->nombres->es . ' [' . $reservacion->localizador . ']'; $smarty->assign('entrada', $reservacion->alojamiento[0]->inicio); $smarty->assign('salida', $reservacion->alojamiento[0]->final); $noches = ceil((strtotime($reservacion->alojamiento[0]->final) - strtotime($reservacion->alojamiento[0]->inicio)) / (24 * 60 * 60)); $smarty->assign('noches', $noches); $pais = getPais($reservacion->usuario->paisId); $smarty->assign('pais', $pais->nombre); $smarty->assign('base_url', $cart->url); $smarty->assign('currency', $moneda); $campania = false; $smarty->assign('hotel', $hotel); if ($hotel && $hotel->campaniaId) { $campania = getCampania($hotel->campaniaId); $smarty->assign('campania', $campania); } $body = $smarty->fetch('confirmacionEmail_nodesign.tpl'); $cobroAnticipado = 0; foreach ($reservacion->productos as $producto) { $cobroAnticipado += $producto->importeInicial; } //generar factura if ($cobroAnticipado && $reservacion->estado == 'Aprobada') { $factura = generarFactura($reservacion, $hotel); } else { $factura = 0; } $mail = new Core_Mailer(); /* enviando email al usuario */ $enviado = $mail->send_email($data_user['email'], $subject, $body, $factura); if ($factura) { //TODO: eliminar pdf $mail = new Core_Mailer(); @unlink($factura); } $emails = $hotel->emailReservas; $emails = explode(',', $emails); $reserva_url = getReservaUrl($idReserva); $smarty->assign('reserva_url', $reserva_url); $body = $smarty->fetch('reservaEmail_nodesign.tpl'); if ($campania) { $subject = 'New Booking ' . $reservacion->localizador . ' [contrato ' . $campania->localizador . ']'; } else { $subject = 'New Booking ' . $hotel->nombres->es . ' ' . $reservacion->localizador; } $emailDistribuidor = explode(',', $hotel->distribuidor->emailReservas); if ($emailDistribuidor && count($emailDistribuidor)) { foreach ($emailDistribuidor as $email) { if (strlen(trim($email)) > 0) { $enviado = $mail->send_email($email, $subject, $body); } } } if ($reservacion->estado == 'Aprobada') { //cuando no es onrequest foreach ($emails as $email) { if (strlen(trim($email)) > 0) { $enviado = $mail->send_email($email, $subject, $body); } } if ($reservacion->extras) { foreach ($reservacion->extras as $excursion) { if ($excursion->emails && explode(',', $excursion->emails)) { $smarty->assign('excursion', $excursion); $body = $smarty->fetch('confirmacionExcursion_nodesign.tpl'); $emails = explode(',', $excursion->emails); $subject = 'New Booking ' . $excursion->localizador; foreach ($emails as $email) { if (strlen(trim($email))) { $mail->send_email($email, $subject, $body); } } } } } } } catch (Exception $ex) { print_r($ex); } }
$afiliado_id = $_POST['afiliado_id']; $afiliado_id_encriptado = urlencode(Encrypter::encrypt($afiliado_id, 'afiliado')); $smarty->assign("code", $afiliado_id_encriptado); $result['msg'] = 'ok'; $enlace = $base_url . '?a=' . $afiliado_id_encriptado; $smarty->assign("enlace", $enlace); if ($_POST['tipo'] == "completo") { $destinos = getAfiliadoDestinos($afiliado_id); $smarty->assign("destinos", $destinos); $widget = $smarty->fetch('admin/widget/widget.tpl'); } else { if ($_POST['tipo'] == "banner") { $rgb = Core_Util_General::hex2rgb($configuracion['backgroundBody']); $images = getAllHotelImages($_POST['hotel']); $smarty->assign('image', array_pop($images)); $hotel_h = getHotelById($_POST['hotel']); $enlace = 'http://' . $hotel_h->dominioCampania . '?a=' . $afiliado_id_encriptado; $smarty->assign("enlace", $enlace); $smarty->assign("hotel_h", $hotel_h); $destino = getDestino($hotel->destinoId); $smarty->assign("destino", $destino); $smarty->assign("rgb", implode(",", $rgb)); $widget = $smarty->fetch('admin/widget/banner.tpl'); } } $result['data'] = array('html' => $widget, 'msg' => 'Se guardaron los cambios correctamente', 'enlace' => $enlace); } } else { if (strcmp($action, 'insert') == 0) { if (isset($_POST['configuracion'])) { $configuracion = $_POST['configuracion'];
} else { $result['data'] = 'La clave no es válida'; } } else { $result['data'] = 'La clave no es válida'; } } if (strcmp($action, 'search') == 0) { $term = $_POST['term']; $usuario = $usuario_core->getUsuario(); $elementos = busquedaReservas($term, $usuario->id); $result['msg'] = 'ok'; $result['lista'] = $elementos; } if (strcmp($action, 'insert') == 0) { $hotel = getHotelById($_POST['hotelId']); $data_user = array('nombre' => NULL, 'apellido' => NULL, 'email' => NULL, 'telefono' => NULL, 'paisId' => NULL); $data_reserva = array('urlOrigen' => 'admin vikahotel', 'monedaId' => $hotel->monedaId, 'recibirFactura' => 0, 'adultos' => 0, 'ninios' => 0); foreach ($data_reserva as $k => $val) { if (isset($_POST[$k])) { $data_reserva[$k] = $_POST[$k]; } } foreach ($data_user as $k => $val) { if (isset($_POST[$k])) { $data_user[$k] = $_POST[$k]; } } $data_pago = array('formaPago' => 'tarjeta', 'tipo' => 'pago', 'tarjetaTipo' => NULL, 'tarjetaNumero' => NULL, 'titular' => NULL, 'caducidadMes' => NULL, 'caducidadAnio' => NULL, 'cvv' => NULL, 'importe' => 0, 'op' => NULL); foreach ($data_pago as $k => $val) { if (isset($_POST[$k])) {
$subject = 'Cancelación de reserva'; $smarty->assign('usuario', $reservacion->usuario); $apartamento = $reservacion->alojamiento[0]; $smarty->assign('reserva', $reservacion); $smarty->assign('apartamento', $apartamento); //$smarty->assign('precioTotal', $moneda . ' ' . number_format($precio, 2, ",", "")); $smarty->assign('cantidad', $_POST['cantidad']); $smarty->assign('excursiones', $reservacion->extras); $smarty->assign('entrada', $apartamento->inicio); $smarty->assign('salida', $apartamento->final); $pais = getPais($data_user['paisId']); $smarty->assign('pais', $pais->nombre); $noches = ceil((strtotime($apartamento->final) - strtotime($apartamento->inicio)) / (24 * 60 * 60)); $smarty->assign('noches', $noches); $campania = false; $hotel = getHotelById($reservacion->hotelId); if ($hotel && $hotel->campaniaId) { $campania = getCampania($hotel->campaniaId); $smarty->assign('campania', $campania); } $smarty->assign('hotel', $hotel); //nuevo diseño //$body = $smarty->fetch('cancelacionEmail_nodesign.tpl'); $body = $smarty->fetch('cancelacionEmail.tpl'); $mail = new Core_Mailer(); $enviado = $mail->send_email($reservacion->usuario->email, $subject, $body); $emails = $hotel->emailReservas; $emails = explode(',', $emails); $emails_distribuidor = explode(',', $hotel->distribuidor->emailReservas); $emails = array_merge($emails, $emails_distribuidor); $body = $smarty->fetch('reservaCancelacionEmail_nodesign.tpl');