Skip to content

Commit

Permalink
Merge pull request #711 from EugenDipner/master
Browse files Browse the repository at this point in the history
to fix delete functionality for invoice and others, where the option …
  • Loading branch information
EugenDipner committed Jun 21, 2022
2 parents e6b18b3 + d99aef9 commit 2d40106
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
3 changes: 2 additions & 1 deletion layouts/vlayout/modules/Vtiger/resources/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ jQuery.Class("Vtiger_List_Js",{
var postData = {
"module": module,
"action": "DeleteAjax",
"operation": "deleteevent",
"record": recordId,
"parent": app.getParentModuleName()
}
Expand All @@ -527,7 +528,7 @@ jQuery.Class("Vtiger_List_Js",{
function(data){
progressIndicatorElement.progressIndicator({
'mode' : 'hide'
})
});
if(data.success) {
var orderBy = jQuery('#orderBy').val();
var sortOrder = jQuery("#sortOrder").val();
Expand Down
19 changes: 15 additions & 4 deletions modules/Vtiger/actions/DeleteAjax.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public function process(Vtiger_Request $request) {
$response->emit();
exit;

}else if($operation == "deleteevent"){
}
/*else if($operation == "deleteevent" ){
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
$recordModel->delete();
Expand All @@ -36,7 +37,8 @@ public function process(Vtiger_Request $request) {
$response->emit();
exit;
}else if($operation == "deleteManyEvents"){
}*/
else if($operation == "deleteManyEvents"){

$idsReferencesArray = $request->get('idsReferencesArray');
for($a = 0; $a < count($idsReferencesArray) ; $a++){
Expand All @@ -52,8 +54,17 @@ public function process(Vtiger_Request $request) {
$response->emit();
exit;

}else{
// it cannot step here, $operation must be given in request. error.
}
else{
//// it cannot step here, $operation must be given in request. error.
//// but because it are often not writen in request, we need to have a way to delete it anyway.
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
$recordModel->delete();

$cvId = $request->get('viewname');
$response = new Vtiger_Response();
$response->setResult(array('viewname'=>$cvId, 'module'=>$moduleName));
$response->emit();
exit;
}
}
Expand Down

0 comments on commit 2d40106

Please sign in to comment.