Carlos Ruiz 2007-03-30 22:32:47 +00:00
parent 6720dfbf02
commit 1f6a5ab0b7
2 changed files with 9 additions and 4 deletions

View File

@ -36,18 +36,18 @@ public class MBPartnerLocation extends X_C_BPartner_Location
* @param C_BPartner_ID bp * @param C_BPartner_ID bp
* @return array of locations * @return array of locations
*/ */
public static MBPartnerLocation[] getForBPartner (Properties ctx, int C_BPartner_ID) public MBPartnerLocation[] getForBPartner (Properties ctx, int C_BPartner_ID)
{ {
ArrayList<MBPartnerLocation> list = new ArrayList<MBPartnerLocation>(); ArrayList<MBPartnerLocation> list = new ArrayList<MBPartnerLocation>();
String sql = "SELECT * FROM C_BPartner_Location WHERE C_BPartner_ID=?"; String sql = "SELECT * FROM C_BPartner_Location WHERE C_BPartner_ID=?";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try
{ {
pstmt = DB.prepareStatement (sql, null); pstmt = DB.prepareStatement (sql, trxName);
pstmt.setInt (1, C_BPartner_ID); pstmt.setInt (1, C_BPartner_ID);
ResultSet rs = pstmt.executeQuery (); ResultSet rs = pstmt.executeQuery ();
while (rs.next ()) while (rs.next ())
list.add(new MBPartnerLocation(ctx, rs, null)); list.add(new MBPartnerLocation(ctx, rs, trxName));
rs.close (); rs.close ();
pstmt.close (); pstmt.close ();
pstmt = null; pstmt = null;
@ -93,6 +93,7 @@ public class MBPartnerLocation extends X_C_BPartner_Location
setIsPayFrom (true); setIsPayFrom (true);
setIsBillTo (true); setIsBillTo (true);
} }
this.trxName = trxName;
} // MBPartner_Location } // MBPartner_Location
/** /**
@ -113,9 +114,11 @@ public class MBPartnerLocation extends X_C_BPartner_Location
* @param rs current row of result set to be loaded * @param rs current row of result set to be loaded
* @param trxName transaction * @param trxName transaction
*/ */
private String trxName = null;
public MBPartnerLocation (Properties ctx, ResultSet rs, String trxName) public MBPartnerLocation (Properties ctx, ResultSet rs, String trxName)
{ {
super(ctx, rs, trxName); super(ctx, rs, trxName);
this.trxName = trxName;
} // MBPartner_Location } // MBPartner_Location
/** Cached Location */ /** Cached Location */
@ -173,7 +176,7 @@ public class MBPartnerLocation extends X_C_BPartner_Location
makeUnique(address); makeUnique(address);
// Check uniqueness // Check uniqueness
MBPartnerLocation[] locations = MBPartnerLocation.getForBPartner(getCtx(), getC_BPartner_ID()); MBPartnerLocation[] locations = getForBPartner(getCtx(), getC_BPartner_ID());
boolean unique = locations.length == 0; boolean unique = locations.length == 0;
while (!unique) while (!unique)
{ {

View File

@ -1593,6 +1593,8 @@ public class MOrder extends X_C_Order implements DocAction
} }
if (!oTax.delete(true, get_TrxName())) if (!oTax.delete(true, get_TrxName()))
return false; return false;
if (!oTax.save(get_TrxName()))
return false;
} }
else else
{ {