From 32f277c5fc9f7614daa9d2561b7bac769a9b3f71 Mon Sep 17 00:00:00 2001 From: Gabriel Monnerat <gabriel@tiolive.com> Date: Fri, 3 May 2013 16:10:33 +0200 Subject: [PATCH] Add constraints to EventConstraint property_sheet to check if destination, resource and source are set and move TALES constraint to a new property sheet that is specific to Mail Messages. By default both are not enabled. --- .../destination_existence_constraint.xml | 86 +++++++++++++++++++ .../resource_existence_constraint.xml | 44 ++++++++++ .../source_existence_constraint.xml | 86 +++++++++++++++++++ .../MailMessageConstraint.xml | 66 ++++++++++++++ .../destination_email_constraint.xml | 7 +- bt5/erp5_crm/bt/revision | 2 +- .../bt/template_property_sheet_id_list | 3 +- 7 files changed, 287 insertions(+), 7 deletions(-) create mode 100644 bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/EventConstraint/destination_existence_constraint.xml create mode 100644 bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/EventConstraint/resource_existence_constraint.xml create mode 100644 bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/EventConstraint/source_existence_constraint.xml create mode 100644 bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/MailMessageConstraint.xml rename bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/{EventConstraint => MailMessageConstraint}/destination_email_constraint.xml (82%) diff --git a/bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/EventConstraint/destination_existence_constraint.xml b/bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/EventConstraint/destination_existence_constraint.xml new file mode 100644 index 0000000000..344bc8c41a --- /dev/null +++ b/bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/EventConstraint/destination_existence_constraint.xml @@ -0,0 +1,86 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Category Existence Constraint" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_identity_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_range_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>constraint_base_category</string> </key> + <value> + <tuple> + <string>destination</string> + </tuple> + </value> + </item> + <item> + <key> <string>constraint_portal_type</string> </key> + <value> <string>python: ()</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>Recipient must be defined</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>destination_existence_constraint</string> </value> + </item> + <item> + <key> <string>message_category_not_set</string> </key> + <value> <string>Recipient must be defined</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Category Existence Constraint</string> </value> + </item> + <item> + <key> <string>use_acquisition</string> </key> + <value> <int>0</int> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/EventConstraint/resource_existence_constraint.xml b/bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/EventConstraint/resource_existence_constraint.xml new file mode 100644 index 0000000000..ac6547ea6e --- /dev/null +++ b/bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/EventConstraint/resource_existence_constraint.xml @@ -0,0 +1,44 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Category Existence Constraint" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>constraint_base_category</string> </key> + <value> + <tuple> + <string>resource</string> + </tuple> + </value> + </item> + <item> + <key> <string>constraint_portal_type</string> </key> + <value> <string>python: ()</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>Type must be defined</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>resource_existence_constraint</string> </value> + </item> + <item> + <key> <string>message_category_not_set</string> </key> + <value> <string>Type must be defined</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Category Existence Constraint</string> </value> + </item> + <item> + <key> <string>use_acquisition</string> </key> + <value> <int>0</int> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/EventConstraint/source_existence_constraint.xml b/bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/EventConstraint/source_existence_constraint.xml new file mode 100644 index 0000000000..5ca93e00bd --- /dev/null +++ b/bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/EventConstraint/source_existence_constraint.xml @@ -0,0 +1,86 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Category Existence Constraint" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_identity_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_range_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>constraint_base_category</string> </key> + <value> + <tuple> + <string>source</string> + </tuple> + </value> + </item> + <item> + <key> <string>constraint_portal_type</string> </key> + <value> <string>python: ()</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>Sender must be defined</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>source_existence_constraint</string> </value> + </item> + <item> + <key> <string>message_category_not_set</string> </key> + <value> <string>Sender must be defined</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Category Existence Constraint</string> </value> + </item> + <item> + <key> <string>use_acquisition</string> </key> + <value> <int>0</int> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/MailMessageConstraint.xml b/bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/MailMessageConstraint.xml new file mode 100644 index 0000000000..ee91dc3cbc --- /dev/null +++ b/bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/MailMessageConstraint.xml @@ -0,0 +1,66 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Property Sheet" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_count</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_mt_index</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>_tree</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>MailMessageConstraint</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Property Sheet</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="Length" module="BTrees.Length"/> + </pickle> + <pickle> <int>0</int> </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> + <record id="4" aka="AAAAAAAAAAQ="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/EventConstraint/destination_email_constraint.xml b/bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/MailMessageConstraint/destination_email_constraint.xml similarity index 82% rename from bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/EventConstraint/destination_email_constraint.xml rename to bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/MailMessageConstraint/destination_email_constraint.xml index f68c005ccc..614257f157 100644 --- a/bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/EventConstraint/destination_email_constraint.xml +++ b/bt5/erp5_crm/PropertySheetTemplateItem/portal_property_sheets/MailMessageConstraint/destination_email_constraint.xml @@ -20,14 +20,11 @@ </item> <item> <key> <string>description</string> </key> - <value> <string>Recipients email must be defined\n -\n -\n -python: object.getDestination() is not None and any(destination for destination in context.getDestinationValueList() if not destination.getDefaultEmailText())</string> </value> + <value> <string>Recipients email must be defined</string> </value> </item> <item> <key> <string>expression</string> </key> - <value> <string>python: object.getDestination() is not None and any(destination for destination in context.getDestinationValueList() if not destination.getDefaultEmailText())</string> </value> + <value> <string>python: not any(destination for destination in context.getDestinationValueList() if not destination.getDefaultEmailText())</string> </value> </item> <item> <key> <string>id</string> </key> diff --git a/bt5/erp5_crm/bt/revision b/bt5/erp5_crm/bt/revision index e2756006da..0c1a9b6f06 100644 --- a/bt5/erp5_crm/bt/revision +++ b/bt5/erp5_crm/bt/revision @@ -1 +1 @@ -644 \ No newline at end of file +645 \ No newline at end of file diff --git a/bt5/erp5_crm/bt/template_property_sheet_id_list b/bt5/erp5_crm/bt/template_property_sheet_id_list index abd04976a5..a2ebc1a552 100644 --- a/bt5/erp5_crm/bt/template_property_sheet_id_list +++ b/bt5/erp5_crm/bt/template_property_sheet_id_list @@ -1,3 +1,4 @@ DefaultEventPath EventPath -EventConstraint \ No newline at end of file +EventConstraint +MailMessageConstraint \ No newline at end of file -- 2.30.9