diff --git a/front/case.form.php b/front/case.form.php index f331552..e2611dd 100644 --- a/front/case.form.php +++ b/front/case.form.php @@ -40,6 +40,22 @@ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') { $locCase->redirectToList(); } else +if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'cancel') { + // cancel case from PM + $locCase = new PluginProcessmakerCase; + $locCase->getFromDB($_POST['cases_id']); + $resultPM = $PM_SOAP->cancelCase($locCase->fields['case_guid']); + if ($resultPM->status_code === 0) { + if ($locCase->cancelCase()) { + Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['cancelled'], true, INFO); + } else { + Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errorcancelled'], true, ERROR); + } + } else { + Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errorcancelled'], true, ERROR); + } + Html::back(); +} else if (isset( $_REQUEST['form'] ) && isset( $_REQUEST['form']['BTN_CATCH'] ) && isset( $_REQUEST['form']['APP_UID'])) { // Claim task management // here we are in a Claim request diff --git a/inc/case.class.php b/inc/case.class.php index 922712a..d6041a8 100644 --- a/inc/case.class.php +++ b/inc/case.class.php @@ -61,6 +61,10 @@ class PluginProcessmakerCase extends CommonDBTM { return $this->canDeleteItem(); } + static function canCancel() { + return plugin_processmaker_haveRight('case', CANCEL); + } + /** * Summary of getTabNameForItem * @param CommonGLPI $item is the item @@ -258,34 +262,206 @@ class PluginProcessmakerCase extends CommonDBTM { } + /** + * Summary of showCaseProperties + */ + function showCaseProperties() { + global $PM_DB; + + $caseInfo = $this->getCaseInfo(); + if (property_exists($caseInfo, 'currentUsers')) { + $caseInfo->currentUsers = $this->sortTasks($caseInfo->currentUsers, PluginProcessmakerUser::getPMUserId(Session::getLoginUserID())); + } + $query = "SELECT `DEL_INDEX`, `DEL_DELEGATE_DATE` FROM `APP_DELEGATION` WHERE `APP_UID`='{$caseInfo->caseId}'"; + $tasks = []; + foreach($PM_DB->request($query) as $row){ + $tasks[$row['DEL_INDEX']] = $row['DEL_DELEGATE_DATE']; + } + + echo "
"; + + echo "| ".__('Case properties', 'processmaker')." | |||
|---|---|---|---|
| ".__('Process', 'processmaker')." | "; + echo "".$caseInfo->processName." | ||
| ".__('Case title', 'processmaker')." | "; + echo "".$caseInfo->caseName." | ||
| ".__('Case number', 'processmaker')." | "; + echo "".$caseInfo->caseNumber." | ||
| ".__('Case status', 'processmaker')." | "; + echo "".self::getStatus($caseInfo->caseStatus)." | ||
| ".__('Case guid', 'processmaker')." | "; + echo "".$caseInfo->caseId." | ||
| ".__('Creator', 'processmaker')." | "; + echo "".$caseInfo->caseCreatorUserName." | ||
| ".__('Creation date', 'processmaker')." | "; + echo "".$caseInfo->createDate." | ||
| ".__('Last update', 'processmaker')." | "; + echo "".$caseInfo->updateDate." | ||
| ".__('Case description', 'processmaker')." | "; + //echo "".$caseInfo->????." | ||
| ".__('Current task(s) properties', 'processmaker')." | ||||
|---|---|---|---|---|
| ".__('Task', 'processmaker')." | +".__('Task guid', 'processmaker')." | +".__('Current user', 'processmaker')." | +".__('Task delegation date', 'processmaker')." | +|
| ".$currentTask->taskName." | "; + echo "".$currentTask->taskId." | "; + if ($currentTask->userName == '') { + echo "".__('To be claimed', 'processmaker')." | "; + } else { + echo "".$currentTask->userName." | "; + } + echo "".$tasks[$currentTask->delIndex]." | "; + echo "".__('None')." | "; + } + + echo "