Commit cdbdd701 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Display Regularisation requests on attention point

parent 56c433b3
from json import dumps from json import dumps
attention_point_list = [] attention_point_list = []
portal = context.getPortalObject()
# For now keep the logic here hardcoded. def addAttentionForTicket(ticket):
if context.getPortalType() == "Hosting Subscription": msg = None
if ticket.getPortalType() == "Support Request":
msg = context.Base_translateString("Ticket waiting your response")
elif ticket.getPortalType() == "Upgrade Decision":
msg = context.Base_translateString("Please Upgrade this service")
elif ticket.getPortalType() == "Regularisation Request":
msg = context.Base_translateString(
"Regularisation waiting your response")
if msg:
return {"text": msg, "link": ticket.getRelativeUrl()}
# Display unresponded tickets on services or servers
if context.getPortalType() in ["Hosting Subscription", "Computer"]:
simulation_state = ["suspended", "confirmed"] simulation_state = ["suspended", "confirmed"]
for ticket in context.Base_getOpenRelatedTicketList( for ticket in context.Base_getOpenRelatedTicketList(
limit=3, simulation_state=simulation_state): limit=3, simulation_state=simulation_state):
if ticket.getPortalType() == "Support Request": entry = addAttentionForTicket(ticket)
attention_point_list.append( if entry is not None:
{"text": "Ticket waiting your response", attention_point_list.append(entry)
"link": ticket.getRelativeUrl()})
elif ticket.getPortalType() == "Upgrade Decision": # This is a limitation of the API that will consider that all tickets
attention_point_list.append( # Are from this module
{"text": "Please Upgrade this service", if context.getPortalType() in ["Support Request Module"]:
"link": ticket.getRelativeUrl()}) simulation_state = ["suspended", "confirmed"]
person = portal.portal_membership.getAuthenticatedMember().getUserValue()
for ticket in portal.portal_catalog(
portal_type=("Support Request", "Upgrade Decision", "Regularisation Request"),
destination_decision_uid=person.getUid(),
limit=3, simulation_state=simulation_state):
entry = addAttentionForTicket(ticket)
if entry is not None:
attention_point_list.append(entry)
return dumps(attention_point_list) return dumps(attention_point_list)
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