FR [ 2744682 ] Requisition: improve error reporting

https://sourceforge.net/tracker/?func=detail&aid=2744682&group_id=176962&atid=879335
This commit is contained in:
teo_sarca 2009-04-08 16:46:32 +00:00
parent 1ae6da187d
commit 26d64fd988
1 changed files with 12 additions and 7 deletions

View File

@ -23,6 +23,7 @@ import java.sql.Timestamp;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.process.DocAction; import org.compiere.process.DocAction;
import org.compiere.process.DocumentEngine; import org.compiere.process.DocumentEngine;
import org.compiere.util.DB; import org.compiere.util.DB;
@ -40,6 +41,8 @@ import org.compiere.util.Msg;
* @version $Id: MRequisition.java,v 1.2 2006/07/30 00:51:05 jjanke Exp $ * @version $Id: MRequisition.java,v 1.2 2006/07/30 00:51:05 jjanke Exp $
* @author red1 * @author red1
* <li>FR [ 2214883 ] Remove SQL code and Replace for Query * <li>FR [ 2214883 ] Remove SQL code and Replace for Query
* @author Teo Sarca, www.arhipac.ro
* <li>FR [ 2744682 ] Requisition: improve error reporting
*/ */
public class MRequisition extends X_M_Requisition implements DocAction public class MRequisition extends X_M_Requisition implements DocAction
{ {
@ -249,17 +252,19 @@ public class MRequisition extends X_M_Requisition implements DocAction
// Invalid // Invalid
if (getAD_User_ID() == 0 if (getAD_User_ID() == 0
|| getM_PriceList_ID() == 0 || getM_PriceList_ID() == 0
|| getM_Warehouse_ID() == 0 || getM_Warehouse_ID() == 0)
|| lines.length == 0)
return DocAction.STATUS_Invalid;
// Std Period open?
if (!MPeriod.isOpen(getCtx(), getDateDoc(), MDocType.DOCBASETYPE_PurchaseRequisition, getAD_Org_ID()))
{ {
m_processMsg = "@PeriodClosed@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if(lines.length == 0)
{
throw new AdempiereException("@NoLines@");
}
// Std Period open?
MPeriod.testPeriodOpen(getCtx(), getDateDoc(), MDocType.DOCBASETYPE_PurchaseRequisition, getAD_Org_ID());
// Add up Amounts // Add up Amounts
int precision = MPriceList.getStandardPrecision(getCtx(), getM_PriceList_ID()); int precision = MPriceList.getStandardPrecision(getCtx(), getM_PriceList_ID());
BigDecimal totalLines = Env.ZERO; BigDecimal totalLines = Env.ZERO;