From 1ca4e6208da2c031edda9a8c6931875d5b14d35b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Mon, 7 Jan 2008 14:23:35 +0000
Subject: [PATCH] allow user to quote original event when doing respond action

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18615 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_crm/Event_createRespondEvent.xml     |  11 +-
 .../Event_viewWorkflowRespondActionDialog.xml |   8 +-
 .../your_respond_event_quotation.xml          | 171 ++++++++++++++++++
 .../portal_workflow/event_workflow.xml        |   7 +-
 .../scripts/Event_createRespondEvent.xml      |  12 +-
 .../transitions/respond_action.xml            |  40 ++--
 .../variables/respond_event_quotation.xml     |  57 ++++++
 bt5/erp5_crm/bt/revision                      |   2 +-
 8 files changed, 275 insertions(+), 33 deletions(-)
 create mode 100644 bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewWorkflowRespondActionDialog/your_respond_event_quotation.xml
 create mode 100644 bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow/variables/respond_event_quotation.xml

diff --git a/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createRespondEvent.xml b/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createRespondEvent.xml
index 1511feaabb..d2660011c2 100644
--- a/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createRespondEvent.xml
+++ b/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createRespondEvent.xml
@@ -66,7 +66,6 @@
         <item>
             <key> <string>_body</string> </key>
             <value> <string># this script allows to create a new follow up ticket for a given event\n
-\n
 event_object = context\n
 event_module = context.getPortalObject().getDefaultModule(\n
                                           respond_event_portal_type)\n
@@ -78,8 +77,11 @@ respond_event = event_module.newContent(\n
                        start_date=DateTime(),\n
                        source=context.getDefaultDestination(),\n
                        destination=context.getDefaultSource(),\n
-                       causality=context.getRelativeUrl(),\n
+                       causality=context.getRelativeUrl(),                      \n
 )\n
+\n
+if respond_event_quotation:\n
+  respond_event.edit(text_content=context.getReplyBody())\n
 # Change the state to outgoing\n
 respond_event.plan()\n
 </string> </value>
@@ -104,7 +106,7 @@ respond_event.plan()\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>respond_event_portal_type, respond_event_title, respond_event_description=\'\'</string> </value>
+            <value> <string>respond_event_portal_type, respond_event_title, respond_event_quotation, respond_event_description=\'\'</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -124,7 +126,7 @@ respond_event.plan()\n
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>3</int> </value>
+                        <value> <int>4</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
@@ -132,6 +134,7 @@ respond_event.plan()\n
                           <tuple>
                             <string>respond_event_portal_type</string>
                             <string>respond_event_title</string>
+                            <string>respond_event_quotation</string>
                             <string>respond_event_description</string>
                             <string>context</string>
                             <string>event_object</string>
diff --git a/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewWorkflowRespondActionDialog.xml b/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewWorkflowRespondActionDialog.xml
index 451b296425..3890a143f3 100644
--- a/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewWorkflowRespondActionDialog.xml
+++ b/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewWorkflowRespondActionDialog.xml
@@ -3,11 +3,8 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Products.ERP5Form.Form</string>
-          <string>ERP5Form</string>
-        </tuple>
-        <none/>
+        <global name="ERP5Form" module="Products.ERP5Form.Form"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
@@ -87,6 +84,7 @@
                         <string>your_respond_event_title</string>
                         <string>your_respond_event_description</string>
                         <string>your_workflow_action</string>
+                        <string>your_respond_event_quotation</string>
                       </list>
                     </value>
                 </item>
