diff --git a/workflow/engine/classes/model/AbeConfiguration.php b/workflow/engine/classes/model/AbeConfiguration.php index adedf1e70..61138a9fb 100644 --- a/workflow/engine/classes/model/AbeConfiguration.php +++ b/workflow/engine/classes/model/AbeConfiguration.php @@ -16,9 +16,24 @@ require_once 'classes/model/om/BaseAbeConfiguration.php'; class AbeConfiguration extends BaseAbeConfiguration { - private $filterThisFields = array('ABE_UID', 'PRO_UID', 'TAS_UID', 'ABE_TYPE', - 'ABE_TEMPLATE', 'ABE_DYN_TYPE', 'DYN_UID','ABE_EMAIL_FIELD', - 'ABE_ACTION_FIELD', 'ABE_CASE_NOTE_IN_RESPONSE', 'ABE_CREATE_DATE','ABE_UPDATE_DATE','ABE_MAILSERVER_OR_MAILCURRENT','ABE_SUBJECT_FIELD','ABE_CUSTOM_GRID'); + private $filterThisFields = [ + 'ABE_UID', + 'PRO_UID', + 'TAS_UID', + 'ABE_TYPE', + 'ABE_TEMPLATE', + 'ABE_DYN_TYPE', + 'DYN_UID', + 'ABE_EMAIL_FIELD', + 'ABE_ACTION_FIELD', + 'ABE_CASE_NOTE_IN_RESPONSE', + 'ABE_FORCE_LOGIN', + 'ABE_CREATE_DATE', + 'ABE_UPDATE_DATE', + 'ABE_SUBJECT_FIELD', + 'ABE_MAILSERVER_OR_MAILCURRENT', + 'ABE_CUSTOM_GRID' + ]; public function load($abeUid) { @@ -54,11 +69,11 @@ class AbeConfiguration extends BaseAbeConfiguration } else { $abeConfigurationInstance = AbeConfigurationPeer::retrieveByPK($data['ABE_UID']); } - + if (isset($data['ABE_CUSTOM_GRID'])) { $data['ABE_CUSTOM_GRID'] = serialize($data['ABE_CUSTOM_GRID']); } else { - $data['ABE_CUSTOM_GRID'] = ""; + $data['ABE_CUSTOM_GRID'] = ""; } $data['ABE_UPDATE_DATE'] = date('Y-m-d H:i:s'); diff --git a/workflow/engine/classes/model/map/AbeConfigurationMapBuilder.php b/workflow/engine/classes/model/map/AbeConfigurationMapBuilder.php index 3f4f3ae11..2aabbb20a 100644 --- a/workflow/engine/classes/model/map/AbeConfigurationMapBuilder.php +++ b/workflow/engine/classes/model/map/AbeConfigurationMapBuilder.php @@ -85,6 +85,8 @@ class AbeConfigurationMapBuilder $tMap->addColumn('ABE_CASE_NOTE_IN_RESPONSE', 'AbeCaseNoteInResponse', 'int', CreoleTypes::INTEGER, false, null); + $tMap->addColumn('ABE_FORCE_LOGIN', 'AbeForceLogin', 'int', CreoleTypes::INTEGER, false, null); + $tMap->addColumn('ABE_CREATE_DATE', 'AbeCreateDate', 'int', CreoleTypes::TIMESTAMP, true, null); $tMap->addColumn('ABE_UPDATE_DATE', 'AbeUpdateDate', 'int', CreoleTypes::TIMESTAMP, false, null); diff --git a/workflow/engine/classes/model/om/BaseAbeConfiguration.php b/workflow/engine/classes/model/om/BaseAbeConfiguration.php index e66917d27..d7cd4e958 100644 --- a/workflow/engine/classes/model/om/BaseAbeConfiguration.php +++ b/workflow/engine/classes/model/om/BaseAbeConfiguration.php @@ -87,6 +87,12 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent */ protected $abe_case_note_in_response = 0; + /** + * The value for the abe_force_login field. + * @var int + */ + protected $abe_force_login = 0; + /** * The value for the abe_create_date field. * @var int @@ -241,6 +247,17 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent return $this->abe_case_note_in_response; } + /** + * Get the [abe_force_login] column value. + * + * @return int + */ + public function getAbeForceLogin() + { + + return $this->abe_force_login; + } + /** * Get the [optionally formatted] [abe_create_date] column value. * @@ -558,6 +575,28 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent } // setAbeCaseNoteInResponse() + /** + * Set the value of [abe_force_login] column. + * + * @param int $v new value + * @return void + */ + public function setAbeForceLogin($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->abe_force_login !== $v || $v === 0) { + $this->abe_force_login = $v; + $this->modifiedColumns[] = AbeConfigurationPeer::ABE_FORCE_LOGIN; + } + + } // setAbeForceLogin() + /** * Set the value of [abe_create_date] column. * @@ -719,22 +758,24 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent $this->abe_case_note_in_response = $rs->getInt($startcol + 9); - $this->abe_create_date = $rs->getTimestamp($startcol + 10, null); + $this->abe_force_login = $rs->getInt($startcol + 10); - $this->abe_update_date = $rs->getTimestamp($startcol + 11, null); + $this->abe_create_date = $rs->getTimestamp($startcol + 11, null); - $this->abe_subject_field = $rs->getString($startcol + 12); + $this->abe_update_date = $rs->getTimestamp($startcol + 12, null); - $this->abe_mailserver_or_mailcurrent = $rs->getInt($startcol + 13); + $this->abe_subject_field = $rs->getString($startcol + 13); - $this->abe_custom_grid = $rs->getString($startcol + 14); + $this->abe_mailserver_or_mailcurrent = $rs->getInt($startcol + 14); + + $this->abe_custom_grid = $rs->getString($startcol + 15); $this->resetModified(); $this->setNew(false); // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 15; // 15 = AbeConfigurationPeer::NUM_COLUMNS - AbeConfigurationPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 16; // 16 = AbeConfigurationPeer::NUM_COLUMNS - AbeConfigurationPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating AbeConfiguration object", $e); @@ -969,18 +1010,21 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent return $this->getAbeCaseNoteInResponse(); break; case 10: - return $this->getAbeCreateDate(); + return $this->getAbeForceLogin(); break; case 11: - return $this->getAbeUpdateDate(); + return $this->getAbeCreateDate(); break; case 12: - return $this->getAbeSubjectField(); + return $this->getAbeUpdateDate(); break; case 13: - return $this->getAbeMailserverOrMailcurrent(); + return $this->getAbeSubjectField(); break; case 14: + return $this->getAbeMailserverOrMailcurrent(); + break; + case 15: return $this->getAbeCustomGrid(); break; default: @@ -1013,11 +1057,12 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent $keys[7] => $this->getAbeEmailField(), $keys[8] => $this->getAbeActionField(), $keys[9] => $this->getAbeCaseNoteInResponse(), - $keys[10] => $this->getAbeCreateDate(), - $keys[11] => $this->getAbeUpdateDate(), - $keys[12] => $this->getAbeSubjectField(), - $keys[13] => $this->getAbeMailserverOrMailcurrent(), - $keys[14] => $this->getAbeCustomGrid(), + $keys[10] => $this->getAbeForceLogin(), + $keys[11] => $this->getAbeCreateDate(), + $keys[12] => $this->getAbeUpdateDate(), + $keys[13] => $this->getAbeSubjectField(), + $keys[14] => $this->getAbeMailserverOrMailcurrent(), + $keys[15] => $this->getAbeCustomGrid(), ); return $result; } @@ -1080,18 +1125,21 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent $this->setAbeCaseNoteInResponse($value); break; case 10: - $this->setAbeCreateDate($value); + $this->setAbeForceLogin($value); break; case 11: - $this->setAbeUpdateDate($value); + $this->setAbeCreateDate($value); break; case 12: - $this->setAbeSubjectField($value); + $this->setAbeUpdateDate($value); break; case 13: - $this->setAbeMailserverOrMailcurrent($value); + $this->setAbeSubjectField($value); break; case 14: + $this->setAbeMailserverOrMailcurrent($value); + break; + case 15: $this->setAbeCustomGrid($value); break; } // switch() @@ -1158,23 +1206,27 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent } if (array_key_exists($keys[10], $arr)) { - $this->setAbeCreateDate($arr[$keys[10]]); + $this->setAbeForceLogin($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { - $this->setAbeUpdateDate($arr[$keys[11]]); + $this->setAbeCreateDate($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { - $this->setAbeSubjectField($arr[$keys[12]]); + $this->setAbeUpdateDate($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { - $this->setAbeMailserverOrMailcurrent($arr[$keys[13]]); + $this->setAbeSubjectField($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { - $this->setAbeCustomGrid($arr[$keys[14]]); + $this->setAbeMailserverOrMailcurrent($arr[$keys[14]]); + } + + if (array_key_exists($keys[15], $arr)) { + $this->setAbeCustomGrid($arr[$keys[15]]); } } @@ -1228,6 +1280,10 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent $criteria->add(AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE, $this->abe_case_note_in_response); } + if ($this->isColumnModified(AbeConfigurationPeer::ABE_FORCE_LOGIN)) { + $criteria->add(AbeConfigurationPeer::ABE_FORCE_LOGIN, $this->abe_force_login); + } + if ($this->isColumnModified(AbeConfigurationPeer::ABE_CREATE_DATE)) { $criteria->add(AbeConfigurationPeer::ABE_CREATE_DATE, $this->abe_create_date); } @@ -1320,6 +1376,8 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent $copyObj->setAbeCaseNoteInResponse($this->abe_case_note_in_response); + $copyObj->setAbeForceLogin($this->abe_force_login); + $copyObj->setAbeCreateDate($this->abe_create_date); $copyObj->setAbeUpdateDate($this->abe_update_date); diff --git a/workflow/engine/classes/model/om/BaseAbeConfigurationPeer.php b/workflow/engine/classes/model/om/BaseAbeConfigurationPeer.php index cc9e02629..ae8a3f6f7 100644 --- a/workflow/engine/classes/model/om/BaseAbeConfigurationPeer.php +++ b/workflow/engine/classes/model/om/BaseAbeConfigurationPeer.php @@ -25,7 +25,7 @@ abstract class BaseAbeConfigurationPeer const CLASS_DEFAULT = 'classes.model.AbeConfiguration'; /** The total number of columns. */ - const NUM_COLUMNS = 15; + const NUM_COLUMNS = 16; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -61,6 +61,9 @@ abstract class BaseAbeConfigurationPeer /** the column name for the ABE_CASE_NOTE_IN_RESPONSE field */ const ABE_CASE_NOTE_IN_RESPONSE = 'ABE_CONFIGURATION.ABE_CASE_NOTE_IN_RESPONSE'; + /** the column name for the ABE_FORCE_LOGIN field */ + const ABE_FORCE_LOGIN = 'ABE_CONFIGURATION.ABE_FORCE_LOGIN'; + /** the column name for the ABE_CREATE_DATE field */ const ABE_CREATE_DATE = 'ABE_CONFIGURATION.ABE_CREATE_DATE'; @@ -87,10 +90,10 @@ abstract class BaseAbeConfigurationPeer * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('AbeUid', 'ProUid', 'TasUid', 'AbeType', 'AbeTemplate', 'AbeDynType', 'DynUid', 'AbeEmailField', 'AbeActionField', 'AbeCaseNoteInResponse', 'AbeCreateDate', 'AbeUpdateDate', 'AbeSubjectField', 'AbeMailserverOrMailcurrent', 'AbeCustomGrid', ), - BasePeer::TYPE_COLNAME => array (AbeConfigurationPeer::ABE_UID, AbeConfigurationPeer::PRO_UID, AbeConfigurationPeer::TAS_UID, AbeConfigurationPeer::ABE_TYPE, AbeConfigurationPeer::ABE_TEMPLATE, AbeConfigurationPeer::ABE_DYN_TYPE, AbeConfigurationPeer::DYN_UID, AbeConfigurationPeer::ABE_EMAIL_FIELD, AbeConfigurationPeer::ABE_ACTION_FIELD, AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE, AbeConfigurationPeer::ABE_CREATE_DATE, AbeConfigurationPeer::ABE_UPDATE_DATE, AbeConfigurationPeer::ABE_SUBJECT_FIELD, AbeConfigurationPeer::ABE_MAILSERVER_OR_MAILCURRENT, AbeConfigurationPeer::ABE_CUSTOM_GRID, ), - BasePeer::TYPE_FIELDNAME => array ('ABE_UID', 'PRO_UID', 'TAS_UID', 'ABE_TYPE', 'ABE_TEMPLATE', 'ABE_DYN_TYPE', 'DYN_UID', 'ABE_EMAIL_FIELD', 'ABE_ACTION_FIELD', 'ABE_CASE_NOTE_IN_RESPONSE', 'ABE_CREATE_DATE', 'ABE_UPDATE_DATE', 'ABE_SUBJECT_FIELD', 'ABE_MAILSERVER_OR_MAILCURRENT', 'ABE_CUSTOM_GRID', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) + BasePeer::TYPE_PHPNAME => array ('AbeUid', 'ProUid', 'TasUid', 'AbeType', 'AbeTemplate', 'AbeDynType', 'DynUid', 'AbeEmailField', 'AbeActionField', 'AbeCaseNoteInResponse', 'AbeForceLogin', 'AbeCreateDate', 'AbeUpdateDate', 'AbeSubjectField', 'AbeMailserverOrMailcurrent', 'AbeCustomGrid', ), + BasePeer::TYPE_COLNAME => array (AbeConfigurationPeer::ABE_UID, AbeConfigurationPeer::PRO_UID, AbeConfigurationPeer::TAS_UID, AbeConfigurationPeer::ABE_TYPE, AbeConfigurationPeer::ABE_TEMPLATE, AbeConfigurationPeer::ABE_DYN_TYPE, AbeConfigurationPeer::DYN_UID, AbeConfigurationPeer::ABE_EMAIL_FIELD, AbeConfigurationPeer::ABE_ACTION_FIELD, AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE, AbeConfigurationPeer::ABE_FORCE_LOGIN, AbeConfigurationPeer::ABE_CREATE_DATE, AbeConfigurationPeer::ABE_UPDATE_DATE, AbeConfigurationPeer::ABE_SUBJECT_FIELD, AbeConfigurationPeer::ABE_MAILSERVER_OR_MAILCURRENT, AbeConfigurationPeer::ABE_CUSTOM_GRID, ), + BasePeer::TYPE_FIELDNAME => array ('ABE_UID', 'PRO_UID', 'TAS_UID', 'ABE_TYPE', 'ABE_TEMPLATE', 'ABE_DYN_TYPE', 'DYN_UID', 'ABE_EMAIL_FIELD', 'ABE_ACTION_FIELD', 'ABE_CASE_NOTE_IN_RESPONSE', 'ABE_FORCE_LOGIN', 'ABE_CREATE_DATE', 'ABE_UPDATE_DATE', 'ABE_SUBJECT_FIELD', 'ABE_MAILSERVER_OR_MAILCURRENT', 'ABE_CUSTOM_GRID', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ) ); /** @@ -100,10 +103,10 @@ abstract class BaseAbeConfigurationPeer * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('AbeUid' => 0, 'ProUid' => 1, 'TasUid' => 2, 'AbeType' => 3, 'AbeTemplate' => 4, 'AbeDynType' => 5, 'DynUid' => 6, 'AbeEmailField' => 7, 'AbeActionField' => 8, 'AbeCaseNoteInResponse' => 9, 'AbeCreateDate' => 10, 'AbeUpdateDate' => 11, 'AbeSubjectField' => 12, 'AbeMailserverOrMailcurrent' => 13, 'AbeCustomGrid' => 14, ), - BasePeer::TYPE_COLNAME => array (AbeConfigurationPeer::ABE_UID => 0, AbeConfigurationPeer::PRO_UID => 1, AbeConfigurationPeer::TAS_UID => 2, AbeConfigurationPeer::ABE_TYPE => 3, AbeConfigurationPeer::ABE_TEMPLATE => 4, AbeConfigurationPeer::ABE_DYN_TYPE => 5, AbeConfigurationPeer::DYN_UID => 6, AbeConfigurationPeer::ABE_EMAIL_FIELD => 7, AbeConfigurationPeer::ABE_ACTION_FIELD => 8, AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE => 9, AbeConfigurationPeer::ABE_CREATE_DATE => 10, AbeConfigurationPeer::ABE_UPDATE_DATE => 11, AbeConfigurationPeer::ABE_SUBJECT_FIELD => 12, AbeConfigurationPeer::ABE_MAILSERVER_OR_MAILCURRENT => 13, AbeConfigurationPeer::ABE_CUSTOM_GRID => 14, ), - BasePeer::TYPE_FIELDNAME => array ('ABE_UID' => 0, 'PRO_UID' => 1, 'TAS_UID' => 2, 'ABE_TYPE' => 3, 'ABE_TEMPLATE' => 4, 'ABE_DYN_TYPE' => 5, 'DYN_UID' => 6, 'ABE_EMAIL_FIELD' => 7, 'ABE_ACTION_FIELD' => 8, 'ABE_CASE_NOTE_IN_RESPONSE' => 9, 'ABE_CREATE_DATE' => 10, 'ABE_UPDATE_DATE' => 11, 'ABE_SUBJECT_FIELD' => 12, 'ABE_MAILSERVER_OR_MAILCURRENT' => 13, 'ABE_CUSTOM_GRID' => 14, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) + BasePeer::TYPE_PHPNAME => array ('AbeUid' => 0, 'ProUid' => 1, 'TasUid' => 2, 'AbeType' => 3, 'AbeTemplate' => 4, 'AbeDynType' => 5, 'DynUid' => 6, 'AbeEmailField' => 7, 'AbeActionField' => 8, 'AbeCaseNoteInResponse' => 9, 'AbeForceLogin' => 10, 'AbeCreateDate' => 11, 'AbeUpdateDate' => 12, 'AbeSubjectField' => 13, 'AbeMailserverOrMailcurrent' => 14, 'AbeCustomGrid' => 15, ), + BasePeer::TYPE_COLNAME => array (AbeConfigurationPeer::ABE_UID => 0, AbeConfigurationPeer::PRO_UID => 1, AbeConfigurationPeer::TAS_UID => 2, AbeConfigurationPeer::ABE_TYPE => 3, AbeConfigurationPeer::ABE_TEMPLATE => 4, AbeConfigurationPeer::ABE_DYN_TYPE => 5, AbeConfigurationPeer::DYN_UID => 6, AbeConfigurationPeer::ABE_EMAIL_FIELD => 7, AbeConfigurationPeer::ABE_ACTION_FIELD => 8, AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE => 9, AbeConfigurationPeer::ABE_FORCE_LOGIN => 10, AbeConfigurationPeer::ABE_CREATE_DATE => 11, AbeConfigurationPeer::ABE_UPDATE_DATE => 12, AbeConfigurationPeer::ABE_SUBJECT_FIELD => 13, AbeConfigurationPeer::ABE_MAILSERVER_OR_MAILCURRENT => 14, AbeConfigurationPeer::ABE_CUSTOM_GRID => 15, ), + BasePeer::TYPE_FIELDNAME => array ('ABE_UID' => 0, 'PRO_UID' => 1, 'TAS_UID' => 2, 'ABE_TYPE' => 3, 'ABE_TEMPLATE' => 4, 'ABE_DYN_TYPE' => 5, 'DYN_UID' => 6, 'ABE_EMAIL_FIELD' => 7, 'ABE_ACTION_FIELD' => 8, 'ABE_CASE_NOTE_IN_RESPONSE' => 9, 'ABE_FORCE_LOGIN' => 10, 'ABE_CREATE_DATE' => 11, 'ABE_UPDATE_DATE' => 12, 'ABE_SUBJECT_FIELD' => 13, 'ABE_MAILSERVER_OR_MAILCURRENT' => 14, 'ABE_CUSTOM_GRID' => 15, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ) ); /** @@ -224,6 +227,8 @@ abstract class BaseAbeConfigurationPeer $criteria->addSelectColumn(AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE); + $criteria->addSelectColumn(AbeConfigurationPeer::ABE_FORCE_LOGIN); + $criteria->addSelectColumn(AbeConfigurationPeer::ABE_CREATE_DATE); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_UPDATE_DATE); diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index de38b25ba..6395c2024 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -4726,16 +4726,8 @@ - - - - - - - - - - + + diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index a1cd1ad1b..09d25a82e 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -2685,6 +2685,7 @@ CREATE TABLE `ABE_CONFIGURATION` `ABE_EMAIL_FIELD` VARCHAR(255) default '' NOT NULL, `ABE_ACTION_FIELD` VARCHAR(255) default '', `ABE_CASE_NOTE_IN_RESPONSE` INTEGER default 0, + `ABE_FORCE_LOGIN` TINYINT default 0, `ABE_CREATE_DATE` DATETIME NOT NULL, `ABE_UPDATE_DATE` DATETIME, `ABE_SUBJECT_FIELD` VARCHAR(100) default '', diff --git a/workflow/engine/methods/login/authentication.php b/workflow/engine/methods/login/authentication.php index c35cb4cb5..f1650f5f1 100755 --- a/workflow/engine/methods/login/authentication.php +++ b/workflow/engine/methods/login/authentication.php @@ -260,7 +260,7 @@ try { $_SESSION['USR_PASSWORD'] = $pwd; $_SESSION['BROWSER_TIME_ZONE'] = $dateTime->getTimeZoneIdByTimeZoneOffset((int)($_POST['form']['BROWSER_TIME_ZONE_OFFSET']), false); - + $_SESSION['URL'] = (isset($_POST['form']['URL']))? $_POST['form']['URL'] : ((isset($_REQUEST['u']))? $_REQUEST['u'] : ''); $_SESSION['USER_LANG'] = $lang; if (strpos($_SERVER['HTTP_REFERER'], 'home/login') !== false) { diff --git a/workflow/engine/methods/login/authenticationSso.php b/workflow/engine/methods/login/authenticationSso.php new file mode 100644 index 000000000..48297fd30 --- /dev/null +++ b/workflow/engine/methods/login/authenticationSso.php @@ -0,0 +1,144 @@ +singleSignOn) { + $_SESSION['__USER_LOGGED_SSO__'] = $RBAC->userObj->fields['USR_UID']; + $_SESSION['__USR_USERNAME_SSO__'] = $RBAC->userObj->fields['USR_USERNAME']; + } else { + if (!isset($_SESSION['__USER_LOGGED_SSO__'])) { + $u = ''; + + if (isset($_POST['form']['URL']) && $_POST['form']['URL'] != '') { + $u = $_POST['form']['URL']; + } else { + if (isset($_GET['u']) && $_GET['u'] != '') { + $u = $_GET['u']; + } + } + + header( + 'Location: /sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . + '/login/login' . (($u != '')? '?u=' . $u : '') + ); + + exit(0); + } + } + + $userUid = (isset($_SESSION['USER_LOGGED']))? $_SESSION['USER_LOGGED'] : ((isset($_SESSION['__USER_LOGGED_SSO__']))? $_SESSION['__USER_LOGGED_SSO__'] : ''); + + /*----------------------------------********---------------------------------*/ + if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) { + //Update User Time Zone + if (isset($_POST['form']['BROWSER_TIME_ZONE'])) { + $user = new Users(); + $user->update(['USR_UID' => $userUid, 'USR_TIME_ZONE' => $_POST['form']['BROWSER_TIME_ZONE']]); + } + } + /*----------------------------------********---------------------------------*/ + + $arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS); + + //Set User Time Zone + $user = UsersPeer::retrieveByPK($userUid); + + if (!is_null($user)) { + $userTimeZone = $user->getUsrTimeZone(); + + if (trim($userTimeZone) == '') { + $userTimeZone = $arraySystemConfiguration['time_zone']; + } + + $_SESSION['USR_TIME_ZONE'] = $userTimeZone; + } + + //Get default user location + if (isset($_POST['form']['URL']) && $_POST['form']['URL'] != '') { + $location = $_POST['form']['URL']; + } else { + if (isset($_GET['u']) && $_GET['u'] != '') { + $location = $_GET['u']; + } else { + $userProperty = new UsersProperties(); + + $location = $userProperty->redirectTo($userUid); + } + } + + /*----------------------------------********---------------------------------*/ + if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) { + if ((int)($arraySystemConfiguration['system_utc_time_zone'])) { + $dateTime = new \ProcessMaker\Util\DateTime(); + + $timeZoneOffset = $dateTime->getTimeZoneOffsetByTimeZoneId($_SESSION['USR_TIME_ZONE']); + $browserTimeZoneOffset = 0; + + if (isset($_POST['form']['BROWSER_TIME_ZONE_OFFSET'])) { + $browserTimeZoneOffset = (int)($_POST['form']['BROWSER_TIME_ZONE_OFFSET']); + } else { + if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) { + $browserTimeZoneOffset = (int)($_GET['BROWSER_TIME_ZONE_OFFSET']); + } + } + + if ($timeZoneOffset === false || $timeZoneOffset != $browserTimeZoneOffset) { + $userUtcOffset = $dateTime->getUtcOffsetByTimeZoneOffset($timeZoneOffset); + $browserUtcOffset = $dateTime->getUtcOffsetByTimeZoneOffset($browserTimeZoneOffset); + + $arrayTimeZoneId = $dateTime->getTimeZoneIdByTimeZoneOffset($browserTimeZoneOffset); + + array_unshift($arrayTimeZoneId, 'false'); + array_walk( + $arrayTimeZoneId, + function (&$value, $key, $parameter) + { + $value = ['TZ_UID' => $value, 'TZ_NAME' => '(UTC ' . $parameter . ') ' . $value]; + }, + $browserUtcOffset + ); + + $_SESSION['_DBArray'] = ['TIME_ZONE' => $arrayTimeZoneId]; + + $arrayData = [ + 'USR_USERNAME' => '', + 'USR_PASSWORD' => '', + 'USR_TIME_ZONE' => '(UTC ' . $userUtcOffset . ') ' . $_SESSION['USR_TIME_ZONE'], + 'BROWSER_TIME_ZONE' => $dateTime->getTimeZoneIdByTimeZoneOffset($browserTimeZoneOffset, false), + 'USER_LANG' => SYS_LANG, + 'URL' => $location + ]; + + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( + 'xmlform', + 'xmlform', + 'login' . PATH_SEP . 'TimeZoneAlert', + '', + $arrayData, SYS_URI . 'login/authenticationSso.php' + ); + + G::RenderPage('publish'); + exit(0); + } + } + } + /*----------------------------------********---------------------------------*/ + + setcookie('singleSignOn', '1', time() + (24 * 60 * 60), '/'); + + $_SESSION['USER_LOGGED'] = $_SESSION['__USER_LOGGED_SSO__']; + $_SESSION['USR_USERNAME'] = $_SESSION['__USR_USERNAME_SSO__']; + + unset($_SESSION['__USER_LOGGED_SSO__'], $_SESSION['__USR_USERNAME_SSO__']); + + G::header('Location: ' . $location); +} catch (Exception $e) { + $arrayData = []; + $arrayData['MESSAGE'] = $e->getMessage(); + + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $arrayData); + + G::RenderPage('publish'); +} diff --git a/workflow/engine/methods/login/login.php b/workflow/engine/methods/login/login.php index 04f2a2448..1753a72e9 100755 --- a/workflow/engine/methods/login/login.php +++ b/workflow/engine/methods/login/login.php @@ -148,6 +148,8 @@ if (isset($_SESSION['__TIME_ZONE_FAILED__']) && $_SESSION['__TIME_ZONE_FAILED__' $userPassword = $_SESSION['USR_PASSWORD']; $userTimeZone = $_SESSION['USR_TIME_ZONE']; $browserTimeZone = $_SESSION['BROWSER_TIME_ZONE']; + $url = $_SESSION['URL']; + if(isset($_SESSION['USER_LANG'])){ $lang = $_SESSION['USER_LANG']; }else{ @@ -220,7 +222,8 @@ if ($timeZoneFailed) { 'USR_PASSWORD' => $userPassword, 'USR_TIME_ZONE' => '(UTC ' . $userUtcOffset . ') ' . $userTimeZone, 'BROWSER_TIME_ZONE' => $browserTimeZone, - 'USER_LANG' => $lang + 'USER_LANG' => $lang, + 'URL' => $url ]; $G_PUBLISH = new Publisher(); diff --git a/workflow/engine/methods/services/ActionsByEmail.php b/workflow/engine/methods/services/ActionsByEmail.php index 8a708a39c..e6f809ee5 100644 --- a/workflow/engine/methods/services/ActionsByEmail.php +++ b/workflow/engine/methods/services/ActionsByEmail.php @@ -1,121 +1,151 @@ verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) { - // since all the request parameters using this script are encrypted - // using the URL_KEY the probability of injecting any kind of code using - // this entry point are only possible knowing the aforementioned key. - switch (G::decrypt(urldecode(utf8_encode($_REQUEST['ACTION'])), URL_KEY)) { - case 'processABE' : - $G_PUBLISH = new Publisher(); - try { - // Validations - if (!isset($_REQUEST['APP_UID'])) { - $_REQUEST['APP_UID'] = ''; - } +if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) { + if (PMLicensedFeatures::getSingleton()->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) { + // since all the request parameters using this script are encrypted + // using the URL_KEY the probability of injecting any kind of code using + // this entry point are only possible knowing the aforementioned key. + switch (G::decrypt(urldecode(utf8_encode($_REQUEST['ACTION'])), URL_KEY)) { + case 'processABE' : + $G_PUBLISH = new Publisher(); - if (!isset($_REQUEST['DEL_INDEX'])) { - $_REQUEST['DEL_INDEX'] = ''; - } + try { + G::LoadClass('case'); - if ($_REQUEST['APP_UID'] == '') { - throw new Exception('The parameter APP_UID is empty.'); - } - - if ($_REQUEST['DEL_INDEX'] == '') { - throw new Exception('The parameter DEL_INDEX is empty.'); - } - - $_REQUEST['APP_UID'] = G::decrypt(urldecode(utf8_encode($_REQUEST['APP_UID'])), URL_KEY); - $_REQUEST['DEL_INDEX'] = G::decrypt(urldecode(utf8_encode($_REQUEST['DEL_INDEX'])), URL_KEY); - $_REQUEST['FIELD'] = G::decrypt(urldecode(utf8_encode($_REQUEST['FIELD'])), URL_KEY); - $_REQUEST['VALUE'] = G::decrypt(urldecode(utf8_encode($_REQUEST['VALUE'])), URL_KEY); - $_REQUEST['ABER'] = G::decrypt(urldecode(utf8_encode($_REQUEST['ABER'])), URL_KEY); - - G::LoadClass('case'); - - $cases = new Cases(); - $caseFieldsABE = $cases->loadCase($_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX']); - - if (is_null($caseFieldsABE['DEL_FINISH_DATE'])) { - $dataField = array(); - $dataField[$_REQUEST['FIELD']] = $_REQUEST['VALUE']; - $caseFieldsABE ['APP_DATA'] = array_merge($caseFieldsABE ['APP_DATA'], $dataField); - - $dataResponses = array(); - $dataResponses['ABE_REQ_UID'] = $_REQUEST['ABER']; - $dataResponses['ABE_RES_CLIENT_IP'] = $_SERVER['REMOTE_ADDR']; - $dataResponses['ABE_RES_DATA'] = serialize($_REQUEST['VALUE']); - $dataResponses['ABE_RES_STATUS'] = 'PENDING'; - $dataResponses['ABE_RES_MESSAGE'] = ''; - - try { - require_once 'classes/model/AbeResponses.php'; - $abeAbeResponsesInstance = new AbeResponses(); - $dataResponses['ABE_RES_UID'] = $abeAbeResponsesInstance->createOrUpdate($dataResponses); - } catch (Exception $error) { - throw $error; + //Validations + if (!isset($_REQUEST['APP_UID'])) { + $_REQUEST['APP_UID'] = ''; } - $cases->updateCase($_REQUEST['APP_UID'], $caseFieldsABE); - - G::LoadClass('wsBase'); - - $ws = new wsBase(); - - $result = $ws->derivateCase($caseFieldsABE['CURRENT_USER_UID'], $_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX'], true); - $code = (is_array($result) ? $result['status_code'] : $result->status_code); - - if ($code != 0) { - throw new Exception('An error occurred while the application was being processed.

