diff --git a/workflow/engine/classes/Cases.php b/workflow/engine/classes/Cases.php index 1576d8249..df5b01b34 100644 --- a/workflow/engine/classes/Cases.php +++ b/workflow/engine/classes/Cases.php @@ -6969,11 +6969,20 @@ class Cases return $response; } + /** + * This method return the cases notes + * @param $applicationID + * @param string $type + * @param string $userUid + * @return array|stdclass|string + */ public function getCaseNotes($applicationID, $type = 'array', $userUid = '') { require_once("classes/model/AppNotes.php"); $appNotes = new AppNotes(); $appNotes = $appNotes->getNotesList($applicationID, $userUid); + $appNotes = AppNotes::applyHtmlentitiesInNotes($appNotes); + $response = ''; if (is_array($appNotes)) { switch ($type) { @@ -7005,10 +7014,10 @@ class Cases $response = ''; foreach ($appNotes['array']['notes'] as $key => $value) { $response .= $value['USR_FIRSTNAME'] . " " . - $value['USR_LASTNAME'] . " " . - "(" . $value['USR_USERNAME'] . ")" . - " " . $value['NOTE_CONTENT'] . " " . " (" . $value['NOTE_DATE'] . " ) " . - " \n"; + $value['USR_LASTNAME'] . " " . + "(" . $value['USR_USERNAME'] . ")" . + " " . $value['NOTE_CONTENT'] . " " . " (" . $value['NOTE_DATE'] . " ) " . + " \n"; } break; } diff --git a/workflow/engine/classes/WsBase.php b/workflow/engine/classes/WsBase.php index 6455e8f68..4040fb5da 100644 --- a/workflow/engine/classes/WsBase.php +++ b/workflow/engine/classes/WsBase.php @@ -2788,7 +2788,7 @@ class WsBase public function getCaseNotes($applicationID, $userUid = '') { try { - $result = new wsGetCaseNotesResponse(0, G::loadTranslation('ID_SUCCESS'), Cases::getCaseNotes($applicationID, 'array', $userUid)); + $result = new WsGetCaseNotesResponse(0, G::loadTranslation('ID_SUCCESS'), Cases::getCaseNotes($applicationID, 'array', $userUid)); $var = array(); diff --git a/workflow/engine/classes/model/AppNotes.php b/workflow/engine/classes/model/AppNotes.php index 736173b36..d508b3258 100644 --- a/workflow/engine/classes/model/AppNotes.php +++ b/workflow/engine/classes/model/AppNotes.php @@ -83,7 +83,7 @@ class AppNotes extends BaseAppNotes $oDataset->next(); while ($aRow = $oDataset->getRow()) { - $aRow['NOTE_CONTENT'] = htmlentities(stripslashes($aRow['NOTE_CONTENT']), ENT_QUOTES, 'UTF-8'); + $aRow['NOTE_CONTENT'] = stripslashes($aRow['NOTE_CONTENT']); $response['notes'][] = $aRow; $oDataset->next(); } @@ -240,5 +240,21 @@ class AppNotes extends BaseAppNotes return $response; } + + /** + * Add htmlEntities to notes in node_content + * @param $notes + * @return array + */ + public static function applyHtmlentitiesInNotes($notes) + { + if (isset($notes) && isset($notes["array"])) { + foreach ($notes["array"]["notes"] as &$note) { + $note["NOTE_CONTENT"] = htmlentities($note["NOTE_CONTENT"], ENT_QUOTES, 'UTF-8'); + } + } + return $notes; + } + } diff --git a/workflow/engine/controllers/appProxy.php b/workflow/engine/controllers/appProxy.php index b62a725fe..b54ca5502 100644 --- a/workflow/engine/controllers/appProxy.php +++ b/workflow/engine/controllers/appProxy.php @@ -73,14 +73,11 @@ class AppProxy extends HttpProxyController $proUid = $httpData->pro; } - if(!isset($httpData->tas) || empty($httpData->tas)) - { - $tasUid = $_SESSION['TASK']; + if (!isset($httpData->tas) || empty($httpData->tas)) { + $tasUid = isset($_SESSION['TASK']) ? $_SESSION['TASK'] : ""; } else { $tasUid = $httpData->tas; } - //$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", $delIndex); @@ -91,11 +88,12 @@ class AppProxy extends HttpProxyController ); } - $usrUid = isset( $_SESSION['USER_LOGGED'] ) ? $_SESSION['USER_LOGGED'] : ""; + $usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ""; $appNotes = new AppNotes(); - $response = $appNotes->getNotesList( $appUid, '', $httpData->start, $httpData->limit ); + $response = $appNotes->getNotesList($appUid, '', $httpData->start, $httpData->limit); + $response = AppNotes::applyHtmlentitiesInNotes($response); - require_once ("classes/model/Application.php"); + require_once("classes/model/Application.php"); $oApplication = new Application(); $aApplication = $oApplication->Load($appUid); $response['array']['appTitle'] = $aApplication['APP_TITLE']; diff --git a/workflow/engine/controllers/home.php b/workflow/engine/controllers/home.php index 8633d6982..c3e9d8ea7 100644 --- a/workflow/engine/controllers/home.php +++ b/workflow/engine/controllers/home.php @@ -544,7 +544,9 @@ class Home extends Controller $cases['data'][$i]['APP_DEL_PREVIOUS_USER'] = ucwords( $row['APP_DEL_PREVIOUS_USER'] ); } // Completting with Notes - $notes = $appNotes->getNotesList( $row['APP_UID'], '', $notesStart, $notesLimit ); + $notes = $appNotes->getNotesList($row['APP_UID'], '', $notesStart, $notesLimit); + $notes = AppNotes::applyHtmlentitiesInNotes($notes); + $notes = $notes['array']; $cases['data'][$i]['NOTES_COUNT'] = $notes['totalCount'];