[ 1797665 ] Add FactsValidate event for Validation of accounting facts

This commit is contained in:
Heng Sin Low 2007-10-22 01:33:35 +00:00
parent 07604d4a9b
commit 46b07e85ab
3 changed files with 45 additions and 2 deletions

View File

@ -574,6 +574,7 @@ public abstract class Doc
// for all Accounting Schema
boolean OK = true;
getPO().setDoc(this);
try
{
for (int i = 0; OK && i < m_ass.length; i++)
@ -619,8 +620,7 @@ public abstract class Doc
String validatorMsg = null;
// Call validator on before post
if (!p_Status.equals(STATUS_Error)) {
getPO().setDoc(this);
if (!p_Status.equals(STATUS_Error)) {
validatorMsg = ModelValidationEngine.get().fireDocValidate(getPO(), ModelValidator.TIMING_BEFORE_POST);
if (validatorMsg != null) {
p_Status = STATUS_Error;
@ -723,6 +723,14 @@ public abstract class Doc
ArrayList<Fact> facts = createFacts (m_ass[index]);
if (facts == null)
return STATUS_Error;
// call modelValidator
String validatorMsg = ModelValidationEngine.get().fireFactsValidate(m_ass[index], facts, getPO());
if (validatorMsg != null) {
p_Error = validatorMsg;
return STATUS_Error;
}
for (int f = 0; f < facts.size(); f++)
{
Fact fact = facts.get(f);

View File

@ -0,0 +1,23 @@
package org.compiere.model;
import java.util.List;
import org.compiere.acct.Fact;
public interface FactsValidator {
/**
* Get Client to be monitored
* @return AD_Client_ID
*/
public int getAD_Client_ID();
/**
*
* @param facts
* @param po
* @return error message or null -
* if not null, the pocument will be marked as Invalid.
*/
public String factsValidate(MAcctSchema schema, List<Fact> facts, PO po);
}

View File

@ -0,0 +1,12 @@
package org.compiere.model;
import java.util.Properties;
public interface PreferenceListener {
/**
* @param properties
*/
public void afterLoadPreferences(Properties properties);
}