Commit cdbdd701 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Display Regularisation requests on attention point

parent 56c433b3
Pipeline #11392 failed with stage
in 0 seconds
from json import dumps
attention_point_list = []
portal = context.getPortalObject()
# For now keep the logic here hardcoded.
if context.getPortalType() == "Hosting Subscription":
def addAttentionForTicket(ticket):
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"]
for ticket in context.Base_getOpenRelatedTicketList(
limit=3, simulation_state=simulation_state):
if ticket.getPortalType() == "Support Request":
attention_point_list.append(
{"text": "Ticket waiting your response",
"link": ticket.getRelativeUrl()})
elif ticket.getPortalType() == "Upgrade Decision":
attention_point_list.append(
{"text": "Please Upgrade this service",
"link": ticket.getRelativeUrl()})
entry = addAttentionForTicket(ticket)
if entry is not None:
attention_point_list.append(entry)
# This is a limitation of the API that will consider that all tickets
# Are from this module
if context.getPortalType() in ["Support Request Module"]:
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)
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