Merged in bugfix/HOR-3556-B (pull request #6058)

HOR-3556

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
jonathan Quispe
2017-09-15 18:41:03 +00:00
committed by Julio Cesar Laura Avendaño
5 changed files with 40 additions and 15 deletions

View File

@@ -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;
}

View File

@@ -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();

View File

@@ -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;
}
}

View File

@@ -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'];

View File

@@ -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'];