Esempio n. 1
0
function updateHotelsStep_6()
{
    $hotelroomtype = new HotelRoomType();
    $_REQUEST['room_type_img'] = Sessions::getRoomImage();
    $hotelroomtype->setValues($_REQUEST);
    //INFO: Log
    //$temp_room_type1 = new HotelRoomType();
    //$temp_room_type2 = $_REQUEST;
    //$temp_room_type1->setRoomTypeId($temp_room_type2['room_type_id']);
    //$temp_room_type1=(array)$temp_room_type1->getHotelRoomTypeFromId();
    //INFO: Log//
    if ($hotelroomtype->updateHotelRoomType()) {
        //INFO: Log
        //$TransactionLog=new TransactionLog($temp_room_type2['room_type_hotel_id'],Libs::getKey('hotel_sections','Room Types - Edit'),'Update',Sessions::getMemberId(),'hotel_room_types',$temp_room_type1[0],$temp_room_type2);
        //$TransactionLog->log();
        //INFO: Log//
        $complete = new ProfileCompletion();
        $complete->setHotelStepId($_REQUEST['hotel_step_id']);
        $complete->setHotelStep1(1);
        $complete->updateProfileCompletionStep('7');
        echo $_REQUEST['hotel_step_id'];
        Common::jsonSuccess("");
    } else {
        Common::jsonError("Error");
    }
    //INFO: Log
    //$temp_room_type1=null;
    //$temp_room_type2=null;
    //INFO: Log
}
function editHotelRates()
{
    $roomrates = new HotelRoomRates();
    $roomrates->setValues($_REQUEST);
    $localCols = $roomrates->getRateFields('Local');
    $foreignCols = $roomrates->getRateFields('Foreign');
    //INFO: Assumes that `count($foreignCols)` and `count($localCols)` are same.
    for ($i = 1; $i < count($foreignCols); $i = $i + 2) {
        $val_array_foreign[] = ($roomrates->getFieldValue($foreignCols[$i]) - $roomrates->getFieldValue($foreignCols[$i - 1])) / 100;
        $val_array_local[] = ($roomrates->getFieldValue($localCols[$i]) - $roomrates->getFieldValue($localCols[$i - 1])) / 100;
    }
    $max_foreign = max($val_array_foreign);
    $max_local = max($val_array_local);
    $min_foreign = min($val_array_foreign);
    $min_local = min($val_array_local);
    $roomrates->setDiscountRatesUpForiegn($max_foreign);
    $roomrates->setDiscountRatesUpLocal($max_local);
    $roomrates->setHotelPriceMinForiegn($min_foreign);
    $roomrates->setHotelPriceMinLocal($min_local);
    $roomrates->setModifiedDate(date('Y-m-d'));
    //INFO: Log
    /*$temp_rate1 = new HotelRoomRates();
      $temp_rate2 = $_REQUEST;
      $temp_rate1->setRoomRateId($temp_rate2['room_rate_id']);
      $temp_rate1=(array)$temp_rate1->getRatesFromRateId();*/
    //INFO: Log//
    if ($roomrates->updateHotelRoomRate()) {
        //INFO: Replaced following commented section with above  `$foreignCols` thing. As no need to re-load data and do the calculation.
        /*// update max and min
          $roomrates = new HotelRoomRates();
          $roomrates->setRoomRateId($_REQUEST['room_rate_id']);
          $query_data = $roomrates->getRateFromId();
          $ic = 0;
          foreach ($query_data as $x) {
              foreach ($x as $key => $val) {
                  if ($ic > 7 && $ic < 67) {
                      $ARRAY[$ic] = $val;
                  }
                  $ic++;
              }
          }
          for ($x = 67; $x > 7; $x--) {
              $y = ($x - 1);
              if ($x < 36) {
                  $val_array_local[] = (($ARRAY[$x] - $ARRAY[$y]) / 100);
              } else {
                  $val_array_foreign[] = (($ARRAY[$x] - $ARRAY[$y]) / 100);
              }
          }
          $max_foreign = max($val_array_foreign);
          $max_local = max($val_array_local);
          $min_foreign = min($val_array_foreign);
          $min_local = min($val_array_local);
          $roomrates->setDiscountRatesUpForiegn($max_foreign);
          $roomrates->setDiscountRatesUpLocal($max_local);
          $roomrates->setHotelPriceMinForiegn($min_foreign);
          $roomrates->setHotelPriceMinLocal($min_local);
          $roomrates->updateHotelRoomRateMax();*/
        //INFO: Log
        //$temp_rate2['discount_rates_up_foriegn']=$max_foreign;
        //$temp_rate2['discount_rates_up_local']=$max_local;
        //$temp_rate2['hotel_price_min_foriegn']=$min_foreign;
        //$temp_rate2['hotel_price_min_local']=$min_local;
        //$TransactionLog=new TransactionLog($temp_rate2['hotel_id'],Libs::getKey('hotel_sections','Hotel Rates - Edit'),'Update',Sessions::getMemberId(),'room_rates',$temp_rate1[0],$temp_rate2);
        //$TransactionLog->log();
        //$temp_hotel1=null;
        //$temp_hotel2=null;
        //INFO: Log
        //max and min
        $complete = new ProfileCompletion();
        $complete->setHotelStepId($_REQUEST['hotel_step_id']);
        $complete->setHotelStep1(1);
        $complete->updateProfileCompletionStep('6');
        //echo($_REQUEST['hotel_step_id']);
        Common::jsonSuccess("Room Rates Added Successfully!");
    } else {
        Common::jsonError("Error");
    }
}
Esempio n. 3
0
function delete()
{
    $offerId = $_REQUEST['id'];
    $offers = new Offers();
    $offers->setId($offerId);
    $data = $offers->getById();
    $offers->extractor($data);
    $hotelID = $offers->hotelId();
    if ($offers->delete()) {
        $path = DOC_ROOT . 'uploads/special_offers/' . $offers->image();
        if (file_exists($path)) {
            unlink($path);
        }
        $specialOffers = new Offers();
        $specialOffers->setHotelId($hotelID);
        $specialOffers_rows = $specialOffers->getByHotelId();
        if (count($specialOffers_rows) == 0) {
            $complete = new ProfileCompletion();
            $complete->setHotelStepHotelsId($hotelID);
            $complete->setHotelStep1(0);
            $complete->updateProfileCompletionStepByHotel('9');
            Common::jsonSuccess("Offer Deleted Successfully", "setOfferStep");
        } else {
            Common::jsonSuccess("Offer Deleted Successfully");
        }
    } else {
        Common::jsonError("Error");
    }
}
Esempio n. 4
0
function updateHotelsStep_6()
{
    $hotelroomtype = new HotelRoomType();
    $hotelroomtype->setValues($_REQUEST);
    if ($hotelroomtype->updateHotelRoomType()) {
        $complete = new ProfileCompletion();
        $complete->setHotelStepId($_REQUEST['hotel_step_id']);
        $complete->setHotelStep1(1);
        $complete->updateProfileCompletionStep('7');
        echo $_REQUEST['hotel_step_id'];
        Common::jsonSuccess("");
    } else {
        Common::jsonError("Error");
    }
}