Bug fix for [1985481] - Processed documents can be edited
https://sourceforge.net/tracker/?func=detail&atid=879332&aid=1985481&group_id=176962
This commit is contained in:
parent
80be2b2e58
commit
809c1cf2da
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
|
@ -83,7 +83,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1010889420871357683L;
|
private static final long serialVersionUID = 1021401221795805887L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Tab (Model) from Value Object.
|
* Create Tab (Model) from Value Object.
|
||||||
|
|
@ -92,8 +92,9 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
* DataStatusListener for communicating changes of the underlying data
|
* DataStatusListener for communicating changes of the underlying data
|
||||||
* @param vo Value Object
|
* @param vo Value Object
|
||||||
*/
|
*/
|
||||||
public GridTab(GridTabVO vo)
|
public GridTab(GridTabVO vo, GridWindow w)
|
||||||
{
|
{
|
||||||
|
m_window = w;
|
||||||
m_vo = vo;
|
m_vo = vo;
|
||||||
// Create MTable
|
// Create MTable
|
||||||
m_mTable = new GridTable (m_vo.ctx, m_vo.AD_Table_ID, m_vo.TableName, m_vo.WindowNo, m_vo.TabNo, true);
|
m_mTable = new GridTable (m_vo.ctx, m_vo.AD_Table_ID, m_vo.TableName, m_vo.WindowNo, m_vo.TabNo, true);
|
||||||
|
|
@ -106,6 +107,9 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
/** Value Object */
|
/** Value Object */
|
||||||
private GridTabVO m_vo;
|
private GridTabVO m_vo;
|
||||||
|
|
||||||
|
// The window of this tab
|
||||||
|
private GridWindow m_window;
|
||||||
|
|
||||||
/** The Table Model for Query */
|
/** The Table Model for Query */
|
||||||
private GridTable m_mTable = null;
|
private GridTable m_mTable = null;
|
||||||
|
|
||||||
|
|
@ -857,7 +861,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Uncoditionally Save data
|
* Unconditionally Save data
|
||||||
* @param manualCmd if true, no vetoable PropertyChange will be fired for save confirmation from MTable
|
* @param manualCmd if true, no vetoable PropertyChange will be fired for save confirmation from MTable
|
||||||
* @return true if save complete (or nor required)
|
* @return true if save complete (or nor required)
|
||||||
*/
|
*/
|
||||||
|
|
@ -866,6 +870,9 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
log.fine("#" + m_vo.TabNo + " - row=" + m_currentRow);
|
log.fine("#" + m_vo.TabNo + " - row=" + m_currentRow);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (hasChangedCurrentTabAndParents())
|
||||||
|
return false;
|
||||||
|
|
||||||
boolean retValue = (m_mTable.dataSave(manualCmd) == GridTable.SAVE_OK);
|
boolean retValue = (m_mTable.dataSave(manualCmd) == GridTable.SAVE_OK);
|
||||||
if (manualCmd)
|
if (manualCmd)
|
||||||
setCurrentRow(m_currentRow, false);
|
setCurrentRow(m_currentRow, false);
|
||||||
|
|
@ -879,6 +886,45 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
return false;
|
return false;
|
||||||
} // dataSave
|
} // dataSave
|
||||||
|
|
||||||
|
// Validate if the current tab record has changed in database or any parent record
|
||||||
|
// Return if there are changes
|
||||||
|
public boolean hasChangedCurrentTabAndParents() {
|
||||||
|
String msg = null;
|
||||||
|
// Carlos Ruiz / globalqss - [ adempiere-Bugs-1985481 ] Processed documents can be edited
|
||||||
|
// Validate that current record has not changed and validate that every parent above has not changed
|
||||||
|
if (m_mTable.hasChanged(m_currentRow)) {
|
||||||
|
// return error stating that current record has changed and it cannot be saved
|
||||||
|
msg = "Current record was changed by another user, please ReQuery";
|
||||||
|
log.saveError("CurrentRecordModified", msg, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (isDetail()) {
|
||||||
|
// get parent tab
|
||||||
|
// the parent tab is the first tab above with level = this_tab_level-1
|
||||||
|
int level = m_vo.TabLevel;
|
||||||
|
for (int i = m_window.getTabIndex(this) - 1; i >= 0; i--) {
|
||||||
|
GridTab parentTab = m_window.getTab(i);
|
||||||
|
if (parentTab.m_vo.TabLevel == level-1) {
|
||||||
|
// this is parent tab
|
||||||
|
if (parentTab.m_mTable.hasChanged(parentTab.m_currentRow)) {
|
||||||
|
// return error stating that current record has changed and it cannot be saved
|
||||||
|
msg = "Record on parent tab " + parentTab.getName() + " was changed by another user, please ReQuery";
|
||||||
|
log.saveError("ParentRecordModified", msg, false);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
// search for the next parent
|
||||||
|
if (parentTab.isDetail()) {
|
||||||
|
level = parentTab.m_vo.TabLevel;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do we need to Save?
|
* Do we need to Save?
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
|
@ -50,7 +50,7 @@ import org.compiere.util.ValueNamePair;
|
||||||
/**
|
/**
|
||||||
* Grid Table Model for JDBC access including buffering.
|
* Grid Table Model for JDBC access including buffering.
|
||||||
* <pre>
|
* <pre>
|
||||||
* The following data types are handeled
|
* The following data types are handled
|
||||||
* Integer for all IDs
|
* Integer for all IDs
|
||||||
* BigDecimal for all Numbers
|
* BigDecimal for all Numbers
|
||||||
* Timestamp for all Dates
|
* Timestamp for all Dates
|
||||||
|
|
@ -80,7 +80,7 @@ public class GridTable extends AbstractTableModel
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -4468782288142337285L;
|
private static final long serialVersionUID = 4071601543088224064L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JDBC Based Buffered Table
|
* JDBC Based Buffered Table
|
||||||
|
|
@ -3146,4 +3146,33 @@ public class GridTable extends AbstractTableModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // setFieldVFormat
|
} // setFieldVFormat
|
||||||
|
|
||||||
|
// verify if the current record has changed
|
||||||
|
public boolean hasChanged(int row) {
|
||||||
|
// not so aggressive (it can has still concurrency problems)
|
||||||
|
// compare Updated, IsProcessed
|
||||||
|
if (getKeyID(row) > 0) {
|
||||||
|
int colUpdated = findColumn("Updated");
|
||||||
|
if (colUpdated > 0) {
|
||||||
|
Timestamp memUpdated = (Timestamp) getValueAt(row, colUpdated);
|
||||||
|
Timestamp dbUpdated = DB.getSQLValueTSEx(null, "SELECT Updated FROM " + m_tableName + " WHERE " + m_tableName + "_ID=?" , getKeyID(row));
|
||||||
|
if (! memUpdated.equals(dbUpdated))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int colProcessed = findColumn("Processed");
|
||||||
|
if (colProcessed > 0) {
|
||||||
|
Boolean memProcessed = (Boolean) getValueAt(row, colProcessed);
|
||||||
|
String dbProcessedS = DB.getSQLValueStringEx(null, "SELECT Processed FROM " + m_tableName + " WHERE " + m_tableName + "_ID=?" , getKeyID(row));
|
||||||
|
Boolean dbProcessed = Boolean.TRUE;
|
||||||
|
if (! dbProcessedS.equals("Y"))
|
||||||
|
dbProcessed = Boolean.FALSE;
|
||||||
|
if (! memProcessed.equals(dbProcessed))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @TODO: configurable aggressive - compare each column with the DB
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
|
@ -141,7 +141,7 @@ public class GridWindow implements Serializable
|
||||||
GridTabVO mTabVO = (GridTabVO)m_vo.Tabs.get(t);
|
GridTabVO mTabVO = (GridTabVO)m_vo.Tabs.get(t);
|
||||||
if (mTabVO != null)
|
if (mTabVO != null)
|
||||||
{
|
{
|
||||||
GridTab mTab = new GridTab(mTabVO);
|
GridTab mTab = new GridTab(mTabVO, this);
|
||||||
m_tabs.add(mTab);
|
m_tabs.add(mTab);
|
||||||
}
|
}
|
||||||
} // for all tabs
|
} // for all tabs
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
|
@ -52,7 +52,7 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 4780252534394959680L;
|
private static final long serialVersionUID = 8726957992840702609L;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -758,5 +758,17 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
|
||||||
log.log(Level.SEVERE, "BP not updated - " + bp);
|
log.log(Level.SEVERE, "BP not updated - " + bp);
|
||||||
}
|
}
|
||||||
} // updateBP
|
} // updateBP
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document Status is Complete or Closed
|
||||||
|
* @return true if CO, CL or RE
|
||||||
|
*/
|
||||||
|
public boolean isComplete()
|
||||||
|
{
|
||||||
|
String ds = getDocStatus();
|
||||||
|
return DOCSTATUS_Completed.equals(ds)
|
||||||
|
|| DOCSTATUS_Closed.equals(ds)
|
||||||
|
|| DOCSTATUS_Reversed.equals(ds);
|
||||||
|
} // isComplete
|
||||||
|
|
||||||
} // MAllocation
|
} // MAllocation
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import java.util.logging.Level;
|
||||||
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;
|
||||||
|
import org.compiere.util.Msg;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -35,7 +36,6 @@ import org.compiere.util.Env;
|
||||||
*/
|
*/
|
||||||
public class MAllocationLine extends X_C_AllocationLine
|
public class MAllocationLine extends X_C_AllocationLine
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -183,6 +183,10 @@ public class MAllocationLine extends X_C_AllocationLine
|
||||||
*/
|
*/
|
||||||
protected boolean beforeSave (boolean newRecord)
|
protected boolean beforeSave (boolean newRecord)
|
||||||
{
|
{
|
||||||
|
if (newRecord && getParent().isComplete()) {
|
||||||
|
log.saveError("ParentComplete", Msg.translate(getCtx(), "C_AllocationLine"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!newRecord
|
if (!newRecord
|
||||||
&& (is_ValueChanged("C_BPartner_ID") || is_ValueChanged("C_Invoice_ID")))
|
&& (is_ValueChanged("C_BPartner_ID") || is_ValueChanged("C_Invoice_ID")))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -6137737123031721451L;
|
private static final long serialVersionUID = -859925588789443186L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
@ -671,5 +671,17 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
|
||||||
// return pl.getC_Currency_ID();
|
// return pl.getC_Currency_ID();
|
||||||
return 0;
|
return 0;
|
||||||
} // getC_Currency_ID
|
} // getC_Currency_ID
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document Status is Complete or Closed
|
||||||
|
* @return true if CO, CL or RE
|
||||||
|
*/
|
||||||
|
public boolean isComplete()
|
||||||
|
{
|
||||||
|
String ds = getDocStatus();
|
||||||
|
return DOCSTATUS_Completed.equals(ds)
|
||||||
|
|| DOCSTATUS_Closed.equals(ds)
|
||||||
|
|| DOCSTATUS_Reversed.equals(ds);
|
||||||
|
} // isComplete
|
||||||
|
|
||||||
} // MBankStatement
|
} // MBankStatement
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ import org.compiere.util.Msg;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -7260240724584085587L;
|
private static final long serialVersionUID = 1914411222159254809L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
@ -154,6 +154,10 @@ import org.compiere.util.Msg;
|
||||||
*/
|
*/
|
||||||
protected boolean beforeSave (boolean newRecord)
|
protected boolean beforeSave (boolean newRecord)
|
||||||
{
|
{
|
||||||
|
if (newRecord && getParent().isComplete()) {
|
||||||
|
log.saveError("ParentComplete", Msg.translate(getCtx(), "C_BankStatementLine"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (getChargeAmt().signum() != 0 && getC_Charge_ID() == 0)
|
if (getChargeAmt().signum() != 0 && getC_Charge_ID() == 0)
|
||||||
{
|
{
|
||||||
log.saveError("FillMandatory", Msg.getElement(getCtx(), "C_Charge_ID"));
|
log.saveError("FillMandatory", Msg.getElement(getCtx(), "C_Charge_ID"));
|
||||||
|
|
@ -198,6 +202,19 @@ import org.compiere.util.Msg;
|
||||||
return true;
|
return true;
|
||||||
} // beforeSave
|
} // beforeSave
|
||||||
|
|
||||||
|
/** Parent */
|
||||||
|
private MBankStatement m_parent = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Parent
|
||||||
|
* @return parent
|
||||||
|
*/
|
||||||
|
public MBankStatement getParent()
|
||||||
|
{
|
||||||
|
if (m_parent == null)
|
||||||
|
m_parent = new MBankStatement (getCtx(), getC_BankStatement_ID(), get_TrxName());
|
||||||
|
return m_parent;
|
||||||
|
} // getParent
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After Save
|
* After Save
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ public class MCash extends X_C_Cash implements DocAction
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 9153922329895288746L;
|
private static final long serialVersionUID = -1221144207418749593L;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -838,4 +838,16 @@ public class MCash extends X_C_Cash implements DocAction
|
||||||
return getCashBook().getC_Currency_ID();
|
return getCashBook().getC_Currency_ID();
|
||||||
} // getC_Currency_ID
|
} // getC_Currency_ID
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document Status is Complete or Closed
|
||||||
|
* @return true if CO, CL or RE
|
||||||
|
*/
|
||||||
|
public boolean isComplete()
|
||||||
|
{
|
||||||
|
String ds = getDocStatus();
|
||||||
|
return DOCSTATUS_Completed.equals(ds)
|
||||||
|
|| DOCSTATUS_Closed.equals(ds)
|
||||||
|
|| DOCSTATUS_Reversed.equals(ds);
|
||||||
|
} // isComplete
|
||||||
|
|
||||||
} // MCash
|
} // MCash
|
||||||
|
|
|
||||||
|
|
@ -303,6 +303,10 @@ public class MCashLine extends X_C_CashLine
|
||||||
*/
|
*/
|
||||||
protected boolean beforeSave (boolean newRecord)
|
protected boolean beforeSave (boolean newRecord)
|
||||||
{
|
{
|
||||||
|
if (newRecord && getParent().isComplete()) {
|
||||||
|
log.saveError("ParentComplete", Msg.translate(getCtx(), "C_CashLine"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Cannot change generated Invoices
|
// Cannot change generated Invoices
|
||||||
if (is_ValueChanged(COLUMNNAME_C_Invoice_ID))
|
if (is_ValueChanged(COLUMNNAME_C_Invoice_ID))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
|
@ -488,7 +488,11 @@ public class MInOutLine extends X_M_InOutLine
|
||||||
*/
|
*/
|
||||||
protected boolean beforeSave (boolean newRecord)
|
protected boolean beforeSave (boolean newRecord)
|
||||||
{
|
{
|
||||||
log.fine("");
|
log.fine("");
|
||||||
|
if (newRecord && getParent().isComplete()) {
|
||||||
|
log.saveError("ParentComplete", Msg.translate(getCtx(), "M_InOutLine"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Locator is mandatory if no charge is defined - teo_sarca BF [ 2757978 ]
|
// Locator is mandatory if no charge is defined - teo_sarca BF [ 2757978 ]
|
||||||
if (getM_Locator_ID() <= 0 && getC_Charge_ID() <= 0)
|
if (getM_Locator_ID() <= 0 && getC_Charge_ID() <= 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,9 @@ import org.compiere.util.Msg;
|
||||||
public class MInventory extends X_M_Inventory implements DocAction
|
public class MInventory extends X_M_Inventory implements DocAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* generated serialVersionUID
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 6039577059413522140L;
|
private static final long serialVersionUID = 910998472569265447L;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -969,4 +969,17 @@ public class MInventory extends X_M_Inventory implements DocAction
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document Status is Complete or Closed
|
||||||
|
* @return true if CO, CL or RE
|
||||||
|
*/
|
||||||
|
public boolean isComplete()
|
||||||
|
{
|
||||||
|
String ds = getDocStatus();
|
||||||
|
return DOCSTATUS_Completed.equals(ds)
|
||||||
|
|| DOCSTATUS_Closed.equals(ds)
|
||||||
|
|| DOCSTATUS_Reversed.equals(ds);
|
||||||
|
} // isComplete
|
||||||
|
|
||||||
} // MInventory
|
} // MInventory
|
||||||
|
|
|
||||||
|
|
@ -304,6 +304,10 @@ public class MInventoryLine extends X_M_InventoryLine
|
||||||
*/
|
*/
|
||||||
protected boolean beforeSave (boolean newRecord)
|
protected boolean beforeSave (boolean newRecord)
|
||||||
{
|
{
|
||||||
|
if (newRecord && getParent().isComplete()) {
|
||||||
|
log.saveError("ParentComplete", Msg.translate(getCtx(), "M_InventoryLine"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (newRecord && m_isManualEntry)
|
if (newRecord && m_isManualEntry)
|
||||||
{
|
{
|
||||||
// Product requires ASI
|
// Product requires ASI
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,11 @@ import org.eevolution.model.MPPProductBOMLine;
|
||||||
*/
|
*/
|
||||||
public class MInvoice extends X_C_Invoice implements DocAction
|
public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -11169828430680188L;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Payments Of BPartner
|
* Get Payments Of BPartner
|
||||||
|
|
@ -2382,5 +2386,17 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document Status is Complete or Closed
|
||||||
|
* @return true if CO, CL or RE
|
||||||
|
*/
|
||||||
|
public boolean isComplete()
|
||||||
|
{
|
||||||
|
String ds = getDocStatus();
|
||||||
|
return DOCSTATUS_Completed.equals(ds)
|
||||||
|
|| DOCSTATUS_Closed.equals(ds)
|
||||||
|
|| DOCSTATUS_Reversed.equals(ds);
|
||||||
|
} // isComplete
|
||||||
|
|
||||||
} // MInvoice
|
} // MInvoice
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
|
@ -27,6 +27,7 @@ import java.util.logging.Level;
|
||||||
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;
|
||||||
|
import org.compiere.util.Msg;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -764,6 +765,10 @@ public class MInvoiceLine extends X_C_InvoiceLine
|
||||||
protected boolean beforeSave (boolean newRecord)
|
protected boolean beforeSave (boolean newRecord)
|
||||||
{
|
{
|
||||||
log.fine("New=" + newRecord);
|
log.fine("New=" + newRecord);
|
||||||
|
if (newRecord && getParent().isComplete()) {
|
||||||
|
log.saveError("ParentComplete", Msg.translate(getCtx(), "C_InvoiceLine"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Re-set invoice header (need to update m_IsSOTrx flag) - phib [ 1686773 ]
|
// Re-set invoice header (need to update m_IsSOTrx flag) - phib [ 1686773 ]
|
||||||
setInvoice(getParent());
|
setInvoice(getParent());
|
||||||
// Charge
|
// Charge
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ public class MJournal extends X_GL_Journal implements DocAction
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 5461368562157627495L;
|
private static final long serialVersionUID = -364132249042527640L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
@ -882,5 +882,17 @@ public class MJournal extends X_GL_Journal implements DocAction
|
||||||
{
|
{
|
||||||
return getTotalDr();
|
return getTotalDr();
|
||||||
} // getApprovalAmt
|
} // getApprovalAmt
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document Status is Complete or Closed
|
||||||
|
* @return true if CO, CL or RE
|
||||||
|
*/
|
||||||
|
public boolean isComplete()
|
||||||
|
{
|
||||||
|
String ds = getDocStatus();
|
||||||
|
return DOCSTATUS_Completed.equals(ds)
|
||||||
|
|| DOCSTATUS_Closed.equals(ds)
|
||||||
|
|| DOCSTATUS_Reversed.equals(ds);
|
||||||
|
} // isComplete
|
||||||
|
|
||||||
} // MJournal
|
} // MJournal
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
|
@ -23,6 +23,7 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Msg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Journal Line Model
|
* Journal Line Model
|
||||||
|
|
@ -35,7 +36,7 @@ public class MJournalLine extends X_GL_JournalLine
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1873359101491826792L;
|
private static final long serialVersionUID = -7008806797777773843L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
@ -90,6 +91,21 @@ public class MJournalLine extends X_GL_JournalLine
|
||||||
|
|
||||||
} // MJournalLine
|
} // MJournalLine
|
||||||
|
|
||||||
|
/** Parent */
|
||||||
|
private MJournal m_parent = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Parent
|
||||||
|
* @return parent
|
||||||
|
*/
|
||||||
|
public MJournal getParent()
|
||||||
|
{
|
||||||
|
if (m_parent == null)
|
||||||
|
m_parent = new MJournal (getCtx(), getGL_Journal_ID(), get_TrxName());
|
||||||
|
return m_parent;
|
||||||
|
} // getParent
|
||||||
|
|
||||||
|
|
||||||
/** Currency Precision */
|
/** Currency Precision */
|
||||||
private int m_precision = 2;
|
private int m_precision = 2;
|
||||||
/** Account Combination */
|
/** Account Combination */
|
||||||
|
|
@ -270,6 +286,10 @@ public class MJournalLine extends X_GL_JournalLine
|
||||||
*/
|
*/
|
||||||
protected boolean beforeSave (boolean newRecord)
|
protected boolean beforeSave (boolean newRecord)
|
||||||
{
|
{
|
||||||
|
if (newRecord && getParent().isComplete()) {
|
||||||
|
log.saveError("ParentComplete", Msg.translate(getCtx(), "GL_JournalLine"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Acct Amts
|
// Acct Amts
|
||||||
BigDecimal rate = getCurrencyRate();
|
BigDecimal rate = getCurrencyRate();
|
||||||
BigDecimal amt = rate.multiply(getAmtSourceDr());
|
BigDecimal amt = rate.multiply(getAmtSourceDr());
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public class MMovement extends X_M_Movement implements DocAction
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -2900004259579407998L;
|
private static final long serialVersionUID = 3634169801280239573L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
@ -867,6 +867,18 @@ public class MMovement extends X_M_Movement implements DocAction
|
||||||
{
|
{
|
||||||
return m_reversal;
|
return m_reversal;
|
||||||
} // isReversal
|
} // isReversal
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document Status is Complete or Closed
|
||||||
|
* @return true if CO, CL or RE
|
||||||
|
*/
|
||||||
|
public boolean isComplete()
|
||||||
|
{
|
||||||
|
String ds = getDocStatus();
|
||||||
|
return DOCSTATUS_Completed.equals(ds)
|
||||||
|
|| DOCSTATUS_Closed.equals(ds)
|
||||||
|
|| DOCSTATUS_Reversed.equals(ds);
|
||||||
|
} // isComplete
|
||||||
|
|
||||||
} // MMovement
|
} // MMovement
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,10 @@ public class MMovementLine extends X_M_MovementLine
|
||||||
@Override
|
@Override
|
||||||
protected boolean beforeSave (boolean newRecord)
|
protected boolean beforeSave (boolean newRecord)
|
||||||
{
|
{
|
||||||
|
if (newRecord && getParent().isComplete()) {
|
||||||
|
log.saveError("ParentComplete", Msg.translate(getCtx(), "M_MovementLine"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Set Line No
|
// Set Line No
|
||||||
if (getLine() == 0)
|
if (getLine() == 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,10 @@ import org.eevolution.model.MPPProductBOMLine;
|
||||||
*/
|
*/
|
||||||
public class MOrder extends X_C_Order implements DocAction
|
public class MOrder extends X_C_Order implements DocAction
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -1575104995897726572L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new Order by copying
|
* Create new Order by copying
|
||||||
|
|
@ -2368,5 +2371,17 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document Status is Complete or Closed
|
||||||
|
* @return true if CO, CL or RE
|
||||||
|
*/
|
||||||
|
public boolean isComplete()
|
||||||
|
{
|
||||||
|
String ds = getDocStatus();
|
||||||
|
return DOCSTATUS_Completed.equals(ds)
|
||||||
|
|| DOCSTATUS_Closed.equals(ds)
|
||||||
|
|| DOCSTATUS_Reversed.equals(ds);
|
||||||
|
} // isComplete
|
||||||
|
|
||||||
} // MOrder
|
} // MOrder
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,6 @@ import org.compiere.util.Msg;
|
||||||
*/
|
*/
|
||||||
public class MOrderLine extends X_C_OrderLine
|
public class MOrderLine extends X_C_OrderLine
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -720,6 +719,10 @@ public class MOrderLine extends X_C_OrderLine
|
||||||
*/
|
*/
|
||||||
protected boolean beforeSave (boolean newRecord)
|
protected boolean beforeSave (boolean newRecord)
|
||||||
{
|
{
|
||||||
|
if (newRecord && getParent().isComplete()) {
|
||||||
|
log.saveError("ParentComplete", Msg.translate(getCtx(), "C_OrderLine"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Get Defaults from Parent
|
// Get Defaults from Parent
|
||||||
if (getC_BPartner_ID() == 0 || getC_BPartner_Location_ID() == 0
|
if (getC_BPartner_ID() == 0 || getC_BPartner_Location_ID() == 0
|
||||||
|| getM_Warehouse_ID() == 0
|
|| getM_Warehouse_ID() == 0
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public class MRMA extends X_M_RMA implements DocAction
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -7911024337541702346L;
|
private static final long serialVersionUID = -2967208431264929454L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
@ -704,4 +704,17 @@ public class MRMA extends X_M_RMA implements DocAction
|
||||||
{
|
{
|
||||||
return getAmt();
|
return getAmt();
|
||||||
} // getApprovalAmt
|
} // getApprovalAmt
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document Status is Complete or Closed
|
||||||
|
* @return true if CO, CL or RE
|
||||||
|
*/
|
||||||
|
public boolean isComplete()
|
||||||
|
{
|
||||||
|
String ds = getDocStatus();
|
||||||
|
return DOCSTATUS_Completed.equals(ds)
|
||||||
|
|| DOCSTATUS_Closed.equals(ds)
|
||||||
|
|| DOCSTATUS_Reversed.equals(ds);
|
||||||
|
} // isComplete
|
||||||
|
|
||||||
} // MRMA
|
} // MRMA
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
|
@ -22,6 +22,7 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Msg;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -32,7 +33,6 @@ import org.compiere.util.Env;
|
||||||
*/
|
*/
|
||||||
public class MRMALine extends X_M_RMALine
|
public class MRMALine extends X_M_RMALine
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -230,6 +230,10 @@ public class MRMALine extends X_M_RMALine
|
||||||
*/
|
*/
|
||||||
protected boolean beforeSave(boolean newRecord)
|
protected boolean beforeSave(boolean newRecord)
|
||||||
{
|
{
|
||||||
|
if (newRecord && getParent().isComplete()) {
|
||||||
|
log.saveError("ParentComplete", Msg.translate(getCtx(), "M_RMALine"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (this.getM_InOutLine_ID() == 0 && this.getC_Charge_ID() == 0)
|
if (this.getM_InOutLine_ID() == 0 && this.getC_Charge_ID() == 0)
|
||||||
{
|
{
|
||||||
log.saveError("FillMandatory", "Shipment/Receipt Line or charge should be entered");
|
log.saveError("FillMandatory", "Shipment/Receipt Line or charge should be entered");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
|
@ -49,7 +49,7 @@ public class MRequisition extends X_M_Requisition implements DocAction
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -4111474920471624816L;
|
private static final long serialVersionUID = 898606565778668659L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
@ -578,5 +578,17 @@ public class MRequisition extends X_M_Requisition implements DocAction
|
||||||
{
|
{
|
||||||
return MUser.get(getCtx(), getAD_User_ID()).getName();
|
return MUser.get(getCtx(), getAD_User_ID()).getName();
|
||||||
} // getUserName
|
} // getUserName
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document Status is Complete or Closed
|
||||||
|
* @return true if CO, CL or RE
|
||||||
|
*/
|
||||||
|
public boolean isComplete()
|
||||||
|
{
|
||||||
|
String ds = getDocStatus();
|
||||||
|
return DOCSTATUS_Completed.equals(ds)
|
||||||
|
|| DOCSTATUS_Closed.equals(ds)
|
||||||
|
|| DOCSTATUS_Reversed.equals(ds);
|
||||||
|
} // isComplete
|
||||||
|
|
||||||
} // MRequisition
|
} // MRequisition
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
|
@ -26,6 +26,7 @@ import java.util.logging.Level;
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Msg;
|
||||||
/**
|
/**
|
||||||
* Requisition Line Model
|
* Requisition Line Model
|
||||||
*
|
*
|
||||||
|
|
@ -249,6 +250,10 @@ public class MRequisitionLine extends X_M_RequisitionLine
|
||||||
*/
|
*/
|
||||||
protected boolean beforeSave (boolean newRecord)
|
protected boolean beforeSave (boolean newRecord)
|
||||||
{
|
{
|
||||||
|
if (newRecord && getParent().isComplete()) {
|
||||||
|
log.saveError("ParentComplete", Msg.translate(getCtx(), "M_RequisitionLine"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (getLine() == 0)
|
if (getLine() == 0)
|
||||||
{
|
{
|
||||||
String sql = "SELECT COALESCE(MAX(Line),0)+10 FROM M_RequisitionLine WHERE M_Requisition_ID=?";
|
String sql = "SELECT COALESCE(MAX(Line),0)+10 FROM M_RequisitionLine WHERE M_Requisition_ID=?";
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public class MTimeExpense extends X_S_TimeExpense implements DocAction
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -6059700156141021371L;
|
private static final long serialVersionUID = 1567303438502090279L;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -580,5 +580,17 @@ public class MTimeExpense extends X_S_TimeExpense implements DocAction
|
||||||
MPriceList pl = MPriceList.get(getCtx(), getM_PriceList_ID(), get_TrxName());
|
MPriceList pl = MPriceList.get(getCtx(), getM_PriceList_ID(), get_TrxName());
|
||||||
return pl.getC_Currency_ID();
|
return pl.getC_Currency_ID();
|
||||||
} // getC_Currency_ID
|
} // getC_Currency_ID
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document Status is Complete or Closed
|
||||||
|
* @return true if CO, CL or RE
|
||||||
|
*/
|
||||||
|
public boolean isComplete()
|
||||||
|
{
|
||||||
|
String ds = getDocStatus();
|
||||||
|
return DOCSTATUS_Completed.equals(ds)
|
||||||
|
|| DOCSTATUS_Closed.equals(ds)
|
||||||
|
|| DOCSTATUS_Reversed.equals(ds);
|
||||||
|
} // isComplete
|
||||||
|
|
||||||
} // MTimeExpense
|
} // MTimeExpense
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
|
@ -23,6 +23,7 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Msg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time + Expense Line Model
|
* Time + Expense Line Model
|
||||||
|
|
@ -35,8 +36,7 @@ public class MTimeExpenseLine extends X_S_TimeExpenseLine
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -241908493119023444L;
|
private static final long serialVersionUID = -815975460880303779L;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
@ -80,6 +80,20 @@ public class MTimeExpenseLine extends X_S_TimeExpenseLine
|
||||||
super(ctx, rs, trxName);
|
super(ctx, rs, trxName);
|
||||||
} // MTimeExpenseLine
|
} // MTimeExpenseLine
|
||||||
|
|
||||||
|
/** Parent */
|
||||||
|
private MTimeExpense m_parent = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Parent
|
||||||
|
* @return parent
|
||||||
|
*/
|
||||||
|
public MTimeExpense getParent()
|
||||||
|
{
|
||||||
|
if (m_parent == null)
|
||||||
|
m_parent = new MTimeExpense (getCtx(), getS_TimeExpense_ID(), get_TrxName());
|
||||||
|
return m_parent;
|
||||||
|
} // getParent
|
||||||
|
|
||||||
/** Currency of Report */
|
/** Currency of Report */
|
||||||
private int m_C_Currency_Report_ID = 0;
|
private int m_C_Currency_Report_ID = 0;
|
||||||
|
|
||||||
|
|
@ -176,6 +190,10 @@ public class MTimeExpenseLine extends X_S_TimeExpenseLine
|
||||||
*/
|
*/
|
||||||
protected boolean beforeSave (boolean newRecord)
|
protected boolean beforeSave (boolean newRecord)
|
||||||
{
|
{
|
||||||
|
if (newRecord && getParent().isComplete()) {
|
||||||
|
log.saveError("ParentComplete", Msg.translate(getCtx(), "S_TimeExpenseLine"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Calculate Converted Amount
|
// Calculate Converted Amount
|
||||||
if (newRecord || is_ValueChanged("ExpenseAmt") || is_ValueChanged("C_Currency_ID"))
|
if (newRecord || is_ValueChanged("ExpenseAmt") || is_ValueChanged("C_Currency_ID"))
|
||||||
{
|
{
|
||||||
|
|
@ -196,7 +214,6 @@ public class MTimeExpenseLine extends X_S_TimeExpenseLine
|
||||||
return true;
|
return true;
|
||||||
} // beforeSave
|
} // beforeSave
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After Save
|
* After Save
|
||||||
* @param newRecord new
|
* @param newRecord new
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,10 @@ import org.compiere.util.Util;
|
||||||
*/
|
*/
|
||||||
public class MDDOrder extends X_DD_Order implements DocAction
|
public class MDDOrder extends X_DD_Order implements DocAction
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -2407222565384020843L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new Order by copying
|
* Create new Order by copying
|
||||||
|
|
@ -1248,7 +1251,17 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document Status is Complete or Closed
|
||||||
|
* @return true if CO, CL or RE
|
||||||
|
*/
|
||||||
|
public boolean isComplete()
|
||||||
|
{
|
||||||
|
String ds = getDocStatus();
|
||||||
|
return DOCSTATUS_Completed.equals(ds)
|
||||||
|
|| DOCSTATUS_Closed.equals(ds)
|
||||||
|
|| DOCSTATUS_Reversed.equals(ds);
|
||||||
|
} // isComplete
|
||||||
|
|
||||||
} // MDDOrder
|
} // MDDOrder
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,6 @@ import org.compiere.util.Msg;
|
||||||
*/
|
*/
|
||||||
public class MDDOrderLine extends X_DD_OrderLine
|
public class MDDOrderLine extends X_DD_OrderLine
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -514,6 +513,10 @@ public class MDDOrderLine extends X_DD_OrderLine
|
||||||
*/
|
*/
|
||||||
protected boolean beforeSave (boolean newRecord)
|
protected boolean beforeSave (boolean newRecord)
|
||||||
{
|
{
|
||||||
|
if (newRecord && getParent().isComplete()) {
|
||||||
|
log.saveError("ParentComplete", Msg.translate(getCtx(), "DD_OrderLine"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Get Defaults from Parent
|
// Get Defaults from Parent
|
||||||
/*if (getC_BPartner_ID() == 0 || getC_BPartner_Location_ID() == 0
|
/*if (getC_BPartner_ID() == 0 || getC_BPartner_Location_ID() == 0
|
||||||
|| getM_Warehouse_ID() == 0)
|
|| getM_Warehouse_ID() == 0)
|
||||||
|
|
|
||||||
|
|
@ -1215,6 +1215,7 @@ public final class APanel extends CPanel
|
||||||
{
|
{
|
||||||
if (!m_curTab.dataSave(true))
|
if (!m_curTab.dataSave(true))
|
||||||
{ // there is a problem, so we go back
|
{ // there is a problem, so we go back
|
||||||
|
showLastError();
|
||||||
m_curWinTab.setSelectedIndex(m_curTabIndex);
|
m_curWinTab.setSelectedIndex(m_curTabIndex);
|
||||||
setBusy(false, true);
|
setBusy(false, true);
|
||||||
return;
|
return;
|
||||||
|
|
@ -1225,6 +1226,7 @@ public final class APanel extends CPanel
|
||||||
{ // yes we want to save
|
{ // yes we want to save
|
||||||
if (!m_curTab.dataSave(true))
|
if (!m_curTab.dataSave(true))
|
||||||
{ // there is a problem, so we go back
|
{ // there is a problem, so we go back
|
||||||
|
showLastError();
|
||||||
m_curWinTab.setSelectedIndex(m_curTabIndex);
|
m_curWinTab.setSelectedIndex(m_curTabIndex);
|
||||||
setBusy(false, true);
|
setBusy(false, true);
|
||||||
return;
|
return;
|
||||||
|
|
@ -1844,8 +1846,7 @@ public final class APanel extends CPanel
|
||||||
// if there is no previous error
|
// if there is no previous error
|
||||||
if (manualCmd && !retValue && !m_errorDisplayed)
|
if (manualCmd && !retValue && !m_errorDisplayed)
|
||||||
{
|
{
|
||||||
ADialog.error(m_curWindowNo, this, "SaveIgnored");
|
showLastError();
|
||||||
setStatusLine(Msg.getMsg(m_ctx, "SaveIgnored"), true);
|
|
||||||
}
|
}
|
||||||
if (retValue)
|
if (retValue)
|
||||||
m_curGC.rowChanged(true, m_curTab.getRecord_ID());
|
m_curGC.rowChanged(true, m_curTab.getRecord_ID());
|
||||||
|
|
@ -1864,6 +1865,15 @@ public final class APanel extends CPanel
|
||||||
return retValue;
|
return retValue;
|
||||||
} // cmd_save
|
} // cmd_save
|
||||||
|
|
||||||
|
private void showLastError() {
|
||||||
|
String msg = CLogger.retrieveErrorString(null);
|
||||||
|
if (msg != null)
|
||||||
|
ADialog.error(m_curWindowNo, this, msg);
|
||||||
|
else
|
||||||
|
ADialog.error(m_curWindowNo, this, "SaveIgnored");
|
||||||
|
setStatusLine(Msg.getMsg(m_ctx, "SaveIgnored"), true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ignore
|
* Ignore
|
||||||
*/
|
*/
|
||||||
|
|
@ -2251,6 +2261,12 @@ public final class APanel extends CPanel
|
||||||
{
|
{
|
||||||
log.info(vButton.toString());
|
log.info(vButton.toString());
|
||||||
|
|
||||||
|
if (m_curTab.hasChangedCurrentTabAndParents()) {
|
||||||
|
String msg = CLogger.retrieveErrorString("Please ReQuery Window");
|
||||||
|
ADialog.error(m_curWindowNo, this, msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boolean startWOasking = false;
|
boolean startWOasking = false;
|
||||||
// boolean batch = false;
|
// boolean batch = false;
|
||||||
String col = vButton.getColumnName();
|
String col = vButton.getColumnName();
|
||||||
|
|
|
||||||
|
|
@ -97,8 +97,6 @@ import org.zkoss.zul.Menupopup;
|
||||||
public abstract class AbstractADWindowPanel extends AbstractUIPart implements ToolbarListener,
|
public abstract class AbstractADWindowPanel extends AbstractUIPart implements ToolbarListener,
|
||||||
EventListener, DataStatusListener, ActionListener, ASyncProcess
|
EventListener, DataStatusListener, ActionListener, ASyncProcess
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private static final CLogger logger;
|
private static final CLogger logger;
|
||||||
|
|
||||||
static
|
static
|
||||||
|
|
@ -765,6 +763,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
{
|
{
|
||||||
if (!curTab.dataSave(true))
|
if (!curTab.dataSave(true))
|
||||||
{
|
{
|
||||||
|
showLastError();
|
||||||
// there is a problem, stop here
|
// there is a problem, stop here
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -774,6 +773,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
{ // yes we want to save
|
{ // yes we want to save
|
||||||
if (!curTab.dataSave(true))
|
if (!curTab.dataSave(true))
|
||||||
{
|
{
|
||||||
|
showLastError();
|
||||||
// there is a problem, stop here
|
// there is a problem, stop here
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1210,9 +1210,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
|
|
||||||
if (!retValue)
|
if (!retValue)
|
||||||
{
|
{
|
||||||
//actual error will prompt in the dataStatusChanged event
|
showLastError();
|
||||||
// FDialog.error(curWindowNo, parent, "SaveIgnored");
|
|
||||||
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "SaveIgnored"), true);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
curTabpanel.dynamicDisplay(0);
|
curTabpanel.dynamicDisplay(0);
|
||||||
|
|
@ -1221,6 +1219,16 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showLastError() {
|
||||||
|
String msg = CLogger.retrieveErrorString(null);
|
||||||
|
if (msg != null)
|
||||||
|
FDialog.error(curWindowNo, parent, msg);
|
||||||
|
else
|
||||||
|
FDialog.error(curWindowNo, parent, "SaveIgnored");
|
||||||
|
//actual error will prompt in the dataStatusChanged event
|
||||||
|
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "SaveIgnored"), true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ToolbarListener#onDelete()
|
* @see ToolbarListener#onDelete()
|
||||||
*/
|
*/
|
||||||
|
|
@ -1596,6 +1604,12 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
*/
|
*/
|
||||||
private void actionButton (WButtonEditor wButton)
|
private void actionButton (WButtonEditor wButton)
|
||||||
{
|
{
|
||||||
|
if (curTab.hasChangedCurrentTabAndParents()) {
|
||||||
|
String msg = CLogger.retrieveErrorString("Please ReQuery Window");
|
||||||
|
FDialog.error(curWindowNo, parent, msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
logger.info(wButton.toString());
|
logger.info(wButton.toString());
|
||||||
|
|
||||||
boolean startWOasking = false;
|
boolean startWOasking = false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue