diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index b4865c58..36f1f91e 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -7466,7 +7466,18 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() $rental_count_id = isset($records['rental_count_id']) && $records['rental_count_id'] ? $records['rental_count_id'] : null; //$location = isset($records['link']) ? $records['link'] : null; //echo $rental_count_id;die(); - $res = $this->saveBase64Images($records['pd_id'],$records['formid'],$company_id,$rental_count_id,$records['images']); + if(isset($records['images'][0]['pd_document_id']) && $records['images'][0]['pd_document_id'] !=null && $records['images'][0]['pd_document_id'] != ""){ + $where_condition_array = array('pd_document_id' => $records['images'][0]['pd_document_id']); + $to_update = array("pd_image_alias_name"=>$records['images'][0]['pd_image_alias_name']); + $res['count'] = $this->PD_Model->updateRecords($to_update,PDDOCUMENTS,$where_condition_array); + $res['msg'] = "Updated"; + $data['uri'] = null; + } + else if(isset($records['images'][0]['image'])){ + $res = $this->saveBase64Images($records['pd_id'],$records['formid'],$company_id,$rental_count_id,$records['images']); + } + + //print_r($res); if(count($res)) { @@ -9192,7 +9203,6 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() public function uploadPDPhotosByApplicant_post() { $records = $this->post('records'); - //print_r($records);die(); $img_array = array(); $current_doc_title = null; $pd_master_details = $this->PD_Model->getPDMasterDetails($records['fk_pd_id']); @@ -9291,16 +9301,23 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() if(!$records['is_multiple'] || isset($records['pd_document_id'])) { $where_condition_array = array('fk_pd_id' => $records['fk_pd_id'],'fk_form_id' => $records['fk_form_id'],'pd_document_title' => $current_doc_title); - if(isset($records['pd_document_id']) && isset($records['retake_flag']) && $records['retake_flag']) + if(isset($records['pd_document_id']) && isset($records['retake_flag']) && $records['retake_flag']) { $where_condition_array = array('pd_document_id' => $records['pd_document_id']); unset($records['pd_document_id']); unset($records['retake_flag']) ; + $to_update = array('isactive' => 0,'retake_flag' => 0); } - $this->PD_Model->updateRecords(array('isactive' => 0,'retake_flag' => 0),PDDOCUMENTS,$where_condition_array); - // print_r($this->db->last_query()); + else if(isset($records['pd_document_id']) && $records['pd_document_id'] !=null && $records['pd_document_id'] != "" && $records['image'] == ""){ + $where_condition_array = array('pd_document_id' => $records['pd_document_id']); + $to_update = array("pd_image_alias_name"=>$records['pd_image_alias_name']); + } + $res = $this->PD_Model->updateRecords($to_update,PDDOCUMENTS,$where_condition_array); } + if($records['image'] != ""){ $res = $this->saveBase64Images($records['fk_pd_id'],($records['fk_form_id'] ? $records['fk_form_id'] : null),$company_id,$rental_count_id = null,array($img_array)); + } + if($res) { $data['dataStatus'] = true; @@ -9595,7 +9612,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() $current_multiple_img_key = $current_img_key; if(!array_key_exists($current_img_key, $multiple_img_data)) { - $multiple_img_data[$current_img_key] = array('img_key' => $value['pd_document_title'],'img_name' => $this->photo_names[ $value['pd_document_title'] ][0],'img_data' => array(array('img_url' => $value['doc_url'],'img_name' => $value['pd_document_title'],'pd_document_id' => $value['pd_document_id'])),'fk_form_id' => $this->photo_names[ $value['pd_document_title'] ][1],'is_multiple' => $current_img[2],'pd_image_alias_name' =>$value['pd_image_alias_name'] ,'is_name_editable' => $this->photo_names[ $value['pd_document_title'] ][3]); + $multiple_img_data[$current_img_key] = array('img_key' => $value['pd_document_title'],'img_name' => $this->photo_names[ $value['pd_document_title'] ][0],'img_data' => array(array('img_url' => $value['doc_url'],'img_name' => $value['pd_document_title'],'pd_document_id' => $value['pd_document_id'],'pd_image_alias_name' =>$value['pd_image_alias_name'] ,'is_name_editable' => $value['is_name_editable'])),'fk_form_id' => $this->photo_names[ $value['pd_document_title'] ][1],'is_multiple' => $current_img[2],'pd_image_alias_name' =>$value['pd_image_alias_name'] ,'is_name_editable' => $this->photo_names[ $value['pd_document_title'] ][3]); } else {