hg merge release-1.0c (merge release1 into release2)

This commit is contained in:
Carlos Ruiz 2014-02-15 11:39:39 -05:00
commit 9cecab37f3
15 changed files with 244 additions and 34 deletions

View File

@ -1639,6 +1639,7 @@ from c_acctprocessor
where not exists (select 1 from ad_schedule where
coalesce(c_acctprocessor.frequencytype,' ') =coalesce(ad_schedule.frequencytype,' ') and
coalesce(c_acctprocessor.frequency,-1) =coalesce(ad_schedule.frequency,-1)
and ad_schedule.scheduletype='F'
)
)
;
@ -1653,6 +1654,7 @@ from ad_alertprocessor
where not exists (select 1 from ad_schedule where
coalesce(ad_alertprocessor.frequencytype,' ') =coalesce(ad_schedule.frequencytype,' ') and
coalesce(ad_alertprocessor.frequency,-1) =coalesce(ad_schedule.frequency,-1)
and ad_schedule.scheduletype='F'
)
)
;
@ -1667,6 +1669,7 @@ from r_requestprocessor
where not exists (select 1 from ad_schedule where
coalesce(r_requestprocessor.frequencytype,' ') =coalesce(ad_schedule.frequencytype,' ') and
coalesce(r_requestprocessor.frequency,-1) =coalesce(ad_schedule.frequency,-1)
and ad_schedule.scheduletype='F'
)
)
;
@ -1681,6 +1684,7 @@ from ad_workflowprocessor
where not exists (select 1 from ad_schedule where
coalesce(ad_workflowprocessor.frequencytype,' ') =coalesce(ad_schedule.frequencytype,' ') and
coalesce(ad_workflowprocessor.frequency,-1) =coalesce(ad_schedule.frequency,-1)
and ad_schedule.scheduletype='F'
)
)
;

View File

@ -1639,6 +1639,7 @@ from c_acctprocessor
where not exists (select 1 from ad_schedule where
coalesce(c_acctprocessor.frequencytype,' ') =coalesce(ad_schedule.frequencytype,' ') and
coalesce(c_acctprocessor.frequency,-1) =coalesce(ad_schedule.frequency,-1)
and ad_schedule.scheduletype='F'
)
) as x
;
@ -1653,6 +1654,7 @@ from ad_alertprocessor
where not exists (select 1 from ad_schedule where
coalesce(ad_alertprocessor.frequencytype,' ') =coalesce(ad_schedule.frequencytype,' ') and
coalesce(ad_alertprocessor.frequency,-1) =coalesce(ad_schedule.frequency,-1)
and ad_schedule.scheduletype='F'
)
) as x
;
@ -1667,6 +1669,7 @@ from r_requestprocessor
where not exists (select 1 from ad_schedule where
coalesce(r_requestprocessor.frequencytype,' ') =coalesce(ad_schedule.frequencytype,' ') and
coalesce(r_requestprocessor.frequency,-1) =coalesce(ad_schedule.frequency,-1)
and ad_schedule.scheduletype='F'
)
) as x
;
@ -1681,6 +1684,7 @@ from ad_workflowprocessor
where not exists (select 1 from ad_schedule where
coalesce(ad_workflowprocessor.frequencytype,' ') =coalesce(ad_schedule.frequencytype,' ') and
coalesce(ad_workflowprocessor.frequency,-1) =coalesce(ad_schedule.frequency,-1)
and ad_schedule.scheduletype='F'
)
) as x
;

View File

