hg merge release-2.0 (merge release2 into development)

This commit is contained in:
Carlos Ruiz 2014-03-12 23:07:54 -05:00
commit bc9b8049bc
26 changed files with 299 additions and 90 deletions

View File

@ -27,7 +27,7 @@ WHERE (o.DocStatus = 'CO' AND o.IsDelivered='N') -- Status must be CO - not CL
-- Not confirmed shipment -- Not confirmed shipment
AND NOT EXISTS (SELECT * FROM M_InOutLine iol AND NOT EXISTS (SELECT * FROM M_InOutLine iol
INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID) INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID)
WHERE iol.C_OrderLine_ID=l.C_OrderLine_ID AND io.DocStatus IN ('IP','WC')) WHERE iol.C_OrderLine_ID=l.C_OrderLine_ID AND io.DocStatus IN ('DR','IN','IP','WC'))
-- --
GROUP BY o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID, GROUP BY o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID,
o.DocumentNo, o.DateOrdered, o.C_DocType_ID, o.DocumentNo, o.DateOrdered, o.C_DocType_ID,

View File

@ -27,7 +27,7 @@ WHERE (o.DocStatus = 'CO' AND o.IsDelivered='N') -- Status must be CO - not CL
-- Not confirmed shipment -- Not confirmed shipment
AND NOT EXISTS (SELECT * FROM M_InOutLine iol AND NOT EXISTS (SELECT * FROM M_InOutLine iol
INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID) INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID)
WHERE iol.C_OrderLine_ID=l.C_OrderLine_ID AND io.DocStatus IN ('IP','WC')) WHERE iol.C_OrderLine_ID=l.C_OrderLine_ID AND io.DocStatus IN ('DR','IN','IP','WC'))
-- --
GROUP BY o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID, GROUP BY o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID,
o.DocumentNo, o.DateOrdered, o.C_DocType_ID, o.DocumentNo, o.DateOrdered, o.C_DocType_ID,

View File

@ -0,0 +1,10 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Feb 10, 2014 1:01:33 AM ICT
-- IDEMPIERE-1712:Field "Event Change Log" of "Change Audit" window is not read only.
UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_DATE('2014-02-10 01:01:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54397
;
SELECT register_migration_script('201402101604-IDEMPIERE-1712.sql') FROM dual
;

View File

@ -0,0 +1,43 @@
-- IDEMPIERE-1144 Generating shipments from existing orders fails if product has mandatory attribute set
CREATE OR REPLACE VIEW M_INOUT_CANDIDATE_V
(AD_CLIENT_ID, AD_ORG_ID, C_BPARTNER_ID, C_ORDER_ID, DOCUMENTNO,
DATEORDERED, C_DOCTYPE_ID, POREFERENCE, DESCRIPTION, SALESREP_ID,
M_WAREHOUSE_ID, TOTALLINES)
AS
SELECT
o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID,
o.DocumentNo, o.DateOrdered, o.C_DocType_ID,
o.POReference, o.Description, o.SalesRep_ID,
l.M_Warehouse_ID,
SUM((l.QtyOrdered-l.QtyDelivered)*l.PriceActual) AS TotalLines
FROM C_Order o
INNER JOIN C_OrderLine l ON (o.C_Order_ID=l.C_Order_ID)
WHERE (o.DocStatus = 'CO' AND o.IsDelivered='N') -- Status must be CO - not CL/RE
-- not Offers and open Walkin-Receipts
AND o.C_DocType_ID IN (SELECT C_DocType_ID FROM C_DocType
WHERE DocBaseType='SOO' AND DocSubTypeSO NOT IN ('ON','OB','WR'))
-- Delivery Rule - not manual
AND o.DeliveryRule<>'M'
AND (l.M_Product_ID IS NULL OR EXISTS
(SELECT * FROM M_Product p
WHERE l.M_Product_ID=p.M_Product_ID AND p.IsExcludeAutoDelivery='N'))
-- we need to ship
AND l.QtyOrdered <> l.QtyDelivered
AND o.IsDropShip='N'
AND (l.M_Product_ID IS NOT NULL OR l.C_Charge_ID IS NOT NULL)
-- Not confirmed shipment
AND NOT EXISTS (SELECT * FROM M_InOutLine iol
INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID)
WHERE iol.C_OrderLine_ID=l.C_OrderLine_ID AND io.DocStatus IN ('DR','IN','IP','WC'))
--
GROUP BY o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID,
o.DocumentNo, o.DateOrdered, o.C_DocType_ID,
o.POReference, o.Description, o.SalesRep_ID, l.M_Warehouse_ID
;
SELECT register_migration_script('201403122133_IDEMPIERE-1144.sql') FROM dual
;

View File

