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