| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/holidays.tripjack.com/application/models/ |
Upload File : |
<?php
class Travel_Model_FlightMaster
{
protected $db = NULL;
public $intId = NULL;
/* * ************************************ */
public function __construct()
{
$request = Zend_Controller_Front::getInstance()->getRequest();
$this->baseUrl = $request->getScheme() . '://' . $request->getHttpHost();
$this->db = Zend_Db_Table::getDefaultAdapter();
}
public function __destruct()
{
$this->db->closeConnection();
}
/* Added By Pardeep Panchal Ends */
public function InsertFlightData($tablename, array $addData)
{
$dbtable = new Zend_Db_Table($tablename);
return $dbtable->insert($addData);
}
public function UpdateFlightData($tablename, array $addData, $where)
{
return $this->db->update($tablename, $addData, $where);
// return $dbtable->insert($addData);
}
public function InsertHotelStaticData($tablename, array $addData)
{
$dbtable = new Zend_Db_Table($tablename);
return $dbtable->insert($addData);
}
public function SearchFlightCustomer($tablename, array $param)
{
$leadMobile = $param['leadMobile'];
$leadEmail = $param['leadEmail'];
$AgencySysId = $param['AgencySysId'];
$select = $this->db->select()->from("$tablename", "*");
$select->where("AgencySysId=?", "$AgencySysId");
$select->where("Contacts=?", "$leadMobile");
$select->where('EmailId=?', $leadEmail);
$select->where("IsMarkForDel", 0);
$select->where("IsActive", 1);
$result = $this->db->fetchAll($select);
return $result;
}
public function SearchFlightCustomerMember($tablename, array $param)
{
$FirstName = $param['FirstName'];
$Relation = $param['Relation'];
$CustomerSysId = $param['CustomerSysId'];
$select = $this->db->select()->from("$tablename", "*");
$select->where("FirstName=?", "$FirstName");
$select->where('Relation=?', $Relation);
$select->where('CustomerSysId=?', $CustomerSysId);
$select->where("IsMarkForDel", 0);
$select->where("IsActive", 1);
$result = $this->db->fetchAll($select);
return $result;
}
public function GetFlightCustomerMember($tablename, array $param)
{
$CustomerSysId = $param['CustomerSysId'];
$AgencySysId = $param['AgencySysId'];
$select = $this->db->select()->from("$tablename", "*");
$select->where("AgencySysId=?", "$AgencySysId");
$select->where("CustomerSysId=?", "$CustomerSysId");
$select->where("IsMarkForDel", 0);
$select->where("IsActive", 1);
$select->order("paxType", 'ASC');
$result = $this->db->fetchAll($select);
return $result;
}
public function CheckCustomer($tablename, array $param)
{
$select = $this->db->select()->from("$tablename", "*");
if (isset($param['CustomerSysId']) && !empty($param['CustomerSysId'])) {
$CustomerSysId = $param['CustomerSysId'];
$select->where("CustomerSysId=?", "$CustomerSysId");
}
if (isset($param['GTX_customerSysId']) && !empty($param['GTX_customerSysId'])) {
$GTX_customerSysId = $param['GTX_customerSysId'];
$select->where("GTX_customerSysId=?", "$GTX_customerSysId");
}
if (isset($param['AgencySysId']) && !empty($param['AgencySysId'])) {
$AgencySysId = $param['AgencySysId'];
$select->where("AgencySysId=?", "$AgencySysId");
}
if (isset($param['Contacts']) && !empty($param['Contacts'])) {
$Contacts = $param['Contacts'];
$select->where("Contacts=?", "$Contacts");
}
if (isset($param['EmailId']) && !empty($param['EmailId'])) {
$EmailId = $param['EmailId'];
$select->where("EmailId=?", "$EmailId");
}
if (isset($param['FirstName']) && !empty($param['FirstName'])) {
$FirstName = $param['FirstName'];
$select->where("FirstName=?", "$FirstName");
}
if (isset($param['LastName']) && !empty($param['LastName'])) {
$LastName = $param['LastName'];
$select->where("LastName=?", "$LastName");
}
$select->where("IsMarkForDel", 0);
$select->where("IsActive", 1);
$select->order("paxType", 'ASC');
$result = $this->db->fetchRow($select);
return $result;
}
public function CheckMember($tablename, array $param)
{
$CustomerSysId = $param['CustomerMemberSysId'];
$AgencySysId = $param['AgencySysId'];
$select = $this->db->select()->from("$tablename", "*");
$select->where("CustomerMemberSysId=?", "$CustomerSysId");
$select->where("AgencySysId=?", "$AgencySysId");
$select->where("IsMarkForDel", 0);
$select->where("IsActive", 1);
$select->order("paxType", 'ASC');
$result = $this->db->fetchRow($select);
return $result;
}
public function CheckMemberAPI($tablename, array $param)
{
$FirstName = $param['FirstName'];
$LastName = $param['LastName'];
$CustomerSysId = $param['CustomerSysId'];
$AgencySysId = $param['AgencySysId'];
$select = $this->db->select()->from("$tablename", "*");
$select->where("FirstName=?", "$FirstName");
$select->where("LastName=?", "$LastName");
$select->where("AgencySysId=?", "$AgencySysId");
$select->where("CustomerSysId=?", "$CustomerSysId");
$select->where("IsMarkForDel", 0);
$select->where("IsActive", 1);
$select->order("paxType", 'ASC');
$result = $this->db->fetchRow($select);
return $result;
}
public function GetFlightBookingData($tablename, array $param)
{
$CustomerSysId = $param['CustomerSysId'];
$select = $this->db->select()->from("$tablename", "*");
$select->where("CustomerSysId=?", "$CustomerSysId");
$select->where("parent_id=?", 0);
$select->where("status=?", 1);
$select->where("IsMarkForDel", 0);
$select->order("id", 'DESC');
$result = $this->db->fetchAll($select);
return $result;
}
public function FlightBookingData($tablename, $apiTraceId, $journeyType = null)
{
$select = $this->db->select()->from("$tablename", "*");
$select->where("apiTraceId=?", "$apiTraceId");
if ($journeyType) {
$select->where("JourneyType=?", $journeyType);
}
// $select->where("parent_id=?",0);
$select->where("IsMarkForDel", 0);
$select->where("status", 1);
$select->order("id", 'ASC');
$result = $this->db->fetchRow($select);
$resultReturn = [];
$passenger = [];
if ($result) {
$parent_id = $result['id'];
$selectp = $this->db->select()->from("tbl_flight_booking_customer", "*");
$selectp->where("apiTraceId=?", "$apiTraceId");
$selectp->where("flight_booking_id=?", "$parent_id");
if ($journeyType) {
$selectp->where("JourneyType=?", $journeyType);
}
$selectp->where("IsMarkForDel", 0);
$selectp->order("id", 'ASC');
$passenger = $this->db->fetchAll($selectp);
if (empty($journeyType)) {
//$parent_id = $result['id'];
$selectr = $this->db->select()->from("$tablename", "*");
$selectr->where("apiTraceId=?", "$apiTraceId");
$selectr->where("parent_id=?", "$parent_id");
$selectr->where("IsMarkForDel", 0);
$selectr->order("id", 'ASC');
$resultReturn = $this->db->fetchRow($selectr);
$flight_booking_id = $resultReturn['id'];
$selectpr = $this->db->select()->from("tbl_flight_booking_customer", "*");
$selectpr->where("apiTraceId=?", "$apiTraceId");
$selectpr->where("flight_booking_id=?", "$flight_booking_id");
if ($journeyType) {
$selectpr->where("JourneyType=?", $journeyType);
}
$selectpr->where("IsMarkForDel", 0);
$selectpr->order("id", 'ASC');
$passengerRe = $this->db->fetchAll($selectpr);
}
}
$result['onward'] = $result;
$result['passenger'] = $passenger;
$resultReturn['return'] = $resultReturn;
$resultReturn['passenger'] = $passengerRe;
$data = array('onward' => $result, 'return' => $resultReturn);
return $data;
}
public function GetCustomerData($tablename, $CustomerSysId = null, $mobile = null, $email = null, $gtxagencysysid = null)
{
$select = $this->db->select()->from("$tablename", "*");
// $select->where("CustomerSysId=?", "$CustomerSysId");
if (!empty($CustomerSysId)) {
$select->where("CustomerSysId=?", "$CustomerSysId");
}
if (!empty($mobile)) {
$select->where("Contacts=?", "$mobile");
}
if (!empty($email)) {
$select->where("EmailId=?", "$email");
}
if (!empty($gtxagencysysid)) {
$select->where("AgencySysId=?", "$gtxagencysysid");
}
$select->where("IsMarkForDel", 0);
$select->where("IsActive", 1);
$result = $this->db->fetchRow($select);
return $result;
}
public function CheckFlightToken($tablename, $AgencySysid = null)
{
$date1 = date('Y-m-d') . " 00:00:00";
$date2 = date('Y-m-d') . " 23:59:00";
$select = $this->db->select()->from("$tablename", "*");
if($AgencySysid){
$select->where('AgencySysid =?', $AgencySysid);
}
$select->where('created_at >= ?', $date1);
$select->where('created_at <= ?', $date2);
$result = $this->db->fetchRow($select);
return $result;
}
public function DeleteToken($tablename)
{
$date1 = date('Y-m-d') . " 00:00:00";
$date2 = date('Y-m-d') . " 23:59:00";
$where = array('created_at >= ? ' => $date1);
$result = $this->db->delete("$tablename", $where);
return $result;
}
public function CheckHotelPaymentSTatus($tablename, $apiTraceId, $journeyType = null)
{
$select = $this->db->select()->from("$tablename", "*");
$select->where("TraceId=?", "$apiTraceId");
if ($journeyType) {
$select->where("JourneyType=?", $journeyType);
}
// $select->where("parent_id=?",0);
$select->where("IsMarkForDel", 0);
$select->order("id", 'ASC');
$result = $this->db->fetchRow($select);
return $result;
}
public function HotelsBookingData($tablename, $apiTraceId = null, $bookingId = null)
{
$select = $this->db->select()->from("$tablename", "*");
if ($apiTraceId) {
$select->where("TraceId=?", $apiTraceId);
}
if ($bookingId) {
$select->where("id=?", $bookingId);
}
$select->where("IsMarkForDel", 0);
$select->order("id", 'ASC');
$result = $this->db->fetchRow($select);
//echo '<pre>';print_r($result);
$booking_room = [];
$passenger = [];
if ($result) {
if (!empty($result)) {
$id = $result['id'];
$selectr = $this->db->select()->from("tbl_hotel_booking_room", "*");
if ($result['TraceId']) {
$selectr->where("TraceId=?", $result['TraceId']);
}
if ($id) {
$selectr->where("tbl_hotel_booking_id=?", $id);
}
$selectr->where("IsMarkForDel", 0);
$selectr->order("id", 'ASC');
//echo $selectr;die;
$bookingroom = $this->db->fetchAll($selectr);
if ($bookingroom) {
foreach ($bookingroom as $key => $room) {
$selectp = $this->db->select()->from("tbl_hotel_booking_guest", "*");
$selectp->where("HotelRooms_id=?", $room['id']);
$selectp->where("IsMarkForDel", 0);
$selectp->order("id", 'ASC');
$guest = $this->db->fetchAll($selectp);
$booking_room[$key]['room'] = $room;
$booking_room[$key]['guest'] = $guest;
}
}
}
$selectp = $this->db->select()->from("tbl_hotel_booking_guest", "*");
$selectp->where("apiTraceId=?", $result['TraceId']);
$selectp->where("paxType", 1);
$selectp->where("IsMarkForDel", 0);
$selectp->order("id", 'ASC');
$passenger = $this->db->fetchRow($selectp);
}
$data = array('BookingData' => $result, 'booking_room' => $booking_room, 'Guest' => $passenger);
return $data;
}
public function getCurrencyIdsAndSymbolList()
{
$select = $this->db->select()->from("tbl_currency", "*");
$select->where("isActive", 1);
$select->order("id", 'ASC');
$result = $this->db->fetchAll($select);
return $result;
}
public function getHotelsBookingList($tablename, $CustomerSysId = null, $cancel = null)
{
$select = $this->db->select()->from("$tablename", "*");
if ($CustomerSysId) {
$select->where("CustomerSysId=?", $CustomerSysId);
}
if ($cancel) {
$select->where("IsCancelled=?", $cancel);
}
$select->where("status", 1);
$select->where("IsMarkForDel", 0);
$select->order("id DESC");
$result = $this->db->fetchAll($select);
//$data = array('BookingData'=>$result,'booking_room'=>$booking_room,'Guest'=>$passenger);
return $result;
}
public function insertFlightTempData($data)
{
$this->db->insert('tbl_temp_data', $data);
return $this->db->lastInsertId('tbl_temp_data');
}
public function GetFlightTempData($traceId)
{
$arr = array('json_data', 'created_at');
$select = $this->db->select();
$select->from(array('TP' => "tbl_temp_data"), $arr);
$select->where("TP.TraceId = ?", $traceId);
$result = $this->db->fetchRow($select);
return $result;
}
public function deleteFlightTempData($TraceId)
{
$where = array('TraceId = ? ' => $TraceId);
$this->db->delete('tbl_temp_data', $where);
}
public function FlightBookingDataTripJack($tablename, $apiTraceId, $journeyType = null, $bookingid=null)
{
$select = $this->db->select()->from("$tablename", "*");
$select->where("apiTraceId=?", "$apiTraceId");
if ($journeyType) {
$select->where("JourneyType=?", $journeyType);
}
if ($bookingid) {
$select->where("APIBookingId=?", $bookingid);
}
// $select->where("parent_id=?",0);
$select->where("status", 1);
$select->where("IsMarkForDel", 0);
$select->order("id", 'ASC');
$result = $this->db->fetchRow($select);
$passenger = [];
if ($result) {
$selectp = $this->db->select()->from("tbl_flight_booking_customer", "*");
$selectp->where("apiTraceId=?", "$apiTraceId");
$selectp->where("IsMarkForDel", 0);
$selectp->group(array("CustomerSysId","id"));
$selectp->order("id", 'ASC');
$passenger = $this->db->fetchAll($selectp);
}
$data = array('data' => $result, 'passenger' => $passenger);
return $data;
}
public function FlightBookingDataAll($tablename, $apiTraceId, $journeyType = null)
{
$select = $this->db->select()->from("$tablename", "*");
$select->where("apiTraceId=?", "$apiTraceId");
if ($journeyType) {
$select->where("JourneyType=?", $journeyType);
}
$select->where("status", 1);
$select->where("IsMarkForDel", 0);
$select->order("id", 'ASC');
$result = $this->db->fetchAll($select);
return $result;
}
public function FlightCancelDataTripJack($tablename, $bookingId, $ChangeRequestId = null, $TraceId = null)
{
$select = $this->db->select()->from("$tablename", "*");
if($bookingId){
$select->where("APIBookingId=?", "$bookingId");
}
if($TraceId){
$select->where("apiTraceId=?", "$TraceId");
}
if ($ChangeRequestId) {
$select->where("ChangeRequestId=?", $ChangeRequestId);
}
// $select->where("parent_id=?",0);
//$select->where("status", 1);
$select->where("IsMarkForDel", 0);
$select->order("id", 'ASC');
$result = $this->db->fetchRow($select);
$passenger = [];
if ($result) {
$selectp = $this->db->select()->from("tbl_flight_booking_customer", "*");
if($bookingId){
$selectp->where("APIBookingId=?", "$bookingId");
}
//$selectp->where("APIBookingId=?", "$bookingId");
if ($ChangeRequestId) {
$selectp->where("ChangeRequestId=?", $ChangeRequestId);
}
if($TraceId){
$selectp->where("apiTraceId=?", "$TraceId");
}
$selectp->where("IsMarkForDel", 0);
$selectp->group(array("CustomerSysId","id"));
$selectp->order("id", 'ASC');
$passenger = $this->db->fetchAll($selectp);
}
$data = array('data' => $result, 'passenger' => $passenger);
return $data;
}
public function updateModification($data, $ModificationId)
{
$where = array('ModificationId = ? ' => $ModificationId);
$this->db->update('tb_flight_modification', $data, $where);
}
public function GeModificationData($apiTraceId)
{
$select = $this->db->select();
$select->from(array('TP' => "tb_flight_modification"));
$select->where("TP.apiTraceId = ?", $apiTraceId);
$result = $this->db->fetchAll($select);
return $result;
}
public function GeModificationDataAmendmentId($amendmentId)
{
$select = $this->db->select();
$select->from(array('TP' => "tb_flight_modification"));
$select->where("TP.ChangeRequestId = ?", $amendmentId);
$result = $this->db->fetchAll($select);
return $result;
}
public function checkExistBooking($BookId)
{
$select = $this->db->select();
$select->from(array('TP' => "tbl_flight_booking"));
$select->where("TP.APIBookingId = ?", $BookId);
$result = $this->db->fetchAll($select);
return $result;
}
public function DBConnect()
{
return $this->db;
}
public function getflightAirportData($AirportCode)
{
$select = $this->db->select()->from("tbl_flight_airport_code");
$select->where("AirportCode=?", $AirportCode);
$select->order("AirId", 'DESC');
$result = $this->db->fetchAll($select);
return $result;
}
public function CheckPaymentSTatus($tablename, $apiTraceId,$journeyType=null) {
$select = $this->db->select()->from("$tablename", "*");
$select->where("apiTraceId=?", "$apiTraceId");
if($journeyType){
$select->where("JourneyType=?",$journeyType);
}
$select->where("IsMarkForDel",0);
$select->order("id", 'ASC');
$result = $this->db->fetchRow($select);
return $result;
}
public function sendgtxapiinfo($CURLOPT_CUSTOMREQUEST, $data, $url) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => $CURLOPT_CUSTOMREQUEST,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"content-type: application/json",
),
));
$response = curl_exec($curl);
$resultset = json_decode($response, 1);
$err = curl_error($curl);
curl_close($curl);
return $resultset;
}
public function getgtxapiinfo($url) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_ENCODING, "gzip");
curl_setopt($curl, CURLOPT_POST, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_HTTPHEADER, array());
$response = curl_exec($curl);
$resultset = json_decode($response, 1);
curl_close($curl);
return $resultset;
}
public function getAllflightAirportListData()
{
$select = $this->db->select()->from("tbl_flight_airport_code");
$select->order("AirId", 'DESC');
$result = $this->db->fetchAll($select);
$resultset = array();
foreach($result as $key => $val){
$resultset[$val['AirportCode']][] = $val;
}
return $resultset;
}
public function getCashFeeData($apiTraceId)
{
$select = $this->db->select();
$select->from(array('TP' => "tbl_cashfee_detail"));
$select->where("TP.orderId = ?", $apiTraceId);
$result = $this->db->fetchRow($select);
return $result;
}
}