Commit c49cf8d8 authored by Boxiang Sun's avatar Boxiang Sun Committed by Vincent Pelletier

erp5_officejs_support_request, erp5_post: Pass follow-up by value

Avoids the double-nonsense of looking the document up by path inside callee (!)
using the catalog (!!).
Also, follow naming conventions: variables containing documents should end
in _value, not in _object.

Vincent Pelletier:
- commit message
- remove unrelated change
- squash similar similar-intent commits even though they apply to
  different BTs
parent ab9e0f93
follow_up_object, = context.getPortalObject().portal_catalog(relative_url=follow_up, limit=1)
follow_up_object.edit() # update modification date
follow_up_value.edit() # update modification date
post = context.PostModule_createHTMLPostFromText(
follow_up=follow_up,
follow_up_value=follow_up_value,
data=data,
)
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>follow_up, predecessor, data, file</string> </value>
<value> <string>follow_up_value, predecessor, data, file</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -38,7 +38,7 @@ support_request.immediateReindexObject()
if description is not None or file is not None:
portal.post_module.PostModule_createHTMLPostForSupportRequest(
follow_up=support_request.getRelativeUrl(), # XXX give support_request as follow_up_value
follow_up_value=support_request,
predecessor=None,
data="" if description is None else description,
file=file,
......
......@@ -3,14 +3,10 @@ portal = context.getPortalObject()
# create an HTML Post
post_module = portal.post_module
# get the related object
follow_up_object, = portal.portal_catalog(relative_url=follow_up, limit=2)
follow_up_object = follow_up_object.getObject()
now = DateTime()
post_edit_kw = {
"start_date": now,
"follow_up_value": follow_up_object,
"follow_up_value": follow_up_value,
"text_content": data,
}
if predecessor is not None:
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>follow_up, data, predecessor=None</string> </value>
<value> <string>follow_up_value, data, predecessor=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......
return context.PostModule_createHTMLPost(
follow_up=follow_up,
follow_up_value=follow_up_value,
predecessor=predecessor,
data="<p>" + data.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace(" ", " &nbsp;").replace("\n", "<br/>") + "</p>",
)
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>follow_up, data, predecessor=None</string> </value>
<value> <string>follow_up_value, data, predecessor=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</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