Commit d03eead6 by Tobin

Merge branch 'master' into 'dev_production'

Master See merge request !223
parents 66807cea 7cd9e2f9
......@@ -624,12 +624,14 @@ class Api extends CI_Controller {
$merchant_key = $settings['merchant_key'];
$ses_id = time().rand(100000,999999);
$reqData = '{"sessionId":"'.$ses_id.'","merchantId":"'.$merchant_id.'","custId":"'.$cust_id.'","emailId":"'.$email.'"}';
$reqData = '{"sessionId":"'.$ses_id.'","merchantId":"'.$merchant_id.'","custId":"'.$cust_id.
'","emailId":"'.$email.'"}';
$plainText = $this->encryptePayData($merchant_iv,$merchant_key,$reqData);
$plainText = $merchant_id.'|'.$plainText;
$env = (strpos($settings['payment_gateway_url'],'staging') !==false )?'staging':'payments';
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,'https://staging.bayanpay.sa/direcpay/secure/PaymentsMerchStoredCardDtlsAPI');
curl_setopt($ch,CURLOPT_URL,"https://$env.bayanpay.sa/direcpay/secure/PaymentsMerchStoredCardDtlsAPI");
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$plainText);
......@@ -671,6 +673,9 @@ class Api extends CI_Controller {
$mKey = base64_decode($merchant_key);
$encText = base64_decode($encText);
$padtext = openssl_decrypt($encText,$key,$mKey,OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $merchant_iv);
if(empty($padtext)){
return;
}
$padData = ord($padtext{strlen($padtext) - 1});
if ($padData > strlen($padtext)) return false;
......
......@@ -22,7 +22,7 @@ class FlightServices extends CI_Controller {
public function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Riyadh");
$this->load->model('Flight_model');
$this->load->model('FlightServices_model');
$this->load->model('Validation_flight_model');
$method = $this->router->fetch_method();
$data = (array) json_decode(file_get_contents('php://input'));
......@@ -64,7 +64,7 @@ class FlightServices extends CI_Controller {
public function flight_authenticate(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Flight_model->flight_authenticate($data);
$res = $this->FlightServices_model->flight_authenticate($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -75,7 +75,7 @@ class FlightServices extends CI_Controller {
public function flight_availability_search(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Flight_model->flight_availability_search($data);
$res = $this->FlightServices_model->flight_availability_search($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -86,7 +86,7 @@ class FlightServices extends CI_Controller {
public function flight_fare_rules(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Flight_model->flight_fare_rules($data);
$res = $this->FlightServices_model->flight_fare_rules($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -97,7 +97,7 @@ class FlightServices extends CI_Controller {
public function flight_revalidate(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Flight_model->flight_revalidate($data);
$res = $this->FlightServices_model->flight_revalidate($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -108,7 +108,7 @@ class FlightServices extends CI_Controller {
public function flight_book(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $thia->Flight_model->flight_book($data);
$res = $thia->FlightServices_model->flight_book($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -119,7 +119,7 @@ class FlightServices extends CI_Controller {
public function flight_ticket_order(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Flight_model->flight_ticket_order($data);
$res = $this->FlightServices_model->flight_ticket_order($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -130,7 +130,7 @@ class FlightServices extends CI_Controller {
public function flight_trip_details(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Flight_model->flight_trip_details($data);
$res = $this->FlightServices_model->flight_trip_details($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -141,7 +141,7 @@ class FlightServices extends CI_Controller {
public function cancel_flights(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Flight_model->cancel_flights($data);
$res = $this->FlightServices_model->cancel_flights($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -152,7 +152,7 @@ class FlightServices extends CI_Controller {
public function airportSearch(){
$data = $_GET;
$data['auth_token'] = $this->auth_token;
$res = $this->Flight_model->airportSearch($data);
$res = $this->FlightServices_model->airportSearch($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......
......@@ -22,7 +22,7 @@ class HotelServices extends CI_Controller {
public function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Riyadh");
$this->load->model('Hotel_model');
$this->load->model('HotelServices_model');
$this->load->model('Validation_hotel_model');
$method = $this->router->fetch_method();
$data = (array) json_decode(file_get_contents('php://input'));
......@@ -63,8 +63,7 @@ class HotelServices extends CI_Controller {
public function get_hotel_city_list(){
$data = $_GET;
$data['auth_token'] = $this->auth_token;
$res = $this->Hotel_model->get_hotel_city_list($data);
$res = $this->HotelServices_model->get_hotel_city_list($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -75,7 +74,7 @@ class HotelServices extends CI_Controller {
public function hotel_search(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Hotel_model->hotel_search($data);
$res = $this->HotelServices_model->hotel_search($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -86,7 +85,7 @@ class HotelServices extends CI_Controller {
public function get_specific_hotel_content(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Hotel_model->get_specific_hotel_content($data);
$res = $this->HotelServices_model->get_specific_hotel_content($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -97,7 +96,7 @@ class HotelServices extends CI_Controller {
public function get_room_rates(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Hotel_model->get_room_rates($data);
$res = $this->HotelServices_model->get_room_rates($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -108,7 +107,7 @@ class HotelServices extends CI_Controller {
public function get_rate_rules(){
$data = (array) json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Hotel_model->get_rate_rules($data);
$res = $this->HotelServices_model->get_rate_rules($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -119,7 +118,7 @@ class HotelServices extends CI_Controller {
public function hotel_book(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Hotel_model->hotel_book($data);
$res = $this->HotelServices_model->hotel_book($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -130,7 +129,7 @@ class HotelServices extends CI_Controller {
public function trawex_cancel_booking(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Hotel_model->trawex_cancel_booking($data);
$res = $this->HotelServices_model->trawex_cancel_booking($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......
......@@ -134,7 +134,7 @@ class Api_model extends CI_Model {
'newline' => "\r\n"
));
$ci->email->from('[email protected]', 'TimeOut');
$ci->email->from('[email protected]', 'TimeOut');
$ci->email->to($email);
$ci->email->subject($subject);
$ci->email->message($message);
......
<?php
class Flight_model extends CI_Model {
class FlightServices_model extends CI_Model {
public function _consruct(){
parent::_construct();
......
<?php
class HotelServices_model extends CI_Model {
public function _consruct(){
parent::_construct();
}
public function auth_token_get($token) {
$rs = $this->db->select('user_id')->where('auth_token', $token)->get('customer_auth')->row();
if(count($rs) > 0) {
return $rs->user_id;
} else {
return 0;
}
}
public function get_hotel_city_list($data){
try{
$cond = '';
if(isset($data['query']) && !empty($query = urldecode(strtolower($data['query'])))){
$cond = "AND THC.hotel_city_name LIKE '%".$query."%'";
}
$sql = "SELECT HC.hotel_city_id FROM hotel_cities AS HC
INNER JOIN translator_hotel_city AS THC ON(THC.hotel_city_id=HC.hotel_city_id)
WHERE HC.status=1 $cond GROUP BY HC.hotel_city_id";
$count = $this->db->query($sql)->num_rows();
if($count >= 1){
$perPage = 10;
$page = (isset($data['page']))?$data['page']:1;
$limit = ($page - 1) * $perPage;
$meta = array('total_pages'=>ceil($count/$perPage),'total'=>$count,
'current_page'=>$page,'per_page'=>$perPage);
$sql = "SELECT THC.hotel_city_id AS id,HC.hotel_city_icon AS image,HC.country
FROM translator_hotel_city AS THC
INNER JOIN hotel_cities AS HC ON (HC.hotel_city_id=THC.hotel_city_id)
WHERE HC.status=1 $cond GROUP BY HC.hotel_city_id LIMIT $limit,$perPage";
$hotelData = $this->db->query($sql)->result_array();
$lang = 'EN';
if(isset($data['auth_token']) && !empty($data['auth_token'])){
$user_id = $this->auth_token_get($data['auth_token']);
if($user_id > 0) {
$countryData = $this->getCountryData($user_id);
$lang = $countryData['language_code'];
}
}
foreach ($hotelData as $key => $value) {
if(!empty($lanTrans = langTranslator($value['id'],'HCTY'))){
$lanTrans['name'] = (!empty($lanTrans['hotel_city_name_'.$lang]))?
$lanTrans['hotel_city_name_'.$lang]:
$lanTrans['hotel_city_name_EN'];
$hotelData[$key] = array_merge($hotelData[$key],$lanTrans);
}
}
if(count($hotelData) < 0){
$res = array('status'=>0,'message'=>'No Data Found','code'=>'ER10');
}
$res = array('status'=>1,'data'=>array('city_list'=>$hotelData,'meta'=>$meta));
}else{
$res = array('status'=>0,'message'=>'No Data Found','code'=>'ER10');
}
} catch(Exception $e){
$res = array('status'=>0,'message'=>'Ohh No!! Something Went South!!','code'=>'ER08');
}
return $res;
}
public function hotel_search($data){
try{
$user_id = $this->auth_token_get($data['auth_token']);
if($user_id > 0) {
$trackingId = time().rand(100000,999999);
$settings = getSettings();
if(!isset($data['nextToken']) && empty($data['nextToken'])){
$this->db->select('nationality');
$userData = $this->db->get_where('customer',array('customer_id'=>$user_id))->row_array();
$countryData = $this->getCountryData($user_id);
}
$url = (isset($data['nextToken']) && !empty($data['nextToken']))?"https://trawex.biz/api/hotel_trawexv5/getMoreHotels?user_id=".$settings['trawex_user_id']."&user_password=".$settings['trawex_user_password']."&access=".$settings['trawex_access']."&ip_address=".$settings['trawex_ip_address']."&sessionId=".$data['sessionId']."&nextToken=".$data['nextToken']."&trackingId=".$data['trackingId']."":"https://trawex.biz/api/hotel_trawexv5/hotel_search";
if(!isset($data['nextToken']) && empty($data['nextToken'])){
$postData = array('user_id'=>$settings['trawex_user_id'],
'user_password'=>$settings['trawex_user_password'],
'access'=>$settings['trawex_access'],
'ip_address'=>$settings['trawex_ip_address'],
'trackingId'=>$trackingId,'city_name'=>$data['city_name'],
'country_name'=>$data['country_name'],
'room_count'=>$data['room_count'],'adult'=>$data['adult'],
'child'=>$data['child'],'child_age'=>$data['child_age'],
'checkin'=>$data['checkin'],'checkout'=>$data['checkout'],
'client_nationality'=>$userData['nationality'],
'requiredCurrency'=>$countryData['currency']);
}
$postFields = (isset($data['nextToken']) && !empty($data['nextToken']))?'':$postData;
$result = $this->passToJsonCurl($url,$postFields);
if(!empty($result)){
$result = json_decode($result);
$result->status->trackingId = (!isset($data['nextToken']) && empty($data['nextToken']))?$trackingId:$data['trackingId'];
$res = array('status'=>1,'data'=>array('itineraries'=> $result));
}else{
$res = array('status'=>0,'message'=>'No Data Found','code'=>'ER07');
}
}else{
$res = array('status'=>0,'message'=>'User Authentication Error','code'=>'ER10');
}
}catch(Exception $e){
$res = array('status'=>0,'message'=>'Ohh No!! Something Went South!!','code'=>'ER08');
}
return $res;
}
public function get_specific_hotel_content($data){
try{
$user_id = $this->auth_token_get($data['auth_token']);
if($user_id > 0) {
$settings = getSettings();
$url = "https://trawex.biz/api/hotel_trawexv5/get_specific_hotel_content?user_id=".$settings['trawex_user_id']."&user_password=".$settings['trawex_user_password']."&access=".$settings['trawex_access']."&ip_address=".$settings['trawex_ip_address']."&sessionId=".$data['sessionId']."&trackingId=".$data['trackingId']."&productId=".$data['productId']."&hotelId=".$data['hotelId']."";
$result = $this->passToJsonCurl($url,'');
if(!empty($result)){
$result = json_decode($result);
$result->trackingId = $data['trackingId'];
$res = array('status'=>1,'data'=>$result);
}else{
$res = array('status'=>0,'message'=>'No Data Found','code'=>'ER06');
}
}else{
$res = array('status'=>0,'message'=>'User Authentication Error','code'=>'ER10');
}
}catch(Exception $e){
$res = array('status'=>0,'message'=>'Ohh No!! Something Went South!!','code'=>'ER08');
}
return $res;
}
public function get_room_rates($data){
try{
$user_id = $this->auth_token_get($data['auth_token']);
if($user_id > 0){
$settings = getSettings();
$url = "https://trawex.biz/api/hotel_trawexv5/get_room_rates";
$postData = array("user_id"=>$settings['trawex_user_id'],"user_password"=>$settings['trawex_user_password'],"access"=>$settings['trawex_access'],"ip_address"=>$settings['trawex_ip_address'],"TraceId"=>$data['TraceId'],"propertyid"=>$data['propertyid'],"trackingId"=>$data['trackingId'],"sessionId"=>$data['sessionId'],"productId"=>$data['productId'],"TokenId"=>$data['TokenId'],"resultindex"=>$data['resultindex'],"hotelcode"=>$data['hotelcode']);
$result = $this->passToJsonCurl($url,$postData);
if(!empty($result)){
$result = json_decode($result);
$result->trackingId = $data['trackingId'];
$res = array('status'=>1,'data'=>$result);
}else{
$res = array('status'=>0,'message'=>'No data Found','code'=>'ER06');
}
}else{
$res = array('status'=>0,'message'=>'User Authentication Error','code'=>'ER10');
}
}catch (Exception $e){
$res = array('status'=>0,'message'=>'Ohh No!! Something Went South!!','code'=>'ER08');
}
return $res;
}
public function get_rate_rules($data){
try{
$user_id = $this->auth_token_get($data['auth_token']);
if($user_id > 0){
$settings = getSettings();
$url = "https://trawex.biz/api/hotel_trawexv5/get_rate_rules";
$postData = array(
"user_id"=>$settings['trawex_user_id'],
"user_password"=>$settings['trawex_user_password'],
"access"=>$settings['trawex_access'],
"ip_address"=>$settings['trawex_ip_address'],
"TraceId"=>$data['TraceId'],"propertyid"=>$data['propertyid'],
"trackingId"=>$data['trackingId'],"sessionId"=>$data['sessionId'],
"productId"=>$data['productId'],"TokenId"=>$data['TokenId'],
"resultindex"=>$data['resultindex'],"hotelcode"=>$data['hotelcode'],
"allocationDetails"=>$data['allocationDetails'],
"booking_token"=>$data['booking_token'],
"hotel_name"=>$data['hotel_name'],"infosource"=>$data['infosource'],
"meal_code"=>$data['meal_code'],
"rate_basis_id"=>$data['rate_basis_id'],
"room_code"=>$data['room_code'],"boardCode"=>$data['boardCode'],
"roomType_runno"=>$data['roomType_runno']);
$result = $this->passToJsonCurl($url,$postData);
if(!empty($result)){
$result = json_decode($result);
$result->trackingId = $data['trackingId'];
$res = array('status'=>1,'data'=>$result);
}else{
$res = array('status'=>0,'message'=>'No data Found','code'=>'ER06');
}
}else{
$res = array('status'=>0,'message'=>'User Authentication Error','code'=>'ER10');
}
} catch(Exception $e){
$res = array('status'=>0,'message'=>'Ohh No!! Something Went South!!','code'=>'ER08');
}
return $res;
}
public function hotel_book($data){
try{
$user_id = $this->auth_token_get($data['auth_token']);
if($user_id > 0){
$settings = getSettings();
$url = "https://trawex.biz/api/hotel_trawexv5/hotel_book";
$postData = array(
"user_id"=>$settings['trawex_user_id'],
"user_password"=>$settings['trawex_user_password'],
"access"=>$settings['trawex_access'],
"ip_address"=>$settings['trawex_ip_address'],
"TraceId"=>$data['TraceId'],"propertyid"=>$data['propertyid'],
"trackingId"=>$data['trackingId'],"sessionId"=>$data['sessionId'],
"productId"=>$data['productId'],"TokenId"=>$data['TokenId'],
"resultindex"=>$data['resultindex'],"hotelcode"=>$data['hotelcode'],
"changedOccupancy"=>$data['changedOccupancy'],
"extrabeds"=>$data['extrabeds'],
"guests_details"=>$data['guests_details'],"refcode"=>$data['refcode'],
"prebookingtoken"=>$data['prebookingtoken']
);
$result = $this->passToJsonCurl($url,$postData);
if(!empty($result)){
$result = json_decode($result);
$result->trackingId = $data['trackingId'];
$res = array('status'=>1,'data'=>$result);
}else{
$res = array('status'=>0,'message'=>'No data Found','code'=>'ER06');
}
}else{
$res = array('status'=>0,'message'=>'User Authentication Error','code'=>'ER10');
}
} catch(Exception $e){
$res = array('status'=>0,'message'=>'Ohh No!! Something Went South!!','code'=>'ER08');
}
return $res;
}
public function trawex_cancel_booking($data){
try{
$user_id = $this->auth_token_get($data['auth_token']);
if($user_id > 0){
$settings = getSettings();
$url = "https://trawex.biz/api/hotel_trawexv5/cancel_booking";
$postData = array(
"user_id"=>$settings['trawex_user_id'],
"user_password"=>$settings['trawex_user_password'],
"access"=>$settings['trawex_access'],
"ip_address"=>$settings['trawex_ip_address'],
'trackingId'=>$data['trackingId'],'productId'=>$data['productId'],
'supplierConfirmationNum'=>$data['supplierConfirmationNum'],
'reference'=>$data['reference']
);
$result = $this->passToJsonCurl($url,$postData);
if(!empty($result)){
$result = json_decode($result);
$result->trackingId = $data['trackingId'];
$res = array('status'=>1,'data'=>$result);
}else{
$res = array('status'=>0,'message'=>'No data Found','code'=>'ER06');
}
}else{
$res = array('status'=>0,'message'=>'User Authentication Error','code'=>'ER10');
}
} catch(Exception $e){
$re = array('status'=>0,'message'=>'Ohh No!! Something Went South!!','code'=>'ER08');
}
return $res;
}
public function getCountryData($user_id){
$ctryData = '';
if(!empty($user_id)){
$sql = "SELECT CTRY.* FROM customer AS CUST
INNER JOIN country AS CTRY ON (CTRY.country_id=CUST.country_id)
WHERE CUST.customer_id='$user_id'";
$ctryData = $this->db->query($sql)->row_array();
}
if(empty($ctryData)){
$ctryData = $this->db->query("SELECT * FROM country WHERE language_code='EN'")->row_array();
}
return $ctryData;
}
public function passToJsonCurl($url='',$postData=array()){
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,json_encode($postData));
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch,CURLOPT_HTTPHEADER,array('Content-Type:application/json'));
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
}
?>
......@@ -683,7 +683,7 @@ class Webservice_model extends CI_Model {
'newline' => "\r\n"
));
$ci->email->from('[email protected]', 'TimeOut');
$ci->email->from('[email protected]', 'TimeOut');
$ci->email->to($email);
$ci->email->subject($subject);
$ci->email->message($message);
......@@ -729,7 +729,7 @@ class Webservice_model extends CI_Model {
$sql = "SELECT TC.category_id,TC.category_name,TC.category_image
FROM translator_category AS TC
INNER JOIN event_category AS ECAT ON (ECAT.cat_id=TC.category_id)
WHERE ECAT.status = 1 AND (TC.language_code='$lang' OR TC.language_code='EN')
WHERE ECAT.status = 1 AND TC.language_code='$lang'
$where
GROUP BY ECAT.cat_id ORDER BY ECAT.priority";
$result = $this->db->query($sql)->result();
......@@ -814,7 +814,7 @@ class Webservice_model extends CI_Model {
$sql = "SELECT TREG.region_name FROM region AS REG
INNER JOIN translator_region AS TREG ON (TREG.region_id = REG.id)
WHERE REG.status='1' AND REG.id='$city_id' AND
(TREG.language_code='$lang' OR TREG.language_code='EN')
TREG.language_code='$lang'
GROUP BY REG.id";
$re = $this->db->query($sql)->row();
$cityName = $re->region_name;
......@@ -826,7 +826,7 @@ class Webservice_model extends CI_Model {
FROM region AS REG
INNER JOIN translator_region AS TREG ON (TREG.region_id = REG.id)
WHERE REG.status = '1' AND
(TREG.language_code='$lang' OR TREG.language_code='EN')
TREG.language_code='$lang'
HAVING distance < ".$radius."
ORDER BY distance ASC LIMIT 1")->row_array();
if(!empty($data)){
......@@ -1428,19 +1428,28 @@ class Webservice_model extends CI_Model {
translator_event.event_name,booking.qrcode AS event_image,
venue.location,event_date_time.time,booking.event_id,
booking.no_of_ticket AS ticket_count,events.has_payment,
booking.status AS booking_status
booking.status AS booking_status,transaction.status AS transaction_status
FROM booking
INNER JOIN events ON booking.event_id = events.event_id
INNER JOIN event_date_time ON booking.event_date_id = event_date_time.id
INNER JOIN venue ON venue.id = events.venue_id
INNER JOIN translator_event ON translator_event.event_id=events.event_id
WHERE booking.customer_id = '$user_id' AND booking.status IN(0,1,2,6)
LEFT JOIN transaction ON transaction.booking_id=booking.bookId
WHERE booking.customer_id = '$user_id' AND booking.status IN (0,1,2,6)
AND (translator_event.language_code='$lang' OR
translator_event.language_code='EN')
GROUP BY booking.id
ORDER BY booking.id DESC
LIMIT $page_limit, $per_page";
$result = $this->db->query($sql)->result_array();
if(!empty($result)){
foreach ($result AS $key => $value) {
if($value['has_payment'] == '1' && $value['transaction_status'] != '1'){
unset($result[$key]);
}
}
$result = array_values($result);
}
$meta = array('total_pages'=>ceil($count/$per_page),
'total'=>$count,
'current_page'=>$page,
......@@ -1594,7 +1603,7 @@ class Webservice_model extends CI_Model {
TCAT.category_image AS category_image
FROM event_category AS ECAT
INNER JOIN translator_category AS TCAT ON (TCAT.category_id=ECAT.cat_id)
WHERE ECAT.status = 1
WHERE ECAT.status = 1 AND TCAT.language_code='$lang'
GROUP BY ECAT.cat_id
ORDER BY ECAT.priority";
$category = $this->db->query($sql)->result();
......@@ -2185,7 +2194,7 @@ class Webservice_model extends CI_Model {
$sql = "SELECT CUST.customer_id AS user_id,CUST.name,CUST.profile_image AS user_image,CUST.cust_lat AS latitude,CUST.cust_lng AS longitude, (((acos(sin((".$data['latitude']."*pi()/180)) * sin((CUST.cust_lat*pi()/180)) + cos((".$data['latitude']."*pi()/180)) * cos((CUST.cust_lat*pi()/180)) * cos(((".$data['longitude']." - CUST.cust_lng)*pi()/180))))*180/pi())*60*1.1515) as distance
FROM customer AS CUST
INNER JOIN users AS USR ON (USR.id = CUST.customer_id)
WHERE USR.user_type='3' AND USR.status='1'
WHERE USR.user_type='3' AND USR.status='1' AND CUST.enable_chat='1'
HAVING distance < 5";
$result = $this->db->query($sql);
if(!empty($result) && !empty($result = $result->result_array())){
......
......@@ -68,7 +68,11 @@
case 3: echo 'Pending'; break;
case 4: echo 'Deleted'; break;
case 5: echo 'Payment Failed'; break;
case 6: echo 'Waiting for Aproval'; break;
case 6: if($booking->has_payment == 0){ echo 'Waiting for Aproval'; break; }
else {
if ($booking->trans_status == '1') { echo 'Waiting for Aproval'; break; }
else { echo 'Pending'; break; }
}
}
?>
</th>
......@@ -78,9 +82,17 @@
<i class="fa fa-fw fa-eye"></i>View
</a> <br>
<?php
if(($this->session->userdata('user_type')==1 && $booking->provider_id==1 &&
$booking->book_status=='6') ||
($this->session->userdata('user_type')==2 && $booking->book_status=='6')){
if(
(
($this->session->userdata('user_type')==1 && $booking->provider_id==1 &&
$booking->book_status=='6') ||
($this->session->userdata('user_type')==2 && $booking->book_status=='6')
) &&
(
($booking->has_payment == 0) ||
($booking->has_payment == 1 && $booking->trans_status == '1')
)
){
$msg = "Are you sure to Aprove this booking ?";
$bookId = encode_param($booking->booking_id);
$param = "{'booking_id':'$bookId','alertMsg':'$msg'}"; ?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment