Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ticket email reminders updates #1403

Merged
merged 1 commit into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

COM_SUPPORT="Support"
COM_SUPPORT_CENTER="Support Center"
COM_SUPPORT_OPEN_TICKETS="Open tickets"
COM_SUPPORT_OPEN_TICKETS="My Open Tickets"
COM_SUPPORT_NEW_TICKET="New Ticket"
COM_SUPPORT_STATS="Stats"
COM_SUPPORT_PERMALINK="Permalink"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<th style="text-align: left; padding: 0.7em; font-weight: bold; white-space: nowrap; border-left: 1px solid #fff;" align="left">Creator</th>
<th style="text-align: left; padding: 0.7em; font-weight: bold; white-space: nowrap; border-left: 1px solid #fff;" align="left">Assigned</th>
<th style="text-align: left; padding: 0.7em; font-weight: bold; white-space: nowrap; border-left: 1px solid #fff;" align="left">Severity</th>
<th style="text-align: left; padding: 0.7em; font-weight: bold; white-space: nowrap; border-left: 1px solid #fff;" align="left">Status</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -105,6 +106,7 @@
<td style="text-align: left; padding: 0.7em; white-space: nowrap; border-left: 1px solid <?php echo $bdcolor[$ticket->severity]; ?>;" align="left"><?php echo $ticket->name ? $this->escape($ticket->name) : 'Unknown'; ?> <?php echo $ticket->login ? '(' . $this->escape($ticket->login) . ')' : ''; ?></td>
<td style="text-align: left; padding: 0.7em; white-space: nowrap; border-left: 1px solid <?php echo $bdcolor[$ticket->severity]; ?>;" align="left"><?php echo $ticket->owner ? $this->escape($ticket->owner_name) : '--'; ?> <?php echo $ticket->owner ? '(' . $this->escape($ticket->owner) . ')' : ''; ?></td>
<td style="text-align: left; padding: 0.7em; white-space: nowrap; border-left: 1px solid <?php echo $bdcolor[$ticket->severity]; ?>;" align="left"><?php echo $this->escape($ticket->severity); ?></td>
<td style="text-align: left; padding: 0.7em; white-space: nowrap; border-left: 1px solid <?php echo $bdcolor[$ticket->severity]; ?>;" align="left"><?php echo $this->escape($ticket->status_title); ?></td>
</tr>
<?php
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@
<th style="text-align: right; padding: 0 0.5em; font-weight: bold; white-space: nowrap;" align="right">Link:</th>
<td colspan="3" style="text-align: left; padding: 0 0.5em; vertical-align: top;" valign="top" align="left"><a href="<?php echo $link; ?>"><?php echo $link; ?></a></td>
</tr>
<tr>
<th style="text-align: right; padding: 0 0.5em; font-weight: bold; white-space: nowrap;" align="right">Status:</th>
<td colspan="3" style="text-align: left; padding: 0 0.5em; vertical-align: top;" valign="top" align="left"><?php echo $ticket->status; ?></td>
</tr>
</tbody>
</table>
</td>
Expand Down Expand Up @@ -221,7 +225,7 @@
background-size: 30px 30px;">
<thead>
<tr>
<th colspan="2" style="font-weight: normal; border-bottom: 1px solid <?php echo $bdcolor['major']; ?>; padding: 8px; text-align: left" align="left">
<th colspan="2" style="font-weight: normal; border-bottom: 1px solid <?php echo $bdcolor['critical']; ?>; padding: 8px; text-align: left" align="left">
<?php echo $this->escape($ticket->summary); ?>
</th>
</tr>
Expand All @@ -232,14 +236,14 @@
#<?php echo $ticket->id; ?>
</td>
<td width="75%" style="padding: 8px;">
<table style="border-collapse: collapse;" cellpadding="0" cellspacing="0" border="0">
<table style="border-collapse: collapse;" width="100%" cellpadding="0" cellspacing="0" border="0">
<tbody>
<?php if (!$this->config->get('email_terse')) { ?>
<tr>
<th style="text-align: right; padding: 0 0.5em; font-weight: bold; white-space: nowrap;" align="right">Created:</th>
<td style="text-align: left; padding: 0 0.5em;" align="left"><?php echo $ticket->created; ?></td>
<th style="text-align: right; padding: 0 0.5em; font-weight: bold; white-space: nowrap;" align="right">Last activity:</th>
<td style="text-align: left; padding: 0 0.5em;" align="left"><?php echo '0000-00-00 00:00:00'; ?></td>
<td style="text-align: left; padding: 0 0.5em;" align="left"><?php echo '--'; ?></td>
</tr>
<tr>
<th style="text-align: right; padding: 0 0.5em; font-weight: bold; white-space: nowrap;" align="right">Creator:</th>
Expand All @@ -256,6 +260,10 @@
<th style="text-align: right; padding: 0 0.5em; font-weight: bold; white-space: nowrap;" align="right">Link:</th>
<td colspan="3" style="text-align: left; padding: 0 0.5em; vertical-align: top;" valign="top" align="left"><a href="<?php echo $link; ?>"><?php echo $link; ?></a></td>
</tr>
<tr>
<th style="text-align: right; padding: 0 0.5em; font-weight: bold; white-space: nowrap;" align="right">Status:</th>
<td colspan="3" style="text-align: left; padding: 0 0.5em; vertical-align: top;" valign="top" align="left"><?php echo $ticket->status; ?></td>
</tr>
</tbody>
</table>
</td>
Expand Down Expand Up @@ -339,6 +347,8 @@
}
$link = $site . '/' . trim($sef, '/');
$link = str_replace('/administrator', '', $link);
$st = new \Components\Support\Models\Tags($ticket->id);
$tags = $st->render('string');
?>
<table id="ticket-info" width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse: collapse; border: 1px solid <?php echo $bdcolor[$severity]; ?>; background: <?php echo $bgcolor[$severity]; ?>; font-size: 0.9em; line-height: 1.6em;
background-image: -webkit-gradient(linear, 0 0, 100% 100%, color-stop(.25, rgba(255, 255, 255, .075)), color-stop(.25, transparent), color-stop(.5, transparent), color-stop(.5, rgba(255, 255, 255, .075)), color-stop(.75, rgba(255, 255, 255, .075)), color-stop(.75, transparent), to(transparent));
Expand All @@ -350,19 +360,49 @@
-webkit-background-size: 30px 30px;
-moz-background-size: 30px 30px;
background-size: 30px 30px;">
<thead>
<tr>
<th colspan="2" style="font-weight: normal; border-bottom: 1px solid <?php echo $bdcolor['critical']; ?>; padding: 8px; text-align: left" align="left">
<?php echo $this->escape($ticket->summary); ?>
</th>
</tr>
</thead>
<tbody>
<tr>
<td width="25%" rowspan="2" style="padding: 8px; font-size: 2em; font-weight: bold; text-align: center; vertical-align: middle; padding: 8px 30px;" valign="middle" align="center">
<td width="25%" style="padding: 8px; font-size: 2em; font-weight: bold; text-align: center; vertical-align: middle; padding: 8px 30px;" valign="middle" align="center">
#<?php echo $ticket->id; ?>
</td>
<td width="75%" colspan="2" style="font-weight: normal; padding: 8px 8px 0 8px; text-align: left;" align="left">
<?php echo !$this->config->get('email_terse') ? $this->escape($ticket->summary) : Lang::txt('COM_SUPPORT_TICKET'); ?>
</td>
</tr>
<tr>
<th style="font-weight: normal; padding: 0 8px 8px 8px; text-align: left; font-weight: bold;" align="left">Link:</th>
<td style="font-weight: normal; padding: 0 8px 8px 8px; text-align: left;" width="100%" align="left">
<a href="<?php echo $link; ?>"><?php echo $link; ?></a>
<td width="75%" style="padding: 8px;">
<table style="border-collapse: collapse;" width="100%" cellpadding="0" cellspacing="0" border="0">
<tbody>
<?php if (!$this->config->get('email_terse')) { ?>
<tr>
<th style="text-align: right; padding: 0 0.5em; font-weight: bold; white-space: nowrap;" align="right">Created:</th>
<td style="text-align: left; padding: 0 0.5em;" align="left"><?php echo $ticket->created; ?></td>
<th style="text-align: right; padding: 0 0.5em; font-weight: bold; white-space: nowrap;" align="right">Last activity:</th>
<td style="text-align: left; padding: 0 0.5em;" align="left"><?php echo '--'; ?></td>
</tr>
<tr>
<th style="text-align: right; padding: 0 0.5em; font-weight: bold; white-space: nowrap;" align="right">Creator:</th>
<td style="text-align: left; padding: 0 0.5em;" align="left"><?php echo $ticket->name ? $ticket->name : 'Unknown'; ?> <?php echo $ticket->login ? '(' . $ticket->login . ')' : ''; ?></td>
<th style="text-align: right; padding: 0 0.5em; font-weight: bold; white-space: nowrap;" align="right">Severity:</th>
<td style="text-align: left; padding: 0 0.5em;" align="left"><?php echo $ticket->severity; ?></td>
</tr>
<tr>
<th style="text-align: right; padding: 0 0.5em; font-weight: bold; white-space: nowrap;" align="right">Tags:</th>
<td colspan="3" style="text-align: left; padding: 0 0.5em; vertical-align: top;" valign="top" align="left"><?php echo $tags ? $tags : '--'; ?></td>
</tr>
<?php } ?>
<tr>
<th style="text-align: right; padding: 0 0.5em; font-weight: bold; white-space: nowrap;" align="right">Link:</th>
<td colspan="3" style="text-align: left; padding: 0 0.5em; vertical-align: top;" valign="top" align="left"><a href="<?php echo $link; ?>"><?php echo $link; ?></a></td>
</tr>
<tr>
<th style="text-align: right; padding: 0 0.5em; font-weight: bold; white-space: nowrap;" align="right">Status:</th>
<td colspan="3" style="text-align: left; padding: 0 0.5em; vertical-align: top;" valign="top" align="left"><?php echo $ticket->status; ?></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
Expand Down
24 changes: 20 additions & 4 deletions core/plugins/cron/support/support.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ public function sendTicketsReminder(\Components\Cron\Models\Job $job)
$database->setQuery($sql);
if (!($results = $database->loadObjectList()))
{
Log::error('CRON query failed: ' . $database->getErrorMsg());
return true;
}

