| Line 1437... |
Line 1437... |
| 1437 |
|
1437 |
|
| 1438 |
public function admin_addretailer(){
|
1438 |
public function admin_addretailer(){
|
| 1439 |
|
1439 |
|
| 1440 |
|
1440 |
|
| 1441 |
if ($this->request->is('post')) {
|
1441 |
if ($this->request->is('post')) {
|
| - |
|
1442 |
$agentid = Configure::read('agentid');
|
| 1442 |
$cur_date = date('Y-m-d H:i:s', time());
|
1443 |
$cur_date = date('Y-m-d H:i:s', time());
|
| 1443 |
$data = $this->request->data['Retailer'];
|
1444 |
$data = $this->request->data['Retailer'];
|
| 1444 |
$retailer['Retailer']['identifier'] = NULL;
|
1445 |
$retailer['Retailer']['identifier'] = NULL;
|
| 1445 |
$retailer['Retailer']['title'] = $data['storeName'];
|
1446 |
$retailer['Retailer']['title'] = $data['storeName'];
|
| 1446 |
$retailer['Retailer']['address'] = $data['completeAddress'];
|
1447 |
$retailer['Retailer']['address'] = $data['completeAddress'];
|
| Line 1467... |
Line 1468... |
| 1467 |
|
1468 |
|
| 1468 |
$this->loadModel('Retailer');
|
1469 |
$this->loadModel('Retailer');
|
| 1469 |
$this->Retailer->create();
|
1470 |
$this->Retailer->create();
|
| 1470 |
if ($retdata = $this->Retailer->save($retailer)) {
|
1471 |
if ($retdata = $this->Retailer->save($retailer)) {
|
| 1471 |
$this->Session->setFlash(__('The user has been saved'));
|
1472 |
$this->Session->setFlash(__('The user has been saved'));
|
| 1472 |
$callhistoryquery = "insert into callhistory (retailer_id,agent_id,mobile_number,call_type,sms_verified,call_time,duration_sec,last_fetch_time,call_disposition,disposition_description,disposition_comments,created) values (".$retdata['Retailer']['id'].",'2','".$retailer['Retailer']['contact1']."','inbound',1,'".$cur_date."',0,'".$cur_date."','verified_link_sent','autosms of code will be sent','autosms of code will be sent','".$cur_date."')";
|
1473 |
$callhistoryquery = "insert into callhistory (retailer_id,agent_id,mobile_number,call_type,sms_verified,call_time,duration_sec,last_fetch_time,call_disposition,disposition_description,disposition_comments,created) values (".$retdata['Retailer']['id'].",".$agentid.",'".$retailer['Retailer']['contact1']."','inbound',1,'".$cur_date."',0,'".$cur_date."','verified_link_sent','autosms of code will be sent','autosms of code will be sent','".$cur_date."')";
|
| 1473 |
$contactquery = "insert into retailercontacts (retailer_id,agent_id,mobile_number,contact_type,call_type,created) values (".$retdata['Retailer']['id'].",2,'".$retailer['Retailer']['contact1']."','sms','inbound','".date('Y-m-d h:i:s', time())."')";
|
1474 |
$contactquery = "insert into retailercontacts (retailer_id,agent_id,mobile_number,contact_type,call_type,created) values (".$retdata['Retailer']['id'].",".$agentid.",'".$retailer['Retailer']['contact1']."','sms','inbound','".date('Y-m-d h:i:s', time())."')";
|
| 1474 |
$this->User->query($contactquery);
|
1475 |
$this->User->query($contactquery);
|
| 1475 |
$this->User->query($callhistoryquery);
|
1476 |
$this->User->query($callhistoryquery);
|
| 1476 |
$this->redirect('userretailer');
|
1477 |
$this->redirect('userretailer');
|
| 1477 |
} else {
|
1478 |
} else {
|
| 1478 |
$this->Session->setFlash(__('The user could not be saved. Please, try again.'));
|
1479 |
$this->Session->setFlash(__('The user could not be saved. Please, try again.'));
|
| 1479 |
}
|
1480 |
}
|
| 1480 |
}
|
1481 |
}
|
| 1481 |
}
|
1482 |
}
|
| 1482 |
|
1483 |
|
| 1483 |
public function getcode($id){
|
1484 |
public function getcode($id){
|
| - |
|
1485 |
$agentid = Configure::read('agentid');
|
| 1484 |
$this->autoRender = false;
|
1486 |
$this->autoRender = false;
|
| 1485 |
$this->request->onlyAllow('ajax');
|
1487 |
$this->request->onlyAllow('ajax');
|
| 1486 |
$url = $this->apihost."getDtrLink/2/fresh/".$id;
|
1488 |
$url = $this->apihost."getDtrLink/".$agentid."/fresh/".$id;
|
| 1487 |
$response = $this->make_request($url,null);
|
1489 |
$response = $this->make_request($url,null);
|
| 1488 |
|
1490 |
|
| 1489 |
return json_encode($response['result']);
|
1491 |
return json_encode($response['result']);
|
| 1490 |
|
1492 |
|
| 1491 |
}
|
1493 |
}
|