hg merge release-2.1 (merge release2.1 into development)

This commit is contained in:
Carlos Ruiz 2015-06-24 20:43:40 -05:00
commit a3ba251b49
28 changed files with 311 additions and 116 deletions

View File

@ -0,0 +1,16 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-2676 Incorrect context variables
-- Jun 17, 2015 4:40:47 PM COT
UPDATE AD_Column SET Callout='org.compiere.model.CalloutOrder.priceList', IsUpdateable='N',Updated=TO_DATE('2015-06-17 16:40:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2161
;
-- IDEMPIERE-2676 Incorrect context variables
-- Jun 22, 2015 12:50:04 PM COT
UPDATE AD_Column SET Callout='org.compiere.model.CalloutOrder.priceList', IsUpdateable='N',Updated=TO_DATE('2015-06-22 12:50:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3484
;
SELECT register_migration_script('201506171641_IDEMPIERE-2676.sql') FROM dual
;

View File

@ -0,0 +1,12 @@
-- IDEMPIERE-2676 Incorrect context variables
-- Jun 17, 2015 4:40:47 PM COT
UPDATE AD_Column SET Callout='org.compiere.model.CalloutOrder.priceList', IsUpdateable='N',Updated=TO_TIMESTAMP('2015-06-17 16:40:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2161
;
-- Jun 22, 2015 12:50:04 PM COT
UPDATE AD_Column SET Callout='org.compiere.model.CalloutOrder.priceList', IsUpdateable='N',Updated=TO_TIMESTAMP('2015-06-22 12:50:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3484
;
SELECT register_migration_script('201506171641_IDEMPIERE-2676.sql') FROM dual
;

View File

@ -510,7 +510,7 @@ public class InOutGenerate extends SvrProcess
throw new IllegalStateException("Could not create Shipment Line"); throw new IllegalStateException("Could not create Shipment Line");
if (log.isLoggable(Level.FINE)) log.fine("ToDeliver=" + qty + "/" + deliver + " - " + line); if (log.isLoggable(Level.FINE)) log.fine("ToDeliver=" + qty + "/" + deliver + " - " + line);
toDeliver = toDeliver.subtract(deliver); toDeliver = toDeliver.subtract(deliver);
// Temp adjustment, actual update happen in MInOut.completeIt // Temp adjustment, actual update happen in MInOut.completeIt - just in memory - not saved
storage.setQtyOnHand(storage.getQtyOnHand().subtract(deliver)); storage.setQtyOnHand(storage.getQtyOnHand().subtract(deliver));
// //
if (toDeliver.signum() == 0) if (toDeliver.signum() == 0)

View File

@ -81,7 +81,7 @@ public class GridField
/** /**
* *
*/ */
private static final long serialVersionUID = -5875251339128387039L; private static final long serialVersionUID = 7859929653710975421L;
/** /**
* Field Constructor. * Field Constructor.
@ -851,8 +851,56 @@ public class GridField
} // createDefault } // createDefault
/** /**
* Validate initial Field Value. * Validate initial Field Value. Do not push direct value if it doesn't exist
* Called from MTab.dataNew and MTab.setCurrentRow when inserting * Called from GridTab.dataNew when inserting
* @return true if valid
*/
public boolean validateValueNoDirect()
{
// null
if (m_value == null || m_value.toString().length() == 0)
{
if (isMandatory(true))
{
m_error = true;
return false;
}
else
return true;
}
// Search not cached
if (getDisplayType() == DisplayType.Search && m_lookup != null)
{
// need to re-set invalid values - OK BPartner in PO Line - not OK SalesRep in Invoice
if (m_lookup.getDirect(m_value, false, true) == null)
{
if (log.isLoggable(Level.FINEST)) log.finest(m_vo.ColumnName + " Serach not valid - set to null");
setValue(null, m_inserting);
m_error = true;
return false;
}
return true;
}
// cannot be validated
if (!isLookup()
|| m_lookup == null
|| m_lookup.containsKeyNoDirect(m_value))
return true;
// it's not null, a lookup and does not have the key
if (isKey() || isParentValue()) // parents/ket are not validated
return true;
if (log.isLoggable(Level.FINEST)) log.finest(m_vo.ColumnName + " - set to null");
setValue(null, m_inserting);
m_error = true;
return false;
} // validateValue
/**
* Validate initial Field Value. Push direct value if it doesn't exist
* Called from GridTab.setCurrentRow when inserting
* @return true if valid * @return true if valid
*/ */
public boolean validateValue() public boolean validateValue()
@ -896,8 +944,7 @@ public class GridField
setValue(null, m_inserting); setValue(null, m_inserting);
m_error = true; m_error = true;
return false; return false;
} // validateValue } // validateValuePushDirect
/************************************************************************** /**************************************************************************
* Is the Column Visible ? * Is the Column Visible ?

View File

@ -113,7 +113,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
/** /**
* *
*/ */
private static final long serialVersionUID = 1151723870943569774L; private static final long serialVersionUID = 5446672147679386907L;
public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate"; public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate";
@ -1185,15 +1185,15 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
return retValue; return retValue;
setCurrentRow(m_currentRow + 1, true); setCurrentRow(m_currentRow + 1, true);
// process all Callouts (no dependency check - assumed that settings are valid)
for (int i = 0; i < getFieldCount(); i++)
processCallout(getField(i));
// check validity of defaults // check validity of defaults
for (int i = 0; i < getFieldCount(); i++) for (int i = 0; i < getFieldCount(); i++)
{ {
getField(i).refreshLookup(); getField(i).refreshLookup();
getField(i).validateValue(); getField(i).validateValueNoDirect();
} }
// process all Callouts (no dependency check - assumed that settings are valid)
for (int i = 0; i < getFieldCount(); i++)
processCallout(getField(i));
m_mTable.setChanged(false); m_mTable.setChanged(false);
fireStateChangeEvent(new StateChangeEvent(this, StateChangeEvent.DATA_NEW)); fireStateChangeEvent(new StateChangeEvent(this, StateChangeEvent.DATA_NEW));
@ -2542,12 +2542,14 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
*/ */
public int setCurrentRow (int newCurrentRow, boolean fireEvents) public int setCurrentRow (int newCurrentRow, boolean fireEvents)
{ {
boolean changingRow = (m_currentRow != newCurrentRow);
int oldCurrentRow = m_currentRow; int oldCurrentRow = m_currentRow;
m_currentRow = verifyRow (newCurrentRow); m_currentRow = verifyRow (newCurrentRow);
if (log.isLoggable(Level.FINE)) log.fine("Row=" + m_currentRow + " - fire=" + fireEvents); if (log.isLoggable(Level.FINE)) log.fine("Row=" + m_currentRow + " - fire=" + fireEvents);
// Update Field Values // Update Field Values
int size = m_mTable.getColumnCount(); int size = m_mTable.getColumnCount();
GridField keyCalloutDelayed = null;
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
{ {
GridField mField = m_mTable.getField(i); GridField mField = m_mTable.getField(i);
@ -2558,6 +2560,8 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
mField.setValue(value, m_mTable.isInserting()); mField.setValue(value, m_mTable.isInserting());
if (m_mTable.isInserting()) // set invalid values to null if (m_mTable.isInserting()) // set invalid values to null
mField.validateValue(); mField.validateValue();
if (mField.isKey())
keyCalloutDelayed = mField;
} }
else else
{ // no rows - set to a reasonable value - not updateable { // no rows - set to a reasonable value - not updateable
@ -2576,6 +2580,8 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
mField.setValue(); mField.setValue();
} }
} }
if (changingRow && keyCalloutDelayed != null)
processCallout(keyCalloutDelayed);
loadDependentInfo(); loadDependentInfo();
if (!fireEvents) // prevents informing twice if (!fireEvents) // prevents informing twice

View File

@ -43,7 +43,7 @@ public abstract class Lookup extends AbstractListModel<Object>
/** /**
* *
*/ */
private static final long serialVersionUID = -2811763289904455349L; private static final long serialVersionUID = -28200392264647953L;
/** /**
* Lookup * Lookup
@ -382,6 +382,12 @@ public abstract class Lookup extends AbstractListModel<Object>
*/ */
public abstract boolean containsKey (Object key); public abstract boolean containsKey (Object key);
/**
* The Lookup contains the key, do not push direct
* @param key key
* @return true if contains key
*/
public abstract boolean containsKeyNoDirect (Object key);
/************************************************************************** /**************************************************************************
* Refresh Values - default implementation * Refresh Values - default implementation

View File

@ -39,7 +39,7 @@ public final class MAccountLookup extends Lookup implements Serializable
/** /**
* *
*/ */
private static final long serialVersionUID = 5565166586045152280L; private static final long serialVersionUID = -6307559127917670193L;
/** /**
* Constructor * Constructor
@ -103,6 +103,11 @@ public final class MAccountLookup extends Lookup implements Serializable
return load (intValue); return load (intValue);
} // containsKey } // containsKey
public boolean containsKeyNoDirect (Object key)
{
return containsKey(key);
}
/** /**
* Get Description * Get Description
* @return Description * @return Description

View File

@ -37,7 +37,7 @@ public final class MLocationLookup extends Lookup
/** /**
* *
*/ */
private static final long serialVersionUID = -7335118019935048922L; private static final long serialVersionUID = 7238110708451510319L;
/** /**
* Constructor * Constructor
@ -95,6 +95,10 @@ public final class MLocationLookup extends Lookup
return getLocation(key, null) != null; return getLocation(key, null) != null;
} // containsKey } // containsKey
public boolean containsKeyNoDirect (Object key)
{
return containsKey(key);
}
/************************************************************************** /**************************************************************************
* Get Location * Get Location

View File

@ -48,7 +48,7 @@ public final class MLocatorLookup extends Lookup implements Serializable
/** /**
* *
*/ */
private static final long serialVersionUID = 8932848190660391496L; private static final long serialVersionUID = -6041455174391573888L;
/** /**
* Constructor * Constructor
@ -208,6 +208,11 @@ public final class MLocatorLookup extends Lookup implements Serializable
return m_lookup.containsKey(key); return m_lookup.containsKey(key);
} // containsKey } // containsKey
public boolean containsKeyNoDirect (Object key)
{
return containsKey(key);
}
/** /**
* Get Data Direct from Table * Get Data Direct from Table
* @param keyValue integer key value * @param keyValue integer key value

View File

@ -56,7 +56,7 @@ public final class MLookup extends Lookup implements Serializable
/** /**
* *
*/ */
private static final long serialVersionUID = 5784044288965615466L; private static final long serialVersionUID = 2228200000988048623L;
/** /**
* MLookup Constructor * MLookup Constructor
@ -179,7 +179,7 @@ public final class MLookup extends Lookup implements Serializable
* @param key key (Integer for Keys or String for Lists) * @param key key (Integer for Keys or String for Lists)
* @return value * @return value
*/ */
public NamePair get (Object key) public NamePair get (Object key, boolean includeDirect)
{ {
if (key == null || MINUS_ONE.equals(key)) // indicator for null if (key == null || MINUS_ONE.equals(key)) // indicator for null
return null; return null;
@ -212,11 +212,23 @@ public final class MLookup extends Lookup implements Serializable
return retValue; return retValue;
} }
// Try to get it directly if (includeDirect) {
boolean cacheLocal = m_info.IsValidated ; // Try to get it directly
return getDirect(key, false, cacheLocal); // do NOT cache boolean cacheLocal = m_info.IsValidated ;
return getDirect(key, false, cacheLocal); // do NOT cache
}
return null;
} // get } // get
public NamePair get(Object key) {
return get(key, true);
}
public NamePair getNoDirect(Object key) {
return get(key, false);
}
/** /**
* Get Display value (name). * Get Display value (name).
* If not found return key embedded in inactive signs. * If not found return key embedded in inactive signs.
@ -254,6 +266,24 @@ public final class MLookup extends Lookup implements Serializable
} }
} // containsKey } // containsKey
/**
* The Lookup contains the key, do not get direct
* @param key key
* @return true if key is known
*/
public boolean containsKeyNoDirect (Object key)
{
//should check direct too
if (m_lookup.containsKey(key))
return true;
else {
if (m_lookup.size() > 0)
return false;
else
return ( getNoDirect(key) != null );
}
} // containsKeyNoDirect
/** /**
* @return a string representation of the object. * @return a string representation of the object.
*/ */

