Upgrade 1-11.38

This commit is contained in:
xesmyd
2026-03-30 14:10:30 +02:00
parent f2a7e6d1fc
commit ac648ef29d
24665 changed files with 69682 additions and 2205004 deletions
+6 -2
View File
@@ -134,10 +134,14 @@ $userIsAllowInProject = TicketManager::userIsAllowInProject($userInfo, $projectI
$allowEdition = $ticket['ticket']['assigned_last_user'] == $user_id ||
$ticket['ticket']['sys_insert_user_id'] == $user_id ||
$isAdmin;
$allowCategory = TicketManager::userIsAssignedToCategory(
$user_id,
$ticket['ticket']['category_id']
);
if (false === $userIsAllowInProject) {
// make sure it's either a user assigned to this ticket, or the reporter, or and admin
if (false === $allowEdition) {
// make sure it's either a user assigned to this ticket, the reporter, an admin or the category manager
if (false === $allowEdition && false === $allowCategory) {
api_not_allowed(true);
}
}
+70 -7
View File
@@ -65,7 +65,37 @@ $table = new SortableTable(
'DESC'
);
$table->set_additional_parameters(['project_id' => $projectId]);
// Preserve current search parameters across pagination and page size changes
$additionalParameters = [
'project_id' => $projectId,
];
$searchParams = [
// Simple search
'keyword',
'submit_simple',
// Advanced search
'submit_advanced',
'keyword_status',
'keyword_category',
'keyword_assigned_to',
'keyword_created_by',
'keyword_priority',
'keyword_course',
'keyword_unread',
'keyword_start_date_start',
'keyword_start_date_end',
// Extra supported keys used by TicketManager
'keyword_source',
];
foreach ($searchParams as $paramName) {
if (isset($_GET[$paramName]) && $_GET[$paramName] !== '') {
$additionalParameters[$paramName] = Security::remove_XSS($_GET[$paramName]);
}
}
$table->set_additional_parameters($additionalParameters);
if ($table->per_page == 0) {
$table->per_page = 20;
@@ -74,7 +104,7 @@ if ($table->per_page == 0) {
switch ($action) {
case 'delete':
if (isset($_GET['ticket_id'])) {
TicketManager::deleteTicket((int)$_GET['ticket_id']);
TicketManager::deleteTicket((int) $_GET['ticket_id']);
Display::addFlash(Display::return_message(
sprintf(
get_lang('TicketDeleted'),
@@ -95,6 +125,7 @@ switch ($action) {
$data = [
[
'#',
get_lang('Subject'),
get_lang('Status'),
get_lang('Date'),
get_lang('LastUpdate'),
@@ -106,13 +137,44 @@ switch ($action) {
],
];
$datos = $table->get_clean_html();
$ticketTable = Database::get_main_table(TABLE_TICKET_TICKET);
foreach ($datos as $ticket) {
$ticket[0] = substr(strip_tags($ticket[0]), 0, 12);
$ticketId = 0;
if (preg_match('/ticket_id=(\d+)/', $ticket[0], $matches)) {
$ticketId = (int) $matches[1];
}
$ticketCode = '';
$ticketTitle = '';
$ticketDate = '';
$ticketLastUpdate = '';
if ($ticketId > 0) {
$sql = "SELECT code, subject, start_date, sys_lastedit_datetime FROM $ticketTable WHERE id = $ticketId";
$rs = Database::query($sql);
if ($row = Database::fetch_array($rs)) {
$ticketCode = $row['code'];
$ticketTitle = $row['subject'];
// Format dates for export as dd/mm/yy
if (!empty($row['start_date'])) {
$ts = strtotime($row['start_date']);
if ($ts !== false) {
$ticketDate = date('d/m/y', $ts);
}
}
if (!empty($row['sys_lastedit_datetime'])) {
$ts2 = strtotime($row['sys_lastedit_datetime']);
if ($ts2 !== false) {
$ticketLastUpdate = date('d/m/y', $ts2);
}
}
}
}
$ticket_rem = [
utf8_decode(strip_tags($ticket[0])),
utf8_decode($ticketCode),
utf8_decode($ticketTitle),
utf8_decode(api_html_entity_decode($ticket[1])),
utf8_decode(strip_tags($ticket[2])),
utf8_decode(strip_tags($ticket[3])),
utf8_decode(!empty($ticketDate) ? $ticketDate : strip_tags($ticket[2])),
utf8_decode(!empty($ticketLastUpdate) ? $ticketLastUpdate : strip_tags($ticket[3])),
utf8_decode(strip_tags($ticket[4])),
utf8_decode(strip_tags($ticket[5])),
utf8_decode(strip_tags($ticket[6])),
@@ -156,7 +218,8 @@ if (!empty($projectId)) {
'keyword_status',
'keyword_category',
'keyword_assigned_to',
'keyword_start_date',
'keyword_start_date_start',
'keyword_start_date_end',
'keyword_unread',
'Tickets_per_page',
'Tickets_column',