diff --git a/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewWorkflowRespondActionDialog/your_respond_event_quotation.xml b/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewWorkflowRespondActionDialog/your_respond_event_quotation.xml
new file mode 100644
index 0000000000..f131c26940
--- /dev/null
+++ b/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewWorkflowRespondActionDialog/your_respond_event_quotation.xml
@@ -0,0 +1,171 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="CheckBoxField" module="Products.Formulator.StandardFields"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>your_respond_event_quotation</string> </value>
+        </item>
+        <item>
+            <key> <string>message_values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>external_validator_failed</string> </key>
+                    <value> <string>The input failed the external validator.</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>overrides</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>alternate_name</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>css_class</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>default</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>description</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>external_validator</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>hidden</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>tales</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>alternate_name</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>css_class</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>default</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>description</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>external_validator</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>hidden</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>alternate_name</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>css_class</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>default</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
+                <item>
+                    <key> <string>description</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
+                <item>
+                    <key> <string>external_validator</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>hidden</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string>Quote Event</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow.xml b/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow.xml
index 60a32f498d..945054f341 100644
--- a/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow.xml
+++ b/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow.xml
@@ -3,11 +3,8 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Products.DCWorkflow.DCWorkflow</string>
-          <string>DCWorkflowDefinition</string>
-        </tuple>
-        <none/>
+        <global name="DCWorkflowDefinition" module="Products.DCWorkflow.DCWorkflow"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
diff --git a/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow/scripts/Event_createRespondEvent.xml b/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow/scripts/Event_createRespondEvent.xml
index 3a2b0dccfd..332f31a6e9 100644
--- a/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow/scripts/Event_createRespondEvent.xml
+++ b/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow/scripts/Event_createRespondEvent.xml
@@ -3,11 +3,8 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Products.PythonScripts.PythonScript</string>
-          <string>PythonScript</string>
-        </tuple>
-        <none/>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
@@ -81,12 +78,14 @@ for history_item in history[::-1]:\n
     respond_event_portal_type = history_item[\'respond_event_portal_type\']\n
     respond_event_title = history_item[\'respond_event_title\']\n
     respond_event_description = history_item[\'respond_event_description\']\n
+    respond_event_quotation = history_item[\'respond_event_quotation\']\n
     break\n
 \n
 if respond_event_portal_type is not None:\n
   event.Event_createRespondEvent(respond_event_portal_type,\n
                                  respond_event_title,\n
-                                 respond_event_description)\n
+                                 respond_event_quotation,\n
+                                 respond_event_description,)\n
 </string> </value>
         </item>
         <item>
@@ -146,6 +145,7 @@ if respond_event_portal_type is not None:\n
                             <string>history_item</string>
                             <string>respond_event_title</string>
                             <string>respond_event_description</string>
+                            <string>respond_event_quotation</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow/transitions/respond_action.xml b/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow/transitions/respond_action.xml
index 2378490d59..d25b656b1b 100644
--- a/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow/transitions/respond_action.xml
+++ b/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow/transitions/respond_action.xml
@@ -3,11 +3,8 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Products.DCWorkflow.Transitions</string>
-          <string>TransitionDefinition</string>
-        </tuple>
-        <none/>
+        <global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
@@ -101,17 +98,14 @@
   <record id="3" aka="AAAAAAAAAAM=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Persistence</string>
-          <string>PersistentMapping</string>
-        </tuple>
-        <none/>
+        <global name="PersistentMapping" module="Persistence.mapping"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
       <dictionary>
         <item>
-            <key> <string>_container</string> </key>
+            <key> <string>data</string> </key>
             <value>
               <dictionary>
                 <item>
@@ -127,11 +121,17 @@
                     </value>
                 </item>
                 <item>
-                    <key> <string>respond_event_title</string> </key>
+                    <key> <string>respond_event_quotation</string> </key>
                     <value>
                       <persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
                     </value>
                 </item>
+                <item>
+                    <key> <string>respond_event_title</string> </key>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
+                    </value>
+                </item>
               </dictionary>
             </value>
         </item>
@@ -177,6 +177,22 @@
     </pickle>
   </record>
   <record id="6" aka="AAAAAAAAAAY=">
+    <pickle>
+      <tuple>
+        <global name="Expression" module="Products.CMFCore.Expression"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>text</string> </key>
+            <value> <string>python: state_change.kwargs.get(\'respond_event_quotation\')</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="7" aka="AAAAAAAAAAc=">
     <pickle>
       <tuple>
         <tuple>
diff --git a/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow/variables/respond_event_quotation.xml b/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow/variables/respond_event_quotation.xml
new file mode 100644
index 0000000000..c101447372
--- /dev/null
+++ b/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow/variables/respond_event_quotation.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="VariableDefinition" module="Products.DCWorkflow.Variables"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>default_expr</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>default_value</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value> <string>Store the boolean which tell if we quote original event or not</string> </value>
+        </item>
+        <item>
+            <key> <string>for_catalog</string> </key>
+            <value> <int>0</int> </value>
+        </item>
+        <item>
+            <key> <string>for_status</string> </key>
+            <value> <int>1</int> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>respond_event_quotation</string> </value>
+        </item>
+        <item>
+            <key> <string>info_guard</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>update_always</string> </key>
+            <value> <int>0</int> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_crm/bt/revision b/bt5/erp5_crm/bt/revision
index b9c6c007cc..fa59ff276d 100644
--- a/bt5/erp5_crm/bt/revision
+++ b/bt5/erp5_crm/bt/revision
@@ -1 +1 @@
-131
\ No newline at end of file
+134
\ No newline at end of file
-- 
2.30.9