Merge with release-3.1

This commit is contained in:
hieplq 2015-12-13 15:07:43 +07:00
commit 40f1351fd0
13 changed files with 127 additions and 58 deletions

View File

@ -0,0 +1,10 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Ticket #1005382: Requests are showing up on the wrong person's calendar
-- Nov 27, 2015 4:26:07 PM SGT
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200074,0,0,TO_DATE('2015-11-27 16:26:05','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2015-11-27 16:26:05','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_DASHBOARD_CALENDAR_REQUEST_DISPLAY_MODE','CSU','C - Created by of the request is the logged in user; S - Sales Rep of the request is the logged in user; U - User/Contact of the request is the logged in user','D','C','f134d1ed-4101-4582-a3b3-0d2bf5c3577c')
;
SELECT register_migration_script('201511271630_IDEMPIERE-2973_1005382.sql') FROM dual
;

View File

@ -0,0 +1,15 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-2716 Bank Register Report - add Bank Account Parameter
-- Jul 7, 2015 10:28:19 AM CEST
INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200082,'C_BankAccount by Bank','S','C_BankAccount.C_Bank_ID=@C_Bank_ID@',0,0,'Y',TO_DATE('2015-07-07 10:28:18','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-07-07 10:28:18','YYYY-MM-DD HH24:MI:SS'),100,'C','923bb7a8-b071-4f8a-85de-794e06e43490')
;
-- Jul 7, 2015 10:28:27 AM CEST
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200139,0,0,'Y',TO_DATE('2015-07-07 10:28:26','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-07-07 10:28:26','YYYY-MM-DD HH24:MI:SS'),100,'Bank Account','Account at the Bank','The Bank Account identifies an account at this Bank.',200035,15,19,'N',200082,10,'N','C_BankAccount_ID','Y','D',836,'c852e4f4-417c-4955-b1ec-26d73d79b81c','N')
;
SELECT register_migration_script('201512121213_IDEMPIERE-2716.sql') FROM dual
;

View File

@ -0,0 +1,7 @@
-- Ticket #1005382: Requests are showing up on the wrong person's calendar
-- Nov 27, 2015 4:26:07 PM SGT
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200074,0,0,TO_TIMESTAMP('2015-11-27 16:26:05','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2015-11-27 16:26:05','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_DASHBOARD_CALENDAR_REQUEST_DISPLAY_MODE','CSU','C - Created by of the request is the logged in user; S - Sales Rep of the request is the logged in user; U - User/Contact of the request is the logged in user','D','C','f134d1ed-4101-4582-a3b3-0d2bf5c3577c')
;
SELECT register_migration_script('201511271630_IDEMPIERE-2973_1005382.sql') FROM dual
;

View File

@ -0,0 +1,12 @@
-- IDEMPIERE-2716 Bank Register Report - add Bank Account Parameter
-- Jul 7, 2015 10:28:19 AM CEST
INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200082,'C_BankAccount by Bank','S','C_BankAccount.C_Bank_ID=@C_Bank_ID@',0,0,'Y',TO_TIMESTAMP('2015-07-07 10:28:18','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-07-07 10:28:18','YYYY-MM-DD HH24:MI:SS'),100,'C','923bb7a8-b071-4f8a-85de-794e06e43490')
;
-- Jul 7, 2015 10:28:27 AM CEST
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200139,0,0,'Y',TO_TIMESTAMP('2015-07-07 10:28:26','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-07-07 10:28:26','YYYY-MM-DD HH24:MI:SS'),100,'Bank Account','Account at the Bank','The Bank Account identifies an account at this Bank.',200035,15,19,'N',200082,10,'N','C_BankAccount_ID','Y','D',836,'c852e4f4-417c-4955-b1ec-26d73d79b81c','N')
;
SELECT register_migration_script('201512121213_IDEMPIERE-2716.sql') FROM dual
;

View File

