Fix tickets errors see BT#11081

ofaj
jmontoyaa 9 years ago
parent 169ba41748
commit e6a72cb36c
  1. 25
      main/inc/lib/TicketManager.php
  2. 2
      main/inc/lib/template.lib.php
  3. 50
      main/ticket/ticket_assign_log.php
  4. 53
      main/ticket/ticket_details.php

@ -596,7 +596,7 @@ class TicketManager
'ticket_id' => $ticket_id,
'user_id' => $user_id,
'assigned_date' => $now,
'sys_insert_user_id' => $insert_id,
'sys_insert_user_id' => $insert_id
];
Database::insert($table_support_assigned_log, $params);
@ -631,7 +631,7 @@ class TicketManager
null, // sender name
null, // sender e-mail
array(
'cc' => $sender['email'],
'cc' => $sender['email']
) // should be support e-mail (platform admin) here
);
}
@ -1626,22 +1626,23 @@ class TicketManager
$sql = "SELECT * FROM $table_support_assigned_log
WHERE ticket_id = '$ticket_id'
ORDER BY assigned_date";
ORDER BY assigned_date DESC";
$result = Database::query($sql);
$history = array();
$history = [];
$webpath = api_get_path(WEB_PATH);
while ($row = Database::fetch_assoc($result)) {
if ($row['user_id'] != 0) {
$assignuser = api_get_user_info(
$row['user_id']
);
$assignuser = api_get_user_info($row['user_id']);
$row['assignuser'] = '<a href="' . $webpath . 'main/admin/user_information.php?user_id=' . $row['user_id'] . '" target="_blank">' .
$assignuser['username'] . '</a>';
} else {
$row['assignuser'] = get_lang('Unassign');
}
$row['assigned_date'] = date_to_str_ago($row['assigned_date']);
$insertuser = api_get_user_info($row['sys_insert_user_id']);
$row['assigned_date'] = api_convert_and_format_date(
api_get_local_time($row['assigned_date']), '%d/%m/%y-%H:%M:%S', _api_get_timezone()
);
$row['assignuser'] = $row['user_id'] != 0 ? ('<a href="' . $webpath . 'main/admin/user_information.php?user_id=' . $row['user_id'] . '" target="_blank">' . $assignuser['username'] . '</a>') : get_lang('Unassign');
$row['insertuser'] = '<a href="' . $webpath . 'main/admin/user_information.php?user_id=' . $row['sys_insert_user_id'] . '" target="_blank">' . $insertuser['username'] . '</a>';
$row['insertuser'] = '<a href="' . $webpath . 'main/admin/user_information.php?user_id=' . $row['sys_insert_user_id'] . '" target="_blank">' .
$insertuser['username'] . '</a>';
$history[] = $row;
}

@ -908,7 +908,7 @@ class Template
if (!empty($courseInfo)) {
$courseParams = api_get_cidreq();
}
$url = api_get_path(WEB_CODE_PATH).'ticket/new_ticket.php?project_id=1&'.$courseParams;
$url = api_get_path(WEB_CODE_PATH).'ticket/tickets.php?project_id=1&'.$courseParams;
$rightFloatMenu .= '<div class="report">
<a href="'.$url.'" target="_blank">
'. $iconTicket . '

