Merge with release-1.0c

This commit is contained in:
Elaine Tan 2013-12-03 19:43:01 +08:00
commit 38a8dfb728
7 changed files with 95 additions and 45 deletions

View File

@ -0,0 +1,10 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Dec 3, 2013 1:02:10 PM SGT
-- IDEMPIERE-1590 Sales region field is showing summary regions
UPDATE AD_Column SET AD_Reference_Value_ID=144, AD_Reference_ID=18,Updated=TO_DATE('2013-12-03 13:02:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2968
;
SELECT register_migration_script('201312031304_IDEMPIERE-1590.sql') FROM dual
;

View File

@ -0,0 +1,7 @@
-- Dec 3, 2013 1:02:10 PM SGT
-- IDEMPIERE-1590 Sales region field is showing summary regions
UPDATE AD_Column SET AD_Reference_Value_ID=144, AD_Reference_ID=18,Updated=TO_TIMESTAMP('2013-12-03 13:02:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2968
;
SELECT register_migration_script('201312031304_IDEMPIERE-1590.sql') FROM dual
;

View File

@ -159,7 +159,18 @@ public class CalloutInvoice extends CalloutEngine
{ // get default PriceList
int i = Env.getContextAsInt(ctx, "#M_PriceList_ID");
if (i != 0)
mTab.setValue("M_PriceList_ID", new Integer(i));
{
MPriceList pl = new MPriceList(ctx, i, null);
if (IsSOTrx == pl.isSOPriceList())
mTab.setValue("M_PriceList_ID", new Integer(i));
else
{
String sql2 = "SELECT M_PriceList_ID FROM M_PriceList WHERE AD_Client_ID=? AND IsSOPriceList=? AND IsActive='Y' ORDER BY IsDefault DESC";
ii = DB.getSQLValue (null, sql2, Env.getAD_Client_ID(ctx), IsSOTrx);
if (ii != 0)
mTab.setValue("M_PriceList_ID", new Integer(ii));
}
}
}
// PaymentRule

View File

@ -289,7 +289,18 @@ public class CalloutOrder extends CalloutEngine
{ // get default PriceList
int i = Env.getContextAsInt(ctx, "#M_PriceList_ID");
if (i != 0)
mTab.setValue("M_PriceList_ID", new Integer(i));
{
MPriceList pl = new MPriceList(ctx, i, null);
if (IsSOTrx == pl.isSOPriceList())
mTab.setValue("M_PriceList_ID", new Integer(i));
else
{
String sql2 = "SELECT M_PriceList_ID FROM M_PriceList WHERE AD_Client_ID=? AND IsSOPriceList=? AND IsActive='Y' ORDER BY IsDefault DESC";
ii = DB.getSQLValue (null, sql2, Env.getAD_Client_ID(ctx), IsSOTrx);
if (ii != 0)
mTab.setValue("M_PriceList_ID", new Integer(ii));
}
}
}
// Bill-To
@ -494,7 +505,18 @@ public class CalloutOrder extends CalloutEngine
{ // get default PriceList
int i = Env.getContextAsInt(ctx, "#M_PriceList_ID");
if (i != 0)
mTab.setValue("M_PriceList_ID", new Integer(i));
{
MPriceList pl = new MPriceList(ctx, i, null);
if (IsSOTrx == pl.isSOPriceList())
mTab.setValue("M_PriceList_ID", new Integer(i));
else
{
String sql2 = "SELECT M_PriceList_ID FROM M_PriceList WHERE AD_Client_ID=? AND IsSOPriceList=? AND IsActive='Y' ORDER BY IsDefault DESC";
ii = DB.getSQLValue (null, sql2, Env.getAD_Client_ID(ctx), IsSOTrx);
if (ii != 0)
mTab.setValue("M_PriceList_ID", new Integer(ii));
}
}
}
int bill_Location_ID = rs.getInt("Bill_Location_ID");

View File

@ -358,12 +358,11 @@ public class ImportAccount extends SvrProcess
no = DB.executeUpdate(sql.toString(), get_TrxName());
if (log.isLoggable(Level.CONFIG)) log.config("Not Found Parent ElementValue=" + no);
//
sql = new StringBuilder ("SELECT i.ParentElementValue_ID, i.I_ElementValue_ID,")
sql = new StringBuilder ("SELECT COALESCE(i.ParentElementValue_ID, 0), i.I_ElementValue_ID,")
.append(" e.AD_Tree_ID, i.C_ElementValue_ID, i.Value||'-'||i.Name AS Info ")
.append("FROM I_ElementValue i")
.append(" INNER JOIN C_Element e ON (i.C_Element_ID=e.C_Element_ID) ")
.append("WHERE i.C_ElementValue_ID IS NOT NULL AND e.AD_Tree_ID IS NOT NULL")
.append(" AND i.ParentElementValue_ID IS NOT NULL")
.append(" AND i.I_IsImported='Y' AND Processed='N' AND i.AD_Client_ID=").append(m_AD_Client_ID);
int noParentUpdate = 0;
try

View File

@ -928,11 +928,16 @@ public class MInvoice extends X_C_Invoice implements DocAction
{
int ii = Env.getContextAsInt(getCtx(), "#M_PriceList_ID");
if (ii != 0)
setM_PriceList_ID(ii);
else
{
String sql = "SELECT M_PriceList_ID FROM M_PriceList WHERE AD_Client_ID=? AND IsDefault='Y'";
ii = DB.getSQLValue (null, sql, getAD_Client_ID());
MPriceList pl = new MPriceList(getCtx(), ii, null);
if (isSOTrx() == pl.isSOPriceList())
setM_PriceList_ID(ii);
}
if (getM_PriceList_ID() == 0)
{
String sql = "SELECT M_PriceList_ID FROM M_PriceList WHERE AD_Client_ID=? AND IsSOPriceList=? AND IsActive='Y' ORDER BY IsDefault DESC";
ii = DB.getSQLValue (null, sql, getAD_Client_ID(), isSOTrx());
if (ii != 0)
setM_PriceList_ID (ii);
}

View File

@ -2429,8 +2429,7 @@ public final class MPayment extends X_C_Payment
}
//
setC_Invoice_ID(0);
if (!accrual)
setIsAllocated(false);
setIsAllocated(false);
} // deallocate
/**
@ -2626,40 +2625,37 @@ public final class MPayment extends X_C_Payment
setReversal_ID(reversal.getC_Payment_ID());
StringBuilder info = new StringBuilder(reversal.getDocumentNo());
if (!accrual)
{
// Create automatic Allocation
MAllocationHdr alloc = new MAllocationHdr (getCtx(), false,
getDateTrx(), getC_Currency_ID(),
Msg.translate(getCtx(), "C_Payment_ID") + ": " + reversal.getDocumentNo(), get_TrxName());
alloc.setAD_Org_ID(getAD_Org_ID());
if (!alloc.save())
log.warning("Automatic allocation - hdr not saved");
else
{
// Original Allocation
MAllocationLine aLine = new MAllocationLine (alloc, getPayAmt(true),
Env.ZERO, Env.ZERO, Env.ZERO);
aLine.setDocInfo(getC_BPartner_ID(), 0, 0);
aLine.setPaymentInfo(getC_Payment_ID(), 0);
if (!aLine.save(get_TrxName()))
log.warning("Automatic allocation - line not saved");
// Reversal Allocation
aLine = new MAllocationLine (alloc, reversal.getPayAmt(true),
Env.ZERO, Env.ZERO, Env.ZERO);
aLine.setDocInfo(reversal.getC_BPartner_ID(), 0, 0);
aLine.setPaymentInfo(reversal.getC_Payment_ID(), 0);
if (!aLine.save(get_TrxName()))
log.warning("Automatic allocation - reversal line not saved");
}
// added AdempiereException by zuhri
if (!alloc.processIt(DocAction.ACTION_Complete))
throw new AdempiereException("Failed when processing document - " + alloc.getProcessMsg());
// end added
alloc.saveEx(get_TrxName());
//
info.append(" - @C_AllocationHdr_ID@: ").append(alloc.getDocumentNo());
}
// Create automatic Allocation
MAllocationHdr alloc = new MAllocationHdr (getCtx(), false,
( accrual ? dateAcct : getDateTrx() ),
getC_Currency_ID(),
Msg.translate(getCtx(), "C_Payment_ID") + ": " + reversal.getDocumentNo(), get_TrxName());
alloc.setAD_Org_ID(getAD_Org_ID());
alloc.saveEx(get_TrxName());
// Original Allocation
MAllocationLine aLine = new MAllocationLine (alloc, getPayAmt(true),
Env.ZERO, Env.ZERO, Env.ZERO);
aLine.setDocInfo(getC_BPartner_ID(), 0, 0);
aLine.setPaymentInfo(getC_Payment_ID(), 0);
if (!aLine.save(get_TrxName()))
log.warning("Automatic allocation - line not saved");
// Reversal Allocation
aLine = new MAllocationLine (alloc, reversal.getPayAmt(true),
Env.ZERO, Env.ZERO, Env.ZERO);
aLine.setDocInfo(reversal.getC_BPartner_ID(), 0, 0);
aLine.setPaymentInfo(reversal.getC_Payment_ID(), 0);
if (!aLine.save(get_TrxName()))
log.warning("Automatic allocation - reversal line not saved");
// added AdempiereException by zuhri
if (!alloc.processIt(DocAction.ACTION_Complete))
throw new AdempiereException("Failed when processing document - " + alloc.getProcessMsg());
// end added
alloc.saveEx(get_TrxName());
//
info.append(" - @C_AllocationHdr_ID@: ").append(alloc.getDocumentNo());
// Update BPartner
if (getC_BPartner_ID() != 0)