View File

@ -607,7 +607,7 @@ public class MLookupFactory
msginf.toString(), ZoomWindow, ZoomWindowPO, zoomQuery); msginf.toString(), ZoomWindow, ZoomWindowPO, zoomQuery);
retValue.DisplayColumn = lookupDisplayColumn; retValue.DisplayColumn = lookupDisplayColumn;
retValue.InfoWindowId = infoWindowId; retValue.InfoWindowId = infoWindowId;
retValue.QueryDirect = directQuery; retValue.QueryDirect = MRole.getDefault().addAccessSQL(directQuery, TableName, true, false);
s_cacheRefTable.put(key.toString(), retValue.cloneIt()); s_cacheRefTable.put(key.toString(), retValue.cloneIt());
return retValue; return retValue;
} // getLookup_Table } // getLookup_Table
@ -814,7 +814,7 @@ public class MLookupFactory
MLookupInfo lInfo = new MLookupInfo(realSQL.toString(), TableName, MLookupInfo lInfo = new MLookupInfo(realSQL.toString(), TableName,
msginf.toString(), ZoomWindow, ZoomWindowPO, zoomQuery); msginf.toString(), ZoomWindow, ZoomWindowPO, zoomQuery);
lInfo.DisplayColumn = displayColumn.toString(); lInfo.DisplayColumn = displayColumn.toString();
lInfo.QueryDirect = directQuery; lInfo.QueryDirect = MRole.getDefault().addAccessSQL(directQuery, TableName, true, false);
s_cacheRefTable.put(cacheKey.toString(), lInfo.cloneIt()); s_cacheRefTable.put(cacheKey.toString(), lInfo.cloneIt());
return lInfo; return lInfo;
} // getLookup_TableDir } // getLookup_TableDir

