From 25d306ca88bec83857b03291b3fe904a17fad60e Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Wed, 2 Nov 2022 22:46:39 +0530 Subject: [PATCH] pd video exsiting delete : ps --- api/application/controllers/PD_Controller.php | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 50619ff1..93624a0d 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -8497,6 +8497,7 @@ class PD_Controller extends REST_Controller if(isset($records['content_type']) && $records['content_type'] == 2){ // echo "VT".$records['content_type']; + log_message('ERROR', '### PD VIDEO called ; type = ' . $records['content_type']); $img_array['pd_image_alias_name'] = isset($records['pd_image_alias_name']) ? $records['pd_image_alias_name'] : null; $img_array['image_key'] = $records['image_key']; $img_array['link'] = isset($records['link']) ? $records['link'] : null; @@ -8504,9 +8505,28 @@ class PD_Controller extends REST_Controller $img_array['Name'] = isset($records['name']) ? $records['name'] : $records['image_key']; $img_array['content_type'] = isset($records['content_type']) ? $records['content_type'] : null; if($records['image']){ + $where_condition_array = array('fk_pd_id' => $records['fk_pd_id'], 'fk_form_id' => $records['fk_form_id'], 'image_key' => $records['image_key']); + 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); + } 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']); + } else { + $to_update = array('isactive' => 0, 'retake_flag' => 0); + } + // print_r($to_update); + // print_r($where_condition_array); + $update = $this->PD_Model->updateRecords($to_update, PDDOCUMENTS, $where_condition_array); + log_message('ERROR', '### PD VIDEO exist-update ' . $update); + // $res = 1; $res = $this->saveBase64Video($records['fk_pd_id'], ($records['fk_form_id'] ? $records['fk_form_id'] : null), array($img_array)); }else{ - $res = array(); + log_message('ERROR', '### PD VIDEO Not Saved. Due to Base64 Format Missing'); + $res['status'] = true; + $res['msg'] = "Video Not Saved. Due to Base64 Format Missing."; } }//Video Type End Here content type = 2 else{