From 674e3355da27f7df61f10e1671fc486cf61d6fa6 Mon Sep 17 00:00:00 2001
From: Mame Coumba Sall <mame@nexedi.com>
Date: Wed, 27 Jan 2010 12:04:23 +0000
Subject: [PATCH] Rename script that verifies if the user has the permission to
 modify content

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32016 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...xml => Base_userHasModidyPortalContentPermission.xml} | 9 +++++++--
 .../erp5_banking_core/CurrencyPurchase_getQuantity.xml   | 4 +++-
 bt5/erp5_banking_core/bt/revision                        | 2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)
 rename bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/{Base_getAssignorId.xml => Base_userHasModidyPortalContentPermission.xml} (94%)

diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getAssignorId.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_userHasModidyPortalContentPermission.xml
similarity index 94%
rename from bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getAssignorId.xml
rename to bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_userHasModidyPortalContentPermission.xml
index 528a026cb6..52a1513d2a 100644
--- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getAssignorId.xml
+++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_userHasModidyPortalContentPermission.xml
@@ -53,7 +53,12 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>from AccessControl import getSecurityManager\n
+            <value> <string>"""\n
+This script is used to determine if the user\n
+has the permission "Modify portal content",\n
+in the context\n
+"""\n
+from AccessControl import getSecurityManager\n
 u=getSecurityManager().getUser()\n
 if u.has_permission("Modify portal content",context):\n
   return True\n
@@ -126,7 +131,7 @@ else:\n
         </item>
         <item>
             <key> <string>id</string> </key>
-            <value> <string>Base_getAssignorId</string> </value>
+            <value> <string>Base_userHasModidyPortalContentPermission</string> </value>
         </item>
         <item>
             <key> <string>warnings</string> </key>
diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CurrencyPurchase_getQuantity.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CurrencyPurchase_getQuantity.xml
index 4c30248808..51e21a9281 100644
--- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CurrencyPurchase_getQuantity.xml
+++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CurrencyPurchase_getQuantity.xml
@@ -77,7 +77,9 @@ if commission_price is not None:\n
 quantity = price - commission_value\n
 quantity = round(quantity,0)\n
 if quantity!=context.getQuantity():\n
-  if context.Base_getAssignorId()==False and context.getQuantity() is not None:\n
+  #verify that when the quantity is already calculated by another user,it does not need\n
+  # to be calculated again, just return the value already calculated \n
+  if context.Base_userHasModidyPortalContentPermission()==False and context.getQuantity() is not None:\n
     return quantity\n
   else:\n
     context.setQuantity(quantity)\n
diff --git a/bt5/erp5_banking_core/bt/revision b/bt5/erp5_banking_core/bt/revision
index 3c2af958d8..19afd4ebd9 100644
--- a/bt5/erp5_banking_core/bt/revision
+++ b/bt5/erp5_banking_core/bt/revision
@@ -1 +1 @@
-526
\ No newline at end of file
+527
\ No newline at end of file
-- 
2.30.9