Commit 7b5c1e9d authored by Aurel's avatar Aurel

2006-08-9 aurel

* fix script that check counter is opened and comment useless log to prevent security problem

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9095 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5ab4b81c
......@@ -93,7 +93,7 @@ if resource is None :\n
\n
# Next, check the balance of the account\n
account_balance = resource.getFutureInventory(payment=payment, src__=src__)\n
context.log("account balance",account_balance)\n
#context.log("account balance",account_balance)\n
if src__ :\n
return account_balance \n
\n
......
......@@ -359,7 +359,7 @@
</item>
<item>
<key> <string>base_category</string> </key>
<value> <string>source_payment</string> </value>
<value> <string>destination_payment</string> </value>
</item>
<item>
<key> <string>catalog_index</string> </key>
......@@ -381,7 +381,9 @@
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
<value>
<list/>
</value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -441,6 +443,14 @@
<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>parameter_list</string> </key>
<value>
......
......@@ -86,11 +86,11 @@ if site is None:\n
site = site_list[0]\n
\n
# get only the office, not need of vault\n
context.log(\'Baobab_checkCounterDateOpen\', \'get site for vault %s\' %(site))\n
#context.log(\'Baobab_checkCounterDateOpen\', \'get site for vault %s\' %(site))\n
site = context.Baobab_getVaultSite(site)\n
\n
kw = {"portal_type" : \'Counter Date\', "delivery.start_date" : str(date), "site_id" : site.getId(), "simulation_state" : "open"}\n
context.log(\'Baobab_checkCounterDateOpen\', \'kw = %s\' %(kw,))\n
#context.log(\'Baobab_checkCounterDateOpen\', \'kw = %s\' %(kw,))\n
counter_date_list = [x.getObject() for x in context.portal_catalog(**kw)]\n
#context.log(\'Baobab_checkCounterDateOpen\', \'counter_date_list = %s, requete = %s\' %(counter_date_list, context.portal_catalog(src__=1, **kw)))\n
\n
......
......@@ -71,8 +71,8 @@
<value> <string>site = context.Baobab_getVaultSite(counter)\n
counter_list = [x.getObject() for x in context.portal_catalog(portal_type="Counter", simulation_state = \'open\', site_uid = site.getUid())]\n
for counter_ob in counter_list:\n
context.log(counter.getRelativeUrl(), counter_ob.getSite())\n
if counter_ob.getSite() in counter.getRelativeUrl() or counter.getRelativeUrl() in counter_ob.getSite():\n
# context.log(counter.getRelativeUrl(), counter_ob.getSite())\n
if "site/%" %counter_ob.getSite() in counter.getRelativeUrl() or counter.getRelativeUrl() in "site/%" %counter_ob.getSite():\n
return 1\n
else:\n
return 0\n
......
......@@ -77,7 +77,7 @@ class Number:\n
80:\'quatre vingt\',100:\'cent\',1000:\'mille\',1000000:\'million\',1000000000:\'milliard\'}\n
\n
def MinusHumdred(self,MyNumber):\n
context.log(\'MinusHumdred\', MyNumber)\n
#context.log(\'MinusHumdred\', MyNumber)\n
if MyNumber == 0:\n
return \'\'\n
elif MyNumber in self.DIC:\n
......
......@@ -70,6 +70,7 @@
<key> <string>_body</string> </key>
<value> <string># in this script you must return the default value of the account for this site\n
# this must correspond to the relative url of the default account\n
\n
return \'\'\n
</string> </value>
</item>
......
......@@ -78,7 +78,7 @@ else:\n
persons = context.acl_users.erp5_users.getUserByLogin(login)\n
\n
if len(persons) == 0:\n
context.log(\'Baobab_getUserAssignementList\', \'Person %s not found\' %(login))\n
#context.log(\'Baobab_getUserAssignementList\', \'Person %s not found\' %(login))\n
return []\n
else:\n
#person = persons[0].getObject()\n
......
......@@ -86,7 +86,7 @@ if len(user_site_list) > 0:\n
for a in user_site_list:\n
if not a.startswith(\'site\'):\n
a = \'site/\' + a\n
context.log("a", a)\n
#context.log("a", a)\n
site_codification = context.portal_categories.getCategoryValue(a).getCodification()\n
if site_codification not in (\'\', None):\n
emission_letter_dict[site_codification[0].lower()] = 1\n
......
......@@ -74,7 +74,7 @@ site = vault\n
if same_type(site, \'\'):\n
site = context.restrictedTraverse(\'portal_categories/site/%s\' %(site,))\n
\n
context.log(\'site\', site)\n
#context.log(\'site\', site)\n
while True:\n
if not hasattr(site, \'getVaultTypeList\'):\n
msg = Message(domain = \'ui\', message = \'The site value is misconfigured; report this to system administrators.\')\n
......
......@@ -83,8 +83,8 @@ requested_dict = {}\n
\n
# test all movement\n
tmp_list = context.contentValues(filter={\'portal_type\': portal_type})\n
context.log(\'tmp_list\', str((tmp_list, portal_type, context)))\n
context.log(\'source\',source)\n
#context.log(\'tmp_list\', str((tmp_list, portal_type, context)))\n
#context.log(\'source\',source)\n
line_list = []\n
for l in tmp_list :\n
# The source can be different for every line (due to getBaobabSource approach)\n
......@@ -96,7 +96,7 @@ for l in tmp_list :\n
line_list.append(l)\n
except (AttributeError, KeyError):\n
pass\n
context.log("line list", line_list)\n
#context.log("line list", line_list)\n
if len(line_list) == 0 :\n
# no resource\n
return 2\n
......@@ -108,11 +108,11 @@ for line in line_list :\n
if line.hasCellContent() :\n
for cell in line.objectValues() :\n
variation_text = cell.getVariationText()\n
context.log(\'check cell : \', str((source_counter, line_resource, variation_text)))\n
#context.log(\'check cell : \', str((source_counter, line_resource, variation_text)))\n
inventory_value = context.portal_simulation.getFutureInventory(node=source_counter, resource = line_resource,\n
variation_text = variation_text)\n
context.log(\'cell quantity\', cell.getQuantity())\n
context.log(\'inventory value\', inventory_value)\n
#context.log(\'cell quantity\', cell.getQuantity())\n
#context.log(\'inventory value\', inventory_value)\n
if inventory_value - cell.getQuantity() < 0:\n
return 1\n
\n
......@@ -186,7 +186,6 @@ return 0\n
<string>_getattr_</string>
<string>context</string>
<string>tmp_list</string>
<string>str</string>
<string>line_list</string>
<string>_getiter_</string>
<string>l</string>
......
......@@ -208,6 +208,7 @@ if listbox is None:\n
if cash_delivery_line is not None:\n
# If a line exists for this cash currency, add lines into the listbox according to\n
# the currency information.\n
#context.log("cash_delivery_line", "cash_delivery_line = %s, currency = %s, type = %s" %(cash_delivery_line, currency_cash, line_portal_type))\n
currency_dict = None\n
resource_price = currency_cash.getBasePrice()\n
\n
......@@ -218,6 +219,7 @@ if listbox is None:\n
category2 = cell.getProperty(axis_dict[\'line2\'])\n
column_category = cell.getProperty(axis_dict[\'column\'])\n
key = (category1, category2)\n
#context.log(str((key, axis_dict[\'column\'], column_category, cell.getVariation())), cell)\n
cell_dict_dict.setdefault(key, {})[column_category] = cell\n
\n
# Sort the keys to obtain a consistent behavior.\n
......@@ -231,6 +233,7 @@ if listbox is None:\n
currency_dict = None\n
for counter, column in enumerate(axis_list_dict[\'column\']):\n
cell = cell_dict.get(column, None)\n
#context.log("Cashdelivery_...", "cell = %s, column = %s"%(cell, column))\n
if cell is None:\n
continue\n
\n
......@@ -252,7 +255,7 @@ if listbox is None:\n
\n
currency_dict[\'column%d\' % (counter + 1)] = quantity\n
total_quantity += quantity\n
\n
#context.log("currency_dict", currency_dict)\n
if currency_dict is not None:\n
price = total_quantity * resource_price\n
currency_dict[\'price\'] = price\n
......
......@@ -96,6 +96,7 @@ per_resource_dict = {}\n
\n
# remove previous line\n
old_line = [x.getObject() for x in context.searchFolder(portal_type=[line_portal_type,])]\n
#context.log("will erease old line", old_line)\n
if len(old_line)>0:\n
for object_list in old_line:\n
context.deleteContent(object_list.getId())\n
......@@ -105,7 +106,7 @@ for line in listbox:\n
for counter in xrange(1, len(column_base_list)+1):\n
quantity = line["column%s" %(str(counter),)]\n
if quantity != 0:\n
context.log("listboxline", line)\n
#context.log("listboxline", line)\n
movement = {}\n
movement[\'quantity\'] = quantity\n
# get variation for the cell\n
......@@ -151,7 +152,7 @@ for line in listbox:\n
else:\n
movement[\'emission_letter\'] = "emission_letter/not_defined"\n
movement[\'variation\'] = "variation/%s" %variation_list[counter-1]\n
context.log("movement", movement)\n
#context.log("movement", movement)\n
# generate a key based on variation\n
# this will allow us to check if there is multiple line for the same resource + variation\n
movement_key = \'%s_%s_%s\' %(movement[\'cash_status\'], movement[\'emission_letter\'], movement[\'variation\'])\n
......@@ -173,7 +174,7 @@ for resource_id in per_resource_dict.keys():\n
# get the resource\n
resource_list = context.portal_catalog(portal_type = (\'Banknote\',\'Coin\'), id = resource_id)\n
if len(resource_list) == 0:\n
context.log(\'CashDetail_saveFastInputLine\', \'Cannot get the resource object for id = %s\' %(resource_id,))\n
#context.log(\'CashDetail_saveFastInputLine\', \'Cannot get the resource object for id = %s\' %(resource_id,))\n
continue\n
resource_object = resource_list[0].getObject()\n
# get the variation\n
......
......@@ -70,7 +70,7 @@
<key> <string>_body</string> </key>
<value> <string>context.edit(quantity_unit = \'unit\',\n
quantity = 1)\n
context.log(\'CheckOperationLine_init\', \'quantity = %s\' %(context.getQuantity()))\n
#context.log(\'CheckOperationLine_init\', \'quantity = %s\' %(context.getQuantity()))\n
</string> </value>
</item>
<item>
......
......@@ -183,11 +183,11 @@ elif import_type == \'assign_codification\' :\n
category = context.portal_categories.getCategoryValue(lowerCase(e_list[0]))\n
category.setCodification(e_list[1])\n
# Automatically assign code for some subcategories\n
context.log(\'e_list[0]\',e_list[0])\n
#context.log(\'e_list[0]\',e_list[0])\n
if e_list[0].startswith(\'site\'):\n
acquired_vault_code = {\'banque_interne\':\'BI\',\'operations_diverses\':\'OD\',\'gros_paiement\':\'GP\',\'gros_versement\':\'GV\',\n
\'guichet_1\':\'G1\',\'guichet_2\':\'G2\',\'guichet_3\':\'G3\'}\n
context.log(\'category\',category.getPath())\n
#context.log(\'category\',category.getPath())\n
for sub_cat in category.getCategoryChildValueList(sort_id=\'path\'):\n
print " %s" % sub_cat.getRelativeUrl()\n
if sub_cat.getId() in acquired_vault_code.keys():\n
......
2006-07-18 aurel
* add and modify some script for checking counter and counter date
2006-07-15 Seb
* added check book model module
2006-07-03 aurel
* update generic fast input script
2006-06-26 Seb
* Fixed display of inventory lines
2006-06-16 seb
* Added work done by Aurelien on fast input
* Some minor changes
2006-06-02 aurel
* add vault type base category to category
2006-08-9 aurel
* fix script that check counter is opened and comment useless log to prevent security problem
2006-05-18 aurel
* update Delivery_getVaultItemList to take new categories into account and fix Baobab_getResourceVintageList
......
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