@ -0,0 +1,11 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Feb 11, 2014 5:56:46 PM COT
-- IDEMPIERE-1724 Field C_Charge_ID in table C_OrderLine has wrong dynamic Validation
UPDATE AD_Column SET AD_Val_Rule_ID=52030,Updated=TO_DATE('2014-02-11 17:56:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3050
;
SELECT register_migration_script('201402111757_IDEMPIERE-1724.sql') FROM dual
;

View File

@ -0,0 +1,55 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Feb 15, 2014 11:34:30 AM COT
-- IDEMPIERE-1755 when copy a user some field should reset
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2014-02-15 11:34:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200458
;
-- Feb 15, 2014 11:35:12 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2014-02-15 11:35:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200405
;
-- Feb 15, 2014 11:35:19 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2014-02-15 11:35:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200408
;
-- Feb 15, 2014 11:35:23 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2014-02-15 11:35:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200407
;
-- Feb 15, 2014 11:35:46 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2014-02-15 11:35:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200406
;
-- Feb 15, 2014 11:35:55 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2014-02-15 11:35:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200456
;
-- Feb 15, 2014 11:36:03 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2014-02-15 11:36:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200404
;
-- Feb 15, 2014 11:36:14 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2014-02-15 11:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200409
;
-- Feb 15, 2014 11:36:31 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2014-02-15 11:36:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=417
;
-- Feb 15, 2014 11:36:38 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2014-02-15 11:36:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=61756
;
-- Feb 15, 2014 11:36:43 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2014-02-15 11:36:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200457
;
-- Feb 15, 2014 11:36:51 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2014-02-15 11:36:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=52066
;
SELECT register_migration_script('201402151138_IDEMPIERE-1755.sql') FROM dual
;

View File

@ -0,0 +1,8 @@
-- Feb 11, 2014 5:56:46 PM COT
-- IDEMPIERE-1724 Field C_Charge_ID in table C_OrderLine has wrong dynamic Validation
UPDATE AD_Column SET AD_Val_Rule_ID=52030,Updated=TO_TIMESTAMP('2014-02-11 17:56:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3050
;
SELECT register_migration_script('201402111757_IDEMPIERE-1724.sql') FROM dual
;

View File

@ -0,0 +1,52 @@
-- Feb 15, 2014 11:34:30 AM COT
-- IDEMPIERE-1755 when copy a user some field should reset
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2014-02-15 11:34:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200458
;
-- Feb 15, 2014 11:35:12 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2014-02-15 11:35:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200405
;
-- Feb 15, 2014 11:35:19 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2014-02-15 11:35:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200408
;
-- Feb 15, 2014 11:35:23 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2014-02-15 11:35:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200407
;
-- Feb 15, 2014 11:35:46 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2014-02-15 11:35:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200406
;
-- Feb 15, 2014 11:35:55 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2014-02-15 11:35:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200456
;
-- Feb 15, 2014 11:36:03 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2014-02-15 11:36:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200404
;
-- Feb 15, 2014 11:36:14 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2014-02-15 11:36:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200409
;
-- Feb 15, 2014 11:36:31 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2014-02-15 11:36:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=417
;
-- Feb 15, 2014 11:36:38 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2014-02-15 11:36:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=61756
;
-- Feb 15, 2014 11:36:43 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2014-02-15 11:36:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200457
;
-- Feb 15, 2014 11:36:51 AM COT
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2014-02-15 11:36:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=52066
;
SELECT register_migration_script('201402151138_IDEMPIERE-1755.sql') FROM dual
;

View File

@ -153,7 +153,7 @@ public class CalloutRMA extends CalloutEngine {
invoice.getDateInvoiced(), invoice.getDateInvoiced(),
AD_Org_ID, rma.getShipment().getM_Warehouse_ID(),
invoice.getC_BPartner_Location_ID(), // should be bill to
invoice.getC_BPartner_Location_ID(), rma.isSOTrx());
invoice.getC_BPartner_Location_ID(), rma.isSOTrx(), null);
}
else
{
@ -168,7 +168,7 @@ public class CalloutRMA extends CalloutEngine {
order.getDateOrdered(), order.getDateOrdered(),
AD_Org_ID, order.getM_Warehouse_ID(),
order.getC_BPartner_Location_ID(), // should be bill to
order.getC_BPartner_Location_ID(), rma.isSOTrx());
order.getC_BPartner_Location_ID(), rma.isSOTrx(), null);
}
else
return "No Invoice/Order found the Shipment/Receipt associated";

View File

