Commit 43c2b010 by Jansa Jose

Merge branch 'master' into 'dev_production'

Master See merge request !253
parents 696d2711 61d5dc8a
......@@ -381,12 +381,12 @@ class Api_model extends CI_Model {
$bookedData = $this->db->query("
SELECT ODR.order_id,ODR.order_type,ODR.booking_id FROM orders AS ODR
LEFT JOIN booking AS BOK ON
(ODR.booking_id=BOK.bookId AND BOK.status IN (0,1,2,3,5,6))
LEFT JOIN flight_booking AS FBK ON
(ODR.booking_id=FBK.flight_book_id AND FBK.status IN (0,1,2,3,5))
LEFT JOIN hotel_booking AS HBK ON
(ODR.booking_id=HBK.hotel_book_id AND HBK.status IN (0,1,2,3,5))
LEFT JOIN booking AS BOK ON (ODR.booking_id=BOK.bookId AND
BOK.status IN (0,1,2,3,5,6))
LEFT JOIN flight_booking AS FBK ON (ODR.booking_id=FBK.flight_book_id AND
FBK.status IN (0,1,2,3,5))
LEFT JOIN hotel_booking AS HBK ON (ODR.booking_id=HBK.hotel_book_id AND
HBK.status IN (0,1,2,3,5))
WHERE ODR.customer_id='$user_id'
GROUP BY ODR.order_id ORDER BY ODR.order_id DESC $cond");
if($per_page == 0 && $page == 0){
......@@ -445,6 +445,7 @@ class Api_model extends CI_Model {
WHERE booking.bookId='$booking_id'";
$eventData = $this->db->query($sql)->row_array();
$eventData['order_type'] = 1;
$evtLang = langTranslator($eventData['event_id'],'EVT');
array_merge($eventData,$evtLang);
......@@ -471,6 +472,7 @@ class Api_model extends CI_Model {
$hotelData['event_time'] = '11:00';
$hotelData['book_id'] = $hotelData['event_id'];
$hotelData['venue_id'] = $hotelData['event_id'];
$hotelData['order_type'] = 2;
$hotelData['has_payment'] = 1;
unset($hotelData['traveller_details']);
return $hotelData;
......@@ -496,6 +498,7 @@ class Api_model extends CI_Model {
unset($flightData['traveller_details'],$flightData['event_date']);
$flightData['event_date'] = (isset($fghtTme[0]) && !empty($fghtTme[0]))?$fghtTme[0]:'';
$flightData['event_time'] = (isset($fghtTme[1]) && !empty($fghtTme[1]))?$fghtTme[1]:'';
$flightData['order_type'] = 3;
$flightData['has_payment'] = 1;
$flightData['book_id'] = $flightData['event_id'];
$flightData['venue_id'] = $flightData['event_id'];
......@@ -581,7 +584,7 @@ class Api_model extends CI_Model {
}
} catch(Exception $e) {
$res = array('status'=>0,'message'=>'Ohh No!! Something went South!!','code'=>'ER06');
$res = array('status'=>0,'message'=>'Ohh No!! Something went South!!','code'=>'ER06');
}
return $res;
}
......@@ -683,6 +686,13 @@ class Api_model extends CI_Model {
$post_data['amount'] = 0;
}
$evtData = $this->db->get_where('event_date_time',array('event_id'=>$post_data['event_id'],
'date'=>$post_data['event_date'],'time'=>$post_data['event_time']));
if(empty($evtData = $evtData->row_array()) || !isset($evtData['id']) ||
empty($post_data['event_date_id'] = $evtData['id'])){
$res = array('status'=>0,'message'=>'Event date or time is invalid','code'=>'ER06');
}
$evtData = $this->db->get_where('events',array('event_id'=>$post_data['event_id']));
$evtData = $evtData->row_array();
if(!empty($evtData) && isset($evtData['approve_booking']) && $evtData['approve_booking']=='1'){
......@@ -702,7 +712,8 @@ class Api_model extends CI_Model {
$auth_token = $post_data['auth_token'];
$card_data = (isset($post_data['cardData']))?$post_data['cardData']:array();
unset($post_data['auth_token'],$post_data['has_payment'],$post_data['cardData'],
$post_data['promocode_id'],$post_data['redeem_amount']);
$post_data['promocode_id'],$post_data['redeem_amount'],$post_data['event_date'],
$post_data['event_time']);
$rs = $this->db->insert('booking', $post_data);
$this->db->insert('orders',array('booking_id'=>$post_data['bookId'],'order_type'=>'1','created_date'=>date('Y-m-d h:i:s'),'customer_id'=>$user_id));
......@@ -2001,4 +2012,4 @@ class Api_model extends CI_Model {
return;
}
}
?>
\ No newline at end of file
?>
......@@ -220,12 +220,6 @@ class Validation_model extends CI_Model {
'message' => 'Event id is null or empty'
)
) ,
'event_date_id' => array(
'required' => array(
'code' => 'ER33',
'message' => 'Event date and time is null or empty'
)
),
'no_of_ticket' => array(
'required' => array(
'code' => 'ER36',
......
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