View File

@ -41,11 +41,10 @@ import org.compiere.util.NamePair;
public class MPAttributeLookup extends Lookup public class MPAttributeLookup extends Lookup
implements Serializable implements Serializable
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 70273805106666111L; private static final long serialVersionUID = 1877125428249819248L;
/** /**
* Constructor * Constructor
@ -88,6 +87,11 @@ public class MPAttributeLookup extends Lookup
return get(key) != null; return get(key) != null;
} // containsKey } // containsKey
public boolean containsKeyNoDirect (Object key)
{
return containsKey(key);
}
/** /**
* Get Object of Key Value * Get Object of Key Value
* @param value value * @param value value

View File

@ -39,7 +39,7 @@ public class MPaymentLookup extends Lookup implements Serializable {
/** /**
* *
*/ */
private static final long serialVersionUID = 6505672741140583659L; private static final long serialVersionUID = 2876345457828980720L;
/** Context */ /** Context */
private Properties m_ctx; private Properties m_ctx;
@ -97,6 +97,11 @@ public class MPaymentLookup extends Lookup implements Serializable {
return false; return false;
} }
public boolean containsKeyNoDirect (Object key)
{
return containsKey(key);
}
@Override @Override
public String getColumnName() { public String getColumnName() {
return "PaymentRule"; return "PaymentRule";

View File

@ -120,11 +120,8 @@ public class MProductionLine extends X_M_ProductionLine {
} }
MStorageOnHand storage = MStorageOnHand.getCreate(getCtx(), getM_Locator_ID(), MStorageOnHand storage = MStorageOnHand.getCreate(getCtx(), getM_Locator_ID(),
getM_Product_ID(), asi.get_ID(),dateMPolicy, get_TrxName()); getM_Product_ID(), asi.get_ID(),dateMPolicy, get_TrxName());
storage.changeQtyOnHand(getMovementQty(), true); storage.addQtyOnHand(getMovementQty());
if ( !storage.save(get_TrxName()) ) { storage.load(storage.get_TrxName());
log.log(Level.SEVERE, "Could not update storage for " + toString());
errorString.append("Could not save transaction for " + toString() + "\n");
}
if (log.isLoggable(Level.FINE))log.log(Level.FINE, "Created finished goods line " + getLine()); if (log.isLoggable(Level.FINE))log.log(Level.FINE, "Created finished goods line " + getLine());
return errorString.toString(); return errorString.toString();
@ -182,11 +179,8 @@ public class MProductionLine extends X_M_ProductionLine {
if (log.isLoggable(Level.FINE))log.log(Level.FINE, "Saved transaction for " + toString()); if (log.isLoggable(Level.FINE))log.log(Level.FINE, "Saved transaction for " + toString());
} }
DB.getDatabase().forUpdate(storages[sl], 120); DB.getDatabase().forUpdate(storages[sl], 120);
storages[sl].changeQtyOnHand(lineQty, false); storages[sl].addQtyOnHand(lineQty.negate());
if ( !storages[sl].save(get_TrxName()) ) { storages[sl].load(storages[sl].get_TrxName());
log.log(Level.SEVERE, "Could not update storage for " + toString());
errorString.append("Could not update storage for " + toString() + "\n");
}
qtyToMove = qtyToMove.subtract(lineQty); qtyToMove = qtyToMove.subtract(lineQty);
if (log.isLoggable(Level.FINE))log.log(Level.FINE, getLine() + " Qty moved = " + lineQty + ", Remaining = " + qtyToMove ); if (log.isLoggable(Level.FINE))log.log(Level.FINE, getLine() + " Qty moved = " + lineQty + ", Remaining = " + qtyToMove );
} }
@ -244,11 +238,8 @@ public class MProductionLine extends X_M_ProductionLine {
} else { } else {
if (log.isLoggable(Level.FINE))log.log(Level.FINE, "Saved transaction for " + toString()); if (log.isLoggable(Level.FINE))log.log(Level.FINE, "Saved transaction for " + toString());
} }
storage.changeQtyOnHand(lineQty, false); storage.addQtyOnHand(lineQty.negate());
if ( !storage.save(get_TrxName()) ) { storage.load(storage.get_TrxName());
log.log(Level.SEVERE, "Could not update storage for " + toString());
errorString.append("Could not update storage for " + toString() + "\n");
}
qtyToMove = qtyToMove.subtract(lineQty); qtyToMove = qtyToMove.subtract(lineQty);
if (log.isLoggable(Level.FINE))log.log(Level.FINE, getLine() + " Qty moved = " + lineQty + ", Remaining = " + qtyToMove ); if (log.isLoggable(Level.FINE))log.log(Level.FINE, getLine() + " Qty moved = " + lineQty + ", Remaining = " + qtyToMove );
} }

