Beispiel #1
0
 $fv->validateEmpty('maxpax', $_L['RTS_nomaxprson_err']);
 $fv->validateNumber('maxpax', $_L['RTS_maxprson_nmric_err']);
 $fv->validateEmpty('minstay', $_L['RTS_nominnghts_err']);
 $fv->validateNumber('minstay', $_L['RTS_minstay_nmric_err']);
 $fv->validateEmpty('maxstay', $_L['RTS_nomaxstay_err']);
 $fv->validateNumber('maxstay', $_L['RTS_maxstay_nmric_err']);
 $fv->validateEmpty('minbook', $_L['RTS_nominadv_err']);
 $fv->validateNumber('minbook', $_L['RTS_minadv_nmric_err']);
 if (!$allowChangeRate) {
     $fv->addErrormsg($_L['RTS_Err_changeRateType']);
 }
 if ($fv->checkErrors()) {
     // display errors
     $validationMsgs = "<div align=\"left\"><h2>" . $_L['PR_formerr'] . "</h2>" . $fv->displayErrors() . "</div>";
 } else {
     $ratesid = modify_rate($_POST['ratesid'], $_POST['code'], $_POST['description'], $_POST['bookingsrc'], $_POST['occupancy'], $_POST['ratetype'], $_POST['minpax'], $_POST['maxpax'], $_POST['minstay'], $_POST['maxstay'], $_POST['minbook'], $_POST['currencycode'], $_POST['date_started'], $_POST['date_stopped']);
     if ($_POST['ratetype'] == CUSTOMERRATE && $_POST['customerid']) {
         delete_rateroomtypes($ratesid);
         add_roomratetypes($ratesid, CUSTOMERRATE, $_POST['customerid']);
     }
     $syncrate = 0;
     if ($_POST['ratetype'] == AGENTRATE) {
         $agentid = isset($_POST['agentid']) ? $_POST['agentid'] : 0;
         delete_rateroomtypes($ratesid);
         add_roomratetypes($ratesid, AGENTRATE, $agentid);
     }
     if ($_POST['ratetype'] == PROMORATE || $_POST['ratetype'] == CUSTOMERRATE || $_POST['ratetype'] == AGENTRATE) {
         if ($_POST['ratetype'] == PROMORATE) {
             delete_rateroomtypes($ratesid);
         }
         get_roomslist($rms, '', '', 0);
 $roomtype = trim($_POST['ROOMTYPE']);
 $roomcount = trim($_POST['ROOMCOUNT']);
 $roomcost = trim($_POST['ROOMCOST']);
 $currency = trim($_POST['CURRENCY']);
 $ratecode = "DEF_" . $roomtype;
 $date_started = date("d/m/Y");
 $date_stopped = date('d/m/Y', strtotime(date("d/m/Y", mktime()) . " + 365 day"));
 //Room No. File Name
 $roomno_file = "roomno.txt";
 $roomno = 100;
 if (file_exists($roomno_file)) {
     $roomno = file_get_contents($roomno_file);
 }
 //Default Room URL
 $defurl = "http://www.example.com/image.jpg";
 $rateid = modify_rate(0, $ratecode, "Default Rate", 15, "F", 1, 1, 1, 1, 1, 0, $currency, $date_started, $date_stopped);
 modify_rateitem(0, $rateid, 1, 1, 16773247, 1, 1, $roomcost, 0);
 $roomtypeid = modify_roomtype(0, $roomtype, $roomtype, $rateid, $defurl);
 for ($i = 0; $i < $roomcount; $i++) {
     $add_roomno = $roomno + $i;
     $roomstatus = "V";
     $roomid = modify_room(0, $add_roomno, $roomtypeid, "", 1, 1, 1, 0, 0, 0, 1, $roomstatus, "", "", $rateid);
     if (isset($_POST['AMENITIES'])) {
         $amenitylist = $_POST['AMENITIES'];
         //print_r($amenitylist);
         foreach ($amenitylist as $amenity) {
             add_roomamenity($roomid, $amenity);
         }
     }
 }
 $roomno = $roomno + 100;