Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastian
erp5
Commits
3e9ef826
Commit
3e9ef826
authored
Oct 13, 2017
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs_support_request_ui: remove code duplication
parent
434cbdb3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
25 deletions
+7
-25
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/PostModule_createHTMLPostForSupportRequest.py
...ort_request/PostModule_createHTMLPostForSupportRequest.py
+1
-1
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/SupportRequestModule_createSupportRequest.py
...port_request/SupportRequestModule_createSupportRequest.py
+6
-24
No files found.
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/PostModule_createHTMLPostForSupportRequest.py
View file @
3e9ef826
...
...
@@ -5,7 +5,7 @@ post = context.PostModule_createHTMLPostFromText(
data
=
data
,
)
if
file
!=
"undefined"
:
# XXX "undefined" ? should also be fixed in javascript side
if
file
not
in
(
"undefined"
,
None
)
:
# XXX "undefined" ? should also be fixed in javascript side
document_kw
=
{
'batch_mode'
:
True
,
'redirect_to_document'
:
False
,
'file'
:
file
}
...
...
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/SupportRequestModule_createSupportRequest.py
View file @
3e9ef826
...
...
@@ -36,32 +36,14 @@ support_request.edit(
support_request
.
submit
()
support_request
.
immediateReindexObject
()
# create an HTML Post
if
description
or
file
is
not
None
:
post_module
=
portal
.
post_module
post
=
post_module
.
newContent
(
portal_type
=
'HTML Post'
)
post
.
edit
(
start_date
=
now
,
follow_up_value
=
support_request
,
text_content
=
"<p>"
+
description
.
replace
(
"&"
,
"&"
).
replace
(
"<"
,
"<"
).
replace
(
">"
,
">"
).
replace
(
" "
,
" "
).
replace
(
"
\
n
"
,
"<br/>"
)
+
"</p>"
,
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
predecessor
=
None
,
data
=
""
if
description
is
None
else
description
,
file
=
file
,
)
# handle attachments
if
getattr
(
file
,
'filename'
,
''
)
!=
''
:
document_kw
=
{
'batch_mode'
:
True
,
'redirect_to_document'
:
False
,
'file'
:
file
}
document
=
context
.
Base_contribute
(
**
document_kw
)
# set relation between post and document
post
.
setSuccessorValueList
([
document
])
# depending on security model this should be changed accordingly
document
.
publish
()
post
.
publish
()
post
.
immediateReindexObject
()
return
support_request
.
Base_redirect
(
'officejs_support_request_view'
,
keep_items
=
{
'portal_status_message'
:
portal
.
Base_translateString
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment