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.
'/core/lib/project.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/modules/project/modules_project.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
40$langsLoad=array(
'projects',
'companies');
41if (isModEnabled(
'eventorganization')) {
42 $langsLoad[]=
'eventorganization';
45$langs->loadLangs($langsLoad);
49$action =
GETPOST(
'action',
'aZ09');
50$backtopage =
GETPOST(
'backtopage',
'alpha');
51$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
52$backtopagejsfields =
GETPOST(
'backtopagejsfields',
'alpha');
53$cancel =
GETPOST(
'cancel',
'alpha');
54$confirm =
GETPOST(
'confirm',
'aZ09');
57if (!empty($backtopagejsfields)) {
58 $tmpbacktopagejsfields = explode(
':', $backtopagejsfields);
59 $dol_openinpopup = $tmpbacktopagejsfields[0];
62$status =
GETPOST(
'status',
'int');
63$opp_status =
GETPOST(
'opp_status',
'int');
65$objcanvas =
GETPOST(
"objcanvas",
"alphanohtml");
66$comefromclone =
GETPOST(
"comefromclone",
"alphanohtml");
69$date_start_event =
dol_mktime(
GETPOST(
'date_start_eventhour',
'int'),
GETPOST(
'date_start_eventmin',
'int'),
GETPOST(
'date_start_eventsec',
'int'),
GETPOST(
'date_start_eventmonth',
'int'),
GETPOST(
'date_start_eventday',
'int'),
GETPOST(
'date_start_eventyear',
'int'));
70$date_end_event =
dol_mktime(
GETPOST(
'date_end_eventhour',
'int'),
GETPOST(
'date_end_eventmin',
'int'),
GETPOST(
'date_end_eventsec',
'int'),
GETPOST(
'date_end_eventmonth',
'int'),
GETPOST(
'date_end_eventday',
'int'),
GETPOST(
'date_end_eventyear',
'int'));
71$location =
GETPOST(
'location',
'alphanohtml');
74$mine =
GETPOST(
'mode') ==
'mine' ? 1 : 0;
78$hookmanager->initHooks(array(
'projectcard',
'globalcard'));
85if ($id > 0 || !empty($ref)) {
86 $ret = $object->fetch($id, $ref);
88 $object->fetch_thirdparty();
89 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object,
'fetchComments') && empty($object->comments)) {
90 $object->fetchComments();
97$extrafields->fetch_name_optionals_label($object->table_element);
100$socid =
GETPOST(
'socid',
'int');
104if ($id ==
'' && $ref ==
'' && ($action !=
"create" && $action !=
"add" && $action !=
"update" && !
GETPOST(
"cancel"))) {
108$permissiontoadd = $user->hasRight(
'projet',
'creer');
109$permissiontodelete = $user->hasRight(
'projet',
'supprimer');
110$permissiondellink = $user->hasRight(
'projet',
'creer');
117$parameters = array(
'id'=>$socid,
'objcanvas'=>$objcanvas);
118$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
123if (empty($reshook)) {
124 $backurlforlist = DOL_URL_ROOT.
'/projet/list.php';
128 if (
GETPOST(
"comefromclone") == 1) {
129 $result = $object->delete($user);
131 header(
"Location: index.php");
135 setEventMessages($langs->trans(
"CantRemoveProject", $langs->transnoentitiesnoconv(
"ProjectOverview")),
null,
'errors');
140 if (empty($backtopage) || ($cancel && empty($id))) {
141 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
142 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
143 $backtopage = $backurlforlist;
145 $backtopage = DOL_URL_ROOT.
'/projet/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
151 if (!empty($backtopageforcancel)) {
152 header(
"Location: ".$backtopageforcancel);
154 } elseif (!empty($backtopage)) {
155 header(
"Location: ".$backtopage);
161 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
164 if ($action ==
'confirm_setdraft' && $confirm ==
'yes' && $permissiontoadd) {
165 $result = $object->setStatut($object::STATUS_DRAFT,
null,
'',
'PROJECT_MODIFY');
176 if ($action ==
'add' && $permissiontoadd) {
179 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")),
null,
'errors');
183 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"ProjectLabel")),
null,
'errors');
187 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
188 if (
GETPOST(
'usage_opportunity') !=
'' && !(
GETPOST(
'opp_status') > 0)) {
190 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfUsage"),
null,
'errors');
192 if (
GETPOST(
'opp_amount') !=
'' && !(
GETPOST(
'opp_status') > 0)) {
194 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfAmount"),
null,
'errors');
199 if (!empty($conf->global->PROJECT_CREATE_NO_DRAFT) && !$error) {
208 $object->ref =
GETPOST(
'ref',
'alphanohtml');
209 $object->title =
GETPOST(
'title',
'alphanohtml');
210 $object->socid =
GETPOST(
'socid',
'int');
211 $object->description =
GETPOST(
'description',
'restricthtml');
212 $object->public =
GETPOST(
'public',
'alphanohtml');
214 $object->budget_amount =
price2num(
GETPOST(
'budget_amount',
'alphanohtml'));
216 $object->date_start = $date_start;
217 $object->date_end = $date_end;
218 $object->date_start_event = $date_start_event;
219 $object->date_end_event = $date_end_event;
220 $object->location = $location;
221 $object->statut = $status;
222 $object->opp_status = $opp_status;
223 $object->opp_percent = $opp_percent;
224 $object->usage_opportunity = (
GETPOST(
'usage_opportunity',
'alpha') ==
'on' ? 1 : 0);
225 $object->usage_task = (
GETPOST(
'usage_task',
'alpha') ==
'on' ? 1 : 0);
226 $object->usage_bill_time = (
GETPOST(
'usage_bill_time',
'alpha') ==
'on' ? 1 : 0);
227 $object->usage_organize_event = (
GETPOST(
'usage_organize_event',
'alpha') ==
'on' ? 1 : 0);
230 $ret = $extrafields->setOptionalsFromPost(
null, $object);
235 $result = $object->create($user);
236 if (!$error && $result > 0) {
238 $typeofcontact =
'PROJECTLEADER';
239 $result = $object->add_contact($user->id, $typeofcontact,
'internal');
245 } elseif ($result < 0) {
246 $langs->load(
"errors");
251 $langs->load(
"errors");
255 if (!$error && !empty($object->id) > 0) {
257 $categories =
GETPOST(
'categories',
'array');
258 $result = $object->setCategories($categories);
260 $langs->load(
"errors");
269 if (!empty($backtopage)) {
270 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--|__ID__/', $object->id, $backtopage);
271 $backtopage = $backtopage.
'&projectid='.$object->id;
272 header(
"Location: ".$backtopage);
275 header(
"Location:card.php?id=".$object->id);
280 unset($_POST[
"ref"]);
288 if ($action ==
'update' && empty(
GETPOST(
'cancel')) && $permissiontoadd) {
293 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")),
null,
'errors');
297 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"ProjectLabel")),
null,
'errors');
303 $object->oldcopy = clone $object;
305 $old_start_date = $object->date_start;
307 $object->ref =
GETPOST(
'ref',
'alpha');
308 $object->title =
GETPOST(
'title',
'alphanohtml');
309 $object->statut =
GETPOST(
'status',
'int');
310 $object->socid =
GETPOST(
'socid',
'int');
311 $object->description =
GETPOST(
'description',
'restricthtml');
312 $object->public =
GETPOST(
'public',
'alpha');
313 $object->date_start = (!
GETPOST(
'projectstart')) ?
'' : $date_start;
314 $object->date_end = (!
GETPOST(
'projectend')) ?
'' : $date_end;
315 $object->date_start_event = (!
GETPOST(
'date_start_event')) ?
'' : $date_start_event;
316 $object->date_end_event = (!
GETPOST(
'date_end_event')) ?
'' : $date_end_event;
317 $object->location = $location;
318 if (GETPOSTISSET(
'opp_amount')) {
321 if (GETPOSTISSET(
'budget_amount')) {
324 if (GETPOSTISSET(
'opp_status')) {
325 $object->opp_status = $opp_status;
327 if (GETPOSTISSET(
'opp_percent')) {
328 $object->opp_percent = $opp_percent;
330 $object->usage_opportunity = (
GETPOST(
'usage_opportunity',
'alpha') ==
'on' ? 1 : 0);
331 $object->usage_task = (
GETPOST(
'usage_task',
'alpha') ==
'on' ? 1 : 0);
332 $object->usage_bill_time = (
GETPOST(
'usage_bill_time',
'alpha') ==
'on' ? 1 : 0);
333 $object->usage_organize_event = (
GETPOST(
'usage_organize_event',
'alpha') ==
'on' ? 1 : 0);
336 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
342 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
343 if ($object->opp_amount && ($object->opp_status <= 0)) {
345 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfAmount"),
null,
'errors');
350 $result = $object->update($user);
360 $categories =
GETPOST(
'categories',
'array');
361 $result = $object->setCategories($categories);
370 if (
GETPOST(
"reportdate") && ($object->date_start != $old_start_date)) {
371 $result = $object->shiftTaskDate($old_start_date);
374 setEventMessages($langs->trans(
"ErrorShiftTaskDate").
':'.$object->error, $object->errors,
'errors');
381 $resclose = $object->setClose($user);
384 setEventMessages($langs->trans(
"FailedToCloseProject").
':'.$object->error, $object->errors,
'errors');
395 if (
GETPOST(
'socid',
'int') > 0) {
396 $object->fetch_thirdparty(
GETPOST(
'socid',
'int'));
398 unset($object->thirdparty);
404 if ($action ==
'builddoc' && $permissiontoadd) {
407 $object->setDocModel($user,
GETPOST(
'model',
'alpha'));
410 $outputlangs = $langs;
411 if (
GETPOST(
'lang_id',
'aZ09')) {
413 $outputlangs->setDefaultLang(
GETPOST(
'lang_id',
'aZ09'));
415 $result = $object->generateDocument($object->model_pdf, $outputlangs);
423 if ($action ==
'remove_file' && $permissiontoadd) {
424 if ($object->id > 0) {
425 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
427 $langs->load(
"other");
428 $upload_dir = $conf->project->multidir_output[$object->entity];
429 $file = $upload_dir.
'/'.
GETPOST(
'file');
441 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $permissiontoadd) {
442 $result = $object->setValid($user);
448 if ($action ==
'confirm_close' && $confirm ==
'yes' && $permissiontoadd) {
449 $result = $object->setClose($user);
455 if ($action ==
'confirm_reopen' && $confirm ==
'yes' && $permissiontoadd) {
456 $result = $object->setValid($user);
462 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
464 $result = $object->delete($user);
468 if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
469 $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
470 $tmpurl = preg_replace(
'/__SOCID__/', $object->socid, $tmpurl);
471 $urlback = $tmpurl.(preg_match(
'/\?/', $tmpurl) ?
'&' :
'?').
'restore_lastsearch_values=1';
473 $urlback = DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1';
476 header(
"Location: ".$urlback);
484 if ($action ==
'confirm_clone' && $permissiontoadd && $confirm ==
'yes') {
485 $clone_contacts =
GETPOST(
'clone_contacts') ? 1 : 0;
486 $clone_tasks =
GETPOST(
'clone_tasks') ? 1 : 0;
487 $clone_project_files =
GETPOST(
'clone_project_files') ? 1 : 0;
488 $clone_task_files =
GETPOST(
'clone_task_files') ? 1 : 0;
489 $clone_notes =
GETPOST(
'clone_notes') ? 1 : 0;
490 $move_date =
GETPOST(
'move_date') ? 1 : 0;
491 $clone_thirdparty =
GETPOST(
'socid',
'int') ?
GETPOST(
'socid',
'int') : 0;
493 $result = $object->createFromClone($user, $object->id, $clone_contacts, $clone_tasks, $clone_project_files, $clone_task_files, $clone_notes, $move_date, 0, $clone_thirdparty);
499 $newobject->fetch($result);
501 setEventMessages($langs->trans(
"ProjectCreatedInDolibarr", $newobject->ref),
"",
'mesgs');
503 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.$result.
'&action=edit&comefromclone=1');
509 $triggersendname =
'PROJECT_SENTBYMAIL';
511 $autocopy =
'MAIN_MAIL_AUTOCOPY_PROJECT_TO';
512 $trackid =
'proj'.$object->id;
513 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
521$form =
new Form($db);
524$userstatic =
new User($db);
526$title = $langs->trans(
"Project").
' - '.$object->ref.(!empty($object->thirdparty->name) ?
' - '.$object->thirdparty->name :
'').(!empty($object->title) ?
' - '.$object->title :
'');
527if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/projectnameonly/', $conf->global->MAIN_HTML_TITLE)) {
528 $title = $object->ref.(!empty($object->thirdparty->name) ?
' - '.$object->thirdparty->name :
'').(!empty($object->title) ?
' - '.$object->title :
'');
531$help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:Modul_Projekte";
535$titleboth = $langs->trans(
"LeadsOrProjects");
536$titlenew = $langs->trans(
"NewLeadOrProject");
538 $titleboth = $langs->trans(
"Projects");
539 $titlenew = $langs->trans(
"NewProject");
542 $titleboth = $langs->trans(
"Leads");
543 $titlenew = $langs->trans(
"NewLead");
546if ($action ==
'create' && $user->rights->projet->creer) {
551 $thirdparty =
new Societe($db);
553 $thirdparty->fetch($socid);
558 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
559 print
'<input type="hidden" name="action" value="add">';
560 print
'<input type="hidden" name="token" value="'.newToken().
'">';
561 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
562 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
563 print
'<input type="hidden" name="backtopagejsfields" value="'.$backtopagejsfields.
'">';
564 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
568 print
'<table class="border centpercent tableforfieldcreate">';
571 $modele = empty($conf->global->PROJECT_ADDON) ?
'mod_project_simple' : $conf->global->PROJECT_ADDON;
574 $file =
''; $classname =
''; $filefound = 0;
575 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
576 foreach ($dirmodels as $reldir) {
577 $file =
dol_buildpath($reldir.
"core/modules/project/".$modele.
'.php', 0);
578 if (file_exists($file)) {
580 $classname = $modele;
587 $modProject =
new $classname;
589 $defaultref = $modProject->getNextValue($thirdparty, $object);
592 if (is_numeric($defaultref) && $defaultref <= 0) {
598 print
'<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Ref").
'</span></td><td class><input class="maxwidth150onsmartphone" type="text" name="ref" value="'.
dol_escape_htmltag($suggestedref).
'">';
600 print
' '.$form->textwithpicto(
'', $langs->trans(
"YouCanCompleteRef", $suggestedref));
605 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Label").
'</span></td><td><input class="width500 maxwidth150onsmartphone" type="text" name="title" value="'.
dol_escape_htmltag(
GETPOST(
"title",
'alphanohtml')).
'" autofocus></td></tr>';
608 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled(
'eventorganization')) {
609 print
'<tr><td class="tdtop">';
610 print $langs->trans(
"Usage");
613 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
614 print
'<input type="checkbox" id="usage_opportunity" name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') ?
' checked="checked"' :
'') :
' checked="checked"').
'"> ';
615 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
616 print
'<label for="usage_opportunity">'.$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext).
'</label>';
618 print
'$( document ).ready(function() {
619 jQuery("#usage_opportunity").change(function() {
620 if (jQuery("#usage_opportunity").prop("checked")) {
621 console.log("Show opportunities fields");
622 jQuery(".classuseopportunity").show();
624 console.log("Hide opportunities fields "+jQuery("#usage_opportunity").prop("checked"));
625 jQuery(".classuseopportunity").hide();
629 if (GETPOSTISSET(
'usage_opportunity') && !
GETPOST(
'usage_opportunity')) {
630 print
'jQuery(".classuseopportunity").hide();';
636 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
637 print
'<input type="checkbox" id="usage_task" name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') ?
' checked="checked"' :
'') :
' checked="checked"').
'"> ';
638 $htmltext = $langs->trans(
"ProjectFollowTasks");
639 print
'<label for="usage_task">'.$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext).
'</label>';
641 print
'$( document ).ready(function() {
642 jQuery("#usage_task").change(function() {
643 if (jQuery("#usage_task").prop("checked")) {
644 console.log("Show task fields");
645 jQuery(".classusetask").show();
647 console.log("Hide tasks fields "+jQuery("#usage_task").prop("checked"));
648 jQuery(".classusetask").hide();
652 if (GETPOSTISSET(
'usage_task') && !
GETPOST(
'usage_task')) {
653 print
'jQuery(".classusetask").hide();';
659 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
660 print
'<input type="checkbox" id="usage_bill_time" name="usage_bill_time"'.(GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time',
'alpha') ?
' checked="checked"' :
'') :
'').
'"> ';
661 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
662 print
'<label for="usage_bill_time">'.$form->textwithpicto($langs->trans(
"BillTime"), $htmltext).
'</label>';
664 print
'$( document ).ready(function() {
665 jQuery("#usage_bill_time").change(function() {
666 if (jQuery("#usage_bill_time").prop("checked")) {
667 console.log("Show bill time fields");
668 jQuery(".classusebilltime").show();
670 console.log("Hide bill time fields "+jQuery("#usage_bill_time").prop("checked"));
671 jQuery(".classusebilltime").hide();
675 if (GETPOSTISSET(
'usage_bill_time') && !
GETPOST(
'usage_bill_time')) {
676 print
'jQuery(".classusebilltime").hide();';
682 if (isModEnabled(
'eventorganization')) {
683 print
'<input type="checkbox" id="usage_organize_event" name="usage_organize_event"'.(GETPOSTISSET(
'usage_organize_event') ? (
GETPOST(
'usage_organize_event',
'alpha') ?
' checked="checked"' :
'') :
'').
'"> ';
684 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
685 print
'<label for="usage_organize_event">'.$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext).
'</label>';
687 print
'$( document ).ready(function() {
688 jQuery("#usage_organize_event").change(function() {
689 if (jQuery("#usage_organize_event").prop("checked")) {
690 console.log("Show organize event fields");
691 jQuery(".classuseorganizeevent").show();
693 console.log("Hide organize event fields "+jQuery("#usage_organize_event").prop("checked"));
694 jQuery(".classuseorganizeevent").hide();
698 if (!
GETPOST(
'usage_organize_event')) {
699 print
'jQuery(".classuseorganizeevent").hide();';
709 if (isModEnabled(
'societe')) {
711 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'<span class="fieldrequired">');
712 print $langs->trans(
"ThirdParty");
713 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'</span>');
714 print
'</td><td class="maxwidthonsmartphone">';
716 if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) {
717 $filter = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
719 $text =
img_picto(
'',
'company').$form->select_company(
GETPOST(
'socid',
'int'),
'socid', $filter,
'SelectThirdParty', 1, 0, array(), 0,
'minwidth300 widthcentpercentminusxx maxwidth500');
720 if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) {
721 $texthelp = $langs->trans(
"IfNeedToUseOtherObjectKeepEmpty");
722 print $form->textwithtooltip($text.
' '.
img_help(), $texthelp, 1);
726 if (!GETPOSTISSET(
'backtopage')) {
727 $url =
'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?action=create');
728 $newbutton =
'<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddThirdParty").
'"></span>';
731 $tmpbacktopagejsfields =
'addthirdparty:socid,search_socid';
732 print
dolButtonToOpenUrlInDialogPopup(
'addthirdparty', $langs->transnoentitiesnoconv(
'AddThirdParty'), $newbutton, $url,
'',
'',
'', $tmpbacktopagejsfields);
734 print
' <a href="'.DOL_URL_ROOT.$url.
'">'.$newbutton.
'</a>';
742 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
743 print
'<input type="hidden" name="status" value="'.$status.
'">';
744 print $object->LibStatut($status, 4);
749 print
'<tr><td>'.$langs->trans(
"Visibility").
'</td><td class="maxwidthonsmartphone">';
751 if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) {
752 $array[0] = $langs->trans(
"PrivateProject");
754 if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) {
755 $array[1] = $langs->trans(
"SharedProject");
758 if (count($array) > 0) {
759 print $form->selectarray(
'public', $array,
GETPOST(
'public'), 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
761 print
'<input type="hidden" name="public" id="public" value="'.GETPOST(
'public').
'">';
764 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
765 print $langs->trans(
"PrivateProject");
767 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
768 print $langs->trans(
"SharedProject");
773 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
775 print
'<tr class="classuseopportunity"><td><span class="fieldrequired">'.$langs->trans(
"OpportunityStatus").
'</span></td>';
776 print
'<td class="maxwidthonsmartphone">';
777 print $formproject->selectOpportunityStatus(
'opp_status', GETPOSTISSET(
'opp_status') ?
GETPOST(
'opp_status') : $object->opp_status, 1, 0, 0, 0,
'', 0, 1);
780 print
' <input class="width50 right" type="text" id="opp_percent" name="opp_percent" title="'.dol_escape_htmltag($langs->trans(
"OpportunityProbability")).
'" value="'.
dol_escape_htmltag(GETPOSTISSET(
'opp_percent') ?
GETPOST(
'opp_percent') :
'').
'"><span class="hideonsmartphone"> %</span>';
781 print
'<input type="hidden" name="opp_percent_not_set" id="opp_percent_not_set" value="'.dol_escape_htmltag(GETPOSTISSET(
'opp_percent') ?
'0' :
'1').
'">';
786 print
'<tr class="classuseopportunity"><td>'.$langs->trans(
"OpportunityAmount").
'</td>';
787 print
'<td><input class="width75 right" type="text" name="opp_amount" value="'.dol_escape_htmltag(GETPOSTISSET(
'opp_amount') ?
GETPOST(
'opp_amount') :
'').
'">';
788 print
' '.$langs->getCurrencySymbol($conf->currency);
794 print
'<tr><td>'.$langs->trans(
"Budget").
'</td>';
795 print
'<td><input class="width75 right" type="text" name="budget_amount" value="'.dol_escape_htmltag(GETPOSTISSET(
'budget_amount') ?
GETPOST(
'budget_amount') :
'').
'">';
796 print
' '.$langs->getCurrencySymbol($conf->currency);
801 print
'<tr><td>'.$langs->trans(
"Date").(isModEnabled(
'eventorganization') ?
' <span class="classuseorganizeevent">('.$langs->trans(
"Project").
')</span>' :
'').
'</td><td>';
802 print $form->selectDate(($date_start ? $date_start :
''),
'projectstart', 0, 0, 0,
'', 1, 0);
803 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
804 print $form->selectDate(($date_end ? $date_end : -1),
'projectend', 0, 0, 0,
'', 1, 0);
807 if (isModEnabled(
'eventorganization')) {
809 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Date").
' ('.$langs->trans(
"Event").
')</td><td>';
810 print $form->selectDate(($date_start_event ? $date_start_event : -1),
'date_start_event', 1, 1, 1,
'', 1, 0);
811 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
812 print $form->selectDate(($date_end_event ? $date_end_event : -1),
'date_end_event', 1, 1, 1,
'', 1, 0);
816 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Location").
'</td>';
817 print
'<td><input class="minwidth300 maxwidth500" type="text" name="location" value="'.dol_escape_htmltag($location).
'"></td>';
822 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
824 $doleditor =
new DolEditor(
'description',
GETPOST(
"description",
'restricthtml'),
'', 90,
'dolibarr_notes',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_3,
'90%');
825 $doleditor->Create();
828 if (isModEnabled(
'categorie')) {
830 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
831 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT,
'',
'parent', 64, 0, 1);
832 $arrayselected =
GETPOST(
'categories',
'array');
833 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
838 $parameters = array();
839 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
840 print $hookmanager->resPrint;
841 if (empty($reshook)) {
842 print $object->showOptionals($extrafields,
'create');
849 print $form->buttonsSaveCancel(
'CreateDraft');
855 print
'<script type="text/javascript">
856 jQuery(document).ready(function() {
857 function change_percent()
859 var element = jQuery("#opp_status option:selected");
860 var defaultpercent = element.attr("defaultpercent");
861 /*if (jQuery("#opp_percent_not_set").val() == "") */
862 jQuery("#opp_percent").val(defaultpercent);
866 jQuery("#opp_status").change(function() {
870 jQuery("#usage_task").change(function() {
871 console.log("We click on usage task "+jQuery("#usage_task").is(":checked"));
872 if (! jQuery("#usage_task").is(":checked")) {
873 jQuery("#usage_bill_time").prop("checked", false);
877 jQuery("#usage_bill_time").change(function() {
878 console.log("We click on usage to bill time");
879 if (jQuery("#usage_bill_time").is(":checked")) {
880 jQuery("#usage_task").prop("checked", true);
885} elseif ($object->id > 0) {
890 $res = $object->fetch_optionals();
893 $userAccess = $object->restrictedProjectArea($user,
'read');
894 $userWrite = $object->restrictedProjectArea($user,
'write');
895 $userDelete = $object->restrictedProjectArea($user,
'delete');
900 if ($action ==
'validate') {
901 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ValidateProject'), $langs->trans(
'ConfirmValidateProject'),
'confirm_validate',
'', 0, 1);
904 if ($action ==
'close') {
905 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"CloseAProject"), $langs->trans(
"ConfirmCloseAProject"),
"confirm_close",
'',
'', 1);
908 if ($action ==
'reopen') {
909 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"ReOpenAProject"), $langs->trans(
"ConfirmReOpenAProject"),
"confirm_reopen",
'',
'', 1);
912 if ($action ==
'delete') {
913 $text = $langs->trans(
"ConfirmDeleteAProject");
914 $task =
new Task($db);
915 $taskarray = $task->getTasksArray(0, 0, $object->id, 0, 0);
916 $nboftask = count($taskarray);
918 $text .=
'<br>'.img_warning().
' '.$langs->trans(
"ThisWillAlsoRemoveTasks", $nboftask);
920 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"DeleteAProject"), $text,
"confirm_delete",
'',
'', 1);
924 if ($action ==
'clone') {
925 $formquestion = array(
926 'text' => $langs->trans(
"ConfirmClone"),
927 array(
'type' =>
'other',
'name' =>
'socid',
'label' => $langs->trans(
"SelectThirdParty"),
'value' => $form->select_company(
GETPOST(
'socid',
'int') > 0 ?
GETPOST(
'socid',
'int') : $object->socid,
'socid',
'',
"None", 0, 0, null, 0,
'minwidth200 maxwidth250')),
928 array(
'type' =>
'checkbox',
'name' =>
'clone_contacts',
'label' => $langs->trans(
"CloneContacts"),
'value' => true),
929 array(
'type' =>
'checkbox',
'name' =>
'clone_tasks',
'label' => $langs->trans(
"CloneTasks"),
'value' => true),
930 array(
'type' =>
'checkbox',
'name' =>
'move_date',
'label' => $langs->trans(
"CloneMoveDate"),
'value' => true),
931 array(
'type' =>
'checkbox',
'name' =>
'clone_notes',
'label' => $langs->trans(
"CloneNotes"),
'value' => true),
932 array(
'type' =>
'checkbox',
'name' =>
'clone_project_files',
'label' => $langs->trans(
"CloneProjectFiles"),
'value' => false),
933 array(
'type' =>
'checkbox',
'name' =>
'clone_task_files',
'label' => $langs->trans(
"CloneTaskFiles"),
'value' => false)
936 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"ToClone"), $langs->trans(
"ConfirmCloneProject"),
"confirm_clone", $formquestion,
'', 1, 400, 590);
940 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
941 print
'<input type="hidden" name="token" value="'.newToken().
'">';
942 print
'<input type="hidden" name="action" value="update">';
943 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
944 print
'<input type="hidden" name="comefromclone" value="'.$comefromclone.
'">';
948 if ($action ==
'edit' && $userWrite > 0) {
949 print
dol_get_fiche_head($head,
'project', $langs->trans(
"Project"), 0, ($object->public ?
'projectpub' :
'project'));
951 print
'<table class="border centpercent">';
954 $suggestedref = $object->ref;
955 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Ref").
'</td>';
956 print
'<td><input size="25" name="ref" value="'.$suggestedref.
'">';
957 print
' '.$form->textwithpicto(
'', $langs->trans(
"YouCanCompleteRef", $suggestedref));
961 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
962 print
'<td><input class="quatrevingtpercent" name="title" value="'.dol_escape_htmltag($object->title).
'"></td></tr>';
965 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td><td>';
966 print
'<select class="flat" name="status" id="status">';
967 foreach ($object->statuts_short as $key => $val) {
968 print
'<option value="'.$key.
'"'.((GETPOSTISSET(
'status') ?
GETPOST(
'status') : $object->
statut) == $key ?
' selected="selected"' :
'').
'>'.$langs->trans($val).
'</option>';
975 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled(
'eventorganization')) {
976 print
'<tr><td class="tdtop">';
977 print $langs->trans(
"Usage");
980 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
981 print
'<input type="checkbox" id="usage_opportunity" name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'> ';
982 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
983 print
'<label for="usage_opportunity">'.$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext).
'</label>';
985 print
'$( document ).ready(function() {
986 jQuery("#usage_opportunity").change(function() {
987 set_usage_opportunity();
990 set_usage_opportunity();
992 function set_usage_opportunity() {
993 console.log("set_usage_opportunity");
994 if (jQuery("#usage_opportunity").prop("checked")) {
995 console.log("Show opportunities fields");
996 jQuery(".classuseopportunity").show();
998 console.log("Hide opportunities fields "+jQuery("#usage_opportunity").prop("checked"));
999 jQuery(".classuseopportunity").hide();
1006 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
1007 print
'<input type="checkbox" id="usage_task" name="usage_task"' . (GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')) .
'> ';
1008 $htmltext = $langs->trans(
"ProjectFollowTasks");
1009 print
'<label for="usage_task">'.$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext).
'</label>';
1011 print
'$( document ).ready(function() {
1012 jQuery("#usage_task").change(function() {
1018 function set_usage_task() {
1019 console.log("set_usage_task");
1020 if (jQuery("#usage_task").prop("checked")) {
1021 console.log("Show task fields");
1022 jQuery(".classusetask").show();
1024 console.log("Hide task fields "+jQuery("#usage_task").prop("checked"));
1025 jQuery(".classusetask").hide();
1032 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
1033 print
'<input type="checkbox" id="usage_bill_time" name="usage_bill_time"' . (GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_bill_time ?
' checked="checked"' :
'')) .
'> ';
1034 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
1035 print
'<label for="usage_bill_time">'.$form->textwithpicto($langs->trans(
"BillTime"), $htmltext).
'</label>';
1037 print
'$( document ).ready(function() {
1038 jQuery("#usage_bill_time").change(function() {
1039 set_usage_bill_time();
1042 set_usage_bill_time();
1044 function set_usage_bill_time() {
1045 console.log("set_usage_bill_time");
1046 if (jQuery("#usage_bill_time").prop("checked")) {
1047 console.log("Show bill time fields");
1048 jQuery(".classusebilltime").show();
1050 console.log("Hide bill time fields "+jQuery("#usage_bill_time").prop("checked"));
1051 jQuery(".classusebilltime").hide();
1058 if (isModEnabled(
'eventorganization')) {
1059 print
'<input type="checkbox" id="usage_organize_event" name="usage_organize_event"'. (GETPOSTISSET(
'usage_organize_event') ? (
GETPOST(
'usage_organize_event',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_organize_event ?
' checked="checked"' :
'')) .
'> ';
1060 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
1061 print
'<label for="usage_organize_event">'.$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext).
'</label>';
1063 print
'$( document ).ready(function() {
1064 jQuery("#usage_organize_event").change(function() {
1070 function set_usage_event() {
1071 console.log("set_usage_event");
1072 if (jQuery("#usage_organize_event").prop("checked")) {
1073 console.log("Show organize event fields");
1074 jQuery(".classuseorganizeevent").show();
1076 console.log("Hide organize event fields "+jQuery("#usage_organize_event").prop("checked"));
1077 jQuery(".classuseorganizeevent").hide();
1088 if (isModEnabled(
'societe')) {
1090 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'<span class="fieldrequired">');
1091 print $langs->trans(
"ThirdParty");
1092 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'</span>');
1095 if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) {
1096 $filter = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
1098 $text =
img_picto(
'',
'company',
'class="pictofixedwidth"');
1099 $text .= $form->select_company($object->thirdparty->id,
'socid', $filter,
'None', 1, 0, array(), 0,
'minwidth300');
1100 if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) {
1101 $texthelp = $langs->trans(
"IfNeedToUseOtherObjectKeepEmpty");
1102 print $form->textwithtooltip($text.
' '.
img_help(), $texthelp, 1, 0,
'',
'', 2);
1110 print
'<tr><td>'.$langs->trans(
"Visibility").
'</td><td>';
1112 if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) {
1113 $array[0] = $langs->trans(
"PrivateProject");
1115 if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) {
1116 $array[1] = $langs->trans(
"SharedProject");
1119 if (count($array) > 0) {
1120 print $form->selectarray(
'public', $array, $object->public, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1122 print
'<input type="hidden" id="public" name="public" value="'.$object->public.
'">';
1124 if ($object->public == 0) {
1125 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
1126 print $langs->trans(
"PrivateProject");
1128 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
1129 print $langs->trans(
"SharedProject");
1134 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
1135 $classfortr = ($object->usage_opportunity ?
'' :
' hideobject');
1137 print
'<tr class="classuseopportunity'.$classfortr.
'"><td>'.$langs->trans(
"OpportunityStatus").
'</td>';
1140 print $formproject->selectOpportunityStatus(
'opp_status', $object->opp_status, 1, 0, 0, 0,
'minwidth150 inline-block valignmiddle', 1, 1);
1143 print
' <input class="width50 right" type="text" id="opp_percent" name="opp_percent" title="'.dol_escape_htmltag($langs->trans(
"OpportunityProbability")).
'" value="'.(GETPOSTISSET(
'opp_percent') ?
GETPOST(
'opp_percent') : (strcmp($object->opp_percent,
'') ?
vatrate($object->opp_percent) :
'')).
'"> %';
1144 print
'<span id="oldopppercent" class="opacitymedium"></span>';
1147 print
'<div id="divtocloseproject" class="inline-block valign clearboth paddingtop" style="display: none;">';
1148 print
'<input type="checkbox" id="inputcloseproject" name="closeproject" />';
1149 print
'<label for="inputcloseproject">';
1150 print $form->textwithpicto($langs->trans(
"AlsoCloseAProject"), $langs->trans(
"AlsoCloseAProjectTooltip")).
'</label>';
1157 print
'<tr class="classuseopportunity'.$classfortr.
'"><td>'.$langs->trans(
"OpportunityAmount").
'</td>';
1158 print
'<td><input class="width75 right" type="text" name="opp_amount" value="'.(GETPOSTISSET(
'opp_amount') ?
GETPOST(
'opp_amount') : (strcmp($object->opp_amount,
'') ?
price2num($object->opp_amount) :
'')).
'">';
1159 print $langs->getCurrencySymbol($conf->currency);
1165 print
'<tr><td>'.$langs->trans(
"Budget").
'</td>';
1166 print
'<td><input class="width75 right" type="text" name="budget_amount" value="'.(GETPOSTISSET(
'budget_amount') ?
GETPOST(
'budget_amount') : (strcmp($object->budget_amount,
'') ?
price2num($object->budget_amount) :
'')).
'">';
1167 print $langs->getCurrencySymbol($conf->currency);
1172 print
'<tr><td>'.$langs->trans(
"Date").(isModEnabled(
'eventorganization') ?
' <span class="classuseorganizeevent">('.$langs->trans(
"Project").
')</span>' :
'').
'</td><td>';
1173 print $form->selectDate($object->date_start ? $object->date_start : -1,
'projectstart', 0, 0, 0,
'', 1, 0);
1174 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
1175 print $form->selectDate($object->date_end ? $object->date_end : -1,
'projectend', 0, 0, 0,
'', 1, 0);
1176 $object->getLinesArray(
null, 0);
1177 if (!empty($object->usage_task) && !empty($object->lines)) {
1178 print
' <span id="divreportdate" class="hidden"> <input type="checkbox" class="valignmiddle" id="reportdate" name="reportdate" value="yes" ';
1179 if ($comefromclone) {
1182 print
'/><label for="reportdate" class="valignmiddle opacitymedium">'.$langs->trans(
"ProjectReportDate").
'</label></span>';
1186 if (isModEnabled(
'eventorganization')) {
1188 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Date").
' ('.$langs->trans(
"Event").
')</td><td>';
1189 print $form->selectDate(($date_start_event ? $date_start_event : ($object->date_start_event ? $object->date_start_event : -1)),
'date_start_event', 1, 1, 1,
'', 1, 0);
1190 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
1191 print $form->selectDate(($date_end_event ? $date_end_event : ($object->date_end_event ? $object->date_end_event : -1)),
'date_end_event', 1, 1, 1,
'', 1, 0);
1195 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Location").
'</td>';
1196 print
'<td><input class="minwidth300 maxwidth500" type="text" name="location" value="'.dol_escape_htmltag(GETPOSTISSET(
'location') ?
GETPOST(
'location') : $object->location).
'"></td>';
1201 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
1203 $doleditor =
new DolEditor(
'description', $object->description,
'', 90,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_3,
'90%');
1204 $doleditor->Create();
1208 if (isModEnabled(
'categorie')) {
1209 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
1210 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT,
'',
'parent', 64, 0, 1);
1212 $cats = $c->containing($object->id, Categorie::TYPE_PROJECT);
1213 foreach ($cats as $cat) {
1214 $arrayselected[] = $cat->id;
1216 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0,
'0');
1221 $parameters = array();
1222 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1223 print $hookmanager->resPrint;
1224 if (empty($reshook)) {
1225 print $object->showOptionals($extrafields,
'edit');
1230 print
dol_get_fiche_head($head,
'project', $langs->trans(
"Project"), -1, ($object->public ?
'projectpub' :
'project'));
1234 if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
1235 $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
1236 $tmpurl = preg_replace(
'/__SOCID__/', $object->socid, $tmpurl);
1237 $linkback =
'<a href="'.$tmpurl.(preg_match(
'/\?/', $tmpurl) ?
'&' :
'?').
'restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1239 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1242 $morehtmlref =
'<div class="refidno">';
1245 $morehtmlref .=
'<br>';
1247 if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
1248 $morehtmlref .= $object->thirdparty->getNomUrl(1,
'project');
1250 $morehtmlref .=
'</div>';
1253 if (empty($user->rights->projet->all->lire)) {
1254 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
1255 $object->next_prev_filter =
"rowid IN (".$db->sanitize(count($objectsListId) ? join(
',', array_keys($objectsListId)) :
'0').
")";
1258 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1260 print
'<div class="fichecenter">';
1261 print
'<div class="fichehalfleft">';
1262 print
'<div class="underbanner clearboth"></div>';
1264 print
'<table class="border tableforfield centpercent">';
1267 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled(
'eventorganization')) {
1268 print
'<tr><td class="tdtop">';
1269 print $langs->trans(
"Usage");
1272 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
1273 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'> ';
1274 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
1275 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
1278 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
1279 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')).
'> ';
1280 $htmltext = $langs->trans(
"ProjectFollowTasks");
1281 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
1284 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
1285 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"' :
'')).
'> ';
1286 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
1287 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
1291 if (isModEnabled(
'eventorganization')) {
1292 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"' :
'')).
'> ';
1293 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
1294 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
1300 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
1301 if ($object->public) {
1302 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
1303 print $langs->trans(
'SharedProject');
1305 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
1306 print $langs->trans(
'PrivateProject');
1310 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && !empty($object->usage_opportunity)) {
1312 print
'<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
1313 $code =
dol_getIdFromCode($db, $object->opp_status,
'c_lead_status',
'rowid',
'code');
1315 print $langs->trans(
"OppStatus".$code);
1319 print
' <span title="'.$langs->trans(
"OpportunityProbability").
'"> / ';
1320 if (strcmp($object->opp_percent,
'')) {
1321 print
price($object->opp_percent, 0, $langs, 1, 0).
' %';
1323 print
'</span></td></tr>';
1326 print
'<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
1327 if (strcmp($object->opp_amount,
'')) {
1328 print
'<span class="amount">'.price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency).
'</span>';
1329 if (strcmp($object->opp_percent,
'')) {
1330 print
' <span title="'.dol_escape_htmltag($langs->trans(
'OpportunityWeightedAmount')).
'"><span class="opacitymedium">'.$langs->trans(
"Weighted").
'</span>: <span class="amount">'.
price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).
'</span></span>';
1337 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
1338 if (!is_null($object->budget_amount) && strcmp($object->budget_amount,
'')) {
1339 print
'<span class="amount">'.price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
1344 print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
1346 print ($start ? $start :
'?');
1348 print
' <span class="opacitymedium">-</span> ';
1349 print ($end ? $end :
'?');
1350 if ($object->hasDelay()) {
1357 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1362 print
'<div class="fichehalfright">';
1363 print
'<div class="underbanner clearboth"></div>';
1365 print
'<table class="border tableforfield centpercent">';
1368 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
1373 if (isModEnabled(
'categorie')) {
1374 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
1375 print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
1384 print
'<div class="clearboth"></div>';
1389 if ($action ==
'edit' && $userWrite > 0) {
1390 print $form->buttonsSaveCancel();
1396 print
'<script type="text/javascript">
1397 jQuery(document).ready(function() {
1398 jQuery("#usage_task").change(function() {
1399 console.log("We click on usage task "+jQuery("#usage_task").is(":checked"));
1400 if (! jQuery("#usage_task").is(":checked")) {
1401 jQuery("#usage_bill_time").prop("checked", false);
1405 jQuery("#usage_bill_time").change(function() {
1406 console.log("We click on usage to bill time");
1407 if (jQuery("#usage_bill_time").is(":checked")) {
1408 jQuery("#usage_task").prop("checked", true);
1412 jQuery("#projectstart").change(function() {
1413 console.log("We modify the start date");
1414 jQuery("#divreportdate").show();
1420 if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
1422 $defaultcheckedwhenoppclose = 1;
1423 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
1424 $defaultcheckedwhenoppclose = 0;
1427 print
'<!-- Javascript to manage opportunity status change -->';
1428 print
'<script type="text/javascript">
1429 jQuery(document).ready(function() {
1430 function change_percent()
1432 var element = jQuery("#opp_status option:selected");
1433 var defaultpercent = element.attr("defaultpercent");
1434 var defaultcloseproject = '.((int) $defaultcheckedwhenoppclose).
';
1435 var elemcode = element.attr("elemcode");
1436 var oldpercent = \''.
dol_escape_js($object->opp_percent).
'\';
1438 console.log(
"We select "+elemcode);
1441 var closeproject = 0;
1442 if (elemcode == \
'LOST\') closeproject = 1;
1443 if (elemcode == \'WON\') closeproject = defaultcloseproject;
1444 if (closeproject) jQuery("#inputcloseproject").prop("checked", true);
1445 else jQuery("#inputcloseproject").prop("checked", false);
1447 /* Make the close project checkbox visible or not */
1448 console.log("closeproject="+closeproject);
1449 if (elemcode == \'WON\' || elemcode == \'LOST\')
1451 jQuery("#divtocloseproject").show();
1455 jQuery("#divtocloseproject").hide();
1458 /* Change percent with default percent (defaultpercent) if new status (defaultpercent) is higher than current (jQuery("#opp_percent").val()) */
1459 if (oldpercent != \'\' && (parseFloat(defaultpercent) < parseFloat(oldpercent)))
1461 console.log("oldpercent="+oldpercent+" defaultpercent="+defaultpercent+" def < old");
1462 if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') {
1463 jQuery("#oldopppercent").text(\' - '.
dol_escape_js($langs->transnoentities(
"PreviousValue")).
': \'+price2numjs(oldpercent)+\' %\');
1466 if (parseFloat(oldpercent) != 100 && elemcode != \'LOST\') { jQuery("#opp_percent").val(oldpercent); }
1467 else { jQuery("#opp_percent").val(price2numjs(defaultpercent)); }
1469 console.log("oldpercent="+oldpercent+" defaultpercent="+defaultpercent);
1470 if (jQuery("#opp_percent").val() == \'\' || (parseFloat(jQuery("#opp_percent").val()) < parseFloat(defaultpercent))) {
1471 if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') {
1472 jQuery("#oldopppercent").text(\' - '.
dol_escape_js($langs->transnoentities(
"PreviousValue")).
': \'+price2numjs(oldpercent)+\' %\');
1474 jQuery("#opp_percent").val(price2numjs(defaultpercent));
1479 jQuery("#opp_status").change(function() {
1491 print
'<div class="tabsAction">';
1492 $parameters = array();
1493 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1495 if (empty($reshook)) {
1496 if ($action !=
"edit" && $action !=
'presend') {
1506 if (empty($user->socid)) {
1508 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend&token='.newToken().
'&id='.$object->id.
'&mode=init#formmailbeforetitle',
'');
1528 if ($userWrite > 0) {
1529 print
dolGetButtonAction(
'', $langs->trans(
'SetToDraft'),
'default', $_SERVER[
"PHP_SELF"].
'?action=confirm_setdraft&confirm=yes&token='.newToken().
'&id='.$object->id,
'');
1531 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'SetToDraft'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1538 if ($userWrite > 0) {
1539 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?action=edit&token='.newToken().
'&id='.$object->id,
'');
1541 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Modify'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1547 if ($userWrite > 0) {
1548 print
dolGetButtonAction(
'', $langs->trans(
'Validate'),
'default', $_SERVER[
"PHP_SELF"].
'?action=validate&token='.newToken().
'&id='.$object->id,
'');
1550 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1556 if ($userWrite > 0) {
1557 print
dolGetButtonAction(
'', $langs->trans(
'Close'),
'default', $_SERVER[
"PHP_SELF"].
'?action=close&token='.newToken().
'&id='.$object->id,
'');
1559 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Close'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1565 if ($userWrite > 0) {
1566 print
dolGetButtonAction(
'', $langs->trans(
'ReOpen'),
'default', $_SERVER[
"PHP_SELF"].
'?action=reopen&token='.newToken().
'&id='.$object->id,
'');
1568 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'ReOpen'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1573 if (empty($conf->global->PROJECT_HIDE_CREATE_OBJECT_BUTTON)) {
1575 $is_customer_or_prospect = (!empty($object->thirdparty->prospect) || !empty($object->thirdparty->client));
1576 $is_supplier_only= (!empty($object->thirdparty->fournisseur) && $is_customer_or_prospect ==
false);
1578 $arrayforbutaction = array(
1579 10 => array(
'lang'=>
'propal',
'enabled'=>(isModEnabled(
"propal") && $is_customer_or_prospect ==
true),
'perm'=>$user->hasRight(
'propal',
'creer'),
'label' =>
'AddProp',
'url'=>
'/comm/propal/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid),
1580 20 => array(
'lang'=>
'orders',
'enabled'=>(isModEnabled(
"commande") && $is_customer_or_prospect ==
true),
'perm'=>$user->hasRight(
'commande',
'creer'),
'label' =>
'CreateOrder',
'url'=>
'/commande/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid),
1581 30 => array(
'lang'=>
'bills',
'enabled'=>(isModEnabled(
"facture") && $is_customer_or_prospect ==
true),
'perm'=>$user->hasRight(
'facture',
'creer'),
'label' =>
'CreateBill',
'url'=>
'/compta/facture/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid),
1582 40 => array(
'lang'=>
'supplier_proposal',
'enabled'=>isModEnabled(
"supplier_proposal"),
'perm'=>$user->hasRight(
'supplier_proposal',
'creer'),
'label' =>
'AddSupplierProposal',
'url'=>
'/supplier_proposal/card.php?action=create&projectid='.$object->id.($is_supplier_only ==
true ?
'&socid='.$object->socid :
'')),
1583 50 => array(
'lang'=>
'suppliers',
'enabled'=>isModEnabled(
"supplier_order"),
'perm'=>$user->hasRight(
'fournisseur',
'commande',
'creer'),
'label' =>
'AddSupplierOrder',
'url'=>
'/fourn/commande/card.php?action=create&projectid='.$object->id.($is_supplier_only == true ?
'&socid='.$object->socid :
'')),
1584 60 => array(
'lang'=>
'suppliers',
'enabled'=>isModEnabled(
"supplier_invoice"),
'perm'=>$user->hasRight(
'fournisseur',
'facture',
'creer'),
'label' =>
'AddSupplierInvoice',
'url'=>
'/fourn/facture/card.php?action=create&projectid='.$object->id.($is_supplier_only == true ?
'&socid='.$object->socid :
'')),
1585 70 => array(
'lang'=>
'interventions',
'enabled'=>isModEnabled(
"ficheinter"),
'perm'=>$user->hasRight(
'fichinter',
'creer'),
'label' =>
'AddIntervention',
'url'=>
'/fichinter/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid),
1586 80 => array(
'lang'=>
'contracts',
'enabled'=>isModEnabled(
"contrat"),
'perm'=>$user->hasRight(
'contrat',
'creer'),
'label' =>
'AddContract',
'url'=>
'/contrat/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid),
1587 90 => array(
'lang'=>
'trips',
'enabled'=>isModEnabled(
"expensereport"),
'perm'=>$user->hasRight(
'expensereport',
'creer'),
'label' =>
'AddTrip',
'url'=>
'/expensereport/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid),
1588 100 => array(
'lang'=>
'donations',
'enabled'=>isModEnabled(
"don"),
'perm'=>$user->hasRight(
'don',
'creer'),
'label' =>
'AddDonation',
'url'=>
'/don/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid),
1591 $params = array(
'backtopage' => $_SERVER[
"PHP_SELF"].
'?id='.$object->id);
1593 print
dolGetButtonAction($langs->trans(
"Create"),
'',
'default', $arrayforbutaction,
'', 1, $params);
1597 if ($user->hasRight(
'projet',
'creer')) {
1598 if ($userWrite > 0) {
1599 print
dolGetButtonAction(
'', $langs->trans(
'ToClone'),
'default', $_SERVER[
"PHP_SELF"].
'?action=clone&token='.newToken().
'&id='.$object->id,
'');
1601 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'ToClone'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1606 if ($user->hasRight(
'projet',
'supprimer') || ($object->statut ==
Project::STATUS_DRAFT && $user->hasRight(
'projet',
'creer'))) {
1607 if ($userDelete > 0 || ($object->statut ==
Project::STATUS_DRAFT && $user->hasRight(
'projet',
'creer'))) {
1608 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $_SERVER[
"PHP_SELF"].
'?action=delete&token='.newToken().
'&id='.$object->id,
'');
1610 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Delete'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1618 if (
GETPOST(
'modelselected')) {
1619 $action =
'presend';
1622 if ($action !=
'presend') {
1623 print
'<div class="fichecenter"><div class="fichehalfleft">';
1624 print
'<a name="builddoc"></a>';
1630 $filedir = $conf->project->multidir_output[$object->entity].
"/".
dol_sanitizeFileName($object->ref);
1631 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1632 $genallowed = ($user->hasRight(
'projet',
'lire') && $userAccess > 0);
1633 $delallowed = ($user->hasRight(
'projet',
'creer') && $userWrite > 0);
1635 print $formfile->showdocuments(
'project', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 0, 0,
'',
'',
'',
'',
'', $object);
1637 print
'</div><div class="fichehalfright">';
1641 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/projet/messaging.php?id='.$object->id);
1644 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1646 $somethingshown =
$formactions->showactions($object,
'project', 0, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1648 print
'</div></div>';
1652 $modelmail =
'project';
1653 $defaulttopic =
'SendProjectRef';
1654 $defaulttopiclang =
'projects';
1655 $diroutput = $conf->project->multidir_output[$object->entity];
1656 $autocopy =
'MAIN_MAIL_AUTOCOPY_PROJECT_TO';
1657 $trackid =
'proj'.$object->id;
1659 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
1662 $parameters = array();
1663 $reshook = $hookmanager->executeHooks(
'mainCardTabAddMore', $parameters, $object, $action);
1665 print $langs->trans(
"RecordNotFound");
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action=='set') elseif( $action=='specimen') elseif($action=='setmodel') elseif( $action=='del') elseif($action=='setdoc') $formactions
View.
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage categories.
Class to manage a WYSIWYG editor.
Class to manage projects.
const STATUS_VALIDATED
Open/Validated status.
const STATUS_CLOSED
Closed status.
const STATUS_DRAFT
Draft status.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
Class to manage Dolibarr users.
print $langs trans("Ref").' m m m statut
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_help($usehelpcursor=1, $usealttitle=1)
Show help logo with cursor "?".
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $backtopagejsfields='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
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_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
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.
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_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.