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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
24e66495
Commit
24e66495
authored
Dec 23, 2011
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve and fix validation script.
It was broken in a previous modification.
parent
ad5722a1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
32 deletions
+11
-32
bt5/erp5_configurator/SkinTemplateItem/portal_skins/erp5_configurator/BusinessConfiguration_validateCustomerUsername.xml
...urator/BusinessConfiguration_validateCustomerUsername.xml
+10
-31
bt5/erp5_configurator/bt/revision
bt5/erp5_configurator/bt/revision
+1
-1
No files found.
bt5/erp5_configurator/SkinTemplateItem/portal_skins/erp5_configurator/BusinessConfiguration_validateCustomerUsername.xml
View file @
24e66495
...
@@ -50,9 +50,7 @@
...
@@ -50,9 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<value>
<string>
# check that customer did not enter in form repeating user names\n
# check that customer did not enter in form repeating user names\n
reference_list = REQUEST.get(\'_original_field_your_reference\', [])\n
reference_list = REQUEST.get(\'_original_field_your_reference\', [])\n
for reference in reference_list:\n
for reference in reference_list:\n
if reference_list.count(reference) != 1:\n
if reference_list.count(reference) != 1:\n
...
@@ -60,47 +58,28 @@ for reference in reference_list:\n
...
@@ -60,47 +58,28 @@ for reference in reference_list:\n
return 0\n
return 0\n
\n
\n
portal = context.getPortalObject()\n
portal = context.getPortalObject()\n
reference = kw.get(\'reference\', None)\n
reference = editor\n
\n
if editor is not None:\n
# script is used as a form field\'s validator\n
reference = editor\n
\n
# get Business Configuration\n
business_configuration = context.restrictedTraverse(REQUEST.get(\'business_configuration_key\'))\n
\n
\n
# ... then check already created accounts\n
# ... then check already created accounts\n
if portal.portal_catalog.getResultValue(\n
if portal.portal_catalog.getResultValue(\n
reference
=
reference, \n
reference
=
reference, \n
portal_type
=
"Person") is not None:\n
portal_type
=
"Person") is not None:\n
return 0\n
return 0\n
\n
\n
\n
# first check if a Business Configuration has not already "reserved" it\n
# first check if a Business Configuration has not already "reserved" it\n
# through a Person Configuration Item which when build will create a real\n
# through a Person Configuration Item which when build will create a real\n
# Nexedi ERP5 account.\n
# Nexedi ERP5 account.\n
person_configurator_item_list = [portal.portal_catalog.getResultValue(\n
reference=reference,\n
portal_type=\'Person Configurator Item\')]\n
\n
\n
if business_configuration is not None:\n
bc_path = " NOT %%/%s/%%" % REQUEST.get(\'business_configuration_key\')\n
# when in Configuratorm mode we the user may have created already Person Configurator Item\n
# in this business configuration. Make sure that going to Previous page will not stop\n
# validation of username uniqueness \n
# XXX: this should be done using a ZSQL Query rather than getting object\n
# there should not be a speed penalty of loading objects in RAM as in most cases\n
# it\'s either 0 (i.e. not used) or 1 (used)\n
person_configurator_item_list = filter(lambda x: x.getObject().getParentValue().getParentValue() == \n
business_configuration, \\\n
person_configurator_item_list)\n
\n
\n
if len(person_configurator_item_list) >
0:\n
if portal.portal_catalog.getResultValue(\n
reference = reference,\n
portal_type=\'Person Configurator Item\',\n
path = bc_path) is not None:\n
return 0\n
return 0\n
\n
\n
return 1\n
return 1\n
</string>
</value>
]]>
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
...
...
bt5/erp5_configurator/bt/revision
View file @
24e66495
523
524
\ No newline at end of file
\ No newline at end of file
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