Example #1
0
 function index()
 {
     $a_post = convertXMLPOSTBooking($this->input->post());
     $this->load->model('travflex/search_model');
     $service_name = 'Booking';
     try {
         $arrCompleteServ = array();
         foreach ($a_post as &$post) {
             if ($post['OrgResId'] != '' and $post['OrgHBId'] != '') {
                 $service_name = 'Amend Booking';
             }
             $this->searchProduct($post);
             $this->bookingProduct($post);
             $data = $this->postBookingProduct($post);
             if ($data === FALSE) {
                 continue;
             }
             $arrCompleteServ[] = $data;
         }
         //check hotel and period was same ...do concat!!
         if ($this->postbook_model->checkCompletedService($arrCompleteServ) === TRUE) {
             if ($a_post[0]['isConcatHBID'] == 'TRUE') {
                 $this->postbook_model->concatBookId($arrCompleteServ);
             }
         }
         $abooking = array("ResNo" => randomID(), "Status" => $arrCompleteServ[0]['Status'], "PaxPassport" => $post['PaxPassport'], "OSRefNo" => $post['OSRefNo'], "FinishBook" => $post['FinishBook'], "RPCurrency" => $arrCompleteServ[0]["RPCurrency"], "CompleteService" => $arrCompleteServ, "UnCompleteService" => array());
     } catch (Exception $ex) {
         log_message('INFO', 'ERROR MSG => ' . $ex->getMessage() . '; LINE => ' . $ex->getLine());
         $abooking['errors']['error'] = $ex->getMessage();
     }
     $this->load->view('travflex/book_response', array('bookInfo' => $abooking));
     xmllog21s($service_name, $this->log_21);
 }
Example #2
0
 public function index()
 {
     $a_post = convertXMLPOSTBooking($this->input->post());
     $this->load->model('travflex/search_model');
     $this->load->model('travflex/book/prebook_model');
     $this->load->model('travflex/book/postbook_model');
     $this->load->helper(array('view', 'tools'));
     $this->load->library('Httpcurl');
     $arrCompleteServices = array();
     $err = array();
     foreach ($a_post as $idx => &$post) {
         try {
             $this->searchHotel($post);
             $this->temp_log['request']['searchHotel'][$idx] = 'query from db.';
             $this->temp_log['response']['searchHotel'][$idx] = $post['response'];
             $this->prebookHotel($post);
             $this->temp_log['request']['bookHotel'][$idx] = $post['request'];
             $this->temp_log['response']['bookHotel'][$idx] = $post['response'];
             $arrCompleteServices[] = $this->postbookHotel($post);
             $is_error = 'FALSE';
         } catch (Exception $ex) {
             $is_error = 'TRUE';
             log_message('NOTICE', 'Exception : ' . $ex->getMessage() . '; LINE : ' . $ex->getLine() . '; FILE : ' . $ex->getFile());
             $err['response']['errors'][$idx] = $ex->getMessage();
         }
     }
     //concat room category when :::
     //1. same hotel(HOTEL,XML) and same period(XML)
     if ($a_post[0]['isConcatHBID'] == 'TRUE' && $is_error == 'FALSE') {
         $id = '';
         $ref = '';
         foreach ($arrCompleteServices as $item) {
             $id .= $item['Id'] . '#|#';
             $ref .= $item['RefHBId'] . '#|#';
         }
         foreach ($arrCompleteServices as &$fill) {
             $fill['Id'] = substr($id, 0, -3);
             $fill['RefHBId'] = substr($ref, 0, -3);
         }
     }
     @$this->load->view('travflex/book_responseV2', array('post' => $a_post, 'arrCompleteServices' => $arrCompleteServices, 'err' => $err));
     xmllog21s('BookingHotel', $this->temp_log);
 }