QUES MASTER FUNC ADDED

This commit is contained in:
velz 2018-09-27 15:51:29 +05:30
parent 1455f95360
commit d5fc15dd4a
4 changed files with 63 additions and 15 deletions

View File

@ -86,7 +86,7 @@ defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest auto
// define login route name for token verification // define login route name for token verification
//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors
defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'triggerNewPD'); // no errors defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getListOfProducts'); // no errors
/*********************AWS resources Constants*************************************************/ /*********************AWS resources Constants*************************************************/
defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic');

View File

@ -93,6 +93,7 @@ $route['saveTemplateCategoryDetails'] = 'Template_Management_Controller/saveTemp
$route['(listAllQuestions/:any)'] = 'Question_Management_Controller/listAllQuestions/'; $route['(listAllQuestions/:any)'] = 'Question_Management_Controller/listAllQuestions/';
$route['saveNewQuestion'] = 'Question_Management_Controller/saveNewQuestion'; $route['saveNewQuestion'] = 'Question_Management_Controller/saveNewQuestion';
$route['saveExistQuestion'] = 'Question_Management_Controller/saveExistQuestion'; $route['saveExistQuestion'] = 'Question_Management_Controller/saveExistQuestion';
$route['updateAnswerStatus'] = 'Question_Management_Controller/updateAnswerStatus';
//ENTITY MANAGEMENT //ENTITY MANAGEMENT
$route['listAllEntites'] = 'Entity_Management_Controller/listAllEntites'; $route['listAllEntites'] = 'Entity_Management_Controller/listAllEntites';
@ -103,4 +104,9 @@ $route['saveExistEntity'] = 'Entity_Management_Controller/saveExistEntity';
$route['triggerNewPD'] = 'PD_Controller/triggerNewPD'; $route['triggerNewPD'] = 'PD_Controller/triggerNewPD';
$route['updateExistPD'] = 'PD_Controller/updateExistPD'; $route['updateExistPD'] = 'PD_Controller/updateExistPD';
$route['(listLessPDDetails/:any)'] = 'PD_Controller/listLessPDDetails/'; $route['(listLessPDDetails/:any)'] = 'PD_Controller/listLessPDDetails/';
$route['getListOfProducts'] = 'PD_Controller/getListOfProducts';
$route['getListOfLenders'] = 'PD_Controller/getListOfLenders';
$route['getListOfCustomerSegments'] = 'PD_Controller/getListOfCustomerSegments';
$route['getListOfPDAllocationTypes'] = 'PD_Controller/getListOfPDAllocationTypes';
$route['getListOfStatesAndCities'] = 'PD_Controller/getListOfStatesAndCities';

View File

@ -172,10 +172,10 @@ class PD_Controller extends REST_Controller {
/********For Save New PD while Trigger****/ /********For Save New PD while Trigger****/
public function triggerNewPD_post() public function triggerNewPD_post()
{ {
echo "TRIGGER"; //echo "TRIGGER";
//$this->aws_ses->verifyEmailIdentity('raro@spindl-e.com'); //$this->aws_ses->verifyEmailIdentity('raro@spindl-e.com');
//$this->aws_ses->sendMail('raro@spindl-e.com'); //$this->aws_ses->sendMail('raro@spindl-e.com');
die(); //die();
$pd_details = json_decode($this->post('pd_details'),true); $pd_details = json_decode($this->post('pd_details'),true);
$pd_applicant_details = json_decode($this->post('pd_applicant_details'),true); $pd_applicant_details = json_decode($this->post('pd_applicant_details'),true);
$pd_document_titles = json_decode($this->post('pd_document_titles'),true); $pd_document_titles = json_decode($this->post('pd_document_titles'),true);

View File

@ -64,13 +64,16 @@ class Question_Management_Controller extends REST_Controller {
if($question_id != '' || $question_id != null) if($question_id != '' || $question_id != null)
{ {
//$count++; //$count++;
foreach($answers as $answer) if(count($answers))
{ {
foreach($answers as $answer)
{
$temp_answers = array('fk_question_id' => $question_id, 'answer' =>$answer['answer'] , 'createdon' =>$records['createdon'] , 'fk_createdby' =>$records['fk_createdby']);
$child_id = $this->Question_Management_Model->saveRecords($temp_answers,QUESTIONANSWERS);
$temp_answers = array('fk_question_id' => $question_id, 'answer' =>$answer['answer'] , 'createdon' =>$records['createdon'] , 'fk_createdby' =>$records['fk_createdby']);
$child_id = $this->Question_Management_Model->saveRecords($temp_answers,QUESTIONANSWERS);
}
} }
} }
@ -107,14 +110,27 @@ class Question_Management_Controller extends REST_Controller {
} }
$where_condtion_array = array('question_id'=>$records['question_id']); $where_condtion_array = array('question_id'=>$records['question_id']);
$affected_rows = $this->db->updateRecords($records,QUESTIONS,$where_condtion_array); $affected_rows = $this->Question_Management_Model->updateRecords($records,QUESTIONS,$where_condtion_array);
$affected_rows_child = 0; $affected_rows_child = 0;
foreach($answers as $answer)
{
$where_condtion_array = array('question_answer_id'=>$answer['question_answer_id']);
$affected_rows_child = $this->db->updateRecords($answer,QUESTIONANSWERS,$where_condtion_array);
}
if(count($answers))
{
foreach($answers as $answer)
{
if($answer['question_answer_id'] != null || $answer['question_answer_id'] != '')
{
$where_condtion_array = array('question_answer_id'=>$answer['question_answer_id']);
$answer['updatedon'] = $records['updatedon'];
$answer['fk_updatedby'] = $records['fk_updatedby'];
$affected_rows_child = $this->Question_Management_Model->updateRecords($answer,QUESTIONANSWERS,$where_condtion_array);
}
else
{
$temp_answers = array('fk_question_id' => $records['question_id'], 'answer' =>$answer['answer'] , 'createdon' =>$records['updatedon'] , 'fk_createdby' =>$records['fk_updatedby']);
$child_id = $this->Question_Management_Model->saveRecords($temp_answers,QUESTIONANSWERS);
}
}
}
if($affected_rows == 1) //&& (count($answers) == $affected_rows_child)) if($affected_rows == 1) //&& (count($answers) == $affected_rows_child))
{ {
$data['dataStatus'] = true; $data['dataStatus'] = true;
@ -133,6 +149,32 @@ class Question_Management_Controller extends REST_Controller {
} }
} }
/* ******** For Updated isActive status of ansewrs only ******/
public function updateAnswerStatus()
{
$records = $this->post('records');
$where_condtion_array = array('question_answer_id' => $records['question_answer_id']);
$affected_rows = $this->Question_Management_Model->updateRecords($records,QUESTIONANSWERS,$where_condtion_array);
if($affected_rows == 1) //&& (count($answers) == $affected_rows_child))
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['record'] = $affected_rows;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
$this->response($data,REST_Controller::HTTP_OK);
}
}
} }