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
ecceb142
Commit
ecceb142
authored
Sep 18, 2014
by
Klaus Wölfel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only add user if login does not exist yet
parent
e2f70046
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
34 deletions
+38
-34
product/ERP5Configurator/Document/PersonConfiguratorItem.py
product/ERP5Configurator/Document/PersonConfiguratorItem.py
+38
-34
No files found.
product/ERP5Configurator/Document/PersonConfiguratorItem.py
View file @
ecceb142
...
@@ -61,45 +61,49 @@ class PersonConfiguratorItem(XMLObject, ConfiguratorItemMixin):
...
@@ -61,45 +61,49 @@ class PersonConfiguratorItem(XMLObject, ConfiguratorItemMixin):
,
PropertySheet
.
Login
)
,
PropertySheet
.
Login
)
def
_checkConsistency
(
self
,
fixit
=
False
,
filter
=
None
,
**
kw
):
def
_checkConsistency
(
self
,
fixit
=
False
,
filter
=
None
,
**
kw
):
error_list
=
[
"Person %s should be created"
%
self
.
getReference
(),]
error_list
=
[]
if
fixit
:
person
=
self
.
portal_catalog
.
getResultValue
(
reference
=
self
.
getReference
(),
person_module
=
self
.
getPortalObject
().
person_module
portal_type
=
"Person"
)
person
=
person_module
.
newContent
(
portal_type
=
"Person"
)
if
person
is
None
:
group_id
=
getattr
(
aq_base
(
self
),
'group_id'
,
None
)
error_list
.
append
(
"Person %s should be created"
%
self
.
getReference
())
site_id
=
getattr
(
aq_base
(
self
),
'site_id'
,
None
)
if
fixit
:
person_module
=
self
.
getPortalObject
().
person_module
person
=
person_module
.
newContent
(
portal_type
=
"Person"
)
group_id
=
getattr
(
aq_base
(
self
),
'group_id'
,
None
)
site_id
=
getattr
(
aq_base
(
self
),
'site_id'
,
None
)
if
getattr
(
aq_base
(
self
),
'organisation_id'
,
None
)
is
not
None
:
if
getattr
(
aq_base
(
self
),
'organisation_id'
,
None
)
is
not
None
:
person
.
setCareerSubordination
(
'organisation_module/%s'
%
\
person
.
setCareerSubordination
(
'organisation_module/%s'
%
\
self
.
organisation_id
)
self
.
organisation_id
)
# save
# save
person
.
edit
(
**
{
'default_email_text'
:
self
.
getDefaultEmailText
(),
person
.
edit
(
**
{
'default_email_text'
:
self
.
getDefaultEmailText
(),
'default_telephone_text'
:
self
.
getDefaultTelephoneText
(),
'default_telephone_text'
:
self
.
getDefaultTelephoneText
(),
'first_name'
:
self
.
getFirstName
(),
'first_name'
:
self
.
getFirstName
(),
'career_function'
:
self
.
getFunction
(),
'career_function'
:
self
.
getFunction
(),
'last_name'
:
self
.
getLastName
(),
'last_name'
:
self
.
getLastName
(),
'reference'
:
self
.
getReference
(),
'reference'
:
self
.
getReference
(),
'password'
:
self
.
getPassword
(),
'password'
:
self
.
getPassword
(),
})
})
assignment
=
person
.
newContent
(
portal_type
=
"Assignment"
,
assignment
=
person
.
newContent
(
portal_type
=
"Assignment"
,
function
=
self
.
getFunction
(),
function
=
self
.
getFunction
(),
group
=
group_id
,
group
=
group_id
,
site
=
site_id
)
site
=
site_id
)
# Set dates are required to create valid assigments.
# Set dates are required to create valid assigments.
now
=
DateTime
()
now
=
DateTime
()
assignment
.
setStartDate
(
now
)
assignment
.
setStartDate
(
now
)
# XXX Is it required to set stop date?
# XXX Is it required to set stop date?
# Define valid for 10 years.
# Define valid for 10 years.
assignment
.
setStopDate
(
now
+
(
365
*
10
))
assignment
.
setStopDate
(
now
+
(
365
*
10
))
# Validate the Person and Assigment
# Validate the Person and Assigment
person
.
validate
(
comment
=
translateString
(
"Validated by Configurator"
))
person
.
validate
(
comment
=
translateString
(
"Validated by Configurator"
))
assignment
.
open
(
comment
=
translateString
(
"Open by Configuration"
))
assignment
.
open
(
comment
=
translateString
(
"Open by Configuration"
))
## add to customer template
## add to customer template
business_configuration
=
self
.
getBusinessConfigurationValue
()
business_configuration
=
self
.
getBusinessConfigurationValue
()
self
.
install
(
person
,
business_configuration
)
self
.
install
(
person
,
business_configuration
)
return
error_list
return
error_list
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