Code Style
This commit is contained in:
@@ -5498,19 +5498,23 @@ class Cases
|
|||||||
$arrayApplicationData = $this->loadCase($applicationUid);
|
$arrayApplicationData = $this->loadCase($applicationUid);
|
||||||
$arrayData['APP_NUMBER'] = $arrayApplicationData['APP_NUMBER'];
|
$arrayData['APP_NUMBER'] = $arrayApplicationData['APP_NUMBER'];
|
||||||
|
|
||||||
$oTask = new Task();
|
$task = new Task();
|
||||||
$aTaskInfo = $oTask->load($taskUid);
|
$taskInfo = $task->load($taskUid);
|
||||||
|
|
||||||
if ($aTaskInfo['TAS_SEND_LAST_EMAIL'] == 'TRUE') {
|
if ($taskInfo['TAS_SEND_LAST_EMAIL'] == 'TRUE') {
|
||||||
$dataLastEmail = $this->loadDataSendEmail($aTaskInfo, $arrayData, $from, 'LAST');
|
$dataLastEmail = $this->loadDataSendEmail($taskInfo, $arrayData, $from, 'LAST');
|
||||||
$dataLastEmail['applicationUid'] = $applicationUid;
|
$dataLastEmail['applicationUid'] = $applicationUid;
|
||||||
$dataLastEmail['delIndex'] = $delIndex;
|
$dataLastEmail['delIndex'] = $delIndex;
|
||||||
|
//Load the TAS_ID
|
||||||
|
if (isset($taskInfo['TAS_ID'])) {
|
||||||
|
$arrayData['TAS_ID'] = $taskInfo['TAS_ID'];
|
||||||
|
}
|
||||||
$this->sendMessage($dataLastEmail, $arrayData, $arrayTask);
|
$this->sendMessage($dataLastEmail, $arrayData, $arrayTask);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (Exception $oException) {
|
} catch (Exception $e) {
|
||||||
throw $oException;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1770,6 +1770,10 @@ class Derivation
|
|||||||
$dataEmail['applicationUid'] = $appFields['APP_UID'];
|
$dataEmail['applicationUid'] = $appFields['APP_UID'];
|
||||||
$dataEmail['delIndex'] = $iNewDelIndex;
|
$dataEmail['delIndex'] = $iNewDelIndex;
|
||||||
array_push($taskData, $nextDel);
|
array_push($taskData, $nextDel);
|
||||||
|
//Load the TAS_ID
|
||||||
|
if (isset($nextDel['TAS_ID'])) {
|
||||||
|
$appFields['APP_DATA']['TAS_ID'] = $nextDel['TAS_ID'];
|
||||||
|
}
|
||||||
$this->case->sendMessage($dataEmail, $appFields['APP_DATA'], $taskData);
|
$this->case->sendMessage($dataEmail, $appFields['APP_DATA'], $taskData);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -611,12 +611,16 @@ class AppDocument extends BaseAppDocument
|
|||||||
$aColumns['PRO_UID'],
|
$aColumns['PRO_UID'],
|
||||||
$appUid,
|
$appUid,
|
||||||
array(),
|
array(),
|
||||||
array('INPUT_DOCUMENTS' => 'VIEW')
|
array('INPUT_DOCUMENTS' => 'VIEW', 'ATTACHMENTS' => 'VIEW')
|
||||||
);
|
);
|
||||||
//Has permissions?
|
//Has permissions?
|
||||||
if (in_array($appDocUid, $userAuthorization['objectPermissions']['INPUT_DOCUMENTS'])) {
|
if (in_array($appDocUid, $userAuthorization['objectPermissions']['INPUT_DOCUMENTS'])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
//Has permissions?
|
||||||
|
if (in_array($appDocUid, $userAuthorization['objectPermissions']['ATTACHMENTS'])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
//Is supervisor?
|
//Is supervisor?
|
||||||
if ($userAuthorization['supervisor']) {
|
if ($userAuthorization['supervisor']) {
|
||||||
//Review if the supervisor has assigned the object input document
|
//Review if the supervisor has assigned the object input document
|
||||||
|
|||||||
@@ -15,17 +15,26 @@ use ProcessMaker\BusinessModel\Cases\InputDocument;
|
|||||||
|
|
||||||
class ObjectPermission extends BaseObjectPermission
|
class ObjectPermission extends BaseObjectPermission
|
||||||
{
|
{
|
||||||
public function load ($UID)
|
/**
|
||||||
|
* Get the fields related to the user uid
|
||||||
|
*
|
||||||
|
* @param string $usrUid
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function load($usrUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oRow = ObjectPermissionPeer::retrieveByPK( $UID );
|
$row = ObjectPermissionPeer::retrieveByPK($usrUid);
|
||||||
if (! is_null( $oRow )) {
|
if (!is_null($row)) {
|
||||||
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
|
$fields = $row->toArray(BasePeer::TYPE_FIELDNAME);
|
||||||
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
$this->fromArray($fields, BasePeer::TYPE_FIELDNAME);
|
||||||
$this->setNew( false );
|
$this->setNew(false);
|
||||||
return $aFields;
|
|
||||||
|
return $fields;
|
||||||
} else {
|
} else {
|
||||||
throw (new Exception( "The row '" . $UsrUid . "' in table USER doesn't exist!" ));
|
throw (new Exception("The row '" . $usrUid . "' in table USER doesn't exist!"));
|
||||||
}
|
}
|
||||||
} catch (Exception $oError) {
|
} catch (Exception $oError) {
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
@@ -362,47 +371,47 @@ class ObjectPermission extends BaseObjectPermission
|
|||||||
*/
|
*/
|
||||||
public function objectPermissionByOutputInput ($appUid, $proUid, $opTaskSource, $obType = 'OUTPUT', $opObjUid = '', $statusCase = '')
|
public function objectPermissionByOutputInput ($appUid, $proUid, $opTaskSource, $obType = 'OUTPUT', $opObjUid = '', $statusCase = '')
|
||||||
{
|
{
|
||||||
$oCriteria = new Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_UID);
|
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_UID);
|
||||||
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_TYPE);
|
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_TYPE);
|
||||||
$arrayCondition = array();
|
$arrayCondition = array();
|
||||||
$arrayCondition[] = array(AppDelegationPeer::APP_UID, AppDocumentPeer::APP_UID, Criteria::EQUAL);
|
$arrayCondition[] = array(AppDelegationPeer::APP_UID, AppDocumentPeer::APP_UID, Criteria::EQUAL);
|
||||||
$arrayCondition[] = array(AppDelegationPeer::DEL_INDEX, AppDocumentPeer::DEL_INDEX, Criteria::EQUAL);
|
$arrayCondition[] = array(AppDelegationPeer::DEL_INDEX, AppDocumentPeer::DEL_INDEX, Criteria::EQUAL);
|
||||||
$oCriteria->addJoinMC($arrayCondition, Criteria::LEFT_JOIN);
|
$criteria->addJoinMC($arrayCondition, Criteria::LEFT_JOIN);
|
||||||
$oCriteria->add(AppDelegationPeer::APP_UID, $appUid);
|
$criteria->add(AppDelegationPeer::APP_UID, $appUid);
|
||||||
$oCriteria->add(AppDelegationPeer::PRO_UID, $proUid);
|
$criteria->add(AppDelegationPeer::PRO_UID, $proUid);
|
||||||
|
|
||||||
if ($statusCase != 'COMPLETED' && $opTaskSource != '' && (int)$opTaskSource != 0) {
|
if ($statusCase != 'COMPLETED' && $opTaskSource != '' && (int)$opTaskSource != 0) {
|
||||||
$oCriteria->add(AppDelegationPeer::TAS_UID, $opTaskSource);
|
$criteria->add(AppDelegationPeer::TAS_UID, $opTaskSource);
|
||||||
}
|
}
|
||||||
if ($opObjUid != '' && $opObjUid != '0') {
|
if ($opObjUid != '' && $opObjUid != '0') {
|
||||||
$oCriteria->add(AppDocumentPeer::DOC_UID, $opObjUid);
|
$criteria->add(AppDocumentPeer::DOC_UID, $opObjUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
$supervisorDocuments = [];
|
$supervisorDocuments = [];
|
||||||
switch ($obType) {
|
switch ($obType) {
|
||||||
case 'INPUT':
|
case 'INPUT':
|
||||||
$oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, 'INPUT');
|
$criteria->add(AppDocumentPeer::APP_DOC_TYPE, 'INPUT');
|
||||||
//We will to get the supervisor's documents with index = 100000
|
//We will to get the supervisor's documents with index = 100000
|
||||||
$inputDocument = new InputDocument();
|
$inputDocument = new InputDocument();
|
||||||
$supervisorDocuments = $inputDocument->getSupervisorDocuments($proUid, $appUid);
|
$supervisorDocuments = $inputDocument->getSupervisorDocuments($appUid);
|
||||||
break;
|
break;
|
||||||
case 'ATTACHED':
|
case 'ATTACHED':
|
||||||
$oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, 'ATTACHED');
|
$criteria->add(AppDocumentPeer::APP_DOC_TYPE, 'ATTACHED');
|
||||||
break;
|
break;
|
||||||
case 'OUTPUT':
|
case 'OUTPUT':
|
||||||
$oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT');
|
$criteria->add(AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
|
$dataset = AppDelegationPeer::doSelectRS($criteria);
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
$result = array();
|
$result = [];
|
||||||
while ($oDataset->next()) {
|
while ($dataset->next()) {
|
||||||
$aRow = $oDataset->getRow();
|
$row = $dataset->getRow();
|
||||||
if (!in_array($aRow['APP_DOC_UID'], $result)) {
|
if (!in_array($row['APP_DOC_UID'], $result)) {
|
||||||
array_push($result, $aRow['APP_DOC_UID']);
|
array_push($result, $row['APP_DOC_UID']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace ProcessMaker\BusinessModel;
|
|||||||
|
|
||||||
use AbeConfiguration;
|
use AbeConfiguration;
|
||||||
use AbeConfigurationPeer;
|
use AbeConfigurationPeer;
|
||||||
|
use AbeRequests;
|
||||||
use AbeRequestsPeer;
|
use AbeRequestsPeer;
|
||||||
use AbeResponsesPeer;
|
use AbeResponsesPeer;
|
||||||
use ApplicationPeer;
|
use ApplicationPeer;
|
||||||
@@ -20,6 +21,7 @@ use ResultSet;
|
|||||||
use SpoolRun;
|
use SpoolRun;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
use UsersPeer;
|
use UsersPeer;
|
||||||
|
use TaskPeer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of ActionsByEmailService
|
* Description of ActionsByEmailService
|
||||||
@@ -390,7 +392,7 @@ class ActionsByEmail
|
|||||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID);
|
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID);
|
||||||
$criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID);
|
$criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID);
|
||||||
$criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID);
|
$criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID);
|
||||||
|
$criteria->addSelectColumn(TaskPeer::TAS_ID);
|
||||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID);
|
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID);
|
||||||
$criteria->addSelectColumn(AbeRequestsPeer::APP_UID);
|
$criteria->addSelectColumn(AbeRequestsPeer::APP_UID);
|
||||||
$criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX);
|
$criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX);
|
||||||
@@ -399,19 +401,18 @@ class ActionsByEmail
|
|||||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_BODY);
|
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_BODY);
|
||||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_ANSWERED);
|
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_ANSWERED);
|
||||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_STATUS);
|
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_STATUS);
|
||||||
|
|
||||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
|
$criteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
|
||||||
$criteria->addSelectColumn(AppDelegationPeer::APP_NUMBER);
|
$criteria->addSelectColumn(AppDelegationPeer::APP_NUMBER);
|
||||||
|
$criteria->addJoin(AbeConfigurationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
|
||||||
|
$criteria->addJoin(AbeConfigurationPeer::ABE_UID, AbeRequestsPeer::ABE_UID, Criteria::LEFT_JOIN);
|
||||||
|
$conditions[] = [AbeRequestsPeer::APP_UID, AppDelegationPeer::APP_UID];
|
||||||
|
$conditions[] = [AbeRequestsPeer::DEL_INDEX, AppDelegationPeer::DEL_INDEX];
|
||||||
|
$criteria->addJoinMC($conditions, Criteria::LEFT_JOIN);
|
||||||
$criteria->add(AbeRequestsPeer::ABE_REQ_UID, $arrayData['REQ_UID']);
|
$criteria->add(AbeRequestsPeer::ABE_REQ_UID, $arrayData['REQ_UID']);
|
||||||
$criteria->addJoin(AbeRequestsPeer::ABE_UID, AbeConfigurationPeer::ABE_UID);
|
|
||||||
$criteria->addJoin(AppDelegationPeer::APP_UID, AbeRequestsPeer::APP_UID);
|
|
||||||
$criteria->addJoin(AppDelegationPeer::DEL_INDEX, AbeRequestsPeer::DEL_INDEX);
|
|
||||||
$resultRes = AbeRequestsPeer::doSelectRS($criteria);
|
$resultRes = AbeRequestsPeer::doSelectRS($criteria);
|
||||||
$resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
$resultRes->next();
|
$resultRes->next();
|
||||||
$dataRes = Array();
|
$dataRes = [];
|
||||||
|
|
||||||
if ($dataRes = $resultRes->getRow()) {
|
if ($dataRes = $resultRes->getRow()) {
|
||||||
if (is_null($dataRes['DEL_FINISH_DATE'])) {
|
if (is_null($dataRes['DEL_FINISH_DATE'])) {
|
||||||
@@ -431,13 +432,7 @@ class ActionsByEmail
|
|||||||
$spool = new SpoolRun();
|
$spool = new SpoolRun();
|
||||||
$spool->setConfig($aSetup);
|
$spool->setConfig($aSetup);
|
||||||
|
|
||||||
//Load the TAS_ID
|
$spool->create([
|
||||||
if (!isset($arrayData['TAS_ID'])) {
|
|
||||||
$task= new Task();
|
|
||||||
$taskId = $task->load($dataRes['TAS_UID'])['TAS_ID'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$spool->create(array(
|
|
||||||
'msg_uid' => '',
|
'msg_uid' => '',
|
||||||
'app_uid' => $dataRes['APP_UID'],
|
'app_uid' => $dataRes['APP_UID'],
|
||||||
'del_index' => $dataRes['DEL_INDEX'],
|
'del_index' => $dataRes['DEL_INDEX'],
|
||||||
@@ -451,13 +446,12 @@ class ActionsByEmail
|
|||||||
'app_msg_attach' => '',
|
'app_msg_attach' => '',
|
||||||
'app_msg_template' => '',
|
'app_msg_template' => '',
|
||||||
'app_msg_status' => 'pending',
|
'app_msg_status' => 'pending',
|
||||||
"tas_id" => $taskId,
|
"tas_id" => $dataRes['TAS_ID'],
|
||||||
"app_number" => isset($dataRes['APP_NUMBER']) ? $dataRes['APP_NUMBER'] : ''
|
"app_number" => isset($dataRes['APP_NUMBER']) ? $dataRes['APP_NUMBER'] : ''
|
||||||
));
|
]);
|
||||||
|
|
||||||
if ($spool->sendMail()) {
|
if ($spool->sendMail()) {
|
||||||
$dataRes['ABE_REQ_STATUS'] = 'SENT';
|
$dataRes['ABE_REQ_STATUS'] = 'SENT';
|
||||||
|
|
||||||
$message = G::LoadTranslation('ID_EMAIL_RESENT_TO') . ': ' . $dataRes['ABE_REQ_SENT_TO'];
|
$message = G::LoadTranslation('ID_EMAIL_RESENT_TO') . ': ' . $dataRes['ABE_REQ_SENT_TO'];
|
||||||
} else {
|
} else {
|
||||||
$dataRes['ABE_REQ_STATUS'] = 'ERROR';
|
$dataRes['ABE_REQ_STATUS'] = 'ERROR';
|
||||||
@@ -465,7 +459,7 @@ class ActionsByEmail
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$abeRequestsInstance = new \AbeRequests();
|
$abeRequestsInstance = new AbeRequests();
|
||||||
$abeRequestsInstance->createOrUpdate($dataRes);
|
$abeRequestsInstance->createOrUpdate($dataRes);
|
||||||
} catch (Exception $error) {
|
} catch (Exception $error) {
|
||||||
throw $error;
|
throw $error;
|
||||||
|
|||||||
@@ -1145,7 +1145,6 @@ class InputDocument
|
|||||||
* This function get all the supervisor's documents
|
* This function get all the supervisor's documents
|
||||||
* When the DEL_INDEX = 100000
|
* When the DEL_INDEX = 100000
|
||||||
*
|
*
|
||||||
* @param string $proUid, uid related to the process
|
|
||||||
* @param string $appUid, uid related to the case
|
* @param string $appUid, uid related to the case
|
||||||
* @param array $docType, can be INPUT, ATTACHED, OUTPUT
|
* @param array $docType, can be INPUT, ATTACHED, OUTPUT
|
||||||
* @param array $docStatus, can be ACTIVE, DELETED
|
* @param array $docStatus, can be ACTIVE, DELETED
|
||||||
@@ -1153,7 +1152,7 @@ class InputDocument
|
|||||||
* @return array $documents
|
* @return array $documents
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getSupervisorDocuments($proUid, $appUid, $docType = ['INPUT'], $docStatus = ['ACTIVE'])
|
public function getSupervisorDocuments($appUid, $docType = ['INPUT'], $docStatus = ['ACTIVE'])
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$criteria = new Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
@@ -1161,7 +1160,6 @@ class InputDocument
|
|||||||
$criteria->add(AppDocumentPeer::APP_DOC_TYPE, $docType, Criteria::IN);
|
$criteria->add(AppDocumentPeer::APP_DOC_TYPE, $docType, Criteria::IN);
|
||||||
$criteria->add(AppDocumentPeer::APP_DOC_STATUS, $docStatus, Criteria::IN);
|
$criteria->add(AppDocumentPeer::APP_DOC_STATUS, $docStatus, Criteria::IN);
|
||||||
$criteria->add(AppDocumentPeer::DEL_INDEX, 100000);
|
$criteria->add(AppDocumentPeer::DEL_INDEX, 100000);
|
||||||
$criteria->add(ApplicationPeer::PRO_UID, $proUid);
|
|
||||||
$criteria->addJoin(AppDocumentPeer::APP_UID, ApplicationPeer::APP_UID, Criteria::LEFT_JOIN);
|
$criteria->addJoin(AppDocumentPeer::APP_UID, ApplicationPeer::APP_UID, Criteria::LEFT_JOIN);
|
||||||
$dataset = AppDocumentPeer::doSelectRS($criteria);
|
$dataset = AppDocumentPeer::doSelectRS($criteria);
|
||||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|||||||
Reference in New Issue
Block a user