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