From 9dccd5761734cf69847b70179253e36095a3fe60 Mon Sep 17 00:00:00 2001 From: hieplq Date: Sun, 4 Sep 2016 10:51:01 +0700 Subject: [PATCH 1/6] IDEMPIERE-3179:record should move to editing mode when user is editing first field --- .../webui/adwindow/ADWindowContent.java | 5 ++++ .../adwindow/AbstractADWindowContent.java | 11 ++++++--- org.adempiere.ui.zk/index.zul | 24 +++++++++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowContent.java index f4376f8a63..e0890144c4 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowContent.java @@ -240,5 +240,10 @@ public class ADWindowContent extends AbstractADWindowContent SessionManager.getSessionApplication().getKeylistener().removeEventListener(Events.ON_CTRL_KEY, content); } catch (Exception e){} } + } + + @Override + protected void switchEditStatus(boolean editStatus) { + layout.setWidgetOverride("isEditting", "'" + String.valueOf(editStatus) + "'"); } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java index 953ec46f7b..7f4ba69ee0 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java @@ -267,6 +267,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements */ protected abstract IADTabbox createADTab(); + protected abstract void switchEditStatus(boolean editStatus); + private void focusToActivePanel() { IADTabpanel adTabPanel = adTabbox.getSelectedTabpanel(); focusToTabpanel(adTabPanel); @@ -1556,10 +1558,13 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements { adTabbox.updateDetailPaneToolbar(changed, readOnly); } - toolbar.enableIgnore(adTabbox.needSave(true, false) || + boolean isEditting = adTabbox.needSave(true, false) || adTabbox.getSelectedGridTab().isNew() || - (adTabbox.getSelectedDetailADTabpanel() != null && adTabbox.getSelectedDetailADTabpanel().getGridTab().isNew())); - + (adTabbox.getSelectedDetailADTabpanel() != null && adTabbox.getSelectedDetailADTabpanel().getGridTab().isNew()); + toolbar.enableIgnore(isEditting); + + switchEditStatus (isEditting); + if (changed && !readOnly && !toolbar.isSaveEnable() ) { if (tabPanel.getGridTab().getRecord_ID() > 0) { if (adTabbox.getSelectedIndex() == 0 && !detailTab) { diff --git a/org.adempiere.ui.zk/index.zul b/org.adempiere.ui.zk/index.zul index 53c679cf98..b58a14d7fd 100644 --- a/org.adempiere.ui.zk/index.zul +++ b/org.adempiere.ui.zk/index.zul @@ -40,6 +40,30 @@ Copyright (C) 2007 Ashley G Ramdass. } }); + zk.afterLoad('zul.wgt', function () { + // should filter out for only component inside standard window or component wish fire this event, + // or ever rise other event like start editting to distinguish with true onChange event + zk.override(zul.inp.InputWidget.prototype, "doInput_", function (evt) { + this.$doInput_(evt); + var domElemOfLayout = jq('#' + this.$n().id).closest(".adwindow-layout"); + if (domElemOfLayout == null){ + ;// do nothing + }else{ + var winLayoutWg = zk.Widget.$(domElemOfLayout); + if (winLayoutWg == null){ + ;// do nothing + }else{ + var isEditting = winLayoutWg.get ("isEditting"); + // winLayoutWg should cache to improve perfomance + if (isEditting == "false"){ + zAu.send(new zk.Event(zk.Widget.$(this), 'onChange',{"value":this.$n().value}));//fire change event to move to edit + } + } + } + }); + + }); + zk.afterLoad('zul.mesh', function () { zk.override(zul.mesh.Paging.prototype, "bind_", function () { From 89ba2d67e3feb8e652f52e7eab5fc347837e25ae Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 4 Sep 2016 12:08:10 +0200 Subject: [PATCH 2/6] IDEMPIERE-1672 create a user with name same exist user, make exist user can't log-in --- .../src/org/compiere/model/MUser.java | 42 ++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MUser.java b/org.adempiere.base/src/org/compiere/model/MUser.java index fa6a3b5f47..c376f53633 100644 --- a/org.adempiere.base/src/org/compiere/model/MUser.java +++ b/org.adempiere.base/src/org/compiere/model/MUser.java @@ -887,20 +887,34 @@ public class MUser extends X_AD_User if (newRecord || super.getValue() == null || is_ValueChanged("Value")) setValue(super.getValue()); - boolean email_login = MSysConfig.getBooleanValue(MSysConfig.USE_EMAIL_FOR_LOGIN, false); - if (email_login && getPassword() != null && getPassword().length() > 0) { - // email is mandatory for users with password - if (getEMail() == null || getEMail().length() == 0) { - log.saveError("SaveError", Msg.getMsg(getCtx(), "FillMandatory") + Msg.getElement(getCtx(), COLUMNNAME_EMail) + " - " + toString()); - return false; - } - // email with password must be unique on the same tenant - int cnt = DB.getSQLValue(get_TrxName(), - "SELECT COUNT(*) FROM AD_User WHERE Password IS NOT NULL AND EMail=? AND AD_Client_ID=? AND AD_User_ID!=?", - getEMail(), getAD_Client_ID(), getAD_User_ID()); - if (cnt > 0) { - log.saveError("SaveError", Msg.getMsg(getCtx(), DBException.SAVE_ERROR_NOT_UNIQUE_MSG, true) + Msg.getElement(getCtx(), COLUMNNAME_EMail)); - return false; + if (getPassword() != null && getPassword().length() > 0) { + boolean email_login = MSysConfig.getBooleanValue(MSysConfig.USE_EMAIL_FOR_LOGIN, false); + if (email_login) { + // email is mandatory for users with password + if (getEMail() == null || getEMail().length() == 0) { + log.saveError("SaveError", Msg.getMsg(getCtx(), "FillMandatory") + Msg.getElement(getCtx(), COLUMNNAME_EMail) + " - " + toString()); + return false; + } + // email with password must be unique on the same tenant + int cnt = DB.getSQLValue(get_TrxName(), + "SELECT COUNT(*) FROM AD_User WHERE Password IS NOT NULL AND EMail=? AND AD_Client_ID=? AND AD_User_ID!=?", + getEMail(), getAD_Client_ID(), getAD_User_ID()); + if (cnt > 0) { + log.saveError("SaveError", Msg.getMsg(getCtx(), DBException.SAVE_ERROR_NOT_UNIQUE_MSG, true) + Msg.getElement(getCtx(), COLUMNNAME_EMail)); + return false; + } + } else { + // IDEMPIERE-1672 check duplicate name in client + String nameToValidate = getLDAPUser(); + if (Util.isEmpty(nameToValidate)) + nameToValidate = getName(); + int cnt = DB.getSQLValue(get_TrxName(), + "SELECT COUNT(*) FROM AD_User WHERE Password IS NOT NULL AND COALESCE(LDAPUser,Name)=? AND AD_Client_ID=? AND AD_User_ID!=?", + nameToValidate, getAD_Client_ID(), getAD_User_ID()); + if (cnt > 0) { + log.saveError("SaveError", Msg.getMsg(getCtx(), DBException.SAVE_ERROR_NOT_UNIQUE_MSG, true) + Msg.getElement(getCtx(), COLUMNNAME_Name) + " / " + Msg.getElement(getCtx(), COLUMNNAME_LDAPUser)); + return false; + } } } From 084f20bc24e50c420bb97ccc44f11677a058f637 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 6 Sep 2016 12:41:20 +0200 Subject: [PATCH 3/6] IDEMPIERE-3185 NPE on WPreference --- .../WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java | 4 ++-- .../src/org/adempiere/webui/window/WPreference.java | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java index ab54af0d06..439b125ba0 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java @@ -63,7 +63,7 @@ public class WQuickEntry extends Window implements EventListener, ValueCh /** * */ - private static final long serialVersionUID = 6033101081045706748L; + private static final long serialVersionUID = -8530102231615195037L; public static final String QUICK_ENTRY_MODE = "_QUICK_ENTRY_MODE_"; @@ -85,7 +85,7 @@ public class WQuickEntry extends Window implements EventListener, ValueCh private ConfirmPanel confirmPanel = new ConfirmPanel(true, false, false, false, false, false); - private int m_AD_Window_ID; + protected int m_AD_Window_ID; private boolean isHasField = false; /** diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPreference.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPreference.java index bea84e9b6f..201ca09980 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPreference.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPreference.java @@ -22,6 +22,7 @@ import org.adempiere.webui.component.Window; import org.adempiere.webui.editor.WYesNoEditor; import org.adempiere.webui.grid.WQuickEntry; import org.adempiere.webui.theme.ThemeManager; +import org.compiere.model.MRole; import org.compiere.model.MUserPreference; import org.compiere.util.CLogger; import org.compiere.util.Env; @@ -65,8 +66,11 @@ public class WPreference extends WQuickEntry implements EventListener { log.log(Level.SEVERE, ex.getMessage()); } - initPOs(); - loadPreferences(); + Boolean canAccessPreference = MRole.getDefault().getWindowAccess(m_AD_Window_ID); + if (canAccessPreference != null && canAccessPreference) { + initPOs(); + loadPreferences(); + } this.setTitle(""); } //WPreference From d015abe5c1cd80928b18a731ee375eaf134e7e3c Mon Sep 17 00:00:00 2001 From: hieplq Date: Sun, 4 Sep 2016 22:11:21 +0700 Subject: [PATCH 4/6] IDEMPIERE-3182:auto fill password don't work util you touch password field --- .../WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java index f92dbecaeb..dae2559759 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java @@ -174,6 +174,8 @@ public class LoginPanel extends Window implements EventListener } } onUserIdChange(AD_User_ID); + if (txtUserId.getValue().length() > 0) + txtPassword.focus(); chkRememberMe.setChecked(true); } if (MSystem.isZKRememberPasswordAllowed()) { From db1d42ab2d63bec91d50f30f7c0f0b202bd5819b Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 6 Sep 2016 14:58:33 +0200 Subject: [PATCH 5/6] IDEMPIERE-2668 Exclude Locators for Demand Operations / different approach to make reservation locator mandatory - previous approach didn't allow to add new warehouses --- .../i3.1/oracle/201609061457_IDEMPIERE-2668.sql | 15 +++++++++++++++ .../postgresql/201609061457_IDEMPIERE-2668.sql | 12 ++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 migration/i3.1/oracle/201609061457_IDEMPIERE-2668.sql create mode 100644 migration/i3.1/postgresql/201609061457_IDEMPIERE-2668.sql diff --git a/migration/i3.1/oracle/201609061457_IDEMPIERE-2668.sql b/migration/i3.1/oracle/201609061457_IDEMPIERE-2668.sql new file mode 100644 index 0000000000..d751558e9f --- /dev/null +++ b/migration/i3.1/oracle/201609061457_IDEMPIERE-2668.sql @@ -0,0 +1,15 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-2668 Exclude Locators for Demand Operations +-- Sep 6, 2016 1:55:35 PM GMT+01:00 +UPDATE AD_Field SET IsMandatory=NULL, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2016-09-06 13:55:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200649 +; + +-- Sep 6, 2016 1:55:56 PM GMT+01:00 +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, MandatoryLogic='@M_Warehouse_ID@>0', IsToolbarButton=NULL,Updated=TO_DATE('2016-09-06 13:55:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200649 +; + +SELECT register_migration_script('201609061457_IDEMPIERE-2668.sql') FROM dual +; + diff --git a/migration/i3.1/postgresql/201609061457_IDEMPIERE-2668.sql b/migration/i3.1/postgresql/201609061457_IDEMPIERE-2668.sql new file mode 100644 index 0000000000..a461a7d9a9 --- /dev/null +++ b/migration/i3.1/postgresql/201609061457_IDEMPIERE-2668.sql @@ -0,0 +1,12 @@ +-- IDEMPIERE-2668 Exclude Locators for Demand Operations +-- Sep 6, 2016 1:55:35 PM GMT+01:00 +UPDATE AD_Field SET IsMandatory=NULL, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2016-09-06 13:55:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200649 +; + +-- Sep 6, 2016 1:55:56 PM GMT+01:00 +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, MandatoryLogic='@M_Warehouse_ID@>0', IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2016-09-06 13:55:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200649 +; + +SELECT register_migration_script('201609061457_IDEMPIERE-2668.sql') FROM dual +; + From bee8bc4d67113c20043bdfadaa168c91b37060a3 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 7 Sep 2016 19:17:14 +0200 Subject: [PATCH 6/6] IDEMPIERE-3188 2Pack locked validating info window --- org.adempiere.base/src/org/compiere/model/MInfoWindow.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInfoWindow.java b/org.adempiere.base/src/org/compiere/model/MInfoWindow.java index 5ef35477cd..f3436c14f4 100644 --- a/org.adempiere.base/src/org/compiere/model/MInfoWindow.java +++ b/org.adempiere.base/src/org/compiere/model/MInfoWindow.java @@ -442,7 +442,7 @@ public class MInfoWindow extends X_AD_InfoWindow // try run sql PreparedStatement pstmt = null; try { - pstmt = DB.prepareStatement(builder.toString(), null); + pstmt = DB.prepareStatement(builder.toString(), get_TrxName()); pstmt.executeQuery(); }catch (Exception ex){ log.log(Level.WARNING, ex.getMessage());