@ -0,0 +1,30 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Dec 26, 2013 10:24:08 PM ICT
-- IDEMPIERE-1646 Make filter price list (SO/PO) in BP and BP group
INSERT INTO AD_Val_Rule (Code,AD_Val_Rule_ID,EntityType,Name,Description,Type,AD_Val_Rule_UU,CreatedBy,UpdatedBy,Updated,Created,AD_Org_ID,IsActive,AD_Client_ID) VALUES ('M_PriceList.IsSOPriceList = ''Y'' AND (SELECT COUNT(*) FROM M_PriceList_Version WHERE M_PriceList.M_PriceList_ID=M_PriceList_Version.M_PriceList_ID AND M_PriceList_Version.IsActive=''Y'')>0',200057,'D','M_PriceList is SO','Limits the Sales & Purchase Order window to the correct price lsits','S','83715776-17dc-4e3c-87c2-3d638e43136a',100,100,TO_DATE('2013-12-26 22:24:08','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2013-12-26 22:24:08','YYYY-MM-DD HH24:MI:SS'),0,'Y',0)
;
-- Dec 26, 2013 10:24:45 PM ICT
INSERT INTO AD_Val_Rule (Code,AD_Val_Rule_ID,EntityType,Name,Description,Type,AD_Val_Rule_UU,CreatedBy,UpdatedBy,Updated,Created,AD_Org_ID,IsActive,AD_Client_ID) VALUES ('M_PriceList.IsSOPriceList = ''N'' AND (SELECT COUNT(*) FROM M_PriceList_Version WHERE M_PriceList.M_PriceList_ID=M_PriceList_Version.M_PriceList_ID AND M_PriceList_Version.IsActive=''Y'')>0',200058,'D','M_PriceList is PO','Limits the Sales & Purchase Order window to the correct price lsits','S','efc89c8e-b74b-4ded-85b1-d266fa967194',100,100,TO_DATE('2013-12-26 22:24:45','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2013-12-26 22:24:45','YYYY-MM-DD HH24:MI:SS'),0,'Y',0)
;
-- Dec 26, 2013 10:25:20 PM ICT
UPDATE AD_Column SET AD_Val_Rule_ID=200057,Updated=TO_DATE('2013-12-26 22:25:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2930
;
-- Dec 26, 2013 10:26:04 PM ICT
UPDATE AD_Column SET AD_Val_Rule_ID=200058,Updated=TO_DATE('2013-12-26 22:26:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2931
;
-- Dec 27, 2013 10:32:02 AM ICT
UPDATE AD_Column SET AD_Val_Rule_ID=200058,Updated=TO_DATE('2013-12-27 10:32:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=14637
;
-- Dec 27, 2013 10:32:10 AM ICT
UPDATE AD_Column SET AD_Val_Rule_ID=200057,Updated=TO_DATE('2013-12-27 10:32:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=14636
;
SELECT register_migration_script('201403122207-IDEMPIERE-1646.sql') FROM dual
;

View File

@ -0,0 +1,7 @@
-- Feb 10, 2014 1:01:33 AM ICT
-- IDEMPIERE-1712:Field "Event Change Log" of "Change Audit" window is not read only.
UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2014-02-10 01:01:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54397
;
SELECT register_migration_script('201402101604-IDEMPIERE-1712.sql') FROM dual
;

View File

@ -0,0 +1,43 @@
-- IDEMPIERE-1144 Generating shipments from existing orders fails if product has mandatory attribute set
CREATE OR REPLACE VIEW M_INOUT_CANDIDATE_V
(AD_CLIENT_ID, AD_ORG_ID, C_BPARTNER_ID, C_ORDER_ID, DOCUMENTNO,
DATEORDERED, C_DOCTYPE_ID, POREFERENCE, DESCRIPTION, SALESREP_ID,
M_WAREHOUSE_ID, TOTALLINES)
AS
SELECT
o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID,
o.DocumentNo, o.DateOrdered, o.C_DocType_ID,
o.POReference, o.Description, o.SalesRep_ID,
l.M_Warehouse_ID,
SUM((l.QtyOrdered-l.QtyDelivered)*l.PriceActual) AS TotalLines
FROM C_Order o
INNER JOIN C_OrderLine l ON (o.C_Order_ID=l.C_Order_ID)
WHERE (o.DocStatus = 'CO' AND o.IsDelivered='N') -- Status must be CO - not CL/RE
-- not Offers and open Walkin-Receipts
AND o.C_DocType_ID IN (SELECT C_DocType_ID FROM C_DocType
WHERE DocBaseType='SOO' AND DocSubTypeSO NOT IN ('ON','OB','WR'))
-- Delivery Rule - not manual
AND o.DeliveryRule<>'M'
AND (l.M_Product_ID IS NULL OR EXISTS
(SELECT * FROM M_Product p
WHERE l.M_Product_ID=p.M_Product_ID AND p.IsExcludeAutoDelivery='N'))
-- we need to ship
AND l.QtyOrdered <> l.QtyDelivered
AND o.IsDropShip='N'
AND (l.M_Product_ID IS NOT NULL OR l.C_Charge_ID IS NOT NULL)
-- Not confirmed shipment
AND NOT EXISTS (SELECT * FROM M_InOutLine iol
INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID)
WHERE iol.C_OrderLine_ID=l.C_OrderLine_ID AND io.DocStatus IN ('DR','IN','IP','WC'))
--
GROUP BY o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID,
o.DocumentNo, o.DateOrdered, o.C_DocType_ID,
o.POReference, o.Description, o.SalesRep_ID, l.M_Warehouse_ID
;
SELECT register_migration_script('201403122133_IDEMPIERE-1144.sql') FROM dual
;

View File

@ -0,0 +1,27 @@
-- Dec 26, 2013 10:24:08 PM ICT
-- IDEMPIERE-1646 Make filter price list (SO/PO) in BP and BP group
INSERT INTO AD_Val_Rule (Code,AD_Val_Rule_ID,EntityType,Name,Description,Type,AD_Val_Rule_UU,CreatedBy,UpdatedBy,Updated,Created,AD_Org_ID,IsActive,AD_Client_ID) VALUES ('M_PriceList.IsSOPriceList = ''Y'' AND (SELECT COUNT(*) FROM M_PriceList_Version WHERE M_PriceList.M_PriceList_ID=M_PriceList_Version.M_PriceList_ID AND M_PriceList_Version.IsActive=''Y'')>0',200057,'D','M_PriceList is SO','Limits the Sales & Purchase Order window to the correct price lsits','S','83715776-17dc-4e3c-87c2-3d638e43136a',100,100,TO_TIMESTAMP('2013-12-26 22:24:08','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2013-12-26 22:24:08','YYYY-MM-DD HH24:MI:SS'),0,'Y',0)
;
-- Dec 26, 2013 10:24:45 PM ICT
INSERT INTO AD_Val_Rule (Code,AD_Val_Rule_ID,EntityType,Name,Description,Type,AD_Val_Rule_UU,CreatedBy,UpdatedBy,Updated,Created,AD_Org_ID,IsActive,AD_Client_ID) VALUES ('M_PriceList.IsSOPriceList = ''N'' AND (SELECT COUNT(*) FROM M_PriceList_Version WHERE M_PriceList.M_PriceList_ID=M_PriceList_Version.M_PriceList_ID AND M_PriceList_Version.IsActive=''Y'')>0',200058,'D','M_PriceList is PO','Limits the Sales & Purchase Order window to the correct price lsits','S','efc89c8e-b74b-4ded-85b1-d266fa967194',100,100,TO_TIMESTAMP('2013-12-26 22:24:45','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2013-12-26 22:24:45','YYYY-MM-DD HH24:MI:SS'),0,'Y',0)
;
-- Dec 26, 2013 10:25:20 PM ICT
UPDATE AD_Column SET AD_Val_Rule_ID=200057,Updated=TO_TIMESTAMP('2013-12-26 22:25:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2930
;
-- Dec 26, 2013 10:26:04 PM ICT
UPDATE AD_Column SET AD_Val_Rule_ID=200058,Updated=TO_TIMESTAMP('2013-12-26 22:26:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2931
;
-- Dec 27, 2013 10:32:02 AM ICT
UPDATE AD_Column SET AD_Val_Rule_ID=200058,Updated=TO_TIMESTAMP('2013-12-27 10:32:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=14637
;
-- Dec 27, 2013 10:32:10 AM ICT
UPDATE AD_Column SET AD_Val_Rule_ID=200057,Updated=TO_TIMESTAMP('2013-12-27 10:32:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=14636
;
SELECT register_migration_script('201403122207-IDEMPIERE-1646.sql') FROM dual
;

View File

@ -109,7 +109,7 @@ public class CalloutPaymentAllocate extends CalloutEngine
mTab.setValue("Amount", InvoiceOpen.subtract(DiscountAmt)); mTab.setValue("Amount", InvoiceOpen.subtract(DiscountAmt));
mTab.setValue("DiscountAmt", DiscountAmt); mTab.setValue("DiscountAmt", DiscountAmt);
// reset as dependent fields get reset // reset as dependent fields get reset
Env.setContext(ctx, WindowNo, "C_Invoice_ID", C_Invoice_ID.toString()); Env.setContext(ctx, WindowNo, mTab.getTabNo(), "C_Invoice_ID", C_Invoice_ID.toString());
mTab.setValue("C_Invoice_ID", C_Invoice_ID); mTab.setValue("C_Invoice_ID", C_Invoice_ID);
} }
} }
@ -146,8 +146,8 @@ public class CalloutPaymentAllocate extends CalloutEngine
{ {
if (isCalloutActive()) // assuming it is resetting value if (isCalloutActive()) // assuming it is resetting value
return ""; return "";
// No Invoice // No Invoice
int C_Invoice_ID = Env.getContextAsInt(ctx, WindowNo, "C_Invoice_ID"); int C_Invoice_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "C_Invoice_ID");
if (C_Invoice_ID == 0) if (C_Invoice_ID == 0)
return ""; return "";
// Get Info from Tab // Get Info from Tab
@ -173,8 +173,8 @@ public class CalloutPaymentAllocate extends CalloutEngine
// PayAmt - calculate write off // PayAmt - calculate write off
if (colName.equals("Amount")) if (colName.equals("Amount"))
{ {
WriteOffAmt = InvoiceAmt.subtract(Amount).subtract(DiscountAmt).subtract(OverUnderAmt); OverUnderAmt = InvoiceAmt.subtract(Amount).subtract(DiscountAmt).subtract(WriteOffAmt);
mTab.setValue("WriteOffAmt", WriteOffAmt); mTab.setValue("OverUnderAmt", OverUnderAmt);
} }
else // calculate Amount else // calculate Amount
{ {

View File

@ -57,7 +57,7 @@ public class InOutGenerate extends SvrProcess
/** Include Orders w. unconfirmed Shipments */ /** Include Orders w. unconfirmed Shipments */
private boolean p_IsUnconfirmedInOut = false; private boolean p_IsUnconfirmedInOut = false;
/** DocAction */ /** DocAction */
private String p_docAction = DocAction.ACTION_Complete; private String p_docAction = DocAction.ACTION_None;
/** Consolidate */ /** Consolidate */
private boolean p_ConsolidateDocument = true; private boolean p_ConsolidateDocument = true;
/** Shipment Date */ /** Shipment Date */
@ -123,9 +123,6 @@ public class InOutGenerate extends SvrProcess
m_movementDate = new Timestamp(System.currentTimeMillis()); m_movementDate = new Timestamp(System.currentTimeMillis());
} else } else
m_movementDate = p_DateShipped; m_movementDate = p_DateShipped;
// DocAction check
if (!DocAction.ACTION_Complete.equals(p_docAction))
p_docAction = DocAction.ACTION_Prepare;
} }
} // prepare } // prepare
@ -244,7 +241,7 @@ public class InOutGenerate extends SvrProcess
if (!p_IsUnconfirmedInOut) if (!p_IsUnconfirmedInOut)
where.append(" AND NOT EXISTS (SELECT * FROM M_InOutLine iol") where.append(" AND NOT EXISTS (SELECT * FROM M_InOutLine iol")
.append(" INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID) ") .append(" INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID) ")
.append("WHERE iol.C_OrderLine_ID=C_OrderLine.C_OrderLine_ID AND io.DocStatus IN ('IP','WC'))"); .append("WHERE iol.C_OrderLine_ID=C_OrderLine.C_OrderLine_ID AND io.DocStatus IN ('DR','IN','IP','WC'))");
// Deadlock Prevention - Order by M_Product_ID // Deadlock Prevention - Order by M_Product_ID
MOrderLine[] lines = order.getLines (where.toString(), "C_BPartner_Location_ID, M_Product_ID"); MOrderLine[] lines = order.getLines (where.toString(), "C_BPartner_Location_ID, M_Product_ID");
for (int i = 0; i < lines.length; i++) for (int i = 0; i < lines.length; i++)
@ -269,7 +266,7 @@ public class InOutGenerate extends SvrProcess
BigDecimal unconfirmedShippedQty = Env.ZERO; BigDecimal unconfirmedShippedQty = Env.ZERO;
if (p_IsUnconfirmedInOut && product != null && toDeliver.signum() != 0) if (p_IsUnconfirmedInOut && product != null && toDeliver.signum() != 0)
{ {
String where2 = "EXISTS (SELECT * FROM M_InOut io WHERE io.M_InOut_ID=M_InOutLine.M_InOut_ID AND io.DocStatus IN ('IP','WC'))"; String where2 = "EXISTS (SELECT * FROM M_InOut io WHERE io.M_InOut_ID=M_InOutLine.M_InOut_ID AND io.DocStatus IN ('DR','IN','IP','WC'))";
MInOutLine[] iols = MInOutLine.getOfOrderLine(getCtx(), MInOutLine[] iols = MInOutLine.getOfOrderLine(getCtx(),
line.getC_OrderLine_ID(), where2, null); line.getC_OrderLine_ID(), where2, null);
for (int j = 0; j < iols.length; j++) for (int j = 0; j < iols.length; j++)
@ -574,11 +571,13 @@ public class InOutGenerate extends SvrProcess
{ {
if (m_shipment != null) if (m_shipment != null)
{ {
// Fails if there is a confirmation if (!DocAction.ACTION_None.equals(p_docAction))
if (!m_shipment.processIt(p_docAction)) { {
log.warning("Failed: " + m_shipment); // Fails if there is a confirmation
throw new IllegalStateException("Shipment Process Failed: " + m_shipment + " - " + m_shipment.getProcessMsg()); if (!m_shipment.processIt(p_docAction)) {
log.warning("Failed: " + m_shipment);
throw new IllegalStateException("Shipment Process Failed: " + m_shipment + " - " + m_shipment.getProcessMsg());
}
} }
m_shipment.saveEx(); m_shipment.saveEx();
String message = Msg.parseTranslation(getCtx(), "@ShipmentProcessed@ " + m_shipment.getDocumentNo()); String message = Msg.parseTranslation(getCtx(), "@ShipmentProcessed@ " + m_shipment.getDocumentNo());

View File

@ -252,9 +252,9 @@ public class ReplenishReport extends SvrProcess
sql.append("QtyOnHand = (SELECT COALESCE(SUM(QtyOnHand),0) FROM M_StorageOnHand s, M_Locator l WHERE t.M_Product_ID=s.M_Product_ID"); sql.append("QtyOnHand = (SELECT COALESCE(SUM(QtyOnHand),0) FROM M_StorageOnHand s, M_Locator l WHERE t.M_Product_ID=s.M_Product_ID");
sql.append(" AND l.M_Locator_ID=s.M_Locator_ID AND l.M_Warehouse_ID=t.M_Warehouse_ID),"); sql.append(" AND l.M_Locator_ID=s.M_Locator_ID AND l.M_Warehouse_ID=t.M_Warehouse_ID),");
sql.append("QtyReserved = (SELECT COALESCE(SUM(Qty),0) FROM M_StorageReservation s WHERE t.M_Product_ID=s.M_Product_ID"); sql.append("QtyReserved = (SELECT COALESCE(SUM(Qty),0) FROM M_StorageReservation s WHERE t.M_Product_ID=s.M_Product_ID");
sql.append(" AND t.M_Warehouse_ID=s.M_Warehouse_ID),"); sql.append(" AND t.M_Warehouse_ID=s.M_Warehouse_ID AND s.IsSOTrx='Y'),");
sql.append("QtyOrdered = (SELECT COALESCE(SUM(Qty),0) FROM M_StorageReservation s WHERE t.M_Product_ID=s.M_Product_ID"); sql.append("QtyOrdered = (SELECT COALESCE(SUM(Qty),0) FROM M_StorageReservation s WHERE t.M_Product_ID=s.M_Product_ID");
sql.append(" AND t.M_Warehouse_ID=s.M_Warehouse_ID)"); sql.append(" AND t.M_Warehouse_ID=s.M_Warehouse_ID AND s.IsSOTrx='N')");
if (p_C_DocType_ID != 0) if (p_C_DocType_ID != 0)
sql.append(", C_DocType_ID=").append(p_C_DocType_ID); sql.append(", C_DocType_ID=").append(p_C_DocType_ID);
sql.append(" WHERE AD_PInstance_ID=").append(getAD_PInstance_ID()); sql.append(" WHERE AD_PInstance_ID=").append(getAD_PInstance_ID());

View File

@ -272,9 +272,9 @@ public class ReplenishReportProduction extends SvrProcess
sql.append("QtyOnHand = (SELECT COALESCE(SUM(QtyOnHand),0) FROM M_StorageOnHand s, M_Locator l WHERE t.M_Product_ID=s.M_Product_ID"); sql.append("QtyOnHand = (SELECT COALESCE(SUM(QtyOnHand),0) FROM M_StorageOnHand s, M_Locator l WHERE t.M_Product_ID=s.M_Product_ID");
sql.append(" AND l.M_Locator_ID=s.M_Locator_ID AND l.M_Warehouse_ID=t.M_Warehouse_ID),"); sql.append(" AND l.M_Locator_ID=s.M_Locator_ID AND l.M_Warehouse_ID=t.M_Warehouse_ID),");
sql.append("QtyReserved = (SELECT COALESCE(SUM(Qty),0) FROM M_StorageReservation s WHERE t.M_Product_ID=s.M_Product_ID"); sql.append("QtyReserved = (SELECT COALESCE(SUM(Qty),0) FROM M_StorageReservation s WHERE t.M_Product_ID=s.M_Product_ID");
sql.append(" AND t.M_Warehouse_ID=s.M_Warehouse_ID),"); sql.append(" AND t.M_Warehouse_ID=s.M_Warehouse_ID AND s.IsSOTrx='Y'),");
sql.append("QtyOrdered = (SELECT COALESCE(SUM(Qty),0) FROM M_StorageReservation s WHERE t.M_Product_ID=s.M_Product_ID"); sql.append("QtyOrdered = (SELECT COALESCE(SUM(Qty),0) FROM M_StorageReservation s WHERE t.M_Product_ID=s.M_Product_ID");
sql.append(" AND t.M_Warehouse_ID=s.M_Warehouse_ID)"); sql.append(" AND t.M_Warehouse_ID=s.M_Warehouse_ID AND s.IsSOTrx='N')");
if (p_C_DocType_ID != 0) if (p_C_DocType_ID != 0)
sql.append(", C_DocType_ID=").append(p_C_DocType_ID); sql.append(", C_DocType_ID=").append(p_C_DocType_ID);
sql.append(" WHERE AD_PInstance_ID=").append(getAD_PInstance_ID()); sql.append(" WHERE AD_PInstance_ID=").append(getAD_PInstance_ID());

View File

@ -1056,6 +1056,12 @@ public class GridTable extends AbstractTableModel
{} {}
loops++; loops++;
} }
if (m_sort.size() == 0) {
// check if there is a DB error saved to show
Exception savedEx = CLogger.retrieveException();
if (savedEx != null)
throw new IllegalStateException(savedEx);
}
if (row >= m_sort.size()) { if (row >= m_sort.size()) {
throw new IllegalStateException("Timeout loading row " + (row+1)); throw new IllegalStateException("Timeout loading row " + (row+1));
} }
@ -3512,7 +3518,8 @@ public class GridTable extends AbstractTableModel
} }
catch (SQLException e) catch (SQLException e)
{ {
log.log(Level.SEVERE, m_SQL, e); log.saveError(e.getLocalizedMessage(), e);
throw new DBException(e);
} }
} }

View File

@ -16,21 +16,21 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.model; package org.compiere.model;
import static org.compiere.model.SystemIDs.COUNTRY_US;
import java.io.Serializable; import java.io.Serializable;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
import org.compiere.util.CCache; import org.compiere.util.CCache;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Language; import org.compiere.util.Language;
import static org.compiere.model.SystemIDs.*;
/** /**
* Location Country Model (Value Object) * Location Country Model (Value Object)
@ -47,8 +47,7 @@ public class MCountry extends X_C_Country
/** /**
* *
*/ */
private static final long serialVersionUID = -3098295201595847612L; private static final long serialVersionUID = -4015127112992493778L;
/** /**
* Get Country (cached) * Get Country (cached)
@ -59,14 +58,13 @@ public class MCountry extends X_C_Country
public static MCountry get (Properties ctx, int C_Country_ID) public static MCountry get (Properties ctx, int C_Country_ID)
{ {
loadAllCountriesIfNeeded(ctx); loadAllCountriesIfNeeded(ctx);
String key = String.valueOf(C_Country_ID); MCountry c = s_countries.get(C_Country_ID);
MCountry c = (MCountry)s_countries.get(key);
if (c != null) if (c != null)
return c; return c;
c = new MCountry (ctx, C_Country_ID, null); c = new MCountry (ctx, C_Country_ID, null);
if (c.getC_Country_ID() == C_Country_ID) if (c.getC_Country_ID() == C_Country_ID)
{ {
s_countries.put(key, c); s_countries.put(C_Country_ID, c);
return c; return c;
} }
return null; return null;
@ -79,8 +77,14 @@ public class MCountry extends X_C_Country
*/ */
public static MCountry getDefault (Properties ctx) public static MCountry getDefault (Properties ctx)
{ {
loadAllCountriesIfNeeded(ctx); int clientID = Env.getAD_Client_ID(ctx);
return s_default; MCountry c = s_default.get(clientID);
if (c != null)
return c;
loadDefaultCountry(ctx);
c = s_default.get(clientID);
return c;
} // get } // get
/** /**
@ -112,43 +116,53 @@ public class MCountry extends X_C_Country
{ {
MClient client = MClient.get (ctx); MClient client = MClient.get (ctx);
MLanguage lang = MLanguage.get(ctx, client.getAD_Language()); MLanguage lang = MLanguage.get(ctx, client.getAD_Language());
MCountry usa = null;
// //
s_countries = new CCache<String,MCountry>(Table_Name, 250); s_countries = new CCache<Integer,MCountry>(Table_Name, 250);
String sql = "SELECT * FROM C_Country WHERE IsActive='Y'"; List<MCountry> countries = new Query(ctx, Table_Name, "", null)
Statement stmt = null; .setOnlyActiveRecords(true)
ResultSet rs = null; .list();
try for (MCountry c : countries) {
{ s_countries.put(c.getC_Country_ID(), c);
stmt = DB.createStatement(); // Country code of Client Language
rs = stmt.executeQuery(sql); if (lang != null && lang.getCountryCode().equals(c.getCountryCode()))
while(rs.next()) s_default.put(client.getAD_Client_ID(), c);
{
MCountry c = new MCountry (ctx, rs, null);
s_countries.put(String.valueOf(c.getC_Country_ID()), c);
// Country code of Client Language
if (lang != null && lang.getCountryCode().equals(c.getCountryCode()))
s_default = c;
if (c.getC_Country_ID() == COUNTRY_US) // USA
usa = c;
}
} }
catch (SQLException e)
{
s_log.log(Level.SEVERE, sql, e);
}
finally
{
DB.close(rs, stmt);
rs = null;
stmt = null;
}
if (s_default == null)
s_default = usa;
if (s_log.isLoggable(Level.FINE)) s_log.fine("#" + s_countries.size() if (s_log.isLoggable(Level.FINE)) s_log.fine("#" + s_countries.size()
+ " - Default=" + s_default); + " - Default=" + s_default);
} // loadAllCountries } // loadAllCountries
/**
* Load Default Country for actual client on context
* @param ctx
*/
private static void loadDefaultCountry(Properties ctx) {
loadAllCountriesIfNeeded(ctx);
MClient client = MClient.get (ctx);
MCountry found = s_default.get(client.getAD_Client_ID());
if (found != null)
return;
MLanguage lang = MLanguage.get(ctx, client.getAD_Language());
MCountry usa = null;
for (Entry<Integer, MCountry> cachedEntry : s_countries.entrySet()) {
MCountry c = cachedEntry.getValue();
// Country code of Client Language
if (lang != null && lang.getCountryCode().equals(c.getCountryCode())) {
found = c;
break;
}
if (c.getC_Country_ID() == COUNTRY_US) // USA
usa = c;
}
if (found != null)
s_default.put(client.getAD_Client_ID(), found);
else
s_default.put(client.getAD_Client_ID(), usa);
if (s_log.isLoggable(Level.FINE)) s_log.fine("#" + s_countries.size()
+ " - Default=" + s_default);
}
/** /**
* Return Language * Return Language
* @return Name * @return Name
@ -177,9 +191,9 @@ public class MCountry extends X_C_Country
private static String s_AD_Language = null; private static String s_AD_Language = null;
/** Country Cache */ /** Country Cache */
private static CCache<String,MCountry> s_countries = null; private static CCache<Integer,MCountry> s_countries = null;
/** Default Country */ /** Default Country */
private static MCountry s_default = null; private static CCache<Integer,MCountry> s_default = new CCache<Integer,MCountry>(Table_Name, 3);
/** Static Logger */ /** Static Logger */
private static CLogger s_log = CLogger.getCLogger (MCountry.class); private static CLogger s_log = CLogger.getCLogger (MCountry.class);
// Default DisplaySequence */ // Default DisplaySequence */

View File

@ -95,7 +95,7 @@ public class MGoal extends X_PA_Goal
rs = null; pstmt = null; rs = null; pstmt = null;
} }
if (list.size() == 0) if (list.size() == 0)
s_log.log (Level.WARNING, Msg.getMsg(ctx, "FindZeroRecords")); s_log.log (Level.INFO, Msg.getMsg(ctx, "FindZeroRecords"));
MGoal[] retValue = new MGoal[list.size ()]; MGoal[] retValue = new MGoal[list.size ()];
list.toArray (retValue); list.toArray (retValue);
return retValue; return retValue;

