pd video exsiting delete : ps

This commit is contained in:
VE10-Sanjeev 2022-11-02 22:46:39 +05:30
parent 81ff52ae83
commit 25d306ca88

View File

@ -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{