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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
3b8c1195
Commit
3b8c1195
authored
Apr 27, 2021
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_hr: get correct document's creator
parent
d1d8479f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletion
+27
-1
bt5/erp5_hr/SkinTemplateItem/portal_skins/erp5_hr/PositionApplicationModule_addPositionApplication.py
...p5_hr/PositionApplicationModule_addPositionApplication.py
+27
-1
No files found.
bt5/erp5_hr/SkinTemplateItem/portal_skins/erp5_hr/PositionApplicationModule_addPositionApplication.py
View file @
3b8c1195
from
erp5.component.module.DateUtils
import
addToDate
from
cStringIO
import
StringIO
import
zipfile
import
re
from
DateTime
import
DateTime
from
DateTime
import
DateTime
requester
=
None
requester
=
None
if
not
first_name
or
not
last_name
:
if
not
first_name
or
not
last_name
:
...
@@ -22,6 +24,19 @@ if link:
...
@@ -22,6 +24,19 @@ if link:
if
requester
.
default_link
.
getUrlString
()
!=
link
:
if
requester
.
default_link
.
getUrlString
()
!=
link
:
requester
.
default_link
.
edit
(
url_string
=
link
)
requester
.
default_link
.
edit
(
url_string
=
link
)
def
getGenerator
(
text_document
):
zipbuffer
=
StringIO
(
str
(
text_document
.
getData
()))
zipfileobj
=
zipfile
.
ZipFile
(
zipbuffer
)
try
:
meta
=
zipfileobj
.
read
(
'meta.xml'
)
generator_list
=
re
.
findall
(
'<meta:generator>.*?</meta:generator>'
,
meta
)
if
generator_list
:
generator
=
generator_list
[
0
]
return
generator
[
len
(
'<meta:generator>'
)
:
len
(
generator
)
-
len
(
'</meta:generator>'
)]
return
''
except
KeyError
:
return
''
position_application
=
context
.
position_application_module
.
newContent
(
position_application
=
context
.
position_application_module
.
newContent
(
portal_type
=
'Position Application'
,
portal_type
=
'Position Application'
,
destination_decision_value
=
requester
,
destination_decision_value
=
requester
,
...
@@ -86,6 +101,17 @@ for line in listbox:
...
@@ -86,6 +101,17 @@ for line in listbox:
}
}
document
=
context
.
Base_contribute
(
**
document_kw
)
document
=
context
.
Base_contribute
(
**
document_kw
)
content_information
=
document
.
getContentInformation
()
content_information
=
document
.
getContentInformation
()
# text is converted by cloudooo, so creator is changed to LibreOffice
# check content type
if
document
.
getPortalType
()
==
'Text'
:
content_type
=
document
.
getContentTypeFromContent
()
if
content_type
.
endswith
(
'msword'
):
content_information
[
'Creator'
]
=
'Microsoft Word'
else
:
generator
=
getGenerator
(
document
)
if
generator
:
content_information
[
'Creator'
]
=
generator
creator
=
content_information
.
pop
(
'Creator'
,
content_information
.
pop
(
'Generator'
,
None
))
creator
=
content_information
.
pop
(
'Creator'
,
content_information
.
pop
(
'Generator'
,
None
))
document_type
=
line
[
'document_type'
]
document_type
=
line
[
'document_type'
]
description
=
document_type
description
=
document_type
...
...
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