Work in progress - integrate bug fixing from Compiere 260b
This commit is contained in:
parent
6147f64ec4
commit
dbd6a623b3
|
@ -537,8 +537,10 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
{
|
{
|
||||||
m_parentNeedSave = false;
|
m_parentNeedSave = false;
|
||||||
String lc = getLinkColumnName();
|
String lc = getLinkColumnName();
|
||||||
if (lc.equals(""))
|
if (lc.equals("")) {
|
||||||
log.severe ("No link column");
|
log.warning ("No link column");
|
||||||
|
where.append (" 2=3");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String value = Env.getContext(m_vo.ctx, m_vo.WindowNo, lc);
|
String value = Env.getContext(m_vo.ctx, m_vo.WindowNo, lc);
|
||||||
|
|
|
@ -68,8 +68,6 @@ public class GridWindow implements Serializable
|
||||||
private GridWindowVO m_vo;
|
private GridWindowVO m_vo;
|
||||||
/** Tabs */
|
/** Tabs */
|
||||||
private ArrayList<GridTab> m_tabs = new ArrayList<GridTab>();
|
private ArrayList<GridTab> m_tabs = new ArrayList<GridTab>();
|
||||||
/** Position */
|
|
||||||
private Rectangle m_position = null;
|
|
||||||
/** Model last updated */
|
/** Model last updated */
|
||||||
private Timestamp m_modelUpdated = null;
|
private Timestamp m_modelUpdated = null;
|
||||||
|
|
||||||
|
|
|
@ -167,11 +167,11 @@ public class MBPBankAccount extends X_C_BP_BankAccount
|
||||||
*/
|
*/
|
||||||
public MBank getBank()
|
public MBank getBank()
|
||||||
{
|
{
|
||||||
int C_BP_BankAccount_ID = getC_BP_BankAccount_ID();
|
int C_Bank_ID = getC_Bank_ID();
|
||||||
if (C_BP_BankAccount_ID == 0)
|
if (C_Bank_ID == 0)
|
||||||
return null;
|
return null;
|
||||||
if (m_bank == null)
|
if (m_bank == null)
|
||||||
m_bank = new MBank (getCtx(), C_BP_BankAccount_ID, get_TrxName());
|
m_bank = new MBank (getCtx(), C_Bank_ID, get_TrxName());
|
||||||
return m_bank;
|
return m_bank;
|
||||||
} // getBank
|
} // getBank
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class MBPartner extends X_C_BPartner
|
||||||
{
|
{
|
||||||
MBPartner retValue = null;
|
MBPartner retValue = null;
|
||||||
String sql = "SELECT * FROM C_BPartner "
|
String sql = "SELECT * FROM C_BPartner "
|
||||||
+ "WHERE C_BPartner_ID=(SELECT C_BPartnerCashTrx_ID FROM AD_ClientInfo WHERE AD_Client_ID=?)";
|
+ "WHERE C_BPartner_ID IN (SELECT C_BPartnerCashTrx_ID FROM AD_ClientInfo WHERE AD_Client_ID=?)";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -376,7 +376,7 @@ public class MBPartner extends X_C_BPartner
|
||||||
|
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
String sql = "SELECT * FROM C_BPartner "
|
String sql = "SELECT * FROM C_BPartner "
|
||||||
+ "WHERE C_BPartner_ID=(SELECT C_BPartnerCashTrx_ID FROM AD_ClientInfo WHERE AD_Client_ID=?)";
|
+ "WHERE C_BPartner_ID IN (SELECT C_BPartnerCashTrx_ID FROM AD_ClientInfo WHERE AD_Client_ID=?)";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -568,7 +568,7 @@ public class MBPartner extends X_C_BPartner
|
||||||
return m_accounts;
|
return m_accounts;
|
||||||
//
|
//
|
||||||
ArrayList<MBPBankAccount> list = new ArrayList<MBPBankAccount>();
|
ArrayList<MBPBankAccount> list = new ArrayList<MBPBankAccount>();
|
||||||
String sql = "SELECT * FROM C_BP_BankAccount WHERE C_BPartner_ID=?";
|
String sql = "SELECT * FROM C_BP_BankAccount WHERE C_BPartner_ID=? AND IsActive='Y'";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -403,12 +403,12 @@ public class MCostDetail extends X_M_CostDetail
|
||||||
* @param ctx context
|
* @param ctx context
|
||||||
* @param whereClause where clause
|
* @param whereClause where clause
|
||||||
* @param ID 1st parameter
|
* @param ID 1st parameter
|
||||||
* @param ID2 2nd parameter
|
* @param M_AttributeSetInstance_ID ASI
|
||||||
* @param trxName trx
|
* @param trxName trx
|
||||||
* @return cost detail
|
* @return cost detail
|
||||||
*/
|
*/
|
||||||
private static MCostDetail get (Properties ctx, String whereClause,
|
private static MCostDetail get (Properties ctx, String whereClause,
|
||||||
int ID, int ID2, String trxName)
|
int ID, int M_AttributeSetInstance_ID, String trxName)
|
||||||
{
|
{
|
||||||
String sql = "SELECT * FROM M_CostDetail WHERE " + whereClause;
|
String sql = "SELECT * FROM M_CostDetail WHERE " + whereClause;
|
||||||
MCostDetail retValue = null;
|
MCostDetail retValue = null;
|
||||||
|
@ -417,7 +417,7 @@ public class MCostDetail extends X_M_CostDetail
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
pstmt.setInt (1, ID);
|
pstmt.setInt (1, ID);
|
||||||
pstmt.setInt (2, ID2);
|
pstmt.setInt (2, M_AttributeSetInstance_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
ResultSet rs = pstmt.executeQuery ();
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
retValue = new MCostDetail (ctx, rs, trxName);
|
retValue = new MCostDetail (ctx, rs, trxName);
|
||||||
|
@ -693,7 +693,7 @@ public class MCostDetail extends X_M_CostDetail
|
||||||
{
|
{
|
||||||
if (isProcessed())
|
if (isProcessed())
|
||||||
{
|
{
|
||||||
log.info("already processed");
|
log.info("Already processed");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
boolean ok = false;
|
boolean ok = false;
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.compiere.util.DB;
|
||||||
public class MDunningLevel extends X_C_DunningLevel
|
public class MDunningLevel extends X_C_DunningLevel
|
||||||
{
|
{
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MPayment.class);
|
private static CLogger s_log = CLogger.getCLogger (MDunningLevel.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
|
@ -282,7 +282,7 @@ public class MDunningRunLine extends X_C_DunningRunLine
|
||||||
// Total
|
// Total
|
||||||
setTotalAmt(getConvertedAmt().add(getFeeAmt()).add(getInterestAmt()));
|
setTotalAmt(getConvertedAmt().add(getFeeAmt()).add(getInterestAmt()));
|
||||||
// Reset Collection Status only if null
|
// Reset Collection Status only if null
|
||||||
if (getInvoice().getInvoiceCollectionType ()==null)
|
if (getInvoice()!=null && getInvoice().getInvoiceCollectionType ()==null)
|
||||||
{
|
{
|
||||||
if (m_invoice!=null)
|
if (m_invoice!=null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -184,6 +184,20 @@ public class MEntityType extends X_AD_EntityType
|
||||||
/** 10=D, 20=C, 100=U, 110=CUST, 200=A, 210=EXT, 220=XX */
|
/** 10=D, 20=C, 100=U, 110=CUST, 200=A, 210=EXT, 220=XX */
|
||||||
private static final int s_maxAD_EntityType_ID = 221;
|
private static final int s_maxAD_EntityType_ID = 221;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set AD_EntityType_ID
|
||||||
|
*/
|
||||||
|
private void setAD_EntityType_ID()
|
||||||
|
{
|
||||||
|
int AD_EntityType_ID = getAD_EntityType_ID();
|
||||||
|
if (AD_EntityType_ID == 0)
|
||||||
|
{
|
||||||
|
String sql = "SELECT NVL(MAX(AD_EntityType_ID), 999999) FROM AD_EntityType WHERE AD_EntityType_ID > 1000";
|
||||||
|
AD_EntityType_ID= DB.getSQLValue (get_TrxName(), sql);
|
||||||
|
setAD_EntityType_ID(AD_EntityType_ID+1);
|
||||||
|
}
|
||||||
|
} // setAD_EntityType_ID
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is System Maintained
|
* Is System Maintained
|
||||||
* @return true if D/C/U/CUST/A/EXT/XX
|
* @return true if D/C/U/CUST/A/EXT/XX
|
||||||
|
@ -246,6 +260,7 @@ public class MEntityType extends X_AD_EntityType
|
||||||
+ " - Must be ASCII Letter or Digit");
|
+ " - Must be ASCII Letter or Digit");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
setAD_EntityType_ID();
|
||||||
} // new
|
} // new
|
||||||
s_entityTypes = null; // reset
|
s_entityTypes = null; // reset
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -475,6 +475,17 @@ public class MGoal extends X_PA_Goal
|
||||||
return m_color;
|
return m_color;
|
||||||
} // getColor
|
} // getColor
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the color schema for this goal.
|
||||||
|
*
|
||||||
|
* @return the color schema, or null if the measure targer is 0
|
||||||
|
*/
|
||||||
|
public MColorSchema getColorSchema()
|
||||||
|
{
|
||||||
|
return (getMeasureTarget().signum() == 0) ?
|
||||||
|
null : MColorSchema.get(getCtx(), getPA_ColorSchema_ID());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Measure Display
|
* Get Measure Display
|
||||||
* @return Measure Display
|
* @return Measure Display
|
||||||
|
|
|
@ -87,8 +87,6 @@ public class MImage extends X_AD_Image
|
||||||
private Image m_image = null;
|
private Image m_image = null;
|
||||||
/** The Icon */
|
/** The Icon */
|
||||||
private Icon m_icon = null;
|
private Icon m_icon = null;
|
||||||
/** The Image File */
|
|
||||||
private File m_file = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Image
|
* Get Image
|
||||||
|
|
|
@ -1015,7 +1015,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
// Credit Check
|
// Credit Check
|
||||||
if (isSOTrx() && !isReversal())
|
if (isSOTrx() && !isReversal())
|
||||||
{
|
{
|
||||||
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), null);
|
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName());
|
||||||
if (MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus()))
|
if (MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus()))
|
||||||
{
|
{
|
||||||
m_processMsg = "@BPartnerCreditStop@ - @TotalOpenBalance@="
|
m_processMsg = "@BPartnerCreditStop@ - @TotalOpenBalance@="
|
||||||
|
@ -1546,11 +1546,11 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
|
|
||||||
// Org Must be linked to BPartner
|
// Org Must be linked to BPartner
|
||||||
MOrg org = MOrg.get(getCtx(), getAD_Org_ID());
|
MOrg org = MOrg.get(getCtx(), getAD_Org_ID());
|
||||||
int counterC_BPartner_ID = org.getLinkedC_BPartner_ID();
|
int counterC_BPartner_ID = org.getLinkedC_BPartner_ID(get_TrxName());
|
||||||
if (counterC_BPartner_ID == 0)
|
if (counterC_BPartner_ID == 0)
|
||||||
return null;
|
return null;
|
||||||
// Business Partner needs to be linked to Org
|
// Business Partner needs to be linked to Org
|
||||||
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), null);
|
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName());
|
||||||
int counterAD_Org_ID = bp.getAD_OrgBP_ID_Int();
|
int counterAD_Org_ID = bp.getAD_OrgBP_ID_Int();
|
||||||
if (counterAD_Org_ID == 0)
|
if (counterAD_Org_ID == 0)
|
||||||
return null;
|
return null;
|
||||||
|
@ -1771,6 +1771,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
reversal.closeIt();
|
reversal.closeIt();
|
||||||
|
reversal.setProcessing (false);
|
||||||
reversal.setDocStatus(DOCSTATUS_Reversed);
|
reversal.setDocStatus(DOCSTATUS_Reversed);
|
||||||
reversal.setDocAction(DOCACTION_None);
|
reversal.setDocAction(DOCACTION_None);
|
||||||
reversal.save(get_TrxName());
|
reversal.save(get_TrxName());
|
||||||
|
|
|
@ -1046,7 +1046,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
{
|
{
|
||||||
BigDecimal retValue = null;
|
BigDecimal retValue = null;
|
||||||
String sql = "SELECT SUM(currencyConvert(al.Amount+al.DiscountAmt+al.WriteOffAmt,"
|
String sql = "SELECT SUM(currencyConvert(al.Amount+al.DiscountAmt+al.WriteOffAmt,"
|
||||||
+ "ah.C_Currency_ID, i.C_Currency_ID,ah.DateTrx,i.C_ConversionType_ID, al.AD_Client_ID,al.AD_Org_ID)) "
|
+ "ah.C_Currency_ID, i.C_Currency_ID,ah.DateTrx,COALESCE(i.C_ConversionType_ID,0), al.AD_Client_ID,al.AD_Org_ID)) "
|
||||||
+ "FROM C_AllocationLine al"
|
+ "FROM C_AllocationLine al"
|
||||||
+ " INNER JOIN C_AllocationHdr ah ON (al.C_AllocationHdr_ID=ah.C_AllocationHdr_ID)"
|
+ " INNER JOIN C_AllocationHdr ah ON (al.C_AllocationHdr_ID=ah.C_AllocationHdr_ID)"
|
||||||
+ " INNER JOIN C_Invoice i ON (al.C_Invoice_ID=i.C_Invoice_ID) "
|
+ " INNER JOIN C_Invoice i ON (al.C_Invoice_ID=i.C_Invoice_ID) "
|
||||||
|
@ -1820,7 +1820,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
|
|
||||||
// Org Must be linked to BPartner
|
// Org Must be linked to BPartner
|
||||||
MOrg org = MOrg.get(getCtx(), getAD_Org_ID());
|
MOrg org = MOrg.get(getCtx(), getAD_Org_ID());
|
||||||
int counterC_BPartner_ID = org.getLinkedC_BPartner_ID();
|
int counterC_BPartner_ID = org.getLinkedC_BPartner_ID(get_TrxName());
|
||||||
if (counterC_BPartner_ID == 0)
|
if (counterC_BPartner_ID == 0)
|
||||||
return null;
|
return null;
|
||||||
// Business Partner needs to be linked to Org
|
// Business Partner needs to be linked to Org
|
||||||
|
@ -2046,6 +2046,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
reversal.setC_Payment_ID(0);
|
reversal.setC_Payment_ID(0);
|
||||||
reversal.setIsPaid(true);
|
reversal.setIsPaid(true);
|
||||||
reversal.closeIt();
|
reversal.closeIt();
|
||||||
|
reversal.setProcessing (false);
|
||||||
reversal.setDocStatus(DOCSTATUS_Reversed);
|
reversal.setDocStatus(DOCSTATUS_Reversed);
|
||||||
reversal.setDocAction(DOCACTION_None);
|
reversal.setDocAction(DOCACTION_None);
|
||||||
reversal.save(get_TrxName());
|
reversal.save(get_TrxName());
|
||||||
|
|
|
@ -250,7 +250,7 @@ public class MJournal extends X_GL_Journal implements DocAction
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
if (fromLines.length != count)
|
if (fromLines.length != count)
|
||||||
log.log(Level.SEVERE, "copyLinesFrom - Line difference - JournalLines=" + fromLines.length + " <> Saved=" + count);
|
log.log(Level.SEVERE, "Line difference - JournalLines=" + fromLines.length + " <> Saved=" + count);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
} // copyLinesFrom
|
} // copyLinesFrom
|
||||||
|
|
|
@ -50,11 +50,13 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
|
||||||
MJournalBatch to = new MJournalBatch (ctx, 0, trxName);
|
MJournalBatch to = new MJournalBatch (ctx, 0, trxName);
|
||||||
PO.copyValues(from, to, from.getAD_Client_ID(), from.getAD_Org_ID());
|
PO.copyValues(from, to, from.getAD_Client_ID(), from.getAD_Org_ID());
|
||||||
to.set_ValueNoCheck ("DocumentNo", null);
|
to.set_ValueNoCheck ("DocumentNo", null);
|
||||||
|
to.set_ValueNoCheck ("C_Period_ID", null);
|
||||||
to.setDateAcct(dateDoc);
|
to.setDateAcct(dateDoc);
|
||||||
to.setDateDoc(dateDoc);
|
to.setDateDoc(dateDoc);
|
||||||
to.setDocStatus(DOCSTATUS_Drafted);
|
to.setDocStatus(DOCSTATUS_Drafted);
|
||||||
to.setDocAction(DOCACTION_Complete);
|
to.setDocAction(DOCACTION_Complete);
|
||||||
to.setIsApproved(false);
|
to.setIsApproved(false);
|
||||||
|
to.setProcessed (false);
|
||||||
//
|
//
|
||||||
if (!to.save())
|
if (!to.save())
|
||||||
throw new IllegalStateException("Could not create Journal Batch");
|
throw new IllegalStateException("Could not create Journal Batch");
|
||||||
|
@ -220,7 +222,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
|
||||||
PO.copyValues(fromJournals[i], toJournal, getAD_Client_ID(), getAD_Org_ID());
|
PO.copyValues(fromJournals[i], toJournal, getAD_Client_ID(), getAD_Org_ID());
|
||||||
toJournal.setGL_JournalBatch_ID(getGL_JournalBatch_ID());
|
toJournal.setGL_JournalBatch_ID(getGL_JournalBatch_ID());
|
||||||
toJournal.set_ValueNoCheck ("DocumentNo", null); // create new
|
toJournal.set_ValueNoCheck ("DocumentNo", null); // create new
|
||||||
toJournal.setC_Period_ID(0);
|
toJournal.set_ValueNoCheck ("C_Period_ID", null);
|
||||||
toJournal.setDateDoc(getDateDoc()); // dates from this Batch
|
toJournal.setDateDoc(getDateDoc()); // dates from this Batch
|
||||||
toJournal.setDateAcct(getDateAcct());
|
toJournal.setDateAcct(getDateAcct());
|
||||||
toJournal.setDocStatus(MJournal.DOCSTATUS_Drafted);
|
toJournal.setDocStatus(MJournal.DOCSTATUS_Drafted);
|
||||||
|
@ -238,7 +240,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fromJournals.length != count)
|
if (fromJournals.length != count)
|
||||||
log.log(Level.SEVERE, "copyDetailsFrom - Line difference - Journals=" + fromJournals.length + " <> Saved=" + count);
|
log.log(Level.SEVERE, "Line difference - Journals=" + fromJournals.length + " <> Saved=" + count);
|
||||||
|
|
||||||
return count + lineCount;
|
return count + lineCount;
|
||||||
} // copyLinesFrom
|
} // copyLinesFrom
|
||||||
|
|
|
@ -174,7 +174,29 @@ public class MMovementLine extends X_M_MovementLine
|
||||||
|
|
||||||
// Qty Precision
|
// Qty Precision
|
||||||
if (newRecord || is_ValueChanged("QtyEntered"))
|
if (newRecord || is_ValueChanged("QtyEntered"))
|
||||||
setMovementQty(getMovementQty());
|
setMovementQty(getMovementQty());
|
||||||
|
|
||||||
|
// Mandatory Instance
|
||||||
|
if (getM_AttributeSetInstanceTo_ID() == 0)
|
||||||
|
{
|
||||||
|
if (getM_AttributeSetInstance_ID() != 0) // set to from
|
||||||
|
setM_AttributeSetInstanceTo_ID(getM_AttributeSetInstance_ID());
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MProduct product = getProduct();
|
||||||
|
if (product != null
|
||||||
|
&& product.getM_AttributeSet_ID() != 0)
|
||||||
|
{
|
||||||
|
MAttributeSet mas = MAttributeSet.get(getCtx(), product.getM_AttributeSet_ID());
|
||||||
|
if (mas.isInstanceAttribute()
|
||||||
|
&& (mas.isMandatory() || mas.isMandatoryAlways()))
|
||||||
|
{
|
||||||
|
log.saveError("FillMandatory", Msg.getElement(getCtx(), "M_AttributeSetInstanceTo_ID"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // ASI
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} // beforeSave
|
} // beforeSave
|
||||||
|
|
|
@ -1314,7 +1314,7 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
// Credit Check
|
// Credit Check
|
||||||
if (isSOTrx())
|
if (isSOTrx())
|
||||||
{
|
{
|
||||||
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), null);
|
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName());
|
||||||
if (MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus()))
|
if (MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus()))
|
||||||
{
|
{
|
||||||
m_processMsg = "@BPartnerCreditStop@ - @TotalOpenBalance@="
|
m_processMsg = "@BPartnerCreditStop@ - @TotalOpenBalance@="
|
||||||
|
@ -1888,11 +1888,11 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
|
|
||||||
// Org Must be linked to BPartner
|
// Org Must be linked to BPartner
|
||||||
MOrg org = MOrg.get(getCtx(), getAD_Org_ID());
|
MOrg org = MOrg.get(getCtx(), getAD_Org_ID());
|
||||||
int counterC_BPartner_ID = org.getLinkedC_BPartner_ID();
|
int counterC_BPartner_ID = org.getLinkedC_BPartner_ID(get_TrxName());
|
||||||
if (counterC_BPartner_ID == 0)
|
if (counterC_BPartner_ID == 0)
|
||||||
return null;
|
return null;
|
||||||
// Business Partner needs to be linked to Org
|
// Business Partner needs to be linked to Org
|
||||||
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), null);
|
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName());
|
||||||
int counterAD_Org_ID = bp.getAD_OrgBP_ID_Int();
|
int counterAD_Org_ID = bp.getAD_OrgBP_ID_Int();
|
||||||
if (counterAD_Org_ID == 0)
|
if (counterAD_Org_ID == 0)
|
||||||
return null;
|
return null;
|
||||||
|
@ -2142,6 +2142,26 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
|
|
||||||
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
|
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
|
||||||
String DocSubTypeSO = dt.getDocSubTypeSO();
|
String DocSubTypeSO = dt.getDocSubTypeSO();
|
||||||
|
|
||||||
|
// Replace Prepay with POS to revert all doc
|
||||||
|
if (MDocType.DOCSUBTYPESO_PrepayOrder.equals (DocSubTypeSO))
|
||||||
|
{
|
||||||
|
MDocType newDT = null;
|
||||||
|
MDocType[] dts = MDocType.getOfClient (getCtx());
|
||||||
|
for (int i = 0; i < dts.length; i++)
|
||||||
|
{
|
||||||
|
MDocType type = dts[i];
|
||||||
|
if (MDocType.DOCSUBTYPESO_PrepayOrder.equals(type.getDocSubTypeSO()))
|
||||||
|
{
|
||||||
|
if (type.isDefault() || newDT == null)
|
||||||
|
newDT = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (newDT == null)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
setC_DocType_ID (newDT.getC_DocType_ID());
|
||||||
|
}
|
||||||
|
|
||||||
// PO - just re-open
|
// PO - just re-open
|
||||||
if (!isSOTrx())
|
if (!isSOTrx())
|
||||||
|
|
|
@ -1655,16 +1655,16 @@ public final class MPayment extends X_C_Payment
|
||||||
|
|
||||||
// Org Must be linked to BPartner
|
// Org Must be linked to BPartner
|
||||||
MOrg org = MOrg.get(getCtx(), getAD_Org_ID());
|
MOrg org = MOrg.get(getCtx(), getAD_Org_ID());
|
||||||
int counterC_BPartner_ID = org.getLinkedC_BPartner_ID();
|
int counterC_BPartner_ID = org.getLinkedC_BPartner_ID(get_TrxName());
|
||||||
if (counterC_BPartner_ID == 0)
|
if (counterC_BPartner_ID == 0)
|
||||||
return null;
|
return null;
|
||||||
// Business Partner needs to be linked to Org
|
// Business Partner needs to be linked to Org
|
||||||
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), null);
|
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName());
|
||||||
int counterAD_Org_ID = bp.getAD_OrgBP_ID_Int();
|
int counterAD_Org_ID = bp.getAD_OrgBP_ID_Int();
|
||||||
if (counterAD_Org_ID == 0)
|
if (counterAD_Org_ID == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
MBPartner counterBP = new MBPartner (getCtx(), counterC_BPartner_ID, null);
|
MBPartner counterBP = new MBPartner (getCtx(), counterC_BPartner_ID, get_TrxName());
|
||||||
// MOrgInfo counterOrgInfo = MOrgInfo.get(getCtx(), counterAD_Org_ID);
|
// MOrgInfo counterOrgInfo = MOrgInfo.get(getCtx(), counterAD_Org_ID);
|
||||||
log.info("Counter BP=" + counterBP.getName());
|
log.info("Counter BP=" + counterBP.getName());
|
||||||
|
|
||||||
|
|
|
@ -122,4 +122,20 @@ public class MProductCategoryAcct extends X_M_Product_Category_Acct
|
||||||
return success;
|
return success;
|
||||||
} // afterSave
|
} // afterSave
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String Representation
|
||||||
|
* @return info
|
||||||
|
*/
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
StringBuffer sb = new StringBuffer ("MProductCategoryAcct[");
|
||||||
|
sb.append (get_ID())
|
||||||
|
.append (",M_Product_Category_ID=").append (getM_Product_Category_ID())
|
||||||
|
.append (",C_AcctSchema_ID=").append(getC_AcctSchema_ID())
|
||||||
|
.append (",CostingLevel=").append(getCostingLevel())
|
||||||
|
.append (",CostingMethod=").append(getCostingMethod())
|
||||||
|
.append ("]");
|
||||||
|
return sb.toString ();
|
||||||
|
} // toString
|
||||||
|
|
||||||
} // MProductCategoryAcct
|
} // MProductCategoryAcct
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class MRecurring extends X_C_Recurring
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
StringBuffer sb = new StringBuffer ("MRecurring[")
|
StringBuffer sb = new StringBuffer ("MRecurring[")
|
||||||
.append(get_ID()).append(",").append(getName());
|
.append(get_ID()).append("-").append(getName());
|
||||||
if (getRecurringType().equals(MRecurring.RECURRINGTYPE_Order))
|
if (getRecurringType().equals(MRecurring.RECURRINGTYPE_Order))
|
||||||
sb.append(",C_Order_ID=").append(getC_Order_ID());
|
sb.append(",C_Order_ID=").append(getC_Order_ID());
|
||||||
else if (getRecurringType().equals(MRecurring.RECURRINGTYPE_Invoice))
|
else if (getRecurringType().equals(MRecurring.RECURRINGTYPE_Invoice))
|
||||||
|
@ -65,7 +65,7 @@ public class MRecurring extends X_C_Recurring
|
||||||
sb.append(",C_Project_ID=").append(getC_Project_ID());
|
sb.append(",C_Project_ID=").append(getC_Project_ID());
|
||||||
else if (getRecurringType().equals(MRecurring.RECURRINGTYPE_GLJournal))
|
else if (getRecurringType().equals(MRecurring.RECURRINGTYPE_GLJournal))
|
||||||
sb.append(",GL_JournalBatch_ID=").append(getGL_JournalBatch_ID());
|
sb.append(",GL_JournalBatch_ID=").append(getGL_JournalBatch_ID());
|
||||||
sb.append(",Fequency=").append(getFrequencyType()).append("*").append(getFrequency());
|
sb.append(",Frequency=").append(getFrequencyType()).append("*").append(getFrequency());
|
||||||
sb.append("]");
|
sb.append("]");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
} // toString
|
} // toString
|
||||||
|
|
|
@ -59,10 +59,6 @@ public final class NaturalAccountMap<K,V> extends CCache<K,V>
|
||||||
m_trxName = trxName;
|
m_trxName = trxName;
|
||||||
} // NaturalAccountMap
|
} // NaturalAccountMap
|
||||||
|
|
||||||
/** Delimiter */
|
|
||||||
private String m_delim = ",";
|
|
||||||
/** KeyNo */
|
|
||||||
private static int s_keyNo = 0;
|
|
||||||
/** Context */
|
/** Context */
|
||||||
private Properties m_ctx = null;
|
private Properties m_ctx = null;
|
||||||
/** Transaction */
|
/** Transaction */
|
||||||
|
|
|
@ -501,4 +501,18 @@ public class ProductCost
|
||||||
return cost;
|
return cost;
|
||||||
} // getPOCost
|
} // getPOCost
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String Representation
|
||||||
|
* @return info
|
||||||
|
*/
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
StringBuffer sb = new StringBuffer ("ProductCost[");
|
||||||
|
sb.append ("M_Product_ID=").append(m_M_Product_ID)
|
||||||
|
.append(",M_AttributeSetInstance_ID").append(m_M_AttributeSetInstance_ID)
|
||||||
|
.append (",Qty=").append(m_qty)
|
||||||
|
.append ("]");
|
||||||
|
return sb.toString ();
|
||||||
|
} // toString
|
||||||
|
|
||||||
} // ProductCost
|
} // ProductCost
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class BPartnerOrgLink extends SvrProcess
|
||||||
}
|
}
|
||||||
else // check if linked to already
|
else // check if linked to already
|
||||||
{
|
{
|
||||||
int C_BPartner_ID = org.getLinkedC_BPartner_ID();
|
int C_BPartner_ID = org.getLinkedC_BPartner_ID(get_TrxName());
|
||||||
if (C_BPartner_ID > 0)
|
if (C_BPartner_ID > 0)
|
||||||
throw new IllegalArgumentException ("Organization '" + org.getName()
|
throw new IllegalArgumentException ("Organization '" + org.getName()
|
||||||
+ "' already linked (to C_BPartner_ID=" + C_BPartner_ID + ")");
|
+ "' already linked (to C_BPartner_ID=" + C_BPartner_ID + ")");
|
||||||
|
|
|
@ -239,16 +239,28 @@ public class ChangeLogProcess extends SvrProcess
|
||||||
{
|
{
|
||||||
m_sqlUpdate.append(getSQLValue(cLog.getOldValue()));
|
m_sqlUpdate.append(getSQLValue(cLog.getOldValue()));
|
||||||
if (p_CheckNewValue.booleanValue())
|
if (p_CheckNewValue.booleanValue())
|
||||||
m_sqlUpdateWhere.append(" AND ").append(m_column.getColumnName())
|
{
|
||||||
.append("=").append(getSQLValue(cLog.getNewValue()));
|
m_sqlUpdateWhere.append(" AND ").append(m_column.getColumnName());
|
||||||
|
String newValue = getSQLValue(cLog.getNewValue());
|
||||||
|
if (newValue == null || "NULL".equals(newValue))
|
||||||
|
m_sqlUpdateWhere.append(" IS NULL");
|
||||||
|
else
|
||||||
|
m_sqlUpdateWhere.append("=").append(newValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ReDo (a) -> b
|
// ReDo (a) -> b
|
||||||
else if (p_CheckOldValue != null)
|
else if (p_CheckOldValue != null)
|
||||||
{
|
{
|
||||||
m_sqlUpdate.append(getSQLValue(cLog.getNewValue()));
|
m_sqlUpdate.append(getSQLValue(cLog.getNewValue()));
|
||||||
if (p_CheckOldValue.booleanValue())
|
if (p_CheckOldValue.booleanValue())
|
||||||
m_sqlUpdateWhere.append(" AND ").append(m_column.getColumnName())
|
{
|
||||||
.append("=").append(getSQLValue(cLog.getOldValue()));
|
String newValue = getSQLValue(cLog.getOldValue());
|
||||||
|
m_sqlUpdateWhere.append(" AND ").append(m_column.getColumnName());
|
||||||
|
if (newValue == null || "NULL".equals(newValue))
|
||||||
|
m_sqlUpdateWhere.append(" IS NULL");
|
||||||
|
else
|
||||||
|
m_sqlUpdateWhere.append("=").append(newValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // createStatement
|
} // createStatement
|
||||||
|
|
||||||
|
|
|
@ -357,7 +357,7 @@ public class DistributionRun extends SvrProcess
|
||||||
if (runAD_Org_ID == 0)
|
if (runAD_Org_ID == 0)
|
||||||
runAD_Org_ID = Env.getAD_Org_ID(getCtx());
|
runAD_Org_ID = Env.getAD_Org_ID(getCtx());
|
||||||
MOrg runOrg = MOrg.get(getCtx(), runAD_Org_ID);
|
MOrg runOrg = MOrg.get(getCtx(), runAD_Org_ID);
|
||||||
int runC_BPartner_ID = runOrg.getLinkedC_BPartner_ID();
|
int runC_BPartner_ID = runOrg.getLinkedC_BPartner_ID(get_TrxName());
|
||||||
boolean counter = !m_run.isCreateSingleOrder() // no single Order
|
boolean counter = !m_run.isCreateSingleOrder() // no single Order
|
||||||
&& runC_BPartner_ID > 0 // Org linked to BP
|
&& runC_BPartner_ID > 0 // Org linked to BP
|
||||||
&& !m_docType.isSOTrx(); // PO
|
&& !m_docType.isSOTrx(); // PO
|
||||||
|
|
|
@ -39,7 +39,6 @@ public class DocumentTypeVerify extends SvrProcess
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Parameters (Nop)
|
* No Parameters (Nop)
|
||||||
* @see org.compiere.process.SvrProcess#prepare()
|
|
||||||
*/
|
*/
|
||||||
protected void prepare()
|
protected void prepare()
|
||||||
{
|
{
|
||||||
|
@ -47,7 +46,6 @@ public class DocumentTypeVerify extends SvrProcess
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute process
|
* Execute process
|
||||||
* @see org.compiere.process.SvrProcess#doIt()
|
|
||||||
* @return info
|
* @return info
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -42,9 +42,6 @@ public class ImportAccount extends SvrProcess
|
||||||
/** Delete old Imported */
|
/** Delete old Imported */
|
||||||
private boolean m_deleteOldImported = false;
|
private boolean m_deleteOldImported = false;
|
||||||
|
|
||||||
/** Organization to be imported to */
|
|
||||||
private int m_AD_Org_ID = 0;
|
|
||||||
|
|
||||||
/** Effective */
|
/** Effective */
|
||||||
private Timestamp m_DateValue = null;
|
private Timestamp m_DateValue = null;
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,6 @@ public class ImportBPartner extends SvrProcess
|
||||||
/** Delete old Imported */
|
/** Delete old Imported */
|
||||||
private boolean m_deleteOldImported = false;
|
private boolean m_deleteOldImported = false;
|
||||||
|
|
||||||
/** Organization to be imported to */
|
|
||||||
private int m_AD_Org_ID = 0;
|
|
||||||
/** Effective */
|
/** Effective */
|
||||||
private Timestamp m_DateValue = null;
|
private Timestamp m_DateValue = null;
|
||||||
|
|
||||||
|
@ -100,11 +98,11 @@ public class ImportBPartner extends SvrProcess
|
||||||
log.fine("Reset=" + no);
|
log.fine("Reset=" + no);
|
||||||
|
|
||||||
// Set BP_Group
|
// Set BP_Group
|
||||||
sql = new StringBuffer ("UPDATE I_BPartner i "
|
sql = new StringBuffer ("UPDATE I_BPartner i "
|
||||||
+ "SET GroupValue=(SELECT Value FROM C_BP_Group g WHERE g.IsDefault='Y'"
|
+ "SET GroupValue=(SELECT MAX(Value) FROM C_BP_Group g WHERE g.IsDefault='Y'"
|
||||||
+ " AND g.AD_Client_ID=i.AD_Client_ID AND ROWNUM=1) "
|
+ " AND g.AD_Client_ID=i.AD_Client_ID");
|
||||||
+ "WHERE GroupValue IS NULL AND C_BP_Group_ID IS NULL"
|
sql.append("WHERE GroupValue IS NULL AND C_BP_Group_ID IS NULL"
|
||||||
+ " AND I_IsImported<>'Y'").append(clientCheck);
|
+ " AND I_IsImported<>'Y'").append(clientCheck);
|
||||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||||
log.fine("Set Group Default=" + no);
|
log.fine("Set Group Default=" + no);
|
||||||
//
|
//
|
||||||
|
@ -149,14 +147,14 @@ public class ImportBPartner extends SvrProcess
|
||||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||||
log.config("Invalid Country=" + no);
|
log.config("Invalid Country=" + no);
|
||||||
|
|
||||||
// Set Region
|
// Set Region
|
||||||
sql = new StringBuffer ("UPDATE I_BPartner i "
|
sql = new StringBuffer ("UPDATE I_BPartner i "
|
||||||
+ "Set RegionName=(SELECT Name FROM C_Region r"
|
+ "Set RegionName=(SELECT MAX(Name FROM C_Region r"
|
||||||
+ " WHERE r.IsDefault='Y' AND r.C_Country_ID=i.C_Country_ID"
|
+ " WHERE r.IsDefault='Y' AND r.C_Country_ID=i.C_Country_ID"
|
||||||
+ " AND r.AD_Client_ID IN (0, i.AD_Client_ID) AND ROWNUM=1) "
|
+ " AND r.AD_Client_ID IN (0, i.AD_Client_ID)) " );
|
||||||
+ "WHERE RegionName IS NULL AND C_Region_ID IS NULL"
|
sql.append("WHERE RegionName IS NULL AND C_Region_ID IS NULL"
|
||||||
+ " AND I_IsImported<>'Y'").append(clientCheck);
|
+ " AND I_IsImported<>'Y'").append(clientCheck);
|
||||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||||
log.fine("Set Region Default=" + no);
|
log.fine("Set Region Default=" + no);
|
||||||
//
|
//
|
||||||
sql = new StringBuffer ("UPDATE I_BPartner i "
|
sql = new StringBuffer ("UPDATE I_BPartner i "
|
||||||
|
@ -433,7 +431,7 @@ public class ImportBPartner extends SvrProcess
|
||||||
if (impBP.getPhone() != null)
|
if (impBP.getPhone() != null)
|
||||||
user.setPhone(impBP.getPhone());
|
user.setPhone(impBP.getPhone());
|
||||||
if (impBP.getPhone2() != null)
|
if (impBP.getPhone2() != null)
|
||||||
user.setPhone(impBP.getPhone2());
|
user.setPhone2(impBP.getPhone2());
|
||||||
if (impBP.getFax() != null)
|
if (impBP.getFax() != null)
|
||||||
user.setFax(impBP.getFax());
|
user.setFax(impBP.getFax());
|
||||||
if (impBP.getEMail() != null)
|
if (impBP.getEMail() != null)
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'C_ProcessCreate')
|
|
||||||
BEGIN
|
|
||||||
PRINT '<<< DROPPING PROCEDURE C_ProcessCreate >>>'
|
|
||||||
DROP Procedure C_ProcessCreate
|
|
||||||
END
|
|
||||||
go
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
CREATE Procedure C_ProcessCreate
|
|
||||||
(
|
|
||||||
@AD_Table_ID Identifier,
|
|
||||||
@Record_ID Identifier,
|
|
||||||
@AD_IProcess_ID Identifier OUTPUT
|
|
||||||
)
|
|
||||||
--WITH ENCRYPTION
|
|
||||||
AS
|
|
||||||
/******************************************************************************
|
|
||||||
* Author: Jorg Janke (c) ClassApps 1999
|
|
||||||
* Version: $Header: /cvs/adempiere/db/database/Procedures/C_ProcessCreate.sql,v 1.1 2006/04/21 17:51:58 jjanke Exp $
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Create process for background execution
|
|
||||||
*
|
|
||||||
* Return values:
|
|
||||||
* Int_Process_ID
|
|
||||||
*
|
|
||||||
* Called by:
|
|
||||||
*
|
|
||||||
******************************************************************************/
|
|
||||||
BEGIN
|
|
||||||
Set NoCount ON
|
|
||||||
BEGIN TRANSACTION
|
|
||||||
|
|
||||||
SELECT @AD_IProcess_ID = ISNULL(MAX(AD_IProcess_ID), 0)+1
|
|
||||||
FROM AD_IProcess
|
|
||||||
---------------------------------
|
|
||||||
INSERT INTO AD_IProcess
|
|
||||||
(AD_IProcess_ID, AD_Table_ID, Record_ID, IsProcessing, Updated)
|
|
||||||
VALUES
|
|
||||||
(@AD_IProcess_ID, @AD_Table_ID, @Record_ID, 'N', null)
|
|
||||||
|
|
||||||
IF (@@ERROR <> 0)
|
|
||||||
BEGIN
|
|
||||||
RAISERROR 60001 'Int_Process insert error'
|
|
||||||
ROLLBACK TRAN
|
|
||||||
RETURN(1)
|
|
||||||
END
|
|
||||||
|
|
||||||
COMMIT TRANSACTION
|
|
||||||
END -- C_ProcessCreate
|
|
||||||
go
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
IF OBJECT_ID('C_ProcessCreate') IS NOT NULL
|
|
||||||
PRINT '<<< CREATED PROCEDURE C_ProcessCreate >>>'
|
|
||||||
ELSE
|
|
||||||
PRINT '<<< FAILED CREATING PROCEDURE C_ProcessCreate >>>'
|
|
||||||
go
|
|
|
@ -202,11 +202,11 @@ public class MOrg extends X_AD_Org
|
||||||
* Get Linked BPartner
|
* Get Linked BPartner
|
||||||
* @return C_BPartner_ID
|
* @return C_BPartner_ID
|
||||||
*/
|
*/
|
||||||
public int getLinkedC_BPartner_ID()
|
public int getLinkedC_BPartner_ID(String trxName)
|
||||||
{
|
{
|
||||||
if (m_linkedBPartner == null)
|
if (m_linkedBPartner == null)
|
||||||
{
|
{
|
||||||
int C_BPartner_ID = DB.getSQLValue(null,
|
int C_BPartner_ID = DB.getSQLValue(trxName,
|
||||||
"SELECT C_BPartner_ID FROM C_BPartner WHERE AD_OrgBP_ID=?",
|
"SELECT C_BPartner_ID FROM C_BPartner WHERE AD_OrgBP_ID=?",
|
||||||
getAD_Org_ID());
|
getAD_Org_ID());
|
||||||
if (C_BPartner_ID < 0) // not found = -1
|
if (C_BPartner_ID < 0) // not found = -1
|
||||||
|
|
Loading…
Reference in New Issue