diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php
index c08b14391..e7a772d23 100755
--- a/workflow/engine/classes/class.pmFunctions.php
+++ b/workflow/engine/classes/class.pmFunctions.php
@@ -1290,6 +1290,49 @@ function WSUnpauseCase ($caseUid, $delIndex, $userUid)
return $response;
}
+/**
+ *
+ * @method Add case note.
+ *
+ * @name WSAddCaseNote
+ * @label WS Add case note
+ * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#WSAddCaseNote.28.29
+ *
+ * @param string(32) | $caseUid | ID of the case | The unique ID of the case.
+ * @param string(32) | $processUid | ID of the process | The unique ID of the process.
+ * @param string(32) | $taskUid | ID of the task | The unique ID of the task.
+ * @param string(32) | $userUid | ID user | The unique ID of the user who will add note case.
+ * @param string | $note | Note of the case | Note of the case.
+ * @param int | $sendMail = 1 | Send mail | Optional parameter. If set to 1, will send an email to all participants in the case.
+ * @return array | $response | WS array | A WS Response associative array.
+ *
+ */
+function WSAddCaseNote($caseUid, $processUid, $taskUid, $userUid, $note, $sendMail = 1)
+{
+ $client = WSOpen();
+
+ $sessionId = $_SESSION["WS_SESSION_ID"];
+
+ $params = array(
+ "sessionId" => $sessionId,
+ "caseUid" => $caseUid,
+ "processUid" => $processUid,
+ "taskUid" => $taskUid,
+ "userUid" => $userUid,
+ "note" => $note,
+ "sendMail" => $sendMail
+ );
+
+ $result = $client->__soapCall("addCaseNote", array($params));
+
+ $response = array();
+ $response["status_code"] = $result->status_code;
+ $response["message"] = $result->message;
+ $response["time_stamp"] = $result->timestamp;
+
+ return $response;
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -2421,3 +2464,33 @@ function PMFUnpauseCase ($caseUid, $delIndex, $userUid)
}
}
+/**
+ *
+ * @method Add case note.
+ *
+ * @name PMFAddCaseNote
+ * @label PMF Add case note
+ *
+ * @param string(32) | $caseUid | ID of the case | The unique ID of the case.
+ * @param string(32) | $processUid | ID of the process | The unique ID of the process.
+ * @param string(32) | $taskUid | ID of the task | The unique ID of the task.
+ * @param string(32) | $userUid | ID user | The unique ID of the user who will add note case.
+ * @param string | $note | Note of the case | Note of the case.
+ * @param int | $sendMail = 1 | Send mail | Optional parameter. If set to 1, will send an email to all participants in the case.
+ * @return int | $result | Result of the add case note | Returns 1 if the note has been added to the case.; otherwise, returns 0 if an error occurred.
+ *
+ */
+function PMFAddCaseNote($caseUid, $processUid, $taskUid, $userUid, $note, $sendMail = 1)
+{
+ G::LoadClass("wsBase");
+
+ $ws = new wsBase();
+ $result = $ws->addCaseNote($caseUid, $processUid, $taskUid, $userUid, $note, $sendMail);
+
+ if ($result->status_code == 0) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
diff --git a/workflow/engine/classes/class.wsBase.php b/workflow/engine/classes/class.wsBase.php
index 83735c483..d386d54d9 100755
--- a/workflow/engine/classes/class.wsBase.php
+++ b/workflow/engine/classes/class.wsBase.php
@@ -30,6 +30,7 @@ require_once ("classes/model/AppCacheView.php");
require_once ("classes/model/AppDelegation.php");
require_once ("classes/model/AppDocument.php");
require_once ("classes/model/AppDelay.php");
+require_once ("classes/model/AppNotes.php");
require_once ("classes/model/AppThread.php");
require_once ("classes/model/Department.php");
require_once ("classes/model/Dynaform.php");
@@ -3026,5 +3027,75 @@ class wsBase
return $result;
}
}
+
+ /**
+ * Add case note
+ *
+ * @param string caseUid : ID of the case.
+ * @param string processUid : ID of the process.
+ * @param string taskUid : ID of the task.
+ * @param string userUid : The unique ID of the user who will add note case.
+ * @param string note : Note of the case.
+ * @param int sendMail : Optional parameter. If set to 1, will send an email to all participants in the case.
+ * @return $result will return an object
+ */
+ public function addCaseNote($caseUid, $processUid, $taskUid, $userUid, $note, $sendMail = 1)
+ {
+ try {
+ if (empty($caseUid)) {
+ $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " caseUid");
+
+ return $result;
+ }
+
+ if (empty($processUid)) {
+ $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " processUid");
+
+ return $result;
+ }
+
+ if (empty($taskUid)) {
+ $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " taskUid");
+
+ return $result;
+ }
+
+ if (empty($userUid)) {
+ $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " userUid");
+
+ return $result;
+ }
+
+ if (empty($note)) {
+ $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " note");
+
+ return $result;
+ }
+
+ $case = new Cases();
+
+ $respView = $case->getAllObjectsFrom($processUid, $caseUid, $taskUid, $userUid, "VIEW");
+ $respBlock = $case->getAllObjectsFrom($processUid, $caseUid, $taskUid, $userUid, "BLOCK");
+
+ if ($respView["CASES_NOTES"] == 0 && $respBlock["CASES_NOTES"] == 0) {
+ $result = new wsResponse(100, G::LoadTranslation("ID_CASES_NOTES_NO_PERMISSIONS"));
+
+ return $result;
+ }
+
+ //Add note case
+ $appNote = new AppNotes();
+ $response = $appNote->addCaseNote($caseUid, $userUid, $note, $sendMail);
+
+ //Response
+ $result = new wsResponse(0, G::LoadTranslation("ID_COMMAND_EXECUTED_SUCCESSFULLY"));
+
+ return $result;
+ } catch (Exception $e) {
+ $result = new wsResponse(100, $e->getMessage());
+
+ return $result;
+ }
+ }
}
diff --git a/workflow/engine/classes/model/AppNotes.php b/workflow/engine/classes/model/AppNotes.php
index 56ca7f3d0..e30dd7458 100755
--- a/workflow/engine/classes/model/AppNotes.php
+++ b/workflow/engine/classes/model/AppNotes.php
@@ -217,10 +217,10 @@ class AppNotes extends BaseAppNotes
$sTo = ((($aUser['USR_FIRSTNAME'] != '') || ($aUser['USR_LASTNAME'] != '')) ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>';
$oSpool = new spoolRun();
- if ($aConfiguration['MESS_RAUTH'] == false || (is_string($aConfiguration['MESS_RAUTH']) && $aConfiguration['MESS_RAUTH'] == 'false')) {
- $aConfiguration['MESS_RAUTH'] = 0;
- } else {
- $aConfiguration['MESS_RAUTH'] = 1;
+ if ($aConfiguration['MESS_RAUTH'] == false || (is_string($aConfiguration['MESS_RAUTH']) && $aConfiguration['MESS_RAUTH'] == 'false')) {
+ $aConfiguration['MESS_RAUTH'] = 0;
+ } else {
+ $aConfiguration['MESS_RAUTH'] = 1;
}
$oSpool->setConfig( array ('MESS_ENGINE' => $aConfiguration['MESS_ENGINE'],'MESS_SERVER' => $aConfiguration['MESS_SERVER'],'MESS_PORT' => $aConfiguration['MESS_PORT'],'MESS_ACCOUNT' => $aConfiguration['MESS_ACCOUNT'],'MESS_PASSWORD' => $aConfiguration['MESS_PASSWORD'],'SMTPAuth' => $aConfiguration['MESS_RAUTH'] == '1' ? true : false,'SMTPSecure' => isset( $aConfiguration['SMTPSecure'] ) ? $aConfiguration['SMTPSecure'] : '') );
@@ -235,5 +235,30 @@ class AppNotes extends BaseAppNotes
throw $oException;
}
}
+
+ public function addCaseNote($applicationUid, $userUid, $note, $sendMail)
+ {
+ $response = $this->postNewNote($applicationUid, $userUid, $note, false);
+
+ if ($sendMail == 1) {
+ G::LoadClass("case");
+
+ $case = new Cases();
+
+ $p = $case->getUsersParticipatedInCase($applicationUid);
+ $noteRecipientsList = array();
+
+ foreach ($p["array"] as $key => $userParticipated) {
+ $noteRecipientsList[] = $key;
+ }
+
+ $noteRecipients = implode(",", $noteRecipientsList);
+ $note = stripslashes($note);
+
+ $this->sendNoteNotification($applicationUid, $userUid, $note, $noteRecipients);
+ }
+
+ return $response;
+ }
}
diff --git a/workflow/engine/controllers/appProxy.php b/workflow/engine/controllers/appProxy.php
index c2e198546..b9d31cd71 100644
--- a/workflow/engine/controllers/appProxy.php
+++ b/workflow/engine/controllers/appProxy.php
@@ -1,37 +1,37 @@
-
- * @herits Controller
- * @access public
- */
-
-class AppProxy extends HttpProxyController
-{
-
- /**
- * Get Notes List
- *
- * @param int $httpData->start
- * @param int $httpData->limit
- * @param string $httpData->appUid (optionalif it is not passed try use $_SESSION['APPLICATION'])
- * @return array containg the case notes
- */
- function getNotesList ($httpData)
- {
- $appUid = null;
-
- if (isset( $httpData->appUid ) && trim( $httpData->appUid ) != "") {
- $appUid = $httpData->appUid;
- } else {
- if (isset( $_SESSION['APPLICATION'] )) {
- $appUid = $_SESSION['APPLICATION'];
- }
- }
-
- G::LoadClass( 'case' );
+
+ * @herits Controller
+ * @access public
+ */
+
+class AppProxy extends HttpProxyController
+{
+
+ /**
+ * Get Notes List
+ *
+ * @param int $httpData->start
+ * @param int $httpData->limit
+ * @param string $httpData->appUid (optionalif it is not passed try use $_SESSION['APPLICATION'])
+ * @return array containg the case notes
+ */
+ function getNotesList ($httpData)
+ {
+ $appUid = null;
+
+ if (isset( $httpData->appUid ) && trim( $httpData->appUid ) != "") {
+ $appUid = $httpData->appUid;
+ } else {
+ if (isset( $_SESSION['APPLICATION'] )) {
+ $appUid = $_SESSION['APPLICATION'];
+ }
+ }
+
+ G::LoadClass( 'case' );
$case = new Cases();
$caseLoad = '';
@@ -39,236 +39,218 @@ class AppProxy extends HttpProxyController
$caseLoad = $case->loadCase($appUid);
$httpData->pro = $caseLoad['PRO_UID'];
}
-
- $proUid = (!isset($httpData->pro)) ? $_SESSION['PROCESS'] : $httpData->pro;
- $tasUid = (!isset($httpData->tas)) ? ((isset($_SESSION['TASK'])) ? $_SESSION['TASK'] : '') : $httpData->tas;
- $usrUid = $_SESSION['USER_LOGGED'];
-
- $respView = $case->getAllObjectsFrom( $proUid, $appUid, $tasUid, $usrUid, 'VIEW' );
- $respBlock = $case->getAllObjectsFrom( $proUid, $appUid, $tasUid, $usrUid, 'BLOCK' );
-
- if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) {
- return array ('totalCount' => 0,'notes' => array (),'noPerms' => 1
- );
- }
-
- require_once ("classes/model/AppNotes.php");
-
- if (! isset( $appUid )) {
- throw new Exception( 'Can\'t resolve the Apllication ID for this request.' );
- }
-
- $usrUid = isset( $_SESSION['USER_LOGGED'] ) ? $_SESSION['USER_LOGGED'] : "";
- $appNotes = new AppNotes();
- $response = $appNotes->getNotesList( $appUid, '', $httpData->start, $httpData->limit );
-
- return $response['array'];
- }
-
- /**
- * post Note Action
- *
- * @param string $httpData->appUid (optional, if it is not passed try use $_SESSION['APPLICATION'])
- * @return array containg the case notes
- */
- function postNote ($httpData)
- {
+
+ $proUid = (!isset($httpData->pro)) ? $_SESSION['PROCESS'] : $httpData->pro;
+ $tasUid = (!isset($httpData->tas)) ? ((isset($_SESSION['TASK'])) ? $_SESSION['TASK'] : '') : $httpData->tas;
+ $usrUid = $_SESSION['USER_LOGGED'];
+
+ $respView = $case->getAllObjectsFrom( $proUid, $appUid, $tasUid, $usrUid, 'VIEW' );
+ $respBlock = $case->getAllObjectsFrom( $proUid, $appUid, $tasUid, $usrUid, 'BLOCK' );
+
+ if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) {
+ return array ('totalCount' => 0,'notes' => array (),'noPerms' => 1
+ );
+ }
+
+ require_once ("classes/model/AppNotes.php");
+
+ if (! isset( $appUid )) {
+ throw new Exception( 'Can\'t resolve the Apllication ID for this request.' );
+ }
+
+ $usrUid = isset( $_SESSION['USER_LOGGED'] ) ? $_SESSION['USER_LOGGED'] : "";
+ $appNotes = new AppNotes();
+ $response = $appNotes->getNotesList( $appUid, '', $httpData->start, $httpData->limit );
+
+ return $response['array'];
+ }
+
+ /**
+ * post Note Action
+ *
+ * @param string $httpData->appUid (optional, if it is not passed try use $_SESSION['APPLICATION'])
+ * @return array containg the case notes
+ */
+ function postNote ($httpData)
+ {
+ require_once ("classes/model/AppNotes.php");
+
//extract(getExtJSParams());
- if (isset( $httpData->appUid ) && trim( $httpData->appUid ) != "") {
- $appUid = $httpData->appUid;
- } else {
- $appUid = $_SESSION['APPLICATION'];
- }
-
- if (! isset( $appUid )) {
- throw new Exception( 'Can\'t resolve the Apllication ID for this request.' );
- }
-
- $usrUid = (isset( $_SESSION['USER_LOGGED'] )) ? $_SESSION['USER_LOGGED'] : "";
- require_once ("classes/model/AppNotes.php");
-
- $appNotes = new AppNotes();
- $noteContent = addslashes( $httpData->noteText );
-
- $result = $appNotes->postNewNote( $appUid, $usrUid, $noteContent, false );
-
+ if (isset( $httpData->appUid ) && trim( $httpData->appUid ) != "") {
+ $appUid = $httpData->appUid;
+ } else {
+ $appUid = $_SESSION['APPLICATION'];
+ }
+
+ if (! isset( $appUid )) {
+ throw new Exception( 'Can\'t resolve the Apllication ID for this request.' );
+ }
+
+ $usrUid = (isset( $_SESSION['USER_LOGGED'] )) ? $_SESSION['USER_LOGGED'] : "";
+ $noteContent = addslashes( $httpData->noteText );
+
//Disabling the controller response because we handle a special behavior
- $this->setSendResponse( false );
-
+ $this->setSendResponse(false);
+
+ //Add note case
+ $appNote = new AppNotes();
+ $response = $appNote->addCaseNote($appUid, $usrUid, $noteContent, intval($httpData->swSendMail));
+
//Send the response to client
- @ini_set( 'implicit_flush', 1 );
- ob_start();
- echo G::json_encode( $result );
- @ob_flush();
- @flush();
- @ob_end_flush();
- ob_implicit_flush( 1 );
-
- //Send notification in background
- if (intval( $httpData->swSendMail ) == 1) {
- G::LoadClass( "case" );
-
- $oCase = new Cases();
-
- $p = $oCase->getUsersParticipatedInCase( $appUid );
- $noteRecipientsList = array ();
-
- foreach ($p["array"] as $key => $userParticipated) {
- $noteRecipientsList[] = $key;
- }
-
- $noteRecipients = implode( ",", $noteRecipientsList );
- $noteContent = stripslashes( $noteContent );
-
- $appNotes->sendNoteNotification( $appUid, $usrUid, $noteContent, $noteRecipients );
- }
- }
-
- /**
- * request to open the case summary
- *
- * @param string $httpData->appUid
- * @param string $httpData->delIndex
- * @return object bool $result->succes, string $result->message(is an exception was thrown), string $result->dynUid
- */
- function requestOpenSummary ($httpData)
- {
- global $RBAC;
- $this->success = true;
- $this->dynUid = '';
-
- switch ($RBAC->userCanAccess( 'PM_CASES' )) {
- case - 2:
- throw new Exception( G::LoadTranslation( 'ID_USER_HAVENT_RIGHTS_SYSTEM' ) );
- break;
- case - 1:
- throw new Exception( G::LoadTranslation( 'ID_USER_HAVENT_RIGHTS_PAGE' ) );
- break;
- }
-
- G::LoadClass( 'case' );
- $case = new Cases();
-
- if ($RBAC->userCanAccess( 'PM_ALLCASES' ) < 0 && $case->userParticipatedInCase( $httpData->appUid, $_SESSION['USER_LOGGED'] ) == 0) {
- throw new Exception( G::LoadTranslation( 'ID_NO_PERMISSION_NO_PARTICIPATED' ) );
- }
-
- if ($httpData->action == 'sent') { // Get the last valid delegation for participated list
- $criteria = new Criteria();
- $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
- $criteria->add(AppDelegationPeer::APP_UID, $httpData->appUid);
- $criteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
- $criteria->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX);
- if (AppDelegationPeer::doCount($criteria) > 0) {
- $dataset = AppDelegationPeer::doSelectRS($criteria);
- $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
- $dataset->next();
- $row = $dataset->getRow();
- $httpData->delIndex = $row['DEL_INDEX'];
- }
- }
- $applicationFields = $case->loadCase( $httpData->appUid, $httpData->delIndex );
- $process = new Process();
- $processData = $process->load( $applicationFields['PRO_UID'] );
-
- if (isset( $processData['PRO_DYNAFORMS']['PROCESS'] )) {
- $this->dynUid = $processData['PRO_DYNAFORMS']['PROCESS'];
- }
-
- $_SESSION['_applicationFields'] = $applicationFields;
- $_SESSION['_processData'] = $processData;
- $_SESSION['APPLICATION'] = $httpData->appUid;
- $_SESSION['INDEX'] = $httpData->delIndex;
- $_SESSION['PROCESS'] = $applicationFields['PRO_UID'];
- $_SESSION['TASK'] = $applicationFields['TAS_UID'];
- $_SESSION['STEP_POSITION'] = '';
- }
-
- /**
- * get the case summary data
- *
- * @param string $httpData->appUid
- * @param string $httpData->delIndex
- * @return array containg the case summary data
- */
- function getSummary ($httpData)
- {
- $labels = array ();
- $form = new Form( 'cases/cases_Resume', PATH_XMLFORM, SYS_LANG );
- G::LoadClass( 'case' );
- $case = new Cases();
-
- foreach ($form->fields as $fieldName => $field) {
- $labels[$fieldName] = $field->label;
- }
-
- if (isset( $_SESSION['_applicationFields'] ) && $_SESSION['_processData']) {
- $applicationFields = $_SESSION['_applicationFields'];
- unset( $_SESSION['_applicationFields'] );
- $processData = $_SESSION['_processData'];
- unset( $_SESSION['_processData'] );
- } else {
- if ($httpData->action == 'sent') { // Get the last valid delegation for participated list
- $criteria = new Criteria();
- $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
- $criteria->add(AppDelegationPeer::APP_UID, $httpData->appUid);
- $criteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
- $criteria->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX);
- if (AppDelegationPeer::doCount($criteria) > 0) {
- $dataset = AppDelegationPeer::doSelectRS($criteria);
- $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
- $dataset->next();
- $row = $dataset->getRow();
- $httpData->delIndex = $row['DEL_INDEX'];
- }
- }
- $applicationFields = $case->loadCase( $httpData->appUid, $httpData->delIndex );
- $process = new Process();
- $processData = $process->load( $applicationFields['PRO_UID'] );
- }
-
- $data = array ();
- $task = new Task();
- $taskData = $task->load( $applicationFields['TAS_UID'] );
- $currentUser = $applicationFields['CURRENT_USER'] != '' ? $applicationFields['CURRENT_USER'] : '[' . G::LoadTranslation( 'ID_UNASSIGNED' ) . ']';
-
- $data[] = array ('label' => $labels['PRO_TITLE'],'value' => $processData['PRO_TITLE'],'section' => $labels['TITLE1']
- );
- $data[] = array ('label' => $labels['TITLE'],'value' => $applicationFields['TITLE'],'section' => $labels['TITLE1']
- );
- $data[] = array ('label' => $labels['APP_NUMBER'],'value' => $applicationFields['APP_NUMBER'],'section' => $labels['TITLE1']
- );
- $data[] = array ('label' => $labels['STATUS'],'value' => $applicationFields['STATUS'],'section' => $labels['TITLE1']
- );
- $data[] = array ('label' => $labels['APP_UID'],'value' => $applicationFields['APP_UID'],'section' => $labels['TITLE1']
- );
- $data[] = array ('label' => $labels['CREATOR'],'value' => $applicationFields['CREATOR'],'section' => $labels['TITLE1']
- );
- $data[] = array ('label' => $labels['CREATE_DATE'],'value' => $applicationFields['CREATE_DATE'],'section' => $labels['TITLE1']
- );
- $data[] = array ('label' => $labels['UPDATE_DATE'],'value' => $applicationFields['UPDATE_DATE'],'section' => $labels['TITLE1']
- );
- $data[] = array ('label' => $labels['DESCRIPTION'],'value' => $applicationFields['DESCRIPTION'],'section' => $labels['TITLE1']
- );
-
+ @ini_set("implicit_flush", 1);
+ ob_start();
+ echo G::json_encode($response);
+ @ob_flush();
+ @flush();
+ @ob_end_flush();
+ ob_implicit_flush(1);
+ }
+
+ /**
+ * request to open the case summary
+ *
+ * @param string $httpData->appUid
+ * @param string $httpData->delIndex
+ * @return object bool $result->succes, string $result->message(is an exception was thrown), string $result->dynUid
+ */
+ function requestOpenSummary ($httpData)
+ {
+ global $RBAC;
+ $this->success = true;
+ $this->dynUid = '';
+
+ switch ($RBAC->userCanAccess( 'PM_CASES' )) {
+ case - 2:
+ throw new Exception( G::LoadTranslation( 'ID_USER_HAVENT_RIGHTS_SYSTEM' ) );
+ break;
+ case - 1:
+ throw new Exception( G::LoadTranslation( 'ID_USER_HAVENT_RIGHTS_PAGE' ) );
+ break;
+ }
+
+ G::LoadClass( 'case' );
+ $case = new Cases();
+
+ if ($RBAC->userCanAccess( 'PM_ALLCASES' ) < 0 && $case->userParticipatedInCase( $httpData->appUid, $_SESSION['USER_LOGGED'] ) == 0) {
+ throw new Exception( G::LoadTranslation( 'ID_NO_PERMISSION_NO_PARTICIPATED' ) );
+ }
+
+ if ($httpData->action == 'sent') { // Get the last valid delegation for participated list
+ $criteria = new Criteria();
+ $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
+ $criteria->add(AppDelegationPeer::APP_UID, $httpData->appUid);
+ $criteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
+ $criteria->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX);
+ if (AppDelegationPeer::doCount($criteria) > 0) {
+ $dataset = AppDelegationPeer::doSelectRS($criteria);
+ $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
+ $dataset->next();
+ $row = $dataset->getRow();
+ $httpData->delIndex = $row['DEL_INDEX'];
+ }
+ }
+ $applicationFields = $case->loadCase( $httpData->appUid, $httpData->delIndex );
+ $process = new Process();
+ $processData = $process->load( $applicationFields['PRO_UID'] );
+
+ if (isset( $processData['PRO_DYNAFORMS']['PROCESS'] )) {
+ $this->dynUid = $processData['PRO_DYNAFORMS']['PROCESS'];
+ }
+
+ $_SESSION['_applicationFields'] = $applicationFields;
+ $_SESSION['_processData'] = $processData;
+ $_SESSION['APPLICATION'] = $httpData->appUid;
+ $_SESSION['INDEX'] = $httpData->delIndex;
+ $_SESSION['PROCESS'] = $applicationFields['PRO_UID'];
+ $_SESSION['TASK'] = $applicationFields['TAS_UID'];
+ $_SESSION['STEP_POSITION'] = '';
+ }
+
+ /**
+ * get the case summary data
+ *
+ * @param string $httpData->appUid
+ * @param string $httpData->delIndex
+ * @return array containg the case summary data
+ */
+ function getSummary ($httpData)
+ {
+ $labels = array ();
+ $form = new Form( 'cases/cases_Resume', PATH_XMLFORM, SYS_LANG );
+ G::LoadClass( 'case' );
+ $case = new Cases();
+
+ foreach ($form->fields as $fieldName => $field) {
+ $labels[$fieldName] = $field->label;
+ }
+
+ if (isset( $_SESSION['_applicationFields'] ) && $_SESSION['_processData']) {
+ $applicationFields = $_SESSION['_applicationFields'];
+ unset( $_SESSION['_applicationFields'] );
+ $processData = $_SESSION['_processData'];
+ unset( $_SESSION['_processData'] );
+ } else {
+ if ($httpData->action == 'sent') { // Get the last valid delegation for participated list
+ $criteria = new Criteria();
+ $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
+ $criteria->add(AppDelegationPeer::APP_UID, $httpData->appUid);
+ $criteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
+ $criteria->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX);
+ if (AppDelegationPeer::doCount($criteria) > 0) {
+ $dataset = AppDelegationPeer::doSelectRS($criteria);
+ $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
+ $dataset->next();
+ $row = $dataset->getRow();
+ $httpData->delIndex = $row['DEL_INDEX'];
+ }
+ }
+ $applicationFields = $case->loadCase( $httpData->appUid, $httpData->delIndex );
+ $process = new Process();
+ $processData = $process->load( $applicationFields['PRO_UID'] );
+ }
+
+ $data = array ();
+ $task = new Task();
+ $taskData = $task->load( $applicationFields['TAS_UID'] );
+ $currentUser = $applicationFields['CURRENT_USER'] != '' ? $applicationFields['CURRENT_USER'] : '[' . G::LoadTranslation( 'ID_UNASSIGNED' ) . ']';
+
+ $data[] = array ('label' => $labels['PRO_TITLE'],'value' => $processData['PRO_TITLE'],'section' => $labels['TITLE1']
+ );
+ $data[] = array ('label' => $labels['TITLE'],'value' => $applicationFields['TITLE'],'section' => $labels['TITLE1']
+ );
+ $data[] = array ('label' => $labels['APP_NUMBER'],'value' => $applicationFields['APP_NUMBER'],'section' => $labels['TITLE1']
+ );
+ $data[] = array ('label' => $labels['STATUS'],'value' => $applicationFields['STATUS'],'section' => $labels['TITLE1']
+ );
+ $data[] = array ('label' => $labels['APP_UID'],'value' => $applicationFields['APP_UID'],'section' => $labels['TITLE1']
+ );
+ $data[] = array ('label' => $labels['CREATOR'],'value' => $applicationFields['CREATOR'],'section' => $labels['TITLE1']
+ );
+ $data[] = array ('label' => $labels['CREATE_DATE'],'value' => $applicationFields['CREATE_DATE'],'section' => $labels['TITLE1']
+ );
+ $data[] = array ('label' => $labels['UPDATE_DATE'],'value' => $applicationFields['UPDATE_DATE'],'section' => $labels['TITLE1']
+ );
+ $data[] = array ('label' => $labels['DESCRIPTION'],'value' => $applicationFields['DESCRIPTION'],'section' => $labels['TITLE1']
+ );
+
// note added by krlos pacha carlos[at]colosa[dot]com
//getting this field if it doesn't exist. Related 7994 bug
- $taskData['TAS_TITLE'] = (array_key_exists( 'TAS_TITLE', $taskData )) ? $taskData['TAS_TITLE'] : Content::Load( "TAS_TITLE", "", $applicationFields['TAS_UID'], SYS_LANG );
-
- $data[] = array ('label' => $labels['TAS_TITLE'],'value' => $taskData['TAS_TITLE'],'section' => $labels['TITLE2']
- );
- $data[] = array ('label' => $labels['CURRENT_USER'],'value' => $currentUser,'section' => $labels['TITLE2']
- );
- $data[] = array ('label' => $labels['DEL_DELEGATE_DATE'],'value' => $applicationFields['DEL_DELEGATE_DATE'],'section' => $labels['TITLE2']
- );
- $data[] = array ('label' => $labels['DEL_INIT_DATE'],'value' => $applicationFields['DEL_INIT_DATE'],'section' => $labels['TITLE2']
- );
- $data[] = array ('label' => $labels['DEL_TASK_DUE_DATE'],'value' => $applicationFields['DEL_TASK_DUE_DATE'],'section' => $labels['TITLE2']
- );
- $data[] = array ('label' => $labels['DEL_FINISH_DATE'],'value' => $applicationFields['DEL_FINISH_DATE'],'section' => $labels['TITLE2']
- );
+ $taskData['TAS_TITLE'] = (array_key_exists( 'TAS_TITLE', $taskData )) ? $taskData['TAS_TITLE'] : Content::Load( "TAS_TITLE", "", $applicationFields['TAS_UID'], SYS_LANG );
+
+ $data[] = array ('label' => $labels['TAS_TITLE'],'value' => $taskData['TAS_TITLE'],'section' => $labels['TITLE2']
+ );
+ $data[] = array ('label' => $labels['CURRENT_USER'],'value' => $currentUser,'section' => $labels['TITLE2']
+ );
+ $data[] = array ('label' => $labels['DEL_DELEGATE_DATE'],'value' => $applicationFields['DEL_DELEGATE_DATE'],'section' => $labels['TITLE2']
+ );
+ $data[] = array ('label' => $labels['DEL_INIT_DATE'],'value' => $applicationFields['DEL_INIT_DATE'],'section' => $labels['TITLE2']
+ );
+ $data[] = array ('label' => $labels['DEL_TASK_DUE_DATE'],'value' => $applicationFields['DEL_TASK_DUE_DATE'],'section' => $labels['TITLE2']
+ );
+ $data[] = array ('label' => $labels['DEL_FINISH_DATE'],'value' => $applicationFields['DEL_FINISH_DATE'],'section' => $labels['TITLE2']
+ );
//$data[] = array('label'=>$labels['DYN_UID'] , 'value' => $processData['PRO_DYNAFORMS']['PROCESS'];, 'section'=>$labels['DYN_UID']);
- return $data;
- }
-}
-
+ return $data;
+ }
+}
+
diff --git a/workflow/engine/methods/services/pmos2.wsdl b/workflow/engine/methods/services/pmos2.wsdl
index 1ebd37649..8531027d5 100755
--- a/workflow/engine/methods/services/pmos2.wsdl
+++ b/workflow/engine/methods/services/pmos2.wsdl
@@ -871,6 +871,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1099,6 +1121,12 @@
+
+
+
+
+
+
@@ -1261,6 +1289,10 @@
+
+
+
+
@@ -1625,6 +1657,15 @@
+
+
+
+
+
+
+
diff --git a/workflow/engine/methods/services/soap2.php b/workflow/engine/methods/services/soap2.php
index 1544ff581..8b908d577 100755
--- a/workflow/engine/methods/services/soap2.php
+++ b/workflow/engine/methods/services/soap2.php
@@ -1190,6 +1190,33 @@ function unpauseCase ($params)
return $result;
}
+function addCaseNote($params)
+{
+ $result = isValidSession($params->sessionId);
+
+ if ($result->status_code != 0) {
+ return $result;
+ }
+
+ if (ifPermission($params->sessionId, "PM_CASES") == 0) {
+ $result = new wsResponse(2, "You do not have privileges");
+
+ return $result;
+ }
+
+ $ws = new wsBase();
+ $result = $ws->addCaseNote(
+ $params->caseUid,
+ $params->processUid,
+ $params->taskUid,
+ $params->userUid,
+ $params->note,
+ (isset($params->sendMail))? $params->sendMail : 1
+ );
+
+ return $result;
+}
+
$server = new SoapServer($wsdl);
$server->addFunction("Login");
@@ -1233,5 +1260,6 @@ $server->addFunction("deleteCase");
$server->addFunction("cancelCase");
$server->addFunction("pauseCase");
$server->addFunction("unpauseCase");
+$server->addFunction("addCaseNote");
$server->handle();