|
@@ -39,9 +39,15 @@ class TicketManager
|
|
|
$table_support_project = Database::get_main_table(TABLE_TICKET_PROJECT);
|
|
|
|
|
|
$order = empty($order) ? 'category.total_tickets DESC' : $order;
|
|
|
- $sql = "SELECT category.*, project.other_area , project.email
|
|
|
- FROM $table_support_category category, $table_support_project project
|
|
|
- WHERE project.project_id = category.project_id
|
|
|
+ $sql = "SELECT
|
|
|
+ category.*,
|
|
|
+ category.id category_id,
|
|
|
+ project.other_area,
|
|
|
+ project.email
|
|
|
+ FROM
|
|
|
+ $table_support_category category,
|
|
|
+ $table_support_project project
|
|
|
+ WHERE project.id = category.project_id
|
|
|
ORDER BY $order";
|
|
|
$result = Database::query($sql);
|
|
|
$types = array();
|
|
@@ -268,7 +274,6 @@ class TicketManager
|
|
|
$status = '',
|
|
|
$assigned_user = 0
|
|
|
) {
|
|
|
- global $plugin;
|
|
|
$table_support_tickets = Database::get_main_table(TABLE_TICKET_TICKET);
|
|
|
$table_support_category = Database::get_main_table(
|
|
|
TABLE_TICKET_CATEGORY
|
|
@@ -327,7 +332,6 @@ class TicketManager
|
|
|
'category_id' => $category_id,
|
|
|
'priority_id' => $priority,
|
|
|
'course_id' => $course_id,
|
|
|
- 'request_user' => 0,
|
|
|
'personal_email' => $personalEmail,
|
|
|
'status_id' => $status,
|
|
|
'start_date' => $now,
|
|
@@ -347,7 +351,7 @@ class TicketManager
|
|
|
|
|
|
Display::addFlash(Display::return_message(
|
|
|
sprintf(
|
|
|
- $plugin->get_lang('TicketXCreated'),
|
|
|
+ get_lang('TicketXCreated'),
|
|
|
$ticket_code
|
|
|
),
|
|
|
'normal',
|
|
@@ -359,7 +363,7 @@ class TicketManager
|
|
|
|
|
|
Display::addFlash(Display::return_message(
|
|
|
sprintf(
|
|
|
- $plugin->get_lang('TicketXAssignedToUserX'),
|
|
|
+ get_lang('TicketXAssignedToUserX'),
|
|
|
$ticket_code,
|
|
|
$assignedUserInfo['complete_name']
|
|
|
),
|
|
@@ -370,7 +374,7 @@ class TicketManager
|
|
|
|
|
|
// Update code
|
|
|
$sql = "UPDATE $table_support_tickets
|
|
|
- SET ticket_code = '$ticket_code'
|
|
|
+ SET code = '$ticket_code'
|
|
|
WHERE ticket_id = '$ticket_id'";
|
|
|
Database::query($sql);
|
|
|
|
|
@@ -416,7 +420,7 @@ class TicketManager
|
|
|
if (empty($category_id)) {
|
|
|
if ($plugin->get('send_warning_to_all_admins')) {
|
|
|
$warningSubject = sprintf(
|
|
|
- $plugin->get_lang('TicketXCreatedWithNoCategory'),
|
|
|
+ get_lang('TicketXCreatedWithNoCategory'),
|
|
|
$ticket_code
|
|
|
);
|
|
|
Display::addFlash(Display::return_message($warningSubject));
|
|
@@ -436,20 +440,20 @@ class TicketManager
|
|
|
$categoryInfo = TicketManager::getCategory($category_id);
|
|
|
$usersInCategory = TicketManager::getUsersInCategory($category_id);
|
|
|
|
|
|
- $message = '<h2>'.$plugin->get_lang('TicketInformation').'</h2><br />'.$helpDeskMessage;
|
|
|
+ $message = '<h2>'.get_lang('TicketInformation').'</h2><br />'.$helpDeskMessage;
|
|
|
|
|
|
if ($plugin->get('warn_admin_no_user_in_category')) {
|
|
|
$usersInCategory = TicketManager::getUsersInCategory($category_id);
|
|
|
if (empty($usersInCategory)) {
|
|
|
$subject = sprintf(
|
|
|
- $plugin->get_lang('WarningCategoryXDoesntHaveUsers'),
|
|
|
+ get_lang('WarningCategoryXDoesntHaveUsers'),
|
|
|
$categoryInfo['name']
|
|
|
);
|
|
|
|
|
|
if ($plugin->get('send_warning_to_all_admins')) {
|
|
|
Display::addFlash(Display::return_message(
|
|
|
sprintf(
|
|
|
- $plugin->get_lang('CategoryWithNoUserNotificationSentToAdmins'),
|
|
|
+ get_lang('CategoryWithNoUserNotificationSentToAdmins'),
|
|
|
$categoryInfo['name']
|
|
|
),
|
|
|
null,
|
|
@@ -490,9 +494,9 @@ class TicketManager
|
|
|
if ($other_area) {
|
|
|
// Send email to "other area" email
|
|
|
api_mail_html(
|
|
|
- $plugin->get_lang('VirtualSupport'),
|
|
|
+ get_lang('VirtualSupport'),
|
|
|
$email,
|
|
|
- $plugin->get_lang('IncidentResentToVirtualSupport'),
|
|
|
+ get_lang('IncidentResentToVirtualSupport'),
|
|
|
$helpDeskMessage,
|
|
|
$user['firstname'].' '.$user['lastname'],
|
|
|
$personalEmail,
|
|
@@ -502,9 +506,9 @@ class TicketManager
|
|
|
|
|
|
// Send email to user
|
|
|
api_mail_html(
|
|
|
- $plugin->get_lang('VirtualSupport'),
|
|
|
+ get_lang('VirtualSupport'),
|
|
|
$user['email'],
|
|
|
- $plugin->get_lang('IncidentResentToVirtualSupport'),
|
|
|
+ get_lang('IncidentResentToVirtualSupport'),
|
|
|
$helpDeskMessage,
|
|
|
$user['firstname'].' '.$user['lastname'],
|
|
|
$personalEmail,
|
|
@@ -512,8 +516,8 @@ class TicketManager
|
|
|
$data_files
|
|
|
);
|
|
|
|
|
|
- $studentMessage = sprintf($plugin->get_lang('YourQuestionWasSentToTheResponableAreaX'), $email, $email);
|
|
|
- $studentMessage .= sprintf($plugin->get_lang('YourAnswerToTheQuestionWillBeSentToX'), $personalEmail);
|
|
|
+ $studentMessage = sprintf(get_lang('YourQuestionWasSentToTheResponableAreaX'), $email, $email);
|
|
|
+ $studentMessage .= sprintf(get_lang('YourAnswerToTheQuestionWillBeSentToX'), $personalEmail);
|
|
|
self::insert_message(
|
|
|
$ticket_id, get_lang('MessageResent'), $studentMessage, null, 1
|
|
|
);
|
|
@@ -534,7 +538,6 @@ class TicketManager
|
|
|
*/
|
|
|
public static function assign_ticket_user($ticket_id, $user_id)
|
|
|
{
|
|
|
- global $plugin;
|
|
|
$ticket_id = intval($ticket_id);
|
|
|
$user_id = intval($user_id);
|
|
|
|
|
@@ -566,7 +569,7 @@ class TicketManager
|
|
|
|
|
|
$sql = "UPDATE $table_support_tickets
|
|
|
SET assigned_last_user = $user_id
|
|
|
- WHERE ticket_id = $ticket_id";
|
|
|
+ WHERE id = $ticket_id";
|
|
|
$result = Database::query($sql);
|
|
|
if (Database::affected_rows($result) > 0) {
|
|
|
$insert_id = api_get_user_id();
|
|
@@ -574,12 +577,12 @@ 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);
|
|
|
|
|
|
$subject = '';
|
|
|
- $content = sprintf($plugin->get_lang('AssignedChangeFromXToY'), $oldUserName, $userCompleteName);
|
|
|
+ $content = sprintf(get_lang('AssignedChangeFromXToY'), $oldUserName, $userCompleteName);
|
|
|
|
|
|
self::insert_message(
|
|
|
$ticket_id,
|
|
@@ -593,14 +596,14 @@ class TicketManager
|
|
|
if ($insert_id !== $user_id) {
|
|
|
$info = api_get_user_info($user_id);
|
|
|
$sender = api_get_user_info($insert_id);
|
|
|
- $href = api_get_path(WEB_PLUGIN_PATH).PLUGIN_NAME.'/src/ticket_details.php?ticket_id='.$ticket_id;
|
|
|
+ $href = api_get_path(WEB_CODE_PATH).'/ticket/ticket_details.php?ticket_id='.$ticket_id;
|
|
|
$message = sprintf(
|
|
|
- $plugin->get_lang('TicketAssignedMsg'),
|
|
|
+ get_lang('TicketAssignedMsg'),
|
|
|
$info['complete_name'],
|
|
|
$href,
|
|
|
$ticket_id
|
|
|
);
|
|
|
- $mailTitle = sprintf($plugin->get_lang('TicketAssignX'), $ticket_id);
|
|
|
+ $mailTitle = sprintf(get_lang('TicketAssignX'), $ticket_id);
|
|
|
api_mail_html(
|
|
|
$info['complete_name'],
|
|
|
$info['mail'],
|
|
@@ -645,7 +648,7 @@ class TicketManager
|
|
|
$table_support_message_attachments = Database::get_main_table(TABLE_TICKET_MESSAGE_ATTACHMENTS);
|
|
|
if ($sendConfirmation) {
|
|
|
$form = '<form action="ticket_details.php?ticket_id=' . $ticket_id . '" id="confirmticket" method="POST" >
|
|
|
- <p>' . $plugin->get_lang('TicketWasThisAnswerSatisfying') . '</p>
|
|
|
+ <p>' . get_lang('TicketWasThisAnswerSatisfying') . '</p>
|
|
|
<button class="btn btn-primary responseyes" name="response" id="responseyes" value="1">' . get_lang('Yes') . '</button>
|
|
|
<button class="btn btn-danger responseno" name="response" id="responseno" value="0">' . get_lang('No') . '</button>
|
|
|
</form>';
|
|
@@ -667,7 +670,6 @@ class TicketManager
|
|
|
|
|
|
$params = [
|
|
|
'ticket_id' => $ticket_id,
|
|
|
- 'message_id' => $message_id,
|
|
|
'subject' => $subject,
|
|
|
'message' => $content,
|
|
|
'ip_address' => $_SERVER['REMOTE_ADDR'],
|
|
@@ -689,7 +691,7 @@ class TicketManager
|
|
|
FROM $table_support_messages
|
|
|
WHERE ticket_id ='$ticket_id'
|
|
|
)
|
|
|
- WHERE ticket_id = $ticket_id ";
|
|
|
+ WHERE id = $ticket_id ";
|
|
|
Database::query($sql);
|
|
|
|
|
|
$sql = "SELECT COUNT(*) as total_attach
|
|
@@ -807,7 +809,6 @@ class TicketManager
|
|
|
$direction,
|
|
|
$user_id = 0
|
|
|
) {
|
|
|
- global $plugin;
|
|
|
$table_support_category = Database::get_main_table(TABLE_TICKET_CATEGORY);
|
|
|
$table_support_tickets = Database::get_main_table(TABLE_TICKET_TICKET);
|
|
|
$table_support_priority = Database::get_main_table(TABLE_TICKET_PRIORITY);
|
|
@@ -821,12 +822,13 @@ class TicketManager
|
|
|
|
|
|
$sql = "SELECT DISTINCT
|
|
|
ticket.*,
|
|
|
- ticket.ticket_id AS col0,
|
|
|
+ ticket.id ticket_id,
|
|
|
+ ticket.id AS col0,
|
|
|
ticket.start_date AS col1,
|
|
|
ticket.sys_lastedit_datetime AS col2,
|
|
|
cat.name AS col3,
|
|
|
- priority.priority AS col5,
|
|
|
- priority.priority AS col6,
|
|
|
+ priority.name AS col5,
|
|
|
+ priority.name AS col6,
|
|
|
status.name AS col7,
|
|
|
ticket.total_messages AS col8,
|
|
|
ticket.message AS col9,
|
|
@@ -837,9 +839,9 @@ class TicketManager
|
|
|
$table_support_priority priority,
|
|
|
$table_support_status status
|
|
|
WHERE
|
|
|
- cat.category_id = ticket.category_id AND
|
|
|
- ticket.priority_id = priority.priority_id AND
|
|
|
- ticket.status_id = status.status_id
|
|
|
+ cat.id = ticket.category_id AND
|
|
|
+ ticket.priority_id = priority.id AND
|
|
|
+ ticket.status_id = status.id
|
|
|
";
|
|
|
if (!$isAdmin) {
|
|
|
$sql .= " AND (ticket.assigned_last_user = $user_id)";
|
|
@@ -857,7 +859,7 @@ class TicketManager
|
|
|
if ($_GET['keyword'] != '') {
|
|
|
$keyword = Database::escape_string(trim($_GET['keyword']));
|
|
|
$sql .= " AND (
|
|
|
- ticket.ticket_code = '$keyword' OR
|
|
|
+ ticket.code = '$keyword' OR
|
|
|
ticket.ticket_id = '$keyword'
|
|
|
)";
|
|
|
}
|
|
@@ -1002,7 +1004,7 @@ class TicketManager
|
|
|
}
|
|
|
} else {
|
|
|
if ($row['status_id'] !== self::STATUS_FORWARDED) {
|
|
|
- $row['assigned_last_user'] = '<span style="color:#ff0000;">' . $plugin->get_lang('ToBeAssigned') . '</span>';
|
|
|
+ $row['assigned_last_user'] = '<span style="color:#ff0000;">' . get_lang('ToBeAssigned') . '</span>';
|
|
|
} else {
|
|
|
$row['assigned_last_user'] = '<span style="color:#00ff00;">' . get_lang('MessageResent') . '</span>';
|
|
|
}
|
|
@@ -1030,7 +1032,7 @@ class TicketManager
|
|
|
}
|
|
|
$row['col0'] = Display::return_icon(
|
|
|
$img_source, get_lang('Info')
|
|
|
- ) . '<a href="ticket_details.php?ticket_id=' . $row['col0'] . '">' . $row['ticket_code'] . '</a>';
|
|
|
+ ) . '<a href="ticket_details.php?ticket_id=' . $row['col0'] . '">' . $row['code'] . '</a>';
|
|
|
// @todo fix
|
|
|
/*if ($row['col7'] == 'PENDIENTE') {
|
|
|
$row['col7'] = '<span style="color: #f00; font-weight:bold;">' . $row['col7'] . '</span>';
|
|
@@ -1051,7 +1053,7 @@ class TicketManager
|
|
|
$row['col0'] = Display::return_icon(
|
|
|
$img_source,
|
|
|
get_lang('Info')
|
|
|
- ) . '<a href="ticket_details.php?ticket_id=' . $row['col0'] . '">' . $row['ticket_code'] . '</a>';
|
|
|
+ ) . '<a href="ticket_details.php?ticket_id=' . $row['col0'] . '">' . $row['code'] . '</a>';
|
|
|
$now = api_strtotime(api_get_utc_datetime());
|
|
|
$last_edit_date = api_strtotime($row['sys_lastedit_datetime']);
|
|
|
$dif = $now - $last_edit_date;
|
|
@@ -1108,21 +1110,21 @@ class TicketManager
|
|
|
$table_main_user = Database::get_main_table(TABLE_MAIN_USER);
|
|
|
$table_main_admin = Database::get_main_table(TABLE_MAIN_ADMIN);
|
|
|
|
|
|
- $sql = "SELECT COUNT(ticket.ticket_id) AS total
|
|
|
+ $sql = "SELECT COUNT(ticket.id) AS total
|
|
|
FROM $table_support_tickets ticket ,
|
|
|
$table_support_category cat ,
|
|
|
$table_support_priority priority,
|
|
|
$table_support_status status
|
|
|
WHERE
|
|
|
- cat.category_id = ticket.category_id AND
|
|
|
- ticket.priority_id = priority.priority_id AND
|
|
|
- ticket.status_id = status.status_id";
|
|
|
+ cat.id = ticket.category_id AND
|
|
|
+ ticket.priority_id = priority.id AND
|
|
|
+ ticket.status_id = status.id";
|
|
|
|
|
|
// Search simple
|
|
|
if (isset($_GET['submit_simple'])) {
|
|
|
if ($_GET['keyword'] != '') {
|
|
|
$keyword = Database::escape_string(trim($_GET['keyword']));
|
|
|
- $sql .= " AND (ticket.ticket_code = '$keyword'
|
|
|
+ $sql .= " AND (ticket.code = '$keyword'
|
|
|
OR user.firstname LIKE '%$keyword%'
|
|
|
OR user.lastname LIKE '%$keyword%'
|
|
|
OR concat(user.firstname,' ',user.lastname) LIKE '%$keyword%'
|
|
@@ -1214,31 +1216,31 @@ class TicketManager
|
|
|
}
|
|
|
|
|
|
if ($keyword_unread == 'yes') {
|
|
|
- $sql .= " AND ticket.ticket_id IN ( ";
|
|
|
- $sql .= "SELECT ticket.ticket_id
|
|
|
+ $sql .= " AND ticket.id IN ( ";
|
|
|
+ $sql .= "SELECT ticket.id
|
|
|
FROM $table_support_tickets ticket,
|
|
|
$table_support_messages message,
|
|
|
$table_main_user user
|
|
|
- WHERE ticket.ticket_id = message.ticket_id
|
|
|
+ WHERE ticket.id = message.ticket_id
|
|
|
AND message.status = 'NOL'
|
|
|
AND message.sys_insert_user_id = user.user_id
|
|
|
AND user.user_id NOT IN (
|
|
|
SELECT user_id FROM $table_main_admin
|
|
|
) AND ticket.status_id != '".self::STATUS_FORWARDED."'
|
|
|
- GROUP BY ticket.ticket_id)";
|
|
|
+ GROUP BY ticket.id)";
|
|
|
} else {
|
|
|
if ($keyword_unread == 'no') {
|
|
|
- $sql .= " AND ticket.ticket_id NOT IN ( ";
|
|
|
- $sql .= " SELECT ticket.ticket_id
|
|
|
+ $sql .= " AND ticket.id NOT IN ( ";
|
|
|
+ $sql .= " SELECT ticket.id
|
|
|
FROM $table_support_tickets ticket,
|
|
|
$table_support_messages message,
|
|
|
$table_main_user user
|
|
|
- WHERE ticket.ticket_id = message.ticket_id
|
|
|
+ WHERE ticket.id = message.ticket_id
|
|
|
AND message.status = 'NOL'
|
|
|
AND message.sys_insert_user_id = user.user_id
|
|
|
AND user.user_id NOT IN (SELECT user_id FROM $table_main_admin)
|
|
|
AND ticket.status_id != '".self::STATUS_FORWARDED."'
|
|
|
- GROUP BY ticket.ticket_id)";
|
|
|
+ GROUP BY ticket.id)";
|
|
|
}
|
|
|
}
|
|
|
$res = Database::query($sql);
|
|
@@ -1277,16 +1279,16 @@ class TicketManager
|
|
|
ticket.*,
|
|
|
cat.name,
|
|
|
status.name as status,
|
|
|
- priority.priority
|
|
|
+ priority.name priority
|
|
|
FROM $table_support_tickets ticket,
|
|
|
$table_support_category cat ,
|
|
|
$table_support_priority priority,
|
|
|
$table_support_status status
|
|
|
WHERE
|
|
|
- ticket.ticket_id = $ticket_id
|
|
|
- AND cat.category_id = ticket.category_id
|
|
|
- AND priority.priority_id = ticket.priority_id
|
|
|
- AND status.status_id = ticket.status_id ";
|
|
|
+ ticket.id = $ticket_id
|
|
|
+ AND cat.id = ticket.category_id
|
|
|
+ AND priority.id = ticket.priority_id
|
|
|
+ AND status.id = ticket.status_id ";
|
|
|
$result = Database::query($sql);
|
|
|
$ticket = array();
|
|
|
if (Database::num_rows($result) > 0) {
|
|
@@ -1311,9 +1313,10 @@ class TicketManager
|
|
|
$row['course_url'] = '<a href="'.$course['course_public_url'].'">'.$course['name'].'</a>';
|
|
|
}
|
|
|
}
|
|
|
- $userInfo = api_get_user_info($row['request_user']);
|
|
|
- $row['user_url'] = '<a href="' . api_get_path(WEB_PATH) . 'main/admin/user_information.php?user_id=' . $row['request_user'] . '">
|
|
|
- ' . api_get_person_name($userInfo['firstname'], $userInfo['lastname']) . '</a>';
|
|
|
+
|
|
|
+ $userInfo = api_get_user_info($row['sys_insert_user_id']);
|
|
|
+ $row['user_url'] = '<a href="' . api_get_path(WEB_PATH) . 'main/admin/user_information.php?user_id=' . $userInfo['user_id'] . '">
|
|
|
+ ' . $userInfo['complete_name']. '</a>';
|
|
|
$ticket['usuario'] = $userInfo;
|
|
|
$ticket['ticket'] = $row;
|
|
|
}
|
|
@@ -1345,8 +1348,8 @@ class TicketManager
|
|
|
$sql = "SELECT *
|
|
|
FROM $table_support_message_attachments
|
|
|
WHERE
|
|
|
- message_id = " . $row['message_id'] . " AND
|
|
|
- ticket_id= '$ticket_id' ";
|
|
|
+ message_id = " . $row['id'] . " AND
|
|
|
+ ticket_id = '$ticket_id' ";
|
|
|
$result_attach = Database::query($sql);
|
|
|
while ($row2 = Database::fetch_assoc($result_attach)) {
|
|
|
$archiveURL = $archiveURL = $webPath . "plugin/" . PLUGIN_NAME . '/src/download.php?ticket_id=' . $ticket_id . '&file=';
|
|
@@ -1407,18 +1410,17 @@ class TicketManager
|
|
|
*/
|
|
|
public static function sendNotification($ticketId, $userId, $title, $message)
|
|
|
{
|
|
|
- global $plugin;
|
|
|
$userInfo = api_get_user_info($userId);
|
|
|
$ticketInfo = self::get_ticket_detail_by_id($ticketId, $userId);
|
|
|
$requestUserInfo = $ticketInfo['usuario'];
|
|
|
- $ticketCode = $ticketInfo['ticket']['ticket_code'];
|
|
|
+ $ticketCode = $ticketInfo['ticket']['code'];
|
|
|
$status = $ticketInfo['ticket']['status'];
|
|
|
$priority = $ticketInfo['ticket']['priority'];
|
|
|
|
|
|
$titleEmail = "[$ticketCode] $title";
|
|
|
- $messageEmail = $plugin->get_lang('TicketNum').": $ticketCode <br />";
|
|
|
- $messageEmail .= $plugin->get_lang('Status').": $status <br />";
|
|
|
- $messageEmail .= $plugin->get_lang('Priority').": $priority <br />";
|
|
|
+ $messageEmail = get_lang('TicketNum').": $ticketCode <br />";
|
|
|
+ $messageEmail .= get_lang('Status').": $status <br />";
|
|
|
+ $messageEmail .= get_lang('Priority').": $priority <br />";
|
|
|
$messageEmail .= '<hr /><br />';
|
|
|
$messageEmail .= $message;
|
|
|
|
|
@@ -1453,12 +1455,11 @@ class TicketManager
|
|
|
*
|
|
|
* @return bool
|
|
|
*/
|
|
|
- public function updateTicket(
|
|
|
+ public static function updateTicket(
|
|
|
$params,
|
|
|
$ticketId,
|
|
|
$userId
|
|
|
) {
|
|
|
- global $plugin;
|
|
|
$now = api_get_utc_datetime();
|
|
|
|
|
|
$table = Database::get_main_table(TABLE_TICKET_TICKET);
|
|
@@ -1468,14 +1469,15 @@ class TicketManager
|
|
|
'sys_lastedit_user_id' => $userId,
|
|
|
'sys_lastedit_datetime' => $now
|
|
|
];
|
|
|
- Database::update($table, $newParams, ['ticket_id = ? ' => $ticketId]);
|
|
|
+ Database::update($table, $newParams, ['id = ? ' => $ticketId]);
|
|
|
|
|
|
self::sendNotification(
|
|
|
$ticketId,
|
|
|
$userId,
|
|
|
- $plugin->get_lang('TicketUpdated'),
|
|
|
- $plugin->get_lang('TicketUpdated')
|
|
|
+ get_lang('TicketUpdated'),
|
|
|
+ get_lang('TicketUpdated')
|
|
|
);
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -1490,7 +1492,6 @@ class TicketManager
|
|
|
$ticket_id,
|
|
|
$user_id
|
|
|
) {
|
|
|
- global $plugin;
|
|
|
$table_support_tickets = Database::get_main_table(TABLE_TICKET_TICKET);
|
|
|
|
|
|
$ticket_id = intval($ticket_id);
|
|
@@ -1509,8 +1510,8 @@ class TicketManager
|
|
|
self::sendNotification(
|
|
|
$ticket_id,
|
|
|
$user_id,
|
|
|
- $plugin->get_lang('TicketUpdated'),
|
|
|
- $plugin->get_lang('TicketUpdated')
|
|
|
+ get_lang('TicketUpdated'),
|
|
|
+ get_lang('TicketUpdated')
|
|
|
);
|
|
|
return true;
|
|
|
} else {
|
|
@@ -1531,11 +1532,11 @@ class TicketManager
|
|
|
$table_main_admin = Database::get_main_table(TABLE_MAIN_ADMIN);
|
|
|
$user_info = api_get_user_info();
|
|
|
$user_id = $user_info['user_id'];
|
|
|
- $sql = "SELECT COUNT( DISTINCT ticket.ticket_id) AS unread
|
|
|
+ $sql = "SELECT COUNT( DISTINCT ticket.id) AS unread
|
|
|
FROM $table_support_tickets ticket,
|
|
|
$table_support_messages message ,
|
|
|
$table_main_user user
|
|
|
- WHERE ticket.ticket_id = message.ticket_id
|
|
|
+ WHERE ticket.id = message.ticket_id
|
|
|
AND message.status = 'NOL'
|
|
|
AND user.user_id = message.sys_insert_user_id ";
|
|
|
if (!api_is_platform_admin()) {
|
|
@@ -1578,7 +1579,6 @@ class TicketManager
|
|
|
*/
|
|
|
public static function close_ticket($ticket_id, $user_id)
|
|
|
{
|
|
|
- global $plugin;
|
|
|
$ticket_id = intval($ticket_id);
|
|
|
$user_id = intval($user_id);
|
|
|
|
|
@@ -1589,14 +1589,14 @@ class TicketManager
|
|
|
sys_lastedit_user_id ='$user_id',
|
|
|
sys_lastedit_datetime ='" . $now . "',
|
|
|
end_date ='$now'
|
|
|
- WHERE ticket_id ='$ticket_id'";
|
|
|
+ WHERE id ='$ticket_id'";
|
|
|
Database::query($sql);
|
|
|
|
|
|
self::sendNotification(
|
|
|
$ticket_id,
|
|
|
$user_id,
|
|
|
- $plugin->get_lang('TicketClosed'),
|
|
|
- $plugin->get_lang('TicketClosed')
|
|
|
+ get_lang('TicketClosed'),
|
|
|
+ get_lang('TicketClosed')
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -1692,7 +1692,7 @@ class TicketManager
|
|
|
$user_id = api_get_user_id();
|
|
|
}
|
|
|
|
|
|
- $sql = "SELECT ticket.ticket_code, ticket.sys_insert_datetime ,
|
|
|
+ $sql = "SELECT ticket.code, ticket.sys_insert_datetime ,
|
|
|
ticket.sys_lastedit_datetime , cat.name as category ,
|
|
|
CONCAT(user.lastname,' ', user.firstname) AS fullname ,
|
|
|
status.name as status , ticket.total_messages as messages ,
|
|
@@ -1703,15 +1703,15 @@ class TicketManager
|
|
|
$table_support_status status ,
|
|
|
$table_main_user user
|
|
|
WHERE
|
|
|
- cat.category_id = ticket.category_id
|
|
|
- AND ticket.priority_id = priority.priority_id
|
|
|
- AND ticket.status_id = status.status_id
|
|
|
+ cat.id = ticket.category_id
|
|
|
+ AND ticket.priority_id = priority.id
|
|
|
+ AND ticket.status_id = status.id
|
|
|
AND user.user_id = ticket.request_user ";
|
|
|
- //Search simple
|
|
|
+ // Search simple
|
|
|
if (isset($_GET['submit_simple'])) {
|
|
|
- if ($_GET['keyword'] != '') {
|
|
|
+ if ($_GET['keyword'] !== '') {
|
|
|
$keyword = Database::escape_string(trim($_GET['keyword']));
|
|
|
- $sql .= " AND (ticket.ticket_code = '$keyword'
|
|
|
+ $sql .= " AND (ticket.code = '$keyword'
|
|
|
OR user.firstname LIKE '%$keyword%'
|
|
|
OR user.lastname LIKE '%$keyword%'
|
|
|
OR concat(user.firstname,' ',user.lastname) LIKE '%$keyword%'
|