View File

@ -27,6 +27,7 @@ import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -44,7 +45,7 @@ public class MStorageOnHand extends X_M_StorageOnHand
/** /**
* *
*/ */
private static final long serialVersionUID = 1137569740767949519L; private static final long serialVersionUID = -3820729340100521329L;
/** /**
* *
@ -735,14 +736,31 @@ public class MStorageOnHand extends X_M_StorageOnHand
return false; return false;
} }
storage.setQtyOnHand (storage.getQtyOnHand().add (diffQtyOnHand)); storage.addQtyOnHand(diffQtyOnHand);
storage.load(storage.get_TrxName());
if (storage.getQtyOnHand().signum() == -1) {
if (MWarehouse.get(Env.getCtx(), M_Warehouse_ID).isDisallowNegativeInv()) {
throw new AdempiereException(Msg.getMsg(ctx, "NegativeInventoryDisallowed"));
}
}
if (s_log.isLoggable(Level.FINE)) { if (s_log.isLoggable(Level.FINE)) {
StringBuilder diffText = new StringBuilder("(OnHand=").append(diffQtyOnHand).append(") -> ").append(storage.toString()); StringBuilder diffText = new StringBuilder("(OnHand=").append(diffQtyOnHand).append(") -> ").append(storage.toString());
s_log.fine(diffText.toString()); s_log.fine(diffText.toString());
} }
return storage.save (trxName); return true;
} // add } // add
/**
* Add quantity on hand directly - not using cached value - solving IDEMPIERE-2629
* @param addition
*/
public void addQtyOnHand(BigDecimal addition) {
final String sql = "UPDATE M_StorageOnHand SET QtyOnHand=QtyOnHand+?, Updated=SYSDATE, UpdatedBy=? " +
"WHERE M_Product_ID=? AND M_Locator_ID=? AND M_AttributeSetInstance_ID=? AND DateMaterialPolicy=?";
DB.executeUpdateEx(sql,
new Object[] {addition, Env.getAD_User_ID(Env.getCtx()), getM_Product_ID(), getM_Locator_ID(), getM_AttributeSetInstance_ID(), getDateMaterialPolicy()},
get_TrxName());
}
/************************************************************************** /**************************************************************************
* Get Location with highest Locator Priority and a sufficient OnHand Qty * Get Location with highest Locator Priority and a sufficient OnHand Qty
@ -854,21 +872,6 @@ public class MStorageOnHand extends X_M_StorageOnHand
/** Warehouse */ /** Warehouse */
private int m_M_Warehouse_ID = 0; private int m_M_Warehouse_ID = 0;
/**
* Change Qty OnHand
* @param qty quantity
* @param add add if true
*/
public void changeQtyOnHand (BigDecimal qty, boolean add)
{
if (qty == null || qty.signum() == 0)
return;
if (add)
setQtyOnHand(getQtyOnHand().add(qty));
else
setQtyOnHand(getQtyOnHand().subtract(qty));
} // changeQtyOnHand
/** /**
* Get M_Warehouse_ID of Locator * Get M_Warehouse_ID of Locator
* @return warehouse * @return warehouse
@ -1030,8 +1033,9 @@ public class MStorageOnHand extends X_M_StorageOnHand
{ {
StringBuffer sb = new StringBuffer("MStorageOnHand[") StringBuffer sb = new StringBuffer("MStorageOnHand[")
.append("M_Locator_ID=").append(getM_Locator_ID()) .append("M_Locator_ID=").append(getM_Locator_ID())
.append(",M_Product_ID=").append(getM_Product_ID()) .append(",M_Product_ID=").append(getM_Product_ID())
.append(",M_AttributeSetInstance_ID=").append(getM_AttributeSetInstance_ID()) .append(",M_AttributeSetInstance_ID=").append(getM_AttributeSetInstance_ID())
.append(",DateMaterialPolicy=").append(getDateMaterialPolicy())
.append(": OnHand=").append(getQtyOnHand()) .append(": OnHand=").append(getQtyOnHand())
/* @win commented out /* @win commented out
.append(",Reserved=").append(getQtyReserved()) .append(",Reserved=").append(getQtyReserved())

View File

@ -30,7 +30,7 @@ public class MStorageReservation extends X_M_StorageReservation {
/** /**
* *
*/ */
private static final long serialVersionUID = -2649259510341856418L; private static final long serialVersionUID = 8179093165315835613L;
/** /**
* Get Storage Info * Get Storage Info
@ -248,12 +248,25 @@ public class MStorageReservation extends X_M_StorageReservation {
return false; return false;
} }
storage.setQty (storage.getQty().add(diffQty)); storage.addQty(diffQty);
storage.load(storage.get_TrxName());
if (s_log.isLoggable(Level.FINE)) { if (s_log.isLoggable(Level.FINE)) {
StringBuilder diffText = new StringBuilder("(Qty=").append(diffQty).append(") -> ").append(storage.toString()); StringBuilder diffText = new StringBuilder("(Qty=").append(diffQty).append(") -> ").append(storage.toString());
s_log.fine(diffText.toString()); s_log.fine(diffText.toString());
} }
return storage.save (trxName); return true;
}
/**
* Add quantity on hand directly - not using cached value - solving IDEMPIERE-2629
* @param addition
*/
public void addQty(BigDecimal addition) {
final String sql = "UPDATE M_StorageReservation SET Qty=Qty+?, Updated=SYSDATE, UpdatedBy=? " +
"WHERE M_Product_ID=? AND M_Warehouse_ID=? AND M_AttributeSetInstance_ID=? AND IsSOTrx=?";
DB.executeUpdateEx(sql,
new Object[] {addition, Env.getAD_User_ID(Env.getCtx()), getM_Product_ID(), getM_Warehouse_ID(), getM_AttributeSetInstance_ID(), isSOTrx()},
get_TrxName());
} }
/** /**
@ -309,4 +322,20 @@ public class MStorageReservation extends X_M_StorageReservation {
return retValue; return retValue;
} // getCreate } // getCreate
/**
* String Representation
* @return info
*/
public String toString()
{
StringBuffer sb = new StringBuffer("MStorageReservation[")
.append("M_Warehouse_ID=").append(getM_Warehouse_ID())
.append(",M_Product_ID=").append(getM_Product_ID())
.append(",M_AttributeSetInstance_ID=").append(getM_AttributeSetInstance_ID())
.append(",IsSOTrx=").append(isSOTrx())
.append(": Qty=").append(getQty())
.append("]");
return sb.toString();
} // toString
} }