@ -7,32 +7,36 @@
require_once __DIR__.'/../inc/global.inc.php';
$plugin = TicketPlugin::create();
api_protect_admin_script();
if (!isset($_POST['ticket_id'])) {
exit;
}
$ticket_id = intval($_POST['ticket_id']);
$history = TicketManager::get_assign_log($ticket_id);
?>
<table width="350px" border="0" cellspacing="2" cellpadding="2">
<?php
if (count($history) == 0) {
?>
<tr>
<td colspan="2"><?php echo api_ucfirst(('Sin Historial')); ?></td>
</tr>
<?php
}
<table width="200px" border="0" cellspacing="2" cellpadding="2">
<?php
if (count($history) == 0) {
?>
<?php for ($k = 0; $k < count($history); $k++) { ?>
<tr>
<td width="125px">
<?php echo api_convert_encoding($history[$k]['assignuser'], 'UTF-8', $charset); ?>
</td>
<td width="100px">
<?php echo api_convert_encoding($history[$k]['assigned_date'], 'UTF-8', $charset); ?>
</td>
<td width="125px">
<?php echo api_convert_encoding($history[$k]['insertuser'], 'UTF-8', $charset); ?>
</td>
</tr>
<?php } ?>
<tr>
<td colspan="2"><?php echo api_ucfirst(get_lang('TicketNoHistory')); ?></td>
</tr>
<?php
}
foreach ($history as $item) {
?>
<tr>
<td width="50px">
<?php echo api_convert_encoding($item['insertuser'], 'UTF-8', $charset); ?>
</td>
<td width="80px">
<?php echo api_convert_encoding($item['assigned_date'], 'UTF-8', $charset); ?>
</td>
<td width="50px">
<?php echo api_convert_encoding($item['assignuser'], 'UTF-8', $charset); ?>
</td>
</tr>
<?php } ?>
</table>

@ -280,7 +280,7 @@ if (!isset($_POST['compose'])) {
echo '<table width="100%" >
<tr>
<td colspan="3">
<h1>'.$title.' '.$form_close_ticket.' '.$img_assing.' </h1>
<h1>'.$title.' '.$form_close_ticket.'</h1>
<h2>'.$ticket['ticket']['subject'].'</h2>
<p>
'.$senderData.' ' .
@ -344,31 +344,6 @@ if (!isset($_POST['compose'])) {
</td>
</tr>
';
// Select admins
$select_admins = '<select class ="chzn-select" style="width: 350px; " name = "admins" id="admins" ">';
$admins = UserManager::get_user_list_like(
array('status' => COURSEMANAGER), array('username'),
true
);
$select_admins .= '<option value="" >'.get_lang('None').'</option>';
foreach ($admins as $admin) {
$select_admins.= "<option value = '" . $admin['user_id'] . "' " . (($user_id == $admin['user_id']) ? ("selected='selected'") : '') . ">" .
$admin['complete_name'] . "</option>";
}
$select_admins .= "</select>";
echo '<div id="dialog-form" title="' . get_lang('Assign') . '" >';
echo '<form id="frmResponsable" method="POST" action="ticket_details.php?ticket_id=' . $ticket['ticket']['id'] . '">
<input type="hidden" name ="action" id="action" value="assign"/>
<div>
<div class="label">' . get_lang('Responsable') . ':</div>
<div class="formw">' . $select_admins . '</div>
</div>
</form>';
echo '</div>';
echo '</table>';
$messages = $ticket['messages'];
@ -454,6 +429,10 @@ if (!isset($_POST['compose'])) {
$ticket_id,
api_get_user_id()
);
if (isset($_POST['assigned_last_user']) && !empty($_POST['assigned_last_user'])) {
TicketManager::assign_ticket_user($ticket_id, $_POST['assigned_last_user']);
}
}
Display::addFlash(Display::return_message(get_lang('Saved')));
header("Location:" . api_get_self() . "?ticket_id=" . $ticket_id);
@ -501,10 +480,32 @@ function show_form_send_message($ticket)
)
);
$admins = UserManager::get_user_list_like(
array('status' => COURSEMANAGER), array('username'),
true
);
$adminList = ['' => get_lang('Select')];
foreach ($admins as $admin) {
$adminList[$admin['user_id']] = $admin['complete_name'];
}
$form->addElement(
'select',
'assigned_last_user',
get_lang('Assign'),
$adminList,
array(
'id' => 'assigned_last_user',
'for' => 'assigned_last_user'
)
);
$form->setDefaults(
[
'priority_id' => $ticket['priority_id'],
'status_id' => $ticket['status_id'],
'assigned_last_user' => $ticket['assigned_last_user']
]
);
}

Loading…
Cancel
Save