@ -477,7 +477,7 @@ public class CalloutInvoice extends CalloutEngine
//
int C_Tax_ID = Tax.get(ctx, M_Product_ID, C_Charge_ID, billDate, shipDate,
AD_Org_ID, M_Warehouse_ID, billC_BPartner_Location_ID, shipC_BPartner_Location_ID,
Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"));
Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"), null);
if (log.isLoggable(Level.INFO)) log.info("Tax ID=" + C_Tax_ID);
//
if (C_Tax_ID == 0)

View File

@ -323,7 +323,7 @@ public class CalloutInvoiceBatch extends CalloutEngine
//
int C_Tax_ID = Tax.get(ctx, 0, C_Charge_ID, billDate, shipDate,
AD_Org_ID, M_Warehouse_ID, C_BPartner_Location_ID, C_BPartner_Location_ID,
Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"));
Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"), null);
if (log.isLoggable(Level.INFO)) log.info("Tax ID=" + C_Tax_ID);
//
if (C_Tax_ID == 0)

View File

@ -1002,7 +1002,7 @@ public class CalloutOrder extends CalloutEngine
//
int C_Tax_ID = Tax.get (ctx, M_Product_ID, C_Charge_ID, billDate, shipDate,
AD_Org_ID, M_Warehouse_ID, billC_BPartner_Location_ID, shipC_BPartner_Location_ID,
"Y".equals(Env.getContext(ctx, WindowNo, "IsSOTrx")));
"Y".equals(Env.getContext(ctx, WindowNo, "IsSOTrx")), null);
if (log.isLoggable(Level.INFO)) log.info("Tax ID=" + C_Tax_ID);
//
if (C_Tax_ID == 0)

View File

@ -437,7 +437,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
int C_Tax_ID = Tax.get(getCtx(), getM_Product_ID(), getC_Charge_ID() , m_DateInvoiced, m_DateInvoiced,
getAD_Org_ID(), M_Warehouse_ID,
m_C_BPartner_Location_ID, // should be bill to
m_C_BPartner_Location_ID, m_IsSOTrx);
m_C_BPartner_Location_ID, m_IsSOTrx, get_TrxName());
if (C_Tax_ID == 0)
{
log.log(Level.SEVERE, "No Tax found");

View File

@ -341,7 +341,7 @@ public class MOrderLine extends X_C_OrderLine
int ii = Tax.get(getCtx(), getM_Product_ID(), getC_Charge_ID(), getDateOrdered(), getDateOrdered(),
getAD_Org_ID(), getM_Warehouse_ID(),
getC_BPartner_Location_ID(), // should be bill to
getC_BPartner_Location_ID(), m_IsSOTrx);
getC_BPartner_Location_ID(), m_IsSOTrx, get_TrxName());
if (ii == 0)
{
log.log(Level.SEVERE, "No Tax found");

View File

@ -159,7 +159,7 @@ public class MRMALine extends X_M_RMALine
taxId = Tax.get(getCtx(), getM_Product_ID(), getC_Charge_ID(), invoice.getDateInvoiced(), invoice.getDateInvoiced(),
getAD_Org_ID(), getParent().getShipment().getM_Warehouse_ID(),
invoice.getC_BPartner_Location_ID(), // should be bill to
invoice.getC_BPartner_Location_ID(), getParent().isSOTrx());
invoice.getC_BPartner_Location_ID(), getParent().isSOTrx(), get_TrxName());
}
else
{
@ -173,7 +173,7 @@ public class MRMALine extends X_M_RMALine
taxId = Tax.get(getCtx(), getM_Product_ID(), getC_Charge_ID(), order.getDateOrdered(), order.getDateOrdered(),
getAD_Org_ID(), order.getM_Warehouse_ID(),
order.getC_BPartner_Location_ID(), // should be bill to
order.getC_BPartner_Location_ID(), getParent().isSOTrx());
order.getC_BPartner_Location_ID(), getParent().isSOTrx(), get_TrxName());
}
else
throw new IllegalStateException("No Invoice/Order found the Shipment/Receipt associated");

View File

