|
@@ -142,6 +142,11 @@ if ($id > 0 && $removeelem > 0) {
|
|
|
$tmpobject = new User($db);
|
|
|
$result = $tmpobject->fetch($removeelem);
|
|
|
$elementtype = 'user';
|
|
|
+ } elseif ($type == Categorie::TYPE_TICKET && $user->rights->ticket->write) {
|
|
|
+ require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
|
|
|
+ $tmpobject = new Ticket($db);
|
|
|
+ $result = $tmpobject->fetch($removeelem);
|
|
|
+ $elementtype = 'ticket';
|
|
|
}
|
|
|
|
|
|
$result = $object->del_type($tmpobject, $elementtype);
|
|
@@ -167,7 +172,8 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi
|
|
|
if ($elemid && $action == 'addintocategory' &&
|
|
|
(($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) ||
|
|
|
($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) ||
|
|
|
- ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer)
|
|
|
+ ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) ||
|
|
|
+ ($type == Categorie::TYPE_TICKET && $user->rights->ticket->write)
|
|
|
)) {
|
|
|
if ($type == Categorie::TYPE_PRODUCT) {
|
|
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
|
@@ -181,6 +187,10 @@ if ($elemid && $action == 'addintocategory' &&
|
|
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
|
|
$newobject = new Societe($db);
|
|
|
$elementtype = 'supplier';
|
|
|
+ } elseif ($type == Categorie::TYPE_TICKET) {
|
|
|
+ require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
|
|
|
+ $newobject = new Ticket($db);
|
|
|
+ $elementtype = 'ticket';
|
|
|
}
|
|
|
$result = $newobject->fetch($elemid);
|
|
|
|
|
@@ -1024,6 +1034,78 @@ if ($type == Categorie::TYPE_WAREHOUSE) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+if ($type == Categorie::TYPE_TICKET) {
|
|
|
+ $permission = ($user->rights->categorie->creer || $user->rights->categorie->creer);
|
|
|
+
|
|
|
+ $tickets = $object->getObjectsInCateg($type, 0, $limit, $offset);
|
|
|
+ if ($tickets < 0) {
|
|
|
+ dol_print_error($db, $object->error, $object->errors);
|
|
|
+ } else {
|
|
|
+ // Form to add record into a category
|
|
|
+ $showclassifyform = 1;
|
|
|
+ if ($showclassifyform) {
|
|
|
+ print '<br>';
|
|
|
+ print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
|
|
+ print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
+ print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
|
|
+ print '<input type="hidden" name="type" value="'.$typeid.'">';
|
|
|
+ print '<input type="hidden" name="id" value="'.$object->id.'">';
|
|
|
+ print '<input type="hidden" name="action" value="addintocategory">';
|
|
|
+ print '<table class="noborder centpercent">';
|
|
|
+ print '<tr class="liste_titre"><td>';
|
|
|
+ print $langs->trans("AddTicketIntoCategory").' ';
|
|
|
+ $form->selectTickets('', 'elemid');
|
|
|
+ print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
|
|
|
+ print '</tr>';
|
|
|
+ print '</table>';
|
|
|
+ print '</form>';
|
|
|
+ }
|
|
|
+
|
|
|
+ print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
|
|
+ print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
+ print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
|
|
+ print '<input type="hidden" name="type" value="'.$typeid.'">';
|
|
|
+ print '<input type="hidden" name="id" value="'.$object->id.'">';
|
|
|
+ print '<input type="hidden" name="action" value="list">';
|
|
|
+
|
|
|
+ print '<br>';
|
|
|
+ $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($tickets); $nbtotalofrecords = ''; $newcardbutton = '';
|
|
|
+ print_barre_liste($langs->trans("Ticket"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'ticket', 0, $newcardbutton, '', $limit);
|
|
|
+
|
|
|
+
|
|
|
+ print '<table class="noborder centpercent">'."\n";
|
|
|
+ print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Ref").'</td></tr>'."\n";
|
|
|
+
|
|
|
+ if (count($tickets) > 0) {
|
|
|
+ $i = 0;
|
|
|
+ foreach ($tickets as $ticket) {
|
|
|
+ $i++;
|
|
|
+ if ($i > $limit) break;
|
|
|
+
|
|
|
+ print "\t".'<tr class="oddeven">'."\n";
|
|
|
+ print '<td class="nowrap" valign="top">';
|
|
|
+ print $ticket->getNomUrl(1);
|
|
|
+ print "</td>\n";
|
|
|
+ print '<td class="tdtop">'.$ticket->label."</td>\n";
|
|
|
+ // Link to delete from category
|
|
|
+ print '<td class="right">';
|
|
|
+ if ($permission) {
|
|
|
+ print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&removeelem=".$ticket->id."'>";
|
|
|
+ print $langs->trans("DeleteFromCat");
|
|
|
+ print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
|
|
|
+ print "</a>";
|
|
|
+ }
|
|
|
+ print '</td>';
|
|
|
+ print "</tr>\n";
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ print '<tr class="oddeven"><td colspan="2" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
|
|
|
+ }
|
|
|
+ print "</table>\n";
|
|
|
+
|
|
|
+ print '</form>'."\n";
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
// End of page
|
|
|
llxFooter();
|