@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig
/** /**
* *
*/ */
private static final long serialVersionUID = 2300170888492939423L; private static final long serialVersionUID = -5124493725187310483L;
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS"; public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";
@ -142,6 +142,7 @@ public class MSysConfig extends X_AD_SysConfig
public static final String ZK_BROWSER_ICON = "ZK_BROWSER_ICON"; public static final String ZK_BROWSER_ICON = "ZK_BROWSER_ICON";
public static final String ZK_BROWSER_TITLE = "ZK_BROWSER_TITLE"; public static final String ZK_BROWSER_TITLE = "ZK_BROWSER_TITLE";
public static final String ZK_BUTTON_STYLE = "ZK_BUTTON_STYLE"; public static final String ZK_BUTTON_STYLE = "ZK_BUTTON_STYLE";
public static final String ZK_DASHBOARD_CALENDAR_REQUEST_DISPLAY_MODE = "ZK_DASHBOARD_CALENDAR_REQUEST_DISPLAY_MODE";
public static final String ZK_DASHBOARD_PERFORMANCE_TIMEOUT = "ZK_DASHBOARD_PERFORMANCE_TIMEOUT"; public static final String ZK_DASHBOARD_PERFORMANCE_TIMEOUT = "ZK_DASHBOARD_PERFORMANCE_TIMEOUT";
public static final String ZK_DASHBOARD_REFRESH_INTERVAL = "ZK_DASHBOARD_REFRESH_INTERVAL"; public static final String ZK_DASHBOARD_REFRESH_INTERVAL = "ZK_DASHBOARD_REFRESH_INTERVAL";
public static final String ZK_DECIMALBOX_PROCESS_DOTKEYPAD = "ZK_DECIMALBOX_PROCESS_DOTKEYPAD"; public static final String ZK_DECIMALBOX_PROCESS_DOTKEYPAD = "ZK_DECIMALBOX_PROCESS_DOTKEYPAD";

View File

@ -357,7 +357,7 @@ public class ReportEngine implements PrintServiceAttributeListener
*/ */
public String getName() public String getName()
{ {
return m_printFormat.getName(); return m_printFormat.get_Translation("Name");
} // getName } // getName
/** /**

View File

@ -39,6 +39,8 @@ public class BankRegister extends SvrProcess
{ {
/** Bank Parameter */ /** Bank Parameter */
private int p_C_Bank_ID = 0; private int p_C_Bank_ID = 0;
/** Bank Account Parameter */
private int p_C_BankAccount_ID = 0;
/** Period Parameter */ /** Period Parameter */
//private int p_C_Period_ID = 0; //private int p_C_Period_ID = 0;
private Timestamp p_DateAcct_From = null; private Timestamp p_DateAcct_From = null;
@ -78,11 +80,15 @@ public class BankRegister extends SvrProcess
} }
else if (name.equals("C_BPartner_ID")) else if (name.equals("C_BPartner_ID"))
p_C_BPartner_ID = ((BigDecimal)para[i].getParameter()).intValue(); p_C_BPartner_ID = ((BigDecimal)para[i].getParameter()).intValue();
else if (name.equals("C_BankAccount_ID"))
p_C_BankAccount_ID = para[i].getParameterAsInt();
else else
log.log(Level.SEVERE, "Unknown Parameter: " + name); log.log(Level.SEVERE, "Unknown Parameter: " + name);
} }
m_parameterWhere.append(" fa.AD_Table_ID = (Select AD_Table_ID From AD_Table Where TableName = 'C_Payment') "); m_parameterWhere.append(" fa.AD_Table_ID = (Select AD_Table_ID From AD_Table Where TableName = 'C_Payment') ");
m_parameterWhere.append(" And b.C_Bank_ID = " + p_C_Bank_ID); m_parameterWhere.append(" And b.C_Bank_ID = " + p_C_Bank_ID);
if(p_C_BankAccount_ID > 0)
m_parameterWhere.append(" AND ba.C_BankAccount_ID = " + p_C_BankAccount_ID);
setDateAcct(); setDateAcct();
sb.append(" - DateAcct ").append(p_DateAcct_From).append("-").append(p_DateAcct_To); sb.append(" - DateAcct ").append(p_DateAcct_From).append("-").append(p_DateAcct_To);

View File

@ -67,9 +67,7 @@ import org.compiere.model.MAttachmentEntry;
import org.compiere.model.MMailMsg; import org.compiere.model.MMailMsg;
import org.compiere.model.MRequest; import org.compiere.model.MRequest;
import org.compiere.model.MStore; import org.compiere.model.MStore;
import org.compiere.model.MSysConfig;
import org.compiere.model.MUserMail; import org.compiere.model.MUserMail;
import org.compiere.model.PO;
/** /**
* Servlet Utilities * Servlet Utilities
@ -1317,45 +1315,4 @@ public final class WebUtil
return retVal; return retVal;
} }
/** Return the host name of the server (eg: demo.idempiere.com) */
public static String getHostName() {
StringBuilder retValue = new StringBuilder();
try {
retValue.append(InetAddress.getLocalHost().getHostName());
} catch (UnknownHostException e) {
log.log(Level.WARNING, "Local host or IP not found", e);
retValue.append(getHostIP());
}
return retValue.toString();
}
/** Return the hardcoded link to the login page */
public static String getLoginPage() {
return getHostName() + "/webui/index.zul";
}
/** Return the link for direct access to the record using tableID */
public static String getZoomUrlTableID(PO po)
{
return getApplicationUrl(po) + "?Action=Zoom&AD_Table_ID=" + po.get_Table_ID() + "&Record_ID=" + po.get_ID();
}
/** Return the link for direct access to the record using tablename */
public static String getZoomUrlTableName(PO po)
{
return getApplicationUrl(po) + "?Action=Zoom&TableName" + po.get_TableName() + "&Record_ID=" + po.get_ID();
}
/** Return the link to the login page */
public static String getApplicationUrl(PO po)
{
String url = MSysConfig.getValue("APPLICATION_URL", po.getAD_Client_ID());
if (!Util.isEmpty(url) && !url.equals("USE_HARDCODED"))
return MSysConfig.getValue("APPLICATION_URL", po.getAD_Client_ID());
else
return getLoginPage();
}
} // WebUtil } // WebUtil

