You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
131 lines
4.8 KiB
PHP
131 lines
4.8 KiB
PHP
<?php
|
|
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
|
|
class Confirm extends CI_Controller
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model('Order_model');
|
|
}
|
|
|
|
public function index($COLI_SN,$visitor_link,$token)
|
|
{
|
|
$data=array();
|
|
if (empty($COLI_SN) || strtoupper(md5($visitor_link))!=strtoupper($token)) {
|
|
$this->load->view('link_tips', $data);
|
|
return false;
|
|
}
|
|
|
|
$data['visitor_link']=$visitor_link;
|
|
$data['userinfo']=$this->Order_model->get_customer_info($COLI_SN);
|
|
$data['username']='';
|
|
if (!empty($data['userinfo'])) {
|
|
foreach ($data['userinfo'] as $v) {
|
|
if ($v->CUL_IsLinkMan==1) {
|
|
$data['username']=$v->MEI_FirstName;
|
|
}
|
|
}
|
|
}else{
|
|
$this->load->view('link_tips', $data);
|
|
return false;
|
|
}
|
|
|
|
$visitor_link_arr=$this->Order_model->get_visitor_link($COLI_SN);
|
|
foreach ($visitor_link_arr as $l) {
|
|
if ($visitor_link==$l->visitor_link) {
|
|
$this->load->view('link_tips', $data);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
$this->load->view('confirm_order', $data);
|
|
}
|
|
|
|
public function save_confirm_info()
|
|
{
|
|
//客人信息
|
|
$gender=$this->input->post('gender');
|
|
$given_name=$this->input->post('given_name');
|
|
$birthday=$this->input->post('birthday');
|
|
$passport=$this->input->post('passport');
|
|
$expiration_date=$this->input->post('passport_expiration_date');
|
|
$nationality=$this->input->post('nationality');
|
|
$contact_phone='座机:'.$this->input->post('landline').'/手机:'.$this->input->post('mobile');
|
|
$COLI_SN=$this->input->post('COLI_SN');
|
|
$visitor_link=$this->input->post('visitor_link');
|
|
$COLI_ID=$this->input->post('COLI_ID');
|
|
|
|
//已经确认过
|
|
$had_save=$this->Order_model->get_visitor_link($COLI_SN,$visitor_link);
|
|
if(!empty($had_save)){
|
|
echo 3;
|
|
return;
|
|
}
|
|
|
|
foreach ($this->input->post('sur_name') as $key => $name)
|
|
{
|
|
if (!empty($name)) {
|
|
if ($this->input->post('home_address')!='') {
|
|
$MEI_Street=$this->input->post('home_address');
|
|
}elseif($this->input->post('address_street')){
|
|
$MEI_Street=$this->input->post('address_street').','.$this->input->post('address_city').','.$this->input->post('address_state').','.$this->input->post('address_country');
|
|
}else{
|
|
$MEI_Street='';
|
|
}
|
|
$MEI_FirstName=$given_name[$key];
|
|
$MEI_LastName=$name;
|
|
|
|
if ($this->input->post('arrive_flight')) {
|
|
$CUL_Memo = 'Arrival China Flight No : '
|
|
.$this->input->post('arrive_flight')
|
|
.' & Arrival time : '
|
|
.$this->input->post('arrive_time')
|
|
.' & Departure China Flight no : '
|
|
.$this->input->post('departure_flight')
|
|
.' & Departure time : '
|
|
.$this->input->post('depart_time');
|
|
}else{
|
|
$CUL_Memo='';
|
|
}
|
|
|
|
$MEI_Memo=$this->input->post('special_request').' '.$CUL_Memo;
|
|
|
|
$birthday[$key]=date('Y-m-d H:i:s',strtotime($birthday[$key]));
|
|
$expiration_date[$key]=date('Y-m-d H:i:s',strtotime($expiration_date[$key]));
|
|
|
|
$MEI_SN=$this->Order_model->add_customer_info($gender[$key],$nationality[$key],$MEI_FirstName,$MEI_LastName,$passport[$key],$expiration_date[$key],$birthday[$key],$MEI_Memo,$MEI_Street,'',$contact_phone,0,$COLI_SN,$visitor_link);
|
|
}
|
|
}
|
|
|
|
if ($MEI_SN && $this->input->post('emergency_person_name')!='') {
|
|
$add_emergency_res=$this->Order_model->add_customer_info(
|
|
'',
|
|
'',
|
|
$this->input->post('emergency_person_name'),
|
|
'',
|
|
'',
|
|
'',
|
|
'',
|
|
$this->input->post('emergency_relationship'),
|
|
'',
|
|
$this->input->post('emergency_email'),
|
|
$this->input->post('emergency_telephone'),
|
|
1,
|
|
$COLI_SN,
|
|
$visitor_link
|
|
);
|
|
}
|
|
|
|
if ($MEI_SN) {
|
|
$this->Order_model->send_mail('chinahighlights', 'service@chinahighlights.com', $this->input->post('toname'), $this->input->post('tomail'), $COLI_ID.' 团个人信息导入HT', $COLI_ID.' 团个人信息导入HT','China Highlights',$M_Web='CHT');
|
|
echo 1;
|
|
}else{
|
|
echo 0;
|
|
}
|
|
}
|
|
|
|
} |