diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index cf549eb8670..62bb2267283 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -89,6 +89,7 @@ CategorieRecursiv=Lier automatiquement avec le(a) tag/catégorie parent(e) CategorieRecursivHelp=Si l'option est activé, quand un produit est ajouté dans une sous-catégorie, le produit sera ajouté aussi dans la catégorie parente. AddProductServiceIntoCategory=Ajouter le produit/service suivant AddCustomerIntoCategory=Assigner cette catégorie au client +AddTicketIntoCategory=Assigner cette catégorie au ticket AddSupplierIntoCategory=Assigner cette catégorie au fournisseur ShowCategory=Afficher tag/catégorie ByDefaultInList=Par défaut dans la liste diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 4f0ddb962ca..67c4aaf2ed6 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -532,6 +532,16 @@ if (empty($reshook)) { } } + if ($action == 'set_categories' && $user->rights->ticket->write) { + if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { + $result = $object->setCategories(GETPOST('categories', 'array')); + + $url = 'card.php?action=view&track_id='.$object->track_id; + header("Location: ".$url); + exit(); + } + } + if ($action == 'setsubject' && $user->rights->ticket->write) { if ($object->fetch(GETPOST('id', 'int'))) { if ($action == 'setsubject') { @@ -787,7 +797,7 @@ if ($action == 'create' || $action == 'presend') { print $form->buttonsSaveCancel(); print ''; */ -} elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'presend' || $action == 'presend_addmessage' || $action == 'close' || $action == 'abandon' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen' +} elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'presend' || $action == 'presend_addmessage' || $action == 'close' || $action == 'abandon' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'categories' || $action == 'reopen' || $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') { if ($res > 0) { // or for unauthorized internals users @@ -1101,9 +1111,43 @@ if ($action == 'create' || $action == 'presend') { // Categories if ($conf->categorie->enabled) { - print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, Categorie::TYPE_TICKET, 1); - print ""; + print ''; + print ''; + print ''; + } + print '
'; + print $langs->trans("Categories"); + if ($action != 'categories' && !$user->socid) { + print ''.img_edit($langs->trans('Modify')).'
'; + print ''; + + if ($user->rights->ticket->write && $action == 'categories') { + $cate_arbo = $form->select_all_categories(Categorie::TYPE_TICKET, '', 'parent', 64, 0, 1); + if (count($cate_arbo)) { + // Categories + print ''; + print '
'; + print ''; + print ''; + print ''; + + $category = new Categorie($db); + $cats = $category->containing($object->id, 'ticket'); + $arrayselected = array(); + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } + + print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print ''; + print '
'; + print ""; + } + } else { + print ''; + print $form->showCategories($object->id, Categorie::TYPE_TICKET, 1); + print ""; + } } // Other attributes