dolibarr 22.0.5
card.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2018 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2011-2020 Juanjo Menent <jmenent@2byte.es>
6 * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
7 * Copyright (C) 2014-2018 Ferran Marcet <fmarcet@2byte.es>
8 * Copyright (C) 2014-2025 Charlene Benke <charlene@patas-monkey.com>
9 * Copyright (C) 2015-2016 Abbes Bahfir <bafbes@gmail.com>
10 * Copyright (C) 2018-2022 Philippe Grand <philippe.grand@atoo-net.com>
11 * Copyright (C) 2020-2025 Frédéric France <frederic.france@free.fr>
12 * Copyright (C) 2023 Benjamin Grembi <benjamin@oarces.fr>
13 * Copyright (C) 2023-2024 William Mead <william.mead@manchenumerique.fr>
14 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
15 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
16 * Copyright (C) 2025 Pierre Ardoin <developpeur@lesmetiersdubatiment.fr>
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 3 of the License, or
21 * (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program. If not, see <https://www.gnu.org/licenses/>.
30 */
31
38// Load Dolibarr environment
39require '../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
41require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
42require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php';
43require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php';
44require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
45if (isModEnabled('project')) {
46 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
47 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
48}
49if (isModEnabled('contract')) {
50 require_once DOL_DOCUMENT_ROOT."/core/class/html.formcontract.class.php";
51 require_once DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php";
52}
53if (getDolGlobalString('FICHEINTER_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/fichinter/mod_" . getDolGlobalString('FICHEINTER_ADDON').".php")) {
54 require_once DOL_DOCUMENT_ROOT."/core/modules/fichinter/mod_" . getDolGlobalString('FICHEINTER_ADDON').'.php';
55}
56require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
57require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
58
67// Load translation files required by the page
68$langs->loadLangs(array('bills', 'companies', 'interventions', 'stocks'));
69
70$id = GETPOSTINT('id');
71$ref = GETPOST('ref', 'alpha');
72$ref_client = GETPOST('ref_client', 'alpha');
73$socid = GETPOSTINT('socid');
74$contratid = GETPOSTINT('contratid');
75$action = GETPOST('action', 'alpha');
76$cancel = GETPOST('cancel', 'alpha');
77$confirm = GETPOST('confirm', 'alpha');
78$backtopage = GETPOST('backtopage', 'alpha');
79
80$mesg = GETPOST('msg', 'alpha');
81$origin = GETPOST('origin', 'alpha');
82$originid = (GETPOSTINT('originid') ? GETPOSTINT('originid') : GETPOSTINT('origin_id')); // For backward compatibility
83$note_public = GETPOST('note_public', 'restricthtml');
84$note_private = GETPOST('note_private', 'restricthtml');
85$lineid = GETPOSTINT('line_id');
86
87$error = 0;
88
89//PDF
90$hidedetails = (GETPOSTINT('hidedetails') ? GETPOSTINT('hidedetails') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0));
91$hidedesc = (GETPOSTINT('hidedesc') ? GETPOSTINT('hidedesc') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0));
92$hideref = (GETPOSTINT('hideref') ? GETPOSTINT('hideref') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0));
93
94// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
95$hookmanager->initHooks(array('interventioncard', 'globalcard'));
96
97$object = new Fichinter($db);
98$extrafields = new ExtraFields($db);
99$objectsrc = null;
100
101$extrafields->fetch_name_optionals_label($object->table_element);
102
103// Load object
104if ($id > 0 || !empty($ref)) {
105 $ret = $object->fetch($id, $ref);
106 if ($ret > 0) {
107 $id = $object->id; // The page may be called with the ref only: the security check must be done on the object found
108 $ret = $object->fetch_thirdparty();
109 }
110 if ($ret < 0) {
111 dol_print_error(null, $object->error);
112 }
113}
114
115// Security check
116if ($user->socid) {
117 $socid = $user->socid;
118}
119$result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
120
121$permissionnote = $user->hasRight('ficheinter', 'creer'); // Used by the include of actions_setnotes.inc.php
122$permissiondellink = $user->hasRight('ficheinter', 'creer'); // Used by the include of actions_dellink.inc.php
123$permissiontodelete = (($object->status == Fichinter::STATUS_DRAFT && $user->hasRight('ficheinter', 'creer')) || $user->hasRight('ficheinter', 'supprimer'));
124$permissiontoadd = $user->hasRight('ficheinter', 'creer');
125$permissiontoeditextra = $permissiontoadd;
126if (GETPOST('attribute', 'aZ09') && isset($extrafields->attributes[$object->table_element]['perms'][GETPOST('attribute', 'aZ09')])) {
127 // For action 'update_extras', is there a specific permission set for the attribute to update
128 $permissiontoeditextra = dol_eval((string) $extrafields->attributes[$object->table_element]['perms'][GETPOST('attribute', 'aZ09')]);
129}
130
131
132/*
133 * Actions
134 */
135
136$parameters = array('socid' => $socid);
137$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
138if ($reshook < 0) {
139 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
140}
141
142if (empty($reshook)) {
143 $backurlforlist = DOL_URL_ROOT.'/fichinter/list.php';
144
145 if (empty($backtopage) || ($cancel && empty($id))) {
146 if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
147 if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
148 $backtopage = $backurlforlist;
149 } else {
150 $backtopage = DOL_URL_ROOT.'/fichinter/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
151 }
152 }
153 }
154
155 if ($cancel) {
156 if (!empty($backtopageforcancel)) {
157 header("Location: ".$backtopageforcancel);
158 exit;
159 } elseif (!empty($backtopage)) {
160 header("Location: ".$backtopage);
161 exit;
162 }
163 $action = '';
164 }
165
166 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be 'include', not 'include_once'
167
168 include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once'
169
170 // Action clone object
171 if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd) {
172 if (false && !GETPOST('clone_content') && !GETPOST('clone_receivers')) {
173 setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
174 } else {
175 if ($object->id > 0) {
176 // Because createFromClone modifies the object, we must clone it so that we can restore it later
177 $orig = clone $object;
178 $clone_notes = false;
179 if (GETPOSTISSET('clone_notes') && GETPOST('clone_notes') === 'on') {
180 $clone_notes = true;
181 }
182 $clone_contacts = false;
183 if (GETPOSTISSET('clone_contacts') && GETPOST('clone_contacts') === 'on') {
184 $clone_contacts = true;
185 }
186
187 $result = $object->createFromClone($user, $socid, $clone_contacts, $clone_notes);
188 if ($result > 0) {
189 header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
190 exit;
191 } else {
192 setEventMessages($object->error, $object->errors, 'errors');
193 $object = $orig;
194 $action = '';
195 }
196 }
197 }
198 }
199
200 if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) {
201 $result = $object->setValid($user);
202
203 if ($result >= 0) {
204 if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
205 // Define output language
206 $outputlangs = $langs;
207 $newlang = '';
208 if (getDolGlobalInt('MAIN_MULTILANGS') /* && empty($newlang) */ && GETPOST('lang_id', 'aZ09')) {
209 $newlang = GETPOST('lang_id', 'aZ09');
210 }
211 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
212 $newlang = $object->thirdparty->default_lang;
213 }
214 if (!empty($newlang)) {
215 $outputlangs = new Translate("", $conf);
216 $outputlangs->setDefaultLang($newlang);
217 }
218 $result = fichinter_create($db, $object, (!GETPOST('model', 'alpha')) ? $object->model_pdf : GETPOST('model', 'alpha'), $outputlangs);
219 }
220
221 header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
222 exit;
223 } else {
224 $mesg = $object->error;
225 }
226 } elseif ($action == 'confirm_sign' && $confirm == 'yes' && $permissiontoadd) {
227 $result = $object->setSignedStatus($user, GETPOSTINT('signed_status'), 0, 'FICHINTER_MODIFY');
228 if ($result >= 0) {
229 if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
230 // Define output language
231 $outputlangs = $langs;
232 $newlang = '';
233 if (getDolGlobalInt('MAIN_MULTILANGS') /* && empty($newlang) */ && GETPOST('lang_id', 'aZ09')) {
234 $newlang = GETPOST('lang_id', 'aZ09');
235 }
236 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
237 $newlang = $object->thirdparty->default_lang;
238 }
239 if (!empty($newlang)) {
240 $outputlangs = new Translate("", $conf);
241 $outputlangs->setDefaultLang($newlang);
242 }
243 $result = fichinter_create($db, $object, (!GETPOST('model', 'alpha')) ? $object->model_pdf : GETPOST('model', 'alpha'), $outputlangs);
244 }
245
246 header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
247 exit;
248 } else {
249 $mesg = $object->error;
250 }
251 } elseif ($action == 'confirm_unsign' && $confirm == 'yes' && $permissiontoadd) {
252 $result = $object->setSignedStatus($user, Fichinter::$SIGNED_STATUSES['STATUS_NO_SIGNATURE'], 0, 'FICHINTER_MODIFY');
253 if ($result >= 0) {
254 if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
255 // Define output language
256 $outputlangs = $langs;
257 $newlang = '';
258 if (getDolGlobalInt('MAIN_MULTILANGS') /* && empty($newlang) */ && GETPOST('lang_id', 'aZ09')) {
259 $newlang = GETPOST('lang_id', 'aZ09');
260 }
261 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
262 $newlang = $object->thirdparty->default_lang;
263 }
264 if (!empty($newlang)) {
265 $outputlangs = new Translate("", $conf);
266 $outputlangs->setDefaultLang($newlang);
267 }
268 $result = fichinter_create($db, $object, (!GETPOST('model', 'alpha')) ? $object->model_pdf : GETPOST('model', 'alpha'), $outputlangs);
269 }
270
271 header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
272 exit;
273 } else {
274 $mesg = $object->error;
275 }
276 } elseif ($action == 'confirm_modify' && $confirm == 'yes' && $permissiontoadd) {
277 $result = $object->setDraft($user);
278 if ($result >= 0) {
279 if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
280 // Define output language
281 $outputlangs = $langs;
282 $newlang = '';
283 if (getDolGlobalInt('MAIN_MULTILANGS') /* && empty($newlang) */ && GETPOST('lang_id', 'aZ09')) {
284 $newlang = GETPOST('lang_id', 'aZ09');
285 }
286 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
287 $newlang = $object->thirdparty->default_lang;
288 }
289 if (!empty($newlang)) {
290 $outputlangs = new Translate("", $conf);
291 $outputlangs->setDefaultLang($newlang);
292 }
293 $result = fichinter_create($db, $object, (!GETPOST('model', 'alpha')) ? $object->model_pdf : GETPOST('model', 'alpha'), $outputlangs);
294 }
295
296 header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
297 exit;
298 } else {
299 $mesg = $object->error;
300 }
301 } elseif ($action == 'confirm_done' && $confirm == 'yes' && $permissiontoadd) {
302 $result = $object->setClose($user);
303
304 if ($result >= 0) {
305 if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
306 // Define output language
307 $outputlangs = $langs;
308 $newlang = '';
309 if (getDolGlobalInt('MAIN_MULTILANGS') /* && empty($newlang) */ && GETPOST('lang_id', 'aZ09')) {
310 $newlang = GETPOST('lang_id', 'aZ09');
311 }
312 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
313 $newlang = $object->thirdparty->default_lang;
314 }
315 if (!empty($newlang)) {
316 $outputlangs = new Translate("", $conf);
317 $outputlangs->setDefaultLang($newlang);
318 }
319 $result = fichinter_create($db, $object, (!GETPOST('model', 'alpha')) ? $object->model_pdf : GETPOST('model', 'alpha'), $outputlangs);
320 }
321
322 header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
323 exit;
324 } else {
325 $mesg = $object->error;
326 }
327 } elseif ($action == 'add' && $permissiontoadd) {
328 $selectedLines = GETPOST('toselect', 'array');
329 $object->socid = $socid;
330 $object->duration = GETPOSTINT('duration');
331 $object->fk_project = GETPOSTINT('projectid');
332 $object->fk_contrat = GETPOSTINT('contratid');
333 $object->user_author_id = $user->id;
334 $object->description = GETPOST('description', 'restricthtml');
335 $object->ref = $ref;
336 $object->ref_client = $ref_client;
337 $object->model_pdf = GETPOST('model', 'alpha');
338 $object->note_private = GETPOST('note_private', 'restricthtml');
339 $object->note_public = GETPOST('note_public', 'restricthtml');
340
341 if ($object->socid > 0) {
342 // If creation from another object of another module (Example: origin=propal, originid=1)
343 if (!empty($origin) && !empty($originid)) {
344 // Parse element/subelement (ex: project_task)
345 $regs = array();
346 $element = $subelement = GETPOST('origin', 'alphanohtml');
347 if (preg_match('/^([^_]+)_([^_]+)/i', GETPOST('origin', 'alphanohtml'), $regs)) {
348 $element = $regs[1];
349 $subelement = $regs[2];
350 }
351
352 // For compatibility
353 if ($element == 'order') {
354 $element = $subelement = 'commande';
355 }
356 if ($element == 'propal') {
357 $element = 'comm/propal';
358 $subelement = 'propal';
359 }
360 if ($element == 'contract') {
361 $element = $subelement = 'contrat';
362 }
363
364 $object->origin = $origin;
365 $object->origin_id = $originid;
366
367 // Possibility to add external linked objects with hooks
368 $object->linked_objects[$object->origin] = $object->origin_id;
369 if (GETPOSTISARRAY('other_linked_objects')) {
370 $object->linked_objects = array_merge($object->linked_objects, GETPOST('other_linked_objects', 'array:int'));
371 }
372
373 // Extrafields
374
375 // Fill array 'array_options' with data from add form
376 $ret = $extrafields->setOptionalsFromPost(null, $object);
377 if ($ret < 0) {
378 $error++;
379 $action = 'create';
380 }
381 //$array_options = $extrafields->getOptionalsFromPost($object->table_element);
382
383 //$object->array_options = $array_options;
384
385 $id = $object->create($user);
386
387 if ($id > 0) {
388 dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
389
390 $classname = ucfirst($subelement);
391 $srcobject = new $classname($db);
392 '@phan-var-force Commande|Propal|Contrat $srcobject'; // Can be other class, but CommonObject is too generic
395 dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines");
396 $result = $srcobject->fetch($object->origin_id);
397 if ($result > 0) {
398 $srcobject->fetch_thirdparty();
399 $lines = $srcobject->lines;
400 if (empty($lines) && method_exists($srcobject, 'fetch_lines')) {
401 $srcobject->fetch_lines();
402 $lines = $srcobject->lines;
403 }
404
405 if (is_array($lines)) {
406 $num = count($lines);
407
408 for ($i = 0; $i < $num; $i++) {
409 if (!in_array($lines[$i]->id, $selectedLines)) {
410 continue; // Skip unselected lines
411 }
412
413 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : Product::TYPE_PRODUCT);
414
415 if ($product_type == Product::TYPE_SERVICE || getDolGlobalString('FICHINTER_PRINT_PRODUCTS')) { //only services except if config includes products
416 $duration = 3600; // Default to one hour
417 $desc = '';
418 // Predefined products & services
419 if ($lines[$i]->fk_product > 0) {
420 $prod = new Product($db);
421 $prod->id = $lines[$i]->fk_product;
422
423 // Define output language
424 if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) {
425 $prod->getMultiLangs();
426 // We show if duration is present on service (so we get it)
427 $prod->fetch($lines[$i]->fk_product);
428 $outputlangs = $langs;
429 $newlang = '';
430 if (/* empty($newlang) && */ GETPOST('lang_id', 'aZ09')) {
431 $newlang = GETPOST('lang_id', 'aZ09');
432 }
433 if (empty($newlang)) {
434 $newlang = $srcobject->thirdparty->default_lang;
435 }
436 if (!empty($newlang)) {
437 $outputlangs = new Translate("", $conf);
438 $outputlangs->setDefaultLang($newlang);
439 }
440 $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $lines[$i]->product_label;
441 } else {
442 $prod->fetch($lines[$i]->fk_product);
443 $label = $lines[$i]->product_label;
444 }
445
446 if ($prod->duration_value && $conf->global->FICHINTER_USE_SERVICE_DURATION) {
447 switch ($prod->duration_unit) {
448 default:
449 case 'h':
450 $mult = 3600;
451 break;
452 case 'd':
453 $mult = 3600 * 24;
454 break;
455 case 'w':
456 $mult = 3600 * 24 * 7;
457 break;
458 case 'm':
459 $mult = (int) (3600 * 24 * (365 / 12)); // Average month duration
460 break;
461 case 'y':
462 $mult = 3600 * 24 * 365;
463 break;
464 }
465 $duration = (int) $prod->duration_value * $mult * $lines[$i]->qty;
466 }
467
468 $desc = $lines[$i]->product_ref;
469 $desc .= ' - ';
470 $desc .= $label;
471 $desc .= '<br>';
472 }
473 // Common part (predefined or free line)
474 $desc .= dol_htmlentitiesbr($lines[$i]->desc);
475 $desc .= '<br>';
476 $desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')';
477
478 $timearray = dol_getdate(dol_now());
479 $date_intervention = dol_mktime(0, 0, 0, $timearray['mon'], $timearray['mday'], $timearray['year']);
480
481 if ($product_type == Product::TYPE_PRODUCT) {
482 $duration = 0;
483 }
484
485 $predef = '';
486
487 // Extrafields
488 $extrafields->fetch_name_optionals_label($object->table_element_line);
489 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line, $predef);
490
491 $result = $object->addline(
492 $user,
493 $id,
494 $desc,
495 $date_intervention,
496 $duration,
497 $array_options
498 );
499
500 if ($result < 0) {
501 $error++;
502 break;
503 }
504 }
505 }
506 }
507 } else {
508 $langs->load("errors");
509 setEventMessages($srcobject->error, $srcobject->errors, 'errors');
510 $action = 'create';
511 $error++;
512 }
513 } else {
514 $langs->load("errors");
515 setEventMessages($object->error, $object->errors, 'errors');
516 $action = 'create';
517 $error++;
518 }
519 } else {
520 // Fill array 'array_options' with data from add form
521 $ret = $extrafields->setOptionalsFromPost(null, $object);
522 if ($ret < 0) {
523 $error++;
524 $action = 'create';
525 }
526
527 if (!$error) {
528 // Extrafields
529 $array_options = $extrafields->getOptionalsFromPost($object->table_element);
530
531 $object->array_options = $array_options;
532
533 $result = $object->create($user);
534 if ($result > 0) {
535 $id = $result; // Force raffraichissement sur fiche venant d'etre cree
536 } else {
537 $langs->load("errors");
538 setEventMessages($object->error, $object->errors, 'errors');
539 $action = 'create';
540 $error++;
541 }
542 }
543 }
544 } else {
545 $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty"));
546 $action = 'create';
547 $error++;
548 }
549 } elseif ($action == 'update' && $permissiontoadd) {
550 $object->socid = $socid;
551 $object->fk_project = GETPOSTINT('projectid');
552 $object->fk_contrat = GETPOSTINT('contratid');
553 $object->user_author_id = $user->id;
554 $object->description = GETPOST('description', 'restricthtml');
555 $object->ref = $ref;
556 $object->ref_client = $ref_client;
557
558 $result = $object->update($user);
559 if ($result < 0) {
560 setEventMessages($object->error, $object->errors, 'errors');
561 }
562 } elseif ($action == 'classin' && $permissiontoadd) {
563 // Set into a project
564 $result = $object->setProject(GETPOSTINT('projectid'));
565 if ($result < 0) {
566 dol_print_error($db, $object->error);
567 }
568 } elseif ($action == 'setcontract' && $permissiontoadd) {
569 // Set into a contract
570 $result = $object->set_contrat($user, GETPOSTINT('contratid'));
571 if ($result < 0) {
572 dol_print_error($db, $object->error);
573 }
574 } elseif ($action == 'setref_client' && $permissiontoadd) {
575 // Positionne ref client
576 $result = $object->setRefClient($user, GETPOST('ref_client', 'alpha'));
577 if ($result < 0) {
578 setEventMessages($object->error, $object->errors, 'errors');
579 }
580 } elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('ficheinter', 'supprimer')) {
581 $result = $object->delete($user);
582 if ($result < 0) {
583 setEventMessages($object->error, $object->errors, 'errors');
584 }
585
586 header('Location: '.DOL_URL_ROOT.'/fichinter/list.php?leftmenu=ficheinter&restore_lastsearch_values=1');
587 exit;
588 } elseif ($action == 'setdescription' && $permissiontoadd) {
589 $result = $object->set_description($user, GETPOST('description'));
590 if ($result < 0) {
591 dol_print_error($db, $object->error);
592 }
593 } elseif ($action == "addline" && $permissiontoadd) {
594 // Add line
595 if (!GETPOST('np_desc', 'restricthtml') && !getDolGlobalString('FICHINTER_EMPTY_LINE_DESC')) {
596 $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description"));
597 $error++;
598 }
599 if (!getDolGlobalString('FICHINTER_WITHOUT_DURATION') && !GETPOSTINT('durationhour') && !GETPOSTINT('durationmin')) {
600 $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Duration"));
601 $error++;
602 }
603 if (!getDolGlobalString('FICHINTER_WITHOUT_DURATION') && GETPOSTINT('durationhour') >= 24 && GETPOSTINT('durationmin') > 0) {
604 $mesg = $langs->trans("ErrorValueTooHigh");
605 $error++;
606 }
607 if (!$error) {
608 $db->begin();
609
610 $desc = GETPOST('np_desc', 'restricthtml');
611 $date_intervention = dol_mktime(GETPOSTINT('dihour'), GETPOSTINT('dimin'), 0, GETPOSTINT('dimonth'), GETPOSTINT('diday'), GETPOSTINT('diyear'));
612 $duration = !getDolGlobalString('FICHINTER_WITHOUT_DURATION') ? convertTime2Seconds(GETPOSTINT('durationhour'), GETPOSTINT('durationmin')) : 0;
613
614 // Extrafields
615 $extrafields->fetch_name_optionals_label($object->table_element_line);
616 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
617
618 $result = $object->addline(
619 $user,
620 $id,
621 $desc,
622 $date_intervention,
623 $duration,
624 $array_options
625 );
626
627 // Define output language
628 $outputlangs = $langs;
629 $newlang = '';
630 if (getDolGlobalInt('MAIN_MULTILANGS') /* && empty($newlang) */ && GETPOST('lang_id', 'aZ09')) {
631 $newlang = GETPOST('lang_id', 'aZ09');
632 }
633 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
634 $newlang = $object->thirdparty->default_lang;
635 }
636 if (!empty($newlang)) {
637 $outputlangs = new Translate("", $conf);
638 $outputlangs->setDefaultLang($newlang);
639 }
640
641 if ($result >= 0) {
642 $db->commit();
643
644 if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
645 fichinter_create($db, $object, $object->model_pdf, $outputlangs);
646 }
647 header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
648 exit;
649 } else {
650 $mesg = $object->error;
651 $db->rollback();
652 }
653 }
654 } elseif ($action == 'classifybilled' && $permissiontoadd) {
655 // Classify Billed
656 $result = $object->setStatut(Fichinter::STATUS_BILLED);
657 if ($result > 0) {
658 header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
659 exit;
660 } else {
661 setEventMessages($object->error, $object->errors, 'errors');
662 }
663 } elseif ($action == 'classifyunbilled' && $permissiontoadd) {
664 // Classify unbilled
665 $result = $object->setStatut(Fichinter::STATUS_VALIDATED);
666 if ($result > 0) {
667 header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
668 exit;
669 } else {
670 $mesg = $object->error;
671 }
672 } elseif ($action == 'confirm_reopen' && $permissiontoadd) {
673 // Reopen
674 $result = $object->setStatut(Fichinter::STATUS_VALIDATED);
675 if ($result > 0) {
676 header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
677 exit;
678 } else {
679 $mesg = $object->error;
680 }
681 } elseif ($action == 'updateline' && $permissiontoadd && GETPOST('save', 'alpha')) {
682 // Mise a jour d'une ligne d'intervention
683 $objectline = new FichinterLigne($db);
684 if ($objectline->fetch($lineid) <= 0) {
685 dol_print_error($db);
686 exit;
687 }
688
689 if ($object->fetch($objectline->fk_fichinter) <= 0) {
690 dol_print_error($db);
691 exit;
692 }
693 $object->fetch_thirdparty();
694
695 $desc = GETPOST('np_desc', 'restricthtml');
696 $date_inter = dol_mktime(GETPOSTINT('dihour'), GETPOSTINT('dimin'), 0, GETPOSTINT('dimonth'), GETPOSTINT('diday'), GETPOSTINT('diyear'));
697 $duration = convertTime2Seconds(GETPOSTINT('durationhour'), GETPOSTINT('durationmin'));
698
699 $objectline->date = $date_inter;
700 $objectline->desc = $desc;
701 $objectline->duration = $duration;
702
703 // Extrafields
704 $extrafields->fetch_name_optionals_label($object->table_element_line);
705 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
706 if (is_array($array_options)) {
707 $objectline->array_options = array_merge($objectline->array_options, $array_options);
708 }
709
710 $result = $objectline->update($user);
711 if ($result < 0) {
712 // Surface validation errors (e.g. mandatory extrafield left empty) as an
713 // event message on the same page instead of breaking with a full Dolibarr
714 // error screen that loses the user's edit context.
715 setEventMessages($objectline->error, $objectline->errors, 'errors');
716 }
717
718 // Define output language
719 $outputlangs = $langs;
720 $newlang = '';
721 if (getDolGlobalInt('MAIN_MULTILANGS') /* && empty($newlang) */ && GETPOST('lang_id', 'aZ09')) {
722 $newlang = GETPOST('lang_id', 'aZ09');
723 }
724 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
725 $newlang = $object->thirdparty->default_lang;
726 }
727 if (!empty($newlang)) {
728 $outputlangs = new Translate("", $conf);
729 $outputlangs->setDefaultLang($newlang);
730 }
731 if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
732 fichinter_create($db, $object, $object->model_pdf, $outputlangs);
733 }
734
735 header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
736 exit;
737 } elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $permissiontoadd) {
738 // Supprime une ligne d'intervention AVEC confirmation
739 $objectline = new FichinterLigne($db);
740 if ($objectline->fetch($lineid) <= 0) {
741 dol_print_error($db);
742 exit;
743 }
744 $result = $objectline->deleteLine($user);
745
746 if ($object->fetch($objectline->fk_fichinter) <= 0) {
747 dol_print_error($db);
748 exit;
749 }
750
751 // Define output language
752 $outputlangs = $langs;
753 $newlang = '';
754 if (getDolGlobalInt('MAIN_MULTILANGS') /* && empty($newlang) */ && GETPOST('lang_id', 'aZ09')) {
755 $newlang = GETPOST('lang_id', 'aZ09');
756 }
757 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
758 $newlang = $object->thirdparty->default_lang;
759 }
760 if (!empty($newlang)) {
761 $outputlangs = new Translate("", $conf);
762 $outputlangs->setDefaultLang($newlang);
763 }
764 if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
765 fichinter_create($db, $object, $object->model_pdf, $outputlangs);
766 }
767 } elseif ($action == 'up' && $permissiontoadd) {
768 // Set position of lines
769 $object->line_up($lineid);
770
771 // Define output language
772 $outputlangs = $langs;
773 $newlang = '';
774 if (getDolGlobalInt('MAIN_MULTILANGS') /* && empty($newlang) */ && GETPOST('lang_id', 'aZ09')) {
775 $newlang = GETPOST('lang_id', 'aZ09');
776 }
777 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
778 $newlang = $object->thirdparty->default_lang;
779 }
780 if (!empty($newlang)) {
781 $outputlangs = new Translate("", $conf);
782 $outputlangs->setDefaultLang($newlang);
783 }
784 if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
785 fichinter_create($db, $object, $object->model_pdf, $outputlangs);
786 }
787
788 header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.$lineid);
789 exit;
790 } elseif ($action == 'down' && $permissiontoadd) {
791 $object->line_down($lineid);
792
793 // Define output language
794 $outputlangs = $langs;
795 $newlang = '';
796 if (getDolGlobalInt('MAIN_MULTILANGS') /* && empty($newlang) */ && GETPOST('lang_id', 'aZ09')) {
797 $newlang = GETPOST('lang_id', 'aZ09');
798 }
799 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
800 $newlang = $object->thirdparty->default_lang;
801 }
802 if (!empty($newlang)) {
803 $outputlangs = new Translate("", $conf);
804 $outputlangs->setDefaultLang($newlang);
805 }
806 if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
807 fichinter_create($db, $object, $object->model_pdf, $outputlangs);
808 }
809
810 header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.$lineid);
811 exit;
812 }
813
814 // Actions when printing a doc from card
815 include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
816
817 // Actions to send emails
818 $triggersendname = 'FICHINTER_SENTBYMAIL';
819 $autocopy = 'MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
820 $trackid = 'int'.$object->id;
821 include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
822
823 // Actions to build doc
824 $upload_dir = getMultidirOutput($object);
825 $permissiontoadd = $user->hasRight('ficheinter', 'creer');
826 include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
827
828 if ($action == 'update_extras' && $permissiontoeditextra) {
829 $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
830
831 $attribute_name = GETPOST('attribute', 'aZ09');
832
833 // Fill array 'array_options' with data from update form
834 $ret = $extrafields->setOptionalsFromPost(null, $object, $attribute_name);
835 if ($ret < 0) {
836 $error++;
837 }
838
839 if (!$error) {
840 // Actions on extra fields
841 $result = $object->updateExtraField($attribute_name, 'FICHINTER_MODIFY');
842 if ($result < 0) {
843 setEventMessages($object->error, $object->errors, 'errors');
844 $error++;
845 }
846 }
847
848 if ($error) {
849 $action = 'edit_extras';
850 }
851 }
852
853 if (getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) {
854 if ($action == 'addcontact' && $permissiontoadd) {
855 if ($result > 0 && $id > 0) {
856 $contactid = (GETPOSTINT('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid'));
857 $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
858 $result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
859 }
860
861 if ($result >= 0) {
862 header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
863 exit;
864 } else {
865 if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
866 $langs->load("errors");
867 $mesg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
868 } else {
869 $mesg = $object->error;
870 }
871 }
872 } elseif ($action == 'swapstatut' && $permissiontoadd) {
873 // bascule du statut d'un contact
874 $result = $object->swapContactStatus(GETPOSTINT('ligne'));
875 } elseif ($action == 'deletecontact' && $permissiontoadd) {
876 // Efface un contact
877 $result = $object->delete_contact(GETPOSTINT('lineid'));
878
879 if ($result >= 0) {
880 header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
881 exit;
882 } else {
883 dol_print_error($db);
884 }
885 }
886 }
887}
888
889
890/*
891 * View
892 */
893
894$form = new Form($db);
895$formfile = new FormFile($db);
896$formcontract = null;
897$formproject = null;
898if (isModEnabled('contract')) {
899 $formcontract = new FormContract($db);
900}
901if (isModEnabled('project')) {
902 $formproject = new FormProjets($db);
903}
904
905
906$help_url = 'EN:Module_Interventions';
907
908llxHeader('', $langs->trans("Intervention"), $help_url, '', 0, 0, '', '', '', 'mod-fichinter page-card');
909
910if ($action == 'create') {
911 // Create new intervention
912
913 $soc = new Societe($db);
914
915 print load_fiche_titre($langs->trans("AddIntervention"), '', 'intervention');
916
917 if ($error > 0) {
919 } else {
920 dol_htmloutput_mesg($mesg);
921 }
922
923 if ($socid) {
924 $res = $soc->fetch($socid);
925 }
926
927 if (GETPOST('origin', 'alphanohtml') && GETPOSTINT('originid')) {
928 // Parse element/subelement (ex: project_task)
929 $regs = array();
930 $element = $subelement = GETPOST('origin', 'alphanohtml');
931 if (preg_match('/^([^_]+)_([^_]+)/i', GETPOST('origin', 'alphanohtml'), $regs)) {
932 $element = $regs[1];
933 $subelement = $regs[2];
934 }
935
936 if ($element == 'project') {
937 $projectid = GETPOSTINT('originid');
938 } else {
939 // For compatibility
940 if ($element == 'order' || $element == 'commande') {
941 $element = $subelement = 'commande';
942 }
943 if ($element == 'propal') {
944 $element = 'comm/propal';
945 $subelement = 'propal';
946 }
947 if ($element == 'contract') {
948 $element = $subelement = 'contrat';
949 }
950
951 dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
952
953 $classname = ucfirst($subelement);
954 $objectsrc = new $classname($db);
955 '@phan-var-force Commande|Propal|Contrat $objectsrc';
956 $objectsrc->fetch(GETPOSTINT('originid'));
957 if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) {
958 $objectsrc->fetch_lines();
959 $lines = $objectsrc->lines;
960 }
961 $objectsrc->fetch_thirdparty();
962
963 $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');
964
965 $soc = $objectsrc->thirdparty;
966
967 $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private : GETPOST('note_private', 'restricthtml')));
968 $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public : GETPOST('note_public', 'restricthtml'));
969
970 // Replicate extrafields
971 $objectsrc->fetch_optionals();
972 $object->array_options = $objectsrc->array_options;
973
974 // Object source contacts list
975 $srccontactslist = $objectsrc->liste_contact(-1, 'external', 1);
976 }
977 } else {
978 $projectid = GETPOSTINT('projectid');
979 }
980
981 if (!$conf->global->FICHEINTER_ADDON) {
982 dol_print_error($db, $langs->trans("Error")." ".$langs->trans("Error_FICHEINTER_ADDON_NotDefined"));
983 exit;
984 }
985
986 $object->datec = dol_now();
987
988 $obj = getDolGlobalString('FICHEINTER_ADDON');
989 $obj = "mod_".$obj;
990
991 //$modFicheinter = new $obj;
992 //$numpr = $modFicheinter->getNextValue($soc, $object);
993
994 if ($socid > 0) {
995 $soc = new Societe($db);
996 $soc->fetch($socid);
997
998 print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
999 print '<input type="hidden" name="token" value="'.newToken().'">';
1000 print '<input type="hidden" name="socid" value='.$soc->id.'>';
1001 print '<input type="hidden" name="action" value="add">';
1002 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
1003
1004 print dol_get_fiche_head([]);
1005
1006 print '<table class="border centpercent">';
1007
1008 print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("ThirdParty").'</td><td>'.$soc->getNomUrl(1).'</td></tr>';
1009
1010 // Ref
1011 print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td>'.$langs->trans("Draft").'</td></tr>';
1012
1013 // Ref customer
1014 print '<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans('RefCustomer').'</td><td class="valuefieldcreate">';
1015 print '<input type="text" name="ref_client" value="'.GETPOST('ref_client').'"></td>';
1016 print '</tr>';
1017
1018 // Description (must be a textarea and not html must be allowed (used in list view)
1019 print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
1020 print '<td>';
1021 print '<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.'">'.GETPOST('description').'</textarea>';
1022 print '</td></tr>';
1023
1024 // Project
1025 if (isModEnabled('project')) {
1026 $formproject = new FormProjets($db);
1027
1028 $langs->load("project");
1029
1030 print '<tr><td>'.$langs->trans("Project").'</td><td>';
1031 /* Fix: If a project must be linked to any companies (suppliers or not), project must be not be set as limited to customer but must be not linked to any particular thirdparty
1032 if ($societe->fournisseur==1)
1033 $numprojet=select_projects(-1, GETPOST("projectid", 'int'), 'projectid');
1034 else
1035 $numprojet=select_projects($societe->id, GETPOST("projectid", 'int'), 'projectid');
1036 */
1037 $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid');
1038 if ($numprojet == 0) {
1039 print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
1040 }
1041 print '</td></tr>';
1042 }
1043
1044 // Contract
1045 if (isModEnabled('contract') && is_object($formcontract)) {
1046 $langs->load("contracts");
1047 print '<tr><td>'.$langs->trans("Contract").'</td><td>';
1048 $numcontrat = $formcontract->select_contract($soc->id, GETPOSTINT('contratid'), 'contratid', 0, 1, 1);
1049 if ($numcontrat == 0) {
1050 print ' &nbsp; <a href="'.DOL_URL_ROOT.'/contrat/card.php?socid='.$soc->id.'&action=create"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddContract").'"></span></a>';
1051 }
1052 print '</td></tr>';
1053 }
1054
1055 // Model
1056 print '<tr>';
1057 print '<td>'.$langs->trans("DefaultModel").'</td>';
1058 print '<td>';
1060 print $form->selectarray('model', $liste, $conf->global->FICHEINTER_ADDON_PDF);
1061 print "</td></tr>";
1062
1063 // Public note
1064 print '<tr>';
1065 print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
1066 print '<td>';
1067 $doleditor = new DolEditor('note_public', (string) $note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%');
1068 print $doleditor->Create(1);
1069 //print '<textarea name="note_public" cols="80" rows="'.ROWS_3.'">'.$note_public.'</textarea>';
1070 print '</td></tr>';
1071
1072 // Private note
1073 if (empty($user->socid)) {
1074 print '<tr>';
1075 print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
1076 print '<td>';
1077 $doleditor = new DolEditor('note_private', (string) $note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%');
1078 print $doleditor->Create(1);
1079 //print '<textarea name="note_private" cols="80" rows="'.ROWS_3.'">'.$note_private.'</textarea>';
1080 print '</td></tr>';
1081 }
1082
1083 // Other attributes
1084 $parameters = array();
1085 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1086 print $hookmanager->resPrint;
1087 if (empty($reshook)) {
1088 print $object->showOptionals($extrafields, 'create');
1089 }
1090
1091 // Show link to origin object
1092 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1093 $newclassname = $classname;
1094 if ($newclassname == 'Propal') {
1095 $langs->load('propal');
1096 $newclassname = 'CommercialProposal';
1097 }
1098 print '<tr><td>'.$langs->trans($newclassname).'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>';
1099
1100 // Amount
1101 /* Hide amount because we only copy services so amount may differ than source
1102 print '<tr><td>' . $langs->trans('AmountHT') . '</td><td>' . price($objectsrc->total_ht) . '</td></tr>';
1103 print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td>' . price($objectsrc->total_tva) . "</td></tr>";
1104 if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 RE
1105 {
1106 print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td><td>' . price($objectsrc->total_localtax1) . "</td></tr>";
1107 }
1108
1109 if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2 IRPF
1110 {
1111 print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td>' . price($objectsrc->total_localtax2) . "</td></tr>";
1112 }
1113
1114 print '<tr><td>' . $langs->trans('AmountTTC') . '</td><td>' . price($objectsrc->total_ttc) . "</td></tr>";
1115
1116 if (isModEnabled("multicurrency"))
1117 {
1118 print '<tr><td>' . $langs->trans('MulticurrencyAmountHT') . '</td><td>' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
1119 print '<tr><td>' . $langs->trans('MulticurrencyAmountVAT') . '</td><td>' . price($objectsrc->multicurrency_total_tva) . "</td></tr>";
1120 print '<tr><td>' . $langs->trans('MulticurrencyAmountTTC') . '</td><td>' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>";
1121 }
1122 */
1123 }
1124
1125 print '</table>';
1126
1127 if (is_object($objectsrc)) {
1128 print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">';
1129 print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
1130 } elseif ($origin == 'project' && !empty($projectid)) {
1131 print '<input type="hidden" name="projectid" value="'.$projectid.'">';
1132 }
1133
1134 print dol_get_fiche_end();
1135
1136 print $form->buttonsSaveCancel("CreateDraftIntervention");
1137
1138 // Show origin lines
1139 if (!empty($origin) && !empty($originid) && is_object($objectsrc) && !getDolGlobalInt('FICHINTER_DISABLE_DETAILS')) {
1140 $title = $langs->trans('Services');
1141 print load_fiche_titre($title);
1142
1143 print '<div class="div-table-responsive-no-min">';
1144 print '<table class="noborder centpercent">';
1145
1146 $objectsrc->printOriginLinesList(!getDolGlobalString('FICHINTER_PRINT_PRODUCTS') ? 'services' : ''); // Show only service, except if option FICHINTER_PRINT_PRODUCTS is on
1147
1148 print '</table>';
1149 print '</div>';
1150 }
1151
1152 print '</form>';
1153 } else {
1154 print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
1155 print '<input type="hidden" name="token" value="'.newToken().'">';
1156 print '<input type="hidden" name="action" value="create">'; // We go back to create action
1157 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
1158
1159 print dol_get_fiche_head([]);
1160
1161 if (is_object($objectsrc)) {
1162 print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">';
1163 print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
1164 } elseif ($origin == 'project' && !empty($projectid)) {
1165 print '<input type="hidden" name="projectid" value="'.$projectid.'">';
1166 }
1167 print '<table class="border centpercent">';
1168 print '<tr><td class="fieldrequired">'.$langs->trans("ThirdParty").'</td><td>';
1169 $filter = '(s.status:=:1)';
1170
1171 print $form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300');
1172 print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
1173 print '</td></tr>';
1174 print '</table>';
1175
1176 print dol_get_fiche_end();
1177
1178 print $form->buttonsSaveCancel("CreateDraftIntervention");
1179
1180 print '</form>';
1181 }
1182} elseif ($id > 0 || !empty($ref)) {
1183 // View mode
1184
1185 $object->fetch($id, $ref);
1186 $object->fetch_thirdparty();
1187
1188 $soc = new Societe($db);
1189 $soc->fetch($object->socid);
1190
1191 if ($error > 0) {
1192 dol_htmloutput_errors($mesg);
1193 } else {
1194 dol_htmloutput_mesg($mesg);
1195 }
1196
1198
1199 print dol_get_fiche_head($head, 'card', $langs->trans("InterventionCard"), -1, 'intervention');
1200
1201 $formconfirm = '';
1202
1203 // Confirm deletion of intervention
1204 if ($action == 'delete') {
1205 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete', '', 0, 1);
1206 }
1207
1208 // Confirm validation
1209 if ($action == 'validate') {
1210 // Verify if the object's number os temporary
1211 $ref = substr($object->ref, 1, 4);
1212 if ($ref == 'PROV') {
1213 $numref = $object->getNextNumRef($soc);
1214 if (empty($numref)) {
1215 $error++;
1216 setEventMessages($object->error, $object->errors, 'errors');
1217 }
1218 } else {
1219 $numref = $object->ref;
1220 }
1221 $text = $langs->trans('ConfirmValidateIntervention', $numref);
1222 if (isModEnabled('notification')) {
1223 require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
1224 $notify = new Notify($db);
1225 $text .= '<br>';
1226 $text .= $notify->confirmMessage('FICHINTER_VALIDATE', $object->socid, $object);
1227 }
1228
1229 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $text, 'confirm_validate', '', 1, 1);
1230 }
1231
1232 // Confirm sign
1233 if ($action == 'sign') {
1234 $text = $langs->trans('ConfirmSignIntervention');
1235 if (isModEnabled('notification')) {
1236 require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
1237 $notify = new Notify($db);
1238 $text .= '<br>';
1239 $text .= $notify->confirmMessage('FICHINTER_MODIFY', $object->socid, $object);
1240 }
1241 $formquestion = [];
1242 $formquestion[] = [
1243 'type' => 'select',
1244 'name' => 'signed_status',
1245 'select_show_empty' => 0,
1246 'label' => '<span class="fieldrequired">'.$langs->trans('SignStatus').'</span>',
1247 'values' => $object->getSignedStatusLocalisedArray()
1248 ];
1249 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SignIntervention'), $text, 'confirm_sign', $formquestion, 0, 1);
1250 }
1251
1252 // Confirm unsign
1253 if ($action == 'unsign') {
1254 $text = $langs->trans('ConfirmUnsignIntervention');
1255 if (isModEnabled('notification')) {
1256 require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
1257 $notify = new Notify($db);
1258 $text .= '<br>';
1259 $text .= $notify->confirmMessage('FICHINTER_MODIFY', $object->socid, $object);
1260 }
1261 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('UnsignIntervention'), $text, 'confirm_unsign', '', 0, 1);
1262 }
1263
1264 // Confirm done
1265 if ($action == 'classifydone') {
1266 $text = $langs->trans('ConfirmCloseIntervention');
1267 if (isModEnabled('notification')) {
1268 require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
1269 $notify = new Notify($db);
1270 $text .= '<br>';
1271 $text .= $notify->confirmMessage('FICHINTER_CLOSE', $object->socid, $object);
1272 }
1273 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('CloseIntervention'), $text, 'confirm_done', '', 0, 1);
1274 }
1275
1276 // Confirm back to draft
1277 if ($action == 'modify') {
1278 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify', '', 0, 1);
1279 }
1280
1281 // Confirm back to open
1282 if ($action == 'reopen') {
1283 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReopenIntervention', $object->ref), 'confirm_reopen', '', 0, 1);
1284 }
1285
1286 // Confirm deletion of line
1287 if ($action == 'ask_deleteline') {
1288 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&line_id='.$lineid, $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline', '', 0, 1);
1289 }
1290
1291 // Clone confirmation
1292 if ($action == 'clone') {
1293 // Create an array for form
1294 $formquestion = array(
1295 // 'text' => $langs->trans("ConfirmClone"),
1296 // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
1297 array(
1298 'type' => 'other',
1299 'name' => 'socid',
1300 'label' => $langs->trans("SelectThirdParty"),
1301 'value' => $form->select_company(GETPOSTINT('socid'), 'socid', '', '', 0, 0, array(), 0, 'minwidth200')
1302 ),
1303 array(
1304 'type' => 'checkbox',
1305 'name' => 'clone_contacts',
1306 'label' => $langs->trans("CloneContacts"),
1307 'value' => 1
1308 ),
1309 array(
1310 'type' => 'checkbox',
1311 'name' => 'clone_notes',
1312 'label' => $langs->trans("CloneNotes"),
1313 'value' => 1
1314 )
1315 );
1316
1317 // Paiement incomplet. On demande si motif = escompte ou autre
1318 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneIntervention', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
1319 }
1320
1321 if (!$formconfirm) {
1322 $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
1323 $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1324 if (empty($reshook)) {
1325 $formconfirm .= $hookmanager->resPrint;
1326 } elseif ($reshook > 0) {
1327 $formconfirm = $hookmanager->resPrint;
1328 }
1329 }
1330
1331 // Print form confirm
1332 print $formconfirm;
1333
1334
1335 // Intervention card
1336 $linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
1337
1338
1339 $morehtmlref = '<div class="refidno">';
1340 // Ref customer
1341 $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->hasRight('ficheinter', 'creer'), 'string', '', 0, 1);
1342 $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->hasRight('ficheinter', 'creer'), 'string', '', null, null, '', 1);
1343 // Thirdparty
1344 $morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'customer');
1345 // Project
1346 if (isModEnabled('project')) {
1347 $langs->load("projects");
1348 $morehtmlref .= '<br>';
1349 if ($permissiontoadd) {
1350 $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
1351 if ($action != 'classify') {
1352 $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
1353 }
1354 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
1355 } else {
1356 if (!empty($object->fk_project)) {
1357 $proj = new Project($db);
1358 $proj->fetch($object->fk_project);
1359 $morehtmlref .= $proj->getNomUrl(1);
1360 if ($proj->title) {
1361 $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
1362 }
1363 }
1364 }
1365 }
1366 $morehtmlref .= '</div>';
1367
1368 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
1369
1370
1371 print '<div class="fichecenter">';
1372 print '<div class="fichehalfleft">';
1373 print '<div class="underbanner clearboth"></div>';
1374
1375 print '<table class="border tableforfield centpercent">';
1376
1377 if (getDolGlobalString('FICHINTER_USE_PLANNED_AND_DONE_DATES')) {
1378 // Date Start
1379 print '<tr><td class="titlefield">'.$langs->trans("Dateo").'</td>';
1380 print '<td>';
1381 print $object->dateo ? dol_print_date($object->dateo, 'daytext') : '&nbsp;';
1382 print '</td>';
1383 print '</tr>';
1384
1385 // Date End
1386 print '<tr><td>'.$langs->trans("Datee").'</td>';
1387 print '<td>';
1388 print $object->datee ? dol_print_date($object->datee, 'daytext') : '&nbsp;';
1389 print '</td>';
1390 print '</tr>';
1391
1392 // Date Terminate/close
1393 print '<tr><td>'.$langs->trans("Datet").'</td>';
1394 print '<td>';
1395 print $object->datet ? dol_print_date($object->datet, 'daytext') : '&nbsp;';
1396 print '</td>';
1397 print '</tr>';
1398 }
1399
1400 // Description (must be a textarea and not html must be allowed (used in list view)
1401 print '<tr><td class="titlefield">';
1402 print $form->editfieldkey("Description", 'description', $object->description, $object, $user->hasRight('ficheinter', 'creer'), 'textarea');
1403 print '</td><td>';
1404 print $form->editfieldval("Description", 'description', $object->description, $object, $user->hasRight('ficheinter', 'creer'), 'textarea:8');
1405 print '</td>';
1406 print '</tr>';
1407
1408 // Contract
1409 if (isModEnabled('contract')) {
1410 $langs->load('contracts');
1411 print '<tr>';
1412 print '<td>';
1413
1414 print '<table class="nobordernopadding centpercent"><tr><td>';
1415 print $langs->trans('Contract');
1416 print '</td>';
1417 if ($action != 'editcontract') {
1418 print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editcontract&id='.$object->id.'">';
1419 print img_edit($langs->trans('SetContract'), 1);
1420 print '</a></td>';
1421 }
1422 print '</tr></table>';
1423 print '</td><td>';
1424 if ($action == 'editcontract') {
1425 $formcontract = new FormContract($db);
1426 $formcontract->formSelectContract($_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, $object->fk_contrat, 'contratid', 0, 1, 1);
1427 } else {
1428 if ($object->fk_contrat) {
1429 $contratstatic = new Contrat($db);
1430 $contratstatic->fetch($object->fk_contrat);
1431 //print '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$selected.'">'.$projet->title.'</a>';
1432 print $contratstatic->getNomUrl(0, 0, 1);
1433 } else {
1434 print "&nbsp;";
1435 }
1436 }
1437 print '</td>';
1438 print '</tr>';
1439 }
1440
1441 // Other attributes
1442 $cols = 2;
1443 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
1444
1445 print '</table>';
1446
1447 print '</div>';
1448 print '<div class="fichehalfright">';
1449 print '<div class="underbanner clearboth"></div>';
1450
1451 print '<table class="border tableforfield centpercent">';
1452
1453 if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2') {
1454 // Duration in time
1455 print '<tr><td class="titlefield">'.$langs->trans("TotalDuration").'</td>';
1456 print '<td>'.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).' ('.convertDurationtoHour($object->duration, "s").' '.$langs->trans("HourShort").')</td>';
1457 print '</tr>';
1458 }
1459
1460 print "</table>";
1461
1462 print '</div>';
1463 print '</div>';
1464
1465 print '<div class="clearboth"></div><br>';
1466
1467
1468 if (getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) {
1469 $blocname = 'contacts';
1470 $title = $langs->trans('ContactsAddresses');
1471 include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
1472 }
1473
1474 if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) {
1475 $blocname = 'notes';
1476 $title = $langs->trans('Notes');
1477 include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
1478 }
1479
1480 // Line of interventions
1481 if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2') {
1482 print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" name="addinter" method="post">';
1483 print '<input type="hidden" name="token" value="'.newToken().'">';
1484 print '<input type="hidden" name="id" value="'.$object->id.'">';
1485 if ($action == 'editline') {
1486 print '<input type="hidden" name="action" value="updateline">';
1487 print '<input type="hidden" name="line_id" value="'.GETPOSTINT('line_id').'">';
1488 } else {
1489 print '<input type="hidden" name="action" value="addline">';
1490 }
1491 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
1492
1493 // Intervention lines
1494 $sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
1495 $sql .= ' ft.date as date_intervention';
1496 $sql .= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft';
1497 $sql .= ' WHERE ft.fk_fichinter = '.((int) $object->id);
1498 if (getDolGlobalString('FICHINTER_HIDE_EMPTY_DURATION')) {
1499 $sql .= ' AND ft.duree <> 0';
1500 }
1501 $sql .= ' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid';
1502
1503 $resql = $db->query($sql);
1504 if ($resql) {
1505 $num = $db->num_rows($resql);
1506 $i = 0;
1507
1508 if ($num) {
1509 print '<br>';
1510 print '<table class="noborder centpercent">';
1511 print '<tr class="liste_titre">';
1512
1513 // No.
1514 if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
1515 print '<td width="5" class="center linecolnum"></td>';
1516 }
1517
1518 print '<td class="liste_titre">'.$langs->trans('Description').'</td>';
1519 print '<td class="liste_titre center">'.$langs->trans('Date').'</td>';
1520 print '<td class="liste_titre right">'.(!getDolGlobalString('FICHINTER_WITHOUT_DURATION') ? $langs->trans('Duration') : '').'</td>';
1521 print '<td class="liste_titre">&nbsp;</td>';
1522 print '<td class="liste_titre">&nbsp;</td>';
1523 print "</tr>\n";
1524 }
1525 while ($i < $num) {
1526 $objp = $db->fetch_object($resql);
1527
1528 // Ligne en mode visu
1529 if ($action != 'editline' || GETPOSTINT('line_id') != $objp->rowid) {
1530 print '<tr class="oddeven">';
1531
1532 // No.
1533 if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
1534 print '<td class="center linecolnum">'.($i + 1).'</td>';
1535 }
1536
1537 print '<td>';
1538 print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
1539 print dol_htmlentitiesbr($objp->description);
1540
1541 $objectline = new FichinterLigne($db);
1542 $objectline->fetch($objp->rowid);
1543 $objectline->fetch_optionals();
1544
1545 $extrafields->fetch_name_optionals_label($objectline->table_element);
1546
1547 $temps = $objectline->showOptionals($extrafields, 'view', array(), '', '', '1', 'line');
1548 if (!empty($temps)) {
1549 print '<div style="padding-top: 10px" id="extrafield_lines_area_'.$objp->rowid.'" name="extrafield_lines_area_'.$objp->rowid.'">';
1550 print $temps;
1551 print '</div>';
1552 }
1553
1554 print '</td>';
1555
1556 // Date
1557 print '<td class="center" width="150">'.(!getDolGlobalString('FICHINTER_DATE_WITHOUT_HOUR') ? dol_print_date($db->jdate($objp->date_intervention), 'dayhour') : dol_print_date($db->jdate($objp->date_intervention), 'day')).'</td>';
1558
1559 // Duration
1560 print '<td class="right" width="150">'.(!getDolGlobalString('FICHINTER_WITHOUT_DURATION') ? convertSecondToTime($objp->duree) : '').'</td>';
1561
1562 print "</td>\n";
1563
1564 // Icon to edit and delete
1565 if ($object->status == 0 && $user->hasRight('ficheinter', 'creer')) {
1566 print '<td class="center">';
1567 print '<a class="editfielda marginrightonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=editline&token='.newToken().'&line_id='.$objp->rowid.'#'.$objp->rowid.'">';
1568 print img_edit();
1569 print '</a>';
1570 print '<a class="marginleftonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=ask_deleteline&token='.newToken().'&line_id='.$objp->rowid.'">';
1571 print img_delete();
1572 print '</a></td>';
1573 print '<td class="center">';
1574 if ($num > 1) {
1575 if ($i > 0) {
1576 print '<a class="marginleftonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=up&token='.newToken().'&line_id='.$objp->rowid.'">';
1577 print img_up();
1578 print '</a>';
1579 }
1580 if ($i < $num - 1) {
1581 print '<a class="marginleftonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=down&token='.newToken().'&line_id='.$objp->rowid.'">';
1582 print img_down();
1583 print '</a>';
1584 }
1585 }
1586 print '</td>';
1587 } else {
1588 print '<td colspan="2">&nbsp;</td>';
1589 }
1590
1591 print '</tr>';
1592 }
1593
1594 // Line in update mode
1595 if ($object->status == 0 && $action == 'editline' && $user->hasRight('ficheinter', 'creer') && GETPOSTINT('line_id') == $objp->rowid) {
1596 print '<tr class="oddeven nohover">';
1597
1598 // No.
1599 if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
1600 print '<td class="center linecolnum">'.($i + 1).'</td>';
1601 }
1602
1603 print '<td>';
1604 print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
1605
1606 // Editeur wysiwyg
1607 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
1608 $doleditor = new DolEditor('np_desc', $objp->description, '', 164, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), ROWS_2, '90%');
1609 $doleditor->Create();
1610
1611 $objectline = new FichinterLigne($db);
1612 $objectline->fetch($objp->rowid);
1613 $objectline->fetch_optionals();
1614
1615 $extrafields->fetch_name_optionals_label($objectline->table_element);
1616
1617 $temps = $objectline->showOptionals($extrafields, 'edit', array(), '', '', '1', 'line');
1618 if (!empty($temps)) {
1619 print '<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.'" name="extrafield_lines_area_'.$line->id.'">';
1620 print $temps;
1621 print '</div>';
1622 }
1623
1624 print '</td>';
1625
1626 // Date d'intervention
1627 print '<td class="center nowrap">';
1628 if (getDolGlobalString('FICHINTER_DATE_WITHOUT_HOUR')) {
1629 print $form->selectDate($db->jdate($objp->date_intervention), 'di', 0, 0, 0, "date_intervention");
1630 } else {
1631 print $form->selectDate($db->jdate($objp->date_intervention), 'di', 1, 1, 0, "date_intervention");
1632 }
1633 print '</td>';
1634
1635 // Duration
1636 print '<td class="right">';
1637 if (!getDolGlobalString('FICHINTER_WITHOUT_DURATION')) {
1638 $selectmode = 'select';
1639 if (getDolGlobalString('INTERVENTION_ADDLINE_FREEDUREATION')) {
1640 $selectmode = 'text';
1641 }
1642 $form->select_duration('duration', $objp->duree, 0, $selectmode);
1643 }
1644 print '</td>';
1645
1646 print '<td class="center" colspan="5" valign="center">';
1647 print '<input type="submit" class="button buttongen marginbottomonly button-save" name="save" value="'.$langs->trans("Save").'">';
1648 print '<input type="submit" class="button buttongen marginbottomonly button-cancel" name="cancel" value="'.$langs->trans("Cancel").'"></td>';
1649 print '</tr>'."\n";
1650 }
1651
1652 $i++;
1653 }
1654
1655 $db->free($resql);
1656
1657 // Add new line
1658 if ($object->status == 0 && $user->hasRight('ficheinter', 'creer') && $action != 'editline' && (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2')) {
1659 if (!$num) {
1660 print '<br>';
1661 print '<table class="noborder centpercent">';
1662 print '<tr class="liste_titre">';
1663
1664 // No.
1665 if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
1666 print '<td width="5" class="center linecolnum"></td>';
1667 }
1668
1669 print '<td>';
1670 print '<a name="add"></a>'; // ancre
1671 print $langs->trans('Description').'</td>';
1672 print '<td class="center">'.$langs->trans('Date').'</td>';
1673 print '<td class="right">'.(!getDolGlobalString('FICHINTER_WITHOUT_DURATION') ? $langs->trans('Duration') : '').'</td>';
1674 print '<td colspan="3">&nbsp;</td>';
1675 print "</tr>\n";
1676 }
1677
1678 print '<tr class="oddeven nohover">'."\n";
1679
1680 // No.
1681 if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
1682 print '<td class="center linecolnum">'.($i + 1).'</td>';
1683 }
1684
1685 print '<td>';
1686 // editeur wysiwyg
1687 if (!getDolGlobalString('FICHINTER_EMPTY_LINE_DESC')) {
1688 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
1689 $doleditor = new DolEditor('np_desc', GETPOST('np_desc', 'restricthtml'), '', 100, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_DETAILS'), ROWS_2, '90%');
1690 $doleditor->Create();
1691 }
1692
1693 $objectline = new FichinterLigne($db);
1694 $extrafields->fetch_name_optionals_label($objectline->table_element);
1695
1696 if (is_object($objectline)) {
1697 $temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', '1', 'line');
1698
1699 if (!empty($temps)) {
1700 print '<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
1701 print $temps;
1702 print '</div>';
1703 }
1704 }
1705
1706 print '</td>';
1707
1708 // Date intervention
1709 print '<td class="center nowrap">';
1710 $now = dol_now();
1711 $timearray = dol_getdate($now);
1712 if (!GETPOSTINT('diday')) {
1713 if (getDolGlobalInt('FICHINTER_DATE_WITHOUT_HOUR')) {
1714 $timewithnohour = dol_mktime(0, 0, 0, $timearray['mon'], $timearray['mday'], $timearray['year']);
1715 } else {
1716 $timewithnohour = dol_mktime($timearray['hours'], $timearray['minutes'], 0, $timearray['mon'], $timearray['mday'], $timearray['year']);
1717 }
1718 } else {
1719 $timewithnohour = dol_mktime(GETPOSTINT('dihour'), GETPOSTINT('dimin'), 0, GETPOSTINT('dimonth'), GETPOSTINT('diday'), GETPOSTINT('diyear'));
1720 }
1721 if (getDolGlobalInt('FICHINTER_DATE_WITHOUT_HOUR')) {
1722 print $form->selectDate($timewithnohour, 'di', 0, 0, 0, "addinter");
1723 } else {
1724 print $form->selectDate($timewithnohour, 'di', 1, 1, 0, "addinter");
1725 }
1726 print '</td>';
1727
1728 // Duration
1729 print '<td class="right">';
1730 if (!getDolGlobalString('FICHINTER_WITHOUT_DURATION')) {
1731 $selectmode = 'select';
1732 if (getDolGlobalString('INTERVENTION_ADDLINE_FREEDUREATION')) {
1733 $selectmode = 'text';
1734 }
1735 $form->select_duration('duration', (!GETPOSTINT('durationhour') && !GETPOSTINT('durationmin')) ? 3600 : (60 * 60 * GETPOSTINT('durationhour') + 60 * GETPOSTINT('durationmin')), 0, $selectmode);
1736 }
1737 print '</td>';
1738
1739 print '<td class="center" valign="middle" colspan="3"><input type="submit" class="button button-add" value="'.$langs->trans('Add').'" name="addline"></td>';
1740 print '</tr>';
1741
1742 if (!$num) {
1743 print '</table>';
1744 }
1745 }
1746
1747 if ($num) {
1748 print '</table>';
1749 }
1750 } else {
1751 dol_print_error($db);
1752 }
1753
1754 print '</form>'."\n";
1755 }
1756
1757 print dol_get_fiche_end();
1758
1759 print "\n";
1760
1761
1762 /*
1763 * Actions buttons
1764 */
1765
1766 print '<div class="tabsAction">';
1767
1768 $parameters = array();
1769 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
1770 // modified by hook
1771 if (empty($reshook)) {
1772 $params = array();
1773 if ($user->socid == 0) {
1774 if ($action != 'editdescription' && ($action != 'presend')) {
1775 // Validate
1776 if ($object->status == Fichinter::STATUS_DRAFT && (count($object->lines) > 0 || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '1')) {
1777 if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'creer')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'ficheinter_advance', 'validate'))) {
1778 print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&action=validate&token='.newToken().'">'.$langs->trans("Validate").'</a></div>';
1779 } else {
1780 print '<div class="inline-block divButActionRefused"><span class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Validate").'</span></div>';
1781 }
1782 }
1783
1784 // Modify
1785 if ($object->status == Fichinter::STATUS_VALIDATED && ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'creer')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'ficheinter_advance', 'unvalidate')))) {
1786 print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&action=modify&token='.newToken().'">';
1787 if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2') {
1788 print $langs->trans("Modify");
1789 } else {
1790 print $langs->trans("SetToDraft");
1791 }
1792 print '</a></div>';
1793 }
1794
1795 // Reopen
1796 if ($object->status >= Fichinter::STATUS_CLOSED) {
1797 if ($user->hasRight('ficheinter', 'creer')) {
1798 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans('ReOpen').'</a></div>';
1799 } else {
1800 print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans('ReOpen').'</a></div>';
1801 }
1802 }
1803
1804 // Send
1805 if (empty($user->socid)) {
1806 if ($object->status > Fichinter::STATUS_DRAFT) {
1807 if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('ficheinter', 'ficheinter_advance', 'send')) {
1808 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a></div>';
1809 } else {
1810 print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a></div>';
1811 }
1812 }
1813 }
1814
1815 // Create intervention model
1816 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1 && $object->status == Fichinter::STATUS_DRAFT && $user->hasRight('ficheinter', 'creer') && (count($object->lines) > 0)) {
1817 print '<div class="inline-block divButAction">';
1818 print '<a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card-rec.php?id='.$object->id.'&action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id).'">'.$langs->trans("ChangeIntoRepeatableIntervention").'</a>';
1819 print '</div>';
1820 }
1821
1822 $arrayofcreatebutton = array();
1823 // Proposal
1824 if (isModEnabled("service") && isModEnabled("propal") && $object->status > Fichinter::STATUS_DRAFT) {
1825 $langs->load("propal");
1826 if ($object->status < Fichinter::STATUS_BILLED) {
1827 $arrayofcreatebutton[] = array(
1828 'url' => '/comm/propal/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid,
1829 'label' => $langs->trans('AddProp'),
1830 'lang' => 'propal',
1831 'perm' => $user->hasRight('propal', 'creer'),
1832 'enabled' => true,
1833 );
1834 }
1835 }
1836
1837 // Invoicing
1838 if (isModEnabled('invoice') && $object->status > Fichinter::STATUS_DRAFT) {
1839 $langs->load("bills");
1840 if ($object->status < Fichinter::STATUS_BILLED) {
1841 $arrayofcreatebutton[] = array(
1842 'url' => '/compta/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid,
1843 'label' => $langs->trans('AddBill'),
1844 'lang' => 'bills',
1845 'perm' => $user->hasRight('facture', 'creer') ? true : false,
1846 'enabled' => true,
1847 );
1848 }
1849
1850 if (getDolGlobalString('FICHINTER_CLASSIFY_BILLED')) { // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1
1851 if ($object->status != Fichinter::STATUS_BILLED) {
1852 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled&token='.newToken().'">'.$langs->trans("InterventionClassifyBilled").'</a></div>';
1853 } else {
1854 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifyunbilled&token='.newToken().'">'.$langs->trans("InterventionClassifyUnBilled").'</a></div>';
1855 }
1856 }
1857 }
1858
1859 if (count($arrayofcreatebutton)) {
1860 print dolGetButtonAction('', $langs->trans("Create"), 'default', $arrayofcreatebutton, '', true, $params);
1861 }
1862
1863 // Sign
1864 if ($object->status > Fichinter::STATUS_DRAFT) {
1865 if ($object->signed_status != Fichinter::$SIGNED_STATUSES['STATUS_SIGNED_ALL']) {
1866 print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=sign&token=' . newToken() . '">' . $langs->trans("InterventionSign") . '</a></div>';
1867 } else {
1868 print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=unsign&token=' . newToken() . '">' . $langs->trans("InterventionUnsign") . '</a></div>';
1869 }
1870 }
1871
1872 // Done
1873 if (!getDolGlobalString('FICHINTER_CLASSIFY_BILLED') && $object->status > Fichinter::STATUS_DRAFT && $object->status < Fichinter::STATUS_CLOSED) {
1874 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifydone&token='.newToken().'">'.$langs->trans("InterventionClassifyDone").'</a></div>';
1875 }
1876
1877 // Clone
1878 if ($user->hasRight('ficheinter', 'creer')) {
1879 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken().'&object=ficheinter">'.$langs->trans("ToClone").'</a></div>';
1880 }
1881
1882 // Delete
1883 print '<div class="inline-block divButAction">';
1884 print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
1885 print '</div>';
1886 }
1887 }
1888 }
1889
1890 print '</div>';
1891
1892 // Select mail models is same action as presend
1893 if (GETPOST('modelselected')) {
1894 $action = 'presend';
1895 }
1896
1897 if ($action != 'presend') {
1898 print '<div class="fichecenter"><div class="fichehalfleft">';
1899
1900 /*
1901 * Built documents
1902 */
1903 $filename = dol_sanitizeFileName($object->ref);
1904 $filedir = getMultidirOutput($object)."/".$filename;
1905 $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
1906 $genallowed = $user->hasRight('ficheinter', 'lire');
1907 $delallowed = $user->hasRight('ficheinter', 'creer');
1908 print $formfile->showdocuments('ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang, '', $object);
1909
1910 // Show links to link elements
1911 $tmparray = $form->showLinkToObjectBlock($object, array(), array('fichinter'), 1);
1912 $linktoelem = $tmparray['linktoelem'];
1913 $htmltoenteralink = $tmparray['htmltoenteralink'];
1914 print $htmltoenteralink;
1915
1916 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
1917
1918 // Show direct download link
1919 if ($object->status != Fichinter::STATUS_DRAFT && getDolGlobalString('FICHINTER_ALLOW_EXTERNAL_DOWNLOAD')) {
1920 print '<br><!-- Link to download main doc -->'."\n";
1921 print showDirectDownloadLink($object).'<br>';
1922 }
1923
1924 // Show online signature link
1925 if ($object->status != Fichinter::STATUS_DRAFT && getDolGlobalString('FICHINTER_ALLOW_ONLINE_SIGN')) {
1926 print '<br><!-- Link to sign -->';
1927 require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
1928
1929 print showOnlineSignatureUrl('fichinter', $object->ref, $object).'<br>';
1930 }
1931
1932 print '</div><div class="fichehalfright">';
1933
1934 $MAXEVENT = 10;
1935
1936 $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/fichinter/agenda.php?id='.$object->id);
1937
1938 // List of actions on element
1939 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
1940 $formactions = new FormActions($db);
1941 $somethingshown = $formactions->showactions($object, 'fichinter', $socid, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for thirdparty
1942
1943 print '</div></div>';
1944 }
1945
1946 // Presend form
1947 $modelmail = 'fichinter_send';
1948 $defaulttopic = 'SendInterventionRef';
1949 $diroutput = $conf->ficheinter->multidir_output[$object->entity];
1950 $trackid = 'int'.$object->id;
1951
1952 include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
1953}
1954
1955
1956llxFooter();
1957
1958$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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:73
Class to manage a WYSIWYG editor.
Class to manage standard extra fields.
const STATUS_BILLED
Billed.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
const STATUS_CLOSED
Closed.
Class to manage intervention lines.
Class to manage building of HTML components.
Class to manage generation of HTML components for contract module.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class to manage building of HTML components.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
Class to manage the table of subscription to notifications.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
convertDurationtoHour($duration_value, $duration_unit)
Convert duration to hour.
Definition date.lib.php:338
convertTime2Seconds($iHours=0, $iMinutes=0, $iSeconds=0)
Convert hours and minutes into seconds.
Definition date.lib.php:215
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
Definition date.lib.php:244
fichinter_prepare_head($object)
Prepare array with list of tabs.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
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, $morecssdiv='')
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(!function_exists( 'utf8_encode')) if(!function_exists('utf8_decode')) if(!function_exists( 'str_starts_with')) if(!function_exists('str_ends_with')) if(!function_exists( 'str_contains')) getMultidirOutput($object, $module='', $forobject=0, $mode='output')
Return the full path of the directory where a module (or an object of a module) stores its files.
showDirectDownloadLink($object)
Return string with full Url.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
img_up($titlealt='default', $selected=0, $moreclass='')
Show top arrow logo.
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formatted error messages to output (Used to show messages on html output).
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Create an intervention document on disk using template defined into FICHEINTER_ADDON_PDF.
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.