View File

@ -903,10 +903,11 @@ public class DocumentEngine implements DocAction
* @param AD_Table_ID * @param AD_Table_ID
* @param docAction * @param docAction
* @param options * @param options
* @param periodOpen - flag indicating if the period is Open - to avoid including Void and ReverseCorrect options in the list
* @return Number of valid options * @return Number of valid options
*/ */
public static int getValidActions(String docStatus, Object processing, public static int getValidActions(String docStatus, Object processing,
String orderType, String isSOTrx, int AD_Table_ID, String[] docAction, String[] options) String orderType, String isSOTrx, int AD_Table_ID, String[] docAction, String[] options, boolean periodOpen)
{ {
if (options == null) if (options == null)
throw new IllegalArgumentException("Option array parameter is null"); throw new IllegalArgumentException("Option array parameter is null");
@ -1001,8 +1002,9 @@ public class DocumentEngine implements DocAction
// Complete .. CO // Complete .. CO
if (docStatus.equals(DocumentEngine.STATUS_Completed)) if (docStatus.equals(DocumentEngine.STATUS_Completed))
{ {
options[index++] = DocumentEngine.ACTION_Void; if (periodOpen) {
options[index++] = DocumentEngine.ACTION_Reverse_Correct; options[index++] = DocumentEngine.ACTION_Reverse_Correct;
}
options[index++] = DocumentEngine.ACTION_Reverse_Accrual; options[index++] = DocumentEngine.ACTION_Reverse_Accrual;
} }
} }
@ -1014,8 +1016,9 @@ public class DocumentEngine implements DocAction
// Complete .. CO // Complete .. CO
if (docStatus.equals(DocumentEngine.STATUS_Completed)) if (docStatus.equals(DocumentEngine.STATUS_Completed))
{ {
options[index++] = DocumentEngine.ACTION_Void; if (periodOpen) {
options[index++] = DocumentEngine.ACTION_Reverse_Correct; options[index++] = DocumentEngine.ACTION_Reverse_Correct;
}
options[index++] = DocumentEngine.ACTION_Reverse_Accrual; options[index++] = DocumentEngine.ACTION_Reverse_Accrual;
} }
} }
@ -1027,8 +1030,9 @@ public class DocumentEngine implements DocAction
// Complete .. CO // Complete .. CO
if (docStatus.equals(DocumentEngine.STATUS_Completed)) if (docStatus.equals(DocumentEngine.STATUS_Completed))
{ {
options[index++] = DocumentEngine.ACTION_Void; if (periodOpen) {
options[index++] = DocumentEngine.ACTION_Reverse_Correct; options[index++] = DocumentEngine.ACTION_Reverse_Correct;
}
options[index++] = DocumentEngine.ACTION_Reverse_Accrual; options[index++] = DocumentEngine.ACTION_Reverse_Accrual;
} }
} }
@ -1040,9 +1044,11 @@ public class DocumentEngine implements DocAction
// Complete .. CO // Complete .. CO
if (docStatus.equals(DocumentEngine.STATUS_Completed)) if (docStatus.equals(DocumentEngine.STATUS_Completed))
{ {
options[index++] = DocumentEngine.ACTION_Reverse_Correct; if (periodOpen) {
options[index++] = DocumentEngine.ACTION_Reverse_Correct;
options[index++] = DocumentEngine.ACTION_ReActivate;
}
options[index++] = DocumentEngine.ACTION_Reverse_Accrual; options[index++] = DocumentEngine.ACTION_Reverse_Accrual;
options[index++] = DocumentEngine.ACTION_ReActivate;
} }
} }
/******************** /********************
@ -1053,8 +1059,9 @@ public class DocumentEngine implements DocAction
// Complete .. CO // Complete .. CO
if (docStatus.equals(DocumentEngine.STATUS_Completed)) if (docStatus.equals(DocumentEngine.STATUS_Completed))
{ {
options[index++] = DocumentEngine.ACTION_Void; if (periodOpen) {
options[index++] = DocumentEngine.ACTION_Reverse_Correct; options[index++] = DocumentEngine.ACTION_Reverse_Correct;
}
options[index++] = DocumentEngine.ACTION_Reverse_Accrual; options[index++] = DocumentEngine.ACTION_Reverse_Accrual;
} }
} }
@ -1078,7 +1085,9 @@ public class DocumentEngine implements DocAction
// Complete .. CO // Complete .. CO
if (docStatus.equals(DocumentEngine.STATUS_Completed)) if (docStatus.equals(DocumentEngine.STATUS_Completed))
{ {
options[index++] = DocumentEngine.ACTION_Void; if (periodOpen) {
options[index++] = DocumentEngine.ACTION_Void;
}
} }
} }
/******************** /********************
@ -1090,8 +1099,9 @@ public class DocumentEngine implements DocAction
// Complete .. CO // Complete .. CO
if (docStatus.equals(DocumentEngine.STATUS_Completed)) if (docStatus.equals(DocumentEngine.STATUS_Completed))
{ {
options[index++] = DocumentEngine.ACTION_Void; if (periodOpen) {
options[index++] = DocumentEngine.ACTION_Reverse_Correct; options[index++] = DocumentEngine.ACTION_Reverse_Correct;
}
options[index++] = DocumentEngine.ACTION_Reverse_Accrual; options[index++] = DocumentEngine.ACTION_Reverse_Accrual;
} }
} }
@ -1129,8 +1139,9 @@ public class DocumentEngine implements DocAction
// Complete .. CO // Complete .. CO
else if (docStatus.equals(DocumentEngine.STATUS_Completed)) else if (docStatus.equals(DocumentEngine.STATUS_Completed))
{ {
options[index++] = DocumentEngine.ACTION_Void; if (periodOpen) {
options[index++] = DocumentEngine.ACTION_Reverse_Correct; options[index++] = DocumentEngine.ACTION_Reverse_Correct;
}
options[index++] = DocumentEngine.ACTION_Reverse_Accrual; options[index++] = DocumentEngine.ACTION_Reverse_Accrual;
} }

View File

@ -866,9 +866,9 @@ public class ConfigurationData
Ini.setAdempiereHome(m_adempiereHome.getAbsolutePath()); Ini.setAdempiereHome(m_adempiereHome.getAbsolutePath());
// Create Connection // Create Connection
String ccType = Database.DB_POSTGRESQL; String ccType = Database.DB_ORACLE;
if (getDatabaseType().equals(DBTYPE_ORACLE)) if (getDatabaseType() != null && !getDatabaseType().equals(Database.DB_ORACLE))
ccType = Database.DB_ORACLE; ccType = getDatabaseType();
CConnection cc = null; CConnection cc = null;
try try
{ {
@ -1127,12 +1127,6 @@ public class ConfigurationData
* Database Settings * Database Settings
*************************************************************************/ *************************************************************************/
/** Oracle directory */
private static String DBTYPE_ORACLE = "Oracle";
/** PostgreSQL */
private static String DBTYPE_POSTGRESQL = "PostgreSQL";
/** Database Types */ /** Database Types */
public static String[] DBTYPE = null; public static String[] DBTYPE = null;
//end e-evolution vpj-cd 02/07/2005 PostgreSQL //end e-evolution vpj-cd 02/07/2005 PostgreSQL

