BF [ 2031197 ] Skips saving

Thanks to Cristina Ghita
This commit is contained in:
teo_sarca 2008-07-29 11:55:34 +00:00
parent 67dc6b32ff
commit 70c84dd787
1 changed files with 11 additions and 4 deletions

View File

@ -37,6 +37,7 @@ 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;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Util;
/** /**
* Order Model. * Order Model.
@ -46,6 +47,9 @@ import org.compiere.util.Env;
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: MOrder.java,v 1.57 2004/05/21 02:27:38 jjanke Exp $ * @version $Id: MOrder.java,v 1.57 2004/05/21 02:27:38 jjanke Exp $
*
* @author Cristina Ghita, SC ARHIPAC SERVICE SRL
* <li>BF [ 2031197 ] Skips saving
*/ */
public class MHRProcess extends X_HR_Process implements DocAction { public class MHRProcess extends X_HR_Process implements DocAction {
public static int m_process = 0; public static int m_process = 0;
@ -192,7 +196,7 @@ public class MHRProcess extends X_HR_Process implements DocAction {
org.compiere.model.MDocType dt = MDocType.get(getCtx(), getC_DocTypeTarget_ID()); org.compiere.model.MDocType dt = MDocType.get(getCtx(), getC_DocTypeTarget_ID());
// Std Period open? // Std Period open?
MPeriod.testPeriodOpen(getCtx(), period.getDateAcct(), dt.getDocBaseType()); // arhipac: teo_sarca MPeriod.testPeriodOpen(getCtx(), period.getDateAcct(), dt.getDocBaseType());
// New or in Progress/Invalid // New or in Progress/Invalid
if (DOCSTATUS_Drafted.equals(getDocStatus()) || DOCSTATUS_InProgress.equals(getDocStatus()) if (DOCSTATUS_Drafted.equals(getDocStatus()) || DOCSTATUS_InProgress.equals(getDocStatus())
@ -368,10 +372,13 @@ public class MHRProcess extends X_HR_Process implements DocAction {
MHRConcept c = new MHRConcept(Env.getCtx(),pc.getHR_Concept_ID(),get_TrxName()); MHRConcept c = new MHRConcept(Env.getCtx(),pc.getHR_Concept_ID(),get_TrxName());
if(m == null) if(m == null)
continue; continue;
if( !c.isRegistered() & (m.getQty().compareTo(Env.ZERO) > 0 || m.getAmount().compareTo(Env.ZERO) > 0) ) if( !c.isRegistered() &&
(m.getQty().signum() > 0
|| m.getAmount().signum() > 0
|| !Util.isEmpty(m.getTextMsg()))
)
{ {
if (!m.save()) m.saveEx();
throw new IllegalStateException("Could not create HR Movement");
} }
else else
{ {