dolibarr 19.0.3
ticket.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2012-2023 Charlene BENKE <charlene@patas-monkey.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
27require '../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php';
29require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
30if (isModEnabled('project')) {
31 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
32}
33
34require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
36require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
37
38$langs->loadLangs(array('companies', 'contracts', 'tickets'));
39
40$socid=GETPOST('socid', 'int');
41$id=GETPOST('id', 'int');
42$ref=GETPOST('ref', 'alpha');
43$action=GETPOST('action', 'alpha');
44
45if ($id == '' && $ref == '') {
46 dol_print_error('', 'Bad parameter');
47 exit;
48}
49
50// Security check
51$socid=0;
52if ($user->socid > 0) {
53 $socid=$user->socid;
54}
55
56$result=restrictedArea($user, 'contrat', $id);
57
58
59/*
60 * View
61 */
62
63llxHeader("", $langs->trans("Tickets"), "Contrat");
64
65$form = new Form($db);
66$userstatic=new User($db);
67
68$object= new Contrat($db);
69$result=$object->fetch($id, $ref);
70$ret=$object->fetch_thirdparty();
71$head = contract_prepare_head($object);
72
73
74dol_fiche_head($head, 'ticket', $langs->trans("Contract"), -1, 'contract');
75
76$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid) ? '?socid='.$socid : '').'">';
77$linkback.= $langs->trans("BackToList").'</a>';
78
79$morehtmlref='';
80$morehtmlref.=$object->ref;
81
82$morehtmlref.='<div class="refidno">';
83// Ref customer
84$morehtmlref.=$form->editfieldkey(
85 "RefCustomer",
86 'ref_customer',
87 $object->ref_customer,
88 $object,
89 0,
90 'string',
91 '',
92 0,
93 1
94);
95$morehtmlref.=$form->editfieldval(
96 "RefCustomer",
97 'ref_customer',
98 $object->ref_customer,
99 $object,
100 0,
101 'string',
102 '',
103 null,
104 null,
105 '',
106 1
107);
108// Ref supplier
109$morehtmlref.='<br>';
110$morehtmlref.=$form->editfieldkey(
111 "RefSupplier",
112 'ref_supplier',
113 $object->ref_supplier,
114 $object,
115 0,
116 'string',
117 '',
118 0,
119 1
120);
121$morehtmlref.=$form->editfieldval(
122 "RefSupplier",
123 'ref_supplier',
124 $object->ref_supplier,
125 $object,
126 0,
127 'string',
128 '',
129 null,
130 null,
131 '',
132 1
133);
134// Thirdparty
135$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
136// Project
137if (! empty($conf->projet->enabled)) {
138 require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
139
140 $langs->load("projects");
141 $morehtmlref.='<br>'.$langs->trans('Project') . ' : ';
142 if (! empty($object->fk_project)) {
143 $proj = new Project($db);
144 $proj->fetch($object->fk_project);
145 $morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=';
146 $morehtmlref.=$object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
147 $morehtmlref.=$proj->ref;
148 $morehtmlref.='</a>';
149 } else {
150 $morehtmlref.='';
151 }
152}
153$morehtmlref.='</div>';
154
155dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref);
156
157print '<div class="underbanner clearboth"></div>';
158
159
160/*
161 * Referers types
162 */
163
164$title=$langs->trans("ListTicketsLinkToContract");
165
166print '<table class="noborder" width="100%">';
167print '<tr class="liste_titre">';
168print '<td >'.$langs->trans("Ref").'</td>';
169print '<td width="300">'.$langs->trans("Subject").'</td>';
170print '<td align="left">'.$langs->trans("Type").'</td>';
171print '<td align="left" nowrap >'.$langs->trans("TicketCategory").'</td>';
172print '<td align="left">'.$langs->trans("Severity").'</td>';
173print '<td align="center">'.$langs->trans("Date").'</td>';
174print '<td align="center" nowrap >'.$langs->trans("DateEnd").'</td>';
175print '<td align="right">'.$langs->trans("Progress").'</td>';
176print '<td align="right" width="100">'.$langs->trans("Status").'</td>';
177print '</tr>';
178// on récupère la totalité des tickets liés au contrat
179$allticketarray = $object->getTicketsArray();
180if (is_array($allticketarray) && count($allticketarray) > 0) {
181 foreach ($allticketarray as $key => $value) {
182 $total_ht = 0;
183 $total_ttc = 0;
184
185 $element = $value;
186
187 print "<tr>";
188
189 // Ref
190 print '<td align="left">';
191 print $element->getNomUrl(1);
192 print "</td>\n";
193
194 // Information
195 print '<td align="left">'.$value->subject.'</td>';
196 print '<td align="left">'.$value->type_label.'</td>';
197 print '<td align="left">'.$value->category_label.'</td>';
198 print '<td align="left">'.$value->severity_label.'</td>';
199
200 // Date
201 print '<td align="center">'.dol_print_date($element->datec, 'day').'</td>';
202 print '<td align="center">'.dol_print_date($element->date_close, 'day').'</td>';
203
204 // Duration
205 print '<td align="right">';
206 print(isset($element->progress) ? $element->progress.'%' : '');
207 print '</td>';
208
209 // Status
210 print '<td align="right">'.$element->getLibStatut(5).'</td>';
211 print '</tr>';
212 }
213}
214print "</table>";
215
216
217llxFooter();
218$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage contracts.
Class to manage generation of HTML components Only common components must be here.
Class to manage projects.
Class to manage Dolibarr users.
contract_prepare_head(Contrat $object)
Prepare array with list of tabs.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tab header of a card.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.