View File

@ -869,12 +869,15 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
*/ */
public void checkDependants(ArrayList<GridField> dependantFields){ public void checkDependants(ArrayList<GridField> dependantFields){
for ( GridField field : dependantFields ){ for (GridField field : dependantFields) {
if (field == null)
continue;
WEditor editor = editors.get(field); WEditor editor = editors.get(field);
if (editor == null)
continue;
boolean isEditable = field.isEditableGrid(true); boolean isEditable = field.isEditableGrid(true);
editor.setReadWrite(isEditable); editor.setReadWrite(isEditable);
if( isEditable ) if (isEditable)
gridPanel.refresh(gridTab); gridPanel.refresh(gridTab);
} }

View File

@ -54,8 +54,10 @@ import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory; import org.compiere.model.MLookupFactory;
import org.compiere.model.MQuery; import org.compiere.model.MQuery;
import org.compiere.model.MSession; import org.compiere.model.MSession;
import org.compiere.model.MSysConfig;
import org.compiere.model.MTable; import org.compiere.model.MTable;
import org.compiere.model.MZoomCondition; import org.compiere.model.MZoomCondition;
import org.compiere.model.PO;
import org.compiere.util.CCache; import org.compiere.util.CCache;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.CacheMgt; import org.compiere.util.CacheMgt;
@ -64,6 +66,7 @@ import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Ini; import org.compiere.util.Ini;
import org.compiere.util.Language; import org.compiere.util.Language;
import org.compiere.util.Util;
import org.zkoss.web.servlet.Servlets; import org.zkoss.web.servlet.Servlets;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Desktop; import org.zkoss.zk.ui.Desktop;
@ -806,4 +809,35 @@ public final class AEnv
} }
return fLanguageType; return fLanguageType;
} }
private static String m_ApplicationUrl = null;
public static String getApplicationUrl() {
String url = MSysConfig.getValue("APPLICATION_URL", Env.getAD_Client_ID(Env.getCtx()));
if (!Util.isEmpty(url) && !url.equals("USE_HARDCODED"))
return MSysConfig.getValue("APPLICATION_URL", Env.getAD_Client_ID(Env.getCtx()));
if (m_ApplicationUrl != null)
return m_ApplicationUrl;
int port = Executions.getCurrent().getServerPort();
String sch = Executions.getCurrent().getScheme();
String sport = null;
if ( (sch.equals("http") && port == 80) || (sch.equals("https") && port == 443) )
sport = "";
else
sport = ":" + port;
m_ApplicationUrl = sch + "://" + Executions.getCurrent().getServerName() + sport + Executions.getCurrent().getContextPath() + Executions.getCurrent().getDesktop().getRequestPath();
return m_ApplicationUrl;
}
/** Return the link for direct access to the record using tableID */
public static String getZoomUrlTableID(PO po)
{
return getApplicationUrl() + "?Action=Zoom&AD_Table_ID=" + po.get_Table_ID() + "&Record_ID=" + po.get_ID();
}
/** Return the link for direct access to the record using tablename */
public static String getZoomUrlTableName(PO po)
{
return getApplicationUrl() + "?Action=Zoom&TableName" + po.get_TableName() + "&Record_ID=" + po.get_ID();
}
} // AEnv } // AEnv

View File

