BUG 9043 Variable for Case Notes content needed SOLVED
- Se crearon varias funciones para este caso. - La funcion getCaseNotes en la class.case.php con los parametros applicationID, type que es la forma que quiere que se devuelvan los datos, puede ser array, objetc, string por defecto esta en array, y userID que nos daria solo las notas de ese usuario, por defecto nos devuelve de todos los usuarios. - Se modifico la funcion getNotesList para poder traer las notas por un determinado usuario y por defecto recupera las notas de todos los usuarios. - en class.pmFunctions.php se creo la funcion PMFGetCaseNotes con los parametros applicationID, type que es la forma que quiere que se devuelvan los datos, puede ser array, objetc, string por defecto esta en array, y userID que nos daria solo las notas de ese usuario, por defecto nos devuelve de todos los usuarios. - En class.wsBase.php la funcion getCaseNotes con los parametros applicationID, userID que nos daria solo las notas de ese usuario, por defecto nos devuelve de todos los usuarios, esta funcion nos devuelve un array con los fieds en minuscula. - En soap2.php getCaseNotes donde se tienen los siguiente parametros: sessionId, se necesita iniciar una session para poder utilizarlo, applicationID, userID que nos daria solo las notas de ese usuario, por defecto nos devuelve de todos los usuarios. - Se adiciono la funcion para utilizarlo en SoapServer. - En wsResponse se creo un nuevo template para la respuesta del webservice wsGetCaseNotesResponse con los campos status_code, message, notes, timestamp. - En pmos2.wsdl se agregaron los datos necesarios para la salida correcta del webservice.
This commit is contained in:
@@ -5529,4 +5529,48 @@ class Cases {
|
||||
$response['array']=$rows;
|
||||
return $response;
|
||||
}
|
||||
|
||||
function getCaseNotes($applicationID, $type = 'array',$userUid = '') {
|
||||
require_once ( "classes/model/AppNotes.php" );
|
||||
$appNotes = new AppNotes();
|
||||
$appNotes = $appNotes->getNotesList($applicationID,$userUid);
|
||||
$response = '';
|
||||
if (is_array($appNotes)) {
|
||||
switch ($type) {
|
||||
case 'array':
|
||||
$response = array();
|
||||
foreach ($appNotes['array']['notes'] as $key => $value) {
|
||||
$list = array();
|
||||
$list['FULL_NAME'] = $value['USR_FIRSTNAME']." ".$value['USR_LASTNAME'];
|
||||
foreach ($value as $keys => $value) {
|
||||
if ($keys != 'USR_FIRSTNAME' && $keys != 'USR_LASTNAME' && $keys != 'USR_EMAIL') {
|
||||
$list[$keys] = $value;
|
||||
}
|
||||
}
|
||||
$response[$key+1] = $list;
|
||||
}
|
||||
break;
|
||||
case 'object':
|
||||
$response = new stdclass();
|
||||
foreach ($appNotes['array']['notes'] as $key => $value) {
|
||||
$response->$key->FULL_NAME = $value['USR_FIRSTNAME']." ".$value['USR_LASTNAME'];
|
||||
foreach ($value as $keys => $value) {
|
||||
if ($keys != 'USR_FIRSTNAME' && $keys != 'USR_LASTNAME' && $keys != 'USR_EMAIL') {
|
||||
$response->$key->$keys = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'string':
|
||||
$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";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1999,3 +1999,9 @@ function PMFGetUserEmailAddress($id, $APP_UID=null, $prefix='usr') {
|
||||
return $aRecipient;
|
||||
}
|
||||
}
|
||||
|
||||
function PMFGetCaseNotes ($applicationID, $type = 'array',$userUid = '') {
|
||||
G::LoadClass('case');
|
||||
$response = Cases::getCaseNotes($applicationID, $type, $userUid);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -2172,4 +2172,26 @@ class wsBase
|
||||
}
|
||||
}
|
||||
|
||||
public function getCaseNotes ($applicationID, $userUid = '') {
|
||||
try {
|
||||
G::LoadClass('case');
|
||||
$result = new wsGetCaseNotesResponse (0, G::loadTranslation('ID_SUCCESS'), Cases::getCaseNotes($applicationID, 'array', $userUid));
|
||||
$var = array();
|
||||
foreach ($result->notes as $key => $value) {
|
||||
$var2 = array();
|
||||
foreach ($value as $keys => $values) {
|
||||
$field = strtolower($keys);
|
||||
$var2[$field] = $values;
|
||||
}
|
||||
$var[] = $var2;
|
||||
}
|
||||
$result->notes = $var;
|
||||
return $result;
|
||||
}
|
||||
catch ( Exception $e ) {
|
||||
$result = new wsResponse (100, $e->getMessage());
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -182,4 +182,31 @@ class wsGetVariableResponse
|
||||
$this->timestamp = date('Y-m-d H:i:s');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class wsGetCaseNotesResponse
|
||||
* @package workflow.engine.classes
|
||||
*/
|
||||
class wsGetCaseNotesResponse
|
||||
{
|
||||
public $status_code = 0;
|
||||
public $message = '';
|
||||
public $notes = null;
|
||||
public $timestamp = '';
|
||||
|
||||
/**
|
||||
* Function __construct
|
||||
* Constructor of the class
|
||||
* @param string $status
|
||||
* @param string $message
|
||||
* @param array|object|string $notes
|
||||
* @return void
|
||||
*/
|
||||
function __construct( $status, $message, $notes ) {
|
||||
$this->status_code = $status;
|
||||
$this->message = $message;
|
||||
$this->notes = $notes;
|
||||
$this->timestamp = date('Y-m-d H:i:s');
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -15,7 +15,7 @@ require_once 'classes/model/om/BaseAppNotes.php';
|
||||
*/
|
||||
class AppNotes extends BaseAppNotes {
|
||||
|
||||
function getNotesList($appUid, $usrUid, $start, $limit) {
|
||||
function getNotesList($appUid, $usrUid = '', $start = '', $limit = '') {
|
||||
require_once ( "classes/model/Users.php" );
|
||||
|
||||
G::LoadClass('ArrayPeer');
|
||||
@@ -36,23 +36,27 @@ class AppNotes extends BaseAppNotes {
|
||||
$Criteria->addSelectColumn(UsersPeer::USR_USERNAME);
|
||||
$Criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
|
||||
$Criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
|
||||
|
||||
$Criteria->addSelectColumn(UsersPeer::USR_EMAIL);
|
||||
|
||||
$Criteria->addJoin(AppNotesPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
|
||||
|
||||
$Criteria->add(appNotesPeer::APP_UID, $appUid, CRITERIA::EQUAL);
|
||||
|
||||
$Criteria->addDescendingOrderByColumn(AppNotesPeer::NOTE_DATE);
|
||||
if ($usrUid != '') {
|
||||
$Criteria->add(appNotesPeer::USR_UID, $usrUid, CRITERIA::EQUAL);
|
||||
}
|
||||
|
||||
$Criteria->addDescendingOrderByColumn(AppNotesPeer::NOTE_DATE);
|
||||
|
||||
$response = array();
|
||||
$totalCount = AppNotesPeer::doCount($Criteria);
|
||||
$response['totalCount'] = $totalCount;
|
||||
$response['notes'] = array();
|
||||
|
||||
if ($start != '') {
|
||||
$Criteria->setLimit($limit);
|
||||
$Criteria->setOffset($start);
|
||||
}
|
||||
|
||||
$oDataset = appNotesPeer::doSelectRS($Criteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
@@ -35,7 +35,7 @@ class AppProxy extends HttpProxyController
|
||||
|
||||
$usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : "";
|
||||
$appNotes = new AppNotes();
|
||||
$response = $appNotes->getNotesList($appUid, $usrUid, $httpData->start, $httpData->limit);
|
||||
$response = $appNotes->getNotesList($appUid, '', $httpData->start, $httpData->limit);
|
||||
|
||||
return $response['array'];
|
||||
}
|
||||
|
||||
2
workflow/engine/controllers/home.php
Normal file → Executable file
2
workflow/engine/controllers/home.php
Normal file → Executable file
@@ -224,7 +224,7 @@ 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'], $this->userID, $notesStart, $notesLimit);
|
||||
$notes = $appNotes->getNotesList($row['APP_UID'], '', $notesStart, $notesLimit);
|
||||
$notes = $notes['array'];
|
||||
|
||||
$cases['data'][$i]['NOTES_COUNT'] = $notes['totalCount'];
|
||||
|
||||
@@ -47,7 +47,7 @@ function getNotesList() {
|
||||
}
|
||||
$usrUid = (isset($_SESSION['USER_LOGGED'])) ? $_SESSION['USER_LOGGED'] : "";
|
||||
$appNotes = new AppNotes();
|
||||
$response = $appNotes->getNotesList($appUid, $usrUid, $start, $limit);
|
||||
$response = $appNotes->getNotesList($appUid, '', $start, $limit);
|
||||
sendJsonResultGeneric($response['array'], $callback);
|
||||
}
|
||||
|
||||
|
||||
@@ -662,6 +662,41 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:complexType name="getCaseNotesStruct">
|
||||
<xs:sequence>
|
||||
<xs:element name="full_name" type="xs:string"/>
|
||||
<xs:element name="app_uid" type="xs:string"/>
|
||||
<xs:element name="usr_uid" type="xs:string"/>
|
||||
<xs:element name="note_date" type="xs:string"/>
|
||||
<xs:element name="note_content" type="xs:string"/>
|
||||
<xs:element name="note_type" type="xs:string"/>
|
||||
<xs:element name="note_availability" type="xs:string"/>
|
||||
<xs:element name="note_origin_obj" type="xs:string"/>
|
||||
<xs:element name="note_affected_obj1" type="xs:string"/>
|
||||
<xs:element name="note_affected_obj2" type="xs:string"/>
|
||||
<xs:element name="note_recipients" type="xs:string"/>
|
||||
<xs:element name="usr_username" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:element name="getCaseNotesRequest">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="sessionId" type="xs:string"/>
|
||||
<xs:element name="applicationID" type="xs:string"/>
|
||||
<xs:element name="userUid" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="getCaseNotesResponse">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="status_code" type="xs:integer"/>
|
||||
<xs:element name="message" type="xs:string"/>
|
||||
<xs:element name="notes" maxOccurs="unbounded" type="xs0:getCaseNotesStruct"/>
|
||||
<xs:element name="timestamp" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
</types>
|
||||
<message name="loginRequest">
|
||||
@@ -838,6 +873,12 @@
|
||||
<message name="importProcessFromLibraryResponse">
|
||||
<part name="parameters" element="xs0:importProcessFromLibraryResponse"/>
|
||||
</message>
|
||||
<message name="getCaseNotesRequest">
|
||||
<part name="parameters" element="xs0:getCaseNotesRequest"/>
|
||||
</message>
|
||||
<message name="getCaseNotesResponse">
|
||||
<part name="parameters" element="xs0:getCaseNotesResponse"/>
|
||||
</message>
|
||||
|
||||
<message name="removeUserFromGroupRequest">
|
||||
<part name="parameters" element="xs0:removeUserFromGroupRequest"/>
|
||||
@@ -967,6 +1008,11 @@
|
||||
<input message="xs0:importProcessFromLibraryRequest"/>
|
||||
<output message="xs0:importProcessFromLibraryResponse"/>
|
||||
</operation>
|
||||
<operation name="getCaseNotes">
|
||||
<input message="xs0:getCaseNotesRequest"/>
|
||||
<output message="xs0:getCaseNotesResponse"/>
|
||||
</operation>
|
||||
|
||||
<operation name="removeUserFromGroup">
|
||||
<input message="xs0:removeUserFromGroupRequest"/>
|
||||
<output message="xs0:pmResponse"/>
|
||||
@@ -1253,6 +1299,16 @@
|
||||
<soap12:body use="literal"/>
|
||||
</output>
|
||||
</operation>
|
||||
<operation name="getCaseNotes">
|
||||
<soap12:operation soapAction="urn:getCaseNotes" soapActionRequired="true" style="document"/>
|
||||
<input>
|
||||
<soap12:body use="literal"/>
|
||||
</input>
|
||||
<output>
|
||||
<soap12:body use="literal"/>
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<operation name="removeUserFromGroup">
|
||||
<soap12:operation soapAction="urn:removeUserFromGroup" soapActionRequired="true" style="document"/>
|
||||
<input>
|
||||
|
||||
@@ -801,6 +801,17 @@
|
||||
return $res;
|
||||
}
|
||||
|
||||
function getCaseNotes( $params ) {
|
||||
$vsResult = isValidSession($params->sessionId);
|
||||
if( $vsResult->status_code !== 0 ){
|
||||
return $vsResult;
|
||||
}
|
||||
|
||||
$ws = new wsBase ();
|
||||
$res = $ws->getCaseNotes( $params->applicationID ,$params->userUid);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/*************/
|
||||
|
||||
#added By Erik AO <erik@colosa.com> in datetime 26.06.2008 10:00:00
|
||||
@@ -884,5 +895,6 @@ $server->addFunction("ReassignCase");
|
||||
$server->addFunction("systemInformation");
|
||||
$server->addFunction("importProcessFromLibrary");
|
||||
$server->addFunction("removeUserFromGroup");
|
||||
$server->addFunction("getCaseNotes");
|
||||
$server->handle();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user