Expand Down Expand Up @@ -515,10 +516,24 @@ public function sendTicketsReminder(\Components\Cron\Models\Job $job)
{
$tickets[$result->owner][$result->severity][] = $result;
}
/*else

if (isset($result->status))
{
$tickets[$result->owner]['unknown'][] = $result;
}*/
if ($result->status == 0)
{
$result->status = "New";
continue;
}

$this_status_sql = "SELECT title FROM `#__support_statuses` WHERE `id`=" . $result->status ;
$database->setQuery($this_status_sql);
if (!($this_result = $database->loadResult()))
{
Log::error('CRON query failed: ' . $database->getErrorMsg());
return true;
}
$result->status = $this_result;
}
}

$from = array(
Expand Down Expand Up @@ -613,7 +628,7 @@ public function sendTicketList(\Components\Cron\Models\Job $job)
Lang::load('com_support') ||
Lang::load('com_support', Component::path('com_support') . DS . 'site');

$sql = "SELECT t.*, o.`name` AS owner_name FROM `#__support_tickets` AS t LEFT JOIN `#__users` AS o ON o.`id`=t.`owner`";
$sql = "SELECT t.*, o.`name` AS owner_name, s.`title` as status_title FROM `#__support_tickets` AS t LEFT JOIN `#__users` AS o ON o.`id`=t.`owner` LEFT JOIN `#__support_statuses` AS s ON s.`id`=t.`status`";

$where = array();

Expand Down Expand Up @@ -898,6 +913,7 @@ public function sendTicketList(\Components\Cron\Models\Job $job)
$database->setQuery($sql);
if (!($results = $database->loadObjectList()))
{
Log::error('CRON query failed: ' . $database->getErrorMsg());
return true;
}

Expand Down