View File

@ -18,7 +18,8 @@ goto START
:START :START
@REM Setup idempiere.properties and idempiereEnv.properties @REM Setup idempiere.properties and idempiereEnv.properties
@"%JAVA%" -jar plugins/org.eclipse.equinox.launcher_1.*.jar -install setup -configuration setup/configuration -application org.adempiere.install.console-application FOR %%c in (plugins\org.eclipse.equinox.launcher_1.*.jar) DO set JARFILE=%%c
@"%JAVA%" -jar %JARFILE% -install setup -configuration setup/configuration -application org.adempiere.install.console-application
@Echo ErrorLevel = %ERRORLEVEL% @Echo ErrorLevel = %ERRORLEVEL%
@IF NOT ERRORLEVEL = 1 GOTO NEXT @IF NOT ERRORLEVEL = 1 GOTO NEXT
@ -30,7 +31,7 @@ goto START
:NEXT :NEXT
@REM setup jetty @REM setup jetty
@"%JAVA%" -jar plugins/org.eclipse.equinox.launcher_1.*.jar -install setup -configuration setup/configuration -application org.eclipse.ant.core.antRunner -buildfile build.xml @"%JAVA%" -jar %JARFILE% -install setup -configuration setup/configuration -application org.eclipse.ant.core.antRunner -buildfile build.xml
@Echo . @Echo .
@Echo For problems, check log file in base directory @Echo For problems, check log file in base directory