View File

@ -163,6 +163,11 @@ public class MInvoice extends X_C_Invoice implements DocAction
if (counter) if (counter)
{ {
to.setRef_Invoice_ID(from.getC_Invoice_ID()); to.setRef_Invoice_ID(from.getC_Invoice_ID());
MOrg org = MOrg.get(from.getCtx(), from.getAD_Org_ID());
int counterC_BPartner_ID = org.getLinkedC_BPartner_ID(trxName);
if (counterC_BPartner_ID == 0)
return null;
to.setBPartner(MBPartner.get(from.getCtx(), counterC_BPartner_ID));
// Try to find Order link // Try to find Order link
if (from.getC_Order_ID() != 0) if (from.getC_Order_ID() != 0)
{ {
@ -2169,8 +2174,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
counter.setAD_Org_ID(counterAD_Org_ID); counter.setAD_Org_ID(counterAD_Org_ID);
// counter.setM_Warehouse_ID(counterOrgInfo.getM_Warehouse_ID()); // counter.setM_Warehouse_ID(counterOrgInfo.getM_Warehouse_ID());
// //
counter.setBPartner(counterBP); // counter.setBPartner(counterBP);// was set on copyFrom
// Refernces (Should not be required // References (Should not be required)
counter.setSalesRep_ID(getSalesRep_ID()); counter.setSalesRep_ID(getSalesRep_ID());
counter.saveEx(get_TrxName()); counter.saveEx(get_TrxName());

View File

@ -675,9 +675,9 @@ public class MLookupFactory
embedSQL.append(BaseTable).append(".").append(BaseColumn); embedSQL.append(BaseTable).append(".").append(BaseColumn);
embedSQL.append("=").append(TableNameAlias).append(".").append(KeyColumn); embedSQL.append("=").append(TableNameAlias).append(".").append(KeyColumn);
} else if (translated) { } else if (translated) {
embedSQL.append(TableNameAlias).append(".").append(BaseColumn).append("=").append(column.getColumnSQL()); embedSQL.append(TableNameAlias).append(".").append(KeyColumn).append("=").append(column.getColumnSQL());
} else { } else {
embedSQL.append(BaseColumn).append("=").append(column.getColumnSQL()); embedSQL.append(KeyColumn).append("=").append(column.getColumnSQL());
} }
return embedSQL.toString(); return embedSQL.toString();

View File

@ -127,9 +127,14 @@ public class MOrder extends X_C_Order implements DocAction
to.setIsTransferred (false); to.setIsTransferred (false);
to.setPosted (false); to.setPosted (false);
to.setProcessed (false); to.setProcessed (false);
if (counter) if (counter) {
to.setRef_Order_ID(from.getC_Order_ID()); to.setRef_Order_ID(from.getC_Order_ID());
else MOrg org = MOrg.get(from.getCtx(), from.getAD_Org_ID());
int counterC_BPartner_ID = org.getLinkedC_BPartner_ID(trxName);
if (counterC_BPartner_ID == 0)
return null;
to.setBPartner(MBPartner.get(from.getCtx(), counterC_BPartner_ID));
} else
to.setRef_Order_ID(0); to.setRef_Order_ID(0);
// //
if (!to.save(trxName)) if (!to.save(trxName))
@ -2338,9 +2343,9 @@ public class MOrder extends X_C_Order implements DocAction
counter.setAD_Org_ID(counterAD_Org_ID); counter.setAD_Org_ID(counterAD_Org_ID);
counter.setM_Warehouse_ID(counterOrgInfo.getM_Warehouse_ID()); counter.setM_Warehouse_ID(counterOrgInfo.getM_Warehouse_ID());
// //
counter.setBPartner(counterBP); // counter.setBPartner(counterBP); // was set on copyFrom
counter.setDatePromised(getDatePromised()); // default is date ordered counter.setDatePromised(getDatePromised()); // default is date ordered
// Refernces (Should not be required // References (Should not be required)
counter.setSalesRep_ID(getSalesRep_ID()); counter.setSalesRep_ID(getSalesRep_ID());
counter.saveEx(get_TrxName()); counter.saveEx(get_TrxName());

View File

@ -1240,11 +1240,7 @@ public class Login
if (system.isLDAP()) if (system.isLDAP())
{ {
authenticated = system.isLDAP(app_user, app_pwd); authenticated = system.isLDAP(app_user, app_pwd);
if (authenticated){
app_pwd = null;
authenticated=true;
}
// if not authenticated, use AD_User as backup // if not authenticated, use AD_User as backup
} }
@ -1328,12 +1324,16 @@ public class Login
} }
clientsValidated.add(user.getAD_Client_ID()); clientsValidated.add(user.getAD_Client_ID());
boolean valid = false; boolean valid = false;
if (hash_password) { // authenticated by ldap
if (authenticated){
valid = true;
} else if (hash_password) {
valid = user.authenticateHash(app_pwd); valid = user.authenticateHash(app_pwd);
} else { } else {
// password not hashed // password not hashed
valid = user.getPassword() != null && user.getPassword().equals(app_pwd); valid = user.getPassword() != null && user.getPassword().equals(app_pwd);
} }
if (valid ) { if (valid ) {
if (user.isLocked()) if (user.isLocked())
{ {
@ -1341,7 +1341,10 @@ public class Login
continue; continue;
} }
if (user.isExpired()) if (authenticated){
// use Ldap because don't check password age
}
else if (user.isExpired())
isPasswordExpired = true; isPasswordExpired = true;
else if (MAX_PASSWORD_AGE > 0 && !user.isNoPasswordReset()) else if (MAX_PASSWORD_AGE > 0 && !user.isNoPasswordReset())
{ {

View File

@ -12,6 +12,8 @@ import org.compiere.model.PO;
import org.compiere.model.POInfo; import org.compiere.model.POInfo;
import org.compiere.model.X_AD_Client; import org.compiere.model.X_AD_Client;
import org.compiere.model.X_AD_Org; import org.compiere.model.X_AD_Org;
import org.compiere.model.X_C_Location;
import org.compiere.model.X_M_Locator;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
@ -275,6 +277,10 @@ public class PoExporter {
addBlob(columnName); addBlob(columnName);
} else if (columnName.equals(po.getUUIDColumnName()) && po.get_Value(columnName) == null) { } else if (columnName.equals(po.getUUIDColumnName()) && po.get_Value(columnName) == null) {
continue; continue;
} else if (DisplayType.Locator == displayType) {
addTableReference(columnName, X_M_Locator.Table_Name, new AttributesImpl());
} else if (DisplayType.Location == displayType) {
addTableReference(columnName, X_C_Location.Table_Name, new AttributesImpl());
} else { } else {
add(columnName, "", new AttributesImpl()); add(columnName, "", new AttributesImpl());
} }

View File

@ -143,7 +143,7 @@ public class VInOutGen extends InOutGen implements FormPanel, ActionListener, Ve
// Document Action Prepared/ Completed // Document Action Prepared/ Completed
MLookup docActionL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 4324 /* M_InOut.DocStatus */, MLookup docActionL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 4324 /* M_InOut.DocStatus */,
DisplayType.List, Env.getLanguage(Env.getCtx()), "DocAction", 135 /* _Document Action */, DisplayType.List, Env.getLanguage(Env.getCtx()), "DocAction", 135 /* _Document Action */,
false, "AD_Ref_List.Value IN ('CO','PR')"); false, "AD_Ref_List.Value IN ('CO','PR','--')");
docAction = new VLookup("DocAction", true, false, true,docActionL); docAction = new VLookup("DocAction", true, false, true,docActionL);
docAction.addVetoableChangeListener(this); docAction.addVetoableChangeListener(this);
// C_Order.C_BPartner_ID // C_Order.C_BPartner_ID

View File

@ -1664,6 +1664,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
IADTabpanel headerTab = adTabbox.getSelectedTabpanel(); IADTabpanel headerTab = adTabbox.getSelectedTabpanel();
IADTabpanel detailTab = adTabbox.getSelectedDetailADTabpanel(); IADTabpanel detailTab = adTabbox.getSelectedDetailADTabpanel();
adTabbox.getSelectedGridTab().dataRefreshAll(fireEvent, true); adTabbox.getSelectedGridTab().dataRefreshAll(fireEvent, true);
adTabbox.getSelectedGridTab().refreshParentTabs();
headerTab.dynamicDisplay(0); headerTab.dynamicDisplay(0);
if (detailTab != null) if (detailTab != null)
{ {
@ -2021,6 +2022,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{ {
String statusLine = statusBar.getStatusLine(); String statusLine = statusBar.getStatusLine();
adTabbox.getSelectedGridTab().dataRefreshAll(true, true); adTabbox.getSelectedGridTab().dataRefreshAll(true, true);
adTabbox.getSelectedGridTab().refreshParentTabs();
statusBar.setStatusLine(statusLine); statusBar.setStatusLine(statusLine);
} }
if (dirtyTabpanel != null) { if (dirtyTabpanel != null) {
@ -2212,6 +2214,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if(result) if(result)
{ {
adTabbox.getSelectedGridTab().dataRefreshAll(true, true); adTabbox.getSelectedGridTab().dataRefreshAll(true, true);
adTabbox.getSelectedGridTab().refreshParentTabs();
IADTabpanel dirtyTabpanel = (IADTabpanel) Executions.getCurrent().removeAttribute("adtabpane.saved"); IADTabpanel dirtyTabpanel = (IADTabpanel) Executions.getCurrent().removeAttribute("adtabpane.saved");
if (dirtyTabpanel != null && dirtyTabpanel.getGridTab().isDetail()) { if (dirtyTabpanel != null && dirtyTabpanel.getGridTab().isDetail()) {
try { try {
@ -2278,6 +2281,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{ {
//error will be catch in the dataStatusChanged event //error will be catch in the dataStatusChanged event
adTabbox.getSelectedGridTab().dataDelete(); adTabbox.getSelectedGridTab().dataDelete();
adTabbox.getSelectedGridTab().refreshParentTabs();
adTabbox.getSelectedTabpanel().dynamicDisplay(0); adTabbox.getSelectedTabpanel().dynamicDisplay(0);
focusToActivePanel(); focusToActivePanel();
@ -2321,6 +2325,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
count++; count++;
} }
} }
adTabbox.getSelectedGridTab().refreshParentTabs();
adTabbox.getSelectedTabpanel().dynamicDisplay(0); adTabbox.getSelectedTabpanel().dynamicDisplay(0);
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "Deleted")+": "+count, false); statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "Deleted")+": "+count, false);

View File

@ -138,7 +138,7 @@ public class WInOutGen extends InOutGen implements IFormController, EventListene
lDocAction.setText(Msg.translate(Env.getCtx(), "DocAction")); lDocAction.setText(Msg.translate(Env.getCtx(), "DocAction"));
MLookup docActionL = MLookupFactory.get(Env.getCtx(), form.getWindowNo(), 4324 /* M_InOut.DocAction */, MLookup docActionL = MLookupFactory.get(Env.getCtx(), form.getWindowNo(), 4324 /* M_InOut.DocAction */,
DisplayType.List, Env.getLanguage(Env.getCtx()), "DocAction", 135 /* _Document Action */, DisplayType.List, Env.getLanguage(Env.getCtx()), "DocAction", 135 /* _Document Action */,
false, "AD_Ref_List.Value IN ('CO','PR')"); false, "AD_Ref_List.Value IN ('CO','PR','--')");
docAction = new WTableDirEditor("DocAction", true, false, true,docActionL); docAction = new WTableDirEditor("DocAction", true, false, true,docActionL);
docAction.setValue(DocAction.ACTION_Complete); docAction.setValue(DocAction.ACTION_Complete);
// docAction.addValueChangeListener(this); // IDEMPIERE-768 // docAction.addValueChangeListener(this); // IDEMPIERE-768

View File

@ -163,6 +163,7 @@ public class WTreeMaintenance extends TreeMaintenance implements IFormController
hbox.setStyle("padding: 3px;"); hbox.setStyle("padding: 3px;");
hbox.setAlign("center"); hbox.setAlign("center");
hbox.setHflex("1"); hbox.setHflex("1");
hbox.setVflex("1");
northPanel.appendChild(hbox); northPanel.appendChild(hbox);
hbox.appendChild (new Space()); hbox.appendChild (new Space());

View File

@ -1243,7 +1243,12 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
public void zoom() public void zoom()
{ {
Integer recordId = contentPanel.getSelectedRowKey();
// prevent NPE when double click is raise but no recore is selected
if (recordId == null)
return;
if (listeners != null && listeners.size() > 0) if (listeners != null && listeners.size() > 0)
{ {
ValueChangeEvent event = new ValueChangeEvent(this,"zoom", ValueChangeEvent event = new ValueChangeEvent(this,"zoom",
@ -1251,8 +1256,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
fireValueChange(event); fireValueChange(event);
} }
else else
{ {
Integer recordId = contentPanel.getSelectedRowKey();
int AD_Table_ID = MTable.getTable_ID(p_tableName); int AD_Table_ID = MTable.getTable_ID(p_tableName);
if (AD_Table_ID <= 0) if (AD_Table_ID <= 0)
{ {

View File

@ -61,7 +61,7 @@ public class HTMLExtension implements IHTMLExtension {
href.setStyle("text-decoration: none; font-size: 11px; vertical-align: middle;"); href.setStyle("text-decoration: none; font-size: 11px; vertical-align: middle;");
href.addAttribute("onclick", "parent.zoom('" href.addAttribute("onclick", "parent.zoom('"
+ componentId + "', '" + componentId + "', '"
+ dataElement.getColumnName() + "', '" + dataElement.getForeignColumnName() + "', '"
+ dataElement.getValueAsString() + "')"); + dataElement.getValueAsString() + "')");
window.addElement(href); window.addElement(href);
menu.addElement(window); menu.addElement(window);