Files
luos/workflow/engine/methods/cases/cases_Delete.php

45 lines
1.2 KiB
PHP
Raw Normal View History

<?php
/**
* cases_Delete.php
*
2020-01-06 14:30:41 -04:00
* Delete case from the cases List option
*
2020-01-06 14:30:41 -04:00
* @link https://wiki.processmaker.com/3.3/Roles#PM_DELETECASE
*/
2020-01-06 14:30:41 -04:00
use ProcessMaker\BusinessModel\Cases;
switch ($RBAC->userCanAccess( 'PM_CASES' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
try {
2020-01-06 14:30:41 -04:00
if (isset($_POST['APP_UIDS'])) {
$cases = explode(',', $_POST['APP_UIDS']);
foreach ($cases as $appUid) {
$case = new Cases();
$case->deleteCase($appUid, $_SESSION['USER_LOGGED']);
}
2020-01-06 14:30:41 -04:00
// Prepare the response successfully
if (count($cases) == 1) {
G::outRes(G::outRes(G::LoadTranslation('ID_CASE_DELETE_SUCCESFULLY')));
} else {
2020-01-06 14:30:41 -04:00
G::outRes(G::outRes(G::LoadTranslation('ID_CASES_DELETE_SUCCESFULLY')));
}
}
} catch (Exception $e) {
2016-07-27 16:37:21 -04:00
$token = strtotime("now");
PMException::registerErrorLog($e, $token);
2020-01-06 14:30:41 -04:00
G::outRes($e->getMessage());
2010-12-02 23:34:41 +00:00
}