View File

@ -17,4 +17,5 @@ goto START
@Echo Starting iDempiere Server ... @Echo Starting iDempiere Server ...
@Echo ======================================= @Echo =======================================
@"%JAVA%" -Dosgi.console=localhost:12612 -Djetty.home=jettyhome -Djetty.etc.config.urls=etc/jetty.xml,etc/jetty-selector.xml,etc/jetty-ssl.xml,etc/jetty-https.xml,etc/jetty-deployer.xml -XX:MaxPermSize=192m -Dmail.mime.encodefilename=true -Dmail.mime.decodefilename=true -Dmail.mime.encodeparameters=true -Dmail.mime.decodeparameters=true -jar plugins/org.eclipse.equinox.launcher_1.*.jar -application org.adempiere.server.application FOR %%c in (plugins\org.eclipse.equinox.launcher_1.*.jar) DO set JARFILE=%%c
@"%JAVA%" -Dosgi.console=localhost:12612 -Djetty.home=jettyhome -Djetty.etc.config.urls=etc/jetty.xml,etc/jetty-selector.xml,etc/jetty-ssl.xml,etc/jetty-https.xml,etc/jetty-deployer.xml -XX:MaxPermSize=192m -Dmail.mime.encodefilename=true -Dmail.mime.decodefilename=true -Dmail.mime.encodeparameters=true -Dmail.mime.decodeparameters=true -jar %JARFILE% -application org.adempiere.server.application

View File

@ -18,7 +18,8 @@ goto START
:START :START
@REM Setup idempiere.properties and idempiereEnv.properties @REM Setup idempiere.properties and idempiereEnv.properties
@"%JAVA%" -jar plugins/org.eclipse.equinox.launcher_1.*.jar -install setup -configuration setup/configuration -application org.adempiere.install.application -consoleLog FOR %%c in (plugins\org.eclipse.equinox.launcher_1.*.jar) DO set JARFILE=%%c
@"%JAVA%" -jar %JARFILE% -install setup -configuration setup/configuration -application org.adempiere.install.application -consoleLog
@Echo ErrorLevel = %ERRORLEVEL% @Echo ErrorLevel = %ERRORLEVEL%
@IF NOT ERRORLEVEL = 1 GOTO NEXT @IF NOT ERRORLEVEL = 1 GOTO NEXT
@ -31,7 +32,7 @@ goto START
:NEXT :NEXT
@REM setup jetty @REM setup jetty
@Echo ... Setup Jetty @Echo ... Setup Jetty
@"%JAVA%" -jar plugins/org.eclipse.equinox.launcher_1.*.jar -install setup -configuration setup/configuration -application org.eclipse.ant.core.antRunner -buildfile build.xml @"%JAVA%" -jar %JARFILE% -install setup -configuration setup/configuration -application org.eclipse.ant.core.antRunner -buildfile build.xml
@Echo ... @Echo ...
@Echo For problems, check log file in base directory @Echo For problems, check log file in base directory

View File

@ -36,7 +36,7 @@ public class XLookup extends Lookup
/** /**
* *
*/ */
private static final long serialVersionUID = 1388987648081532657L; private static final long serialVersionUID = -1960941688071305272L;
/** /**
* Manual Lookup * Manual Lookup
@ -94,6 +94,11 @@ public class XLookup extends Lookup
return false; return false;
} // containsKey } // containsKey
public boolean containsKeyNoDirect (Object key)
{
return containsKey(key);
}
/** /**
* Get Object of Key Value * Get Object of Key Value
* @param key key * @param key key

View File

@ -37,9 +37,11 @@ import org.compiere.model.GridTab;
import org.compiere.model.MAllocationHdr; import org.compiere.model.MAllocationHdr;
import org.compiere.model.MBankStatement; import org.compiere.model.MBankStatement;
import org.compiere.model.MDocType; import org.compiere.model.MDocType;
import org.compiere.model.MPeriod;
import org.compiere.model.MProduction; import org.compiere.model.MProduction;
import org.compiere.model.MTable; import org.compiere.model.MTable;
import org.compiere.model.PO; import org.compiere.model.PO;
import org.compiere.process.DocAction;
import org.compiere.process.DocOptions; import org.compiere.process.DocOptions;
import org.compiere.process.DocumentEngine; import org.compiere.process.DocumentEngine;
import org.compiere.swing.CComboBox; import org.compiere.swing.CComboBox;
@ -235,12 +237,16 @@ public class VDocAction extends CDialog
/******************* /*******************
* General Actions * General Actions
*/ */
String[] docActionHolder = new String[] {DocAction};
index = DocumentEngine.getValidActions(DocStatus, Processing, OrderType, IsSOTrx, m_AD_Table_ID,
docActionHolder, options);
MTable table = MTable.get(Env.getCtx(), m_AD_Table_ID); MTable table = MTable.get(Env.getCtx(), m_AD_Table_ID);
PO po = table.getPO(Record_ID, null); PO po = table.getPO(Record_ID, null);
boolean periodOpen = true;
if (po instanceof DocAction)
periodOpen = MPeriod.isOpen(Env.getCtx(), m_AD_Table_ID, Record_ID, null);
String[] docActionHolder = new String[] {DocAction};
index = DocumentEngine.getValidActions(DocStatus, Processing, OrderType, IsSOTrx, m_AD_Table_ID,
docActionHolder, options, periodOpen);
if (po instanceof DocOptions) if (po instanceof DocOptions)
index = ((DocOptions) po).customizeValidActions(DocStatus, Processing, OrderType, IsSOTrx, index = ((DocOptions) po).customizeValidActions(DocStatus, Processing, OrderType, IsSOTrx,
m_AD_Table_ID, docActionHolder, options, index); m_AD_Table_ID, docActionHolder, options, index);

