PD PROCESS2
This commit is contained in:
parent
ed987e9443
commit
a5af9c2d52
@ -1094,26 +1094,46 @@ class PD_Controller extends REST_Controller {
|
||||
$pd_detail_id = $this->PD_Model->updateRecords($record,PDDETAIL,$where_condition_array);
|
||||
|
||||
// ANSWERS SAVE - pd_detail_answer_id, fk_pd_id, fk_pd_detail_id, pd_answer_id, pd_answer, pd_answer_weightage, pd_answer_remark
|
||||
if(count($answers_array))
|
||||
{
|
||||
foreach($answers_array as $answer_key => $answer)
|
||||
{
|
||||
if($answer['pd_detail_answer_id'] != "" || $answer['pd_detail_answer_id'] != null)
|
||||
if($answer['pd_detail_answer_id'] == "" || $answer['pd_detail_answer_id'] == null)
|
||||
{
|
||||
$where_condition_array = array('pd_detail_answer_id'=>$answer['pd_detail_answer_id']);
|
||||
$pd_detail_answer_id = $this->PD_Model->updateRecords($answer,PDANSWER,$where_condition_array);
|
||||
if($pd_detail_answer_id != "" || $pd_detail_answer_id != null){ $answer_count++; }
|
||||
|
||||
//Deactivate Old Answers
|
||||
$fields = array('pd_detail_answer_id');
|
||||
$where_condition_array = array('fk_pd_id' => $answer['fk_pd_id'],'fk_pd_detail_id' => $answer['fk_pd_detail_id']);
|
||||
$old_answers = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,ENTITY);
|
||||
|
||||
foreach($old_answers as $old)
|
||||
{
|
||||
$where_condition_array = array('pd_detail_answer_id'=>$old['pd_detail_answer_id']);
|
||||
$temp_array = array('isactive' => 0);
|
||||
$pd_detail_answer_id = $this->PD_Model->updateRecords($temp_array,PDANSWER,$where_condition_array);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//INsert New Answers
|
||||
$answer['fk_pd_detail_id'] = $record['pd_detail_id'];
|
||||
$pd_detail_answer_id = $this->PD_Model->saveRecords($answer,PDANSWER);
|
||||
if($pd_detail_answer_id != "" || $pd_detail_answer_id != null){ $answer_count++; }
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update Current Answer
|
||||
$where_condition_array = array('pd_detail_answer_id'=>$answer['pd_detail_answer_id']);
|
||||
$answer['isactive'] = 1;
|
||||
$pd_detail_answer_id = $this->PD_Model->updateRecords($answer,PDANSWER,$where_condition_array);
|
||||
if($pd_detail_answer_id != "" || $pd_detail_answer_id != null){ $answer_count++; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//IMAGES SAVE - pd_document_id, fk_pd_id, fk_pd_detail_id, pd_document_title, pd_document_name, createdon, fk_createdby, updatedon, fk_updatedby
|
||||
|
||||
if(count($images_array))
|
||||
{
|
||||
foreach($images_array as $image_key => $image)
|
||||
{
|
||||
|
||||
@ -1158,6 +1178,7 @@ class PD_Controller extends REST_Controller {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(($pd_detail_id != "" || $pd_detail_id != null) && count($images_array) == $image_count && count($answers_array) == $answer_count)
|
||||
{
|
||||
@ -1196,14 +1217,19 @@ class PD_Controller extends REST_Controller {
|
||||
$pd_detail_id = $this->PD_Model->saveRecords($record,PDDETAIL);
|
||||
|
||||
// ANSWERS SAVE - pd_detail_answer_id, fk_pd_id, fk_pd_detail_id, pd_answer_id, pd_answer, pd_answer_weightage, pd_answer_remark
|
||||
if(count($answers_array))
|
||||
{
|
||||
foreach($answers_array as $answer_key => $answer)
|
||||
{
|
||||
$answer['fk_pd_detail_id'] = $pd_detail_id;
|
||||
$pd_detail_answer_id = $this->PD_Model->saveRecords($answer,PDANSWER);
|
||||
if($pd_detail_answer_id != "" || $pd_detail_answer_id != null){ $answer_count++; }
|
||||
}
|
||||
}
|
||||
|
||||
//IMAGES SAVE - pd_document_id, fk_pd_id, fk_pd_detail_id, pd_document_title, pd_document_name, createdon, fk_createdby, updatedon, fk_updatedby
|
||||
if(count($images_array))
|
||||
{
|
||||
foreach($images_array as $image_key => $image)
|
||||
{
|
||||
|
||||
@ -1249,8 +1275,9 @@ class PD_Controller extends REST_Controller {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(($pd_detail_id != "" || $pd_detail_id != null) && count($images_array) == $image_count && count($answers) == $answer_count)
|
||||
if(($pd_detail_id != "" || $pd_detail_id != null) && count($images_array) == $image_count && count($answers_array) == $answer_count)
|
||||
{
|
||||
|
||||
$data['dataStatus'] = true;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user