Commit ee8da024 authored by Rafael Monnerat's avatar Rafael Monnerat

Now Configurator Items are responsable for handle workflows

The Configurator Items should handle the state changes for each object. Previous approach make sense with the previous design.
parent 96b8a8a6
......@@ -68,53 +68,23 @@ if business_template is not None:\n
for module in module_list:\n
module.updateLocalRolesOnSecurityGroups()\n
print "Updated Role Mappings for: %s(%s) " % (module.getTitle(), module.getPortalType())\n
\n
for preference_to_enable in business_template.getTemplatePreferenceList():\n
preference = getattr(portal_preferences, preference_to_enable, None)\n
if preference is not None:\n
if isTransitionPossible(preference, \'enable\'):\n
preference.enable()\n
\n
# update path items. FIXME: local roles should be exported by business template instead\n
for path in business_template.getTemplatePathList():\n
obj = portal.restrictedTraverse(path, None)\n
# no need to update security on categories\n
if obj is not None and obj.getPortalType() not in (\'Category\', \'Base Category\',):\n
obj.updateLocalRolesOnSecurityGroups()\n
print "Updated Role Mappings for: ", path, obj.getPortalType()\n
\n
# validate and open all objects\n
for path in business_template.getTemplatePathList():\n
obj = context.getPortalObject().restrictedTraverse(path, None)\n
obj = portal.restrictedTraverse(path, None)\n
if obj is not None and hasattr(obj, \'getPortalType\'):\n
# XXX This hardcoded list is a bit inconvinient.\n
if obj.getPortalType() in (\'Person\', \n
\'Organisation\', \n
\'Account\', \n
\'Service\', \'Product\',\n
\'Sale Trade Condition\', \n
\'Purchase Trade Condition\',\n
\'Order Root Simulation Rule\', \n
\'Delivery Root Simulation Rule\',\n
\'Trade Model Simulation Rule\', \n
\'Accounting Transaction Root Simulation Rule\',\n
\'Invoice Transaction Simulation Rule\', \n
\'Payment Simulation Rule\',\n
\'Invoice Root Simulation Rule\', \n
\'Delivery Simulation Rule\', \n
\'Invoice Simulation Rule\'):\n
if isTransitionPossible(obj, \'validate\'):\n
obj.validate()\n
print "Validated: ", obj.getRelativeUrl()\n
\n
if obj.getPortalType() not in (\'Category\', \'Base Category\',):\n
obj.updateLocalRolesOnSecurityGroups()\n
print "Updated Role Mappings for: ", path, obj.getPortalType()\n
\n
if obj.getPortalType() in (\'Person\', \'Organisation\'):\n
for period in obj.contentValues(filter={\'portal_type\':\'Accounting Period\'}):\n
if isTransitionPossible(period, \'start\'):\n
period.start()\n
period.updateLocalRolesOnSecurityGroups()\n
print "\\tOpen (Accounting Period): ", period.getRelativeUrl()\n
\n
for assignment in obj.contentValues(filter={\'portal_type\':\'Assignment\'}):\n
if isTransitionPossible(assignment, \'open\'):\n
assignment.open()\n
assignment.updateLocalRolesOnSecurityGroups()\n
print "\\tOpen (assignment): ", assignment.getRelativeUrl()\n
\n
......@@ -122,6 +92,20 @@ if business_template is not None:\n
if gadget.getValidationState() == \'invisible\':\n
gadget.visible()\n
gadget.public()\n
\n
for rule in context.portal_rules.searchFolder(id=[ "new_order_root_simulation_rule", \n
"new_delivery_root_simulation_rule",\n
"new_trade_model_simulation_rule",\n
"new_accounting_transaction_root_simulation_rule",\n
"new_invoice_transaction_simulation_rule",\n
"new_payment_simulation_rule",\n
"new_invoice_root_simulation_rule",\n
"new_delivery_root_simulation_rule",\n
"new_invoice_simulation_rule"]):\n
\n
if isTransitionPossible(rule, \'validate\'):\n
rule.validate(comment="Validated by Configurator")\n
\n
\n
# update security settings for default preference # XXX why ???\n
default_configurator_preference = getattr(portal_preferences,\n
......@@ -182,7 +166,7 @@ log("%s" % printed)\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>alter_preferences=True</string> </value>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment