Commit 2fc10fb1 authored by Ivan Tyagov's avatar Ivan Tyagov

Form validation added, consistent naming, improved integration with erp5_web...

Form validation added, consistent naming, improved integration with erp5_web and shopping cart management update/delete.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12104 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a05fce8c
...@@ -68,56 +68,37 @@ ...@@ -68,56 +68,37 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>from Products.Formulator.Errors import FormValidationError\n
pm = context.person_module\n
\n \n
data=dict(context.REQUEST)\n form = context.getWebSectionValue().ERP5Ecommerce_newCustomerAccountForm\n
request = context.REQUEST\n
form_kw = request.form\n
person_kw = {}\n
field_prefix = \'field_my_\'\n
\n \n
# Input Validation (Quick & Dirty)\n for key in form_kw.keys():\n
if "" in [data[\'field_first_name\'],\n if key.startswith(field_prefix):\n
data[\'field_last_name\'],\n person_kw[key.replace(field_prefix, \'\')] = form_kw[key]\n
data[\'field_email\'],\n
data[\'field_password\'],\n
data[\'field_telephone\'],\n
data[\'field_zip\'],\n
data[\'field_city\']]:\n
context.REQUEST.RESPONSE.redirect(context.WebSite_getDocumentUrl()+"/incomplete-form")\n
return "Incomplete"\n
if data[\'field_password\'] != data[\'field_repeat_password\']:\n
context.REQUEST.RESPONSE.redirect(context.WebSite_getDocumentUrl()+"/password-mismatch")\n
return "Password Mismatch"\n
\n \n
# The Input validation could be very much improved by getting back\n try:\n
# to the Form and highlighting the corresponding fields.\n form.validate_all_to_request(request)\n
validated = True\n
except FormValidationError, validation_errors:\n
validated = False\n
\n \n
pp = pm.newContent(portal_type=\'Person\')\n if validated == False:\n
pp.setFirstName(data[\'field_first_name\'])\n context.REQUEST.set(\'field_errors\', form.ErrorFields(validation_errors))\n
pp.setLastName(data[\'field_last_name\'])\n return form(validation_errors)\n
pp.setReference(data[\'field_email\'])\n
pp.setPassword(data[\'field_password\'])\n
pp.setCareerRole(\'internal\')\n
pp.validate()\n
context.acl_users.zodb_roles.manage_assignRoleToPrincipals("Member",[pp.getReference()],context.REQUEST.response)\n
context.acl_users.zodb_roles.manage_assignRoleToPrincipals("Assignor",[pp.getReference()],context.REQUEST.response)\n
context.REQUEST.response.redirect("")\n
\n \n
pp.newContent(portal_type=\'Email\', id=\'default_email\', url_string=data[\'field_email\'])\n person_module = context.person_module\n
pp.newContent(portal_type=\'Telephone\', id=\'default_telephone\', telephone_number=data[\'field_telephone\'])\n person = person_module.newContent(portal_type=\'Person\', **person_kw)\n
pp.newContent(portal_type=\'Fax\', id=\'default_fax\', telephone_number=data[\'field_fax\'])\n person.validate()\n
address = pp.newContent(portal_type=\'Address\', id=\'default_address\', \n
street_address=data[\'field_address\'], \n
zip_code=data[\'field_zip\'], \n
city=data[\'field_city\'])\n
address.setRegion(data[\'field_country\'])\n
\n \n
context.REQUEST.RESPONSE.redirect(context.WebSite_getDocumentUrl()+"/person-created")\n ## TODO: create an assignment\n
return \n
\n \n
# Debugging output\n context.REQUEST.RESPONSE.redirect(context.WebSite_getDocumentUrl()+"/person-created")\n
return "OKAY - New Person was created for "+str(context).replace("<","").replace(">","")\n </string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -139,6 +120,7 @@ return "OKAY - New Person was created for "+str(context).replace("<","").replace ...@@ -139,6 +120,7 @@ return "OKAY - New Person was created for "+str(context).replace("<","").replace
<key> <string>_proxy_roles</string> </key> <key> <string>_proxy_roles</string> </key>
<value> <value>
<tuple> <tuple>
<string>Assignor</string>
<string>Manager</string> <string>Manager</string>
</tuple> </tuple>
</value> </value>
...@@ -167,15 +149,26 @@ return "OKAY - New Person was created for "+str(context).replace("<","").replace ...@@ -167,15 +149,26 @@ return "OKAY - New Person was created for "+str(context).replace("<","").replace
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>Products.Formulator.Errors</string>
<string>FormValidationError</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>pm</string> <string>form</string>
<string>dict</string> <string>request</string>
<string>data</string> <string>form_kw</string>
<string>person_kw</string>
<string>field_prefix</string>
<string>_getiter_</string>
<string>key</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>pp</string> <string>_write_</string>
<string>address</string> <string>True</string>
<string>str</string> <string>validated</string>
<string>validation_errors</string>
<string>False</string>
<string>person_module</string>
<string>_apply_</string>
<string>person</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -192,7 +185,7 @@ return "OKAY - New Person was created for "+str(context).replace("<","").replace ...@@ -192,7 +185,7 @@ return "OKAY - New Person was created for "+str(context).replace("<","").replace
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>ERP5Ecommerce_createPerson</string> </value> <value> <string>ERP5Ecommerce_createCustomerAccount</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -155,7 +155,7 @@ return sale_order\n ...@@ -155,7 +155,7 @@ return sale_order\n
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Create Persistent Sale Order from shopping cart</string> </value> <value> <string>Create persistent Sale Order from shopping cart</string> </value>
</item> </item>
<item> <item>
<key> <string>warnings</string> </key> <key> <string>warnings</string> </key>
......
...@@ -68,8 +68,8 @@ ...@@ -68,8 +68,8 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>import string\n <value> <string>from random import choice\n
from random import choice\n import string\n
return \'\'.join([choice(string.letters) for i in range(max_long)])\n return \'\'.join([choice(string.letters) for i in range(max_long)])\n
</string> </value> </string> </value>
</item> </item>
...@@ -114,9 +114,9 @@ return \'\'.join([choice(string.letters) for i in range(max_long)])\n ...@@ -114,9 +114,9 @@ return \'\'.join([choice(string.letters) for i in range(max_long)])\n
<value> <value>
<tuple> <tuple>
<string>max_long</string> <string>max_long</string>
<string>string</string>
<string>random</string> <string>random</string>
<string>choice</string> <string>choice</string>
<string>string</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
......
...@@ -74,13 +74,15 @@ from DateTime import DateTime\n ...@@ -74,13 +74,15 @@ from DateTime import DateTime\n
now = DateTime()\n now = DateTime()\n
request = context.REQUEST\n request = context.REQUEST\n
session_id = request.get(\'session_id\', None)\n session_id = request.get(\'session_id\', None)\n
expire_timeout_days = 7\n
cache_factory = \'erp5_session_cache\'\n
\n \n
if session_id is None:\n if session_id is None:\n
## first call so generate session_id and send back via cookie\n ## first call so generate session_id and send back via cookie\n
session_id = context.ERP5Ecommerce_generateSessionID(max_long=10)\n session_id = context.ERP5Ecommerce_generateSessionID(max_long=10)\n
request.RESPONSE.setCookie(\'session_id\', session_id, expires=(now +7).fCommon(), path=\'/\')\n request.RESPONSE.setCookie(\'session_id\', session_id, expires=(now +expire_timeout_days).fCommon(), path=\'/\')\n
\n
\n \n
cache_factory = \'erp5_session_cache\'\n
cache_method = CachingMethod(callable_object = context.ERP5Ecommerce_newShoppingCart, \\\n cache_method = CachingMethod(callable_object = context.ERP5Ecommerce_newShoppingCart, \\\n
id = session_id, \\\n id = session_id, \\\n
cache_factory=cache_factory)\n cache_factory=cache_factory)\n
...@@ -144,6 +146,7 @@ else:\n ...@@ -144,6 +146,7 @@ else:\n
<string>request</string> <string>request</string>
<string>None</string> <string>None</string>
<string>session_id</string> <string>session_id</string>
<string>expire_timeout_days</string>
<string>cache_factory</string> <string>cache_factory</string>
<string>cache_method</string> <string>cache_method</string>
<string>shopping_cart</string> <string>shopping_cart</string>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>shopping_cart = context.ERP5Ecommerce_getShoppingCart()\n
return shopping_cart.objectValues(\'ERP5 Order Line\')\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>shopping_cart</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Ecommerce_getShoppingCartItemList</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Getshopping cart items</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>""" Why can\'t we use getTotalPrice on temporary Order object? """\n
total = 0.0\n
shopping_cart = context.ERP5Ecommerce_getShoppingCart()\n
for order_line in shopping_cart.objectValues():\n
try:\n
total += order_line.getPrice() * order_line.getTotalQuantity()\n
except RuntimeError:\n
## why this happens is a mistery ?\n
pass\n
return str(total)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>total</string>
<string>_getattr_</string>
<string>context</string>
<string>shopping_cart</string>
<string>_getiter_</string>
<string>order_line</string>
<string>RuntimeError</string>
<string>str</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Ecommerce_getTotalPriceForShoppingCart</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Calculate total price of items in shopping cart</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>user_list = context.acl_users.searchUsers(id=editor, exact_match=True)\n
return len(user_list)==0\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>editor, request</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>editor</string>
<string>request</string>
<string>_getattr_</string>
<string>context</string>
<string>True</string>
<string>user_list</string>
<string>len</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Ecommerce_isValidUsername</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Is valid username provided?</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PageTemplates.ZopePageTemplate</string>
<string>ZopePageTemplate</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
<legend>\n
<span tal:content="here/portal_membership/getAuthenticatedMember"/> \n
</legend>\n
]]></string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Ecommerce_loginStatusWidget</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Render login status</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Form.Form</string>
<string>ERP5Form</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>Title</string>
<string>my_first_name</string>
<string>my_last_name</string>
<string>my_default_email_text</string>
<string>my_default_telephone_text</string>
<string>my_default_fax_text</string>
<string>my_default_address_street_address</string>
<string>my_default_address_city</string>
<string>my_default_address_zip_code</string>
<string>my_default_address_region</string>
<string>my_reference</string>
<string>my_password</string>
<string>password_confirm</string>
<string>submit_register</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Ecommerce_newCustomerAccountForm</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>newCustomerForm</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Register new customer account</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>city</string> </value> <value> <string>my_default_address_city</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
</item> </item>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string>visible_label</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>default</string> </key> <key> <string>default</string> </key>
...@@ -211,7 +211,7 @@ ...@@ -211,7 +211,7 @@
</item> </item>
<item> <item>
<key> <string>display_width</string> </key> <key> <string>display_width</string> </key>
<value> <int>20</int> </value> <value> <int>30</int> </value>
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>country</string> </value> <value> <string>my_default_address_region</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -124,7 +124,9 @@ ...@@ -124,7 +124,9 @@
</item> </item>
<item> <item>
<key> <string>default</string> </key> <key> <string>default</string> </key>
<value> <string></string> </value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -160,9 +162,7 @@ ...@@ -160,9 +162,7 @@
</item> </item>
<item> <item>
<key> <string>items</string> </key> <key> <string>items</string> </key>
<value> <value> <string></string> </value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>required</string> </key> <key> <string>required</string> </key>
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
</item> </item>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string>visible_label</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>default</string> </key> <key> <string>default</string> </key>
...@@ -229,7 +229,7 @@ ...@@ -229,7 +229,7 @@
</item> </item>
<item> <item>
<key> <string>first_item</string> </key> <key> <string>first_item</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
...@@ -240,12 +240,16 @@ ...@@ -240,12 +240,16 @@
<value> <value>
<list> <list>
<tuple> <tuple>
<string></string>
<string></string>
</tuple>
<tuple>
<string>France</string> <string>France</string>
<string>france</string> <string>fr</string>
</tuple> </tuple>
<tuple> <tuple>
<string>Germany</string> <string>Germany</string>
<string>germany</string> <string>de</string>
</tuple> </tuple>
</list> </list>
</value> </value>
...@@ -256,7 +260,7 @@ ...@@ -256,7 +260,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>5</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -290,7 +294,7 @@ ...@@ -290,7 +294,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: [(a.getTitle(),a.getId()) for a in here.portal_categories.region.objectValues()]</string> </value> <value> <string>python: [(),(a.getTitle(),a.getId()) for a in here.portal_categories.region.objectValues()]</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<tuple> <tuple>
<tuple> <tuple>
<string>Products.Formulator.StandardFields</string> <string>Products.Formulator.StandardFields</string>
<string>StringField</string> <string>EmailField</string>
</tuple> </tuple>
<none/> <none/>
</tuple> </tuple>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>email</string> </value> <value> <string>my_default_email_text</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -24,6 +24,10 @@ ...@@ -24,6 +24,10 @@
<key> <string>external_validator_failed</string> </key> <key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value> <value> <string>The input failed the external validator.</string> </value>
</item> </item>
<item>
<key> <string>not_email</string> </key>
<value> <string>You did not enter an email address.</string> </value>
</item>
<item> <item>
<key> <string>required_not_found</string> </key> <key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value> <value> <string>Input is required but no input given.</string> </value>
...@@ -195,7 +199,7 @@ ...@@ -195,7 +199,7 @@
</item> </item>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string>visible_label</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>default</string> </key> <key> <string>default</string> </key>
...@@ -211,7 +215,7 @@ ...@@ -211,7 +215,7 @@
</item> </item>
<item> <item>
<key> <string>display_width</string> </key> <key> <string>display_width</string> </key>
<value> <int>20</int> </value> <value> <int>30</int> </value>
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
...@@ -239,11 +243,11 @@ ...@@ -239,11 +243,11 @@
</item> </item>
<item> <item>
<key> <string>required</string> </key> <key> <string>required</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>E-Mail</string> </value> <value> <string>Email</string> </value>
</item> </item>
<item> <item>
<key> <string>truncate</string> </key> <key> <string>truncate</string> </key>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>address</string> </value> <value> <string>my_default_fax_text</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -211,7 +211,7 @@ ...@@ -211,7 +211,7 @@
</item> </item>
<item> <item>
<key> <string>display_width</string> </key> <key> <string>display_width</string> </key>
<value> <int>20</int> </value> <value> <int>30</int> </value>
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
...@@ -239,11 +239,11 @@ ...@@ -239,11 +239,11 @@
</item> </item>
<item> <item>
<key> <string>required</string> </key> <key> <string>required</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Address</string> </value> <value> <string>FAX</string> </value>
</item> </item>
<item> <item>
<key> <string>truncate</string> </key> <key> <string>truncate</string> </key>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>fax</string> </value> <value> <string>my_default_telephone_text</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
</item> </item>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string>visible_label</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>default</string> </key> <key> <string>default</string> </key>
...@@ -211,7 +211,7 @@ ...@@ -211,7 +211,7 @@
</item> </item>
<item> <item>
<key> <string>display_width</string> </key> <key> <string>display_width</string> </key>
<value> <int>20</int> </value> <value> <int>30</int> </value>
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Fax</string> </value> <value> <string>Telephone</string> </value>
</item> </item>
<item> <item>
<key> <string>truncate</string> </key> <key> <string>truncate</string> </key>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>first_name</string> </value> <value> <string>my_first_name</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -211,7 +211,7 @@ ...@@ -211,7 +211,7 @@
</item> </item>
<item> <item>
<key> <string>display_width</string> </key> <key> <string>display_width</string> </key>
<value> <int>20</int> </value> <value> <int>15</int> </value>
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>last_name</string> </value> <value> <string>my_last_name</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -211,7 +211,7 @@ ...@@ -211,7 +211,7 @@
</item> </item>
<item> <item>
<key> <string>display_width</string> </key> <key> <string>display_width</string> </key>
<value> <int>20</int> </value> <value> <int>15</int> </value>
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>password</string> </value> <value> <string>my_password</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>external_validator_failed</string> </key> <key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value> <value> <string>Password and confirm password do not match.</string> </value>
</item> </item>
<item> <item>
<key> <string>required_not_found</string> </key> <key> <string>required_not_found</string> </key>
...@@ -211,7 +211,7 @@ ...@@ -211,7 +211,7 @@
</item> </item>
<item> <item>
<key> <string>display_width</string> </key> <key> <string>display_width</string> </key>
<value> <int>20</int> </value> <value> <int>12</int> </value>
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
...@@ -223,7 +223,9 @@ ...@@ -223,7 +223,9 @@
</item> </item>
<item> <item>
<key> <string>external_validator</string> </key> <key> <string>external_validator</string> </key>
<value> <string></string> </value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>extra</string> </key> <key> <string>extra</string> </key>
...@@ -263,4 +265,23 @@ ...@@ -263,4 +265,23 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.MethodField</string>
<string>Method</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>Person_validatePasswordsMatch</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>repeat_password</string> </value> <value> <string>password_confirm</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>external_validator_failed</string> </key> <key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value> <value> <string>Password and confirm password do not match.</string> </value>
</item> </item>
<item> <item>
<key> <string>required_not_found</string> </key> <key> <string>required_not_found</string> </key>
...@@ -211,7 +211,7 @@ ...@@ -211,7 +211,7 @@
</item> </item>
<item> <item>
<key> <string>display_width</string> </key> <key> <string>display_width</string> </key>
<value> <int>20</int> </value> <value> <int>12</int> </value>
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
...@@ -223,7 +223,9 @@ ...@@ -223,7 +223,9 @@
</item> </item>
<item> <item>
<key> <string>external_validator</string> </key> <key> <string>external_validator</string> </key>
<value> <string></string> </value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>extra</string> </key> <key> <string>extra</string> </key>
...@@ -243,7 +245,7 @@ ...@@ -243,7 +245,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Repeat password</string> </value> <value> <string>Password (confirm)</string> </value>
</item> </item>
<item> <item>
<key> <string>truncate</string> </key> <key> <string>truncate</string> </key>
...@@ -263,4 +265,23 @@ ...@@ -263,4 +265,23 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.MethodField</string>
<string>Method</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>Person_validatePasswordsMatch</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
</item> </item>
<item> <item>
<key> <string>name</string> </key> <key> <string>name</string> </key>
<value> <string>ERP5Ecommerce_createPerson:method</string> </value> <value> <string>ERP5Ecommerce_createCustomerAccount:method</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -144,7 +144,7 @@ return order\n ...@@ -144,7 +144,7 @@ return order\n
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Create new Shopping Cart</string> </value> <value> <string>Create new shopping cart</string> </value>
</item> </item>
<item> <item>
<key> <string>warnings</string> </key> <key> <string>warnings</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PageTemplates.ZopePageTemplate</string>
<string>ZopePageTemplate</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
<div>\n
<tal:block tal:define="shopping_cart_items here/ERP5Ecommerce_getShoppingCartItemList;\n
empty_cart python: len(shopping_cart_items)==0;\n
website here/getWebSiteValue;">\n
\n
<p tal:condition = "empty_cart"> Your shopping cart is empty. </p>\n
\n
<form action="" tal:condition = "not: empty_cart">\n
<table>\n
<thead>\n
<th>Shopping Cart Items:</th>\n
<th>Price:</th>\n
<th>Quantity:</th>\n
</thead>\n
<tbody> \n
<tal:block tal:repeat="order_line shopping_cart_items">\n
<tr tal:define="resource python: website.restrictedTraverse(order_line.getResource());\n
quantity python: int(order_line.getTotalQuantity());\n
price python: resource.getPrice();\n
order_line_id order_line/getId;\n
global currency python: here.restrictedTraverse(resource.getSupplyLinePriceCurrency()).getTitle()"> \n
<td>\n
<a href="" tal:attributes="href resource/absolute_url">\n
<b tal:content="order_line/getTitle"/> <br/>\n
<a tal:attributes="href python: \'%s?field_my_order_line_id=%s\' \n
%(website.SaleOrder_deleteShoppingCartItem.absolute_url(), \n
order_line_id)"> \n
Delete \n
</a>\n
</a>\n
</td>\n
<td>\n
<span tal:replace="price"/> <span tal:replace="currency"/>\n
</td>\n
<td>\n
<input type="input" \n
name="field_my_buy_quantity"\n
size="2"\n
tal:attributes ="value quantity"/>\n
</td>\n
</tr>\n
</tal:block>\n
<tr>\n
<td></td>\n
<td></td>\n
<td>\n
<br/>\n
<input type="submit" name="SaleOrder_update:method" value="Update"/>\n
</td>\n
</tbody>\n
</table>\n
</form>\n
\n
<tal:block tal:condition = "not: empty_cart">\n
<br/><br/>\n
<b>Total price: <span tal:replace="python: here.ERP5Ecommerce_getTotalPriceForShoppingCart()"/> \n
<span tal:replace="currency"/>\n
</b> <br/>\n
<form action="">\n
<input type="submit" value="Proceed to checkout" name="SaleOrder_confirmShopping:method">\n
</form> \n
\n
</tal:block>\n
</tal:block>\n
</div>
]]></string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Ecommerce_renderSaleOrderAsShoppingCart</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Render custom cart content</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -48,33 +48,42 @@ ...@@ -48,33 +48,42 @@
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
<tal:block tal:define="shopping_cart here/ERP5Ecommerce_getShoppingCart;\n <div>\n
empty_cart python: len(here.ERP5Ecommerce_getShoppingCart().objectValues())==0">\n <tal:block tal:define="shopping_cart_items here/ERP5Ecommerce_getShoppingCartItemList;\n
empty_cart python: len(shopping_cart_items)==0;\n
website here/getWebSiteValue;">\n
\n \n
<legend>My shopping cart</legend>\n <legend>My shopping cart</legend>\n
\n \n
<ul tal:repeat="order_line shopping_cart/objectValues">\n <ul tal:repeat="order_line shopping_cart_items">\n
<li tal:define="resource python: here.restrictedTraverse(order_line.getResource());\n <li tal:define="resource python: website.restrictedTraverse(order_line.getResource());\n
quantity python: int(order_line.getTotalQuantity());\n quantity python: int(order_line.getTotalQuantity());\n
price python: resource.getPrice();\n price python: resource.getPrice();\n
currency python: here.restrictedTraverse(resource.getSupplyLinePriceCurrency()).getTitle()"> \n global currency python: here.restrictedTraverse(resource.getSupplyLinePriceCurrency()).getTitle()"> \n
\n
<a href="" tal:attributes="href resource/absolute_url">\n <a href="" tal:attributes="href resource/absolute_url">\n
<b tal:content="order_line/getTitle"/> \n <b tal:content="order_line/getTitle"/> \n
</a><br/>\n </a>\n
Price: <span tal:replace="price"/> <span tal:replace="currency"/><br/>\n <br/>\n
Price: <span tal:replace="price"/> <span tal:replace="currency"/>\n
<br/>\n
- quantity: <span tal:replace="quantity"/>\n - quantity: <span tal:replace="quantity"/>\n
</li>\n </li>\n
</ul>\n </ul> \n
\n
<tal:block tal:condition = "not: empty_cart">\n
<br/>\n
<b>Total price: <span tal:replace="python: here.ERP5Ecommerce_getTotalPriceForShoppingCart()"/> \n
<span tal:replace="currency"/>\n
</b>\n
\n
<input type="submit" value="View Shopping Cart" name="SaleOrder_viewAsWeb:method"/>\n
\n \n
<!--Total price: <span tal:replace="shopping_cart/getTotalPrice"/> -->\n <input type="submit" value="Proceed to checkout" name="SaleOrder_confirmShopping:method"/>\n
<form action="">\n
<input type="submit"\n
name="SaleOrder_confirmShopping:method"\n
tal:omit-tag="empty_cart"\n
value="Proceed to checkout"/>\n
</form>\n
\n \n
</tal:block> </tal:block>\n
</tal:block>\n
</div>
]]></string> </value> ]]></string> </value>
</item> </item>
...@@ -88,11 +97,11 @@ ...@@ -88,11 +97,11 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>ERP5Ecommerce_miniShoppingCart</string> </value> <value> <string>ERP5Ecommerce_shoppingCartWidget</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Render cart content</string> </value> <value> <string>Render cart portlet</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -74,7 +74,7 @@ from Products.ERP5Type.Document import newTempOrderLine\n ...@@ -74,7 +74,7 @@ from Products.ERP5Type.Document import newTempOrderLine\n
\n \n
request = context.REQUEST\n request = context.REQUEST\n
product = context\n product = context\n
quantity = request.get(\'field_your_buy_quantity\', 1)\n quantity = request.get(\'field_my_buy_quantity\', 1)\n
shopping_cart = context.ERP5Ecommerce_getShoppingCart()\n shopping_cart = context.ERP5Ecommerce_getShoppingCart()\n
\n \n
## check if we don\'t have already such a product in cart\n ## check if we don\'t have already such a product in cart\n
...@@ -98,6 +98,7 @@ if line_found == False:\n ...@@ -98,6 +98,7 @@ if line_found == False:\n
\n \n
redirect_url = request.get(\'HTTP_REFERER\', context.absolute_url())\n redirect_url = request.get(\'HTTP_REFERER\', context.absolute_url())\n
redirect_url = redirect_url.split(\'?\')[0]\n redirect_url = redirect_url.split(\'?\')[0]\n
#redirect_url = context.getWebSectionValue().absolute_url()\n
request.RESPONSE.redirect("%s?portal_status_message=Added to cart." %redirect_url)\n request.RESPONSE.redirect("%s?portal_status_message=Added to cart." %redirect_url)\n
...@@ -181,7 +182,7 @@ request.RESPONSE.redirect("%s?portal_status_message=Added to cart." %redirect_ur ...@@ -181,7 +182,7 @@ request.RESPONSE.redirect("%s?portal_status_message=Added to cart." %redirect_ur
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Add To Shopping Cart</string> </value> <value> <string>Add product to shopping cart</string> </value>
</item> </item>
<item> <item>
<key> <string>warnings</string> </key> <key> <string>warnings</string> </key>
......
...@@ -68,18 +68,15 @@ ...@@ -68,18 +68,15 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string># This script is part of ERP5 E-Commerce.\n <value> <string>""" This script is used to set the security permissions of a Product in a way\n
#\n that it can be used in an E-Commerce web site. This means,\n
# It is used to set the security permissions of a Product in a way\n it must be possible to show it in a product list and to access\n
# that it can be used in an E-Commerce web site. This means,\n its detail-page without being logged in. """\n
# it must be possible to show it in a product list and to access\n
# its detail-page without being logged in.\n
\n
permission_list = context.possible_permissions()\n
\n \n
# First, remove all permissions (very secure by default)\n # First, remove all permissions (very secure by default)\n
# We should keep only Manager, or we will not be able to\n # We should keep only Manager, or we will not be able to\n
# do the end of the script\n # do the end of the script\n
permission_list = context.possible_permissions()\n
for permission in permission_list:\n for permission in permission_list:\n
context.manage_permission(permission, [\'Manager\'], 0)\n context.manage_permission(permission, [\'Manager\'], 0)\n
\n \n
...@@ -113,24 +110,25 @@ assignor_permission_list = [p for p in [\n ...@@ -113,24 +110,25 @@ assignor_permission_list = [p for p in [\n
erp5_role_dict = {\n erp5_role_dict = {\n
\'Anonymous\': anonymous_permission_list,\n \'Anonymous\': anonymous_permission_list,\n
\'Assignee\': common_permission_list,\n \'Assignee\': common_permission_list,\n
\'Assignor\': common_permission_list + author_permission_list +\\\n \'Assignor\': common_permission_list + \\\n
author_permission_list +\\\n
assignor_permission_list,\n assignor_permission_list,\n
\'Associate\': common_permission_list,\n \'Associate\': common_permission_list,\n
\'Auditor\' : common_permission_list,\n \'Auditor\' : common_permission_list,\n
\'Author\': common_permission_list + author_permission_list,\n \'Author\': common_permission_list + \\\n
author_permission_list,\n
\'Manager\': permission_list\n \'Manager\': permission_list\n
}\n }\n
\n \n
# Add ERP5 permissions\n # Add ERP5 permissions\n
erp5_permission_dict = {}\n erp5_permission_dict = {}\n
for role,permission_list in erp5_role_dict.items():\n for role, permission_list in erp5_role_dict.items():\n
for permission in permission_list:\n for permission in permission_list:\n
if not erp5_permission_dict.has_key(permission):\n if not erp5_permission_dict.has_key(permission):\n
erp5_permission_dict[permission] = []\n erp5_permission_dict[permission] = []\n
erp5_permission_dict[permission].append(role)\n erp5_permission_dict[permission].append(role)\n
\n \n
for permission,role_list in erp5_permission_dict.items():\n for permission,role_list in erp5_permission_dict.items():\n
context.debug(permission + str(role_list))\n
context.manage_permission(permission,role_list, 0)\n context.manage_permission(permission,role_list, 0)\n
\n \n
return "finished"\n return "finished"\n
...@@ -194,7 +192,6 @@ return "finished"\n ...@@ -194,7 +192,6 @@ return "finished"\n
<string>_write_</string> <string>_write_</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>role_list</string> <string>role_list</string>
<string>str</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -215,7 +212,7 @@ return "finished"\n ...@@ -215,7 +212,7 @@ return "finished"\n
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Make Products Accessible</string> </value> <value> <string>Make products accessible for anonymous</string> </value>
</item> </item>
<item> <item>
<key> <string>warnings</string> </key> <key> <string>warnings</string> </key>
......
...@@ -90,8 +90,8 @@ ...@@ -90,8 +90,8 @@
<list> <list>
<string>my_title</string> <string>my_title</string>
<string>my_description</string> <string>my_description</string>
<string>your_buy_quantity</string>
<string>my_buy_button</string> <string>my_buy_button</string>
<string>my_buy_quantity</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Product Shop View</string> </value> <value> <string>Product shop view</string> </value>
</item> </item>
<item> <item>
<key> <string>unicode_mode</string> </key> <key> <string>unicode_mode</string> </key>
......
...@@ -217,9 +217,22 @@ ...@@ -217,9 +217,22 @@
<key> <string>default</string> </key> <key> <string>default</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
<input name="field_your_buy_quantity" value="1" type="text" size="3" />\n <select name="field_my_buy_quantity" >\n
<button type="submit" class="save" title="Confirm"\n <option value="1">1 </option>\n
name="Product_addToShoppingCart:method"/>Add to Shopping Cart</button> <option\n
value="2">2 </option>\n
<option\n
value="3">3 </option>\n
<option\n
value="4">4 </option>\n
<option\n
value="5">5 </option>\n
<option\n
value="6">6 </option>\n
</select>\n
<button type="submit"\n
class="save" title="Confirm"\n
name="Product_addToShoppingCart:method">Add to Shopping Cart</button>
]]></string> </value> ]]></string> </value>
</item> </item>
...@@ -245,7 +258,7 @@ name="Product_addToShoppingCart:method"/>Add to Shopping Cart</button> ...@@ -245,7 +258,7 @@ name="Product_addToShoppingCart:method"/>Add to Shopping Cart</button>
</item> </item>
<item> <item>
<key> <string>height</string> </key> <key> <string>height</string> </key>
<value> <int>5</int> </value> <value> <int>50</int> </value>
</item> </item>
<item> <item>
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>your_buy_quantity</string> </value> <value> <string>my_buy_quantity</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
...@@ -208,16 +208,15 @@ ...@@ -208,16 +208,15 @@
user_id = context.portal_membership.getAuthenticatedMember().getId()\n user_id = context.portal_membership.getAuthenticatedMember().getId()\n
request = context.REQUEST\n request = context.REQUEST\n
\n website = context.getWebSiteValue()\n
\n \n
## determine customer if not such create an account\n ## determine customer if not such create an account\n
if context.portal_membership.isAnonymousUser():\n if context.portal_membership.isAnonymousUser():\n
redirect_url = request.get(\'HTTP_REFERER\', context.absolute_url())\n redirect_url = website.ERP5Ecommerce_newCustomerAccountForm.absolute_url()\n
redirect_url = redirect_url.split(\'?\')[0]\n request.RESPONSE.redirect(redirect_url + \'?editable_mode=1&portal_status_message=You need to create an account.\')\n
request.RESPONSE.redirect(redirect_url + \'/ERP5Ecommerce_newCustomerForm?editable_mode=1&portal_status_message=You need to create an account.\')\n
return\n return\n
\n \n
context.debug(context.portal_membership.isAnonymousUser())\n #context.debug(context.portal_membership.isAnonymousUser())\n
\n \n
shopping_cart = context.ERP5Ecommerce_getShoppingCart()\n shopping_cart = context.ERP5Ecommerce_getShoppingCart()\n
\n \n
...@@ -294,13 +293,14 @@ context.REQUEST.RESPONSE.redirect(redirect_url)\n ...@@ -294,13 +293,14 @@ context.REQUEST.RESPONSE.redirect(redirect_url)\n
<string>context</string> <string>context</string>
<string>user_id</string> <string>user_id</string>
<string>request</string> <string>request</string>
<string>website</string>
<string>redirect_url</string> <string>redirect_url</string>
<string>_getitem_</string>
<string>shopping_cart</string> <string>shopping_cart</string>
<string>sale_order</string> <string>sale_order</string>
<string>True</string> <string>True</string>
<string>shopping_cart_persistent</string> <string>shopping_cart_persistent</string>
<string>user_id_number</string> <string>user_id_number</string>
<string>_getitem_</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -321,7 +321,7 @@ context.REQUEST.RESPONSE.redirect(redirect_url)\n ...@@ -321,7 +321,7 @@ context.REQUEST.RESPONSE.redirect(redirect_url)\n
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Confirm Order</string> </value> <value> <string>Confirm order</string> </value>
</item> </item>
<item> <item>
<key> <string>warnings</string> </key> <key> <string>warnings</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_Change_Python_Scripts_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Change_bindings_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Change_cache_settings_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Change_permissions_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Change_proxy_roles_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Manage_WebDAV_Locks_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Manage_properties_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Take_ownership_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Undo_changes_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_View_History_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_View_management_screens_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_WebDAV_Lock_items_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_WebDAV_Unlock_items_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_WebDAV_access_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>request = context.REQUEST\n
website = context.getWebSiteValue()\n
shopping_cart = context.ERP5Ecommerce_getShoppingCart()\n
if field_my_order_line_id is not None:\n
shopping_cart.manage_delObjects(field_my_order_line_id)\n
portal_status_message = "Successfully removed from shopping cart."\n
else:\n
portal_status_message = "Please select an item."\n
\n
redirect_url = website.SaleOrder_viewAsWeb.absolute_url()\n
request.RESPONSE.redirect(redirect_url + \'?portal_status_message=%s\' %portal_status_message)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>field_my_order_line_id = None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>field_my_order_line_id</string>
<string>_getattr_</string>
<string>context</string>
<string>request</string>
<string>website</string>
<string>shopping_cart</string>
<string>None</string>
<string>portal_status_message</string>
<string>redirect_url</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrder_deleteShoppingCartItem</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Delete a shopping cart item</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Form.Form</string>
<string>ERP5Form</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>shopping_cart</string>
<string>shopping_item_list</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrder_viewAsWeb</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Product_view</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Shopping cart details</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
6 14
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment