diff --git a/composer.lock b/composer.lock index fb1946655..8cf93aa42 100644 --- a/composer.lock +++ b/composer.lock @@ -644,7 +644,7 @@ ], "authors": [ { - "name": "Jean-Marc Trémeaux", + "name": "Jean-Marc Trémeaux", "homepage": "http://naku.dohcrew.com/", "role": "Developer" }, @@ -3456,7 +3456,7 @@ ], "authors": [ { - "name": "François Zaninotto" + "name": "François Zaninotto" } ], "description": "Faker is a PHP library that generates fake data for you.", @@ -3500,7 +3500,7 @@ ], "authors": [ { - "name": "Christian Lück", + "name": "Christian Lück", "email": "christian@lueck.tv" } ], @@ -4099,7 +4099,7 @@ ], "authors": [ { - "name": "Ondřej Machulda", + "name": "OndÅ™ej Machulda", "email": "ondrej.machulda@gmail.com" } ], diff --git a/workflow/engine/classes/Groups.php b/workflow/engine/classes/Groups.php index ed257661a..b00b776b1 100644 --- a/workflow/engine/classes/Groups.php +++ b/workflow/engine/classes/Groups.php @@ -95,18 +95,18 @@ class Groups if (is_object($groupUser) && get_class($groupUser) == 'GroupUser') { return true; } else { + $group = GroupwfPeer::retrieveByPK($grpUid); + $groupUser = new GroupUser(); $groupUser->setGrpUid($grpUid); $groupUser->setUsrUid($usrUid); + $groupUser->setGrpId($group->getGrpId()); $groupUser->Save(); - $groupWf = new Groupwf(); - $grpName = $groupWf->loadByGroupUid($grpUid); - $users = new Users(); $usrName = $users->load($usrUid); - G::auditLog("AssignUserToGroup", "Assign user ". $usrName['USR_USERNAME'] ." (".$usrUid.") to group ".$grpName['CON_VALUE']." (".$grpUid.") "); + G::auditLog("AssignUserToGroup", "Assign user " . $usrName['USR_USERNAME'] . " (" . $usrUid . ") to group " . $group->getGrpTitle() . " (" . $grpUid . ") "); return true; } diff --git a/workflow/engine/classes/WorkspaceTools.php b/workflow/engine/classes/WorkspaceTools.php index d1094597c..52b24b706 100644 --- a/workflow/engine/classes/WorkspaceTools.php +++ b/workflow/engine/classes/WorkspaceTools.php @@ -358,6 +358,12 @@ class WorkspaceTools $stop = microtime(true); CLI::logging("<*> Migrating history data took " . ($stop - $start) . " seconds.\n"); /*----------------------------------********---------------------------------*/ + + $start = microtime(true); + CLI::logging("> Optimizing Self-Service data in table APP_ASSIGN_SELF_SERVICE_VALUE_GROUP....\n"); + $this->upgradeSelfServiceData(); + $stop = microtime(true); + CLI::logging("<*> Optimizing Self-Service data in table APP_ASSIGN_SELF_SERVICE_VALUE_GROUP took " . ($stop - $start) . " seconds.\n"); } /** @@ -4251,6 +4257,7 @@ class WorkspaceTools $this->setLastContentMigrateTable(true); } } + /** * Remove the DYN_CONTENT_HISTORY from APP_HISTORY * @@ -4448,4 +4455,68 @@ class WorkspaceTools $conf->saveConfig('MIGRATED_APP_HISTORY', 'history'); } /*----------------------------------********---------------------------------*/ + + /** + * Upgrade APP_ASSIGN_SELF_SERVICE_VALUE_GROUP and GROUP_USER tables. + * Before only the identification value of 32 characters was used, now the + * numerical value plus the type is used, 1 for the user and 2 for the group, + * if it is not found, it is updated with -1. + * + * @param object $con + * + * @return void + */ + public function upgradeSelfServiceData($con = null) + { + if ($con === null) { + $this->initPropel(true); + $con = Propel::getConnection(AppDelegationPeer::DATABASE_NAME); + } + + CLI::logging("-> Update table GROUP_USER\n"); + $con->begin(); + $stmt = $con->createStatement(); + $stmt->executeQuery("" + . "UPDATE GROUPWF AS GW " + . "INNER JOIN GROUP_USER AS GU ON " + . " GW.GRP_UID=GU.GRP_UID " + . "SET GU.GRP_ID=GW.GRP_ID " + . "WHERE GU.GRP_ID = 0"); + $con->commit(); + + CLI::logging("-> Update table APP_ASSIGN_SELF_SERVICE_VALUE_GROUP\n"); + $con->begin(); + $stmt = $con->createStatement(); + $stmt->executeQuery("" + . "UPDATE GROUPWF AS GW " + . "INNER JOIN APP_ASSIGN_SELF_SERVICE_VALUE_GROUP AS GU ON " + . " GW.GRP_UID=GU.GRP_UID " + . "SET " + . "GU.ASSIGNEE_ID=GW.GRP_ID, " + . "GU.ASSIGNEE_TYPE=2 " + . "WHERE GU.ASSIGNEE_ID = 0"); + $con->commit(); + + $con->begin(); + $stmt = $con->createStatement(); + $stmt->executeQuery("" + . "UPDATE USERS AS U " + . "INNER JOIN APP_ASSIGN_SELF_SERVICE_VALUE_GROUP AS GU ON " + . " U.USR_UID=GU.GRP_UID " + . "SET " + . "GU.ASSIGNEE_ID=U.USR_ID, " + . "GU.ASSIGNEE_TYPE=1 " + . "WHERE GU.ASSIGNEE_ID = 0"); + $con->commit(); + + $con->begin(); + $stmt = $con->createStatement(); + $stmt->executeQuery("" + . "UPDATE APP_ASSIGN_SELF_SERVICE_VALUE_GROUP " + . "SET " + . "ASSIGNEE_ID=-1, " + . "ASSIGNEE_TYPE=-1 " + . "WHERE ASSIGNEE_ID = 0"); + $con->commit(); + } } diff --git a/workflow/engine/classes/model/AppAssignSelfServiceValueGroup.php b/workflow/engine/classes/model/AppAssignSelfServiceValueGroup.php index f1fd646c7..3683a9d40 100644 --- a/workflow/engine/classes/model/AppAssignSelfServiceValueGroup.php +++ b/workflow/engine/classes/model/AppAssignSelfServiceValueGroup.php @@ -2,44 +2,100 @@ require_once 'classes/model/om/BaseAppAssignSelfServiceValueGroup.php'; - /** * Skeleton subclass for representing a row from the 'APP_ASSIGN_SELF_SERVICE_VALUE_GROUP' table. - * - * - * * You should add additional methods to this class to meet the * application requirements. This class will only be generated as * long as it does not already exist in the output directory. - * - * @package classes.model */ -class AppAssignSelfServiceValueGroup extends BaseAppAssignSelfServiceValueGroup { +class AppAssignSelfServiceValueGroup extends BaseAppAssignSelfServiceValueGroup +{ - public function createRows($appAssignSelfServiceValueId, $dataVariable) { - try { - $con = Propel::getConnection(AppAssignSelfServiceValuePeer::DATABASE_NAME); - $con->begin(); - $stmt = $con->createStatement(); - if (is_array($dataVariable)) { - foreach ($dataVariable as $uid) { - $rs = $stmt->executeQuery("INSERT INTO - " . AppAssignSelfServiceValueGroupPeer::TABLE_NAME . " (" . - AppAssignSelfServiceValueGroupPeer::ID . ", " . - AppAssignSelfServiceValueGroupPeer::GRP_UID . ") - VALUES (" . $appAssignSelfServiceValueId . ", '" . $uid . "');"); - } - } else { - $rs = $stmt->executeQuery("INSERT INTO - " . AppAssignSelfServiceValueGroupPeer::TABLE_NAME . " (" . - AppAssignSelfServiceValueGroupPeer::ID . ", " . - AppAssignSelfServiceValueGroupPeer::GRP_UID . ") - VALUES (" . $appAssignSelfServiceValueId . ", '" . $dataVariable . "');"); - } - $con->commit(); // Commit all rows inserted in batch - } catch (Exception $error) { - throw new $error; - } - } + /** + * Insert multiple rows in table "APP_ASSIGN_SELF_SERVICE_VALUE_GROUP" + * + * @param string $appAssignSelfServiceValueId + * @param mixed $dataVariable + * + * @return void + * @throws Exception + */ + public function createRows($appAssignSelfServiceValueId, $dataVariable) + { + $con = Propel::getConnection(AppAssignSelfServiceValuePeer::DATABASE_NAME); + $con->begin(); + $statement = $con->createStatement(); + if (is_array($dataVariable)) { + foreach ($dataVariable as $uid) { + $this->createRow($statement, $appAssignSelfServiceValueId, $uid); + } + } else { + $this->createRow($statement, $appAssignSelfServiceValueId, $dataVariable); + } + $con->commit(); + } -} // AppAssignSelfServiceValueGroup + /** + * Insert a row in table "APP_ASSIGN_SELF_SERVICE_VALUE_GROUP" + * + * @param object $statement + * @param string $appAssignSelfServiceValueId + * @param string $id + * + * @return void + */ + public function createRow($statement, $appAssignSelfServiceValueId, $id) + { + $object = $this->getTypeUserOrGroup($id); + if ($object->id === -1) { + $dataLog = Bootstrap::getDefaultContextLog(); + $dataLog['ASSIGNEE_ID'] = $id; + $dataLog['ASSIGNEE_TYPE'] = $object->type; + Bootstrap::registerMonolog('AssignSelfServiceValue', 300, 'Invalid identifier value for Assign Self Service Value', $dataLog, $dataLog['workspace'], 'processmaker.log'); + } else { + $sql = "INSERT INTO " + . AppAssignSelfServiceValueGroupPeer::TABLE_NAME + . " (" + . AppAssignSelfServiceValueGroupPeer::ID . ", " + . AppAssignSelfServiceValueGroupPeer::GRP_UID . ", " + . AppAssignSelfServiceValueGroupPeer::ASSIGNEE_ID . ", " + . AppAssignSelfServiceValueGroupPeer::ASSIGNEE_TYPE + . ") " + . "VALUES (" + . $appAssignSelfServiceValueId . ", '" + . $id . "', " + . $object->id . ", " + . $object->type + . ");"; + $result = $statement->executeQuery($sql); + } + } + + /** + * Gets the 'id' that corresponds to a user or group and its type, the type + * is 1 for user and 2 for group, if it is not found, -1 is returned. + * + * @param string $uid + * + * @return stdClass + */ + public function getTypeUserOrGroup($uid) + { + $object = new stdClass(); + $group = GroupwfPeer::retrieveByPK($uid); + if (!empty($group)) { + $object->type = 2; + $object->id = $group->getGrpId(); + return $object; + } + $user = UsersPeer::retrieveByPK($uid); + if (!empty($user)) { + $object->type = 1; + $object->id = $user->getUsrId(); + return $object; + } + $object->type = -1; + $object->id = -1; + return $object; + } +} diff --git a/workflow/engine/classes/model/ListUnassigned.php b/workflow/engine/classes/model/ListUnassigned.php index 8dff6f520..4a065ad61 100644 --- a/workflow/engine/classes/model/ListUnassigned.php +++ b/workflow/engine/classes/model/ListUnassigned.php @@ -333,27 +333,25 @@ class ListUnassigned extends BaseListUnassigned implements ListInterface try { $arrayAppAssignSelfServiceValueData = array(); - //Get APP_UIDs - $group = new Groups(); - $arrayUid = $group->getActiveGroupsForAnUser($userUid); //Set UIDs of Groups (Groups of User) - $arrayUid[] = $userUid; //Set UID of User - $criteria = new Criteria("workflow"); + $sql = "(" + . AppAssignSelfServiceValueGroupPeer::ASSIGNEE_ID . " IN (" + . " SELECT " . GroupUserPeer::GRP_ID . " " + . " FROM " . GroupUserPeer::TABLE_NAME . " " + . " LEFT JOIN " . GroupwfPeer::TABLE_NAME . " ON (" . GroupUserPeer::GRP_ID . "=" . GroupwfPeer::GRP_ID . ") " + . " WHERE " . GroupUserPeer::USR_UID . "='" . $userUid . "' AND " . GroupwfPeer::GRP_STATUS . "='ACTIVE'" + . " ) AND " + . " " . AppAssignSelfServiceValueGroupPeer::ASSIGNEE_TYPE . "=2 " + . ")"; + $criteria->setDistinct(); $criteria->addSelectColumn(AppAssignSelfServiceValuePeer::APP_UID); $criteria->addSelectColumn(AppAssignSelfServiceValuePeer::DEL_INDEX); $criteria->addSelectColumn(AppAssignSelfServiceValuePeer::TAS_UID); - - $criteria->add( - AppAssignSelfServiceValuePeer::ID, - AppAssignSelfServiceValuePeer::ID. - " IN (SELECT ".AppAssignSelfServiceValueGroupPeer::ID. - " FROM ".AppAssignSelfServiceValueGroupPeer::TABLE_NAME. - " WHERE ".AppAssignSelfServiceValueGroupPeer::GRP_UID." IN ('". - implode("','", $arrayUid)."'))", - Criteria::CUSTOM - ); + $criteria->addJoin(AppAssignSelfServiceValuePeer::ID, AppAssignSelfServiceValueGroupPeer::ID, Criteria::INNER_JOIN); + $criteria->add(AppAssignSelfServiceValueGroupPeer::GRP_UID, $userUid, Criteria::EQUAL); + $criteria->addOr(AppAssignSelfServiceValueGroupPeer::GRP_UID, $sql, Criteria::CUSTOM); $rsCriteria = AppAssignSelfServiceValuePeer::doSelectRS($criteria); $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); @@ -368,7 +366,6 @@ class ListUnassigned extends BaseListUnassigned implements ListInterface ); } - //Return return $arrayAppAssignSelfServiceValueData; } catch (Exception $e) { throw $e; diff --git a/workflow/engine/classes/model/map/AppAssignSelfServiceValueGroupMapBuilder.php b/workflow/engine/classes/model/map/AppAssignSelfServiceValueGroupMapBuilder.php index 4c6b7159e..89fed5cd1 100644 --- a/workflow/engine/classes/model/map/AppAssignSelfServiceValueGroupMapBuilder.php +++ b/workflow/engine/classes/model/map/AppAssignSelfServiceValueGroupMapBuilder.php @@ -69,6 +69,10 @@ class AppAssignSelfServiceValueGroupMapBuilder $tMap->addColumn('GRP_UID', 'GrpUid', 'string', CreoleTypes::VARCHAR, true, 32); + $tMap->addColumn('ASSIGNEE_ID', 'AssigneeId', 'int', CreoleTypes::INTEGER, false, null); + + $tMap->addColumn('ASSIGNEE_TYPE', 'AssigneeType', 'int', CreoleTypes::INTEGER, true, null); + } // doBuild() } // AppAssignSelfServiceValueGroupMapBuilder diff --git a/workflow/engine/classes/model/map/GroupUserMapBuilder.php b/workflow/engine/classes/model/map/GroupUserMapBuilder.php index 8a2712ab0..6242842fa 100644 --- a/workflow/engine/classes/model/map/GroupUserMapBuilder.php +++ b/workflow/engine/classes/model/map/GroupUserMapBuilder.php @@ -67,6 +67,8 @@ class GroupUserMapBuilder $tMap->addPrimaryKey('GRP_UID', 'GrpUid', 'string', CreoleTypes::VARCHAR, true, 32); + $tMap->addColumn('GRP_ID', 'GrpId', 'int', CreoleTypes::INTEGER, false, null); + $tMap->addPrimaryKey('USR_UID', 'UsrUid', 'string', CreoleTypes::VARCHAR, true, 32); $tMap->addValidator('GRP_UID', 'maxLength', 'propel.validator.MaxLengthValidator', '32', 'Group UID can be no larger than 32 in size'); diff --git a/workflow/engine/classes/model/map/GroupwfMapBuilder.php b/workflow/engine/classes/model/map/GroupwfMapBuilder.php index 02da56fb2..152cb8ae9 100644 --- a/workflow/engine/classes/model/map/GroupwfMapBuilder.php +++ b/workflow/engine/classes/model/map/GroupwfMapBuilder.php @@ -63,10 +63,12 @@ class GroupwfMapBuilder $tMap = $this->dbMap->addTable('GROUPWF'); $tMap->setPhpName('Groupwf'); - $tMap->setUseIdGenerator(false); + $tMap->setUseIdGenerator(true); $tMap->addPrimaryKey('GRP_UID', 'GrpUid', 'string', CreoleTypes::VARCHAR, true, 32); + $tMap->addColumn('GRP_ID', 'GrpId', 'int', CreoleTypes::INTEGER, true, null); + $tMap->addColumn('GRP_TITLE', 'GrpTitle', 'string', CreoleTypes::LONGVARCHAR, true, null); $tMap->addColumn('GRP_STATUS', 'GrpStatus', 'string', CreoleTypes::CHAR, true, 8); diff --git a/workflow/engine/classes/model/om/BaseAppAssignSelfServiceValueGroup.php b/workflow/engine/classes/model/om/BaseAppAssignSelfServiceValueGroup.php index 6358edcae..83e76626c 100644 --- a/workflow/engine/classes/model/om/BaseAppAssignSelfServiceValueGroup.php +++ b/workflow/engine/classes/model/om/BaseAppAssignSelfServiceValueGroup.php @@ -39,6 +39,18 @@ abstract class BaseAppAssignSelfServiceValueGroup extends BaseObject implements */ protected $grp_uid; + /** + * The value for the assignee_id field. + * @var int + */ + protected $assignee_id = 0; + + /** + * The value for the assignee_type field. + * @var int + */ + protected $assignee_type = 0; + /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -75,6 +87,28 @@ abstract class BaseAppAssignSelfServiceValueGroup extends BaseObject implements return $this->grp_uid; } + /** + * Get the [assignee_id] column value. + * + * @return int + */ + public function getAssigneeId() + { + + return $this->assignee_id; + } + + /** + * Get the [assignee_type] column value. + * + * @return int + */ + public function getAssigneeType() + { + + return $this->assignee_type; + } + /** * Set the value of [id] column. * @@ -119,6 +153,50 @@ abstract class BaseAppAssignSelfServiceValueGroup extends BaseObject implements } // setGrpUid() + /** + * Set the value of [assignee_id] column. + * + * @param int $v new value + * @return void + */ + public function setAssigneeId($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->assignee_id !== $v || $v === 0) { + $this->assignee_id = $v; + $this->modifiedColumns[] = AppAssignSelfServiceValueGroupPeer::ASSIGNEE_ID; + } + + } // setAssigneeId() + + /** + * Set the value of [assignee_type] column. + * + * @param int $v new value + * @return void + */ + public function setAssigneeType($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->assignee_type !== $v || $v === 0) { + $this->assignee_type = $v; + $this->modifiedColumns[] = AppAssignSelfServiceValueGroupPeer::ASSIGNEE_TYPE; + } + + } // setAssigneeType() + /** * Hydrates (populates) the object variables with values from the database resultset. * @@ -140,12 +218,16 @@ abstract class BaseAppAssignSelfServiceValueGroup extends BaseObject implements $this->grp_uid = $rs->getString($startcol + 1); + $this->assignee_id = $rs->getInt($startcol + 2); + + $this->assignee_type = $rs->getInt($startcol + 3); + $this->resetModified(); $this->setNew(false); // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 2; // 2 = AppAssignSelfServiceValueGroupPeer::NUM_COLUMNS - AppAssignSelfServiceValueGroupPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 4; // 4 = AppAssignSelfServiceValueGroupPeer::NUM_COLUMNS - AppAssignSelfServiceValueGroupPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating AppAssignSelfServiceValueGroup object", $e); @@ -355,6 +437,12 @@ abstract class BaseAppAssignSelfServiceValueGroup extends BaseObject implements case 1: return $this->getGrpUid(); break; + case 2: + return $this->getAssigneeId(); + break; + case 3: + return $this->getAssigneeType(); + break; default: return null; break; @@ -377,6 +465,8 @@ abstract class BaseAppAssignSelfServiceValueGroup extends BaseObject implements $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getGrpUid(), + $keys[2] => $this->getAssigneeId(), + $keys[3] => $this->getAssigneeType(), ); return $result; } @@ -414,6 +504,12 @@ abstract class BaseAppAssignSelfServiceValueGroup extends BaseObject implements case 1: $this->setGrpUid($value); break; + case 2: + $this->setAssigneeId($value); + break; + case 3: + $this->setAssigneeType($value); + break; } // switch() } @@ -445,6 +541,14 @@ abstract class BaseAppAssignSelfServiceValueGroup extends BaseObject implements $this->setGrpUid($arr[$keys[1]]); } + if (array_key_exists($keys[2], $arr)) { + $this->setAssigneeId($arr[$keys[2]]); + } + + if (array_key_exists($keys[3], $arr)) { + $this->setAssigneeType($arr[$keys[3]]); + } + } /** @@ -464,6 +568,14 @@ abstract class BaseAppAssignSelfServiceValueGroup extends BaseObject implements $criteria->add(AppAssignSelfServiceValueGroupPeer::GRP_UID, $this->grp_uid); } + if ($this->isColumnModified(AppAssignSelfServiceValueGroupPeer::ASSIGNEE_ID)) { + $criteria->add(AppAssignSelfServiceValueGroupPeer::ASSIGNEE_ID, $this->assignee_id); + } + + if ($this->isColumnModified(AppAssignSelfServiceValueGroupPeer::ASSIGNEE_TYPE)) { + $criteria->add(AppAssignSelfServiceValueGroupPeer::ASSIGNEE_TYPE, $this->assignee_type); + } + return $criteria; } @@ -525,6 +637,10 @@ abstract class BaseAppAssignSelfServiceValueGroup extends BaseObject implements $copyObj->setGrpUid($this->grp_uid); + $copyObj->setAssigneeId($this->assignee_id); + + $copyObj->setAssigneeType($this->assignee_type); + $copyObj->setNew(true); diff --git a/workflow/engine/classes/model/om/BaseAppAssignSelfServiceValueGroupPeer.php b/workflow/engine/classes/model/om/BaseAppAssignSelfServiceValueGroupPeer.php index 24293ef9f..cd57202f0 100644 --- a/workflow/engine/classes/model/om/BaseAppAssignSelfServiceValueGroupPeer.php +++ b/workflow/engine/classes/model/om/BaseAppAssignSelfServiceValueGroupPeer.php @@ -25,7 +25,7 @@ abstract class BaseAppAssignSelfServiceValueGroupPeer const CLASS_DEFAULT = 'classes.model.AppAssignSelfServiceValueGroup'; /** The total number of columns. */ - const NUM_COLUMNS = 2; + const NUM_COLUMNS = 4; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -37,6 +37,12 @@ abstract class BaseAppAssignSelfServiceValueGroupPeer /** the column name for the GRP_UID field */ const GRP_UID = 'APP_ASSIGN_SELF_SERVICE_VALUE_GROUP.GRP_UID'; + /** the column name for the ASSIGNEE_ID field */ + const ASSIGNEE_ID = 'APP_ASSIGN_SELF_SERVICE_VALUE_GROUP.ASSIGNEE_ID'; + + /** the column name for the ASSIGNEE_TYPE field */ + const ASSIGNEE_TYPE = 'APP_ASSIGN_SELF_SERVICE_VALUE_GROUP.ASSIGNEE_TYPE'; + /** The PHP to DB Name Mapping */ private static $phpNameMap = null; @@ -48,10 +54,10 @@ abstract class BaseAppAssignSelfServiceValueGroupPeer * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('Id', 'GrpUid', ), - BasePeer::TYPE_COLNAME => array (AppAssignSelfServiceValueGroupPeer::ID, AppAssignSelfServiceValueGroupPeer::GRP_UID, ), - BasePeer::TYPE_FIELDNAME => array ('ID', 'GRP_UID', ), - BasePeer::TYPE_NUM => array (0, 1, ) + BasePeer::TYPE_PHPNAME => array ('Id', 'GrpUid', 'AssigneeId', 'AssigneeType', ), + BasePeer::TYPE_COLNAME => array (AppAssignSelfServiceValueGroupPeer::ID, AppAssignSelfServiceValueGroupPeer::GRP_UID, AppAssignSelfServiceValueGroupPeer::ASSIGNEE_ID, AppAssignSelfServiceValueGroupPeer::ASSIGNEE_TYPE, ), + BasePeer::TYPE_FIELDNAME => array ('ID', 'GRP_UID', 'ASSIGNEE_ID', 'ASSIGNEE_TYPE', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); /** @@ -61,10 +67,10 @@ abstract class BaseAppAssignSelfServiceValueGroupPeer * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'GrpUid' => 1, ), - BasePeer::TYPE_COLNAME => array (AppAssignSelfServiceValueGroupPeer::ID => 0, AppAssignSelfServiceValueGroupPeer::GRP_UID => 1, ), - BasePeer::TYPE_FIELDNAME => array ('ID' => 0, 'GRP_UID' => 1, ), - BasePeer::TYPE_NUM => array (0, 1, ) + BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'GrpUid' => 1, 'AssigneeId' => 2, 'AssigneeType' => 3, ), + BasePeer::TYPE_COLNAME => array (AppAssignSelfServiceValueGroupPeer::ID => 0, AppAssignSelfServiceValueGroupPeer::GRP_UID => 1, AppAssignSelfServiceValueGroupPeer::ASSIGNEE_ID => 2, AppAssignSelfServiceValueGroupPeer::ASSIGNEE_TYPE => 3, ), + BasePeer::TYPE_FIELDNAME => array ('ID' => 0, 'GRP_UID' => 1, 'ASSIGNEE_ID' => 2, 'ASSIGNEE_TYPE' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); /** @@ -169,6 +175,10 @@ abstract class BaseAppAssignSelfServiceValueGroupPeer $criteria->addSelectColumn(AppAssignSelfServiceValueGroupPeer::GRP_UID); + $criteria->addSelectColumn(AppAssignSelfServiceValueGroupPeer::ASSIGNEE_ID); + + $criteria->addSelectColumn(AppAssignSelfServiceValueGroupPeer::ASSIGNEE_TYPE); + } const COUNT = 'COUNT(*)'; diff --git a/workflow/engine/classes/model/om/BaseGroupUser.php b/workflow/engine/classes/model/om/BaseGroupUser.php index 936011c3d..0fe6f2789 100644 --- a/workflow/engine/classes/model/om/BaseGroupUser.php +++ b/workflow/engine/classes/model/om/BaseGroupUser.php @@ -33,6 +33,12 @@ abstract class BaseGroupUser extends BaseObject implements Persistent */ protected $grp_uid = '0'; + /** + * The value for the grp_id field. + * @var int + */ + protected $grp_id = 0; + /** * The value for the usr_uid field. * @var string @@ -64,6 +70,17 @@ abstract class BaseGroupUser extends BaseObject implements Persistent return $this->grp_uid; } + /** + * Get the [grp_id] column value. + * + * @return int + */ + public function getGrpId() + { + + return $this->grp_id; + } + /** * Get the [usr_uid] column value. * @@ -97,6 +114,28 @@ abstract class BaseGroupUser extends BaseObject implements Persistent } // setGrpUid() + /** + * Set the value of [grp_id] column. + * + * @param int $v new value + * @return void + */ + public function setGrpId($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->grp_id !== $v || $v === 0) { + $this->grp_id = $v; + $this->modifiedColumns[] = GroupUserPeer::GRP_ID; + } + + } // setGrpId() + /** * Set the value of [usr_uid] column. * @@ -138,14 +177,16 @@ abstract class BaseGroupUser extends BaseObject implements Persistent $this->grp_uid = $rs->getString($startcol + 0); - $this->usr_uid = $rs->getString($startcol + 1); + $this->grp_id = $rs->getInt($startcol + 1); + + $this->usr_uid = $rs->getString($startcol + 2); $this->resetModified(); $this->setNew(false); // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 2; // 2 = GroupUserPeer::NUM_COLUMNS - GroupUserPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 3; // 3 = GroupUserPeer::NUM_COLUMNS - GroupUserPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating GroupUser object", $e); @@ -353,6 +394,9 @@ abstract class BaseGroupUser extends BaseObject implements Persistent return $this->getGrpUid(); break; case 1: + return $this->getGrpId(); + break; + case 2: return $this->getUsrUid(); break; default: @@ -376,7 +420,8 @@ abstract class BaseGroupUser extends BaseObject implements Persistent $keys = GroupUserPeer::getFieldNames($keyType); $result = array( $keys[0] => $this->getGrpUid(), - $keys[1] => $this->getUsrUid(), + $keys[1] => $this->getGrpId(), + $keys[2] => $this->getUsrUid(), ); return $result; } @@ -412,6 +457,9 @@ abstract class BaseGroupUser extends BaseObject implements Persistent $this->setGrpUid($value); break; case 1: + $this->setGrpId($value); + break; + case 2: $this->setUsrUid($value); break; } // switch() @@ -442,7 +490,11 @@ abstract class BaseGroupUser extends BaseObject implements Persistent } if (array_key_exists($keys[1], $arr)) { - $this->setUsrUid($arr[$keys[1]]); + $this->setGrpId($arr[$keys[1]]); + } + + if (array_key_exists($keys[2], $arr)) { + $this->setUsrUid($arr[$keys[2]]); } } @@ -460,6 +512,10 @@ abstract class BaseGroupUser extends BaseObject implements Persistent $criteria->add(GroupUserPeer::GRP_UID, $this->grp_uid); } + if ($this->isColumnModified(GroupUserPeer::GRP_ID)) { + $criteria->add(GroupUserPeer::GRP_ID, $this->grp_id); + } + if ($this->isColumnModified(GroupUserPeer::USR_UID)) { $criteria->add(GroupUserPeer::USR_UID, $this->usr_uid); } @@ -530,6 +586,8 @@ abstract class BaseGroupUser extends BaseObject implements Persistent public function copyInto($copyObj, $deepCopy = false) { + $copyObj->setGrpId($this->grp_id); + $copyObj->setNew(true); diff --git a/workflow/engine/classes/model/om/BaseGroupUserPeer.php b/workflow/engine/classes/model/om/BaseGroupUserPeer.php index 73deae7b2..08a5731d9 100644 --- a/workflow/engine/classes/model/om/BaseGroupUserPeer.php +++ b/workflow/engine/classes/model/om/BaseGroupUserPeer.php @@ -25,7 +25,7 @@ abstract class BaseGroupUserPeer const CLASS_DEFAULT = 'classes.model.GroupUser'; /** The total number of columns. */ - const NUM_COLUMNS = 2; + const NUM_COLUMNS = 3; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -34,6 +34,9 @@ abstract class BaseGroupUserPeer /** the column name for the GRP_UID field */ const GRP_UID = 'GROUP_USER.GRP_UID'; + /** the column name for the GRP_ID field */ + const GRP_ID = 'GROUP_USER.GRP_ID'; + /** the column name for the USR_UID field */ const USR_UID = 'GROUP_USER.USR_UID'; @@ -48,10 +51,10 @@ abstract class BaseGroupUserPeer * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('GrpUid', 'UsrUid', ), - BasePeer::TYPE_COLNAME => array (GroupUserPeer::GRP_UID, GroupUserPeer::USR_UID, ), - BasePeer::TYPE_FIELDNAME => array ('GRP_UID', 'USR_UID', ), - BasePeer::TYPE_NUM => array (0, 1, ) + BasePeer::TYPE_PHPNAME => array ('GrpUid', 'GrpId', 'UsrUid', ), + BasePeer::TYPE_COLNAME => array (GroupUserPeer::GRP_UID, GroupUserPeer::GRP_ID, GroupUserPeer::USR_UID, ), + BasePeer::TYPE_FIELDNAME => array ('GRP_UID', 'GRP_ID', 'USR_UID', ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) ); /** @@ -61,10 +64,10 @@ abstract class BaseGroupUserPeer * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('GrpUid' => 0, 'UsrUid' => 1, ), - BasePeer::TYPE_COLNAME => array (GroupUserPeer::GRP_UID => 0, GroupUserPeer::USR_UID => 1, ), - BasePeer::TYPE_FIELDNAME => array ('GRP_UID' => 0, 'USR_UID' => 1, ), - BasePeer::TYPE_NUM => array (0, 1, ) + BasePeer::TYPE_PHPNAME => array ('GrpUid' => 0, 'GrpId' => 1, 'UsrUid' => 2, ), + BasePeer::TYPE_COLNAME => array (GroupUserPeer::GRP_UID => 0, GroupUserPeer::GRP_ID => 1, GroupUserPeer::USR_UID => 2, ), + BasePeer::TYPE_FIELDNAME => array ('GRP_UID' => 0, 'GRP_ID' => 1, 'USR_UID' => 2, ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) ); /** @@ -167,6 +170,8 @@ abstract class BaseGroupUserPeer $criteria->addSelectColumn(GroupUserPeer::GRP_UID); + $criteria->addSelectColumn(GroupUserPeer::GRP_ID); + $criteria->addSelectColumn(GroupUserPeer::USR_UID); } diff --git a/workflow/engine/classes/model/om/BaseGroupwf.php b/workflow/engine/classes/model/om/BaseGroupwf.php index ad010636b..11623f323 100644 --- a/workflow/engine/classes/model/om/BaseGroupwf.php +++ b/workflow/engine/classes/model/om/BaseGroupwf.php @@ -33,6 +33,12 @@ abstract class BaseGroupwf extends BaseObject implements Persistent */ protected $grp_uid; + /** + * The value for the grp_id field. + * @var int + */ + protected $grp_id; + /** * The value for the grp_title field. * @var string @@ -82,6 +88,17 @@ abstract class BaseGroupwf extends BaseObject implements Persistent return $this->grp_uid; } + /** + * Get the [grp_id] column value. + * + * @return int + */ + public function getGrpId() + { + + return $this->grp_id; + } + /** * Get the [grp_title] column value. * @@ -148,6 +165,28 @@ abstract class BaseGroupwf extends BaseObject implements Persistent } // setGrpUid() + /** + * Set the value of [grp_id] column. + * + * @param int $v new value + * @return void + */ + public function setGrpId($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->grp_id !== $v) { + $this->grp_id = $v; + $this->modifiedColumns[] = GroupwfPeer::GRP_ID; + } + + } // setGrpId() + /** * Set the value of [grp_title] column. * @@ -255,20 +294,22 @@ abstract class BaseGroupwf extends BaseObject implements Persistent $this->grp_uid = $rs->getString($startcol + 0); - $this->grp_title = $rs->getString($startcol + 1); + $this->grp_id = $rs->getInt($startcol + 1); - $this->grp_status = $rs->getString($startcol + 2); + $this->grp_title = $rs->getString($startcol + 2); - $this->grp_ldap_dn = $rs->getString($startcol + 3); + $this->grp_status = $rs->getString($startcol + 3); - $this->grp_ux = $rs->getString($startcol + 4); + $this->grp_ldap_dn = $rs->getString($startcol + 4); + + $this->grp_ux = $rs->getString($startcol + 5); $this->resetModified(); $this->setNew(false); // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 5; // 5 = GroupwfPeer::NUM_COLUMNS - GroupwfPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 6; // 6 = GroupwfPeer::NUM_COLUMNS - GroupwfPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating Groupwf object", $e); @@ -476,15 +517,18 @@ abstract class BaseGroupwf extends BaseObject implements Persistent return $this->getGrpUid(); break; case 1: - return $this->getGrpTitle(); + return $this->getGrpId(); break; case 2: - return $this->getGrpStatus(); + return $this->getGrpTitle(); break; case 3: - return $this->getGrpLdapDn(); + return $this->getGrpStatus(); break; case 4: + return $this->getGrpLdapDn(); + break; + case 5: return $this->getGrpUx(); break; default: @@ -508,10 +552,11 @@ abstract class BaseGroupwf extends BaseObject implements Persistent $keys = GroupwfPeer::getFieldNames($keyType); $result = array( $keys[0] => $this->getGrpUid(), - $keys[1] => $this->getGrpTitle(), - $keys[2] => $this->getGrpStatus(), - $keys[3] => $this->getGrpLdapDn(), - $keys[4] => $this->getGrpUx(), + $keys[1] => $this->getGrpId(), + $keys[2] => $this->getGrpTitle(), + $keys[3] => $this->getGrpStatus(), + $keys[4] => $this->getGrpLdapDn(), + $keys[5] => $this->getGrpUx(), ); return $result; } @@ -547,15 +592,18 @@ abstract class BaseGroupwf extends BaseObject implements Persistent $this->setGrpUid($value); break; case 1: - $this->setGrpTitle($value); + $this->setGrpId($value); break; case 2: - $this->setGrpStatus($value); + $this->setGrpTitle($value); break; case 3: - $this->setGrpLdapDn($value); + $this->setGrpStatus($value); break; case 4: + $this->setGrpLdapDn($value); + break; + case 5: $this->setGrpUx($value); break; } // switch() @@ -586,19 +634,23 @@ abstract class BaseGroupwf extends BaseObject implements Persistent } if (array_key_exists($keys[1], $arr)) { - $this->setGrpTitle($arr[$keys[1]]); + $this->setGrpId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { - $this->setGrpStatus($arr[$keys[2]]); + $this->setGrpTitle($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { - $this->setGrpLdapDn($arr[$keys[3]]); + $this->setGrpStatus($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { - $this->setGrpUx($arr[$keys[4]]); + $this->setGrpLdapDn($arr[$keys[4]]); + } + + if (array_key_exists($keys[5], $arr)) { + $this->setGrpUx($arr[$keys[5]]); } } @@ -616,6 +668,10 @@ abstract class BaseGroupwf extends BaseObject implements Persistent $criteria->add(GroupwfPeer::GRP_UID, $this->grp_uid); } + if ($this->isColumnModified(GroupwfPeer::GRP_ID)) { + $criteria->add(GroupwfPeer::GRP_ID, $this->grp_id); + } + if ($this->isColumnModified(GroupwfPeer::GRP_TITLE)) { $criteria->add(GroupwfPeer::GRP_TITLE, $this->grp_title); } @@ -686,6 +742,8 @@ abstract class BaseGroupwf extends BaseObject implements Persistent public function copyInto($copyObj, $deepCopy = false) { + $copyObj->setGrpId($this->grp_id); + $copyObj->setGrpTitle($this->grp_title); $copyObj->setGrpStatus($this->grp_status); diff --git a/workflow/engine/classes/model/om/BaseGroupwfPeer.php b/workflow/engine/classes/model/om/BaseGroupwfPeer.php index 13567c5fb..257d528b9 100644 --- a/workflow/engine/classes/model/om/BaseGroupwfPeer.php +++ b/workflow/engine/classes/model/om/BaseGroupwfPeer.php @@ -25,7 +25,7 @@ abstract class BaseGroupwfPeer const CLASS_DEFAULT = 'classes.model.Groupwf'; /** The total number of columns. */ - const NUM_COLUMNS = 5; + const NUM_COLUMNS = 6; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -34,6 +34,9 @@ abstract class BaseGroupwfPeer /** the column name for the GRP_UID field */ const GRP_UID = 'GROUPWF.GRP_UID'; + /** the column name for the GRP_ID field */ + const GRP_ID = 'GROUPWF.GRP_ID'; + /** the column name for the GRP_TITLE field */ const GRP_TITLE = 'GROUPWF.GRP_TITLE'; @@ -57,10 +60,10 @@ abstract class BaseGroupwfPeer * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('GrpUid', 'GrpTitle', 'GrpStatus', 'GrpLdapDn', 'GrpUx', ), - BasePeer::TYPE_COLNAME => array (GroupwfPeer::GRP_UID, GroupwfPeer::GRP_TITLE, GroupwfPeer::GRP_STATUS, GroupwfPeer::GRP_LDAP_DN, GroupwfPeer::GRP_UX, ), - BasePeer::TYPE_FIELDNAME => array ('GRP_UID', 'GRP_TITLE', 'GRP_STATUS', 'GRP_LDAP_DN', 'GRP_UX', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + BasePeer::TYPE_PHPNAME => array ('GrpUid', 'GrpId', 'GrpTitle', 'GrpStatus', 'GrpLdapDn', 'GrpUx', ), + BasePeer::TYPE_COLNAME => array (GroupwfPeer::GRP_UID, GroupwfPeer::GRP_ID, GroupwfPeer::GRP_TITLE, GroupwfPeer::GRP_STATUS, GroupwfPeer::GRP_LDAP_DN, GroupwfPeer::GRP_UX, ), + BasePeer::TYPE_FIELDNAME => array ('GRP_UID', 'GRP_ID', 'GRP_TITLE', 'GRP_STATUS', 'GRP_LDAP_DN', 'GRP_UX', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); /** @@ -70,10 +73,10 @@ abstract class BaseGroupwfPeer * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('GrpUid' => 0, 'GrpTitle' => 1, 'GrpStatus' => 2, 'GrpLdapDn' => 3, 'GrpUx' => 4, ), - BasePeer::TYPE_COLNAME => array (GroupwfPeer::GRP_UID => 0, GroupwfPeer::GRP_TITLE => 1, GroupwfPeer::GRP_STATUS => 2, GroupwfPeer::GRP_LDAP_DN => 3, GroupwfPeer::GRP_UX => 4, ), - BasePeer::TYPE_FIELDNAME => array ('GRP_UID' => 0, 'GRP_TITLE' => 1, 'GRP_STATUS' => 2, 'GRP_LDAP_DN' => 3, 'GRP_UX' => 4, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + BasePeer::TYPE_PHPNAME => array ('GrpUid' => 0, 'GrpId' => 1, 'GrpTitle' => 2, 'GrpStatus' => 3, 'GrpLdapDn' => 4, 'GrpUx' => 5, ), + BasePeer::TYPE_COLNAME => array (GroupwfPeer::GRP_UID => 0, GroupwfPeer::GRP_ID => 1, GroupwfPeer::GRP_TITLE => 2, GroupwfPeer::GRP_STATUS => 3, GroupwfPeer::GRP_LDAP_DN => 4, GroupwfPeer::GRP_UX => 5, ), + BasePeer::TYPE_FIELDNAME => array ('GRP_UID' => 0, 'GRP_ID' => 1, 'GRP_TITLE' => 2, 'GRP_STATUS' => 3, 'GRP_LDAP_DN' => 4, 'GRP_UX' => 5, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); /** @@ -176,6 +179,8 @@ abstract class BaseGroupwfPeer $criteria->addSelectColumn(GroupwfPeer::GRP_UID); + $criteria->addSelectColumn(GroupwfPeer::GRP_ID); + $criteria->addSelectColumn(GroupwfPeer::GRP_TITLE); $criteria->addSelectColumn(GroupwfPeer::GRP_STATUS); diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index 58631dda1..e862f4eeb 100644 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -593,7 +593,7 @@ - +
@@ -615,6 +615,7 @@ + @@ -623,6 +624,9 @@ + + +
@@ -646,6 +650,7 @@ + @@ -658,6 +663,9 @@ + + +
@@ -4241,11 +4249,16 @@ - - + + + + + + +
diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index 93051a2a8..934aa420f 100644 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -281,11 +281,13 @@ DROP TABLE IF EXISTS `GROUPWF`; CREATE TABLE `GROUPWF` ( `GRP_UID` VARCHAR(32) NOT NULL, + `GRP_ID` INTEGER NOT NULL AUTO_INCREMENT, `GRP_TITLE` MEDIUMTEXT NOT NULL, `GRP_STATUS` CHAR(8) default 'ACTIVE' NOT NULL, `GRP_LDAP_DN` VARCHAR(255) default '' NOT NULL, `GRP_UX` VARCHAR(128) default 'NORMAL', - PRIMARY KEY (`GRP_UID`) + PRIMARY KEY (`GRP_UID`), + UNIQUE KEY `GRP_ID` (`GRP_ID`) )ENGINE=InnoDB DEFAULT CHARSET='utf8'; #----------------------------------------------------------------------------- #-- GROUP_USER @@ -297,9 +299,11 @@ DROP TABLE IF EXISTS `GROUP_USER`; CREATE TABLE `GROUP_USER` ( `GRP_UID` VARCHAR(32) default '0' NOT NULL, + `GRP_ID` INTEGER default 0, `USR_UID` VARCHAR(32) default '0' NOT NULL, PRIMARY KEY (`GRP_UID`,`USR_UID`), - KEY `indexForUsrUid`(`USR_UID`) + KEY `indexForUsrUid`(`USR_UID`), + KEY `INDEX_GRP_ID`(`GRP_ID`) )ENGINE=InnoDB DEFAULT CHARSET='utf8'; #----------------------------------------------------------------------------- #-- HOLIDAY @@ -2367,7 +2371,10 @@ CREATE TABLE `APP_ASSIGN_SELF_SERVICE_VALUE_GROUP` ( `ID` INTEGER default 0 NOT NULL, `GRP_UID` VARCHAR(32) NOT NULL, - KEY `indexId`(`ID`) + `ASSIGNEE_ID` INTEGER default 0, + `ASSIGNEE_TYPE` INTEGER default 0 NOT NULL, + KEY `indexId`(`ID`), + KEY `INDEX_ASSIGNEE_ID`(`ASSIGNEE_ID`) )ENGINE=InnoDB DEFAULT CHARSET='utf8'; #----------------------------------------------------------------------------- #-- LIST_INBOX diff --git a/workflow/engine/methods/cases/proxyNewCasesList.php b/workflow/engine/methods/cases/proxyNewCasesList.php index 1ae54a63a..43e620f7f 100644 --- a/workflow/engine/methods/cases/proxyNewCasesList.php +++ b/workflow/engine/methods/cases/proxyNewCasesList.php @@ -1,10 +1,11 @@ error = G::LoadTranslation('ID_LOGIN_AGAIN'); $responseObject->success = true; $responseObject->lostSession = true; - print G::json_encode( $responseObject ); + print G::json_encode($responseObject); die(); } @@ -35,7 +36,7 @@ try { //Define user when is reassign if ($filters['action'] == 'to_reassign') { - if ($filters['user'] == '' ) { + if ($filters['user'] == '') { $userUid = ''; } if ($filters['user'] !== '' && $filters['user'] !== 'CURRENT_USER') { @@ -47,51 +48,43 @@ try { switch ($listName) { case 'inbox': $list = new ListInbox(); - $listpeer = 'ListInboxPeer'; break; case 'participated_history': $list = new ListParticipatedHistory(); - $listpeer = 'ListParticipatedHistoryPeer'; break; case 'participated': case 'participated_last': $list = new ListParticipatedLast(); - $listpeer = 'ListParticipatedLastPeer'; break; case 'completed': $list = new ListCompleted(); - $listpeer = 'ListCompletedPeer'; break; case 'paused': $list = new ListPaused(); - $listpeer = 'ListPausedPeer'; break; case 'canceled': $list = new ListCanceled(); - $listpeer = 'ListCanceledPeer'; break; case 'my_inbox': $list = new ListMyInbox(); - $listpeer = 'ListMyInboxPeer'; break; case 'unassigned': $list = new ListUnassigned(); - $listpeer = 'ListUnassignedPeer'; break; } // Validate filters - $filters['search'] = (!is_null($openApplicationUid))? $openApplicationUid : $filters['search']; + $filters['search'] = (!is_null($openApplicationUid)) ? $openApplicationUid : $filters['search']; //Set a flag for review in the list by APP_UID when is used the case Link with parallel task - $filters['caseLink'] = (!is_null($openApplicationUid))? $openApplicationUid : ''; + $filters['caseLink'] = (!is_null($openApplicationUid)) ? $openApplicationUid : ''; - $filters['start'] = (int)$filters['start']; + $filters['start'] = (int) $filters['start']; $filters['start'] = abs($filters['start']); if ($filters['start'] != 0) { - $filters['start']+1; + $filters['start'] + 1; } - $filters['limit'] = (int)$filters['limit']; + $filters['limit'] = (int) $filters['limit']; $filters['limit'] = abs($filters['limit']); $conf = new Configurations(); $formats = $conf->getFormats(); @@ -100,12 +93,12 @@ try { if ($filters['limit'] == 0) { $generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', ''); if (isset($generalConfCasesList['casesListRowNumber'])) { - $filters['limit'] = (int)$generalConfCasesList['casesListRowNumber']; + $filters['limit'] = (int) $generalConfCasesList['casesListRowNumber']; } else { $filters['limit'] = 25; } } else { - $filters['limit'] = (int)$filters['limit']; + $filters['limit'] = (int) $filters['limit']; } switch ($filters['sort']) { @@ -136,73 +129,67 @@ try { $filters['dir'] = 'DESC'; } - $result = $list->loadList( - $userUid, - $filters, - function (array $record) - { - try { - if (isset($record["DEL_PREVIOUS_USR_UID"])) { - if ($record["DEL_PREVIOUS_USR_UID"] == "") { - $appDelegation = AppDelegationPeer::retrieveByPK($record["APP_UID"], $record["DEL_INDEX"]); + $result = $list->loadList($userUid, $filters, function (array $record) { + try { + if (isset($record["DEL_PREVIOUS_USR_UID"])) { + if ($record["DEL_PREVIOUS_USR_UID"] == "") { + $appDelegation = AppDelegationPeer::retrieveByPK($record["APP_UID"], $record["DEL_INDEX"]); - if (!is_null($appDelegation)) { - $appDelegationPrevious = AppDelegationPeer::retrieveByPK($record["APP_UID"], $appDelegation->getDelPrevious()); + if (!is_null($appDelegation)) { + $appDelegationPrevious = AppDelegationPeer::retrieveByPK($record["APP_UID"], $appDelegation->getDelPrevious()); - if (!is_null($appDelegationPrevious)) { - $taskPrevious = TaskPeer::retrieveByPK($appDelegationPrevious->getTasUid()); + if (!is_null($appDelegationPrevious)) { + $taskPrevious = TaskPeer::retrieveByPK($appDelegationPrevious->getTasUid()); - if (!is_null($taskPrevious)) { - switch ($taskPrevious->getTasType()) { - case "SCRIPT-TASK": - $record["DEL_PREVIOUS_USR_UID"] = $taskPrevious->getTasType(); - break; - } + if (!is_null($taskPrevious)) { + switch ($taskPrevious->getTasType()) { + case "SCRIPT-TASK": + $record["DEL_PREVIOUS_USR_UID"] = $taskPrevious->getTasType(); + break; } } } } - - $record["PREVIOUS_USR_UID"] = $record["DEL_PREVIOUS_USR_UID"]; - $record["PREVIOUS_USR_USERNAME"] = $record["DEL_PREVIOUS_USR_USERNAME"]; - $record["PREVIOUS_USR_FIRSTNAME"] = $record["DEL_PREVIOUS_USR_FIRSTNAME"]; - $record["PREVIOUS_USR_LASTNAME"] = $record["DEL_PREVIOUS_USR_LASTNAME"]; } - if (isset($record["DEL_DUE_DATE"])) { - $record["DEL_TASK_DUE_DATE"] = $record["DEL_DUE_DATE"]; - } - - if (isset($record["APP_PAUSED_DATE"])) { - $record["APP_UPDATE_DATE"] = $record["APP_PAUSED_DATE"]; - } - - if (isset($record["DEL_CURRENT_USR_USERNAME"])) { - $record["USR_USERNAME"] = $record["DEL_CURRENT_USR_USERNAME"]; - $record["USR_FIRSTNAME"] = $record["DEL_CURRENT_USR_FIRSTNAME"]; - $record["USR_LASTNAME"] = $record["DEL_CURRENT_USR_LASTNAME"]; - $record["APP_UPDATE_DATE"] = $record["DEL_DELEGATE_DATE"]; - } - - if (isset($record['DEL_CURRENT_TAS_TITLE']) && $record['DEL_CURRENT_TAS_TITLE'] != '') { - $record['APP_TAS_TITLE'] = $record['DEL_CURRENT_TAS_TITLE']; - } - - if (isset($record["APP_STATUS"])) { - $record["APP_STATUS_LABEL"] = G::LoadTranslation("ID_" . $record["APP_STATUS"]); - } - - //Return - return $record; - } catch (Exception $e) { - throw $e; + $record["PREVIOUS_USR_UID"] = $record["DEL_PREVIOUS_USR_UID"]; + $record["PREVIOUS_USR_USERNAME"] = $record["DEL_PREVIOUS_USR_USERNAME"]; + $record["PREVIOUS_USR_FIRSTNAME"] = $record["DEL_PREVIOUS_USR_FIRSTNAME"]; + $record["PREVIOUS_USR_LASTNAME"] = $record["DEL_PREVIOUS_USR_LASTNAME"]; } + + if (isset($record["DEL_DUE_DATE"])) { + $record["DEL_TASK_DUE_DATE"] = $record["DEL_DUE_DATE"]; + } + + if (isset($record["APP_PAUSED_DATE"])) { + $record["APP_UPDATE_DATE"] = $record["APP_PAUSED_DATE"]; + } + + if (isset($record["DEL_CURRENT_USR_USERNAME"])) { + $record["USR_USERNAME"] = $record["DEL_CURRENT_USR_USERNAME"]; + $record["USR_FIRSTNAME"] = $record["DEL_CURRENT_USR_FIRSTNAME"]; + $record["USR_LASTNAME"] = $record["DEL_CURRENT_USR_LASTNAME"]; + $record["APP_UPDATE_DATE"] = $record["DEL_DELEGATE_DATE"]; + } + + if (isset($record['DEL_CURRENT_TAS_TITLE']) && $record['DEL_CURRENT_TAS_TITLE'] != '') { + $record['APP_TAS_TITLE'] = $record['DEL_CURRENT_TAS_TITLE']; + } + + if (isset($record["APP_STATUS"])) { + $record["APP_STATUS_LABEL"] = G::LoadTranslation("ID_" . $record["APP_STATUS"]); + } + + return $record; + } catch (Exception $e) { + throw $e; } - ); + }); $response = array(); - $response['filters'] = $filters; - $response['totalCount'] = $list->getCountList($userUid, $filters); + $response['filters'] = $filters; + $response['totalCount'] = $list->getCountList($userUid, $filters); $response['data'] = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($result); echo G::json_encode($response); } catch (Exception $e) {