dolibarr 20.0.0
contact.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
3 * Copyright (C) 2012-2015 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
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 <https://www.gnu.org/licenses/>.
19 */
20
27// Load Dolibarr environment
28require '../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
30require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
31require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
34if (isModEnabled('category')) {
35 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
36}
37
38// Load translation files required by the page
39$langsLoad = array('projects', 'companies');
40if (isModEnabled('eventorganization')) {
41 $langsLoad[] = 'eventorganization';
42}
43
44$langs->loadLangs($langsLoad);
45
46$id = GETPOSTINT('id');
47$ref = GETPOST('ref', 'alpha');
48$lineid = GETPOSTINT('lineid');
49$socid = GETPOSTINT('socid');
50$action = GETPOST('action', 'aZ09');
51
52$mine = GETPOST('mode') == 'mine' ? 1 : 0;
53//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
54
55$object = new Project($db);
56
57include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
58if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) {
59 $object->fetchComments();
60}
61
62// Security check
63$socid = 0;
64//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignment.
65$result = restrictedArea($user, 'projet', $id, 'projet&project');
66
67$hookmanager->initHooks(array('projectcontactcard', 'globalcard'));
68
69
70/*
71 * Actions
72 */
73
74$parameters = array('id' => $id);
75$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
76if ($reshook < 0) {
77 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
78}
79
80if (empty($reshook)) {
81 // Test if we can add contact to the tasks at the same times, if not or not required, make a redirect
82 $formconfirmtoaddtasks = '';
83 if ($action == 'addcontact') {
84 $form = new Form($db);
85
86 $source = GETPOST("source", 'aZ09');
87
88 $taskstatic = new Task($db);
89 $task_array = $taskstatic->getTasksArray(0, 0, $object->id, 0, 0);
90 $nbTasks = count($task_array);
91
92 //If no task available, redirec to to add confirm
93 $type_to = (GETPOST('typecontact') ? 'typecontact='.GETPOST('typecontact') : 'type='.GETPOST('type'));
94 $personToAffect = (GETPOST('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid'));
95 $affect_to = (GETPOST('userid') ? 'userid='.$personToAffect : 'contactid='.$personToAffect);
96 $url_redirect = '?id='.$object->id.'&'.$affect_to.'&'.$type_to.'&source='.$source;
97
98 if ($personToAffect > 0 && (!getDolGlobalString('PROJECT_HIDE_TASKS') || $nbTasks > 0)) {
99 $text = $langs->trans('AddPersonToTask');
100 $textbody = $text.' (<a href="#" class="selectall">'.$langs->trans("SelectAll").'</a>)';
101 $formquestion = array('text' => $textbody);
102
103 $task_to_affect = array();
104 foreach ($task_array as $task) {
105 $task_already_affected = false;
106 $personsLinked = $task->liste_contact(-1, $source);
107 if (!is_array($personsLinked) && count($personsLinked) < 0) {
108 setEventMessage($object->error, 'errors');
109 } else {
110 foreach ($personsLinked as $person) {
111 if ($person['id'] == $personToAffect) {
112 $task_already_affected = true;
113 break;
114 }
115 }
116 if (!$task_already_affected) {
117 $task_to_affect[$task->id] = $task->id;
118 }
119 }
120 }
121
122 if (empty($task_to_affect)) {
123 $action = 'addcontact_confirm';
124 } else {
125 $formcompany = new FormCompany($db);
126 foreach ($task_array as $task) {
127 $key = $task->id;
128 $val = $task->ref . ' '.dol_trunc($task->label);
129 $formquestion[] = array(
130 'type' => 'other',
131 'name' => 'person_'.$key.',person_role_'.$key,
132 'label' => '<input type="checkbox" class="flat'.(in_array($key, $task_to_affect) ? ' taskcheckboxes"' : '" checked disabled').' id="person_'.$key.'" name="person_'.$key.'" value="1"> <label for="person_'.$key.'">'.$val.'<label>',
133 'value' => $formcompany->selectTypeContact($taskstatic, '', 'person_role_'.$key, $source, 'position', 0, 'minwidth100imp', 0, 1)
134 );
135 }
136 $formquestion[] = array('type' => 'other', 'name' => 'tasksavailable', 'label' => '', 'value' => '<input type="hidden" id="tasksavailable" name="tasksavailable" value="'.implode(',', array_keys($task_to_affect)).'">');
137 }
138
139 $formconfirmtoaddtasks = $form->formconfirm($_SERVER['PHP_SELF'] . $url_redirect, $text, '', 'addcontact_confirm', $formquestion, '', 1, 300, 590);
140 $formconfirmtoaddtasks .= '
141 <script>
142 $(document).ready(function() {
143 var saveprop = false;
144 $(".selectall").click(function(){
145 console.log("We click on select all with "+saveprop);
146 if (!saveprop) {
147 $(".taskcheckboxes").prop("checked", true);
148 saveprop = true;
149 } else {
150 $(".taskcheckboxes").prop("checked", false);
151 saveprop = false;
152 }
153 });
154 });
155 </script>';
156 } else {
157 $action = 'addcontact_confirm';
158 }
159 }
160
161 // Add new contact
162 if ($action == 'addcontact_confirm' && $user->hasRight('projet', 'creer')) {
163 if (GETPOST('confirm', 'alpha') == 'no') {
164 header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
165 exit;
166 }
167
168 $contactid = (GETPOST('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid'));
169 $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
170 $groupid = GETPOSTINT('groupid');
171 $contactarray = array();
172 $errorgroup = 0;
173 $errorgrouparray = array();
174
175 if ($groupid > 0) {
176 require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
177 $usergroup = new UserGroup($db);
178 $result = $usergroup->fetch($groupid);
179 if ($result > 0) {
180 $excludefilter = 'statut = 1';
181 $tmpcontactarray = $usergroup->listUsersForGroup($excludefilter, 0);
182 if ($contactarray <= 0) {
183 $error++;
184 } else {
185 foreach ($tmpcontactarray as $tmpuser) {
186 $contactarray[] = $tmpuser->id;
187 }
188 }
189 } else {
190 $error++;
191 }
192 } elseif (! ($contactid > 0)) {
193 $error++;
194 $langs->load("errors");
195 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Contact")), null, 'errors');
196 } else {
197 $contactarray[] = $contactid;
198 }
199
200 $result = 0;
201 $result = $object->fetch($id);
202 if (!$error && $result > 0 && $id > 0) {
203 foreach ($contactarray as $key => $contactid) {
204 $result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
205
206 if ($result == 0) {
207 if ($groupid > 0) {
208 $errorgroup++;
209 $errorgrouparray[] = $contactid;
210 } else {
211 $langs->load("errors");
212 setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
213 }
214 } elseif ($result < 0) {
215 if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
216 if ($groupid > 0) {
217 $errorgroup++;
218 $errorgrouparray[] = $contactid;
219 } else {
220 $langs->load("errors");
221 setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
222 }
223 } else {
224 setEventMessages($object->error, $object->errors, 'errors');
225 }
226 }
227
228 $affecttotask = GETPOST('tasksavailable', 'intcomma');
229 if (!empty($affecttotask)) {
230 require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
231 $task_to_affect = explode(',', $affecttotask);
232 if (!empty($task_to_affect)) {
233 foreach ($task_to_affect as $task_id) {
234 if (GETPOSTISSET('person_'.$task_id) && GETPOST('person_'.$task_id, 'san_alpha')) {
235 $tasksToAffect = new Task($db);
236 $result = $tasksToAffect->fetch($task_id);
237 if ($result < 0) {
238 setEventMessages($tasksToAffect->error, null, 'errors');
239 } else {
240 $result = $tasksToAffect->add_contact($contactid, GETPOST('person_role_'.$task_id), GETPOST("source", 'aZ09'));
241 if ($result < 0) {
242 if ($tasksToAffect->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
243 $langs->load("errors");
244 setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
245 } else {
246 setEventMessages($tasksToAffect->error, $tasksToAffect->errors, 'errors');
247 }
248 }
249 }
250 }
251 }
252 }
253 }
254 }
255 }
256 if ($errorgroup > 0) {
257 $langs->load("errors");
258 if ($errorgroup == count($contactarray)) {
259 setEventMessages($langs->trans("ErrorThisGroupIsAlreadyDefinedAsThisType"), null, 'errors');
260 } else {
261 $tmpuser = new User($db);
262 foreach ($errorgrouparray as $key => $value) {
263 $tmpuser->fetch($value);
264 setEventMessages($langs->trans("ErrorThisContactXIsAlreadyDefinedAsThisType", dolGetFirstLastname($tmpuser->firstname, $tmpuser->lastname)), null, 'errors');
265 }
266 }
267 }
268
269 if ($result >= 0) {
270 header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
271 exit;
272 }
273 }
274
275 // Change contact's status
276 if ($action == 'swapstatut' && $user->hasRight('projet', 'creer')) {
277 if ($object->fetch($id)) {
278 $result = $object->swapContactStatus(GETPOSTINT('ligne'));
279 } else {
280 dol_print_error($db);
281 }
282 }
283
284 // Delete a contact
285 if (($action == 'deleteline' || $action == 'deletecontact') && $user->hasRight('projet', 'creer')) {
286 $object->fetch($id);
287 $result = $object->delete_contact(GETPOSTINT("lineid"));
288
289 if ($result >= 0) {
290 header("Location: contact.php?id=".$object->id);
291 exit;
292 } else {
293 dol_print_error($db);
294 }
295 }
296}
297
298
299/*
300 * View
301 */
302
303$form = new Form($db);
304$contactstatic = new Contact($db);
305$userstatic = new User($db);
306
307$title = $langs->trans('ProjectContact').' - '.$object->ref.' '.$object->name;
308if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) {
309 $title = $object->ref.' '.$object->name.' - '.$langs->trans('ProjectContact');
310}
311
312$help_url = 'EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos|DE:Modul_Projekte';
313
314llxHeader('', $title, $help_url);
315
316
317
318if ($id > 0 || !empty($ref)) {
319 /*
320 * View
321 */
322 if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) {
323 $object->fetchComments();
324 }
325 // To verify role of users
326 //$userAccess = $object->restrictedProjectArea($user,'read');
327 $userWrite = $object->restrictedProjectArea($user, 'write');
328 //$userDelete = $object->restrictedProjectArea($user,'delete');
329 //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
330
331 $head = project_prepare_head($object);
332 print dol_get_fiche_head($head, 'contact', $langs->trans("Project"), -1, ($object->public ? 'projectpub' : 'project'));
333
334 $formconfirm = $formconfirmtoaddtasks;
335
336 // Call Hook formConfirm
337 $parameters = array('formConfirm' => $formconfirm);
338 $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
339 if (empty($reshook)) {
340 $formconfirm .= $hookmanager->resPrint;
341 } elseif ($reshook > 0) {
342 $formconfirm = $hookmanager->resPrint;
343 }
344
345 // Print form confirm
346 print $formconfirm;
347
348 // Project card
349
350 if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) {
351 $tmpurl = $_SESSION['pageforbacktolist']['project'];
352 $tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl);
353 $linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?'). 'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
354 } else {
355 $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
356 }
357
358 $morehtmlref = '<div class="refidno">';
359 // Title
360 $morehtmlref .= dol_escape_htmltag($object->title);
361 $morehtmlref .= '<br>';
362 // Thirdparty
363 if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
364 $morehtmlref .= $object->thirdparty->getNomUrl(1, 'project');
365 }
366 $morehtmlref .= '</div>';
367
368 // Define a complementary filter for search of next/prev ref.
369 if (!$user->hasRight('projet', 'all', 'lire')) {
370 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
371 $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")";
372 }
373
374 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
375
376
377 print '<div class="fichecenter">';
378 print '<div class="fichehalfleft">';
379 print '<div class="underbanner clearboth"></div>';
380
381 print '<table class="border tableforfield centpercent">';
382
383 // Usage
384 if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJECT_HIDE_TASKS') || isModEnabled('eventorganization')) {
385 print '<tr><td class="tdtop">';
386 print $langs->trans("Usage");
387 print '</td>';
388 print '<td>';
389 if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
390 print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
391 $htmltext = $langs->trans("ProjectFollowOpportunity");
392 print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
393 print '<br>';
394 }
395 if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
396 print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
397 $htmltext = $langs->trans("ProjectFollowTasks");
398 print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
399 print '<br>';
400 }
401 if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) {
402 print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
403 $htmltext = $langs->trans("ProjectBillTimeDescription");
404 print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
405 print '<br>';
406 }
407 if (isModEnabled('eventorganization')) {
408 print '<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_organize_event ? ' checked="checked"' : '')).'"> ';
409 $htmltext = $langs->trans("EventOrganizationDescriptionLong");
410 print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
411 }
412 print '</td></tr>';
413 }
414
415 // Visibility
416 print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
417 if ($object->public) {
418 print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"');
419 print $langs->trans('SharedProject');
420 } else {
421 print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"');
422 print $langs->trans('PrivateProject');
423 }
424 print '</td></tr>';
425
426 if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') && !empty($object->usage_opportunity)) {
427 // Opportunity status
428 print '<tr><td>'.$langs->trans("OpportunityStatus").'</td><td>';
429 $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code');
430 if ($code) {
431 print $langs->trans("OppStatus".$code);
432 }
433
434 // Opportunity percent
435 print ' <span title="'.$langs->trans("OpportunityProbability").'"> / ';
436 if (strcmp($object->opp_percent, '')) {
437 print price($object->opp_percent, 0, $langs, 1, 0).' %';
438 }
439 print '</span></td></tr>';
440
441 // Opportunity Amount
442 print '<tr><td>'.$langs->trans("OpportunityAmount").'</td><td>';
443 if (strcmp($object->opp_amount, '')) {
444 print '<span class="amount">'.price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency).'</span>';
445 if (strcmp($object->opp_percent, '')) {
446 print ' &nbsp; &nbsp; &nbsp; <span title="'.dol_escape_htmltag($langs->trans('OpportunityWeightedAmount')).'"><span class="opacitymedium">'.$langs->trans("OpportunityWeightedAmountShort").'</span>: <span class="amount">'.price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).'</span></span>';
447 }
448 }
449 print '</td></tr>';
450 }
451
452 // Budget
453 print '<tr><td>'.$langs->trans("Budget").'</td><td>';
454 if (!is_null($object->budget_amount) && strcmp($object->budget_amount, '')) {
455 print '<span class="amount">'.price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).'</span>';
456 }
457 print '</td></tr>';
458
459 // Date start - end project
460 print '<tr><td>'.$langs->trans("Dates").'</td><td>';
461 $start = dol_print_date($object->date_start, 'day');
462 print($start ? $start : '?');
463 $end = dol_print_date($object->date_end, 'day');
464 print ' <span class="opacitymedium">-</span> ';
465 print($end ? $end : '?');
466 if ($object->hasDelay()) {
467 print img_warning("Late");
468 }
469 print '</td></tr>';
470
471 // Other attributes
472 $cols = 2;
473 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
474
475 print "</table>";
476
477 print '</div>';
478 print '<div class="fichehalfright">';
479 print '<div class="underbanner clearboth"></div>';
480
481 print '<table class="border tableforfield centpercent">';
482
483 // Description
484 print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
485 print dol_htmlentitiesbr($object->description);
486 print '</td></tr>';
487
488 // Categories
489 if (isModEnabled('category')) {
490 print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
491 print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
492 print "</td></tr>";
493 }
494
495 print '</table>';
496
497 print '</div>';
498 print '</div>';
499
500 print '<div class="clearboth"></div>';
501
502 print dol_get_fiche_end();
503
504 print '<br>';
505
506 // Contacts lines (modules that overwrite templates must declare this into descriptor)
507 $dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
508 foreach ($dirtpls as $reldir) {
509 $res = @include dol_buildpath($reldir.'/contacts.tpl.php');
510 if ($res) {
511 break;
512 }
513 }
514}
515
516// End of page
517llxFooter();
518$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 contact/addresses.
Class to build HTML component for third parties management Only common components are here.
Class to manage generation of HTML components Only common components must be here.
Class to manage projects.
Class to manage tasks.
Class to manage user groups.
Class to manage Dolibarr users.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
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).
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.
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.