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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
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):
,
PropertySheet
.
Login
)
def
_checkConsistency
(
self
,
fixit
=
False
,
filter
=
None
,
**
kw
):
error_list
=
[
"Person %s should be created"
%
self
.
getReference
(),]
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
)
error_list
=
[]
person
=
self
.
portal_catalog
.
getResultValue
(
reference
=
self
.
getReference
(),
portal_type
=
"Person"
)
if
person
is
None
:
error_list
.
append
(
"Person %s should be created"
%
self
.
getReference
())
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
:
person
.
setCareerSubordination
(
'organisation_module/%s'
%
\
self
.
organisation_id
)
if
getattr
(
aq_base
(
self
),
'organisation_id'
,
None
)
is
not
None
:
person
.
setCareerSubordination
(
'organisation_module/%s'
%
\
self
.
organisation_id
)
# save
person
.
edit
(
**
{
'default_email_text'
:
self
.
getDefaultEmailText
(),
'default_telephone_text'
:
self
.
getDefaultTelephoneText
(),
'first_name'
:
self
.
getFirstName
(),
'career_function'
:
self
.
getFunction
(),
'last_name'
:
self
.
getLastName
(),
'reference'
:
self
.
getReference
(),
'password'
:
self
.
getPassword
(),
})
# save
person
.
edit
(
**
{
'default_email_text'
:
self
.
getDefaultEmailText
(),
'default_telephone_text'
:
self
.
getDefaultTelephoneText
(),
'first_name'
:
self
.
getFirstName
(),
'career_function'
:
self
.
getFunction
(),
'last_name'
:
self
.
getLastName
(),
'reference'
:
self
.
getReference
(),
'password'
:
self
.
getPassword
(),
})
assignment
=
person
.
newContent
(
portal_type
=
"Assignment"
,
function
=
self
.
getFunction
(),
group
=
group_id
,
site
=
site_id
)
assignment
=
person
.
newContent
(
portal_type
=
"Assignment"
,
function
=
self
.
getFunction
(),
group
=
group_id
,
site
=
site_id
)
# Set dates are required to create valid assigments.
now
=
DateTime
()
assignment
.
setStartDate
(
now
)
# XXX Is it required to set stop date?
# Define valid for 10 years.
assignment
.
setStopDate
(
now
+
(
365
*
10
))
# Set dates are required to create valid assigments.
now
=
DateTime
()
assignment
.
setStartDate
(
now
)
# XXX Is it required to set stop date?
# Define valid for 10 years.
assignment
.
setStopDate
(
now
+
(
365
*
10
))
# Validate the Person and Assigment
person
.
validate
(
comment
=
translateString
(
"Validated by Configurator"
))
assignment
.
open
(
comment
=
translateString
(
"Open by Configuration"
))
# Validate the Person and Assigment
person
.
validate
(
comment
=
translateString
(
"Validated by Configurator"
))
assignment
.
open
(
comment
=
translateString
(
"Open by Configuration"
))
## add to customer template
business_configuration
=
self
.
getBusinessConfigurationValue
()
self
.
install
(
person
,
business_configuration
)
## add to customer template
business_configuration
=
self
.
getBusinessConfigurationValue
()
self
.
install
(
person
,
business_configuration
)
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