1004128 IDEMPIERE-775 Documents without C_DocType_ID cannot be distributed directly. Implement suggestion from Carlos - special handling of the 7 tables in the Doc.getC_DocType_ID method.

This commit is contained in:
Heng Sin Low 2014-07-14 14:00:00 +08:00
parent 579d32869b
commit 97e5b51a4c
1 changed files with 61 additions and 0 deletions

View File

@ -28,6 +28,13 @@ import java.util.Iterator;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
import org.compiere.model.I_C_AllocationHdr;
import org.compiere.model.I_C_BankStatement;
import org.compiere.model.I_C_Cash;
import org.compiere.model.I_C_ProjectIssue;
import org.compiere.model.I_M_MatchInv;
import org.compiere.model.I_M_MatchPO;
import org.compiere.model.I_M_Production;
import org.compiere.model.MAccount; import org.compiere.model.MAccount;
import org.compiere.model.MAcctSchema; import org.compiere.model.MAcctSchema;
import org.compiere.model.MConversionRate; import org.compiere.model.MConversionRate;
@ -122,6 +129,8 @@ public abstract class Doc
* M_Requisition POR * M_Requisition POR
**************************************************************************/ **************************************************************************/
private static final String DOC_TYPE_BY_DOC_BASE_TYPE_SQL = "SELECT C_DocType_ID FROM C_DocType WHERE AD_Client_ID=? AND DocBaseType=? AND IsActive='Y'";
/** AR Invoices - ARI */ /** AR Invoices - ARI */
public static final String DOCTYPE_ARInvoice = MDocType.DOCBASETYPE_ARInvoice; public static final String DOCTYPE_ARInvoice = MDocType.DOCBASETYPE_ARInvoice;
/** AR Credit Memo */ /** AR Credit Memo */
@ -1729,6 +1738,58 @@ public abstract class Doc
if (ii != null) if (ii != null)
return ii.intValue(); return ii.intValue();
} }
else
{
if (p_po.get_TableName().equals(I_M_MatchPO.Table_Name))
{
int docTypeId = DB.getSQLValue((String)null, DOC_TYPE_BY_DOC_BASE_TYPE_SQL,
p_po.getAD_Client_ID(), Doc.DOCTYPE_MatMatchPO);
if (docTypeId > 0)
return docTypeId;
}
else if (p_po.get_TableName().equals(I_M_MatchInv.Table_Name))
{
int docTypeId = DB.getSQLValue((String)null, DOC_TYPE_BY_DOC_BASE_TYPE_SQL,
p_po.getAD_Client_ID(), Doc.DOCTYPE_MatMatchInv);
if (docTypeId > 0)
return docTypeId;
}
else if (p_po.get_TableName().equals(I_C_AllocationHdr.Table_Name))
{
int docTypeId = DB.getSQLValue((String)null, DOC_TYPE_BY_DOC_BASE_TYPE_SQL,
p_po.getAD_Client_ID(), Doc.DOCTYPE_Allocation);
if (docTypeId > 0)
return docTypeId;
}
else if (p_po.get_TableName().equals(I_C_BankStatement.Table_Name))
{
int docTypeId = DB.getSQLValue((String)null, DOC_TYPE_BY_DOC_BASE_TYPE_SQL,
p_po.getAD_Client_ID(), Doc.DOCTYPE_BankStatement);
if (docTypeId > 0)
return docTypeId;
}
else if (p_po.get_TableName().equals(I_C_Cash.Table_Name))
{
int docTypeId = DB.getSQLValue((String)null, DOC_TYPE_BY_DOC_BASE_TYPE_SQL,
p_po.getAD_Client_ID(), Doc.DOCTYPE_CashJournal);
if (docTypeId > 0)
return docTypeId;
}
else if (p_po.get_TableName().equals(I_C_ProjectIssue.Table_Name))
{
int docTypeId = DB.getSQLValue((String)null, DOC_TYPE_BY_DOC_BASE_TYPE_SQL,
p_po.getAD_Client_ID(), Doc.DOCTYPE_ProjectIssue);
if (docTypeId > 0)
return docTypeId;
}
else if (p_po.get_TableName().equals(I_M_Production.Table_Name))
{
int docTypeId = DB.getSQLValue((String)null, DOC_TYPE_BY_DOC_BASE_TYPE_SQL,
p_po.getAD_Client_ID(), Doc.DOCTYPE_MatProduction);
if (docTypeId > 0)
return docTypeId;
}
}
return 0; return 0;
} // getC_DocType_ID } // getC_DocType_ID