/**
  * @param $post
  * @return ExtraService
  * @throws Exception
  */
 public function getExtraService($post)
 {
     $customData = $this->getCustomData($post);
     $serviceProvider = $customData['service_provider'];
     $serviceName = $customData['service_name'];
     $extraService = new ExtraService();
     $extraService->loadByServiceName($serviceProvider, $serviceName);
     return $extraService;
 }
 public static function fetchFromDb($id)
 {
     ExtraService::$staticErrors = array();
     if (!is_numeric($id)) {
         array_push(ExtraService::$staticErrors, "Id : {$id} is not numeric");
         return null;
     }
     $sql = "SELECT * FROM bsi_extra_services WHERE id = {$id}";
     $query = mysql_query($sql);
     if (!$query) {
         global $logger;
         $logger->LogFatal("Error executing query: {$sql}");
         $logger->LogFatal("Database error: " . mysql_errno() . ". Message: " . mysql_error());
         die("Error: " . mysql_error());
     }
     if ($row = mysql_fetch_assoc($query)) {
         $extraService = ExtraService::fetchFromParameters($row);
         if ($extraService == null) {
             return null;
         }
         return $extraService;
     } else {
         array_push(ExtraService::$staticErrors, "No extra service with Id : {$id} exists");
         return null;
     }
 }
 public function fetchExtraServices($params)
 {
     $this->extraServices = array();
     if (isset($params['extraServices'])) {
         $extraServices = $params['extraServices'];
         foreach ($extraServices as $serviceId => $quantity) {
             if ($quantity > 0) {
                 $extraService = ExtraService::fetchFromDb($serviceId);
                 if ($extraService != null) {
                     $extraServiceDetails = array();
                     $extraServiceDetails[0] = $extraService;
                     $extraServiceDetails[1] = $quantity;
                     $extraServiceDetails[2] = floatval($extraService) * intval($quantity);
                     $this->extraServices[] = $extraServiceDetails;
                 }
             }
         }
     }
 }
示例#4
0
    $logger->LogError("Session object could not be found ...");
    header("Location: booking-failure.php?error_code=9");
}
// Get booking details from session
$bookingDetails = unserialize($_SESSION['bookingDetails']);
// Get selected extra bed
if (isset($_POST['extraBed']) && is_numeric($_POST['extraBed']) && intval($_POST['extraBed']) > 0) {
    $logger->LogInfo("Extra bed was selected!");
    $bookingDetails->extraBedRequested = true;
}
// Get selected services
if (isset($_POST['extraServices'])) {
    $logger->LogInfo("Extra services were selected!");
    $bookingDetails->extraServices = array();
    foreach ($_POST['extraServices'] as $serviceId => $quantity) {
        $extraService = ExtraService::fetchFromDb(intval($serviceId));
        if ($extraService == null) {
            $logger->LogError("No extra service could be found for id: " . intval($serviceId));
            $_SESSION['errors'] = array(0 => BOOKING_FAILURE_INVALID_REQUEST);
            header("Location: booking-failure.php");
        }
        if (intval($quantity) > 0) {
            $logger->LogInfo("Extra service " . $extraService->getName($language_selected) . " selected for quantity: " . intval($quantity));
            $extraServiceDetails = array(0 => $extraService, 1 => $quantity, 2 => floatval($extraService->price * $quantity));
            $bookingDetails->extraServices[] = $extraServiceDetails;
        } else {
            $logger->LogWarn("Extra service has a quntity of 0. Skipping!");
        }
    }
}
// Calculate price details
include "../includes/SystemConfiguration.class.php";
global $logger;
$extraService = new ExtraService();
$errors = array();
// If we have id, then we are trying to edit
if (isset($_POST['SBMT_REG'])) {
    $extraService = ExtraService::fetchFromParameters($_POST);
    if (!$extraService->save()) {
        $errors = $extraService->errors;
    } else {
        header("Location: extra_services_list.php");
    }
} else {
    if (isset($_GET['id']) && is_numeric($_GET['id'])) {
        $id = $_GET['id'];
        $extraService = ExtraService::fetchFromDb($id);
        if ($extraService == null) {
            $logger->LogError("Invalid request. No extra service with id: {$id} exists.");
            $errors[] = "Invalid request. No extra service with id: {$id} exists.";
        }
    }
}
include "header.php";
?>



