Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kasra Jamshidi
erp5
Commits
bef3c525
Commit
bef3c525
authored
May 04, 2012
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use Ticket_getResourceItemList to avoid code duplication.
parent
beed75df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
35 deletions
+2
-35
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_getResourceItemList.xml
...eItem/portal_skins/erp5_crm/Event_getResourceItemList.xml
+1
-34
bt5/erp5_crm/bt/revision
bt5/erp5_crm/bt/revision
+1
-1
No files found.
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_getResourceItemList.xml
View file @
bef3c525
...
@@ -55,40 +55,7 @@ This script returns the list of items based on the preferred\n
...
@@ -55,40 +55,7 @@ This script returns the list of items based on the preferred\n
resources for events. It is intended to be used\n
resources for events. It is intended to be used\n
by ListField instances.\n
by ListField instances.\n
"""\n
"""\n
from zExceptions import Unauthorized\n
return context.Ticket_getResourceItemList(portal_type=\'Event\')\n
from Products.ERP5Type.Cache import CachingMethod\n
portal = context.getPortalObject()\n
\n
sql_kw = {\'portal_type\': portal.getPortalResourceTypeList(),\n
\'use_uid\': portal.portal_categories.getCategoryUid(portal.portal_preferences.getPreferredEventUse(), base_category=\'use\'),\n
\'validation_state\': \'validated\',\n
\'sort_on\': \'title\'}\n
\n
def getResourceItemList():\n
return [(\'\', \'\')] + [(result.getTitle(), result.getRelativeUrl()) for result in portal.portal_catalog(**sql_kw)]\n
\n
getResourceItemList = CachingMethod(getResourceItemList, \n
id=(script.id, context.Localizer.get_selected_language()), \n
cache_factory=\'erp5_ui_long\')\n
\n
result_list = getResourceItemList()[:]\n
\n
# BBB returns actual value in list field\n
if context.getResource() and context.getResource() not in [result[1] for result in result_list]:\n
try:\n
resource_value = portal.portal_categories.getCategoryValue(context.getResource(), base_category=\'resource\')\n
if resource_value is not None:\n
if resource_value.getPortalType() == \'Category\':\n
category_relative_url = resource_value.getCategoryRelativeUrl()\n
category_title = resource_value.getTranslatedTitle()\n
else:\n
category_relative_url = resource_value.getRelativeUrl()\n
category_title = resource_value.getTitle()\n
result_list.append((category_title, category_relative_url))\n
except Unauthorized:\n
pass\n
\n
return result_list\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
...
bt5/erp5_crm/bt/revision
View file @
bef3c525
595
596
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment