Merge release-7.1 into master

This commit is contained in:
Carlos Ruiz 2020-04-26 13:45:06 +02:00
commit 190ef9d75c
11 changed files with 103 additions and 13 deletions

View File

@ -0,0 +1,15 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-4245 Set GL Category automatically for GL Journal
-- Apr 22, 2020, 8:05:30 PM CEST
UPDATE AD_Column SET Callout='org.compiere.model.CalloutGLJournal.docType',Updated=TO_DATE('2020-04-22 20:05:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1625
;
-- Apr 22, 2020, 8:16:34 PM CEST
UPDATE AD_Column SET Callout='org.compiere.model.CalloutGLJournal.docType',Updated=TO_DATE('2020-04-22 20:16:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10760
;
SELECT register_migration_script('202004222017_IDEMPIERE-4245.sql') FROM dual
;

View File

@ -0,0 +1,12 @@
-- IDEMPIERE-4245 Set GL Category automatically for GL Journal
-- Apr 22, 2020, 8:05:30 PM CEST
UPDATE AD_Column SET Callout='org.compiere.model.CalloutGLJournal.docType',Updated=TO_TIMESTAMP('2020-04-22 20:05:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1625
;
-- Apr 22, 2020, 8:16:34 PM CEST
UPDATE AD_Column SET Callout='org.compiere.model.CalloutGLJournal.docType',Updated=TO_TIMESTAMP('2020-04-22 20:16:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10760
;
SELECT register_migration_script('202004222017_IDEMPIERE-4245.sql') FROM dual
;

View File

@ -316,4 +316,27 @@ public class CalloutGLJournal extends CalloutEngine
return "";
}
/**
* Journal - Doc Type
* Set GL Category from C_DocType_ID
* @param ctx context
* @param WindowNo window no
* @param mTab tab
* @param mField field
* @param value value
* @return null or error message
*/
public String docType(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
if (value == null)
return "";
int C_DocType_ID = Env.getContextAsInt(ctx, WindowNo, "C_DocType_ID");
MDocType dt = MDocType.get (ctx, C_DocType_ID);
mTab.setValue("GL_Category_ID", dt.getGL_Category_ID());
return "";
}
} // CalloutGLJournal

View File

@ -330,6 +330,9 @@ public class MJournal extends X_GL_Journal implements DocAction
}
}
if (getGL_Category_ID() == 0 && getC_DocType_ID() > 0)
setGL_Category_ID(MDocType.get(getCtx(), getC_DocType_ID()).getGL_Category_ID());
// IDEMPIERE-63
// for documents that can be reactivated we cannot allow changing
// C_DocTypeTarget_ID or C_DocType_ID if they were already processed and isOverwriteSeqOnComplete

View File

@ -2339,6 +2339,10 @@ public class MPayment extends X_C_Payment
Msg.translate(getCtx(), "C_Payment_ID") + ": " + getDocumentNo() + " [1]", get_TrxName());
alloc.setAD_Org_ID(getAD_Org_ID());
alloc.setDateAcct(getDateAcct()); // in case date acct is different from datetrx in payment
MInvoice invoice = MInvoice.get(getCtx(), getC_Invoice_ID());
if (invoice.getDateAcct().after(alloc.getDateAcct())) {
alloc.setDateAcct(invoice.getDateAcct());
}
alloc.saveEx();
MAllocationLine aLine = null;
if (isReceipt())

View File

@ -157,6 +157,7 @@ public class MProcess extends X_AD_Process
final String whereClause = MProcessPara.COLUMNNAME_AD_Process_ID+"=?";
List<MProcessPara> list = new Query(getCtx(), I_AD_Process_Para.Table_Name, whereClause, get_TrxName())
.setParameters(get_ID())
.setOnlyActiveRecords(true)
.setOrderBy(MProcessPara.COLUMNNAME_SeqNo)
.list();
//

View File

@ -743,6 +743,9 @@ public final class MRole extends X_AD_Role
*/
private void loadOrgAccessUser(ArrayList<OrgAccess> list)
{
if (getAD_User_ID() == -1) {
log.severe("Trying to load Org Access from User but user has not been set");
}
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "SELECT * FROM AD_User_OrgAccess "
@ -2784,6 +2787,7 @@ public final class MRole extends X_AD_Role
final int AD_User_ID = getAD_User_ID();
if (AD_User_ID < 0)
{
log.severe("Trying to load Child Roles but user has not been set");
//throw new IllegalStateException("AD_User_ID is not set");
return ;
}
@ -2819,6 +2823,7 @@ public final class MRole extends X_AD_Role
final int AD_User_ID = getAD_User_ID();
if (AD_User_ID < 0)
{
log.severe("Trying to load Substituted Roles but user has not been set");
//throw new IllegalStateException("AD_User_ID is not set");
return;
}

View File

@ -149,9 +149,10 @@ public class CompositeADTabbox extends AbstractADTabbox
final IADTabpanel tabPanel = getSelectedDetailADTabpanel();
if (!tabPanel.getGridTab().dataSave(true)) {
showLastError();
}
tabPanel.getGridTab().dataRefreshAll(true, true);
tabPanel.getGridTab().refreshParentTabs();
} else {
tabPanel.getGridTab().dataRefreshAll(true, true);
tabPanel.getGridTab().refreshParentTabs();
}
}
else if (DetailPane.ON_DELETE_EVENT.equals(event.getName())) {
onDelete();

View File

@ -821,15 +821,15 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
protected void startProcess()
{
if (!parameterPanel.validateParameters())
return;
if (m_pi.isProcessRunning(parameterPanel.getParameters())) {
FDialog.error(getWindowNo(), "ProcessAlreadyRunning");
log.log(Level.WARNING, "Abort process " + m_AD_Process_ID + " because it is already running");
return;
}
if (!parameterPanel.validateParameters())
return;
startProcess0();
}

View File

@ -358,8 +358,8 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
String tableName = parameterName.substring(0, parameterName.length()-3);
StringBuilder sql = new StringBuilder("SELECT ");
sql.append(parameterName).append(" FROM ").append(tableName)
.append(" WHERE ").append(tableName).append("_UU=").append(DB.TO_STRING(string));
return DB.getSQLValue(null, sql.toString());
.append(" WHERE ").append(tableName).append("_UU=?");
return DB.getSQLValue(null, sql.toString(), string);
}
Map<String, Object> requestCtx = getRequestCtx();
@ -410,7 +410,15 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
}
// Validate parameters
modelRunProcess.setADMenuID(validateParameter("AD_Menu_ID", modelRunProcess.getADMenuID()));
try {
modelRunProcess.setADMenuID(validateParameter("AD_Menu_ID", modelRunProcess.getADMenuID()));
} catch(XmlValueOutOfRangeException e) { // Catch the exception when the Menu ID is not an Integer
String menuUU = getUUIDValue(modelRunProcess.xgetADMenuID());
if (menuUU == null) {
throw e;
}
modelRunProcess.setADMenuID(validateParameter("AD_Menu_ID", 0, menuUU));
}
try {
modelRunProcess.setADProcessID(validateParameter("AD_Process_ID", modelRunProcess.getADProcessID()));
} catch(XmlValueOutOfRangeException e) { // Catch the exception when the Process ID is not an Integer
@ -476,7 +484,15 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
int roleid = reqlogin.getRoleID();
// Validate parameters
modelGetList.setADReferenceID(validateParameter("AD_Reference_ID", modelGetList.getADReferenceID()));
try {
modelGetList.setADReferenceID(validateParameter("AD_Reference_ID", modelGetList.getADReferenceID()));
} catch(XmlValueOutOfRangeException e) { // Catch the exception when the Reference ID is not an Integer
String refUU = getUUIDValue(modelGetList.xgetADReferenceID());
if (refUU == null) {
throw e;
}
modelGetList.setADReferenceID(validateParameter("AD_Reference_ID", 0, refUU));
}
modelGetList.setFilter(validateParameter("Filter", modelGetList.getFilter()));
int ref_id = modelGetList.getADReferenceID();
@ -535,7 +551,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
} else if (MReference.VALIDATIONTYPE_TableValidation.equals(ref.getValidationType())) {
// Fill values from a reference table
MRole role = new MRole(ctx, roleid, null);
MRole role = MRole.get(ctx, roleid);
MRefTable rt = MRefTable.get(ctx, ref_id);
if (rt == null || rt.get_ID() == 0)
throw new IdempiereServiceFault("Web service type "

View File

@ -74,6 +74,12 @@ public class Process {
private static final CLogger log = CLogger.getCLogger(Process.class);
/**
* @param cs
* @param req
* @return
* @deprecated - method not used - will be deleted in future versions
*/
public static ProcessParamsDocument getProcessParams( CompiereService cs, GetProcessParamsDocument req )
{
ProcessParamsDocument res = ProcessParamsDocument.Factory.newInstance();
@ -193,11 +199,15 @@ public class Process {
RunProcessResponse r= res.addNewRunProcessResponse();
RunProcess rp = req.getRunProcess();
int AD_Menu_ID = rp.getADMenuID();
int AD_Process_ID = rp.getADProcessID();
int m_record_id = rp.getADRecordID();
MProcess process = MProcess.get (m_cs.getCtx() , AD_Process_ID);
// need to check if Role can access
MProcess process = null;
if (AD_Menu_ID <= 0 && AD_Process_ID > 0)
process = MProcess.get(m_cs.getCtx(), AD_Process_ID);
else if (AD_Menu_ID > 0 && AD_Process_ID <= 0)
process = MProcess.getFromMenu(m_cs.getCtx(), AD_Menu_ID);
if (process == null)
{
r.setError("Process not found");