From fde9cccce60070687915967c5d571327e04e6151 Mon Sep 17 00:00:00 2001 From: Arnaud Fontaine <arnaud.fontaine@nexedi.com> Date: Tue, 30 Nov 2010 10:08:34 +0000 Subject: [PATCH] Add missing condition checks for filesystem Constraints git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40917 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Constraint/AccountTypeConstraint.py | 3 +++ product/ERP5/Constraint/BudgetConsumptionFeasability.py | 3 +++ product/ERP5/Constraint/DocumentReferenceConstraint.py | 3 +++ product/ERP5/Constraint/ResourceMeasuresConsistency.py | 3 +++ product/ERP5/Constraint/TradeModelLineCellConsistency.py | 3 +++ product/ERP5/Constraint/TransactionQuantityValueFeasability.py | 3 +++ product/ERP5/Constraint/TransactionQuantityValueValidity.py | 3 +++ product/ERP5Type/Constraint/PropertyTypeValidity.py | 3 +++ 8 files changed, 24 insertions(+) diff --git a/product/ERP5/Constraint/AccountTypeConstraint.py b/product/ERP5/Constraint/AccountTypeConstraint.py index 3046587aa0..1a0d3a8d95 100644 --- a/product/ERP5/Constraint/AccountTypeConstraint.py +++ b/product/ERP5/Constraint/AccountTypeConstraint.py @@ -61,6 +61,9 @@ class AccountTypeConstraint(Constraint): def checkConsistency(self, obj, fixit=0): """Implement here the consistency checker """ + if not self._checkConstraintCondition(obj): + return [] + errors = [] if getattr(obj, 'getAccountType', _MARKER) is _MARKER: errors.append(self._generateError( diff --git a/product/ERP5/Constraint/BudgetConsumptionFeasability.py b/product/ERP5/Constraint/BudgetConsumptionFeasability.py index 585a76f06d..83b07753ff 100644 --- a/product/ERP5/Constraint/BudgetConsumptionFeasability.py +++ b/product/ERP5/Constraint/BudgetConsumptionFeasability.py @@ -37,6 +37,9 @@ class BudgetConsumptionFeasability(Constraint): """ Check if there is enough budget to consumed. """ + if not self._checkConstraintCondition(object): + return [] + errors = [] new_category_list = [] diff --git a/product/ERP5/Constraint/DocumentReferenceConstraint.py b/product/ERP5/Constraint/DocumentReferenceConstraint.py index 2c6fd9acfe..f3d9e234f7 100644 --- a/product/ERP5/Constraint/DocumentReferenceConstraint.py +++ b/product/ERP5/Constraint/DocumentReferenceConstraint.py @@ -58,6 +58,9 @@ class DocumentReferenceConstraint(Constraint): """ Implement here the consistency checker """ + if not self._checkConstraintCondition(document): + return [] + # XXX we probably could check reference syntax here, based on regexp in # preferences? error_list = [] diff --git a/product/ERP5/Constraint/ResourceMeasuresConsistency.py b/product/ERP5/Constraint/ResourceMeasuresConsistency.py index 0ab3400bb2..4506cbb265 100644 --- a/product/ERP5/Constraint/ResourceMeasuresConsistency.py +++ b/product/ERP5/Constraint/ResourceMeasuresConsistency.py @@ -57,6 +57,9 @@ class ResourceMeasuresConsistency(Constraint): def checkConsistency(self, obj, fixit=0): """Implement here the consistency checker """ + if not self._checkConstraintCondition(obj): + return [] + error_list = [] portal = obj.getPortalObject() diff --git a/product/ERP5/Constraint/TradeModelLineCellConsistency.py b/product/ERP5/Constraint/TradeModelLineCellConsistency.py index 6c5754a2a6..08da757e2d 100644 --- a/product/ERP5/Constraint/TradeModelLineCellConsistency.py +++ b/product/ERP5/Constraint/TradeModelLineCellConsistency.py @@ -45,6 +45,9 @@ class TradeModelLineCellConsistency(Constraint): """ Implement here the consistency checker """ + if not self._checkConstraintCondition(document): + return [] + error_list = [] base_id = self.constraint_definition['base_id'] for cell_coordinates in document.getCellKeyList(base_id=base_id): diff --git a/product/ERP5/Constraint/TransactionQuantityValueFeasability.py b/product/ERP5/Constraint/TransactionQuantityValueFeasability.py index de338fc7b3..840bbc00ce 100644 --- a/product/ERP5/Constraint/TransactionQuantityValueFeasability.py +++ b/product/ERP5/Constraint/TransactionQuantityValueFeasability.py @@ -39,6 +39,9 @@ class TransactionQuantityValueFeasability(Constraint): Check if the quantity of the transaction is possible for the source and the destination """ + if not self._checkConstraintCondition(object): + return [] + errors = [] source_cell = object.getSourceValue() destination_cell = object.getDestinationValue() diff --git a/product/ERP5/Constraint/TransactionQuantityValueValidity.py b/product/ERP5/Constraint/TransactionQuantityValueValidity.py index 2a23859f2a..d2d62fb60e 100644 --- a/product/ERP5/Constraint/TransactionQuantityValueValidity.py +++ b/product/ERP5/Constraint/TransactionQuantityValueValidity.py @@ -38,6 +38,9 @@ class TransactionQuantityValueValidity(Constraint): Check if the quantity of the transaction is greater than the balance of the source. """ + if not self._checkConstraintCondition(object): + return [] + errors = [] source_cell = object.getSourceValue() diff --git a/product/ERP5Type/Constraint/PropertyTypeValidity.py b/product/ERP5Type/Constraint/PropertyTypeValidity.py index b936989aea..5c49d17ed1 100644 --- a/product/ERP5Type/Constraint/PropertyTypeValidity.py +++ b/product/ERP5Type/Constraint/PropertyTypeValidity.py @@ -78,6 +78,9 @@ class PropertyTypeValidity(Constraint): def checkConsistency(self, obj, fixit=0): """Check the object's consistency. """ + if not self._checkConstraintCondition(obj): + return [] + error_list = [] # For each attribute name, we check type for prop in obj.propertyMap(): -- 2.30.9