dolibarr 21.0.0-alpha
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
65$hookmanager->initHooks(array('projectcontactcard', 'globalcard'));
66
67//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.
68$result = restrictedArea($user, 'projet', $id, 'projet&project');
69
70$permissiontoadd = $user->hasRight('projet', 'creer');
71
72
73/*
74 * Actions
75 */
76
77$parameters = array('id' => $id);
78$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
79if ($reshook < 0) {
80 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
81}
82
83if (empty($reshook)) {
84 // Test if we can add contact to the tasks at the same times, if not or not required, make a redirect
85 $formconfirmtoaddtasks = '';
86 if ($action == 'addcontact' && $permissiontoadd) {
87 $form = new Form($db);
88
89 $source = GETPOST("source", 'aZ09');
90
91 $taskstatic = new Task($db);
92 $task_array = $taskstatic->getTasksArray(0, 0, $object->id, 0, 0);
93 $nbTasks = count($task_array);
94
95 //If no task available, redirec to to add confirm
96 $type_to = (GETPOST('typecontact') ? 'typecontact='.GETPOST('typecontact') : 'type='.GETPOST('type'));
97 $personToAffect = (GETPOST('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid'));
98 $affect_to = (GETPOST('userid') ? 'userid='.$personToAffect : 'contactid='.$personToAffect);
99 $url_redirect = '?id='.$object->id.'&'.$affect_to.'&'.$type_to.'&source='.$source;
100
101 if ($personToAffect > 0 && (!getDolGlobalString('PROJECT_HIDE_TASKS') || $nbTasks > 0)) {
102 $text = $langs->trans('AddPersonToTask');
103 $textbody = $text.' (<a href="#" class="selectall">'.$langs->trans("SelectAll").'</a>)';
104 $formquestion = array('text' => $textbody);
105
106 $task_to_affect = array();
107 foreach ($task_array as $task) {
108 $task_already_affected = false;
109 $personsLinked = $task->liste_contact(-1, $source);
110 if (!is_array($personsLinked)) {
111 // When liste_contact() does not return an array, it's an error.
112 setEventMessage($object->error, 'errors');
113 } else {
114 foreach ($personsLinked as $person) {
115 if ($person['id'] == $personToAffect) {
116 $task_already_affected = true;
117 break;
118 }
119 }
120 if (!$task_already_affected) {
121 $task_to_affect[$task->id] = $task->id;
122 }
123 }
124 }
125
126 if (empty($task_to_affect)) {
127 $action = 'addcontact_confirm';
128 } else {
129 $formcompany = new FormCompany($db);
130 foreach ($task_array as $task) {
131 $key = $task->id;
132 $val = $task->ref . ' '.dol_trunc($task->label);
133 $formquestion[] = array(
134 'type' => 'other',
135 'name' => 'person_'.$key.',person_role_'.$key,
136 '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>',
137 'value' => $formcompany->selectTypeContact($taskstatic, '', 'person_role_'.$key, $source, 'position', 0, 'minwidth100imp', 0, 1)
138 );
139 }
140 $formquestion[] = array('type' => 'other', 'name' => 'tasksavailable', 'label' => '', 'value' => '<input type="hidden" id="tasksavailable" name="tasksavailable" value="'.implode(',', array_keys($task_to_affect)).'">');
141 }
142
143 $formconfirmtoaddtasks = $form->formconfirm($_SERVER['PHP_SELF'] . $url_redirect, $text, '', 'addcontact_confirm', $formquestion, '', 1, 300, 590);
144 $formconfirmtoaddtasks .= '
145 <script>
146 $(document).ready(function() {
147 var saveprop = false;
148 $(".selectall").click(function(){
149 console.log("We click on select all with "+saveprop);
150 if (!saveprop) {
151 $(".taskcheckboxes").prop("checked", true);
152 saveprop = true;
153 } else {
154 $(".taskcheckboxes").prop("checked", false);
155 saveprop = false;
156 }
157 });
158 });
159 </script>';
160 } else {
161 $action = 'addcontact_confirm';
162 }
163 }
164
165 // Add new contact
166 if ($action == 'addcontact_confirm' && $permissiontoadd) {
167 if (GETPOST('confirm', 'alpha') == 'no') {
168 header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
169 exit;
170 }
171
172 $contactid = (GETPOST('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid'));
173 $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
174 $groupid = GETPOSTINT('groupid');
175 $contactarray = array();
176 $errorgroup = 0;
177 $errorgrouparray = array();
178
179 if ($groupid > 0) {
180 require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
181 $usergroup = new UserGroup($db);
182 $result = $usergroup->fetch($groupid);
183 if ($result > 0) {
184 $excludefilter = 'statut = 1';
185 $tmpcontactarray = $usergroup->listUsersForGroup($excludefilter, 0);
186 if ($contactarray <= 0) {
187 $error++;
188 } else {
189 foreach ($tmpcontactarray as $tmpuser) {
190 $contactarray[] = $tmpuser->id;
191 }
192 }
193 } else {
194 $error++;
195 }
196 } elseif (! ($contactid > 0)) {
197 $error++;
198 $langs->load("errors");
199 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Contact")), null, 'errors');
200 } else {
201 $contactarray[] = $contactid;
202 }
203
204 $result = 0;
205 $result = $object->fetch($id);
206 if (!$error && $result > 0 && $id > 0) {
207 foreach ($contactarray as $key => $contactid) {
208 $result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
209
210 if ($result == 0) {
211 if ($groupid > 0) {
212 $errorgroup++;
213 $errorgrouparray[] = $contactid;
214 } else {
215 $langs->load("errors");
216 setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
217 }
218 } elseif ($result < 0) {
219 if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
220 if ($groupid > 0) {
221 $errorgroup++;
222 $errorgrouparray[] = $contactid;
223 } else {
224 $langs->load("errors");
225 setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
226 }
227 } else {
228 setEventMessages($object->error, $object->errors, 'errors');
229 }
230 }
231
232 $affecttotask = GETPOST('tasksavailable', 'intcomma');
233 if (!empty($affecttotask)) {
234 require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
235 $task_to_affect = explode(',', $affecttotask);
236 if (!empty($task_to_affect)) {
237 foreach ($task_to_affect as $task_id) {
238 if (GETPOSTISSET('person_'.$task_id) && GETPOST('person_'.$task_id, 'san_alpha')) {
239 $tasksToAffect = new Task($db);
240 $result = $tasksToAffect->fetch($task_id);
241 if ($result < 0) {
242 setEventMessages($tasksToAffect->error, null, 'errors');
243 } else {
244 $result = $tasksToAffect->add_contact($contactid, GETPOST('person_role_'.$task_id), GETPOST("source", 'aZ09'));
245 if ($result < 0) {
246 if ($tasksToAffect->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
247 $langs->load("errors");
248 setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
249 } else {
250 setEventMessages($tasksToAffect->error, $tasksToAffect->errors, 'errors');
251 }
252 }
253 }
254 }
255 }
256 }
257 }
258 }
259 }
260 if ($errorgroup > 0) {
261 $langs->load("errors");
262 if ($errorgroup == count($contactarray)) {
263 setEventMessages($langs->trans("ErrorThisGroupIsAlreadyDefinedAsThisType"), null, 'errors');
264 } else {
265 $tmpuser = new User($db);
266 foreach ($errorgrouparray as $key => $value) {
267 $tmpuser->fetch($value);
268 setEventMessages($langs->trans("ErrorThisContactXIsAlreadyDefinedAsThisType", dolGetFirstLastname($tmpuser->firstname, $tmpuser->lastname)), null, 'errors');
269 }
270 }
271 }
272
273 if ($result >= 0) {
274 header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
275 exit;
276 }
277 }
278
279 // Change contact's status
280 if ($action == 'swapstatut' && $permissiontoadd) {
281 if ($object->fetch($id)) {
282 $result = $object->swapContactStatus(GETPOSTINT('ligne'));
283 } else {
284 dol_print_error($db);
285 }
286 }
287
288 // Delete a contact
289 if (($action == 'deleteline' || $action == 'deletecontact') && $permissiontoadd) {
290 $object->fetch($id);
291 $result = $object->delete_contact(GETPOSTINT("lineid"));
292
293 if ($result >= 0) {
294 header("Location: contact.php?id=".$object->id);
295 exit;
296 } else {
297 dol_print_error($db);
298 }
299 }
300}
301
302
303/*
304 * View
305 */
306
307$form = new Form($db);
308$contactstatic = new Contact($db);
309$userstatic = new User($db);
310
311$title = $langs->trans('ProjectContact').' - '.$object->ref.' '.$object->name;
312if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) {
313 $title = $object->ref.' '.$object->name.' - '.$langs->trans('ProjectContact');
314}
315
316$help_url = 'EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos|DE:Modul_Projekte';
317
318llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-project page-card_contact');
319
320
321
322if ($id > 0 || !empty($ref)) {
323 /*
324 * View
325 */
326 if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) {
327 $object->fetchComments();
328 }
329 // To verify role of users
330 //$userAccess = $object->restrictedProjectArea($user,'read');
331 $userWrite = $object->restrictedProjectArea($user, 'write');
332 //$userDelete = $object->restrictedProjectArea($user,'delete');
333 //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
334
335 $head = project_prepare_head($object);
336 print dol_get_fiche_head($head, 'contact', $langs->trans("Project"), -1, ($object->public ? 'projectpub' : 'project'));
337
338 $formconfirm = $formconfirmtoaddtasks;
339
340 // Call Hook formConfirm
341 $parameters = array('formConfirm' => $formconfirm);
342 $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
343 if (empty($reshook)) {
344 $formconfirm .= $hookmanager->resPrint;
345 } elseif ($reshook > 0) {
346 $formconfirm = $hookmanager->resPrint;
347 }
348
349 // Print form confirm
350 print $formconfirm;
351
352 // Project card
353
354 if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) {
355 $tmpurl = $_SESSION['pageforbacktolist']['project'];
356 $tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl);
357 $linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?'). 'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
358 } else {
359 $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
360 }
361
362 $morehtmlref = '<div class="refidno">';
363 // Title
364 $morehtmlref .= dol_escape_htmltag($object->title);
365 $morehtmlref .= '<br>';
366 // Thirdparty
367 if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
368 $morehtmlref .= $object->thirdparty->getNomUrl(1, 'project');
369 }
370 $morehtmlref .= '</div>';
371
372 // Define a complementary filter for search of next/prev ref.
373 if (!$user->hasRight('projet', 'all', 'lire')) {
374 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
375 $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")";
376 }
377
378 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
379
380
381 print '<div class="fichecenter">';
382 print '<div class="fichehalfleft">';
383 print '<div class="underbanner clearboth"></div>';
384
385 print '<table class="border tableforfield centpercent">';
386
387 // Usage
388 if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJECT_HIDE_TASKS') || isModEnabled('eventorganization')) {
389 print '<tr><td class="tdtop">';
390 print $langs->trans("Usage");
391 print '</td>';
392 print '<td>';
393 if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
394 print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
395 $htmltext = $langs->trans("ProjectFollowOpportunity");
396 print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
397 print '<br>';
398 }
399 if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
400 print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
401 $htmltext = $langs->trans("ProjectFollowTasks");
402 print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
403 print '<br>';
404 }
405 if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) {
406 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"' : '')).'"> ';
407 $htmltext = $langs->trans("ProjectBillTimeDescription");
408 print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
409 print '<br>';
410 }
411 if (isModEnabled('eventorganization')) {
412 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"' : '')).'"> ';
413 $htmltext = $langs->trans("EventOrganizationDescriptionLong");
414 print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
415 }
416 print '</td></tr>';
417 }
418
419 // Visibility
420 print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
421 if ($object->public) {
422 print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"');
423 print $langs->trans('SharedProject');
424 } else {
425 print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"');
426 print $langs->trans('PrivateProject');
427 }
428 print '</td></tr>';
429
430 if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') && !empty($object->usage_opportunity)) {
431 // Opportunity status
432 print '<tr><td>'.$langs->trans("OpportunityStatus").'</td><td>';
433 $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code');
434 if ($code) {
435 print $langs->trans("OppStatus".$code);
436 }
437
438 // Opportunity percent
439 print ' <span title="'.$langs->trans("OpportunityProbability").'"> / ';
440 if (strcmp($object->opp_percent, '')) {
441 print price($object->opp_percent, 0, $langs, 1, 0).' %';
442 }
443 print '</span></td></tr>';
444
445 // Opportunity Amount
446 print '<tr><td>'.$langs->trans("OpportunityAmount").'</td><td>';
447 if (strcmp($object->opp_amount, '')) {
448 print '<span class="amount">'.price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency).'</span>';
449 if (strcmp($object->opp_percent, '')) {
450 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>';
451 }
452 }
453 print '</td></tr>';
454 }
455
456 // Budget
457 print '<tr><td>'.$langs->trans("Budget").'</td><td>';
458 if (!is_null($object->budget_amount) && strcmp($object->budget_amount, '')) {
459 print '<span class="amount">'.price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).'</span>';
460 }
461 print '</td></tr>';
462
463 // Date start - end project
464 print '<tr><td>'.$langs->trans("Dates").'</td><td>';
465 $start = dol_print_date($object->date_start, 'day');
466 print($start ? $start : '?');
467 $end = dol_print_date($object->date_end, 'day');
468 print ' <span class="opacitymedium">-</span> ';
469 print($end ? $end : '?');
470 if ($object->hasDelay()) {
471 print img_warning("Late");
472 }
473 print '</td></tr>';
474
475 // Other attributes
476 $cols = 2;
477 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
478
479 print "</table>";
480
481 print '</div>';
482 print '<div class="fichehalfright">';
483 print '<div class="underbanner clearboth"></div>';
484
485 print '<table class="border tableforfield centpercent">';
486
487 // Description
488 print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
489 print dol_htmlentitiesbr($object->description);
490 print '</td></tr>';
491
492 // Categories
493 if (isModEnabled('category')) {
494 print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
495 print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
496 print "</td></tr>";
497 }
498
499 print '</table>';
500
501 print '</div>';
502 print '</div>';
503
504 print '<div class="clearboth"></div>';
505
506 print dol_get_fiche_end();
507
508 print '<br>';
509
510 // Contacts lines (modules that overwrite templates must declare this into descriptor)
511 $dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
512 foreach ($dirtpls as $reldir) {
513 $res = @include dol_buildpath($reldir.'/contacts.tpl.php');
514 if ($res) {
515 break;
516 }
517 }
518}
519
520// End of page
521llxFooter();
522$db->close();
$id
Definition account.php:39
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:70
Class to manage 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.
llxFooter()
Footer empty.
Definition document.php:107
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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, $attop=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.
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 a 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.