Commit 5700cd65 authored by Ivan Tyagov's avatar Ivan Tyagov

Consistent naming, added support for external payment systems (to be improved).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12172 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 466cebd5
......@@ -46,7 +46,7 @@
</item>
<item>
<key> <string>last_id</string> </key>
<value> <string>1</string> </value>
<value> <string>2</string> </value>
</item>
<item>
<key> <string>portal_type</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[
<tal:block tal:define="base_url context/absolute_url;\n
TPE python: options.get(\'TPE\', \'my_merchant_key_location\');\n
montant python: options.get(\'total\', here.ERP5Ecommerce_getShoppingCartTotalPrice(include_currency=True));\n
reference python: options.get(\'reference\', here.ERP5Ecommerce_getShoppingCartId()); \n
url_retour python: options.get(\'shop_url\', \'http://www.my-shop.com\');\n
url_retour_ok python: \'%s/%s?payment_successful=1&portal_status_message=Payment accepted.\' \n
%(base_url, \n
options.get(\'url_return_ok\', \'ERP5Ecommerce_externalPaymentHandler\'));\n
url_retour_err python: \'%s/%s?payment_successful=0&portal_status_message=Payment rejected.\' \n
%(base_url, \n
options.get(\'url_return_err\', \'ERP5Ecommerce_externalPaymentHandler\'));\n
langue python: options.get(\'language\', \'en\');\n
code_societe python: options.get(\'code_societe\', \'my_shop_code\');\n
texte_bouton python: options.get(\'text_button\', \'Secure Online Payment\');\n
texte_libre python: options.get(\'text_free\', \'\');">\n
\n
<span tal:replace="structure python: here.payment.CreerFormulaireCM(TPE = TPE,\n
montant = montant,\n
reference = reference,\n
texte_libre=texte_libre,\n
url_retour = url_retour,\n
url_retour_ok =url_retour_ok,\n
url_retour_err = url_retour_err,\n
langue = langue,\n
texte_bouton= texte_bouton,\n
code_societe = code_societe)"/>\n
</tal:block>
]]></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_CreerFormulaireCM</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>CyberMut button for external payment</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -80,7 +80,7 @@ if product is None:\n
line_found=False\n
for order_line in shopping_cart:\n
if order_line[\'resource\'] == product.getRelativeUrl():\n
new_quantity = order_line[\'quantity\'] + int(quantity)\n
new_quantity = int(order_line[\'quantity\']) + quantity\n
if new_quantity<=0:\n
## remove items with zero quantity\n
del shopping_cart[indexof(order_line)]\n
......@@ -90,7 +90,7 @@ for order_line in shopping_cart:\n
break\n
\n
if line_found == False:\n
## new Product, add to shopping cart\n
## new Resource so add it to shopping cart\n
tmp = {}\n
tmp[\'resource\'] = product.getRelativeUrl()\n
tmp[\'quantity\'] = quantity\n
......
......@@ -70,17 +70,19 @@
<key> <string>_body</string> </key>
<value> <string>from Products.Formulator.Errors import FormValidationError\n
\n
form = context.ERP5Ecommerce_newCustomerAccountForm\n
request = context.REQUEST\n
form_kw = request.form\n
person_kw = {}\n
field_prefix = \'field_my_\'\n
translateString = context.Base_translateString\n
form = context.ERP5Ecommerce_newCustomerAccountForm\n
\n
## extract customer details\n
person_kw = {}\n
field_prefix = \'field_my_\'\n
person_kw[\'career_role\'] = \'internal\'\n
for key in form_kw.keys():\n
if key.startswith(field_prefix):\n
person_kw[key.replace(field_prefix, \'\')] = form_kw[key]\n
person_kw[\'career_role\'] = \'internal\'\n
\n
\n
## get credit card account details\n
bank_kw = {}\n
......@@ -88,7 +90,8 @@ for key in (\'bank_code\', \'bank_account_holder_name\', \'bank_account_number\'
bank_kw[key] = person_kw.pop(key)\n
bank_kw[\'stop_date\'] = \'%s/%s/%s\' %(request.get(\'subfield_field_my_stop_date_year\', \'\'), \\\n
request.get(\'subfield_field_my_stop_date_month\', \'\'), \\\n
request.get(\'subfield_field_my_stop_date_month\', \'\') )\n
request.get(\'subfield_field_my_stop_date_month\', \'\'))\n
## validate form to request\n
try:\n
kw = form.validate_all_to_request(request)\n
validated = True\n
......@@ -99,6 +102,7 @@ if validated == False:\n
context.REQUEST.set(\'field_errors\', form.ErrorFields(validation_errors))\n
return form(validation_errors)\n
\n
## save customer\n
person_module = context.person_module\n
person = person_module.newContent(portal_type=\'Person\', **person_kw)\n
person.validate()\n
......@@ -107,6 +111,7 @@ person.validate()\n
credit_card = person.newContent(portal_type=\'Credit Card\')\n
credit_card.edit(**bank_kw)\n
\n
## reindex customer so it becomes available as site member\n
person.immediateReindexObject()\n
\n
context.Base_redirect(\'ERP5Ecommerce_logged_in\', \\\n
......@@ -170,16 +175,16 @@ context.Base_redirect(\'ERP5Ecommerce_logged_in\', \\\n
<string>FormValidationError</string>
<string>_getattr_</string>
<string>context</string>
<string>form</string>
<string>request</string>
<string>form_kw</string>
<string>translateString</string>
<string>form</string>
<string>person_kw</string>
<string>field_prefix</string>
<string>translateString</string>
<string>_write_</string>
<string>_getiter_</string>
<string>key</string>
<string>_getitem_</string>
<string>_write_</string>
<string>bank_kw</string>
<string>kw</string>
<string>True</string>
......@@ -211,7 +216,7 @@ context.Base_redirect(\'ERP5Ecommerce_logged_in\', \\\n
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Create Customer object</string> </value>
<value> <string>Create customer account</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
......
......@@ -68,10 +68,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>user_id = context.portal_membership.getAuthenticatedMember().getId()\n
user_list = context.person_module.portal_catalog(reference=user_id, \\\n
portal_type="Person")\n
user_object = user_list[0].getObject()\n
<value> <string>user_object = context.ERP5Ecommerce_getShoppingCartCustomer()\n
\n
order_module = context.getPortalObject().sale_order_module\n
sale_order = order_module.newContent(portal_type=\'Sale Order\')\n
......@@ -139,14 +136,12 @@ return sale_order\n
<string>shopping_cart</string>
<string>_getattr_</string>
<string>context</string>
<string>user_id</string>
<string>user_list</string>
<string>_getitem_</string>
<string>user_object</string>
<string>order_module</string>
<string>sale_order</string>
<string>_getiter_</string>
<string>order_line</string>
<string>_getitem_</string>
<string>resource</string>
</tuple>
</value>
......
......@@ -68,7 +68,10 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>return value\n
<value> <string>""" This script is called once when a new shopping cart is to\n
be created for a customer. After that the result from this script \n
is stored in cache (\'erp5_session_cache\')."""\n
return []\n
</string> </value>
</item>
<item>
......@@ -85,7 +88,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>value</string> </value>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......@@ -113,14 +116,12 @@
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>value</string>
</tuple>
<tuple/>
</value>
</item>
</dictionary>
......@@ -136,11 +137,11 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Ecommerce_newShoppingCart</string> </value>
<value> <string>ERP5Ecommerce_createShoppingCart</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Create new shopping cart</string> </value>
<value> <string>Create new shopping cart object</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
......
......@@ -207,10 +207,9 @@
<value> <string>translateString = context.Base_translateString\n
shopping_cart_items = context.ERP5Ecommerce_getShoppingCartItemList()\n
shopping_cart = shopping_cart_items\n
order_line_id = int(field_my_order_line_id)\n
\n
if field_my_order_line_id is not None:\n
del shopping_cart_items[order_line_id]\n
del shopping_cart_items[int(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
......@@ -279,10 +278,9 @@ context.Base_redirect(\'SaleOrder_viewAsWeb\', \\\n
<string>translateString</string>
<string>shopping_cart_items</string>
<string>shopping_cart</string>
<string>int</string>
<string>order_line_id</string>
<string>None</string>
<string>_write_</string>
<string>int</string>
<string>portal_status_message</string>
<string>True</string>
<string>dict</string>
......
......@@ -60,9 +60,10 @@
<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
<th>Product</th>\n
<th>Quantity</th>\n
<th>Price</th>\n
<th>Total</th>\n
</thead>\n
<tbody> \n
<tal:block tal:repeat="order_line shopping_cart_items">\n
......@@ -70,8 +71,8 @@
quantity python: int(order_line[\'quantity\']);\n
price python: resource.getPrice();\n
order_line_id python: shopping_cart_items.index(order_line);\n
global currency python: here.restrictedTraverse(resource.getSupplyLinePriceCurrency()).getTitle()"> \n
<td>\n
currency python: here.restrictedTraverse(resource.getSupplyLinePriceCurrency()).getTitle()"> \n
<td align="right">\n
<a href="" tal:attributes="href resource/absolute_url">\n
<b tal:content="resource/getTitle"/> <br/>\n
<a tal:condition="not: confirm_mode"\n
......@@ -82,10 +83,7 @@
</a>\n
</a>\n
</td>\n
<td>\n
<span tal:replace="price"/> <span tal:replace="currency"/>\n
</td>\n
<td>\n
<td align="right">\n
<input tal:condition="not: confirm_mode"\n
type="input" \n
name="field_my_buy_quantity"\n
......@@ -93,19 +91,31 @@
tal:attributes ="value quantity"/>\n
<span tal:condition="confirm_mode" tal:content="quantity"/>\n
</td>\n
<td align="right">\n
<span tal:replace="price"/><br/><span tal:replace="currency"/>\n
</td>\n
<td align="right">\n
<span tal:replace="python: price*quantity"/><br/><span tal:replace="currency"/>\n
</td>\n
</tr>\n
</tal:block>\n
<tal:block tal:condition = "not: empty_cart">\n
<tr>\n
<td align="right"><br/>Sub total:</td>\n
<td></td>\n
<td></td>\n
<td align="right"> <br/>\n
<b><span tal:replace="python: here.ERP5Ecommerce_getShoppingCartTotalPrice(include_currency=True)"/>\n
</b>\n
</td>\n
</tr>\n
</tal:block>\n
\n
</tbody>\n
</table>\n
</form>\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
<br/>\n
</tal:block>\n
\n
</tal:block>
]]></string> </value>
......@@ -120,11 +130,11 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Ecommerce_renderSaleOrderAsShoppingCart</string> </value>
<value> <string>ERP5Ecommerce_editShoppingCartWidget</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Soppingcart content widget</string> </value>
<value> <string>Shopping cart edit content widget</string> </value>
</item>
</dictionary>
</pickle>
......
<?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>""" This script is called by external payment system.\n
Here you can check if payment was successfull or not."""\n
\n
\n
## TODO: implement payment check for CyberMut\n
\n
\n
## finalize order\n
\n
## redirect\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/>
</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_externalPaymentHandler</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>External online payment system handler</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -82,7 +82,7 @@ if session_id is None:\n
session_id = context.ERP5Ecommerce_generateSessionID(max_long=20)\n
request.RESPONSE.setCookie(\'session_id\', session_id, expires=(now +expire_timeout_days).fCommon(), path=\'/\')\n
\n
cache_method = CachingMethod(callable_object = context.ERP5Ecommerce_newShoppingCart, \\\n
cache_method = CachingMethod(callable_object = context.ERP5Ecommerce_createShoppingCart, \\\n
id = session_id, \\\n
cache_factory=cache_factory)\n
if action==\'reset\':\n
......@@ -90,12 +90,12 @@ if action==\'reset\':\n
cache_method.delete(id=session_id, cache_factory=cache_factory)\n
elif action==\'update\':\n
## update back to cache\n
pass\n
pass \n
#cache_method.delete(id=session_id, cache_factory=cache_factory)\n
#cache_method(value=new_shopping_cart)\n
else:\n
## take order for this session\n
shopping_cart = cache_method(value=[])\n
## take shopping cart for this customer\n
shopping_cart = cache_method()\n
return shopping_cart\n
</string> </value>
</item>
......@@ -177,7 +177,7 @@ else:\n
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Get Shopping Cart</string> </value>
<value> <string>Get shopping cart for customer</string> </value>
</item>
<item>
<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>__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 encoding="cdata"><![CDATA[
if context.portal_membership.isAnonymousUser():\n
return None\n
\n
user_id = context.portal_membership.getAuthenticatedMember().getId()\n
user_list = context.person_module.portal_catalog(reference=user_id, \\\n
portal_type="Person")\n
if len(user_list)>0:\n
user_object = user_list[0].getObject()\n
return user_object\n
else:\n
## not found\n
return None\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>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>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>_getattr_</string>
<string>context</string>
<string>None</string>
<string>user_id</string>
<string>user_list</string>
<string>len</string>
<string>_getitem_</string>
<string>user_object</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_getShoppingCartCustomer</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Get shopping cart customer object</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>return context.REQUEST.get(\'session_id\')\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>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>_getattr_</string>
<string>context</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_getShoppingCartId</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Get shopping cart id</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -85,7 +85,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
<value> <string></string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -111,7 +111,6 @@
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
</tuple>
......
......@@ -69,11 +69,18 @@
<item>
<key> <string>_body</string> </key>
<value> <string>total = 0.0\n
shopping_cart = context.ERP5Ecommerce_getShoppingCart()\n
for order_line in shopping_cart:\n
currency = \'\'\n
\n
shopping_cart_items = context.ERP5Ecommerce_getShoppingCartItemList()\n
for order_line in shopping_cart_items:\n
resource = context.restrictedTraverse(order_line[\'resource\'])\n
total += resource.getPrice() * order_line[\'quantity\']\n
return str(total)\n
currency = context.restrictedTraverse(resource.getSupplyLinePriceCurrency())\n
\n
if include_currency:\n
return \'%s %s\' %(total, currency.getTitle())\n
else:\n
return str(total)\n
</string> </value>
</item>
<item>
......@@ -90,7 +97,7 @@ return str(total)\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>include_currency = False</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......@@ -118,16 +125,18 @@ return str(total)\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>include_currency</string>
<string>total</string>
<string>currency</string>
<string>_getattr_</string>
<string>context</string>
<string>shopping_cart</string>
<string>shopping_cart_items</string>
<string>_getiter_</string>
<string>order_line</string>
<string>_getitem_</string>
......@@ -144,12 +153,14 @@ return str(total)\n
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Ecommerce_getTotalPriceForShoppingCart</string> </value>
<value> <string>ERP5Ecommerce_getShoppingCartTotalPrice</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -98,6 +98,7 @@ return len(user_list)==0\n
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
......
......@@ -82,11 +82,11 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Ecommerce_logged_in</string> </value>
<value> <string>ERP5Ecommerce_login</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Login Handler</string> </value>
<value> <string>Login handler</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -53,7 +53,7 @@
<tal:block tal:condition="isAnon">\n
<h4>You\'re not logged in.</h4>\n
I have an account:\n
<form action="">\n
<form action="ERP5Ecommerce_login">\n
<table>\n
<tr>\n
<td>Username:</td>\n
......@@ -66,7 +66,7 @@
<tr>\n
<td><input type="hidden" name="came_from" tal:attributes="value here/absolute_url"/>\n
<input type="hidden" name="__ac_persistent" value="1"/>\n
<input type="submit" value="Login" name="ERP5Ecommerce_logged_in:method"/>\n
<input type="submit" value="Login"/>\n
</td>\n
</tr>\n
</table>\n
......
<?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[
<tal:block tal:define="customer here/ERP5Ecommerce_getCustomer">\n
Person id: <span tal:content="customer/getId"/> <br/>\n
Name: <span tal:content="customer/getTitle"/> <br/>\n
\n
</tal:block>
]]></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_viewShoppingCartCustomerWidget</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Customer information widget</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -50,13 +50,13 @@
<tal:block tal:define="shopping_cart_items here/ERP5Ecommerce_getShoppingCartItemList;\n
empty_cart python: len(shopping_cart_items)==0;\n
website here/getWebSiteValue;">\n
website python: here.getWebSiteValue();">\n
\n
<ul tal:repeat="order_line shopping_cart_items">\n
<li tal:define="resource python: website.restrictedTraverse(order_line[\'resource\']);\n
quantity python: int(order_line[\'quantity\']);\n
price python: resource.getPrice();\n
global currency python: here.restrictedTraverse(resource.getSupplyLinePriceCurrency()).getTitle()"> \n
currency python: here.restrictedTraverse(resource.getSupplyLinePriceCurrency()).getTitle()"> \n
\n
<a href="" tal:attributes="href resource/absolute_url">\n
<b tal:content="resource/getTitle"/> \n
......@@ -70,9 +70,9 @@
\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><br/>\n
<b>Total price: <span tal:replace="python: here.ERP5Ecommerce_getShoppingCartTotalPrice(include_currency=True)"/> \n
</b>\n
<br/>\n
<a href="SaleOrder_viewAsWeb?editable_mode=1">Edit Shopping Cart</a><br/>\n
<a href="SaleOrder_confirmShopping?editable_mode=1">Proceed to checkout</a>\n
</tal:block>\n
......@@ -91,7 +91,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Ecommerce_shoppingCartWidget</string> </value>
<value> <string>ERP5Ecommerce_viewShoppingCartMiniWidget</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -136,7 +136,11 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Add to cart</string> </value>
<value> <string encoding="cdata"><![CDATA[
&nbsp;
]]></string> </value>
</item>
</dictionary>
</value>
......
......@@ -296,7 +296,7 @@ else:\n
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Confirm order</string> </value>
<value> <string>Redirect to appropriate form</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
......
......@@ -299,7 +299,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/ERP5Ecommerce_renderSaleOrderAsShoppingCart</string> </value>
<value> <string>here/ERP5Ecommerce_editShoppingCartWidget</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -158,7 +158,11 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Submit</string> </value>
<value> <string encoding="cdata"><![CDATA[
&nbsp;
]]></string> </value>
</item>
</dictionary>
</value>
......
......@@ -89,7 +89,8 @@
<value>
<list>
<string>shopping_cart</string>
<string>submit</string>
<string>customer_details</string>
<string>submit_payment</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Form.EditorField</string>
<string>EditorField</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>customer_details</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>line_too_long</string> </key>
<value> <string>A line was too long.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>You entered too many characters.</string> </value>
</item>
<item>
<key> <string>too_many_lines</string> </key>
<value> <string>You entered too many lines.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string>adminToolbox</string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>5</int> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Customer details</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>40</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.TALESField</string>
<string>TALESMethod</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/ERP5Ecommerce_viewShoppingCartCustomerWidget</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -299,7 +299,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.ERP5Ecommerce_renderSaleOrderAsShoppingCart(confirm_mode=1)</string> </value>
<value> <string>python: here.ERP5Ecommerce_editShoppingCartWidget(confirm_mode=1)</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -4,8 +4,8 @@
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Form.InputButtonField</string>
<string>InputButtonField</string>
<string>Products.Formulator.StandardFields</string>
<string>LabelField</string>
</tuple>
<none/>
</tuple>
......@@ -14,7 +14,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>submit</string> </value>
<value> <string>submit_payment</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -26,10 +26,6 @@
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
......@@ -58,10 +54,6 @@
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
......@@ -73,17 +65,15 @@
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -105,10 +95,6 @@
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
......@@ -120,17 +106,13 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string>hiddenLabel</string> </value>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string>Buy</string> </value>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -152,10 +134,6 @@
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>SaleOrder_finalizeShopping:method</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Submit</string> </value>
......@@ -166,4 +144,23 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.TALESField</string>
<string>TALESMethod</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/ERP5Ecommerce_CreerFormulaireCM</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
14
\ No newline at end of file
26
\ 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