Commit f85280ef authored by Rafael Monnerat's avatar Rafael Monnerat

Refactor RSS feeds to use getMovementHistoryList

See merge request nexedi/slapos.core!428
parents 94f0d133 a632de99
......@@ -73,7 +73,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/ComputeNode_viewRelatedSupportRequest</string> </value>
<value> <string>string:${object_url}/ComputeNode_viewTicketRelatedList</string> </value>
</item>
</dictionary>
</pickle>
......
"""
Keep a custom script for permit render other times of documents, ie.: Software Installation.
"""
from Products.ZSQLCatalog.SQLCatalog import ComplexQuery, SimpleQuery
portal = context.getPortalObject()
query = ComplexQuery(
ComplexQuery(
SimpleQuery(portal_type="Support Request"),
SimpleQuery(default_aggregate_uid=context.getUid()),
logical_operator='and'),
ComplexQuery(
SimpleQuery(portal_type="Upgrade Decision Line"),
SimpleQuery(default_aggregate_uid=context.getUid()),
logical_operator='and'),
logical_operator='or')
kw['portal_type'] = ["Support Request", "Upgrade Decision"]
if 'default_or_child_aggregate_uid' not in kw:
kw['default_or_child_aggregate_uid'] = context.getUid()
kw['sort_on'] = (('modification_date', 'DESC'),)
if 'simulation_state' not in kw:
kw['simulation_state'] = "NOT cancelled"
kw['simulation_state'] = ['validated','submitted', 'suspended', 'invalidated',
# Unfortunally Upgrade decision uses diferent states.
'confirmed', 'started', 'stopped', 'delivered']
if 'limit' not in kw:
kw['limit'] = 30
result_list = []
for document in portal.portal_catalog(query=query, **kw):
if document.getPortalType() == "Upgrade Decision Line":
if document.getParentValue().getSimulationState() != 'cancelled':
result_list.append(document.getParentValue())
continue
result_list.append(document)
return result_list
return portal.portal_catalog(**kw)
portal = context.getPortalObject()
uid_list = [context.getUid()]
for instance in portal.portal_catalog(
portal_type="Software Instance",
default_aggregate_uid=[cp.uid for cp in context.searchFolder(portal_type="Compute Partition")]):
uid_list.append(instance.getSpecialiseUid(portal_type="Instance Tree"))
return portal.portal_catalog(
portal_type='Support Request',
default_aggregate_uid=uid_list,
**kw)
"""
Get all related tickets from the computer and everything that was allocated
on it.
"""
portal = context.getPortalObject()
uid_list = [context.getUid()]
computer_partition_uid_list = [
cp.getUid() for cp in context.contentValues(portal_type="Compute Partition") if cp.getSlapState() == 'busy']
if computer_partition_uid_list:
for instance in portal.portal_catalog(
portal_type="Software Instance",
select_dict={'specialise_uid': None},
specialise_portal_type="Instance Tree",
default_aggregate_uid=computer_partition_uid_list):
if instance.specialise_uid not in uid_list:
uid_list.append(instance.specialise_uid)
kw['default_or_child_aggregate_uid'] = uid_list
return context.Base_getOpenRelatedTicketList(**kw)
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_getUserTicketList</string> </value>
<value> <string>ComputeNode_getTicketRelatedList</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -37,6 +37,10 @@
<key> <string>action</string> </key>
<value> <string>Base_edit</string> </value>
</item>
<item>
<key> <string>action_title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
......@@ -105,7 +109,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComputeNode_viewRelatedSupportRequest</string> </value>
<value> <string>ComputeNode_viewTicketRelatedList</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......@@ -113,7 +117,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>WebSection_viewMonitoringSupportRequestList</string> </value>
<value> <string>ComputeNode_viewTicketRelatedList</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......@@ -129,7 +133,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View Monitoring Support Request List</string> </value>
<value> <string>Related Tickets</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
......
......@@ -122,6 +122,10 @@
<string>title</string>
<string>Title</string>
</tuple>
<tuple>
<string>portal_type</string>
<string>Portal Type</string>
</tuple>
<tuple>
<string>resource_title</string>
<string>Type</string>
......@@ -227,7 +231,7 @@
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>ComputeNode_getRelatedSupportRequestList</string> </value>
<value> <string>ComputeNode_getTicketRelatedList</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -10,12 +10,13 @@ from DateTime import DateTime
if context.getSimulationState() == "invalidated":
return "Closed Ticket"
document = context.getAggregateValue()
if context.getPortalType() != "Support Request":
return "Not a Support Request"
document = context.getAggregateValue()
if document is None:
return True
aggregate_portal_type = document.getPortalType()
if aggregate_portal_type == "Compute Node":
if document.getMonitorScope() == "disabled":
......
......@@ -196,11 +196,10 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template):
'slapos_consumption/InstanceTree_getResourceConsumptionDetailList',
'slapos_consumption/InstanceTree_getStatForResource',
'slapos_consumption/SaleInvoiceTransaction_generateResourceConsumptionDocument',
'slapos_consumption/SoftwareInstance_getLatestCPUPercentLoad',
'slapos_consumption/SoftwareInstance_getAverageCPULoad',
'slapos_consumption/SoftwareInstance_getLatestCPUPercentLoad',
'slapos_consumption/SoftwareRelease_getAverageConsumedCPULoad',
'slapos_consumption/SoftwareRelease_getAverageConsumedMemory',
'slapos_consumption/SoftwareRelease_updateCapacityQuantity',
'slapos_wechat/Base_queryWechatOrderStatusByTradeNo',
'slapos_wechat/ERP5Site_receiveWechatPaymentCallback',
'slapos_wechat/PaymentTransaction_redirectToWechatPayment',
......@@ -213,18 +212,12 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template):
'slapos_upgrader/ERP5Site_upgradeERP5CoreBusinessTemplate',
'slapos_upgrader/ERP5Site_upgradeSlapOSTestUICoreBusinessTemplate',
'slapos_upgrader/ERP5Site_upgradeUpgraderBusinessTemplate',
'slapos_rss_style/Base_getTicketUrl',
'slapos_rss_style/SaleInvoiceTransaction_getRSSDescription',
'slapos_rss_style/SaleInvoiceTransaction_getRSSTitle',
'slapos_rss_style/Ticket_getRSSGuid',
'slapos_rss_style/SubscriptionRequest_getRSSDescription',
'slapos_rss_style/WebSection_getLegacyMessageList',
'slapos_rss_style/WebSection_getUserCriticalTicketList',
'slapos_rss_style/WebSection_getUserTicketList',
'slapos_subscription_request/Person_applyContractInvitation',
'slapos_subscription_request/SubscriptionRequestModule_notifyActiveSubscriberList',
'slapos_subscription_request/SubscriptionRequest_checkRelatedAccounting',
'slapos_subscription_request/SubscriptionRequest_generateReservationRefoundSalePackingList',
'slapos_subscription_request/SubscriptionRequest_getRSSDescription',
'slapos_subscription_request/SubscriptionRequest_getRelatedAccountingTransactionList',
'slapos_subscription_request/SubscriptionRequest_notifyPaymentIsReady',
'slapos_subscription_request/SubscriptionRequest_processStopped',
......
catalog.uid = <dtml-var table_0>.uid
-- follow up
AND <dtml-var table_0>.base_category_uid = <dtml-var "portal_categories.follow_up.getUid()">
AND ((<dtml-var table_1>.parent_uid = <dtml-var table_0>.category_uid AND <dtml-var table_2>.uid = <dtml-var table_1>.uid)
OR <dtml-var table_1>.uid = <dtml-var table_0>.category_uid AND <dtml-var table_2>.uid = <dtml-var table_1>.uid)
-- aggregate
AND <dtml-var table_2>.base_category_uid = <dtml-var "portal_categories.aggregate.getUid()">
AND <dtml-var table_2>.category_uid = <dtml-var table_3>.uid
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="SQL Method" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>allow_simple_one_argument_traversal</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>table_0\n
table_1\n
table_2\n
table_3</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>class_file_</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>class_name_</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>connection_hook</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_related_follow_up_default_or_child_aggregate</string> </value>
</item>
<item>
<key> <string>max_cache_</string> </key>
<value> <int>100</int> </value>
</item>
<item>
<key> <string>max_rows_</string> </key>
<value> <int>1000</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>SQL Method</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>z_related_follow_up_default_or_child_aggregate</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -2,5 +2,6 @@
<key>causality_subscription_request_related_uid | category,catalog/uid/z_related_causality_subscription_request</key>
<key>default_or_child_aggregate_reference | catalog,category,catalog/reference/z_related_default_or_child_aggregate</key>
<key>default_or_child_aggregate_uid | catalog,category,catalog/uid/z_related_default_or_child_aggregate</key>
<key>follow_up_default_or_child_aggregate_uid | category,catalog,category,catalog/uid/z_related_follow_up_default_or_child_aggregate</key>
<key>related_successor_but_with_different_title_than_catalog_title | category,catalog/uid/z_related_successor_but_with_different_title_than_catalog_title</key>
</key_list>
\ No newline at end of file
......@@ -22,4 +22,5 @@ erp5_mysql_innodb/z_create_slapos_item
erp5_mysql_innodb/z_create_software_instance_tree
erp5_mysql_innodb/z_related_causality_subscription_request
erp5_mysql_innodb/z_related_default_or_child_aggregate
erp5_mysql_innodb/z_related_follow_up_default_or_child_aggregate
erp5_mysql_innodb/z_related_successor_but_with_different_title_than_catalog_title
\ No newline at end of file
causality_subscription_request_related_uid | category,catalog/uid/z_related_causality_subscription_request
related_successor_but_with_different_title_than_catalog_title | category,catalog/uid/z_related_successor_but_with_different_title_than_catalog_title
default_or_child_aggregate_reference | catalog,category,catalog/reference/z_related_default_or_child_aggregate
default_or_child_aggregate_uid | catalog,category,catalog/uid/z_related_default_or_child_aggregate
\ No newline at end of file
default_or_child_aggregate_uid | catalog,category,catalog/uid/z_related_default_or_child_aggregate
follow_up_default_or_child_aggregate_uid | category,catalog,category,catalog/uid/z_related_follow_up_default_or_child_aggregate
\ No newline at end of file
"""Returns all ticket related events for RSS
"""
from Products.PythonScripts.standard import Object
portal = context.getPortalObject()
# for safety, we limit at 100 lines
list_lines = min(list_lines, 100)
getTicket_memo = {}
def getTicketInfo(event):
follow_up = event.getFollowUp()
try:
return getTicket_memo[follow_up]
except KeyError:
ticket = portal.restrictedTraverse(follow_up, None)
if ticket is None:
# For corner cases where user has an event for which he cannot access the ticket,
# we don't raise error so that others events are visible.
return event.getTitle(), '', ''
getTicket_memo[follow_up] = (
ticket.getTitle(),
ticket.getResourceTranslatedTitle() or '',
ticket.Base_getTicketUrl(),
)
return getTicket_memo[follow_up]
if follow_up_portal_type is None:
follow_up_portal_type = ['Support Request', 'Regularisation Request', 'Upgrade Decision']
context_kw = {}
if context_related:
context_kw['follow_up_default_or_child_aggregate_uid'] = context.getUid()
data_list = []
for brain in portal.portal_simulation.getMovementHistoryList(
security_query=portal.portal_catalog.getSecurityQuery(),
# Limit only to listable portal types
portal_type=['Web Message', 'Mail Nessage'],
follow_up_simulation_state = ['validated','submitted', 'suspended', 'invalidated',
# Unfortunally Upgrade decision uses diferent states.
'confirmed', 'started', 'stopped', 'delivered'],
only_accountable=False,
follow_up_portal_type=follow_up_portal_type,
omit_input=True,
simulation_state=('started', 'stopped', 'delivered'),
limit=list_lines,
sort_on=(('stock.date', 'desc'),
('uid', 'desc')),
**context_kw):
event = brain.getObject()
(ticket_title,
ticket_category,
ticket_link) = getTicketInfo(event)
data_list.append(
Object(**{
'title': ticket_title,
'category': ticket_category,
'author': brain.node_title,
'link': ticket_link,
'description': event.getTextContent(),
'pubDate': brain.date,
'guid': '{}-{}'.format(
event.getFollowUp(),
event.getRelativeUrl()),
'thumbnail': ( None)
})
)
return data_list
......@@ -50,11 +50,11 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>list_lines=50, follow_up_portal_type=None, context_related=False, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Ticket_getRSSGuid</string> </value>
<value> <string>Base_getEventList</string> </value>
</item>
</dictionary>
</pickle>
......
return context.Base_getEventList(
list_lines=list_lines,
follow_up_portal_type=['Support Request', 'Upgrade Decision'],
context_related=True, **kw)
......@@ -50,11 +50,11 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
<value> <string>list_lines=50, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComputeNode_getRelatedSupportRequestList</string> </value>
<value> <string>Base_getTicketRelatedEventList</string> </value>
</item>
</dictionary>
</pickle>
......
portal = context.getPortalObject()
return portal.absolute_url() + "/#/" + context.getRelativeUrl()
web_site = context.getWebSiteValue()
if not web_site:
web_site = context.getPortalObject()
return web_site.absolute_url() + "/#/" + context.getRelativeUrl()
......@@ -37,6 +37,10 @@
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>action_title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
......@@ -79,11 +83,7 @@
<item>
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_modification_date</string>
<string>listbox_title</string>
<string>listbox_description</string>
</list>
<list/>
</value>
</item>
</dictionary>
......@@ -99,7 +99,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>WebSection_viewRssFeedRender</string> </value>
<value> <string>ComputeNode_view</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......@@ -115,7 +115,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View user rss feed list</string> </value>
<value> <string>Ticket List</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
......
......@@ -128,11 +128,11 @@
<string>Title</string>
</tuple>
<tuple>
<string>Ticket_getRSSGuid</string>
<string>guid</string>
<string>guid</string>
</tuple>
<tuple>
<string>modification_date</string>
<string>pubDate</string>
<string>pubDate</string>
</tuple>
<tuple>
......@@ -140,8 +140,16 @@
<string>Description</string>
</tuple>
<tuple>
<string>Base_getTicketUrl</string>
<string>link</string>
<string>link</string>
</tuple>
<tuple>
<string>author</string>
<string>author</string>
</tuple>
<tuple>
<string>thumbnail</string>
<string>thumbnail</string>
</tuple>
</list>
</value>
......@@ -159,20 +167,7 @@
<item>
<key> <string>editable_columns</string> </key>
<value>
<list>
<tuple>
<string>title</string>
<string>Title</string>
</tuple>
<tuple>
<string>modification_date</string>
<string>modification_date</string>
</tuple>
<tuple>
<string>description</string>
<string>description</string>
</tuple>
</list>
<list/>
</value>
</item>
<item>
......@@ -251,7 +246,7 @@
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>Base_getOpenRelatedTicketList</string> </value>
<value> <string>WebSection_getUserTicketList</string> </value>
</item>
</dictionary>
</pickle>
......
"""
Include information of the sender/recipient to clarify.
"""
return """
Sender: %s
Recipient: %s
Content:
%s
""" % (context.getSourceTitle(""),
",".join(context.getDestinationTitleList()),
context.getTextContent())
kw['simulation_state'] = ['validated','submitted', 'suspended', 'invalidated',
# Unfortunally Upgrade decision uses diferent states.
'confirmed', 'delivered']
kw['sort_on'] = [('modification_date', 'DESC'),]
return context.searchFolder(**kw)
return context.Base_getEventList(
list_lines=list_lines,
follow_up_portal_type=context.getVisibleAllowedContentTypeList(),
context_related=False, **kw)
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
<value> <string>list_lines=50, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -37,6 +37,10 @@
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>action_title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
......@@ -79,11 +83,7 @@
<item>
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_modification_date</string>
<string>listbox_title</string>
<string>listbox_description</string>
</list>
<list/>
</value>
</item>
</dictionary>
......@@ -99,7 +99,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>WebSection_viewMonitoringSupportRequestList</string> </value>
<value> <string>Folder_viewOpenTicketList</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......@@ -115,7 +115,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View Monitoring Support Request List</string> </value>
<value> <string>RSS Feed</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
......
......@@ -90,9 +90,7 @@
</item>
<item>
<key> <string>lines</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
<value> <string></string> </value>
</item>
<item>
<key> <string>list_method</string> </key>
......@@ -101,7 +99,7 @@
<item>
<key> <string>selection_name</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
......@@ -125,15 +123,31 @@
<list>
<tuple>
<string>title</string>
<string>Title</string>
<string>title</string>
</tuple>
<tuple>
<string>modification_date</string>
<string>guid</string>
<string>guid</string>
</tuple>
<tuple>
<string>pubDate</string>
<string>pubDate</string>
</tuple>
<tuple>
<string>description</string>
<string>Description</string>
<string>summary</string>
</tuple>
<tuple>
<string>link</string>
<string>link</string>
</tuple>
<tuple>
<string>author</string>
<string>author</string>
</tuple>
<tuple>
<string>thumbnail</string>
<string>thumbnail</string>
</tuple>
</list>
</value>
......@@ -181,12 +195,12 @@
</item>
<item>
<key> <string>lines</string> </key>
<value> <int>20</int> </value>
<value> <int>50</int> </value>
</item>
<item>
<key> <string>list_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
......@@ -210,19 +224,6 @@
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: int(here.REQUEST.get(\'size\', preferences.getPreference(\'preferred_listbox_list_mode_line_count\', 30)))</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
......@@ -235,7 +236,7 @@
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Method" module="Products.Formulator.MethodField"/>
</pickle>
......
......@@ -37,6 +37,10 @@
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>action_title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
......@@ -79,11 +83,7 @@
<item>
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_modification_date</string>
<string>listbox_title</string>
<string>listbox_description</string>
</list>
<list/>
</value>
</item>
</dictionary>
......@@ -99,7 +99,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>WebSection_viewRssFeedRender</string> </value>
<value> <string>InstanceTree_view</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......@@ -115,7 +115,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View user rss feed list</string> </value>
<value> <string>Ticket List</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
......
......@@ -128,11 +128,11 @@
<string>Title</string>
</tuple>
<tuple>
<string>Ticket_getRSSGuid</string>
<string>guid</string>
<string>guid</string>
</tuple>
<tuple>
<string>modification_date</string>
<string>pubDate</string>
<string>pubDate</string>
</tuple>
<tuple>
......@@ -140,8 +140,16 @@
<string>Description</string>
</tuple>
<tuple>
<string>Base_getTicketUrl</string>
<string>link</string>
<string>link</string>
</tuple>
<tuple>
<string>author</string>
<string>author</string>
</tuple>
<tuple>
<string>thumbnail</string>
<string>thumbnail</string>
</tuple>
</list>
</value>
......@@ -159,20 +167,7 @@
<item>
<key> <string>editable_columns</string> </key>
<value>
<list>
<tuple>
<string>title</string>
<string>Title</string>
</tuple>
<tuple>
<string>modification_date</string>
<string>modification_date</string>
</tuple>
<tuple>
<string>description</string>
<string>description</string>
</tuple>
</list>
<list/>
</value>
</item>
<item>
......@@ -251,7 +246,7 @@
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>Base_getOpenRelatedTicketList</string> </value>
<value> <string>Base_getTicketRelatedEventList</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -8,6 +8,12 @@ else:
prefix += "%s" % context.Base_translateString("Invoice")
return "%s %s - (%s)" % (prefix,
start_date = context.getStartDate()
if start_date is not None:
start_date = ' - (%s)' % context.getStartDate().strftime("%d/%m/%Y")
else:
start_date = ''
return "%s %s%s" % (prefix,
context.getReference(),
context.getStartDate().strftime("%d/%m/%Y"))
start_date)
......@@ -134,6 +134,14 @@
<string>title</string>
<string>Title</string>
</tuple>
<tuple>
<string>guid</string>
<string>guid</string>
</tuple>
<tuple>
<string>destination_section_title</string>
<string>author</string>
</tuple>
<tuple>
<string>pubDate</string>
<string>pubDate</string>
......@@ -143,7 +151,7 @@
<string>Description</string>
</tuple>
<tuple>
<string>absolute_url</string>
<string>Base_getTicketUrl</string>
<string>link</string>
</tuple>
</list>
......@@ -175,6 +183,10 @@
<string>description</string>
<string>description</string>
</tuple>
<tuple>
<string>guid</string>
<string>guid</string>
</tuple>
</list>
</value>
</item>
......
......@@ -8,7 +8,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_description</string> </value>
<value> <string>listbox_guid</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -233,6 +233,10 @@
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>input_type</string> </key>
<value> <string>text</string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
......@@ -243,7 +247,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Description</string> </value>
<value> <string>guid</string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
......@@ -271,7 +275,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: cell.Ticket_getLatestEvent() and cell.Ticket_getLatestEvent().getTextContent() or cell.getDescription()</string> </value>
<value> <string>python: \'{}-{}\'.format(cell.getRelativeUrl(), cell.getSimulationState())</string> </value>
</item>
</dictionary>
</pickle>
......
from Products.ERP5Type.Cache import CachingMethod
portal = context.getPortalObject()
def getLastEventRelativeUrl(uid):
portal = context.getPortalObject()
last_event = portal.portal_catalog.getResultValue(
follow_up_uid=context.getUid(),
portal_type=portal.getPortalEventTypeList(),
simulation_state=["confirmed", "started", "stopped", "delivered"],
sort_on=(("modification_date", 'DESC'),))
if last_event is not None:
return last_event.getRelativeUrl()
else:
return last_event
last_event_url = CachingMethod(getLastEventRelativeUrl,
id='Ticket_getLatestEventRelativeUrl',
cache_factory='erp5_content_short')(context.getUid())
if last_event_url is not None:
return portal.restrictedTraverse(last_event_url)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </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>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Ticket_getLatestEvent</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
latest_event_relative_url = ''
latest_event = context.Ticket_getLatestEvent()
if latest_event:
latest_event_relative_url = latest_event.getRelativeUrl()
return '{}-{}'.format(
context.getRelativeUrl(),
latest_event_relative_url,
)
portal = context.getPortalObject()
kw['portal_type'] = ["Support Request", "Regularisation Request", "Upgrade Decision"]
person = portal.portal_membership.getAuthenticatedMember().getUserValue()
if person:
kw['default_destination_decision_uid'] = person.getUid()
kw['simulation_state'] = "NOT cancelled"
kw['sort_on'] = (('modification_date', 'DESC'),)
kw['limit'] = 50
return portal.portal_catalog(**kw)
else:
return []
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </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>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_getUserCriticalTicketList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal = context.getPortalObject()
kw['portal_type'] = ["Support Request", "Regularisation Request", "Upgrade Decision"]
person = portal.portal_membership.getAuthenticatedMember().getUserValue()
if person:
kw['default_destination_decision_uid'] = person.getUid()
kw['simulation_state'] = "NOT cancelled"
kw['sort_on'] = (('modification_date', 'DESC'),)
kw['limit'] = 50
return portal.portal_catalog(**kw)
else:
return []
......@@ -79,11 +79,7 @@
<item>
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_modification_date</string>
<string>listbox_title</string>
<string>listbox_description</string>
</list>
<list/>
</value>
</item>
</dictionary>
......
......@@ -128,20 +128,28 @@
<string>Title</string>
</tuple>
<tuple>
<string>Ticket_getRSSGuid</string>
<string>guid</string>
<string>guid</string>
</tuple>
<tuple>
<string>modification_date</string>
<string>pubDate</string>
<string>pubDate</string>
</tuple>
<tuple>
<string>description</string>
<string>Description</string>
<string>description</string>
</tuple>
<tuple>
<string>Base_getTicketUrl</string>
<string>link</string>
<string>link</string>
</tuple>
<tuple>
<string>author</string>
<string>author</string>
</tuple>
<tuple>
<string>thumbnail</string>
<string>thumbnail</string>
</tuple>
</list>
</value>
......@@ -159,20 +167,7 @@
<item>
<key> <string>editable_columns</string> </key>
<value>
<list>
<tuple>
<string>title</string>
<string>Title</string>
</tuple>
<tuple>
<string>modification_date</string>
<string>modification_date</string>
</tuple>
<tuple>
<string>description</string>
<string>description</string>
</tuple>
</list>
<list/>
</value>
</item>
<item>
......@@ -251,7 +246,7 @@
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>WebSection_getUserCriticalTicketList</string> </value>
<value> <string>Base_getEventList</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -79,11 +79,7 @@
<item>
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_modification_date</string>
<string>listbox_title</string>
<string>listbox_description</string>
</list>
<list/>
</value>
</item>
</dictionary>
......
......@@ -128,11 +128,11 @@
<string>Title</string>
</tuple>
<tuple>
<string>Ticket_getRSSGuid</string>
<string>guid</string>
<string>guid</string>
</tuple>
<tuple>
<string>modification_date</string>
<string>pubDate</string>
<string>pubDate</string>
</tuple>
<tuple>
......@@ -140,8 +140,16 @@
<string>Description</string>
</tuple>
<tuple>
<string>Base_getTicketUrl</string>
<string>link</string>
<string>link</string>
</tuple>
<tuple>
<string>author</string>
<string>author</string>
</tuple>
<tuple>
<string>thumbnail</string>
<string>thumbnail</string>
</tuple>
</list>
</value>
......@@ -159,20 +167,7 @@
<item>
<key> <string>editable_columns</string> </key>
<value>
<list>
<tuple>
<string>title</string>
<string>Title</string>
</tuple>
<tuple>
<string>modification_date</string>
<string>modification_date</string>
</tuple>
<tuple>
<string>description</string>
<string>description</string>
</tuple>
</list>
<list/>
</value>
</item>
<item>
......@@ -251,7 +246,7 @@
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>WebSection_getUserTicketList</string> </value>
<value> <string>Base_getEventList</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -62,7 +62,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>RSS Subscription Request List</string> </value>
<value> <string>RSS Feed</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
......@@ -79,7 +79,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/SubscriptionRequestModule_viewSubscriptionRequestListAsRSS?portal_skin=RSS</string> </value>
<value> <string>string:${object_url}/SubscriptionRequestModule_viewFeedURLDialog</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Event_getRSSTextContent</string> </value>
<value> <string>SubscriptionRequestModule_getTicketFeedUrl</string> </value>
</item>
</dictionary>
</pickle>
......
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