HOR-242-B "Create a PMFunction to get UID of a Process" SOLVED
This commit is contained in:
@@ -2933,6 +2933,56 @@ function PMFTasksListByProcessId($processId)
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @method
|
||||
*
|
||||
* Get the Unique id of Process by name
|
||||
*
|
||||
* @name PMFGetProcessUidByName
|
||||
* @label PMF Get the Unique id of Process by name
|
||||
* @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFGetProcessUidByName.28.29
|
||||
*
|
||||
* @param string | $processName = '' | Name of Process | Name of Process
|
||||
* @return string(32) | $processUid | Unique id of Process | Returns the Unique id of Process, FALSE otherwise
|
||||
*
|
||||
*/
|
||||
function PMFGetProcessUidByName($processName = '')
|
||||
{
|
||||
try {
|
||||
$processUid = '';
|
||||
|
||||
if ($processName == '') {
|
||||
//Return
|
||||
return (isset($_SESSION['PROCESS']))? $_SESSION['PROCESS'] : false;
|
||||
}
|
||||
|
||||
$criteria = new Criteria('workflow');
|
||||
|
||||
$criteria->addSelectColumn(ProcessPeer::PRO_UID);
|
||||
|
||||
$criteria->addJoin(ContentPeer::CON_ID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
|
||||
$criteria->add(ContentPeer::CON_VALUE, $processName, Criteria::EQUAL);
|
||||
$criteria->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE', Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = ContentPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
$processUid = $row['PRO_UID'];
|
||||
} else {
|
||||
//Return
|
||||
return false;
|
||||
}
|
||||
|
||||
//Return
|
||||
return $processUid;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
* The requested text in the specified language | If not found returns false
|
||||
|
||||
Reference in New Issue
Block a user