This commit is contained in:
Paula Quispe
2017-11-06 14:27:06 -04:00
parent 9452251602
commit da21796794
14 changed files with 360 additions and 197 deletions

View File

@@ -5445,6 +5445,12 @@ 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'];
}
$oSpool->setConfig($dataLastEmail['configuration']);
$oSpool->create(array(
"msg_uid" => "",
@@ -5460,7 +5466,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'] == '') {

View File

@@ -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();

View File

@@ -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

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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

View File

@@ -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);

View File

@@ -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)';

View File

@@ -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">

View File

@@ -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;

View File

@@ -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' );

View File

@@ -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";
}
//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 {
$dateFrom = $dateFrom . " 00:00:00";
if (!empty($dateFrom)) {
$criteria->add(AppMessagePeer::APP_MSG_DATE, $dateFrom, Criteria::GREATER_EQUAL);
}
} elseif ($dateTo != "") {
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));

View File

@@ -385,6 +385,7 @@ class ActionsByEmail
$criteria->addSelectColumn(\AbeRequestsPeer::ABE_REQ_STATUS);
$criteria->addSelectColumn(\AppDelegationPeer::DEL_FINISH_DATE);
$criteria->addSelectColumn(\AppDelegationPeer::APP_NUMBER);
$criteria->add(\AbeRequestsPeer::ABE_REQ_UID, $arrayData['REQ_UID']);
$criteria->addJoin(\AbeRequestsPeer::ABE_UID, \AbeConfigurationPeer::ABE_UID);
@@ -414,6 +415,12 @@ class ActionsByEmail
$spool = new SpoolRun();
$spool->setConfig($aSetup);
//Load the TAS_ID
if (!isset($arrayData['TAS_ID'])) {
$task= new Task();
$taskId = $task->load($dataRes['TAS_UID'])['TAS_ID'];
}
$spool->create(array(
'msg_uid' => '',
'app_uid' => $dataRes['APP_UID'],
@@ -427,7 +434,9 @@ class ActionsByEmail
'app_msg_bcc' => '',
'app_msg_attach' => '',
'app_msg_template' => '',
'app_msg_status' => 'pending'
'app_msg_status' => 'pending',
"tas_id" => $taskId,
"app_number" => isset($dataRes['APP_NUMBER']) ? $dataRes['APP_NUMBER'] : ''
));
if ($spool->sendMail()) {

View File

@@ -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;
}
}