Files
luos/workflow/engine/src/ProcessMaker/Util/helpers.php

85 lines
2.3 KiB
PHP
Raw Normal View History

2015-02-13 16:19:01 -04:00
<?php
2017-08-11 13:29:22 -04:00
/**
* We will send a case note in the actions by email
* @param object $httpData
* @return void
*/
2015-02-13 16:19:01 -04:00
function postNote($httpData)
{
2017-08-11 13:29:22 -04:00
$appUid = (isset($httpData->appUid)) ? $httpData->appUid : '';
$usrUid = (isset($httpData->usrUid)) ? $httpData->usrUid : '';
2015-02-13 16:19:01 -04:00
$appNotes = new AppNotes();
$noteContent = addslashes($httpData->noteText);
$result = $appNotes->postNewNote($appUid, $usrUid, $noteContent, false);
//send the response to client
@ini_set('implicit_flush', 1);
ob_start();
@ob_flush();
@flush();
@ob_end_flush();
ob_implicit_flush(1);
2017-08-11 13:29:22 -04:00
2015-02-13 16:19:01 -04:00
//send notification in background
$noteRecipientsList = array();
$oCase = new Cases();
$p = $oCase->getUsersParticipatedInCase($appUid);
foreach ($p['array'] as $key => $userParticipated) {
$noteRecipientsList[] = $key;
}
$noteRecipients = implode(",", $noteRecipientsList);
$appNotes->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients);
}
2017-08-11 13:29:22 -04:00
/**
* We will get to the abeRequest data from actions by email
* @param string $AbeRequestsUid
* @return array $abeRequests
*/
2015-02-13 16:19:01 -04:00
function loadAbeRequest($AbeRequestsUid)
{
$criteria = new Criteria();
$criteria->add(AbeRequestsPeer::ABE_REQ_UID, $AbeRequestsUid);
$resultRequests = AbeRequestsPeer::doSelectRS($criteria);
$resultRequests->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$resultRequests->next();
$abeRequests = $resultRequests->getRow();
return $abeRequests;
}
2017-08-11 13:29:22 -04:00
/**
* We will get the AbeConfiguration by actions by email
* @param string $AbeConfigurationUid
* @return array $abeConfiguration
*/
2015-02-13 16:19:01 -04:00
function loadAbeConfiguration($AbeConfigurationUid)
{
$criteria = new Criteria();
$criteria->add(AbeConfigurationPeer::ABE_UID, $AbeConfigurationUid);
$result = AbeConfigurationPeer::doSelectRS($criteria);
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$result->next();
$abeConfiguration = $result->getRow();
return $abeConfiguration;
}
2017-08-11 13:29:22 -04:00
/**
* We will update the request by actions by email
* @param array $data
* @return void
* @throws Exception
*/
2015-02-13 16:19:01 -04:00
function uploadAbeRequest($data)
{
try {
$abeRequestsInstance = new AbeRequests();
$abeRequestsInstance->createOrUpdate($data);
} catch (Exception $error) {
throw $error;
}
}