Fix ticket workflow see BT#11081

remotes/angel/1.11.x
jmontoyaa 8 years ago
parent 819bafd453
commit 53c6b3e549
  1. 9
      main/inc/lib/TicketManager.php
  2. 20
      main/ticket/categories.php
  3. 25
      main/ticket/categories_add_user.php
  4. 37
      main/ticket/projects.php

@ -1941,10 +1941,7 @@ class TicketManager
$list[] = [
'id' => $row->getId(),
'0' => $row->getId(),
'1' => Display::url(
$row->getName(),
api_get_path(WEB_CODE_PATH).'ticket/tickets.php?project_id='.$row->getId()
),
'1' => $row->getName(),
'2' => $row->getDescription(),
'3' => $row->getId()
];
@ -2305,10 +2302,6 @@ class TicketManager
'url' => 'projects.php',
'content' => get_lang('Projects')
],
[
'url' => 'categories.php',
'content' => get_lang('Categories')
],
[
'url' => 'status.php',
'content' => get_lang('Status')

@ -37,7 +37,12 @@ if ($table->per_page == 0) {
$formToString = '';
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$projectId = isset($_GET['project_id']) ? (int) $_GET['project_id'] : '';
$projectId = isset($_GET['project_id']) ? (int) $_GET['project_id'] : 0;
$project = TicketManager::getProject($projectId);
if (empty($project)) {
api_not_allowed(true);
}
Session::write('project_id', $projectId);
$action = isset($_GET['action']) ? $_GET['action'] : '';
@ -52,11 +57,22 @@ $interbreadcrumb[] = array(
'name' => get_lang('Settings')
);
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/projects.php',
'name' => get_lang('Projects')
);
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/projects.php',
'name' => $project->getName()
);
switch ($action) {
case 'delete':
TicketManager::deleteCategory($id);
Display::addFlash(Display::return_message(get_lang('Deleted')));
header("Location: ".api_get_self());
header("Location: ".api_get_self().'?project_id='.$projectId);
exit;
break;
case 'add':
$toolName = get_lang('Add');

@ -19,7 +19,12 @@ if (empty($categoryInfo)) {
api_not_allowed(true);
}
$form = new FormValidator('edit', 'post', api_get_self().'?id='.$categoryId);
$project = TicketManager::getProject($projectId);
if (empty($project)) {
api_not_allowed(true);
}
$form = new FormValidator('edit', 'post', api_get_self().'?id='.$categoryId.'&project_id='.$projectId);
$form->addHeader($categoryInfo['name']);
$users = UserManager::get_user_list([], ['firstname']);
$users = array_column($users, 'complete_name', 'user_id');
@ -54,9 +59,27 @@ $interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/tickets.php?project_id='.$projectId,
'name' => get_lang('MyTickets')
);
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/settings.php',
'name' => get_lang('Settings')
);
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/projects.php',
'name' => get_lang('Projects')
);
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/projects.php',
'name' => $project->getName()
);
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/categories.php?project_id='.$projectId,
'name' => get_lang('Categories')
);
Display::display_header(get_lang('Users'));
$form->display();

@ -10,7 +10,7 @@ require_once __DIR__.'/../inc/global.inc.php';
api_protect_admin_script(true);
$toolName = get_lang('Project');
//$toolName = get_lang('Project');
$libPath = api_get_path(LIBRARY_PATH);
$webLibPath = api_get_path(WEB_LIBRARY_PATH);
@ -43,6 +43,11 @@ $interbreadcrumb[] = array(
'name' => get_lang('Settings')
);
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/projects.php',
'name' => get_lang('Projects')
);
switch ($action) {
case 'delete':
TicketManager::deleteProject($id);
@ -51,10 +56,7 @@ switch ($action) {
break;
case 'add':
$toolName = get_lang('Add');
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
'name' => get_lang('Categories')
);
$url = api_get_self().'?action=add';
$form = TicketManager::getProjectForm($url);
$formToString = $form->returnForm();
@ -74,15 +76,14 @@ switch ($action) {
}
break;
case 'edit':
$item = TicketManager::getProject($_GET['id']);
if (empty($item)) {
api_not_allowed(true);
}
$toolName = get_lang('Edit');
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
'name' => get_lang('Categories')
);
$url = api_get_self().'?action=edit&id='.$id;
$form = TicketManager::getProjectForm($url);
$item = TicketManager::getProject($_GET['id']);
$form->setDefaults([
'name' => $item->getName(),
'description' => $item->getDescription()]
@ -120,6 +121,18 @@ $isAdmin = api_is_platform_admin();
function modify_filter($id, $params, $row)
{
$result = Display::url(
get_lang('Tickets'),
"tickets.php?project_id={$row['id']}",
['class' => 'btn btn-small btn-default']
);
$result .= Display::url(
get_lang('Categories'),
"categories.php?project_id={$row['id']}",
['class' => 'btn btn-default']
);
$result .= Display::url(
Display::return_icon('edit.png', get_lang('Edit')),
"projects.php?action=edit&id={$row['id']}"
);
@ -129,7 +142,7 @@ function modify_filter($id, $params, $row)
"projects.php?action=delete&id={$row['id']}"
);
return $result;
return $result;
}
$table->set_header(0, '', false);
@ -138,7 +151,7 @@ $table->set_header(2, get_lang('Description'), true, array("style" => "width:200
$table->set_header(3, get_lang('Actions'), true);
$table->set_column_filter('3', 'modify_filter');
Display::display_header($toolName);
Display::display_header('');
$items = [
[

Loading…
Cancel
Save