diff --git a/workflow/engine/methods/processes/processes_Ajax.php b/workflow/engine/methods/processes/processes_Ajax.php index 01fe49f6e..37f3229dd 100755 --- a/workflow/engine/methods/processes/processes_Ajax.php +++ b/workflow/engine/methods/processes/processes_Ajax.php @@ -52,22 +52,22 @@ try { //$oData = $oJSON->decode( stripslashes( $_REQUEST['data'] ) ); $sOutput = ''; $sTask = ''; - + if(array_key_exists('pro_uid', $oDataAux) || array_key_exists('uid', $oDataAux) || array_key_exists('PRO_UID', $oDataAux) || array_key_exists('UID', $oDataAux)) { if(array_key_exists('pro_uid', $oDataAux) || array_key_exists('PRO_UID', $oDataAux)) { if(array_key_exists('pro_uid', $oDataAux)) { $proUid = $oDataAux['pro_uid']; } else { - $proUid = $oDataAux['PRO_UID']; + $proUid = $oDataAux['PRO_UID']; } } else { $proUid = $oDataAux['uid']; $uidAux = $proUid; } - + G::LoadClass('processes'); $infoProcess = new Processes(); - + if(!$infoProcess->processExists($proUid)) { $oSL = new SwimlanesElements(); if($oSL->swimlanesElementsExists($proUid)) { @@ -83,11 +83,11 @@ try { $rs->next(); $row = $rs->getRow(); $proUid = $row['PRO_UID']; - } + } } - $resultProcess = $infoProcess->getProcessRow($proUid); + $resultProcess = $infoProcess->getProcessRow($proUid); } else { - if(array_key_exists('PU_UID', $oDataAux)) { + if(array_key_exists('PU_UID', $oDataAux)) { $c = new Criteria('workflow'); $c->clearSelectColumns(); $c->addSelectColumn(ProcessUserPeer::PRO_UID); @@ -98,14 +98,14 @@ try { $oDataset->next(); $row = $oDataset->getRow(); $userSupervisor = $row['USR_UID']; - + G::LoadClass('processes'); $infoProcess = new Processes(); - $resultProcess = $infoProcess->getProcessRow($row['PRO_UID']); + $resultProcess = $infoProcess->getProcessRow($row['PRO_UID']); } } } - + if(isset($_REQUEST['pro_uid']) && !empty($_REQUEST['pro_uid']) || isset($_REQUEST['PRO_UID']) && !empty($_REQUEST['PRO_UID'])) { if(isset($_REQUEST['pro_uid']) && !empty($_REQUEST['pro_uid'])) { $proUid = $_REQUEST['pro_uid']; @@ -114,21 +114,27 @@ try { } G::LoadClass('processes'); $infoProcess = new Processes(); - $resultProcess = $infoProcess->getProcessRow($proUid); + $resultProcess = $infoProcess->getProcessRow($proUid); } if(isset($proUid) && $proUid != "") { - $valuesProcess['PRO_UID'] = $proUid; - $valuesProcess['PRO_UPDATE_DATE'] = date("Y-m-d H:i:s"); - G::LoadClass('processes'); + G::LoadClass("processes"); + $infoProcess = new Processes(); - $resultProcess = $infoProcess->updateProcessRow($valuesProcess); - $resultProcess = $infoProcess->getProcessRow($proUid); + + if (!in_array($_REQUEST["action"], array("load"))) { + $infoProcess->updateProcessRow(array( + "PRO_UID" => $proUid, + "PRO_UPDATE_DATE" => date("Y-m-d H:i:s") + )); + } + + $resultProcess = $infoProcess->getProcessRow($proUid); } - + //G::LoadClass( 'processMap' ); $oProcessMap = new processMap(new DBConnection()); - + switch ($_REQUEST['action']) { case 'load': $_SESSION['PROCESS'] = $oData->uid; @@ -345,7 +351,7 @@ try { } else { switch ($oData->type) { case 0: - $oData->type = 'SEQUENTIAL'; + $oData->type = 'SEQUENTIAL'; break; case 1: $oData->type = 'SELECT'; @@ -363,7 +369,7 @@ try { $oData->type = 'SEC-JOIN'; break; case 8: - $oData->type = 'DISCRIMINATOR'; + $oData->type = 'DISCRIMINATOR'; break; } $oProcessMap->newPattern($oData->pro_uid, $oData->tas_uid, $oData->next_task, $oData->type); @@ -384,7 +390,7 @@ try { $taskNextInfo=$oTaskNextNewPattern->load($oData->next_task); $titleNextTask=$taskNextInfo['TAS_TITLE']; } else { - $titleNextTask=G::LoadTranslation("ID_END_OF_PROCESS"); + $titleNextTask=G::LoadTranslation("ID_END_OF_PROCESS"); } if ($titleNextTask=='') { G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' : '.$oData->pro_uid.' Routing rule : END OF PROCESS Task Name -> '.$titleTask.' : '.$oData->tas_uid); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Department.php b/workflow/engine/src/ProcessMaker/BusinessModel/Department.php index 5cdee8c3c..28219e9dd 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Department.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Department.php @@ -11,6 +11,65 @@ use \DepartmentPeer; */ class Department { + /** + * Verify if exists the title of a Department + * + * @param string $departmentTitle Title + * @param string $departmentUidExclude Unique id of Department to exclude + * + * return bool Return true if exists the title of a Department, false otherwise + */ + public function existsTitle($departmentTitle, $departmentUidExclude = "") + { + try { + $delimiter = \DBAdapter::getStringDelimiter(); + + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\DepartmentPeer::DEP_UID); + + $criteria->addAlias("CT", \ContentPeer::TABLE_NAME); + + $arrayCondition = array(); + $arrayCondition[] = array(\DepartmentPeer::DEP_UID, "CT.CON_ID", \Criteria::EQUAL); + $arrayCondition[] = array("CT.CON_CATEGORY", $delimiter . "DEPO_TITLE" . $delimiter, \Criteria::EQUAL); + $arrayCondition[] = array("CT.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL); + $criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN); + + if ($departmentUidExclude != "") { + $criteria->add(\DepartmentPeer::DEP_UID, $departmentUidExclude, \Criteria::NOT_EQUAL); + } + + $criteria->add("CT.CON_VALUE", $departmentTitle, \Criteria::EQUAL); + + $rsCriteria = \DepartmentPeer::doSelectRS($criteria); + + return ($rsCriteria->next())? true : false; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Verify if exists the title of a Department + * + * @param string $departmentTitle Title + * @param string $fieldNameForException Field name for the exception + * @param string $departmentUidExclude Unique id of Department to exclude + * + * return void Throw exception if exists the title of a Department + */ + public function throwExceptionIfExistsTitle($departmentTitle, $fieldNameForException, $departmentUidExclude = "") + { + try { + if ($this->existsTitle($departmentTitle, $departmentUidExclude)) { + throw new \Exception(\G::LoadTranslation("ID_DEPARTMENT_TITLE_ALREADY_EXISTS", array($fieldNameForException, $departmentTitle))); + } + } catch (\Exception $e) { + throw $e; + } + } + /** * Get list for Departments * @@ -99,25 +158,63 @@ class Department } /** - * Put Assign User + * Assign User to Department * - * @access public - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @param string $departmentUid Unique id of Department + * @param array $arrayData Data * - * @return void + * return array Return data of the User assigned to Department */ - public function assignUser($dep_uid, $usr_uid) + public function assignUser($departmentUid, array $arrayData) { - $dep_uid = Validator::depUid($dep_uid); - $usr_uid = Validator::usrUid($usr_uid); + try { + //Verify data + $process = new \ProcessMaker\BusinessModel\Process(); + $validator = new \ProcessMaker\BusinessModel\Validator(); - $dep = new \Department(); - $dep->load($dep_uid); - $dep_manager = $dep->getDepManager(); - $manager = ($dep_manager == '') ? true : false; - $dep->addUserToDepartment( $dep_uid, $usr_uid, $manager, false ); - $dep->updateDepartmentManager( $dep_uid ); + $validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData"); + $validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData"); + + //Set data + $arrayData = array_change_key_case($arrayData, CASE_UPPER); + + unset($arrayData["DEP_UID"]); + + //Set variables + $arrayUserFieldDefinition = array( + "DEP_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "departmentUid"), + "USR_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "userUid") + ); + + $arrayUserFieldNameForException = array( + "departmentUid" => strtolower("DEP_UID"), + "userUid" => strtolower("USR_UID") + ); + + //Verify data + $departmentUid = \ProcessMaker\BusinessModel\Validator::depUid($departmentUid); + + $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $arrayUserFieldDefinition, $arrayUserFieldNameForException, true); + + $process->throwExceptionIfNotExistsUser($arrayData["USR_UID"], $arrayUserFieldNameForException["userUid"]); + + //Assign User + $department = new \Department(); + + $department->load($departmentUid); + + $department->addUserToDepartment($departmentUid, $arrayData["USR_UID"], ($department->getDepManager() == "")? true : false, false); + $department->updateDepartmentManager($departmentUid); + + //Return + $arrayData = array_merge(array("DEP_UID" => $departmentUid), $arrayData); + + $arrayData = array_change_key_case($arrayData, CASE_LOWER); + + return $arrayData; + } catch (\Exception $e) { + throw $e; + } } /** @@ -239,6 +336,11 @@ class Department Validator::isBoolean($create, '$create'); $dep_data = array_change_key_case($dep_data, CASE_UPPER); + + if ($create) { + unset($dep_data["DEP_UID"]); + } + $oDepartment = new \Department(); if (isset($dep_data['DEP_UID']) && $dep_data['DEP_UID'] != '') { Validator::depUid($dep_data['DEP_UID']); @@ -254,18 +356,21 @@ class Department } if (!$create) { - $dep_data['DEPO_TITLE'] = $dep_data['DEP_TITLE']; - if (isset($dep_data['DEP_TITLE'])) { - Validator::depTitle($dep_data['DEP_TITLE'], $dep_data['DEP_UID']); + if (isset($dep_data["DEP_TITLE"])) { + $this->throwExceptionIfExistsTitle($dep_data["DEP_TITLE"], strtolower("DEP_TITLE"), $dep_data["DEP_UID"]); + + $dep_data["DEPO_TITLE"] = $dep_data["DEP_TITLE"]; } + $oDepartment->update($dep_data); $oDepartment->updateDepartmentManager($dep_data['DEP_UID']); } else { if (isset($dep_data['DEP_TITLE'])) { - Validator::depTitle($dep_data['DEP_TITLE']); + $this->throwExceptionIfExistsTitle($dep_data["DEP_TITLE"], strtolower("DEP_TITLE")); } else { throw (new \Exception(\G::LoadTranslation("ID_FIELD_REQUIRED", array('dep_title')))); } + $dep_uid = $oDepartment->create($dep_data); $response = $this->getDepartment($dep_uid); return $response; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/User.php b/workflow/engine/src/ProcessMaker/BusinessModel/User.php index e1e1f061d..3d61bf6d0 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/User.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/User.php @@ -215,7 +215,7 @@ class User if ($form['USR_REPLACED_BY'] != '') { $oReplacedBy = \UsersPeer::retrieveByPK($form['USR_REPLACED_BY']); if (is_null($oReplacedBy)) { - throw new \Exception('usr_replaced_by:'.$form['USR_REPLACED_BY'].' '.\G::LoadTranslation('ID_AUTHENTICATION_SOURCE_INVALID')); + throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_EXIST", array(strtolower("USR_REPLACED_BY"), $form["USR_REPLACED_BY"]))); } } } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Validator.php b/workflow/engine/src/ProcessMaker/BusinessModel/Validator.php index c495156b0..74269b502 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Validator.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Validator.php @@ -35,47 +35,6 @@ class Validator return $dep_uid; } - /** - * Validate dep_title - * @var string $dep_title. Name or Title for Departament - * @var string $dep_uid. Uid for Departament - * - * @access public - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia - * - * @return array - * - * @url GET - */ - static public function depTitle($dep_title, $dep_uid = '') - { - $dep_title = trim($dep_title); - if ($dep_title == '') { - throw (new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array('dep_title','')))); - } - - $oCriteria = new \Criteria( 'workflow' ); - $oCriteria->clearSelectColumns(); - $oCriteria->addSelectColumn( \ContentPeer::CON_CATEGORY ); - $oCriteria->addSelectColumn( \ContentPeer::CON_VALUE ); - $oCriteria->addSelectColumn( \DepartmentPeer::DEP_PARENT ); - $oCriteria->add( \ContentPeer::CON_CATEGORY, 'DEPO_TITLE' ); - $oCriteria->addJoin( \ContentPeer::CON_ID, \DepartmentPeer::DEP_UID, \Criteria::LEFT_JOIN ); - $oCriteria->add( \ContentPeer::CON_VALUE, $dep_title ); - $oCriteria->add( \ContentPeer::CON_LANG, SYS_LANG ); - if ($dep_uid != '') { - $oCriteria->add( \ContentPeer::CON_ID, $dep_uid, \Criteria::NOT_EQUAL ); - } - - $oDataset = \DepartmentPeer::doSelectRS( $oCriteria ); - $oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC ); - if ($oDataset->next()) { - throw (new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array('dep_title',$dep_title)))); - } - return $dep_title; - } - /** * Validate dep_status * @var string $dep_uid. Uid for Departament diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Department.php b/workflow/engine/src/ProcessMaker/Services/Api/Department.php index 10f870b4d..a869364b3 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Department.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Department.php @@ -80,25 +80,21 @@ class Department extends Api } /** - * @param string $dep_uid {@min 1}{@max 32} - * @param string $usr_uid {@min 1}{@max 32} + * @url POST /:dep_uid/assign-user * - * @access public - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @param string $dep_uid {@min 32}{@max 32} + * @param array $request_data * - * @return array - * - * @url PUT /:dep_uid/assign-user/:usr_uid + * @status 201 */ - public function doPutAssignUser($dep_uid, $usr_uid) + public function doPostAssignUser($dep_uid, array $request_data) { try { - $oDepartment = new \ProcessMaker\BusinessModel\Department(); - $response = $oDepartment->assignUser($dep_uid, $usr_uid); - return $response; + $department = new \ProcessMaker\BusinessModel\Department(); + + $arrayData = $department->assignUser($dep_uid, $request_data); } catch (\Exception $e) { - throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } diff --git a/workflow/engine/templates/users/users.js b/workflow/engine/templates/users/users.js index e3efc75cf..4f56e47a6 100755 --- a/workflow/engine/templates/users/users.js +++ b/workflow/engine/templates/users/users.js @@ -400,226 +400,226 @@ Ext.onReady(function () { triggerAction : 'all', mode : 'local' }); - - var informationFields = new Ext.form.FieldSet({ - title : _('ID_PERSONAL_INFORMATION'), - items : [ - { - id : 'USR_FIRSTNAME', - fieldLabel : ' * ' + _('ID_FIRSTNAME'), - xtype : 'textfield', - width : 260, - allowBlank : false - }, - { - id : 'USR_LASTNAME', - fieldLabel : _('ID_LASTNAME'), - xtype : 'textfield', - width : 260, - allowBlank : false - }, - { - id : 'USR_USERNAME', - fieldLabel : ' * ' + _('ID_USER_ID'), - xtype : 'textfield', - width : 260, - allowBlank : false, - hidden : (typeof EDITPROFILE != "undefined" && EDITPROFILE == 1)? true : false, - listeners: { - blur : function(ob) - { - // trim - this.value = this.getValue().replace(/^\s+|\s+$/g,""); - document.getElementById('USR_USERNAME').value = this.getValue().replace(/^\s+|\s+$/g,""); - Ext.getCmp('saveB').disable(); - Ext.getCmp('cancelB').disable(); + var informationFields = new Ext.form.FieldSet({ + title : _('ID_PERSONAL_INFORMATION'), + items : [ + { + id : 'USR_FIRSTNAME', + fieldLabel : ' * ' + _('ID_FIRSTNAME'), + xtype : 'textfield', + width : 260, + allowBlank : false + }, + { + id : 'USR_LASTNAME', + fieldLabel : ' * ' + _('ID_LASTNAME'), + xtype : 'textfield', + width : 260, + allowBlank : false + }, + { + id : 'USR_USERNAME', + fieldLabel : ' * ' + _('ID_USER_ID'), + xtype : 'textfield', + width : 260, + allowBlank : false, + hidden : (typeof EDITPROFILE != "undefined" && EDITPROFILE == 1)? true : false, + listeners: { + blur : function(ob) + { + // trim + this.value = this.getValue().replace(/^\s+|\s+$/g,""); + document.getElementById('USR_USERNAME').value = this.getValue().replace(/^\s+|\s+$/g,""); - var spanAjax = ''; - var imageAjax = ''; - var labelAjax = _('ID_USERNAME_TESTING'); + Ext.getCmp('saveB').disable(); + Ext.getCmp('cancelB').disable(); - Ext.getCmp('usernameReview').setText(spanAjax + imageAjax + labelAjax + '', false); - Ext.getCmp('usernameReview').setVisible(true); + var spanAjax = ''; + var imageAjax = ''; + var labelAjax = _('ID_USERNAME_TESTING'); - usernameText = this.getValue(); + Ext.getCmp('usernameReview').setText(spanAjax + imageAjax + labelAjax + '', false); + Ext.getCmp('usernameReview').setVisible(true); - validateUserName(); + usernameText = this.getValue(); - Ext.getCmp('usernameReview').setVisible(true); + validateUserName(); + + Ext.getCmp('usernameReview').setVisible(true); + } } - } - }, - { - xtype: 'label', - fieldLabel: ' ', - id:'usernameReview', - width: 300, - labelSeparator: '' - }, - { - id : 'USR_EMAIL', - fieldLabel : ' * ' + _('ID_EMAIL'), - vtype : 'email', - xtype : 'textfield', - width : 260, - allowBlank : false - }, - { - xtype : 'textarea', - name : 'USR_ADDRESS', - fieldLabel : _('ID_ADDRESS'), - labelSeparator : '', - height : 50, - width : 260 - }, - { - id : 'USR_ZIP_CODE', - fieldLabel : _('ID_ZIP_CODE'), - xtype : 'textfield', - width : 260 - }, - comboCountry, - comboRegion, - comboLocation, - { - id : 'USR_PHONE', - fieldLabel : _('ID_PHONE'), - xtype : 'textfield', - width : 260 - }, - { - id : 'USR_POSITION', - fieldLabel : _('ID_POSITION'), - xtype : 'textfield', - width : 260 - }, - comboReplacedBy, - dateField, - comboCalendar, - comboStatus, - comboRole - ] - }); - - var passwordFields = new Ext.form.FieldSet({ - title : _('ID_CHANGE_PASSWORD'), - items : [ - { - xtype : "textfield", - id : "currentPassword", - name : "currentPassword", - fieldLabel : _("ID_PASSWORD_CURRENT"), - inputType : "password", - hidden : (typeof EDITPROFILE != "undefined" && EDITPROFILE == 1)? false : true, + }, + { + xtype: 'label', + fieldLabel: ' ', + id:'usernameReview', + width: 300, + labelSeparator: '' + }, + { + id : 'USR_EMAIL', + fieldLabel : ' * ' + _('ID_EMAIL'), + vtype : 'email', + xtype : 'textfield', + width : 260, + allowBlank : false + }, + { + xtype : 'textarea', + name : 'USR_ADDRESS', + fieldLabel : _('ID_ADDRESS'), + labelSeparator : '', + height : 50, + width : 260 + }, + { + id : 'USR_ZIP_CODE', + fieldLabel : _('ID_ZIP_CODE'), + xtype : 'textfield', width : 260 - }, - { - id : 'USR_NEW_PASS', - fieldLabel : _('ID_NEW_PASSWORD'), - xtype : 'textfield', - inputType : 'password', - width : 260, - allowBlank : allowBlackStatus, - listeners: { - blur : function(ob) - { - Ext.getCmp('saveB').disable(); - Ext.getCmp('cancelB').disable(); - var spanAjax = ''; - var imageAjax = ''; - var labelAjax = _('ID_PASSWORD_TESTING'); + }, + comboCountry, + comboRegion, + comboLocation, + { + id : 'USR_PHONE', + fieldLabel : _('ID_PHONE'), + xtype : 'textfield', + width : 260 + }, + { + id : 'USR_POSITION', + fieldLabel : _('ID_POSITION'), + xtype : 'textfield', + width : 260 + }, + comboReplacedBy, + dateField, + comboCalendar, + comboStatus, + comboRole + ] + }); - Ext.getCmp('passwordReview').setText(spanAjax + imageAjax + labelAjax + '', false); - Ext.getCmp('passwordReview').setVisible(true); + var passwordFields = new Ext.form.FieldSet({ + title : _('ID_CHANGE_PASSWORD'), + items : [ + { + xtype : "textfield", + id : "currentPassword", + name : "currentPassword", + fieldLabel : _("ID_PASSWORD_CURRENT"), + inputType : "password", + hidden : (typeof EDITPROFILE != "undefined" && EDITPROFILE == 1)? false : true, + width : 260 + }, + { + id : 'USR_NEW_PASS', + fieldLabel : MODE == 'edit' ? _('ID_NEW_PASSWORD') : ' * ' + _('ID_NEW_PASSWORD'), + xtype : 'textfield', + inputType : 'password', + width : 260, + allowBlank : allowBlackStatus, + listeners: { + blur : function(ob) + { + Ext.getCmp('saveB').disable(); + Ext.getCmp('cancelB').disable(); + var spanAjax = ''; + var imageAjax = ''; + var labelAjax = _('ID_PASSWORD_TESTING'); - var passwordText = this.getValue(); + Ext.getCmp('passwordReview').setText(spanAjax + imageAjax + labelAjax + '', false); + Ext.getCmp('passwordReview').setVisible(true); - Ext.Ajax.request({ - url : 'usersAjax', - method:'POST', - params : { - 'action' : 'testPassword', - 'PASSWORD_TEXT' : passwordText - }, - success: function(r,o){ - var resp = Ext.util.JSON.decode(r.responseText); + var passwordText = this.getValue(); - if (resp.STATUS) { - flagPoliciesPassword = true; - } else { - flagPoliciesPassword = false; + Ext.Ajax.request({ + url : 'usersAjax', + method:'POST', + params : { + 'action' : 'testPassword', + 'PASSWORD_TEXT' : passwordText + }, + success: function(r,o){ + var resp = Ext.util.JSON.decode(r.responseText); + + if (resp.STATUS) { + flagPoliciesPassword = true; + } else { + flagPoliciesPassword = false; + } + + Ext.getCmp('passwordReview').setText(resp.DESCRIPTION, false); + Ext.getCmp('saveB').enable(); + Ext.getCmp('cancelB').enable(); + }, + failure: function () { + Ext.MessageBox.show({ + title: _('ID_ERROR'), + msg: _('ID_FAILED_STORE_DATA'), + buttons: Ext.MessageBox.OK, + animEl: 'mb9', + icon: Ext.MessageBox.ERROR + }); + Ext.getCmp('saveB').enable(); + Ext.getCmp('cancelB').enable(); } + }); - Ext.getCmp('passwordReview').setText(resp.DESCRIPTION, false); - Ext.getCmp('saveB').enable(); - Ext.getCmp('cancelB').enable(); - }, - failure: function () { - Ext.MessageBox.show({ - title: _('ID_ERROR'), - msg: _('ID_FAILED_STORE_DATA'), - buttons: Ext.MessageBox.OK, - animEl: 'mb9', - icon: Ext.MessageBox.ERROR - }); - Ext.getCmp('saveB').enable(); - Ext.getCmp('cancelB').enable(); + Ext.getCmp('passwordReview').setVisible(true); + + if (Ext.getCmp('USR_CNF_PASS').getValue() != '') { + userExecuteEvent(document.getElementById('USR_CNF_PASS'), 'blur'); } - }); - Ext.getCmp('passwordReview').setVisible(true); - - if (Ext.getCmp('USR_CNF_PASS').getValue() != '') { - userExecuteEvent(document.getElementById('USR_CNF_PASS'), 'blur'); - } - - } - } - }, - { - xtype: 'label', - fieldLabel: ' ', - id:'passwordReview', - width: 300, - labelSeparator: '' - }, - { - id : 'USR_CNF_PASS', - fieldLabel : _('ID_CONFIRM_PASSWORD'), - xtype : 'textfield', - inputType : 'password', - width : 260, - allowBlank : allowBlackStatus, - listeners: { - blur : function(ob) - { - var passwordText = Ext.getCmp('USR_NEW_PASS').getValue(); - var passwordConfirm = this.getValue(); - - if (passwordText != passwordConfirm) { - var spanErrorConfirm = ''; - var imageErrorConfirm = ''; - var labelErrorConfirm = _('ID_NEW_PASS_SAME_OLD_PASS'); - - Ext.getCmp('passwordConfirm').setText(spanErrorConfirm + imageErrorConfirm + labelErrorConfirm + '', false); - Ext.getCmp('passwordConfirm').setVisible(true); - } else { - Ext.getCmp('passwordConfirm').setVisible(false); } } - } - }, - { - xtype: 'label', - fieldLabel: ' ', - id:'passwordConfirm', - width: 300, - labelSeparator: '' - } + }, + { + xtype: 'label', + fieldLabel: ' ', + id:'passwordReview', + width: 300, + labelSeparator: '' + }, + { + id : 'USR_CNF_PASS', + fieldLabel : MODE == 'edit' ? _('ID_CONFIRM_PASSWORD') : ' * ' + _('ID_CONFIRM_PASSWORD'), + xtype : 'textfield', + inputType : 'password', + width : 260, + allowBlank : allowBlackStatus, + listeners: { + blur : function(ob) + { + var passwordText = Ext.getCmp('USR_NEW_PASS').getValue(); + var passwordConfirm = this.getValue(); - ] - }); + if (passwordText != passwordConfirm) { + var spanErrorConfirm = ''; + var imageErrorConfirm = ''; + var labelErrorConfirm = _('ID_NEW_PASS_SAME_OLD_PASS'); + + Ext.getCmp('passwordConfirm').setText(spanErrorConfirm + imageErrorConfirm + labelErrorConfirm + '', false); + Ext.getCmp('passwordConfirm').setVisible(true); + } else { + Ext.getCmp('passwordConfirm').setVisible(false); + } + } + } + }, + { + xtype: 'label', + fieldLabel: ' ', + id:'passwordConfirm', + width: 300, + labelSeparator: '' + } + + ] + }); var accountOptions = new Ext.form.FieldSet({ title: _('ID_ACCOUNT_OPTIONS'), diff --git a/workflow/engine/xmlform/cases/cases_Scheduler_Options.xml b/workflow/engine/xmlform/cases/cases_Scheduler_Options.xml index f6d106c00..9ec9bd11c 100755 --- a/workflow/engine/xmlform/cases/cases_Scheduler_Options.xml +++ b/workflow/engine/xmlform/cases/cases_Scheduler_Options.xml @@ -10,16 +10,15 @@ - - +