hg merge release-3.1 (merge release3.1 into development)

This commit is contained in:
Carlos Ruiz 2016-09-07 19:20:42 +02:00
commit 2724e50bd3
10 changed files with 103 additions and 22 deletions

View File

@ -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
;

View File

@ -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
;

View File

@ -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());

View File

@ -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;
}
}
}

View File

@ -241,5 +241,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) + "'");
}
}

View File

@ -268,6 +268,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);
@ -1557,10 +1559,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) {

View File

@ -64,7 +64,7 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
/**
*
*/
private static final long serialVersionUID = 6033101081045706748L;
private static final long serialVersionUID = -8530102231615195037L;
public static final String QUICK_ENTRY_MODE = "_QUICK_ENTRY_MODE_";
@ -86,7 +86,7 @@ public class WQuickEntry extends Window implements EventListener<Event>, 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;
/**

View File

@ -175,6 +175,8 @@ public class LoginPanel extends Window implements EventListener<Event>
}
}
onUserIdChange(AD_User_ID);
if (txtUserId.getValue().length() > 0)
txtPassword.focus();
chkRememberMe.setChecked(true);
}
if (MSystem.isZKRememberPasswordAllowed()) {

View File

@ -23,6 +23,7 @@ import org.adempiere.webui.editor.WYesNoEditor;
import org.adempiere.webui.grid.WQuickEntry;
import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.ZKUpdateUtil;
import org.compiere.model.MRole;
import org.compiere.model.MUserPreference;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
@ -66,8 +67,11 @@ public class WPreference extends WQuickEntry implements EventListener<Event> {
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

View File

@ -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 () {