PM-3895 Notifications to all assignees

modify schema.sql add index notification
This commit is contained in:
Ronald Quenta
2015-10-29 11:05:16 -04:00
parent e00065280a
commit 883f6308ed
4 changed files with 32 additions and 5 deletions

View File

@@ -134,6 +134,26 @@ class NotificationDevice extends BaseNotificationDevice {
return $device;
}
public function loadUsersArrayId ($arrayUserId)
{
try {
$criteria = new Criteria();
$criteria->clearSelectColumns();
$criteria->add(NotificationDevicePeer::USR_UID, $arrayUserId, Criteria::IN);
$rs = NotificationDevicePeer::doSelectRS($criteria);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$device = array();
while ($rs->next()) {
$row = $rs->getRow();
$device[] = $row;
}
} catch (Exception $error) {
throw $error;
}
return $device;
}
public function getAll ()
{
$oCriteria = new Criteria( 'workflow' );

View File

@@ -5190,6 +5190,15 @@
<column name="DEV_TYPE" type="VARCHAR" size="50" required="true" default=""/>
<column name="DEV_CREATE" type="TIMESTAMP" required="true" />
<column name="DEV_UPDATE" type="TIMESTAMP" required="true" />
<index name="indexUserNotification">
<index-column name="USR_UID"/>
<vendor type="mysql">
<parameter name="Table" value="NOTIFICATION_DEVICE"/>
<parameter name="Non_unique" value="1"/>
<parameter name="Key_name" value="indexUserNotification"/>
<parameter name="Seq_in_index" value="1"/>
</vendor>
</index>
</table>
</database>

View File

@@ -2913,7 +2913,8 @@ CREATE TABLE `NOTIFICATION_DEVICE`
`DEV_TYPE` VARCHAR(50) default '',
`DEV_CREATE` DATETIME NOT NULL,
`DEV_UPDATE` DATETIME NOT NULL,
PRIMARY KEY (`DEV_UID`, `USR_UID`)
PRIMARY KEY (`DEV_UID`, `USR_UID`),
KEY `indexUserNotification`(`USR_UID`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Definitions Notification device.';
# This restores the fkey checks, after having unset them earlier
# SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -208,10 +208,7 @@ class NotificationDevice
$oNoti = new \NotificationDevice();
$devices = array();
if (is_array($userIds)){
foreach ($userIds as $id) {
$deviceUser = $oNoti->loadByUsersId($id);
$devices = array_merge($devices, $deviceUser);
}
$devices = $oNoti->loadUsersArrayId($userIds);
} else {
$devices = $oNoti->loadByUsersId($userIds);
$lists = new \ProcessMaker\BusinessModel\Lists();