From 92688ac732ab2dbad545edbec5ed5b2f6d316e21 Mon Sep 17 00:00:00 2001 From: dheeyi Date: Mon, 9 Mar 2015 17:18:25 -0400 Subject: [PATCH 1/9] PM-1740 Admin>User>New: El field Last Name es "required" sin embargo no tiene asterisco rojo Causa: Definicion previa. Solucion: Hacer que estes campos tambien tenga esa caracteristica. --- workflow/engine/templates/users/users.js | 640 +++++++++++++++-------- 1 file changed, 431 insertions(+), 209 deletions(-) diff --git a/workflow/engine/templates/users/users.js b/workflow/engine/templates/users/users.js index e3efc75cf..fbe416470 100755 --- a/workflow/engine/templates/users/users.js +++ b/workflow/engine/templates/users/users.js @@ -401,225 +401,447 @@ Ext.onReady(function () { 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 spanAjax = ''; - var imageAjax = ''; - var labelAjax = _('ID_USERNAME_TESTING'); - - Ext.getCmp('usernameReview').setText(spanAjax + imageAjax + labelAjax + '', false); - Ext.getCmp('usernameReview').setVisible(true); - - usernameText = this.getValue(); - - 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, - 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'); - - Ext.getCmp('passwordReview').setText(spanAjax + imageAjax + labelAjax + '', false); - Ext.getCmp('passwordReview').setVisible(true); - - var passwordText = this.getValue(); - - Ext.Ajax.request({ - url : 'usersAjax', - method:'POST', - params : { - 'action' : 'testPassword', - 'PASSWORD_TEXT' : passwordText + if (MODE == "edit") { + var informationFields = new Ext.form.FieldSet({ + title : _('ID_PERSONAL_INFORMATION'), + items : [ + { + id : 'USR_FIRSTNAME', + fieldLabel : _('ID_FIRSTNAME'), + xtype : 'textfield', + width : 260, + allowBlank : false }, - success: function(r,o){ - var resp = Ext.util.JSON.decode(r.responseText); + { + 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,""); - if (resp.STATUS) { - flagPoliciesPassword = true; - } else { - flagPoliciesPassword = false; + Ext.getCmp('saveB').disable(); + Ext.getCmp('cancelB').disable(); + + var spanAjax = ''; + var imageAjax = ''; + var labelAjax = _('ID_USERNAME_TESTING'); + + Ext.getCmp('usernameReview').setText(spanAjax + imageAjax + labelAjax + '', false); + Ext.getCmp('usernameReview').setVisible(true); + + usernameText = this.getValue(); + + validateUserName(); + + Ext.getCmp('usernameReview').setVisible(true); + } } - - 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(); + { + 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, + 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'); + + Ext.getCmp('passwordReview').setText(spanAjax + imageAjax + labelAjax + '', false); + Ext.getCmp('passwordReview').setVisible(true); + + var passwordText = this.getValue(); + + 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').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: '' } - }); - Ext.getCmp('passwordReview').setVisible(true); + ] + }); + }else{ + 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,""); - if (Ext.getCmp('USR_CNF_PASS').getValue() != '') { - userExecuteEvent(document.getElementById('USR_CNF_PASS'), 'blur'); + Ext.getCmp('saveB').disable(); + Ext.getCmp('cancelB').disable(); + + var spanAjax = ''; + var imageAjax = ''; + var labelAjax = _('ID_USERNAME_TESTING'); + + Ext.getCmp('usernameReview').setText(spanAjax + imageAjax + labelAjax + '', false); + Ext.getCmp('usernameReview').setVisible(true); + + usernameText = this.getValue(); + + 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, + 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'); + + Ext.getCmp('passwordReview').setText(spanAjax + imageAjax + labelAjax + '', false); + Ext.getCmp('passwordReview').setVisible(true); + + var passwordText = this.getValue(); + + 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').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 : _('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'), From adac6d724f2b51101a36033a949982ad0c22dfa4 Mon Sep 17 00:00:00 2001 From: dheeyi Date: Tue, 10 Mar 2015 09:40:29 -0400 Subject: [PATCH 2/9] PM-1740 Admin>User>New: El field Last Name es "required" sin embargo no tiene asterisco rojo Causa: Definicion previa. Solucion: Hacer que estes campos tambien tenga esa caracteristica. Nota.- Son requeridos solo en caso de creacion de un nuevo usuario en caso de edicion ya no se muestran como requeridos. --- workflow/engine/templates/users/users.js | 642 ++++++++--------------- 1 file changed, 210 insertions(+), 432 deletions(-) diff --git a/workflow/engine/templates/users/users.js b/workflow/engine/templates/users/users.js index fbe416470..b201f758b 100755 --- a/workflow/engine/templates/users/users.js +++ b/workflow/engine/templates/users/users.js @@ -401,447 +401,225 @@ Ext.onReady(function () { mode : 'local' }); - if (MODE == "edit") { - 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 spanAjax = ''; - var imageAjax = ''; - var labelAjax = _('ID_USERNAME_TESTING'); - - Ext.getCmp('usernameReview').setText(spanAjax + imageAjax + labelAjax + '', false); - Ext.getCmp('usernameReview').setVisible(true); - - usernameText = this.getValue(); - - 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, - 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'); - - Ext.getCmp('passwordReview').setText(spanAjax + imageAjax + labelAjax + '', false); - Ext.getCmp('passwordReview').setVisible(true); - - var passwordText = this.getValue(); - - 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').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: '' - } - - ] - }); - }else{ - var informationFields = new Ext.form.FieldSet({ - title : _('ID_PERSONAL_INFORMATION'), - items : [ + var informationFields = new Ext.form.FieldSet({ + title : _('ID_PERSONAL_INFORMATION'), + items : [ + { + id : 'USR_FIRSTNAME', + fieldLabel : MODE == 'edit' ? _('ID_FIRSTNAME') : ' * ' + _('ID_FIRSTNAME'), + xtype : 'textfield', + width : 260, + allowBlank : false + }, + { + id : 'USR_LASTNAME', + fieldLabel : MODE == 'edit' ? _('ID_LASTNAME') : ' * ' + _('ID_LASTNAME'), + xtype : 'textfield', + width : 260, + allowBlank : false + }, + { + id : 'USR_USERNAME', + fieldLabel : MODE == 'edit' ? _('ID_USER_ID') : ' * ' + _('ID_USER_ID'), + xtype : 'textfield', + width : 260, + allowBlank : false, + hidden : (typeof EDITPROFILE != "undefined" && EDITPROFILE == 1)? true : false, + listeners: { + blur : function(ob) { - 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,""); + // 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(); + Ext.getCmp('saveB').disable(); + Ext.getCmp('cancelB').disable(); - var spanAjax = ''; - var imageAjax = ''; - var labelAjax = _('ID_USERNAME_TESTING'); + var spanAjax = ''; + var imageAjax = ''; + var labelAjax = _('ID_USERNAME_TESTING'); - Ext.getCmp('usernameReview').setText(spanAjax + imageAjax + labelAjax + '', false); - Ext.getCmp('usernameReview').setVisible(true); + Ext.getCmp('usernameReview').setText(spanAjax + imageAjax + labelAjax + '', false); + Ext.getCmp('usernameReview').setVisible(true); - usernameText = this.getValue(); + usernameText = this.getValue(); - validateUserName(); + 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, - 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'); - - Ext.getCmp('passwordReview').setText(spanAjax + imageAjax + labelAjax + '', false); - Ext.getCmp('passwordReview').setVisible(true); - - var passwordText = this.getValue(); - - 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').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: '' + Ext.getCmp('usernameReview').setVisible(true); } + } + }, + { + xtype: 'label', + fieldLabel: ' ', + id:'usernameReview', + width: 300, + labelSeparator: '' + }, + { + id : 'USR_EMAIL', + fieldLabel : MODE == 'edit' ? _('ID_EMAIL') : ' * ' + _('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, + 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'); + + Ext.getCmp('passwordReview').setText(spanAjax + imageAjax + labelAjax + '', false); + Ext.getCmp('passwordReview').setVisible(true); + + var passwordText = this.getValue(); + + 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').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 : 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'), From 84b0007076e5e55b00229f1979bac9aeb968be4c Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Tue, 10 Mar 2015 11:04:10 -0400 Subject: [PATCH 3/9] PM-1762 "HTTP status code will be set to 200 no coincide..." SOLVED Issue: - PM-1762: HTTP status code will be set to 200 no coincide con el real que indica 201 - PM-1759: Create Department: POST /department /api/1.0/{workspace}/department Cause: - PM-1762: Definicion incorrecta del siguiente End-point: PUT department/{dep_uid}/assign-user/{usr_uid} - PM-1759: No se valida de manera correcta el titulo de un departamento Solution: - PM-1762: Se a cambiado la definicion del End-point al siguiente: POST /api/1.0/{workspace}/department/{dep_uid}/assign-user >>>>> { "usr_uid": "41825464054f5b9b0e2dc48048580849" } <<<<< (201) Este cambio debera ser replicado en la wiki Los "status code" retornados por los End-point son los siguientes: GET ----> 200 POST ----> 201 PUT ----> 200 DELETE ----> 200 Esto debe ser reflejado en la wiki, caso contrario es un bug de documentacion - PM-1759: Se ha agregado los metodos necesarios para validar el titulo de un Departamento --- .../ProcessMaker/BusinessModel/Department.php | 141 +++++++++++++++--- .../ProcessMaker/BusinessModel/Validator.php | 41 ----- .../ProcessMaker/Services/Api/Department.php | 22 ++- 3 files changed, 132 insertions(+), 72 deletions(-) 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/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()); } } From 54e01ad68ef39cf20fb0d397723bae9238bdb2da Mon Sep 17 00:00:00 2001 From: dheeyi Date: Tue, 10 Mar 2015 11:41:06 -0400 Subject: [PATCH 4/9] PM-1740 Admin>User>New: El field Last Name es "required" sin embargo no tiene asterisco rojo Causa: Definicion previa. Solucion: Hacer que estes campos tambien tenga esa caracteristica. Nota.- Son requeridos solo en caso de creacion de un nuevo usuario en caso de edicion ya no se muestran como requeridos. --- workflow/engine/templates/users/users.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow/engine/templates/users/users.js b/workflow/engine/templates/users/users.js index b201f758b..fbbc00315 100755 --- a/workflow/engine/templates/users/users.js +++ b/workflow/engine/templates/users/users.js @@ -400,7 +400,7 @@ Ext.onReady(function () { triggerAction : 'all', mode : 'local' }); - + var informationFields = new Ext.form.FieldSet({ title : _('ID_PERSONAL_INFORMATION'), items : [ @@ -413,7 +413,7 @@ Ext.onReady(function () { }, { id : 'USR_LASTNAME', - fieldLabel : MODE == 'edit' ? _('ID_LASTNAME') : ' * ' + _('ID_LASTNAME'), + fieldLabel : ' * ' + _('ID_LASTNAME'), xtype : 'textfield', width : 260, allowBlank : false From 4240d8aff27d5d1df67f870ea96cf86b837bcafd Mon Sep 17 00:00:00 2001 From: dheeyi Date: Tue, 10 Mar 2015 12:00:50 -0400 Subject: [PATCH 5/9] PM-1740 Admin>User>New: El field Last Name es "required" sin embargo no tiene asterisco rojo Causa: Definicion previa. Solucion: Hacer que estes campos tambien tenga esa caracteristica. Nota.- Son requeridos solo en caso de creacion de un nuevo usuario en caso de edicion ya no se muestran como requeridos. --- workflow/engine/templates/users/users.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/workflow/engine/templates/users/users.js b/workflow/engine/templates/users/users.js index fbbc00315..4f56e47a6 100755 --- a/workflow/engine/templates/users/users.js +++ b/workflow/engine/templates/users/users.js @@ -406,7 +406,7 @@ Ext.onReady(function () { items : [ { id : 'USR_FIRSTNAME', - fieldLabel : MODE == 'edit' ? _('ID_FIRSTNAME') : ' * ' + _('ID_FIRSTNAME'), + fieldLabel : ' * ' + _('ID_FIRSTNAME'), xtype : 'textfield', width : 260, allowBlank : false @@ -420,7 +420,7 @@ Ext.onReady(function () { }, { id : 'USR_USERNAME', - fieldLabel : MODE == 'edit' ? _('ID_USER_ID') : ' * ' + _('ID_USER_ID'), + fieldLabel : ' * ' + _('ID_USER_ID'), xtype : 'textfield', width : 260, allowBlank : false, @@ -459,7 +459,7 @@ Ext.onReady(function () { }, { id : 'USR_EMAIL', - fieldLabel : MODE == 'edit' ? _('ID_EMAIL') : ' * ' + _('ID_EMAIL'), + fieldLabel : ' * ' + _('ID_EMAIL'), vtype : 'email', xtype : 'textfield', width : 260, From 148a68f9b8a9526bee7b6de54fac56d4dd30d9d8 Mon Sep 17 00:00:00 2001 From: dheeyi Date: Tue, 10 Mar 2015 12:53:40 -0400 Subject: [PATCH 6/9] PM-1705 El boton "Search"del listado de CaseScheduler no esta estandarizado con las listas de Dynaform, InputDocuments, OutputDocuments,Triggers y DataBaseConnections. causa : Definicion previa de esa manera. solucion : Llevar al formato que tienen los demas componentes. --- workflow/engine/xmlform/cases/cases_Scheduler_Options.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/workflow/engine/xmlform/cases/cases_Scheduler_Options.xml b/workflow/engine/xmlform/cases/cases_Scheduler_Options.xml index f6d106c00..204d7af83 100755 --- a/workflow/engine/xmlform/cases/cases_Scheduler_Options.xml +++ b/workflow/engine/xmlform/cases/cases_Scheduler_Options.xml @@ -10,8 +10,7 @@ - - + Date: Tue, 10 Mar 2015 13:00:10 -0400 Subject: [PATCH 7/9] PM-1705 El boton "Search"del listado de CaseScheduler no esta estandarizado con las listas de Dynaform, InputDocuments, OutputDocuments,Triggers y DataBaseConnections. causa : Definicion previa de esa manera. solucion : Llevar al formato que tienen los demas componentes. --- .../engine/xmlform/cases/cases_Scheduler_Options.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/workflow/engine/xmlform/cases/cases_Scheduler_Options.xml b/workflow/engine/xmlform/cases/cases_Scheduler_Options.xml index 204d7af83..9ec9bd11c 100755 --- a/workflow/engine/xmlform/cases/cases_Scheduler_Options.xml +++ b/workflow/engine/xmlform/cases/cases_Scheduler_Options.xml @@ -17,8 +17,8 @@ function $_GET(q,s) { var re = new RegExp('&'+q+'=([^&]*)','i'); return (s=s.replace(/^\?/,'&').match(re)) ? s=s[1] : s=''; } -function newScheduler() { - window.location = 'cases_Scheduler_New?PRO_UID='+$_GET('PRO_UID'); return false; +function newScheduler() { + window.location = 'cases_Scheduler_New?PRO_UID='+$_GET('PRO_UID'); return false; } function casesSchedulerDelete(schUID,proUid) { @@ -29,9 +29,9 @@ function casesSchedulerDelete(schUID,proUid) { } function editCaseScheduler(SCH_UID,PRO_UID) -{ - window.location = 'cases_Scheduler_Edit?SCH_UID='+SCH_UID+'&PRO_UID='+PRO_UID; - return false; +{ + window.location = 'cases_Scheduler_Edit?SCH_UID='+SCH_UID+'&PRO_UID='+PRO_UID; + return false; } ]]> From f183051a9e8d9b964b8ba98d8ea1344920b3452e Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Tue, 10 Mar 2015 14:39:03 -0400 Subject: [PATCH 8/9] PM-1771 "Designer: Al momento de crear un proceso clasico..." SOLVED Issue: Designer: Al momento de crear un proceso clasico, la columna Update Time muestra la fecha de creacion del proceso Cause: Se hace un update de campo PROCESS.PRO_UPDATE_DATE en el "load" del proceso Solution: Se ha validado para evitar actualizar este campo en el "load" del proceso --- .../methods/processes/processes_Ajax.php | 48 +++++++++++-------- 1 file changed, 27 insertions(+), 21 deletions(-) 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); From 87847c86c161733bce96caa53498e17451370ea2 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Tue, 10 Mar 2015 15:29:06 -0400 Subject: [PATCH 9/9] PM-1733 "0016808: Change error message if the usr_replaced_by..." SOLVED Issue: 0016808: Change error message if the usr_replaced_by is not a valid user in the POST /api/1.0/{workspace}/user endpoint Cause: Label incorrecto Solution: Se a cambiado el ID del label "ID_AUTHENTICATION_SOURCE_INVALID" por "ID_USER_DOES_NOT_EXIST" --- workflow/engine/src/ProcessMaker/BusinessModel/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"]))); } } }