2014-03-24 17:03:13 -04:00
|
|
|
<?php
|
|
|
|
|
namespace BusinessModel\Cases;
|
|
|
|
|
|
|
|
|
|
class OutputDocument
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Get data of Cases OutputDocument
|
|
|
|
|
*
|
2014-03-25 16:43:50 -04:00
|
|
|
* @param string $applicationUid
|
2014-03-24 17:03:13 -04:00
|
|
|
* @param string $userUid
|
|
|
|
|
*
|
|
|
|
|
* return array Return an array with data of an OutputDocument
|
|
|
|
|
*/
|
2014-03-25 16:43:50 -04:00
|
|
|
public function getCasesOutputDocuments($applicationUid, $userUid)
|
2014-03-24 17:03:13 -04:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
\G::LoadClass('case');
|
|
|
|
|
$oCase = new \Cases();
|
2014-03-25 16:43:50 -04:00
|
|
|
$fields = $oCase->loadCase( $applicationUid );
|
2014-03-24 17:03:13 -04:00
|
|
|
$sProcessUID = $fields['PRO_UID'];
|
|
|
|
|
$sTaskUID = '';
|
|
|
|
|
$oCriteria = new \BusinessModel\Cases();
|
2014-03-25 16:43:50 -04:00
|
|
|
$oCriteria->getAllGeneratedDocumentsCriteria( $sProcessUID, $applicationUid, $sTaskUID, $userUid);
|
2014-03-24 17:03:13 -04:00
|
|
|
$result = array ();
|
|
|
|
|
global $_DBArray;
|
|
|
|
|
foreach ($_DBArray['outputDocuments'] as $key => $row) {
|
|
|
|
|
if (isset( $row['DOC_VERSION'] )) {
|
|
|
|
|
$docrow = array ();
|
|
|
|
|
$docrow['app_doc_uid'] = $row['APP_DOC_UID'];
|
|
|
|
|
$docrow['app_doc_filename'] = $row['DOWNLOAD_FILE'];
|
|
|
|
|
$docrow['doc_uid'] = $row['DOC_UID'];
|
|
|
|
|
$docrow['app_doc_version'] = $row['DOC_VERSION'];
|
|
|
|
|
$docrow['app_doc_create_date'] = $row['CREATE_DATE'];
|
|
|
|
|
$docrow['app_doc_create_user'] = $row['CREATED_BY'];
|
|
|
|
|
$docrow['app_doc_type'] = $row['TYPE'];
|
|
|
|
|
$docrow['app_doc_index'] = $row['APP_DOC_INDEX'];
|
|
|
|
|
$docrow['app_doc_link'] = 'cases/' . $row['DOWNLOAD_LINK'];
|
|
|
|
|
$result[] = $docrow;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get data of Cases OutputDocument
|
|
|
|
|
*
|
2014-03-25 16:43:50 -04:00
|
|
|
* @param string $applicationUid
|
2014-03-24 17:03:13 -04:00
|
|
|
* @param string $userUid
|
|
|
|
|
* @param string $outputDocumentUid
|
|
|
|
|
*
|
|
|
|
|
* return array Return an array with data of an OutputDocument
|
|
|
|
|
*/
|
2014-03-25 16:43:50 -04:00
|
|
|
public function getCasesOutputDocument($applicationUid, $userUid, $outputDocumentUid)
|
2014-03-24 17:03:13 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2014-03-25 16:43:50 -04:00
|
|
|
$sApplicationUID = $applicationUid;
|
2014-03-24 17:03:13 -04:00
|
|
|
$sUserUID = $userUid;
|
|
|
|
|
\G::LoadClass('case');
|
|
|
|
|
$oCase = new \Cases();
|
|
|
|
|
$fields = $oCase->loadCase( $sApplicationUID );
|
|
|
|
|
$sProcessUID = $fields['PRO_UID'];
|
|
|
|
|
$sTaskUID = '';
|
|
|
|
|
$oCaseRest = new \BusinessModel\Cases();
|
|
|
|
|
$oCaseRest->getAllGeneratedDocumentsCriteria( $sProcessUID, $sApplicationUID, $sTaskUID, $sUserUID );
|
|
|
|
|
$result = array ();
|
|
|
|
|
global $_DBArray;
|
|
|
|
|
foreach ($_DBArray['outputDocuments'] as $key => $row) {
|
|
|
|
|
if (isset( $row['DOC_VERSION'] )) {
|
|
|
|
|
$docrow = array ();
|
|
|
|
|
$docrow['app_doc_uid'] = $row['APP_DOC_UID'];
|
|
|
|
|
$docrow['app_doc_filename'] = $row['DOWNLOAD_FILE'];
|
|
|
|
|
$docrow['doc_uid'] = $row['DOC_UID'];
|
|
|
|
|
$docrow['app_doc_version'] = $row['DOC_VERSION'];
|
|
|
|
|
$docrow['app_doc_create_date'] = $row['CREATE_DATE'];
|
|
|
|
|
$docrow['app_doc_create_user'] = $row['CREATED_BY'];
|
|
|
|
|
$docrow['app_doc_type'] = $row['TYPE'];
|
|
|
|
|
$docrow['app_doc_index'] = $row['APP_DOC_INDEX'];
|
|
|
|
|
$docrow['app_doc_link'] = 'cases/' . $row['DOWNLOAD_LINK'];
|
|
|
|
|
if ($docrow['app_doc_uid'] == $outputDocumentUid) {
|
|
|
|
|
$result = $docrow;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Delete OutputDocument
|
|
|
|
|
*
|
|
|
|
|
* @param string $outputDocumentUid
|
|
|
|
|
*
|
|
|
|
|
* return array Return an array with data of an OutputDocument
|
|
|
|
|
*/
|
|
|
|
|
public function removeOutputDocument($outputDocumentUid)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$oAppDocument = \AppDocumentPeer::retrieveByPK( $outputDocumentUid, 1 );
|
|
|
|
|
if (is_null( $oAppDocument ) || $oAppDocument->getAppDocStatus() == 'DELETED') {
|
|
|
|
|
throw (new \Exception('This row doesn\'t exist!'));
|
|
|
|
|
}
|
|
|
|
|
\G::LoadClass('wsBase');
|
|
|
|
|
$ws = new \wsBase();
|
|
|
|
|
$ws->removeDocument($outputDocumentUid);
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get data of Cases OutputDocument
|
|
|
|
|
*
|
2014-03-25 16:43:50 -04:00
|
|
|
* @param string $applicationUid
|
2014-03-24 17:03:13 -04:00
|
|
|
* @param string $outputDocumentUid
|
|
|
|
|
* @param string $userUid
|
|
|
|
|
*
|
|
|
|
|
* return array Return an array with data of an OutputDocument
|
|
|
|
|
*/
|
2014-03-25 16:43:50 -04:00
|
|
|
public function addCasesOutputDocument($applicationUid, $outputDocumentUid, $userUid)
|
2014-03-24 17:03:13 -04:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|