Merged in bugfix/HOR-3898-A (pull request #6172)
HOR-3898 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -5445,6 +5445,14 @@ class Cases
|
||||
if ($sTo != null) {
|
||||
$oSpool = new SpoolRun();
|
||||
|
||||
//Load the TAS_ID
|
||||
if (!isset($arrayData['TAS_ID'])) {
|
||||
$task= new Task();
|
||||
$taskId = $task->load($arrayData['TASK'])['TAS_ID'];
|
||||
} else {
|
||||
$taskId = $arrayData['TAS_ID'];
|
||||
}
|
||||
|
||||
$oSpool->setConfig($dataLastEmail['configuration']);
|
||||
$oSpool->create(array(
|
||||
"msg_uid" => "",
|
||||
@@ -5460,7 +5468,9 @@ class Cases
|
||||
"app_msg_attach" => "",
|
||||
"app_msg_template" => "",
|
||||
"app_msg_status" => "pending",
|
||||
"app_msg_error" => $dataLastEmail['msgError']
|
||||
"app_msg_error" => $dataLastEmail['msgError'],
|
||||
"tas_id" => $taskId,
|
||||
"app_number" => isset($arrayData['APP_NUMBER']) ? $arrayData['APP_NUMBER'] : ''
|
||||
));
|
||||
|
||||
if ($dataLastEmail['msgError'] == '') {
|
||||
@@ -5475,12 +5485,16 @@ class Cases
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $taskUid
|
||||
* @param $arrayTask
|
||||
* @param $arrayData
|
||||
* @param $applicationUid
|
||||
* @param $delIndex
|
||||
* This function send an email notification when tas_send_last_email = true
|
||||
* The users assigned to the next task will receive a custom email message when the case is routed
|
||||
*
|
||||
* @param string $taskUid
|
||||
* @param array $arrayTask
|
||||
* @param array $arrayData
|
||||
* @param string $applicationUid
|
||||
* @param integer $delIndex
|
||||
* @param string $from
|
||||
*
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -5490,19 +5504,23 @@ class Cases
|
||||
$arrayApplicationData = $this->loadCase($applicationUid);
|
||||
$arrayData['APP_NUMBER'] = $arrayApplicationData['APP_NUMBER'];
|
||||
|
||||
$oTask = new Task();
|
||||
$aTaskInfo = $oTask->load($taskUid);
|
||||
$task = new Task();
|
||||
$taskInfo = $task->load($taskUid);
|
||||
|
||||
if ($aTaskInfo['TAS_SEND_LAST_EMAIL'] == 'TRUE') {
|
||||
$dataLastEmail = $this->loadDataSendEmail($aTaskInfo, $arrayData, $from, 'LAST');
|
||||
if ($taskInfo['TAS_SEND_LAST_EMAIL'] == 'TRUE') {
|
||||
$dataLastEmail = $this->loadDataSendEmail($taskInfo, $arrayData, $from, 'LAST');
|
||||
$dataLastEmail['applicationUid'] = $applicationUid;
|
||||
$dataLastEmail['delIndex'] = $delIndex;
|
||||
//Load the TAS_ID
|
||||
if (isset($taskInfo['TAS_ID'])) {
|
||||
$arrayData['TAS_ID'] = $taskInfo['TAS_ID'];
|
||||
}
|
||||
$this->sendMessage($dataLastEmail, $arrayData, $arrayTask);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception $oException) {
|
||||
throw $oException;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1770,6 +1770,10 @@ class Derivation
|
||||
$dataEmail['applicationUid'] = $appFields['APP_UID'];
|
||||
$dataEmail['delIndex'] = $iNewDelIndex;
|
||||
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);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -645,6 +645,28 @@ class SpoolRun
|
||||
$spool->setAppMsgShowMessage($db_spool['app_msg_show_message']); // Add by Ankit
|
||||
$spool->setAppMsgError($db_spool['app_msg_error']);
|
||||
|
||||
if (empty($db_spool['app_number'])) {
|
||||
$appDelegation = new AppDelegation();
|
||||
$delegationIds = $appDelegation->getColumnIds($db_spool['app_uid'], $db_spool['del_index']);
|
||||
if (is_array($delegationIds) && count($delegationIds) > 0) {
|
||||
$delegationIds = array_change_key_case($delegationIds);
|
||||
$appNumber = $delegationIds['app_number'];
|
||||
} else {
|
||||
//The notification is not related to case
|
||||
$appNumber = 0;
|
||||
}
|
||||
} else {
|
||||
$appNumber = $db_spool['app_number'];
|
||||
}
|
||||
|
||||
if (empty($db_spool['tas_id'])) {
|
||||
$tasId = isset($delegationIds['tas_id']) ? $delegationIds['tas_id'] : 0;
|
||||
} else {
|
||||
$tasId = $db_spool['tas_id'];
|
||||
}
|
||||
|
||||
$spool->setAppNumber($appNumber);
|
||||
$spool->setTasId($tasId);
|
||||
|
||||
if (!$spool->validate()) {
|
||||
$errors = $spool->getValidationFailures();
|
||||
|
||||
@@ -3855,6 +3855,34 @@ class WorkspaceTools
|
||||
WHERE AD.APP_NUMBER = 0");
|
||||
$con->commit();
|
||||
|
||||
// Populating APP_MESSAGE.APP_NUMBER
|
||||
CLI::logging("-> Populating APP_MESSAGE.APP_NUMBER \n");
|
||||
$con->begin();
|
||||
$stmt = $con->createStatement();
|
||||
$rs = $stmt->executeQuery("UPDATE APP_MESSAGE AS AD
|
||||
INNER JOIN (
|
||||
SELECT APPLICATION.APP_UID, APPLICATION.APP_NUMBER
|
||||
FROM APPLICATION
|
||||
) AS APP
|
||||
ON (AD.APP_UID = APP.APP_UID)
|
||||
SET AD.APP_NUMBER = APP.APP_NUMBER
|
||||
WHERE AD.APP_NUMBER = 0");
|
||||
$con->commit();
|
||||
|
||||
// Populating APP_MESSAGE.TAS_ID
|
||||
CLI::logging("-> Populating APP_MESSAGE.TAS_ID \n");
|
||||
$con->begin();
|
||||
$stmt = $con->createStatement();
|
||||
$rs = $stmt->executeQuery("UPDATE APP_MESSAGE AS AD
|
||||
INNER JOIN (
|
||||
SELECT APP_DELEGATION.TAS_ID, APP_DELEGATION.APP_NUMBER, APP_DELEGATION.TAS_UID, APP_DELEGATION.DEL_INDEX
|
||||
FROM APP_DELEGATION
|
||||
) AS DEL
|
||||
ON (AD.APP_NUMBER = DEL.APP_NUMBER AND AD.DEL_INDEX = DEL.DEL_INDEX)
|
||||
SET AD.TAS_ID = DEL.TAS_ID
|
||||
WHERE AD.TAS_ID = 0 AND AD.APP_NUMBER != 0 AND AD.DEL_INDEX != 0");
|
||||
$con->commit();
|
||||
|
||||
CLI::logging("-> Migrating And Populating Indexing for avoiding the use of table APP_CACHE_VIEW Done \n");
|
||||
|
||||
// Populating PRO_ID, USR_ID
|
||||
|
||||
@@ -922,4 +922,37 @@ class AppDelegation extends BaseAppDelegation
|
||||
return $index;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function get the columns by Id indexing
|
||||
*
|
||||
* @param string $appUid
|
||||
* @param integer $delIndex
|
||||
*
|
||||
* @return array|null
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getColumnIds($appUid, $delIndex)
|
||||
{
|
||||
try {
|
||||
$columnsId = [];
|
||||
if ($delIndex > 0) {
|
||||
$row = AppDelegationPeer::retrieveByPK($appUid, $delIndex);
|
||||
if (!is_null($row)) {
|
||||
$fields = $row->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$this->fromArray($fields, BasePeer::TYPE_FIELDNAME);
|
||||
$columnsId['APP_NUMBER'] = $fields['APP_NUMBER'];
|
||||
$columnsId['USR_ID'] = $fields['USR_ID'];
|
||||
$columnsId['TAS_ID'] = $fields['TAS_ID'];
|
||||
$columnsId['PRO_ID'] = $fields['PRO_ID'];
|
||||
return $columnsId;
|
||||
} else {
|
||||
throw (new Exception("The row '" . $appUid . "' , '" . $delIndex . "' in table APP_DELEGATION doesn't exist!"));
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -811,6 +811,33 @@ class Task extends BaseTask
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function get the columns by Id indexing
|
||||
*
|
||||
* @param string $tasUid
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getColumnIds($tasUid)
|
||||
{
|
||||
try {
|
||||
$columnsId = [];
|
||||
$row = TaskPeer::retrieveByPK($tasUid);
|
||||
if (!is_null($row)) {
|
||||
$fields = $row->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$this->fromArray($fields, BasePeer::TYPE_FIELDNAME);
|
||||
$columnsId['TAS_ID'] = $fields['TAS_ID'];
|
||||
$columnsId['PRO_ID'] = $fields['PRO_ID'];
|
||||
return $columnsId;
|
||||
} else {
|
||||
throw (new Exception("The row '" . $tasUid . "' in table TASK doesn't exist!"));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -101,6 +101,10 @@ class AppMessageMapBuilder
|
||||
|
||||
$tMap->addColumn('APP_MSG_ERROR', 'AppMsgError', 'string', CreoleTypes::LONGVARCHAR, false, null);
|
||||
|
||||
$tMap->addColumn('TAS_ID', 'TasId', 'int', CreoleTypes::INTEGER, false, null);
|
||||
|
||||
$tMap->addColumn('APP_NUMBER', 'AppNumber', 'int', CreoleTypes::INTEGER, false, null);
|
||||
|
||||
} // doBuild()
|
||||
|
||||
} // AppMessageMapBuilder
|
||||
|
||||
@@ -135,6 +135,18 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
|
||||
*/
|
||||
protected $app_msg_error;
|
||||
|
||||
/**
|
||||
* The value for the tas_id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $tas_id = 0;
|
||||
|
||||
/**
|
||||
* The value for the app_number field.
|
||||
* @var int
|
||||
*/
|
||||
protected $app_number = 0;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
@@ -389,6 +401,28 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
|
||||
return $this->app_msg_error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [tas_id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTasId()
|
||||
{
|
||||
|
||||
return $this->tas_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [app_number] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getAppNumber()
|
||||
{
|
||||
|
||||
return $this->app_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of [app_msg_uid] column.
|
||||
*
|
||||
@@ -799,6 +833,50 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
|
||||
|
||||
} // setAppMsgError()
|
||||
|
||||
/**
|
||||
* Set the value of [tas_id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setTasId($v)
|
||||
{
|
||||
|
||||
// Since the native PHP type for this column is integer,
|
||||
// we will cast the input value to an int (if it is not).
|
||||
if ($v !== null && !is_int($v) && is_numeric($v)) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->tas_id !== $v || $v === 0) {
|
||||
$this->tas_id = $v;
|
||||
$this->modifiedColumns[] = AppMessagePeer::TAS_ID;
|
||||
}
|
||||
|
||||
} // setTasId()
|
||||
|
||||
/**
|
||||
* Set the value of [app_number] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setAppNumber($v)
|
||||
{
|
||||
|
||||
// Since the native PHP type for this column is integer,
|
||||
// we will cast the input value to an int (if it is not).
|
||||
if ($v !== null && !is_int($v) && is_numeric($v)) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->app_number !== $v || $v === 0) {
|
||||
$this->app_number = $v;
|
||||
$this->modifiedColumns[] = AppMessagePeer::APP_NUMBER;
|
||||
}
|
||||
|
||||
} // setAppNumber()
|
||||
|
||||
/**
|
||||
* Hydrates (populates) the object variables with values from the database resultset.
|
||||
*
|
||||
@@ -852,12 +930,16 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
|
||||
|
||||
$this->app_msg_error = $rs->getString($startcol + 17);
|
||||
|
||||
$this->tas_id = $rs->getInt($startcol + 18);
|
||||
|
||||
$this->app_number = $rs->getInt($startcol + 19);
|
||||
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
|
||||
// FIXME - using NUM_COLUMNS may be clearer.
|
||||
return $startcol + 18; // 18 = AppMessagePeer::NUM_COLUMNS - AppMessagePeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
return $startcol + 20; // 20 = AppMessagePeer::NUM_COLUMNS - AppMessagePeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating AppMessage object", $e);
|
||||
@@ -1115,6 +1197,12 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
|
||||
case 17:
|
||||
return $this->getAppMsgError();
|
||||
break;
|
||||
case 18:
|
||||
return $this->getTasId();
|
||||
break;
|
||||
case 19:
|
||||
return $this->getAppNumber();
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
@@ -1153,6 +1241,8 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
|
||||
$keys[15] => $this->getAppMsgSendDate(),
|
||||
$keys[16] => $this->getAppMsgShowMessage(),
|
||||
$keys[17] => $this->getAppMsgError(),
|
||||
$keys[18] => $this->getTasId(),
|
||||
$keys[19] => $this->getAppNumber(),
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
@@ -1238,6 +1328,12 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
|
||||
case 17:
|
||||
$this->setAppMsgError($value);
|
||||
break;
|
||||
case 18:
|
||||
$this->setTasId($value);
|
||||
break;
|
||||
case 19:
|
||||
$this->setAppNumber($value);
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
@@ -1333,6 +1429,14 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
|
||||
$this->setAppMsgError($arr[$keys[17]]);
|
||||
}
|
||||
|
||||
if (array_key_exists($keys[18], $arr)) {
|
||||
$this->setTasId($arr[$keys[18]]);
|
||||
}
|
||||
|
||||
if (array_key_exists($keys[19], $arr)) {
|
||||
$this->setAppNumber($arr[$keys[19]]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1416,6 +1520,14 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
|
||||
$criteria->add(AppMessagePeer::APP_MSG_ERROR, $this->app_msg_error);
|
||||
}
|
||||
|
||||
if ($this->isColumnModified(AppMessagePeer::TAS_ID)) {
|
||||
$criteria->add(AppMessagePeer::TAS_ID, $this->tas_id);
|
||||
}
|
||||
|
||||
if ($this->isColumnModified(AppMessagePeer::APP_NUMBER)) {
|
||||
$criteria->add(AppMessagePeer::APP_NUMBER, $this->app_number);
|
||||
}
|
||||
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
@@ -1504,6 +1616,10 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
|
||||
|
||||
$copyObj->setAppMsgError($this->app_msg_error);
|
||||
|
||||
$copyObj->setTasId($this->tas_id);
|
||||
|
||||
$copyObj->setAppNumber($this->app_number);
|
||||
|
||||
|
||||
$copyObj->setNew(true);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ abstract class BaseAppMessagePeer
|
||||
const CLASS_DEFAULT = 'classes.model.AppMessage';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 18;
|
||||
const NUM_COLUMNS = 20;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
@@ -85,6 +85,12 @@ abstract class BaseAppMessagePeer
|
||||
/** the column name for the APP_MSG_ERROR field */
|
||||
const APP_MSG_ERROR = 'APP_MESSAGE.APP_MSG_ERROR';
|
||||
|
||||
/** the column name for the TAS_ID field */
|
||||
const TAS_ID = 'APP_MESSAGE.TAS_ID';
|
||||
|
||||
/** the column name for the APP_NUMBER field */
|
||||
const APP_NUMBER = 'APP_MESSAGE.APP_NUMBER';
|
||||
|
||||
/** The PHP to DB Name Mapping */
|
||||
private static $phpNameMap = null;
|
||||
|
||||
@@ -96,10 +102,10 @@ abstract class BaseAppMessagePeer
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('AppMsgUid', 'MsgUid', 'AppUid', 'DelIndex', 'AppMsgType', 'AppMsgSubject', 'AppMsgFrom', 'AppMsgTo', 'AppMsgBody', 'AppMsgDate', 'AppMsgCc', 'AppMsgBcc', 'AppMsgTemplate', 'AppMsgStatus', 'AppMsgAttach', 'AppMsgSendDate', 'AppMsgShowMessage', 'AppMsgError', ),
|
||||
BasePeer::TYPE_COLNAME => array (AppMessagePeer::APP_MSG_UID, AppMessagePeer::MSG_UID, AppMessagePeer::APP_UID, AppMessagePeer::DEL_INDEX, AppMessagePeer::APP_MSG_TYPE, AppMessagePeer::APP_MSG_SUBJECT, AppMessagePeer::APP_MSG_FROM, AppMessagePeer::APP_MSG_TO, AppMessagePeer::APP_MSG_BODY, AppMessagePeer::APP_MSG_DATE, AppMessagePeer::APP_MSG_CC, AppMessagePeer::APP_MSG_BCC, AppMessagePeer::APP_MSG_TEMPLATE, AppMessagePeer::APP_MSG_STATUS, AppMessagePeer::APP_MSG_ATTACH, AppMessagePeer::APP_MSG_SEND_DATE, AppMessagePeer::APP_MSG_SHOW_MESSAGE, AppMessagePeer::APP_MSG_ERROR, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('APP_MSG_UID', 'MSG_UID', 'APP_UID', 'DEL_INDEX', 'APP_MSG_TYPE', 'APP_MSG_SUBJECT', 'APP_MSG_FROM', 'APP_MSG_TO', 'APP_MSG_BODY', 'APP_MSG_DATE', 'APP_MSG_CC', 'APP_MSG_BCC', 'APP_MSG_TEMPLATE', 'APP_MSG_STATUS', 'APP_MSG_ATTACH', 'APP_MSG_SEND_DATE', 'APP_MSG_SHOW_MESSAGE', 'APP_MSG_ERROR', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
|
||||
BasePeer::TYPE_PHPNAME => array ('AppMsgUid', 'MsgUid', 'AppUid', 'DelIndex', 'AppMsgType', 'AppMsgSubject', 'AppMsgFrom', 'AppMsgTo', 'AppMsgBody', 'AppMsgDate', 'AppMsgCc', 'AppMsgBcc', 'AppMsgTemplate', 'AppMsgStatus', 'AppMsgAttach', 'AppMsgSendDate', 'AppMsgShowMessage', 'AppMsgError', 'TasId', 'AppNumber', ),
|
||||
BasePeer::TYPE_COLNAME => array (AppMessagePeer::APP_MSG_UID, AppMessagePeer::MSG_UID, AppMessagePeer::APP_UID, AppMessagePeer::DEL_INDEX, AppMessagePeer::APP_MSG_TYPE, AppMessagePeer::APP_MSG_SUBJECT, AppMessagePeer::APP_MSG_FROM, AppMessagePeer::APP_MSG_TO, AppMessagePeer::APP_MSG_BODY, AppMessagePeer::APP_MSG_DATE, AppMessagePeer::APP_MSG_CC, AppMessagePeer::APP_MSG_BCC, AppMessagePeer::APP_MSG_TEMPLATE, AppMessagePeer::APP_MSG_STATUS, AppMessagePeer::APP_MSG_ATTACH, AppMessagePeer::APP_MSG_SEND_DATE, AppMessagePeer::APP_MSG_SHOW_MESSAGE, AppMessagePeer::APP_MSG_ERROR, AppMessagePeer::TAS_ID, AppMessagePeer::APP_NUMBER, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('APP_MSG_UID', 'MSG_UID', 'APP_UID', 'DEL_INDEX', 'APP_MSG_TYPE', 'APP_MSG_SUBJECT', 'APP_MSG_FROM', 'APP_MSG_TO', 'APP_MSG_BODY', 'APP_MSG_DATE', 'APP_MSG_CC', 'APP_MSG_BCC', 'APP_MSG_TEMPLATE', 'APP_MSG_STATUS', 'APP_MSG_ATTACH', 'APP_MSG_SEND_DATE', 'APP_MSG_SHOW_MESSAGE', 'APP_MSG_ERROR', 'TAS_ID', 'APP_NUMBER', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -109,10 +115,10 @@ abstract class BaseAppMessagePeer
|
||||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('AppMsgUid' => 0, 'MsgUid' => 1, 'AppUid' => 2, 'DelIndex' => 3, 'AppMsgType' => 4, 'AppMsgSubject' => 5, 'AppMsgFrom' => 6, 'AppMsgTo' => 7, 'AppMsgBody' => 8, 'AppMsgDate' => 9, 'AppMsgCc' => 10, 'AppMsgBcc' => 11, 'AppMsgTemplate' => 12, 'AppMsgStatus' => 13, 'AppMsgAttach' => 14, 'AppMsgSendDate' => 15, 'AppMsgShowMessage' => 16, 'AppMsgError' => 17, ),
|
||||
BasePeer::TYPE_COLNAME => array (AppMessagePeer::APP_MSG_UID => 0, AppMessagePeer::MSG_UID => 1, AppMessagePeer::APP_UID => 2, AppMessagePeer::DEL_INDEX => 3, AppMessagePeer::APP_MSG_TYPE => 4, AppMessagePeer::APP_MSG_SUBJECT => 5, AppMessagePeer::APP_MSG_FROM => 6, AppMessagePeer::APP_MSG_TO => 7, AppMessagePeer::APP_MSG_BODY => 8, AppMessagePeer::APP_MSG_DATE => 9, AppMessagePeer::APP_MSG_CC => 10, AppMessagePeer::APP_MSG_BCC => 11, AppMessagePeer::APP_MSG_TEMPLATE => 12, AppMessagePeer::APP_MSG_STATUS => 13, AppMessagePeer::APP_MSG_ATTACH => 14, AppMessagePeer::APP_MSG_SEND_DATE => 15, AppMessagePeer::APP_MSG_SHOW_MESSAGE => 16, AppMessagePeer::APP_MSG_ERROR => 17, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('APP_MSG_UID' => 0, 'MSG_UID' => 1, 'APP_UID' => 2, 'DEL_INDEX' => 3, 'APP_MSG_TYPE' => 4, 'APP_MSG_SUBJECT' => 5, 'APP_MSG_FROM' => 6, 'APP_MSG_TO' => 7, 'APP_MSG_BODY' => 8, 'APP_MSG_DATE' => 9, 'APP_MSG_CC' => 10, 'APP_MSG_BCC' => 11, 'APP_MSG_TEMPLATE' => 12, 'APP_MSG_STATUS' => 13, 'APP_MSG_ATTACH' => 14, 'APP_MSG_SEND_DATE' => 15, 'APP_MSG_SHOW_MESSAGE' => 16, 'APP_MSG_ERROR' => 17, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
|
||||
BasePeer::TYPE_PHPNAME => array ('AppMsgUid' => 0, 'MsgUid' => 1, 'AppUid' => 2, 'DelIndex' => 3, 'AppMsgType' => 4, 'AppMsgSubject' => 5, 'AppMsgFrom' => 6, 'AppMsgTo' => 7, 'AppMsgBody' => 8, 'AppMsgDate' => 9, 'AppMsgCc' => 10, 'AppMsgBcc' => 11, 'AppMsgTemplate' => 12, 'AppMsgStatus' => 13, 'AppMsgAttach' => 14, 'AppMsgSendDate' => 15, 'AppMsgShowMessage' => 16, 'AppMsgError' => 17, 'TasId' => 18, 'AppNumber' => 19, ),
|
||||
BasePeer::TYPE_COLNAME => array (AppMessagePeer::APP_MSG_UID => 0, AppMessagePeer::MSG_UID => 1, AppMessagePeer::APP_UID => 2, AppMessagePeer::DEL_INDEX => 3, AppMessagePeer::APP_MSG_TYPE => 4, AppMessagePeer::APP_MSG_SUBJECT => 5, AppMessagePeer::APP_MSG_FROM => 6, AppMessagePeer::APP_MSG_TO => 7, AppMessagePeer::APP_MSG_BODY => 8, AppMessagePeer::APP_MSG_DATE => 9, AppMessagePeer::APP_MSG_CC => 10, AppMessagePeer::APP_MSG_BCC => 11, AppMessagePeer::APP_MSG_TEMPLATE => 12, AppMessagePeer::APP_MSG_STATUS => 13, AppMessagePeer::APP_MSG_ATTACH => 14, AppMessagePeer::APP_MSG_SEND_DATE => 15, AppMessagePeer::APP_MSG_SHOW_MESSAGE => 16, AppMessagePeer::APP_MSG_ERROR => 17, AppMessagePeer::TAS_ID => 18, AppMessagePeer::APP_NUMBER => 19, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('APP_MSG_UID' => 0, 'MSG_UID' => 1, 'APP_UID' => 2, 'DEL_INDEX' => 3, 'APP_MSG_TYPE' => 4, 'APP_MSG_SUBJECT' => 5, 'APP_MSG_FROM' => 6, 'APP_MSG_TO' => 7, 'APP_MSG_BODY' => 8, 'APP_MSG_DATE' => 9, 'APP_MSG_CC' => 10, 'APP_MSG_BCC' => 11, 'APP_MSG_TEMPLATE' => 12, 'APP_MSG_STATUS' => 13, 'APP_MSG_ATTACH' => 14, 'APP_MSG_SEND_DATE' => 15, 'APP_MSG_SHOW_MESSAGE' => 16, 'APP_MSG_ERROR' => 17, 'TAS_ID' => 18, 'APP_NUMBER' => 19, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -249,6 +255,10 @@ abstract class BaseAppMessagePeer
|
||||
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_ERROR);
|
||||
|
||||
$criteria->addSelectColumn(AppMessagePeer::TAS_ID);
|
||||
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_NUMBER);
|
||||
|
||||
}
|
||||
|
||||
const COUNT = 'COUNT(APP_MESSAGE.APP_MSG_UID)';
|
||||
|
||||
@@ -350,12 +350,20 @@
|
||||
<column name="APP_MSG_SEND_DATE" type="TIMESTAMP" required="true"/>
|
||||
<column name="APP_MSG_SHOW_MESSAGE" type="TINYINT" required="true" default="1"/>
|
||||
<column name="APP_MSG_ERROR" type="LONGVARCHAR" required="false"/>
|
||||
<column name="TAS_ID" type="INTEGER" required="false" default="0"/>
|
||||
<column name="APP_NUMBER" type="INTEGER" required="false" default="0"/>
|
||||
<index name="indexForAppUid">
|
||||
<index-column name="APP_UID"/>
|
||||
</index>
|
||||
<index name="indexForMsgStatus">
|
||||
<index-column name="APP_MSG_STATUS"/>
|
||||
</index>
|
||||
<index name="INDEX_TAS_ID">
|
||||
<index-column name="TAS_ID"/>
|
||||
</index>
|
||||
<index name="INDEX_APP_NUMBER">
|
||||
<index-column name="APP_NUMBER"/>
|
||||
</index>
|
||||
</table>
|
||||
<table name="APP_OWNER">
|
||||
<vendor type="mysql">
|
||||
|
||||
@@ -163,9 +163,13 @@ CREATE TABLE `APP_MESSAGE`
|
||||
`APP_MSG_SEND_DATE` DATETIME NOT NULL,
|
||||
`APP_MSG_SHOW_MESSAGE` TINYINT default 1 NOT NULL,
|
||||
`APP_MSG_ERROR` MEDIUMTEXT,
|
||||
`TAS_ID` INTEGER default 0,
|
||||
`APP_NUMBER` INTEGER default 0,
|
||||
PRIMARY KEY (`APP_MSG_UID`),
|
||||
KEY `indexForAppUid`(`APP_UID`),
|
||||
KEY `indexForMsgStatus`(`APP_MSG_STATUS`)
|
||||
KEY `indexForMsgStatus`(`APP_MSG_STATUS`),
|
||||
KEY `INDEX_TAS_ID`(`TAS_ID`),
|
||||
KEY `INDEX_APP_NUMBER`(`APP_NUMBER`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Messages in an Application';
|
||||
#-----------------------------------------------------------------------------
|
||||
#-- APP_OWNER
|
||||
@@ -3180,6 +3184,6 @@ CREATE TABLE `PLUGINS_REGISTRY`
|
||||
`PLUGIN_TASK_EXTENDED_PROPERTIES` MEDIUMTEXT,
|
||||
`PLUGIN_ATTRIBUTES` MEDIUMTEXT,
|
||||
PRIMARY KEY (`PR_UID`)
|
||||
)ENGINE=InnoDB ;
|
||||
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Details of plugins registry';
|
||||
# This restores the fkey checks, after having unset them earlier
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
@@ -1,30 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* emailList.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
|
||||
global $RBAC;
|
||||
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use ProcessMaker\BusinessModel\Process as BmProcess;
|
||||
|
||||
$resultRbac = $RBAC->requirePermissions('PM_SETUP_ADVANCE', 'PM_SETUP_LOGS');
|
||||
if (!$resultRbac) {
|
||||
@@ -53,7 +31,8 @@ $status = array(
|
||||
$pluginRegistry = PluginRegistry::loadSingleton();
|
||||
$flagER = $pluginRegistry->isEnable('externalRegistration') ? 1 : 0;
|
||||
|
||||
$processes = getProcessArray($userUid);
|
||||
$process = new BmProcess();
|
||||
$processes = $process->getProcessList();
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
|
||||
@@ -65,32 +44,5 @@ $oHeadPublisher->assign('statusValues', $status);
|
||||
$oHeadPublisher->assign('processValues', $processes);
|
||||
$oHeadPublisher->assign('flagER', $flagER);
|
||||
|
||||
function getProcessArray($userUid) {
|
||||
global $oAppCache;
|
||||
require_once("classes/model/AppCacheView.php");
|
||||
|
||||
$processes = array();
|
||||
$processes[] = array('', G::LoadTranslation('ID_ALL_PROCESS'));
|
||||
|
||||
$cProcess = new Criteria('workflow');
|
||||
$cProcess->clearSelectColumns();
|
||||
$cProcess->addSelectColumn(AppCacheViewPeer::PRO_UID);
|
||||
$cProcess->addSelectColumn(AppCacheViewPeer::APP_PRO_TITLE);
|
||||
$cProcess->setDistinct(AppCacheViewPeer::PRO_UID);
|
||||
|
||||
$cProcess->addAscendingOrderByColumn(AppCacheViewPeer::APP_PRO_TITLE);
|
||||
|
||||
$oDataset = AppCacheViewPeer::doSelectRS($cProcess);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$processes[] = array($aRow['PRO_UID'], $aRow['APP_PRO_TITLE']);
|
||||
$oDataset->next();
|
||||
}
|
||||
|
||||
return $processes;
|
||||
}
|
||||
|
||||
G::RenderPage( 'publish', 'extJs' );
|
||||
|
||||
|
||||
@@ -30,82 +30,14 @@ switch ($req) {
|
||||
$dateTo = isset($_POST["dateTo"]) ? substr($_POST["dateTo"], 0, 10) : "";
|
||||
$filterBy = (isset($_REQUEST['filterBy'])) ? $_REQUEST['filterBy'] : 'ALL';
|
||||
|
||||
$response = new stdclass();
|
||||
$response->status = 'OK';
|
||||
|
||||
$delimiter = DBAdapter::getStringDelimiter();
|
||||
|
||||
$criteria = new Criteria();
|
||||
$criteria->addJoin(AppMessagePeer::APP_UID, ApplicationPeer::APP_UID, Criteria::LEFT_JOIN);
|
||||
|
||||
if ($emailStatus != '') {
|
||||
$criteria->add(AppMessagePeer::APP_MSG_STATUS, $emailStatus);
|
||||
}
|
||||
if ($proUid != '') {
|
||||
$criteria->add(ApplicationPeer::PRO_UID, $proUid);
|
||||
}
|
||||
|
||||
//Review the External Registration
|
||||
$arrayType = [];
|
||||
|
||||
$pluginRegistry = PluginRegistry::loadSingleton();
|
||||
$flagEr = $pluginRegistry->isEnable('externalRegistration') ? 1 : 0;
|
||||
|
||||
if ($flagEr == 0) {
|
||||
$arrayType[] = 'EXTERNAL_REGISTRATION';
|
||||
}
|
||||
|
||||
switch ($filterBy) {
|
||||
case 'CASES':
|
||||
$criteria->add(AppMessagePeer::APP_MSG_TYPE, ['TEST', 'EXTERNAL_REGISTRATION'], Criteria::NOT_IN);
|
||||
break;
|
||||
case 'TEST':
|
||||
$criteria->add(AppMessagePeer::APP_MSG_TYPE, 'TEST', Criteria::EQUAL);
|
||||
break;
|
||||
case 'EXTERNAL-REGISTRATION':
|
||||
$criteria->add(AppMessagePeer::APP_MSG_TYPE, 'EXTERNAL_REGISTRATION', Criteria::EQUAL);
|
||||
break;
|
||||
default:
|
||||
if (!empty($arrayType)) {
|
||||
$criteria->add(AppMessagePeer::APP_MSG_TYPE, $arrayType, Criteria::NOT_IN);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($dateFrom != "") {
|
||||
if ($dateTo != "") {
|
||||
if ($dateFrom == $dateTo) {
|
||||
$dateSame = $dateFrom;
|
||||
$dateFrom = $dateSame . " 00:00:00";
|
||||
$dateTo = $dateSame . " 23:59:59";
|
||||
} else {
|
||||
$dateFrom = $dateFrom . " 00:00:00";
|
||||
$dateTo = $dateTo . " 23:59:59";
|
||||
}
|
||||
|
||||
$criteria->add($criteria->getNewCriterion(AppMessagePeer::APP_MSG_DATE, $dateFrom, Criteria::GREATER_EQUAL)->addAnd($criteria->getNewCriterion(AppMessagePeer::APP_MSG_DATE, $dateTo, Criteria::LESS_EQUAL)));
|
||||
} else {
|
||||
$dateFrom = $dateFrom . " 00:00:00";
|
||||
$criteria->add(AppMessagePeer::APP_MSG_DATE, $dateFrom, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
} elseif ($dateTo != "") {
|
||||
$dateTo = $dateTo . " 23:59:59";
|
||||
$criteria->add(AppMessagePeer::APP_MSG_DATE, $dateTo, Criteria::LESS_EQUAL);
|
||||
}
|
||||
|
||||
//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);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_UID);
|
||||
@@ -113,7 +45,6 @@ switch ($req) {
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_TYPE);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_SUBJECT);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_FROM);
|
||||
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_TO);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_BODY);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_STATUS);
|
||||
@@ -121,18 +52,24 @@ switch ($req) {
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_SEND_DATE);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_SHOW_MESSAGE);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_ERROR);
|
||||
|
||||
$criteria->addSelectColumn(ApplicationPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_TITLE);
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_NUMBER);
|
||||
$criteria->addSelectColumn(ProcessPeer::PRO_TITLE);
|
||||
$criteria->addSelectColumn(TaskPeer::TAS_TITLE);
|
||||
$criteria->addJoin(AppMessagePeer::APP_UID, ApplicationPeer::APP_UID, Criteria::LEFT_JOIN);
|
||||
$criteria->addJoin(ApplicationPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
|
||||
$criteria->addJoin(AppMessagePeer::TAS_ID, TaskPeer::TAS_ID, Criteria::LEFT_JOIN);
|
||||
|
||||
if ($emailStatus != '') {
|
||||
//Status can be: All, Participated, Pending
|
||||
if (!empty($emailStatus)) {
|
||||
$criteria->add(AppMessagePeer::APP_MSG_STATUS, $emailStatus);
|
||||
}
|
||||
if ($proUid != '') {
|
||||
//Process uid
|
||||
if (!empty($proUid)) {
|
||||
$criteria->add(ApplicationPeer::PRO_UID, $proUid);
|
||||
}
|
||||
|
||||
//Filter by can be: All, Cases, Test
|
||||
switch ($filterBy) {
|
||||
case 'CASES':
|
||||
$criteria->add(AppMessagePeer::APP_MSG_TYPE, ['TEST', 'EXTERNAL_REGISTRATION'], Criteria::NOT_IN);
|
||||
@@ -149,29 +86,30 @@ switch ($req) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($dateFrom != "") {
|
||||
if ($dateTo != "") {
|
||||
if ($dateFrom == $dateTo) {
|
||||
$dateSame = $dateFrom;
|
||||
$dateFrom = $dateSame . " 00:00:00";
|
||||
$dateTo = $dateSame . " 23:59:59";
|
||||
} else {
|
||||
$dateFrom = $dateFrom . " 00:00:00";
|
||||
$dateTo = $dateTo . " 23:59:59";
|
||||
}
|
||||
|
||||
$criteria->add($criteria->getNewCriterion(AppMessagePeer::APP_MSG_DATE, $dateFrom, Criteria::GREATER_EQUAL)->addAnd($criteria->getNewCriterion(AppMessagePeer::APP_MSG_DATE, $dateTo, Criteria::LESS_EQUAL)));
|
||||
} else {
|
||||
$dateFrom = $dateFrom . " 00:00:00";
|
||||
//Date from and to
|
||||
if (!empty($dateFrom) && !empty($dateTo)) {
|
||||
$criteria->add($criteria->getNewCriterion(AppMessagePeer::APP_MSG_DATE, $dateFrom, Criteria::GREATER_EQUAL)->addAnd($criteria->getNewCriterion(AppMessagePeer::APP_MSG_DATE, $dateTo, Criteria::LESS_EQUAL)));
|
||||
} else {
|
||||
if (!empty($dateFrom)) {
|
||||
$criteria->add(AppMessagePeer::APP_MSG_DATE, $dateFrom, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
} elseif ($dateTo != "") {
|
||||
$dateTo = $dateTo . " 23:59:59";
|
||||
$criteria->add(AppMessagePeer::APP_MSG_DATE, $dateTo, Criteria::LESS_EQUAL);
|
||||
if (!empty($dateTo)) {
|
||||
$dateTo = $dateTo . " 23:59:59";
|
||||
$criteria->add(AppMessagePeer::APP_MSG_DATE, $dateTo, Criteria::LESS_EQUAL);
|
||||
}
|
||||
}
|
||||
|
||||
if ($sort != '') {
|
||||
//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']);
|
||||
|
||||
if (!empty($sort)) {
|
||||
if (!in_array($sort, AppMessagePeer::getFieldNames(BasePeer::TYPE_FIELDNAME))) {
|
||||
throw new Exception(G::LoadTranslation('ID_INVALID_VALUE_FOR', array('$sort')));
|
||||
}
|
||||
@@ -183,15 +121,11 @@ switch ($req) {
|
||||
} else {
|
||||
$oCriteria->addDescendingOrderByColumn(AppMessagePeer::APP_MSG_SEND_DATE);
|
||||
}
|
||||
if ($limit != '') {
|
||||
if (!empty($limit)) {
|
||||
$criteria->setLimit($limit);
|
||||
$criteria->setOffset($start);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AppMessagePeer::APP_UID, ApplicationPeer::APP_UID);
|
||||
$criteria->addJoin(ApplicationPeer::PRO_UID, ProcessPeer::PRO_UID);
|
||||
|
||||
|
||||
$result = AppMessagePeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$data = Array();
|
||||
@@ -209,48 +143,15 @@ switch ($req) {
|
||||
if ($row['DEL_INDEX'] != 0) {
|
||||
$index = $row['DEL_INDEX'];
|
||||
}
|
||||
|
||||
$criteria = new Criteria();
|
||||
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::APP_TITLE);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::APP_TAS_TITLE);
|
||||
$criteria->add(AppCacheViewPeer::APP_UID, $row['APP_UID'], Criteria::EQUAL);
|
||||
$criteria->add(AppCacheViewPeer::DEL_INDEX, $index, Criteria::EQUAL);
|
||||
|
||||
$resultCacheView = AppCacheViewPeer::doSelectRS($criteria);
|
||||
$resultCacheView->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$row['APP_TITLE'] = '-';
|
||||
|
||||
while ($resultCacheView->next()) {
|
||||
$rowCacheView = $resultCacheView->getRow();
|
||||
$row['APP_TITLE'] = $rowCacheView['APP_TITLE'];
|
||||
$row['TAS_TITLE'] = $rowCacheView['APP_TAS_TITLE'];
|
||||
}
|
||||
|
||||
if ($row['DEL_INDEX'] == 0) {
|
||||
$row['TAS_TITLE'] = $tasTitleDefault;
|
||||
}
|
||||
break;
|
||||
case 'TEST':
|
||||
$row['PRO_UID'] = '';
|
||||
$row['APP_NUMBER'] = '';
|
||||
$row['PRO_TITLE'] = '';
|
||||
$row['APP_TITLE'] = '';
|
||||
$row['TAS_TITLE'] = '';
|
||||
break;
|
||||
case 'EXTERNAL-REGISTRATION':
|
||||
$row['PRO_UID'] = '';
|
||||
$row['APP_NUMBER'] = '';
|
||||
$row['PRO_TITLE'] = '';
|
||||
$row['APP_TITLE'] = '';
|
||||
$row['TAS_TITLE'] = '';
|
||||
break;
|
||||
}
|
||||
|
||||
$data[] = $row;
|
||||
}
|
||||
$response = array();
|
||||
$response = [];
|
||||
$response['totalCount'] = $totalCount;
|
||||
$response['data'] = $data;
|
||||
die(G::json_encode($response));
|
||||
|
||||
@@ -2,10 +2,26 @@
|
||||
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use AbeConfiguration;
|
||||
use AbeConfigurationPeer;
|
||||
use AbeRequests;
|
||||
use AbeRequestsPeer;
|
||||
use AbeResponsesPeer;
|
||||
use ApplicationPeer;
|
||||
use AppDelegationPeer;
|
||||
use Criteria;
|
||||
use Exception;
|
||||
use G;
|
||||
use Publisher;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use PmDynaform;
|
||||
use PMLicensedFeatures;
|
||||
use ResultSet;
|
||||
use SpoolRun;
|
||||
use stdClass;
|
||||
use UsersPeer;
|
||||
use TaskPeer;
|
||||
|
||||
/**
|
||||
* Description of ActionsByEmailService
|
||||
@@ -16,14 +32,14 @@ class ActionsByEmail
|
||||
|
||||
public function saveConfiguration($params)
|
||||
{
|
||||
if (\PMLicensedFeatures
|
||||
if (PMLicensedFeatures
|
||||
::getSingleton()
|
||||
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
|
||||
$feature = $params['ActionsByEmail'];
|
||||
switch ($feature['type']) {
|
||||
case 'configuration':
|
||||
require_once 'classes/model/AbeConfiguration.php';
|
||||
$abeConfigurationInstance = new \AbeConfiguration();
|
||||
$abeConfigurationInstance = new AbeConfiguration();
|
||||
|
||||
if (isset($feature['fields']['ABE_CASE_NOTE_IN_RESPONSE'])) {
|
||||
$arrayAux = json_decode($feature['fields']['ABE_CASE_NOTE_IN_RESPONSE']);
|
||||
@@ -48,7 +64,7 @@ class ActionsByEmail
|
||||
public function loadConfiguration($params)
|
||||
{
|
||||
if ($params['type'] != 'activity'
|
||||
|| !\PMLicensedFeatures
|
||||
|| !PMLicensedFeatures
|
||||
::getSingleton()
|
||||
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0='))
|
||||
{
|
||||
@@ -56,11 +72,11 @@ class ActionsByEmail
|
||||
}
|
||||
require_once 'classes/model/AbeConfiguration.php';
|
||||
|
||||
$criteria = new \Criteria();
|
||||
$criteria->add(\AbeConfigurationPeer::PRO_UID, $params['PRO_UID']);
|
||||
$criteria->add(\AbeConfigurationPeer::TAS_UID, $params['TAS_UID']);
|
||||
$result = \AbeConfigurationPeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$criteria = new Criteria();
|
||||
$criteria->add(AbeConfigurationPeer::PRO_UID, $params['PRO_UID']);
|
||||
$criteria->add(AbeConfigurationPeer::TAS_UID, $params['TAS_UID']);
|
||||
$result = AbeConfigurationPeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$result->next();
|
||||
$configuration = array();
|
||||
if ($configuration = $result->getRow()) {
|
||||
@@ -92,7 +108,7 @@ class ActionsByEmail
|
||||
}
|
||||
|
||||
if ($arrayData['TEMPLATE'] == '') {
|
||||
throw new Exception(\G::LoadTranslation('ID_TEMPLATE_PARAMETER_EMPTY'));
|
||||
throw new Exception(G::LoadTranslation('ID_TEMPLATE_PARAMETER_EMPTY'));
|
||||
}
|
||||
|
||||
$data = array(
|
||||
@@ -104,10 +120,10 @@ class ActionsByEmail
|
||||
|
||||
global $G_PUBLISH;
|
||||
|
||||
$G_PUBLISH = new \Publisher();
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'actionsByEmail/actionsByEmail_FileEdit', '', $data);
|
||||
|
||||
\G::RenderPage('publish', 'raw');
|
||||
G::RenderPage('publish', 'raw');
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -123,7 +139,7 @@ class ActionsByEmail
|
||||
}
|
||||
|
||||
if ($arrayData['TEMPLATE'] == '') {
|
||||
throw new Exception(\G::LoadTranslation('ID_TEMPLATE_PARAMETER_EMPTY'));
|
||||
throw new Exception(G::LoadTranslation('ID_TEMPLATE_PARAMETER_EMPTY'));
|
||||
}
|
||||
|
||||
$templateFile = fopen(PATH_DATA_MAILTEMPLATES . $arrayData['PRO_UID'] . PATH_SEP . $arrayData['TEMPLATE'], 'w');
|
||||
@@ -145,8 +161,9 @@ class ActionsByEmail
|
||||
$arrayData['PRO_UID'] = '';
|
||||
}
|
||||
|
||||
$response->emailFields = array();
|
||||
$response->actionFields = array();
|
||||
$response = new stdClass();
|
||||
$response->emailFields = [];
|
||||
$response->actionFields = [];
|
||||
|
||||
if ($arrayData['PRO_UID'] != '' && $arrayData['DYN_UID']) {
|
||||
$dynaform = new Form($arrayData['PRO_UID'] . PATH_SEP . $arrayData['DYN_UID'], PATH_DYNAFORM, SYS_LANG, false);
|
||||
@@ -212,30 +229,31 @@ class ActionsByEmail
|
||||
}
|
||||
|
||||
if ($arrayData['PRO_UID'] == '') {
|
||||
throw new Exception(\G::LoadTranslation('ID_PRO_UID_PARAMETER_IS_EMPTY'));
|
||||
throw new Exception(G::LoadTranslation('ID_PRO_UID_PARAMETER_IS_EMPTY'));
|
||||
}
|
||||
|
||||
if ($arrayData['TAS_UID'] == '') {
|
||||
throw new Exception(\G::LoadTranslation('ID_TAS_UID_PARAMETER_IS_EMPTY'));
|
||||
throw new Exception(G::LoadTranslation('ID_TAS_UID_PARAMETER_IS_EMPTY'));
|
||||
}
|
||||
|
||||
$abeConfigurationInstance = new \AbeConfiguration();
|
||||
$abeConfigurationInstance = new AbeConfiguration();
|
||||
|
||||
$response = new stdClass();
|
||||
if ($arrayData['ABE_TYPE'] != '') {
|
||||
if ($arrayData['DYN_UID'] == '') {
|
||||
throw new Exception(\G::LoadTranslation('ID_DYN_UID_PARAMETER_IS_EMPTY'));
|
||||
throw new Exception(G::LoadTranslation('ID_DYN_UID_PARAMETER_IS_EMPTY'));
|
||||
}
|
||||
|
||||
try {
|
||||
$response->ABE_UID = $abeConfigurationInstance->createOrUpdate($arrayData);
|
||||
} catch (\Exception $error) {
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
$abeConfigurationInstance->deleteByTasUid($arrayData['TAS_UID']);
|
||||
$response->ABE_UID = '';
|
||||
} catch (\Exception $error) {
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
@@ -246,51 +264,51 @@ class ActionsByEmail
|
||||
|
||||
public function loadActionByEmail(array $arrayData)
|
||||
{
|
||||
$criteria = new \Criteria();
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn('COUNT(*)');
|
||||
|
||||
$criteria->addJoin(\AbeConfigurationPeer::ABE_UID, \AbeRequestsPeer::ABE_UID);
|
||||
$criteria->addJoin(\AppDelegationPeer::APP_UID, \AbeRequestsPeer::APP_UID);
|
||||
$criteria->addJoin(\AppDelegationPeer::DEL_INDEX, \AbeRequestsPeer::DEL_INDEX);
|
||||
$result = \AbeConfigurationPeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$criteria->addJoin(AbeConfigurationPeer::ABE_UID, AbeRequestsPeer::ABE_UID);
|
||||
$criteria->addJoin(AppDelegationPeer::APP_UID, AbeRequestsPeer::APP_UID);
|
||||
$criteria->addJoin(AppDelegationPeer::DEL_INDEX, AbeRequestsPeer::DEL_INDEX);
|
||||
$result = AbeConfigurationPeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$result->next();
|
||||
$totalCount = $result->getRow();
|
||||
$totalCount = $totalCount['COUNT(*)'];
|
||||
|
||||
$criteria = new \Criteria();
|
||||
$criteria->addSelectColumn(\AbeConfigurationPeer::ABE_UID);
|
||||
$criteria->addSelectColumn(\AbeConfigurationPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(\AbeConfigurationPeer::TAS_UID);
|
||||
$criteria->addSelectColumn(\AbeConfigurationPeer::ABE_UPDATE_DATE);
|
||||
$criteria->addSelectColumn(\AbeConfigurationPeer::ABE_TEMPLATE);
|
||||
$criteria->addSelectColumn(\AbeConfigurationPeer::ABE_ACTION_FIELD);
|
||||
$criteria->addSelectColumn(\AbeConfigurationPeer::DYN_UID);
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_UPDATE_DATE);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_TEMPLATE);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID);
|
||||
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::ABE_REQ_UID);
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::APP_UID);
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::DEL_INDEX);
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::ABE_REQ_SENT_TO);
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::ABE_REQ_STATUS);
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::ABE_REQ_SUBJECT);
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::ABE_REQ_ANSWERED);
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::ABE_REQ_BODY);
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::ABE_REQ_DATE);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::APP_UID);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SENT_TO);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_STATUS);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SUBJECT);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_ANSWERED);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_BODY);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_DATE);
|
||||
|
||||
$criteria->addSelectColumn(\ApplicationPeer::APP_NUMBER);
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_NUMBER);
|
||||
|
||||
$criteria->addSelectColumn(\AppDelegationPeer::DEL_PREVIOUS);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS);
|
||||
|
||||
$criteria->addJoin(\AbeConfigurationPeer::ABE_UID, \AbeRequestsPeer::ABE_UID);
|
||||
$criteria->addJoin(\ApplicationPeer::APP_UID, \AbeRequestsPeer::APP_UID);
|
||||
$criteria->addJoin(AbeConfigurationPeer::ABE_UID, AbeRequestsPeer::ABE_UID);
|
||||
$criteria->addJoin(ApplicationPeer::APP_UID, AbeRequestsPeer::APP_UID);
|
||||
|
||||
$criteria->addJoin(\AppDelegationPeer::APP_UID, \AbeRequestsPeer::APP_UID);
|
||||
$criteria->addJoin(\AppDelegationPeer::DEL_INDEX, \AbeRequestsPeer::DEL_INDEX);
|
||||
$criteria->addDescendingOrderByColumn(\AbeRequestsPeer::ABE_REQ_DATE);
|
||||
$criteria->addJoin(AppDelegationPeer::APP_UID, AbeRequestsPeer::APP_UID);
|
||||
$criteria->addJoin(AppDelegationPeer::DEL_INDEX, AbeRequestsPeer::DEL_INDEX);
|
||||
$criteria->addDescendingOrderByColumn(AbeRequestsPeer::ABE_REQ_DATE);
|
||||
$criteria->setLimit($arrayData['limit']);
|
||||
$criteria->setOffset($arrayData['start']);
|
||||
$result = \AbeConfigurationPeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$result = AbeConfigurationPeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$data = Array();
|
||||
$arrayPro = Array();
|
||||
$arrayTAS = Array();
|
||||
@@ -298,18 +316,18 @@ class ActionsByEmail
|
||||
|
||||
while ($result->next()) {
|
||||
$data[] = $result->getRow();
|
||||
$criteriaRes = new \Criteria();
|
||||
$criteriaRes = new Criteria();
|
||||
|
||||
$criteriaRes->addSelectColumn(\AbeResponsesPeer::ABE_RES_UID);
|
||||
$criteriaRes->addSelectColumn(\AbeResponsesPeer::ABE_RES_CLIENT_IP);
|
||||
$criteriaRes->addSelectColumn(\AbeResponsesPeer::ABE_RES_DATA);
|
||||
$criteriaRes->addSelectColumn(\AbeResponsesPeer::ABE_RES_STATUS);
|
||||
$criteriaRes->addSelectColumn(\AbeResponsesPeer::ABE_RES_MESSAGE);
|
||||
$criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_UID);
|
||||
$criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_CLIENT_IP);
|
||||
$criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_DATA);
|
||||
$criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_STATUS);
|
||||
$criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_MESSAGE);
|
||||
|
||||
$criteriaRes->add(\AbeResponsesPeer::ABE_REQ_UID, $data[$index]['ABE_REQ_UID']);
|
||||
$criteriaRes->add(AbeResponsesPeer::ABE_REQ_UID, $data[$index]['ABE_REQ_UID']);
|
||||
|
||||
$resultRes = \AbeResponsesPeer::doSelectRS($criteriaRes);
|
||||
$resultRes->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$resultRes = AbeResponsesPeer::doSelectRS($criteriaRes);
|
||||
$resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$resultRes->next();
|
||||
$dataRes = Array();
|
||||
|
||||
@@ -327,17 +345,17 @@ class ActionsByEmail
|
||||
$data[$index]['ABE_RES_MESSAGE'] = '';
|
||||
}
|
||||
|
||||
$criteriaRes = new \Criteria();
|
||||
$criteriaRes = new Criteria();
|
||||
|
||||
$criteriaRes->addSelectColumn(\AppDelegationPeer::USR_UID);
|
||||
$criteriaRes->addSelectColumn(\UsersPeer::USR_FIRSTNAME);
|
||||
$criteriaRes->addSelectColumn(\UsersPeer::USR_LASTNAME);
|
||||
$criteriaRes->addSelectColumn(AppDelegationPeer::USR_UID);
|
||||
$criteriaRes->addSelectColumn(UsersPeer::USR_FIRSTNAME);
|
||||
$criteriaRes->addSelectColumn(UsersPeer::USR_LASTNAME);
|
||||
|
||||
$criteria->addJoin(\AppDelegationPeer::APP_UID, $data[$index]['APP_UID']);
|
||||
$criteria->addJoin(\AppDelegationPeer::DEL_INDEX, $data[$index]['DEL_PREVIOUS']);
|
||||
$criteria->addJoin(\AppDelegationPeer::USR_UID, \UsersPeer::USR_UID);
|
||||
$resultRes = \AppDelegationPeer::doSelectRS($criteriaRes);
|
||||
$resultRes->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$criteria->addJoin(AppDelegationPeer::APP_UID, $data[$index]['APP_UID']);
|
||||
$criteria->addJoin(AppDelegationPeer::DEL_INDEX, $data[$index]['DEL_PREVIOUS']);
|
||||
$criteria->addJoin(AppDelegationPeer::USR_UID, UsersPeer::USR_UID);
|
||||
$resultRes = AppDelegationPeer::doSelectRS($criteriaRes);
|
||||
$resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$resultRes->next();
|
||||
|
||||
if ($dataRes = $resultRes->getRow()) {
|
||||
@@ -370,31 +388,31 @@ class ActionsByEmail
|
||||
$arrayData['REQ_UID'] = '';
|
||||
}
|
||||
|
||||
$criteria = new \Criteria();
|
||||
$criteria->addSelectColumn(\AbeConfigurationPeer::ABE_UID);
|
||||
$criteria->addSelectColumn(\AbeConfigurationPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(\AbeConfigurationPeer::TAS_UID);
|
||||
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::ABE_REQ_UID);
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::APP_UID);
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::DEL_INDEX);
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::ABE_REQ_SENT_TO);
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::ABE_REQ_SUBJECT);
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::ABE_REQ_BODY);
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::ABE_REQ_ANSWERED);
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::ABE_REQ_STATUS);
|
||||
|
||||
$criteria->addSelectColumn(\AppDelegationPeer::DEL_FINISH_DATE);
|
||||
|
||||
$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->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID);
|
||||
$criteria->addSelectColumn(TaskPeer::TAS_ID);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::APP_UID);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SENT_TO);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SUBJECT);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_BODY);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_ANSWERED);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_STATUS);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
|
||||
$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']);
|
||||
$resultRes = AbeRequestsPeer::doSelectRS($criteria);
|
||||
$resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$resultRes->next();
|
||||
$dataRes = Array();
|
||||
$dataRes = [];
|
||||
|
||||
if ($dataRes = $resultRes->getRow()) {
|
||||
if (is_null($dataRes['DEL_FINISH_DATE'])) {
|
||||
@@ -402,7 +420,7 @@ class ActionsByEmail
|
||||
$emailServer = new \ProcessMaker\BusinessModel\EmailServer();
|
||||
$criteria = $emailServer->getEmailServerCriteria();
|
||||
$rsCriteria = \EmailServerPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
@@ -414,7 +432,7 @@ class ActionsByEmail
|
||||
$spool = new SpoolRun();
|
||||
$spool->setConfig($aSetup);
|
||||
|
||||
$spool->create(array(
|
||||
$spool->create([
|
||||
'msg_uid' => '',
|
||||
'app_uid' => $dataRes['APP_UID'],
|
||||
'del_index' => $dataRes['DEL_INDEX'],
|
||||
@@ -427,29 +445,30 @@ class ActionsByEmail
|
||||
'app_msg_bcc' => '',
|
||||
'app_msg_attach' => '',
|
||||
'app_msg_template' => '',
|
||||
'app_msg_status' => 'pending'
|
||||
));
|
||||
'app_msg_status' => 'pending',
|
||||
"tas_id" => $dataRes['TAS_ID'],
|
||||
"app_number" => isset($dataRes['APP_NUMBER']) ? $dataRes['APP_NUMBER'] : ''
|
||||
]);
|
||||
|
||||
if ($spool->sendMail()) {
|
||||
$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 {
|
||||
$dataRes['ABE_REQ_STATUS'] = 'ERROR';
|
||||
$message = \G::LoadTranslation('ID_THERE_PROBLEM_SENDING_EMAIL') . ': '. $dataRes['ABE_REQ_SENT_TO'] . ', ' . G::LoadTranslation('ID_PLEASE_TRY_LATER');
|
||||
$message = G::LoadTranslation('ID_THERE_PROBLEM_SENDING_EMAIL') . ': ' . $dataRes['ABE_REQ_SENT_TO'] . ', ' . G::LoadTranslation('ID_PLEASE_TRY_LATER');
|
||||
}
|
||||
|
||||
try {
|
||||
$abeRequestsInstance = new \AbeRequests();
|
||||
$abeRequestsInstance = new AbeRequests();
|
||||
$abeRequestsInstance->createOrUpdate($dataRes);
|
||||
} catch (\Exception $error) {
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
} else {
|
||||
$message = \G::LoadTranslation('ID_UNABLE_TO_SEND_EMAIL');
|
||||
$message = G::LoadTranslation('ID_UNABLE_TO_SEND_EMAIL');
|
||||
}
|
||||
} else {
|
||||
$message = \G::LoadTranslation('ID_UNEXPECTED_ERROR_OCCURRED_PLEASE');
|
||||
$message = G::LoadTranslation('ID_UNEXPECTED_ERROR_OCCURRED_PLEASE');
|
||||
}
|
||||
|
||||
//Return
|
||||
@@ -469,29 +488,29 @@ class ActionsByEmail
|
||||
$arrayData['REQ_UID'] = '';
|
||||
}
|
||||
|
||||
$criteria = new \Criteria();
|
||||
$criteria->addSelectColumn(\AbeConfigurationPeer::ABE_UID);
|
||||
$criteria->addSelectColumn(\AbeConfigurationPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(\AbeConfigurationPeer::TAS_UID);
|
||||
$criteria->addSelectColumn(\AbeConfigurationPeer::DYN_UID);
|
||||
$criteria->addSelectColumn(\AbeConfigurationPeer::ABE_ACTION_FIELD);
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD);
|
||||
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::ABE_REQ_UID);
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::APP_UID);
|
||||
$criteria->addSelectColumn(\AbeRequestsPeer::DEL_INDEX);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::APP_UID);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX);
|
||||
|
||||
$criteria->addSelectColumn(\AbeResponsesPeer::ABE_RES_UID);
|
||||
$criteria->addSelectColumn(\AbeResponsesPeer::ABE_RES_DATA);
|
||||
$criteria->addSelectColumn(AbeResponsesPeer::ABE_RES_UID);
|
||||
$criteria->addSelectColumn(AbeResponsesPeer::ABE_RES_DATA);
|
||||
|
||||
$criteria->add(\AbeRequestsPeer::ABE_REQ_UID, $arrayData['REQ_UID']);
|
||||
$criteria->addJoin(\AbeRequestsPeer::ABE_UID, \AbeConfigurationPeer::ABE_UID);
|
||||
$criteria->addJoin(\AbeResponsesPeer::ABE_REQ_UID, \AbeRequestsPeer::ABE_REQ_UID);
|
||||
$resultRes = \AbeRequestsPeer::doSelectRS($criteria);
|
||||
$resultRes->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$criteria->add(AbeRequestsPeer::ABE_REQ_UID, $arrayData['REQ_UID']);
|
||||
$criteria->addJoin(AbeRequestsPeer::ABE_UID, AbeConfigurationPeer::ABE_UID);
|
||||
$criteria->addJoin(AbeResponsesPeer::ABE_REQ_UID, AbeRequestsPeer::ABE_REQ_UID);
|
||||
$resultRes = AbeRequestsPeer::doSelectRS($criteria);
|
||||
$resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$resultRes->next();
|
||||
$dataRes = Array();
|
||||
$message = \G::LoadTranslation('ID_USER_NOT_RESPONDED_REQUEST');
|
||||
$message = G::LoadTranslation('ID_USER_NOT_RESPONDED_REQUEST');
|
||||
if ($dataRes = $resultRes->getRow()) {
|
||||
$_SESSION['CURRENT_DYN_UID'] = trim($dataRes['DYN_UID']);
|
||||
|
||||
@@ -572,12 +591,12 @@ class ActionsByEmail
|
||||
$configuration['CURRENT_DYNAFORM'] = trim($dataRes['DYN_UID']);
|
||||
$configuration['PRO_UID'] = trim($dataRes['PRO_UID']);
|
||||
|
||||
$criteriaD = new \Criteria();
|
||||
$criteriaD = new Criteria();
|
||||
$criteriaD->addSelectColumn(\DynaformPeer::DYN_CONTENT);
|
||||
$criteriaD->addSelectColumn(\DynaformPeer::PRO_UID);
|
||||
$criteriaD->add(\DynaformPeer::DYN_UID, trim($dataRes['DYN_UID']));
|
||||
$resultD = \DynaformPeer::doSelectRS($criteriaD);
|
||||
$resultD->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$resultD->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$resultD->next();
|
||||
$configuration = $resultD->getRow();
|
||||
|
||||
@@ -587,7 +606,7 @@ class ActionsByEmail
|
||||
if ($dataRes['ABE_RES_DATA'] !== '') {
|
||||
$value = unserialize($dataRes['ABE_RES_DATA']);
|
||||
$actionField = str_replace(array('@@','@#','@=','@%','@?','@$'), '', $dataRes['ABE_ACTION_FIELD']);
|
||||
$variables = \G::json_decode($configuration['DYN_CONTENT'], true);
|
||||
$variables = G::json_decode($configuration['DYN_CONTENT'], true);
|
||||
if (is_array($value)) {
|
||||
if(isset($variables['items'][0]['items'])) {
|
||||
$fields = $variables['items'][0]['items'];
|
||||
@@ -654,13 +673,13 @@ class ActionsByEmail
|
||||
);
|
||||
|
||||
//Verify login
|
||||
$criteria = new \Criteria('workflow');
|
||||
$criteria = new Criteria('workflow');
|
||||
|
||||
$criteria->add(\AbeConfigurationPeer::PRO_UID, $arrayAppDelegationData['PRO_UID'], \Criteria::EQUAL);
|
||||
$criteria->add(\AbeConfigurationPeer::TAS_UID, $arrayAppDelegationData['TAS_UID'], \Criteria::EQUAL);
|
||||
$criteria->add(AbeConfigurationPeer::PRO_UID, $arrayAppDelegationData['PRO_UID'], Criteria::EQUAL);
|
||||
$criteria->add(AbeConfigurationPeer::TAS_UID, $arrayAppDelegationData['TAS_UID'], Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \AbeConfigurationPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria = AbeConfigurationPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
$record = $rsCriteria->getRow();
|
||||
@@ -671,7 +690,7 @@ class ActionsByEmail
|
||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
/*----------------------------------********---------------------------------*/
|
||||
//SSO
|
||||
if (\PMLicensedFeatures::getSingleton()->verifyfeature('x4TTzlISnp2K2tnSTJoMC8rTDRMTjlhMCtZeXV0QnNCLzU=')) {
|
||||
if (PMLicensedFeatures::getSingleton()->verifyfeature('x4TTzlISnp2K2tnSTJoMC8rTDRMTjlhMCtZeXV0QnNCLzU=')) {
|
||||
|
||||
$sso = new \PmSsoClass();
|
||||
|
||||
@@ -716,7 +735,7 @@ class ActionsByEmail
|
||||
$flagLogin = true;
|
||||
} else {
|
||||
if ($_SESSION['USER_LOGGED'] != $arrayAppDelegationData['USR_UID']) {
|
||||
\G::SendTemporalMessage('ID_CASE_ASSIGNED_ANOTHER_USER', 'error', 'label');
|
||||
G::SendTemporalMessage('ID_CASE_ASSIGNED_ANOTHER_USER', 'error', 'label');
|
||||
|
||||
$flagLogin = true;
|
||||
}
|
||||
@@ -732,7 +751,7 @@ class ActionsByEmail
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ namespace ProcessMaker\BusinessModel;
|
||||
use G;
|
||||
use Criteria;
|
||||
use DynaformHandler;
|
||||
use ProcessPeer;
|
||||
use ResultSet;
|
||||
|
||||
class Process
|
||||
{
|
||||
@@ -1837,4 +1839,43 @@ class Process
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* We will get the process list
|
||||
* will be return the "PRO_ID" value for the processes, otherwise, return the "PRO_UID" value
|
||||
*
|
||||
* @param string $search
|
||||
* @param boolean $useProId, we can define if we use the PRO ID instead of PRO_UID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getProcessList($search = '', $useProId = false)
|
||||
{
|
||||
$processes = [];
|
||||
$processes[] = ["", G::LoadTranslation("ID_ALL_PROCESS")];
|
||||
|
||||
$process = new Criteria("workflow");
|
||||
$process->clearSelectColumns();
|
||||
$process->addSelectColumn(ProcessPeer::PRO_ID);
|
||||
$process->addSelectColumn(ProcessPeer::PRO_UID);
|
||||
$process->addSelectColumn(ProcessPeer::PRO_TITLE);
|
||||
$process->add(ProcessPeer::PRO_STATUS, "ACTIVE");
|
||||
if (!empty($search)) {
|
||||
$process->add(ProcessPeer::PRO_TITLE, "%$search%", Criteria::LIKE);
|
||||
}
|
||||
$dataset = ProcessPeer::doSelectRS($process);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
while ($row = $dataset->getRow()) {
|
||||
if ($useProId) {
|
||||
$processes[] = [$row["PRO_ID"], $row["PRO_TITLE"]];
|
||||
} else {
|
||||
$processes[] = [$row['PRO_UID'], $row['PRO_TITLE']];
|
||||
}
|
||||
|
||||
$dataset->next();
|
||||
}
|
||||
|
||||
return $processes;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user