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