Merge with db85c1fe66ddd64b9cca06d84f822d5f2985b81e
This commit is contained in:
commit
4100d6ba55
|
@ -0,0 +1,7 @@
|
|||
-- Apr 15, 2013 3:54:49 PM IST
|
||||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
|
||||
UPDATE AD_Process SET AccessLevel='6',Updated=TO_DATE('2013-04-15 15:54:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=200018
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201304150457_IDEMPIERE-294.sql') FROM dual
|
||||
;
|
|
@ -0,0 +1,7 @@
|
|||
-- Apr 15, 2013 3:54:49 PM IST
|
||||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
|
||||
UPDATE AD_Process SET AccessLevel='6',Updated=TO_TIMESTAMP('2013-04-15 15:54:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=200018
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201304150457_IDEMPIERE-294.sql') FROM dual
|
||||
;
|
|
@ -1964,7 +1964,18 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
// auto delay capture authorization payment
|
||||
if (isSOTrx() && !isReversal())
|
||||
{
|
||||
int[] ids = MPaymentTransaction.getAuthorizationPaymentTransactionIDs(getC_Order_ID(), getC_Invoice_ID(), get_TrxName());
|
||||
StringBuilder whereClause = new StringBuilder();
|
||||
whereClause.append("C_Order_ID IN (");
|
||||
whereClause.append("SELECT C_Order_ID ");
|
||||
whereClause.append("FROM C_OrderLine ");
|
||||
whereClause.append("WHERE C_OrderLine_ID IN (");
|
||||
whereClause.append("SELECT C_OrderLine_ID ");
|
||||
whereClause.append("FROM C_InvoiceLine ");
|
||||
whereClause.append("WHERE C_Invoice_ID = ");
|
||||
whereClause.append(getC_Invoice_ID()).append("))");
|
||||
int[] orderIDList = MOrder.getAllIDs(MOrder.Table_Name, whereClause.toString(), get_TrxName());
|
||||
|
||||
int[] ids = MPaymentTransaction.getAuthorizationPaymentTransactionIDs(orderIDList, getC_Invoice_ID(), get_TrxName());
|
||||
if (ids.length > 0)
|
||||
{
|
||||
ArrayList<MPaymentTransaction> ptList = new ArrayList<MPaymentTransaction>();
|
||||
|
@ -1972,8 +1983,6 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
for (int id : ids)
|
||||
{
|
||||
MPaymentTransaction pt = new MPaymentTransaction(Env.getCtx(), id, get_TrxName());
|
||||
|
||||
|
||||
totalPayAmt = totalPayAmt.add(pt.getPayAmt());
|
||||
ptList.add(pt);
|
||||
}
|
||||
|
|
|
@ -443,11 +443,23 @@ public class MPackage extends X_M_Package
|
|||
sb.append("FROM M_InOutLine ");
|
||||
sb.append("WHERE M_InOut_ID = ?) ");
|
||||
sb.append("ORDER BY C_OrderLine_ID DESC");
|
||||
int C_Invoice_ID = DB.getSQLValue(get_TrxName(), sb.toString(), getM_InOut_ID());
|
||||
if (C_Invoice_ID > 0)
|
||||
invoice = new MInvoice(getCtx(), C_Invoice_ID, get_TrxName());
|
||||
int C_Order_ID = DB.getSQLValue(get_TrxName(), sb.toString(), getM_InOut_ID());
|
||||
if (C_Order_ID > 0)
|
||||
order = new MOrder(getCtx(), C_Order_ID, get_TrxName());
|
||||
}
|
||||
}
|
||||
|
||||
if (invoice == null && order != null)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("SELECT C_Invoice_ID ");
|
||||
sb.append("FROM C_Invoice ");
|
||||
sb.append("WHERE C_Order_ID = ? ");
|
||||
sb.append("ORDER BY C_Invoice_ID DESC");
|
||||
int C_Invoice_ID = DB.getSQLValue(get_TrxName(), sb.toString(), order.getC_Order_ID());
|
||||
if (C_Invoice_ID > 0)
|
||||
invoice = new MInvoice(getCtx(), C_Invoice_ID, get_TrxName());
|
||||
}
|
||||
}
|
||||
|
||||
MClientInfo ci = MClientInfo.get(getCtx(), getAD_Client_ID(), get_TrxName());
|
||||
|
|
|
@ -644,4 +644,32 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
|
|||
|
||||
return MPaymentTransaction.getAllIDs(Table_Name, whereClause.toString(), trxName);
|
||||
}
|
||||
|
||||
public static int[] getAuthorizationPaymentTransactionIDs(int[] orderIDList, int C_Invoice_ID, String trxName)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (orderIDList != null)
|
||||
{
|
||||
for (int orderID : orderIDList)
|
||||
sb.append(orderID).append(",");
|
||||
}
|
||||
|
||||
String orderIDs = sb.toString();
|
||||
if (orderIDs.length() > 0)
|
||||
orderIDs = orderIDs.substring(0, orderIDs.length() - 1);
|
||||
|
||||
StringBuilder whereClause = new StringBuilder();
|
||||
whereClause.append("TenderType='").append(MPaymentTransaction.TENDERTYPE_CreditCard).append("' ");
|
||||
whereClause.append("AND TrxType='").append(MPaymentTransaction.TRXTYPE_Authorization).append("' ");
|
||||
if (orderIDs.length() > 0 && C_Invoice_ID > 0)
|
||||
whereClause.append(" AND (C_Order_ID IN (").append(orderIDs).append(") OR C_Invoice_ID=").append(C_Invoice_ID).append(")");
|
||||
else if (orderIDs.length() > 0)
|
||||
whereClause.append(" AND C_Order_ID IN ('").append(orderIDs).append(")");
|
||||
else if (C_Invoice_ID > 0)
|
||||
whereClause.append(" AND C_Invoice_ID=").append(C_Invoice_ID);
|
||||
whereClause.append(" AND IsApproved='Y' AND IsVoided='N' AND IsDelayedCapture='N' ");
|
||||
whereClause.append("ORDER BY DateTrx DESC");
|
||||
|
||||
return MPaymentTransaction.getAllIDs(Table_Name, whereClause.toString(), trxName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -216,6 +216,7 @@ public abstract class PaymentForm implements IPaymentForm {
|
|||
{
|
||||
int retValue = 0;
|
||||
String sql = "SELECT C_Invoice_ID FROM C_Invoice WHERE C_Order_ID=? "
|
||||
+ "AND DocStatus NOT IN ('VO','RE') "
|
||||
+ "ORDER BY C_Invoice_ID DESC"; // last invoice
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
|
Loading…
Reference in New Issue