Peer review [ 1867464 ] Incorrect Partner Location when create manual shipment
Small refactoring
This commit is contained in:
parent
c937785ed0
commit
6005e2cfb1
|
@ -170,62 +170,60 @@ public class CalloutInOut extends CalloutEngine
|
||||||
if (C_BPartner_ID == null || C_BPartner_ID.intValue() == 0)
|
if (C_BPartner_ID == null || C_BPartner_ID.intValue() == 0)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
String sql = "SELECT p.AD_Language,p.C_PaymentTerm_ID,"
|
String sql = "SELECT p.AD_Language,p.C_PaymentTerm_ID,"
|
||||||
+ "p.M_PriceList_ID,p.PaymentRule,p.POReference,"
|
+ "p.M_PriceList_ID,p.PaymentRule,p.POReference,"
|
||||||
+ "p.SO_Description,p.IsDiscountPrinted,"
|
+ "p.SO_Description,p.IsDiscountPrinted,"
|
||||||
+ "p.SO_CreditLimit-p.SO_CreditUsed AS CreditAvailable,"
|
+ "p.SO_CreditLimit-p.SO_CreditUsed AS CreditAvailable,"
|
||||||
+ "l.C_BPartner_Location_ID,c.AD_User_ID "
|
+ "l.C_BPartner_Location_ID,c.AD_User_ID "
|
||||||
+ "FROM C_BPartner p, C_BPartner_Location l, AD_User c "
|
+ "FROM C_BPartner p, C_BPartner_Location l, AD_User c "
|
||||||
+ "WHERE l.IsActive='Y' AND p.C_BPartner_ID=l.C_BPartner_ID(+)"
|
+ "WHERE l.IsActive='Y' AND p.C_BPartner_ID=l.C_BPartner_ID(+)"
|
||||||
+ " AND p.C_BPartner_ID=c.C_BPartner_ID(+)"
|
+ " AND p.C_BPartner_ID=c.C_BPartner_ID(+)"
|
||||||
+ " AND p.C_BPartner_ID=?"; // 1
|
+ " AND p.C_BPartner_ID=?"; // 1
|
||||||
|
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||||
|
pstmt.setInt(1, C_BPartner_ID.intValue());
|
||||||
|
ResultSet rs = pstmt.executeQuery();
|
||||||
|
if (rs.next())
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
//[ 1867464 ]
|
||||||
pstmt.setInt(1, C_BPartner_ID.intValue());
|
boolean IsSOTrx = "Y".equals(Env.getContext(ctx, WindowNo, "IsSOTrx"));
|
||||||
ResultSet rs = pstmt.executeQuery();
|
if (!IsSOTrx)
|
||||||
BigDecimal bd;
|
|
||||||
if (rs.next())
|
|
||||||
{
|
{
|
||||||
//[ 1867464 ]
|
// Location
|
||||||
boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
Integer ii = new Integer(rs.getInt("C_BPartner_Location_ID"));
|
||||||
if(!IsSOTrx)
|
if (rs.wasNull())
|
||||||
{
|
mTab.setValue("C_BPartner_Location_ID", null);
|
||||||
// Location
|
else
|
||||||
Integer ii = new Integer(rs.getInt("C_BPartner_Location_ID"));
|
mTab.setValue("C_BPartner_Location_ID", ii);
|
||||||
if (rs.wasNull())
|
// Contact
|
||||||
mTab.setValue("C_BPartner_Location_ID", null);
|
ii = new Integer(rs.getInt("AD_User_ID"));
|
||||||
else
|
if (rs.wasNull())
|
||||||
mTab.setValue("C_BPartner_Location_ID", ii);
|
mTab.setValue("AD_User_ID", null);
|
||||||
// Contact
|
else
|
||||||
ii = new Integer(rs.getInt("AD_User_ID"));
|
mTab.setValue("AD_User_ID", ii);
|
||||||
if (rs.wasNull())
|
}
|
||||||
mTab.setValue("AD_User_ID", null);
|
|
||||||
else
|
|
||||||
mTab.setValue("AD_User_ID", ii);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Bugs item #1679818: checking for SOTrx only
|
//Bugs item #1679818: checking for SOTrx only
|
||||||
//boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
|
if (IsSOTrx)
|
||||||
if (IsSOTrx)
|
{
|
||||||
{
|
// CreditAvailable
|
||||||
// CreditAvailable
|
double CreditAvailable = rs.getDouble("CreditAvailable");
|
||||||
double CreditAvailable = rs.getDouble("CreditAvailable");
|
if (!rs.wasNull() && CreditAvailable < 0)
|
||||||
if (!rs.wasNull() && CreditAvailable < 0)
|
mTab.fireDataStatusEEvent("CreditLimitOver",
|
||||||
mTab.fireDataStatusEEvent("CreditLimitOver",
|
|
||||||
DisplayType.getNumberFormat(DisplayType.Amount).format(CreditAvailable),
|
DisplayType.getNumberFormat(DisplayType.Amount).format(CreditAvailable),
|
||||||
false);
|
false);
|
||||||
}//
|
}//
|
||||||
}
|
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
|
||||||
catch (SQLException e)
|
|
||||||
{
|
|
||||||
log.log(Level.SEVERE, sql, e);
|
|
||||||
return e.getLocalizedMessage();
|
|
||||||
}
|
}
|
||||||
|
rs.close();
|
||||||
|
pstmt.close();
|
||||||
|
}
|
||||||
|
catch (SQLException e)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, sql, e);
|
||||||
|
return e.getLocalizedMessage();
|
||||||
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
} // bpartner
|
} // bpartner
|
||||||
|
@ -259,7 +257,6 @@ public class CalloutInOut extends CalloutEngine
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, M_Warehouse_ID.intValue());
|
pstmt.setInt(1, M_Warehouse_ID.intValue());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
ResultSet rs = pstmt.executeQuery();
|
||||||
BigDecimal bd;
|
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
// Org
|
// Org
|
||||||
|
|
Loading…
Reference in New Issue