View File

@ -39,9 +39,11 @@ import org.compiere.model.MAllocationHdr;
import org.compiere.model.MBankStatement; import org.compiere.model.MBankStatement;
import org.compiere.model.MClientInfo; import org.compiere.model.MClientInfo;
import org.compiere.model.MDocType; import org.compiere.model.MDocType;
import org.compiere.model.MPeriod;
import org.compiere.model.MProduction; import org.compiere.model.MProduction;
import org.compiere.model.MTable; import org.compiere.model.MTable;
import org.compiere.model.PO; import org.compiere.model.PO;
import org.compiere.process.DocAction;
import org.compiere.process.DocOptions; import org.compiere.process.DocOptions;
import org.compiere.process.DocumentEngine; import org.compiere.process.DocumentEngine;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
@ -66,7 +68,7 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
/** /**
* *
*/ */
private static final long serialVersionUID = -1467198100278350775L; private static final long serialVersionUID = -2166149559040327486L;
private Label lblDocAction; private Label lblDocAction;
private Label label; private Label label;
@ -160,12 +162,16 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
* General Actions * General Actions
*/ */
String[] docActionHolder = new String[]{DocAction};
index = DocumentEngine.getValidActions(DocStatus, Processing, OrderType, IsSOTrx,
m_AD_Table_ID, docActionHolder, options);
MTable table = MTable.get(Env.getCtx(), m_AD_Table_ID); MTable table = MTable.get(Env.getCtx(), m_AD_Table_ID);
PO po = table.getPO(gridTab.getRecord_ID(), null); PO po = table.getPO(gridTab.getRecord_ID(), null);
boolean periodOpen = true;
if (po instanceof DocAction)
periodOpen = MPeriod.isOpen(Env.getCtx(), m_AD_Table_ID, gridTab.getRecord_ID(), null);
String[] docActionHolder = new String[]{DocAction};
index = DocumentEngine.getValidActions(DocStatus, Processing, OrderType, IsSOTrx,
m_AD_Table_ID, docActionHolder, options, periodOpen);
if (po instanceof DocOptions) if (po instanceof DocOptions)
index = ((DocOptions) po).customizeValidActions(DocStatus, Processing, OrderType, IsSOTrx, index = ((DocOptions) po).customizeValidActions(DocStatus, Processing, OrderType, IsSOTrx,
m_AD_Table_ID, docActionHolder, options, index); m_AD_Table_ID, docActionHolder, options, index);

View File

@ -1362,8 +1362,6 @@ public class DB_Oracle implements AdempiereDatabase
} }
rs = stmt.executeQuery(); rs = stmt.executeQuery();
if (rs.next()) { if (rs.next()) {
// reload the record being locked - it could have changed in a different thread - IDEMPIERE-2629
po.load(po.get_TrxName());
return true; return true;
} else { } else {
return false; return false;

View File

@ -1089,8 +1089,6 @@ public class DB_PostgreSQL implements AdempiereDatabase
rs = stmt.executeQuery(); rs = stmt.executeQuery();
if (rs.next()) { if (rs.next()) {
// reload the record being locked - it could have changed in a different thread - IDEMPIERE-2629
po.load(po.get_TrxName());
return true; return true;
} else { } else {
return false; return false;

View File

@ -47,11 +47,11 @@ import org.w3c.dom.Document;
* *
*/ */
public class GetListLookup extends Lookup { public class GetListLookup extends Lookup {
/** /**
* generated serial id *
*/ */
private static final long serialVersionUID = -137206840260406730L; private static final long serialVersionUID = 2582520499473909390L;
private String filter; private String filter;
private String serviceType; private String serviceType;
private String endPoint; private String endPoint;
@ -203,6 +203,11 @@ public class GetListLookup extends Lookup {
return dataMap.containsKey(key); return dataMap.containsKey(key);
} }
public boolean containsKeyNoDirect (Object key)
{
return containsKey(key);
}
/** /**
* Refresh & return number of items read. * Refresh & return number of items read.
* Get get data of parent lookups * Get get data of parent lookups

View File

@ -51,11 +51,11 @@ import org.w3c.dom.Node;
* *
*/ */
public class QueryDataLookup extends Lookup { public class QueryDataLookup extends Lookup {
/** /**
* generated serial id *
*/ */
private static final long serialVersionUID = -137206840260406730L; private static final long serialVersionUID = -1322365740845617635L;
private String filter; private String filter;
private String serviceType; private String serviceType;
private String endPoint; private String endPoint;
@ -219,6 +219,11 @@ public class QueryDataLookup extends Lookup {
return dataMap.containsKey(key); return dataMap.containsKey(key);
} }
public boolean containsKeyNoDirect (Object key)
{
return containsKey(key);
}
/** /**
* Refresh & return number of items read. * Refresh & return number of items read.
* Get get data of parent lookups * Get get data of parent lookups