@ -34,6 +34,7 @@ import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.ServerPushTemplate; import org.adempiere.webui.util.ServerPushTemplate;
import org.compiere.model.I_R_Request; import org.compiere.model.I_R_Request;
import org.compiere.model.MSysConfig;
import org.compiere.model.PO; import org.compiere.model.PO;
import org.compiere.model.X_R_RequestType; import org.compiere.model.X_R_RequestType;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
@ -200,13 +201,31 @@ public class DPCalendar extends DashboardPanel implements EventListener<Event>,
} }
public static ArrayList<ADCalendarEvent> getEvents(int RequestTypeID, Properties ctx) { public static ArrayList<ADCalendarEvent> getEvents(int RequestTypeID, Properties ctx) {
String mode = MSysConfig.getValue(MSysConfig.ZK_DASHBOARD_CALENDAR_REQUEST_DISPLAY_MODE, "CSU", Env.getAD_Client_ID(ctx));
String modeCondition = "";
if (mode.indexOf('C') >= 0)
modeCondition += "r.CreatedBy = ?";
if (mode.indexOf('S') >= 0)
{
if (modeCondition.length() > 0)
modeCondition += " OR ";
modeCondition += "r.SalesRep_ID = ?";
}
if (mode.indexOf('U') >= 0)
{
if (modeCondition.length() > 0)
modeCondition += " OR ";
modeCondition += "r.AD_User_ID = ?";
}
ArrayList<ADCalendarEvent> events = new ArrayList<ADCalendarEvent>(); ArrayList<ADCalendarEvent> events = new ArrayList<ADCalendarEvent>();
String sql = "SELECT DISTINCT r.R_Request_ID, r.DateNextAction, " String sql = "SELECT DISTINCT r.R_Request_ID, r.DateNextAction, "
+ "r.DateStartPlan, r.DateCompletePlan, r.StartTime, r.EndTime, " + "r.DateStartPlan, r.DateCompletePlan, r.StartTime, r.EndTime, "
+ "r.Summary, rt.HeaderColor, rt.ContentColor, rt.R_RequestType_ID " + "r.Summary, rt.HeaderColor, rt.ContentColor, rt.R_RequestType_ID "
+ "FROM R_Request r, R_RequestType rt " + "FROM R_Request r, R_RequestType rt "
+ "WHERE r.R_RequestType_ID = rt.R_RequestType_ID " + "WHERE r.R_RequestType_ID = rt.R_RequestType_ID "
+ "AND (r.SalesRep_ID = ? OR r.AD_User_ID = ? OR r.CreatedBy = ?) " + "AND (" + modeCondition + ") "
+ "AND r.AD_Client_ID = ? AND r.IsActive = 'Y' " + "AND r.AD_Client_ID = ? AND r.IsActive = 'Y' "
+ "AND (r.R_Status_ID IS NULL OR r.R_Status_ID IN (SELECT R_Status_ID FROM R_Status WHERE IsClosed='N')) "; + "AND (r.R_Status_ID IS NULL OR r.R_Status_ID IN (SELECT R_Status_ID FROM R_Status WHERE IsClosed='N')) ";
if(RequestTypeID > 0) if(RequestTypeID > 0)
@ -214,16 +233,21 @@ public class DPCalendar extends DashboardPanel implements EventListener<Event>,
PreparedStatement ps = null; PreparedStatement ps = null;
ResultSet rs = null; ResultSet rs = null;
int count = 1;
try { try {
ps = DB.prepareStatement(sql, null); ps = DB.prepareStatement(sql, null);
ps.setInt(1, Env.getAD_User_ID(ctx)); if (mode.indexOf('C') >= 0)
ps.setInt(2, Env.getAD_User_ID(ctx)); ps.setInt(count++, Env.getAD_User_ID(ctx));
ps.setInt(3, Env.getAD_User_ID(ctx)); if (mode.indexOf('S') >= 0)
ps.setInt(4, Env.getAD_Client_ID(ctx)); ps.setInt(count++, Env.getAD_User_ID(ctx));
if (mode.indexOf('U') >= 0)
ps.setInt(count++, Env.getAD_User_ID(ctx));
ps.setInt(count++, Env.getAD_Client_ID(ctx));
if(RequestTypeID > 0) if(RequestTypeID > 0)
ps.setInt(5, RequestTypeID); ps.setInt(count++, RequestTypeID);
rs = ps.executeQuery(); rs = ps.executeQuery();

View File

@ -2383,7 +2383,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
private boolean isSearchLike(GridField field) private boolean isSearchLike(GridField field)
{ {
return DisplayType.isText(field.getDisplayType()) return DisplayType.isText(field.getDisplayType())
&& MColumn.isSuggestSelectionColumn(field.getColumnName(), true); && (field.isSelectionColumn() || MColumn.isSuggestSelectionColumn(field.getColumnName(), true));
} }
public boolean isValid() public boolean isValid()

View File

@ -1061,10 +1061,10 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
winExportFile.onClose(); winExportFile.onClose();
AMedia media = null; AMedia media = null;
if (data != null) if (data != null)
media = new AMedia(m_reportEngine.getPrintFormat().getName() + "." + ext, null, "application/octet-stream", data); media = new AMedia(m_reportEngine.getName() + "." + ext, null, "application/octet-stream", data);
else else
media = new AMedia(m_reportEngine.getPrintFormat().getName() + "." + ext, null, "application/octet-stream", inputFile, true); media = new AMedia(m_reportEngine.getName() + "." + ext, null, "application/octet-stream", inputFile, true);
Filedownload.save(media, m_reportEngine.getPrintFormat().getName() + "." + ext); Filedownload.save(media, m_reportEngine.getName() + "." + ext);
} }
catch (Exception e) catch (Exception e)
{ {