Commit ce1a954c authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Drop fixit and avoid catalog queries

   The fixit wasnt a good idea, since we cannot guarantee that the data will be complaint (and not changed by the administrator).

    Move Constraint from event to Support Request, since indexation might not find the Support Request while create the first ticket.
parent da9d79b2
<property_sheet_list> <property_sheet_list>
<portal_type id="Mail Message"> <portal_type id="Mail Message">
<item>EventSlapOSConstraint</item> <item>SlapOSEventConstraint</item>
</portal_type> </portal_type>
<portal_type id="Regularisation Request"> <portal_type id="Regularisation Request">
<item>Codification</item> <item>Codification</item>
</portal_type> </portal_type>
<portal_type id="Site Message"> <portal_type id="Site Message">
<item>EventSlapOSConstraint</item> <item>SlapOSEventConstraint</item>
</portal_type>
<portal_type id="Support Request">
<item>SlapOSSupportRequestConstraint</item>
</portal_type> </portal_type>
<portal_type id="Web Message"> <portal_type id="Web Message">
<item>EventSlapOSConstraint</item> <item>SlapOSEventConstraint</item>
</portal_type> </portal_type>
</property_sheet_list> </property_sheet_list>
\ No newline at end of file
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>EventSlapOSConstraint</string> </value> <value> <string>SlapOSEventConstraint</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
......
<?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>SlapOSSupportRequestConstraint</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>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>customer_causality_related_constraint_constraint</string> </value> <value> <string>causality_source_destination_constraint_constraint</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</item> </item>
<item> <item>
<key> <string>script_id</string> </key> <key> <string>script_id</string> </key>
<value> <string>Event_checkCausalityRelatedConsistency</string> </value> <value> <string>SupportRequest_checkCausalitySourceDestinationConsistency</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
support_request = context.getCausalityRelatedValue(portal_type="Support Request")
error_list = []
if support_request:
if context.getSource() != support_request.getDestinationDecision():
error_list.append(
'Sender should be the customer')
if fixit:
context.edit(source=support_request.getDestinationDecision())
assert context.getSource() == support_request.getDestinationDecision()
if context.getDestination() != support_request.getSourceSection():
error_list.append(
'Destination should be the slapos organisation')
if fixit:
context.edit(destination=support_request.getSourceSection())
assert context.getDestination() == support_request.getSourceSection()
return error_list
...@@ -7,10 +7,5 @@ if support_request: ...@@ -7,10 +7,5 @@ if support_request:
customer not in context.getDestinationList() : customer not in context.getDestinationList() :
error_list.append( error_list.append(
'Customer should be source or destination of the event') 'Customer should be source or destination of the event')
if fixit:
destination_list = context.getDestinationList()
destination_list.append(customer)
context.edit(destination=customer)
assert customer in context.getDestinationList()
return error_list return error_list
portal = context.getPortalObject()
event = context.getCausalityValue(portal_type=portal.getPortalEventTypeList())
error_list = []
if event:
if event.getSource() != context.getDestinationDecision():
error_list.append(
'Sender of the related event should be the customer')
if event.getDestination() != context.getSourceSection():
error_list.append(
'Destination of the related event should be the slapos organisation')
return error_list
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Event_checkCausalityRelatedConsistency</string> </value> <value> <string>SupportRequest_checkCausalitySourceDestinationConsistency</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
Mail Message | EventSlapOSConstraint Mail Message | SlapOSEventConstraint
Regularisation Request | Codification Regularisation Request | Codification
Site Message | EventSlapOSConstraint Site Message | SlapOSEventConstraint
Web Message | EventSlapOSConstraint Support Request | SlapOSSupportRequestConstraint
\ No newline at end of file Web Message | SlapOSEventConstraint
\ No newline at end of file
SlapOSCRMSystemPreference SlapOSCRMSystemPreference
EventSlapOSConstraint SlapOSEventConstraint
\ No newline at end of file SlapOSSupportRequestConstraint
\ No newline at end of file
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