BF [3014243] - MInvoice.setC_DocTypeTarget_ID(String) ignores AD_Org_ID

https://sourceforge.net/tracker/?func=detail&atid=879332&aid=3014243&group_id=176962
This commit is contained in:
trifonnt 2010-06-11 19:56:13 +00:00
parent c3ca5d9ee4
commit c4a4f8fcdd
1 changed files with 3 additions and 3 deletions

View File

@ -570,10 +570,10 @@ public class MInvoice extends X_C_Invoice implements DocAction
public void setC_DocTypeTarget_ID (String DocBaseType) public void setC_DocTypeTarget_ID (String DocBaseType)
{ {
String sql = "SELECT C_DocType_ID FROM C_DocType " String sql = "SELECT C_DocType_ID FROM C_DocType "
+ "WHERE AD_Client_ID=? AND DocBaseType=?" + "WHERE AD_Client_ID=? AND AD_Org_ID in (0,?) AND DocBaseType=?"
+ " AND IsActive='Y' " + " AND IsActive='Y' "
+ "ORDER BY IsDefault DESC"; + "ORDER BY IsDefault DESC, AD_Org_ID";
int C_DocType_ID = DB.getSQLValueEx(null, sql, getAD_Client_ID(), DocBaseType); int C_DocType_ID = DB.getSQLValueEx(null, sql, getAD_Client_ID(), getAD_Org_ID(), DocBaseType);
if (C_DocType_ID <= 0) if (C_DocType_ID <= 0)
log.log(Level.SEVERE, "Not found for AD_Client_ID=" log.log(Level.SEVERE, "Not found for AD_Client_ID="
+ getAD_Client_ID() + " - " + DocBaseType); + getAD_Client_ID() + " - " + DocBaseType);