Merge remote-tracking branch 'upstream/3.0.1.8' into 3.0.1.7-Gmail
This commit is contained in:
@@ -139,7 +139,7 @@ class pmDynaform
|
||||
if (!$sw1 && !$sw2) {
|
||||
//read event
|
||||
$fn = $this->onPropertyRead;
|
||||
if (function_exists($fn)) {
|
||||
if (is_callable($fn) || function_exists($fn)) {
|
||||
$fn($json, $key, $value);
|
||||
}
|
||||
//set properties from trigger
|
||||
|
||||
@@ -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
|
||||
@@ -2961,6 +3011,70 @@ function PMFGeti18nText($id, $category, $lang = "en")
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
* Function to return an array of objects containing the properties of the fields
|
||||
* in a specified DynaForm.
|
||||
* It also inserts the "value" and "value_label" as properties in the fields' objects,
|
||||
* if the case is specified.
|
||||
* @name PMFDynaFormFields
|
||||
* @label PMF DynaForm Fields
|
||||
* @param string | $dynUid | Dynaform ID | Id of the dynaform
|
||||
* @param string | $appUid | Case ID | Id of the case
|
||||
* @param int | $delIndex | Delegation index | Delegation index for case
|
||||
* @return array | $fields | List of fields | Return a list of fields
|
||||
*/
|
||||
function PMFDynaFormFields($dynUid, $appUid = false, $delIndex = 0)
|
||||
{
|
||||
G::LoadClass("pmDynaform");
|
||||
$fields = array();
|
||||
$data = array();
|
||||
|
||||
if ($appUid !== false) {
|
||||
if ($delIndex < 0) {
|
||||
throw new Exception(G::LoadTranslation('ID_INVALID_DELEGATION_INDEX_FOR_CASE') . "'" . $appUid . "'.");
|
||||
}
|
||||
$cases = new Cases();
|
||||
$data = $cases->loadCase($appUid, $delIndex);
|
||||
} else {
|
||||
global $oPMScript;
|
||||
if (isset($oPMScript->aFields) && is_array($oPMScript->aFields)) {
|
||||
$data['APP_DATA'] = $oPMScript->aFields;
|
||||
}
|
||||
}
|
||||
$data["CURRENT_DYNAFORM"] = $dynUid;
|
||||
|
||||
$dynaform = new pmDynaform($data);
|
||||
$dynaform->onPropertyRead = function(&$json, $key, $value) {
|
||||
if (isset($json->data) && !isset($json->value)) {
|
||||
$json->value = $json->data->value;
|
||||
$json->value_label = $json->data->label;
|
||||
}
|
||||
};
|
||||
|
||||
if ($dynaform->isResponsive()) {
|
||||
$json = G::json_decode($dynaform->record["DYN_CONTENT"]);
|
||||
$dynaform->jsonr($json);
|
||||
|
||||
$rows = $json->items[0]->items;
|
||||
foreach ($rows as $items) {
|
||||
foreach ($items as $item) {
|
||||
$fields[] = $item;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$oldDynaform = new Dynaform();
|
||||
$aFields = $oldDynaform->getDynaformFields($dynUid);
|
||||
foreach ($aFields as $value) {
|
||||
if (isset($data["APP_DATA"]) && isset($data["APP_DATA"][$value->name])) {
|
||||
$value->value = $data["APP_DATA"][$value->name];
|
||||
}
|
||||
$fields[] = $value;
|
||||
}
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
* This function determines if the domain of the passed email addres is hosted in
|
||||
|
||||
@@ -51,13 +51,19 @@ switch($req){
|
||||
$criteria->add( AppMessagePeer::APP_MSG_DATE, $dateTo, Criteria::LESS_EQUAL );
|
||||
}
|
||||
|
||||
$result = AppMessagePeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$data = Array();
|
||||
while ( $result->next() ) {
|
||||
$data[] = $result->getRow();
|
||||
}
|
||||
$totalCount = count($data);
|
||||
//Number records total
|
||||
$criteriaCount = clone $criteria;
|
||||
|
||||
$criteriaCount->clearSelectColumns();
|
||||
$criteriaCount->addSelectColumn('COUNT(' . AppMessagePeer::APP_MSG_UID . ') AS NUM_REC');
|
||||
|
||||
$rsCriteriaCount = AppMessagePeer::doSelectRS($criteriaCount);
|
||||
$rsCriteriaCount->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$resultCount = $rsCriteriaCount->next();
|
||||
$rowCount = $rsCriteriaCount->getRow();
|
||||
|
||||
$totalCount = (int)($rowCount['NUM_REC']);
|
||||
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_UID);
|
||||
|
||||
@@ -1110,4 +1110,42 @@ class Cases extends Api
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mark a task process as a bookmark
|
||||
* @url POST /bookmark/:tas_uid
|
||||
*
|
||||
* @param string $tas_uid {@min 32}{@max 32}
|
||||
*
|
||||
*/
|
||||
public function doPostBookmarkStartCase($tas_uid)
|
||||
{
|
||||
try {
|
||||
$userLoggedUid = $this->getUserId();
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$user->updateBookmark($userLoggedUid, $tas_uid, 'INSERT');
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a task process from bookmarks
|
||||
* @url DELETE /bookmark/:tas_uid
|
||||
*
|
||||
* @param string $tas_uid {@min 32}{@max 32}
|
||||
*
|
||||
*/
|
||||
public function doDeleteBookmarkStartCase($tas_uid)
|
||||
{
|
||||
try {
|
||||
$userLoggedUid = $this->getUserId();
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$user->updateBookmark($userLoggedUid, $tas_uid, 'DELETE');
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -143,43 +143,5 @@ class User extends Api
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Bookmark start case
|
||||
* @url POST /bookmark/:tas_uid
|
||||
*
|
||||
* @param string $tas_uid {@min 32}{@max 32}
|
||||
*
|
||||
*/
|
||||
public function doPostBookmarkStartCase($tas_uid)
|
||||
{
|
||||
try {
|
||||
$userLoggedUid = $this->getUserId();
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$user->updateBookmark($userLoggedUid, $tas_uid, 'INSERT');
|
||||
return array('bookmarkedTaskId'=>$tas_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Bookmark start case
|
||||
* @url DELETE /bookmark/:tas_uid
|
||||
*
|
||||
* @param string $tas_uid {@min 32}{@max 32}
|
||||
*
|
||||
*/
|
||||
public function doDeleteBookmarkStartCase($tas_uid)
|
||||
{
|
||||
try {
|
||||
$userLoggedUid = $this->getUserId();
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$user->updateBookmark($userLoggedUid, $tas_uid, 'DELETE');
|
||||
return array('unbookmarkedTaskId'=>$tas_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user