@ -47,6 +47,30 @@ public class Tax
static private CLogger log = CLogger.getCLogger (Tax.class);
/**
*
* @param ctx
* @param M_Product_ID
* @param C_Charge_ID
* @param billDate
* @param shipDate
* @param AD_Org_ID
* @param M_Warehouse_ID
* @param billC_BPartner_Location_ID
* @param shipC_BPartner_Location_ID
* @param IsSOTrx
* @deprecated
* @return
*/
public static int get (Properties ctx, int M_Product_ID, int C_Charge_ID,
Timestamp billDate, Timestamp shipDate,
int AD_Org_ID, int M_Warehouse_ID,
int billC_BPartner_Location_ID, int shipC_BPartner_Location_ID,
boolean IsSOTrx) {
return get(ctx, M_Product_ID, C_Charge_ID, billDate, shipDate, AD_Org_ID, M_Warehouse_ID, billC_BPartner_Location_ID, shipC_BPartner_Location_ID, IsSOTrx, null);
}
/**************************************************************************
* Get Tax ID - converts parameters to call Get Tax.
* <pre>
@ -76,18 +100,41 @@ public class Tax
Timestamp billDate, Timestamp shipDate,
int AD_Org_ID, int M_Warehouse_ID,
int billC_BPartner_Location_ID, int shipC_BPartner_Location_ID,
boolean IsSOTrx)
boolean IsSOTrx, String trxName)
{
if (M_Product_ID != 0)
return getProduct (ctx, M_Product_ID, billDate, shipDate, AD_Org_ID, M_Warehouse_ID,
billC_BPartner_Location_ID, shipC_BPartner_Location_ID, IsSOTrx);
billC_BPartner_Location_ID, shipC_BPartner_Location_ID, IsSOTrx, trxName);
else if (C_Charge_ID != 0)
return getCharge (ctx, C_Charge_ID, billDate, shipDate, AD_Org_ID, M_Warehouse_ID,
billC_BPartner_Location_ID, shipC_BPartner_Location_ID, IsSOTrx);
billC_BPartner_Location_ID, shipC_BPartner_Location_ID, IsSOTrx, trxName);
else
return getExemptTax (ctx, AD_Org_ID);
return getExemptTax (ctx, AD_Org_ID, trxName);
} // get
/**
*
* @param ctx
* @param C_Charge_ID
* @param billDate
* @param shipDate
* @param AD_Org_ID
* @param M_Warehouse_ID
* @param billC_BPartner_Location_ID
* @param shipC_BPartner_Location_ID
* @param IsSOTrx
* @return
* @deprecated
*/
public static int getCharge (Properties ctx, int C_Charge_ID,
Timestamp billDate, Timestamp shipDate,
int AD_Org_ID, int M_Warehouse_ID,
int billC_BPartner_Location_ID, int shipC_BPartner_Location_ID,
boolean IsSOTrx) {
return getCharge(ctx, C_Charge_ID, billDate, shipDate, AD_Org_ID, M_Warehouse_ID, billC_BPartner_Location_ID, shipC_BPartner_Location_ID, IsSOTrx, null);
}
/**
* Get Tax ID - converts parameters to call Get Tax.
* <pre>
@ -118,7 +165,7 @@ public class Tax
Timestamp billDate, Timestamp shipDate,
int AD_Org_ID, int M_Warehouse_ID,
int billC_BPartner_Location_ID, int shipC_BPartner_Location_ID,
boolean IsSOTrx)
boolean IsSOTrx, String trxName)
{
/* ship location from warehouse is plainly ignored below */
// if (M_Warehouse_ID <= 0)
@ -152,7 +199,7 @@ public class Tax
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement (sql, null);
pstmt = DB.prepareStatement (sql, trxName);
pstmt.setInt (1, M_Warehouse_ID);
pstmt.setInt (2, C_Charge_ID);
pstmt.setInt (3, AD_Org_ID);
@ -182,7 +229,7 @@ public class Tax
}
else if ("Y".equals (IsTaxExempt))
{
return getExemptTax (ctx, AD_Org_ID);
return getExemptTax (ctx, AD_Org_ID, trxName);
}
}
catch (SQLException e)
@ -213,10 +260,32 @@ public class Tax
+ ", shipToC_Location_ID=" + shipToC_Location_ID);
return get (ctx, C_TaxCategory_ID, IsSOTrx,
shipDate, shipFromC_Location_ID, shipToC_Location_ID,
billDate, billFromC_Location_ID, billToC_Location_ID);
billDate, billFromC_Location_ID, billToC_Location_ID, trxName);
} // getCharge
/**
*
* @param ctx
* @param M_Product_ID
* @param billDate
* @param shipDate
* @param AD_Org_ID
* @param M_Warehouse_ID
* @param billC_BPartner_Location_ID
* @param shipC_BPartner_Location_ID
* @param IsSOTrx
* @return
* @deprecated
*/
public static int getProduct (Properties ctx, int M_Product_ID,
Timestamp billDate, Timestamp shipDate,
int AD_Org_ID, int M_Warehouse_ID,
int billC_BPartner_Location_ID, int shipC_BPartner_Location_ID,
boolean IsSOTrx) {
return getProduct(ctx, M_Product_ID, billDate, shipDate, AD_Org_ID, M_Warehouse_ID, billC_BPartner_Location_ID, shipC_BPartner_Location_ID, IsSOTrx, null);
}
/**
* Get Tax ID - converts parameters to call Get Tax.
* <pre>
@ -246,7 +315,7 @@ public class Tax
Timestamp billDate, Timestamp shipDate,
int AD_Org_ID, int M_Warehouse_ID,
int billC_BPartner_Location_ID, int shipC_BPartner_Location_ID,
boolean IsSOTrx)
boolean IsSOTrx, String trxName)
{
String variable = "";
int C_TaxCategory_ID = 0;
@ -273,7 +342,7 @@ public class Tax
+ " AND o.AD_Org_ID=?"
+ " AND il.C_BPartner_Location_ID=?"
+ " AND sl.C_BPartner_Location_ID=?";
pstmt = DB.prepareStatement(sql, null);
pstmt = DB.prepareStatement(sql, trxName);
pstmt.setInt(1, M_Warehouse_ID);
pstmt.setInt(2, M_Product_ID);
pstmt.setInt(3, AD_Org_ID);
@ -298,7 +367,7 @@ public class Tax
if (found && "Y".equals(IsTaxExempt))
{
if (log.isLoggable(Level.FINE)) log.fine("getProduct - Business Partner is Tax exempt");
return getExemptTax(ctx, AD_Org_ID);
return getExemptTax(ctx, AD_Org_ID, trxName);
}
else if (found)
{
@ -318,7 +387,7 @@ public class Tax
+ ", shipToC_Location_ID=" + shipToC_Location_ID);
return get(ctx, C_TaxCategory_ID, IsSOTrx,
shipDate, shipFromC_Location_ID, shipToC_Location_ID,
billDate, billFromC_Location_ID, billToC_Location_ID);
billDate, billFromC_Location_ID, billToC_Location_ID, trxName);
}
// ----------------------------------------------------------------
@ -328,7 +397,7 @@ public class Tax
// M_Product_ID -> C_TaxCategory_ID
variable = "M_Product_ID";
sql = "SELECT C_TaxCategory_ID FROM M_Product WHERE M_Product_ID=?";
C_TaxCategory_ID = DB.getSQLValueEx(null, sql, M_Product_ID);
C_TaxCategory_ID = DB.getSQLValueEx(trxName, sql, M_Product_ID);
found = C_TaxCategory_ID != -1;
if (C_TaxCategory_ID <= 0)
{
@ -339,7 +408,7 @@ public class Tax
// AD_Org_ID -> billFromC_Location_ID
variable = "AD_Org_ID";
sql = "SELECT C_Location_ID FROM AD_OrgInfo WHERE AD_Org_ID=?";
billFromC_Location_ID = DB.getSQLValueEx(null, sql, AD_Org_ID);
billFromC_Location_ID = DB.getSQLValueEx(trxName, sql, AD_Org_ID);
found = billFromC_Location_ID != -1;
if (billFromC_Location_ID <= 0)
{
@ -352,7 +421,7 @@ public class Tax
+ " FROM C_BPartner_Location l"
+ " INNER JOIN C_BPartner b ON (l.C_BPartner_ID=b.C_BPartner_ID) "
+ " WHERE C_BPartner_Location_ID=?";
pstmt = DB.prepareStatement(sql, null);
pstmt = DB.prepareStatement(sql, trxName);
pstmt.setInt(1, billC_BPartner_Location_ID);
rs = pstmt.executeQuery();
found = false;
@ -370,7 +439,7 @@ public class Tax
throw new TaxCriteriaNotFoundException(variable, billC_BPartner_Location_ID);
}
if ("Y".equals(IsTaxExempt))
return getExemptTax(ctx, AD_Org_ID);
return getExemptTax(ctx, AD_Org_ID, trxName);
// Reverse for PO
if (!IsSOTrx)
@ -389,7 +458,7 @@ public class Tax
// M_Warehouse_ID -> shipFromC_Location_ID
variable = "M_Warehouse_ID";
sql = "SELECT C_Location_ID FROM M_Warehouse WHERE M_Warehouse_ID=?";
shipFromC_Location_ID = DB.getSQLValueEx(null, sql, M_Warehouse_ID);
shipFromC_Location_ID = DB.getSQLValueEx(trxName, sql, M_Warehouse_ID);
found = shipFromC_Location_ID != -1;
if (shipFromC_Location_ID <= 0)
{
@ -399,7 +468,7 @@ public class Tax
// shipC_BPartner_Location_ID -> shipToC_Location_ID
variable = "C_BPartner_Location_ID";
sql = "SELECT C_Location_ID FROM C_BPartner_Location WHERE C_BPartner_Location_ID=?";
shipToC_Location_ID = DB.getSQLValueEx(null, sql, shipC_BPartner_Location_ID);
shipToC_Location_ID = DB.getSQLValueEx(trxName, sql, shipC_BPartner_Location_ID);
found = shipToC_Location_ID != -1;
if (shipToC_Location_ID <= 0)
{
@ -428,24 +497,25 @@ public class Tax
return get (ctx, C_TaxCategory_ID, IsSOTrx,
shipDate, shipFromC_Location_ID, shipToC_Location_ID,
billDate, billFromC_Location_ID, billToC_Location_ID);
billDate, billFromC_Location_ID, billToC_Location_ID, trxName);
} // getProduct
/**
* Get Exempt Tax Code
* @param ctx context
* @param AD_Org_ID org to find client
* @param trxName Transaction
* @return C_Tax_ID
* @throws TaxNoExemptFoundException if no tax exempt found
*/
private static int getExemptTax (Properties ctx, int AD_Org_ID)
private static int getExemptTax (Properties ctx, int AD_Org_ID, String trxName)
{
final String sql = "SELECT t.C_Tax_ID "
+ "FROM C_Tax t"
+ " INNER JOIN AD_Org o ON (t.AD_Client_ID=o.AD_Client_ID) "
+ "WHERE t.IsTaxExempt='Y' AND o.AD_Org_ID=? "
+ "ORDER BY t.Rate DESC";
int C_Tax_ID = DB.getSQLValueEx(null, sql, AD_Org_ID);
int C_Tax_ID = DB.getSQLValueEx(trxName, sql, AD_Org_ID);
if (log.isLoggable(Level.FINE)) log.fine("getExemptTax - TaxExempt=Y - C_Tax_ID=" + C_Tax_ID);
if (C_Tax_ID <= 0)
{
@ -469,13 +539,14 @@ public class Tax
* @param billDate invoice date
* @param billFromC_Location_ID invoice from
* @param billToC_Location_ID invoice to
* @param trxName Transaction
* @return C_Tax_ID
* @throws TaxNotFoundException if no tax found for given criteria
*/
protected static int get (Properties ctx,
int C_TaxCategory_ID, boolean IsSOTrx,
Timestamp shipDate, int shipFromC_Location_ID, int shipToC_Location_ID,
Timestamp billDate, int billFromC_Location_ID, int billToC_Location_ID)
Timestamp billDate, int billFromC_Location_ID, int billToC_Location_ID, String trxName)
{
// C_TaxCategory contains CommodityCode
@ -490,8 +561,8 @@ public class Tax
}
MTax[] taxes = MTax.getAll (ctx);
MLocation lFrom = new MLocation (ctx, billFromC_Location_ID, null);
MLocation lTo = new MLocation (ctx, billToC_Location_ID, null);
MLocation lFrom = new MLocation (ctx, billFromC_Location_ID, trxName);
MLocation lTo = new MLocation (ctx, billToC_Location_ID, trxName);
if (log.isLoggable(Level.FINER)){
log.finer("From=" + lFrom);
log.finer("To=" + lTo);

View File

@ -1498,7 +1498,12 @@ public class Login
sql.append(" AND r.IsMasterRole='N'");
sql.append(" AND u.IsActive='Y' AND EXISTS (SELECT * FROM AD_Client c WHERE u.AD_Client_ID=c.AD_Client_ID AND c.IsActive='Y')");
// don't show roles without org access
sql.append(" AND (r.isaccessallorgs='Y' OR EXISTS (SELECT 1 FROM AD_Role_OrgAccess ro WHERE ro.AD_Role_ID=r.AD_Role_ID AND ro.IsActive='Y'))");
sql.append(" AND (");
sql.append(" (r.isaccessallorgs='Y' OR EXISTS (SELECT 1 FROM AD_Role_OrgAccess ro WHERE ro.AD_Role_ID=r.AD_Role_ID AND ro.IsActive='Y'))");
// show roll with isuseuserorgaccess = "Y" when Exist org in AD_User_Orgaccess
sql.append(" OR ");
sql.append(" (r.isuseuserorgaccess='Y' AND EXISTS (SELECT 1 FROM AD_User_Orgaccess uo WHERE uo.AD_User_ID=u.AD_User_ID AND uo.IsActive='Y')) ");
sql.append(")");
sql.append(" ORDER BY r.Name");
PreparedStatement pstmt = null;