- Error code: ' . $result->status_code . '
- Error message: ' . $result->message . '

'); + if (!isset($_REQUEST['DEL_INDEX'])) { + $_REQUEST['DEL_INDEX'] = ''; } - // Update - $dataResponses['ABE_RES_STATUS'] = ($code == 0 ? 'SENT' : 'ERROR'); - $dataResponses['ABE_RES_MESSAGE'] = ($code == 0 ? '-' : $result->message); - - try { - $abeAbeResponsesInstance = new AbeResponses(); - $abeAbeResponsesInstance->createOrUpdate($dataResponses); - } catch (Exception $error) { - throw $error; + if ($_REQUEST['APP_UID'] == '') { + throw new Exception('The parameter APP_UID is empty.'); } - $message = 'The answer has been submited. Thank you'; - - //Save Cases Notes - G::LoadClass('actionsByEmailUtils'); - - $dataAbeRequests = loadAbeRequest($_REQUEST['ABER']); - $dataAbeConfiguration = loadAbeConfiguration($dataAbeRequests['ABE_UID']); - - if ($dataAbeConfiguration['ABE_CASE_NOTE_IN_RESPONSE'] == 1) { - $response = new stdclass(); - $response->usrUid = $caseFieldsABE['APP_DATA']['USER_LOGGED']; - $response->appUid = $_REQUEST['APP_UID']; - $response->noteText = "Check the information that was sent for the receiver: " . $dataAbeRequests['ABE_REQ_SENT_TO']; - - postNote($response); + if ($_REQUEST['DEL_INDEX'] == '') { + throw new Exception('The parameter DEL_INDEX is empty.'); } - $dataAbeRequests['ABE_REQ_ANSWERED'] = 1; - $code == 0 ? uploadAbeRequest($dataAbeRequests) : ''; - } else { - $message = 'The response has already been sent.'; + $_REQUEST['APP_UID'] = G::decrypt(urldecode(utf8_encode($_REQUEST['APP_UID'])), URL_KEY); + $_REQUEST['DEL_INDEX'] = G::decrypt(urldecode(utf8_encode($_REQUEST['DEL_INDEX'])), URL_KEY); + $_REQUEST['FIELD'] = G::decrypt(urldecode(utf8_encode($_REQUEST['FIELD'])), URL_KEY); + $_REQUEST['VALUE'] = G::decrypt(urldecode(utf8_encode($_REQUEST['VALUE'])), URL_KEY); + $_REQUEST['ABER'] = G::decrypt(urldecode(utf8_encode($_REQUEST['ABER'])), URL_KEY); + + $case = new Cases(); + $actionsByEmail = new \ProcessMaker\BusinessModel\ActionsByEmail(); + + $actionsByEmail->verifyLogin($_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX']); + + $caseFieldsABE = $case->loadCase($_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX']); + + if (is_null($caseFieldsABE['DEL_FINISH_DATE'])) { + $dataField = []; + $dataField[$_REQUEST['FIELD']] = $_REQUEST['VALUE']; + $caseFieldsABE ['APP_DATA'] = array_merge($caseFieldsABE ['APP_DATA'], $dataField); + + $dataResponses = []; + $dataResponses['ABE_REQ_UID'] = $_REQUEST['ABER']; + $dataResponses['ABE_RES_CLIENT_IP'] = $_SERVER['REMOTE_ADDR']; + $dataResponses['ABE_RES_DATA'] = serialize($_REQUEST['VALUE']); + $dataResponses['ABE_RES_STATUS'] = 'PENDING'; + $dataResponses['ABE_RES_MESSAGE'] = ''; + + try { + require_once 'classes/model/AbeResponses.php'; + + $abeAbeResponsesInstance = new AbeResponses(); + $dataResponses['ABE_RES_UID'] = $abeAbeResponsesInstance->createOrUpdate($dataResponses); + } catch (Exception $e) { + throw $e; + } + + $case->updateCase($_REQUEST['APP_UID'], $caseFieldsABE); + + G::LoadClass('wsBase'); + + $ws = new wsBase(); + + $result = $ws->derivateCase( + $caseFieldsABE['CURRENT_USER_UID'], $_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX'], true + ); + + $code = (is_array($result))? $result['status_code'] : $result->status_code; + + if ($code != 0) { + throw new Exception( + 'An error occurred while the application was being processed.

+ Error code: ' . $result->status_code . '
+ Error message: ' . $result->message . '

' + ); + } + + //Update + $dataResponses['ABE_RES_STATUS'] = ($code == 0)? 'SENT' : 'ERROR'; + $dataResponses['ABE_RES_MESSAGE'] = ($code == 0)? '-' : $result->message; + + try { + $abeAbeResponsesInstance = new AbeResponses(); + $abeAbeResponsesInstance->createOrUpdate($dataResponses); + } catch (Exception $e) { + throw $e; + } + + $message = 'The answer has been submited. Thank you'; + + //Save Cases Notes + G::LoadClass('actionsByEmailUtils'); + + $dataAbeRequests = loadAbeRequest($_REQUEST['ABER']); + $dataAbeConfiguration = loadAbeConfiguration($dataAbeRequests['ABE_UID']); + + if ($dataAbeConfiguration['ABE_CASE_NOTE_IN_RESPONSE'] == 1) { + $response = new stdClass(); + $response->usrUid = $caseFieldsABE['APP_DATA']['USER_LOGGED']; + $response->appUid = $_REQUEST['APP_UID']; + $response->noteText = 'Check the information that was sent for the receiver: ' . + $dataAbeRequests['ABE_REQ_SENT_TO']; + + postNote($response); + } + + $dataAbeRequests['ABE_REQ_ANSWERED'] = 1; + $code == 0 ? uploadAbeRequest($dataAbeRequests) : ''; + } else { + $message = 'The response has already been sent.'; + } + + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', array('MESSAGE' => $message)); + } catch (Exception $e) { + $G_PUBLISH->AddContent( + 'xmlform', + 'xmlform', + 'login/showMessage', + '', + ['MESSAGE' => $e->getMessage() . 'Please contact to your system administrator.'] + ); } - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', array('MESSAGE' => $message)); - } catch (Exception $error) { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => $error->getMessage() . 'Please contact to your system administrator.')); - } - - G::RenderPage('publish', 'blank'); - - - break; + G::RenderPage('publish', 'blank'); + break; + } } +} else { +?> + + + + + + + + + +verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) { + global $G_PUBLISH; -if (PMLicensedFeatures - ::getSingleton() - ->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) { - global $G_PUBLISH; - $G_PUBLISH = new Publisher(); - - try { - // Validations - if (!isset($_REQUEST['APP_UID'])) { - $_REQUEST['APP_UID'] = ''; + $G_PUBLISH = new Publisher(); + + try { + G::LoadClass('case'); + G::LoadClass('pmDynaform'); + + //Validations + if (!isset($_REQUEST['APP_UID'])) { + $_REQUEST['APP_UID'] = ''; + } + + if (!isset($_REQUEST['DEL_INDEX'])) { + $_REQUEST['DEL_INDEX'] = ''; + } + + if ($_REQUEST['APP_UID'] == '') { + throw new Exception('The parameter APP_UID is empty.'); + } + + if ($_REQUEST['DEL_INDEX'] == '') { + throw new Exception('The parameter DEL_INDEX is empty.'); + } + + $case = new Cases(); + $actionsByEmail = new \ProcessMaker\BusinessModel\ActionsByEmail(); + + $applicationUid = G::decrypt($_REQUEST['APP_UID'], URL_KEY); + $delIndex = G::decrypt($_REQUEST['DEL_INDEX'], URL_KEY); + + $actionsByEmail->verifyLogin($applicationUid, $delIndex); + + $caseFields = $case->loadCase($applicationUid, $delIndex); + + $criteria = new Criteria(); + $criteria->addSelectColumn(DynaformPeer::DYN_CONTENT); + $criteria->addSelectColumn(DynaformPeer::PRO_UID); + $criteria->add(DynaformPeer::DYN_UID, G::decrypt($_REQUEST['DYN_UID'], URL_KEY)); + $result = DynaformPeer::doSelectRS($criteria); + $result->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $result->next(); + $configuration = $result->getRow(); + + $action = 'ActionsByEmailDataFormPost.php?APP_UID=' . $_REQUEST['APP_UID'] . '&DEL_INDEX=' . + $_REQUEST['DEL_INDEX'] . '&ABER=' . $_REQUEST['ABER']; + + $record = []; + $record['DYN_CONTENT'] = $configuration['DYN_CONTENT']; + $record['PRO_UID'] = $configuration['PRO_UID']; + $record['CURRENT_DYNAFORM'] = G::decrypt($_REQUEST['DYN_UID'], URL_KEY); + $record['APP_UID'] = $_REQUEST['APP_UID']; + $record['DEL_INDEX'] = $_REQUEST['DEL_INDEX']; + $record['ABER'] = $_REQUEST['ABER']; + $record['APP_DATA'] = $caseFields['APP_DATA']; + + if (is_null($caseFields['DEL_FINISH_DATE'])) { + $a = new pmDynaform($record); + + $a->printABE($action,$record); + } else { + $G_PUBLISH->AddContent( + 'xmlform', + 'xmlform', + 'login/showInfo', + '', + ['MESSAGE' => 'The form has already been filled and sent.'] + ); + } + } catch (Exception $e) { + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', ['MESSAGE' => $e->getMessage()]); } - - if (!isset($_REQUEST['DEL_INDEX'])) { - $_REQUEST['DEL_INDEX'] = ''; - } - - if ($_REQUEST['APP_UID'] == '') { - throw new Exception('The parameter APP_UID is empty.'); - } - - if ($_REQUEST['DEL_INDEX'] == '') { - throw new Exception('The parameter DEL_INDEX is empty.'); - } - - G::LoadClass('case'); - G::LoadClass('pmDynaform'); - - $cases = new Cases(); - $caseFields = $cases->loadCase(G::decrypt($_REQUEST['APP_UID'], URL_KEY),G::decrypt($_REQUEST['DEL_INDEX'], URL_KEY)); - - // - $criteria = new Criteria(); - $criteria->addSelectColumn(DynaformPeer::DYN_CONTENT); - $criteria->addSelectColumn(DynaformPeer::PRO_UID); - $criteria->add(DynaformPeer::DYN_UID, G::decrypt($_REQUEST['DYN_UID'], URL_KEY)); - $result = DynaformPeer::doSelectRS($criteria); - $result->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $result->next(); - $configuration = $result->getRow(); - - $action = 'ActionsByEmailDataFormPost.php?APP_UID=' . $_REQUEST['APP_UID'] . '&DEL_INDEX=' . $_REQUEST['DEL_INDEX'] . '&ABER=' . $_REQUEST['ABER']; - $record['DYN_CONTENT'] = $configuration['DYN_CONTENT']; - $record['PRO_UID'] = $configuration['PRO_UID']; - $record['CURRENT_DYNAFORM'] = G::decrypt($_REQUEST['DYN_UID'], URL_KEY); - $record['APP_UID'] = $_REQUEST['APP_UID']; - $record['DEL_INDEX'] = $_REQUEST['DEL_INDEX']; - $record['ABER'] = $_REQUEST['ABER']; - $record['APP_DATA'] = $caseFields['APP_DATA']; - if (is_null($caseFields['DEL_FINISH_DATE'])) { - $a = new pmDynaform($record); - $a->printABE($action,$record); - } else { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', array('MESSAGE' => 'The form has already been filled and sent.')); - } - } catch (Exception $error) { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', array('MESSAGE' => $error->getMessage())); + + G::RenderPage('publish', 'blank'); } - - G::RenderPage('publish', 'blank'); +} else { +?> + + + + + + + + + +createOrUpdate($feature['fields']); break; default: @@ -61,6 +68,7 @@ class ActionsByEmail $configuration['ABE_ACTION_FIELD'] = $configuration['ABE_ACTION_FIELD']; $configuration['ABE_MAILSERVER_OR_MAILCURRENT'] = $configuration['ABE_MAILSERVER_OR_MAILCURRENT']; $configuration['ABE_CASE_NOTE_IN_RESPONSE'] = $configuration['ABE_CASE_NOTE_IN_RESPONSE'] ? '["1"]' : '[]'; + $configuration['ABE_FORCE_LOGIN'] = ($configuration['ABE_FORCE_LOGIN'])? '["1"]' : '[]'; $configuration['ABE_CUSTOM_GRID'] = unserialize($configuration['ABE_CUSTOM_GRID']); } $configuration['feature'] = 'ActionsByEmail'; @@ -623,4 +631,107 @@ class ActionsByEmail //Return return $message; } + + /** + * Verify login + * + * @param string $applicationUid Unique id of Case + * @param int $delIndex Delegation index + * + * @return void + */ + public function verifyLogin($applicationUid, $delIndex) + { + try { + //Verify data and Set variables + $case = new \ProcessMaker\BusinessModel\Cases(); + + $arrayAppDelegationData = $case->getAppDelegationRecordByPk( + $applicationUid, $delIndex, ['$applicationUid' => '$applicationUid', '$delIndex' => '$delIndex'] + ); + + //Verify login + $criteria = new \Criteria('workflow'); + + $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); + + if ($rsCriteria->next()) { + $record = $rsCriteria->getRow(); + + if ($record['ABE_FORCE_LOGIN'] == 1) { + $flagLogin = false; + + if (!isset($_SESSION['USER_LOGGED'])) { + /*----------------------------------********---------------------------------*/ + //SSO + if (\PMLicensedFeatures::getSingleton()->verifyfeature('x4TTzlISnp2K2tnSTJoMC8rTDRMTjlhMCtZeXV0QnNCLzU=')) { + \G::LoadClass('pmSso'); + + $sso = new \pmSsoClass(); + + if ($sso->ssocVerifyUser()) { + global $RBAC; + + //Start new session + @session_destroy(); + session_start(); + session_regenerate_id(); + + //Authenticate + $_GET['u'] = $_SERVER['REQUEST_URI']; + + require_once(PATH_METHODS . 'login' . PATH_SEP . 'authenticationSso.php'); + exit(0); + } + } + /*----------------------------------********---------------------------------*/ + + if (defined('PM_SINGLE_SIGN_ON')) { + $pluginRegistry = &\PMPluginRegistry::getSingleton(); + + if ($pluginRegistry->existsTrigger(PM_SINGLE_SIGN_ON)) { + if ($pluginRegistry->executeTriggers(PM_SINGLE_SIGN_ON, null)) { + global $RBAC; + + //Start new session + @session_destroy(); + session_start(); + session_regenerate_id(); + + //Authenticate + $_GET['u'] = $_SERVER['REQUEST_URI']; + + require_once(PATH_METHODS . 'login' . PATH_SEP . 'authenticationSso.php'); + exit(0); + } + } + } + + $flagLogin = true; + } else { + if ($_SESSION['USER_LOGGED'] != $arrayAppDelegationData['USR_UID']) { + \G::SendTemporalMessage('ID_CASE_ASSIGNED_ANOTHER_USER', 'error', 'label'); + + $flagLogin = true; + } + } + + if ($flagLogin) { + header( + 'Location: /sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . + '/login/login?u=' . urlencode($_SERVER['REQUEST_URI']) + ); + + exit(0); + } + } + } + } catch (\Exception $e) { + throw $e; + } + } } diff --git a/workflow/engine/xmlform/login/TimeZoneAlert.html b/workflow/engine/xmlform/login/TimeZoneAlert.html index 73de2c162..f27a6d979 100644 --- a/workflow/engine/xmlform/login/TimeZoneAlert.html +++ b/workflow/engine/xmlform/login/TimeZoneAlert.html @@ -8,6 +8,7 @@