</td>
</tr>
<tr>
	<td valign="top" align="left" width="100%">
示例#6
0
	                                    	</tr>
	                                    <?php 
if ($bookingDetails->room->hasExtraBed) {
    $bedPrice = $bookingDetails->room->getBedPrice($bookingDetails->searchCriteria->checkInDate, $bookingDetails->searchCriteria->checkOutDate);
    echo '<tr>' . "\n";
    echo '	<td style="background: url(\'images/light_line.png\') bottom left repeat-x; padding: 4px 10px 5px 0px; /* vertical-align: top;*/ text-align: left;">' . BOOKING_SERVICES_EXTRA_BED . '</td>' . "\n";
    echo '	<td style="background: url(\'images/light_line.png\') bottom left repeat-x; padding: 4px 10px 5px 0px; /* vertical-align: top;*/ text-align: left;">' . $systemConfiguration->formatCurrency($bedPrice) . ' ' . BOOKING_SERVICES_PER_STAY . '</td>' . "\n";
    echo '	<td style="background: url(\'images/light_line.png\') bottom left repeat-x; padding: 4px 10px 5px 0px; /* vertical-align: top;*/ text-align: left;">' . "\n";
    echo '		<select name="extraBed">' . "\n";
    echo '			<option value="0" selected>0</option>' . "\n";
    echo '			<option value="1">1</option>' . "\n";
    echo '		</select>' . "\n";
    echo '	</td>' . "\n";
    echo '</tr>' . "\n";
}
$extraServices = ExtraService::fetchAllFromDb();
if ($extraServices == null) {
    $_SESSION['errors'] = ExtraService::$staticErrors;
    header("Location: booking-failure.php");
}
foreach ($extraServices as $extraService) {
    if (!$extraService instanceof ExtraService) {
        continue;
    }
    echo '<tr>' . "\n";
    echo '	<td style="background: url(\'images/light_line.png\') bottom left repeat-x; padding: 4px 10px 5px 0px; /* vertical-align: top;*/ text-align: left;">' . $extraService->getName($language_selected) . '</td>' . "\n";
    echo '	<td style="background: url(\'images/light_line.png\') bottom left repeat-x; padding: 4px 10px 5px 0px; /* vertical-align: top;*/ text-align: left;">' . $systemConfiguration->formatCurrency($extraService->price) . ' ';
    $maxNumberSelectable = 0;
    if ($extraService->isNightly) {
        echo BOOKING_SERVICES_PER_NIGHT . '</td>' . "\n";
        $maxNumberSelectable = $bookingDetails->searchCriteria->getNightCount();
<?php

/**
 * Created by PhpStorm.
 * User: Antonshell
 * Date: 15.08.2015
 * Time: 17:59
 */
$payPal = new PaypalSinglePayment();
$userService = new UserService();
// get extraservices
$extraServices = ExtraService::getList();
//get selected user
$userId = $userService->getSelectedUser();
// get payments history
$payments = ExtraServiceUsers::getPaymentHistory($userId);
$config = Config::get();
?>

<script type="text/javascript">
    var extraServices = <?php 
echo json_encode($extraServices);
?>
;
</script>

<div class="row">
    <div class="col-md-3">
        <div class="form-group">
            <label for="extra_service">Extra Service</label>
            <select id="extra_service" class="form-control">
示例#8
0
<?php

require_once "business/extraservice.class.php";
$extraLijst = ExtraService::toonAlleExtras();
<?php

include_once "access.php";
include_once "../includes/SystemConfiguration.class.php";
// If we have id, then we are trying to delete
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
    $id = $_GET['id'];
    ExtraService::delete($id);
}
header("Location: extra_services_list.php");