PMCORE-490
This commit is contained in:
@@ -200,9 +200,11 @@ class Ajax
|
||||
} else {
|
||||
$options[] = ['text' => G::LoadTranslation('ID_UNPAUSE'), 'fn' => 'unpauseCase'];
|
||||
}
|
||||
|
||||
$options[] = ['text' => G::LoadTranslation('ID_DELETE'), 'fn' => 'deleteCase'];
|
||||
|
||||
// Check if the user has the permission for the action Delete Case
|
||||
if ($RBAC->userCanAccess('PM_DELETECASE') == 1) {
|
||||
$options[] = ['text' => G::LoadTranslation('ID_DELETE'), 'fn' => 'deleteCase'];
|
||||
}
|
||||
// Check if the user has the permission for the action Reassign Case
|
||||
if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1 || $RBAC->userCanAccess('PM_REASSIGNCASE_SUPERVISOR') == 1) {
|
||||
if (!AppDelay::isPaused($appUid, $index)) {
|
||||
$options[] = ['text' => G::LoadTranslation('ID_REASSIGN'), 'fn' => 'getUsersToReassign'];
|
||||
|
||||
@@ -188,6 +188,9 @@ $reassignCaseSup = ($RBAC->userCanAccess('PM_REASSIGNCASE_SUPERVISOR') == 1) ? '
|
||||
$headPublisher->assign('varReassignCase', $reassignCase);
|
||||
$headPublisher->assign('varReassignCaseSupervisor', $reassignCaseSup);
|
||||
|
||||
$deleteCase = ($RBAC->userCanAccess('PM_DELETECASE') == 1) ? 'true' : 'false';
|
||||
$headPublisher->assign('varDeleteCase', $deleteCase);
|
||||
|
||||
$c = new Configurations();
|
||||
$headPublisher->addExtJsScript('app/main', true);
|
||||
$headPublisher->addExtJsScript('cases/casesList', false); //adding a javascript file .js
|
||||
|
||||
@@ -2,26 +2,13 @@
|
||||
/**
|
||||
* cases_Delete.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
* Delete case from the cases List option
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
* @link https://wiki.processmaker.com/3.3/Roles#PM_DELETECASE
|
||||
*/
|
||||
/* Permissions */
|
||||
|
||||
use ProcessMaker\BusinessModel\Cases;
|
||||
|
||||
switch ($RBAC->userCanAccess( 'PM_CASES' )) {
|
||||
case - 2:
|
||||
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
|
||||
@@ -35,23 +22,23 @@ switch ($RBAC->userCanAccess( 'PM_CASES' )) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Process the info */
|
||||
try {
|
||||
$oCase = new Cases();
|
||||
if (isset( $_POST['APP_UIDS'] )) {
|
||||
$ids = explode( ',', $_POST['APP_UIDS'] );
|
||||
foreach ($ids as $id) {
|
||||
$oCase->removeCase( $id );
|
||||
if (isset($_POST['APP_UIDS'])) {
|
||||
$cases = explode(',', $_POST['APP_UIDS']);
|
||||
foreach ($cases as $appUid) {
|
||||
$case = new Cases();
|
||||
$case->deleteCase($appUid, $_SESSION['USER_LOGGED']);
|
||||
}
|
||||
if (count( $_POST['APP_UIDS'] ) > 1) {
|
||||
echo 'The Case was deleted successfully';
|
||||
// Prepare the response successfully
|
||||
if (count($cases) == 1) {
|
||||
G::outRes(G::outRes(G::LoadTranslation('ID_CASE_DELETE_SUCCESFULLY')));
|
||||
} else {
|
||||
echo 'All Cases were deleted successfully';
|
||||
G::outRes(G::outRes(G::LoadTranslation('ID_CASES_DELETE_SUCCESFULLY')));
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$token = strtotime("now");
|
||||
PMException::registerErrorLog($e, $token);
|
||||
G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) );
|
||||
G::outRes($e->getMessage());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user