27require
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/modules/project/modules_project.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
39$langsLoad=array(
'projects',
'companies');
40if (isModEnabled(
'eventorganization')) {
41 $langsLoad[]=
'eventorganization';
44$langs->loadLangs($langsLoad);
48$action =
GETPOST(
'action',
'aZ09');
49$backtopage =
GETPOST(
'backtopage',
'alpha');
50$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
51$backtopagejsfields =
GETPOST(
'backtopagejsfields',
'alpha');
52$cancel =
GETPOST(
'cancel',
'alpha');
53$confirm =
GETPOST(
'confirm',
'aZ09');
56if (!empty($backtopagejsfields)) {
57 $tmpbacktopagejsfields = explode(
':', $backtopagejsfields);
58 $dol_openinpopup = $tmpbacktopagejsfields[0];
61$status =
GETPOST(
'status',
'int');
62$opp_status =
GETPOST(
'opp_status',
'int');
64$objcanvas =
GETPOST(
"objcanvas",
"alphanohtml");
65$comefromclone =
GETPOST(
"comefromclone",
"alphanohtml");
68$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'));
69$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'));
70$location =
GETPOST(
'location',
'alphanohtml');
73$mine =
GETPOST(
'mode') ==
'mine' ? 1 : 0;
77$hookmanager->initHooks(array(
'projectcard',
'globalcard'));
84if ($id > 0 || !empty($ref)) {
85 $ret = $object->fetch($id, $ref);
87 $object->fetch_thirdparty();
88 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object,
'fetchComments') && empty($object->comments)) {
89 $object->fetchComments();
96$extrafields->fetch_name_optionals_label($object->table_element);
99$socid =
GETPOST(
'socid',
'int');
103if ($id ==
'' && $ref ==
'' && ($action !=
"create" && $action !=
"add" && $action !=
"update" && !
GETPOST(
"cancel"))) {
107$permissiontoadd = $user->hasRight(
'projet',
'creer');
108$permissiontodelete = $user->hasRight(
'projet',
'supprimer');
109$permissiondellink = $user->hasRight(
'projet',
'creer');
116$parameters = array(
'id'=>$socid,
'objcanvas'=>$objcanvas);
117$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
122if (empty($reshook)) {
123 $backurlforlist = DOL_URL_ROOT.
'/projet/list.php';
127 if (
GETPOST(
"comefromclone") == 1) {
128 $result = $object->delete($user);
130 header(
"Location: index.php");
134 setEventMessages($langs->trans(
"CantRemoveProject", $langs->transnoentitiesnoconv(
"ProjectOverview")),
null,
'errors');
139 if (empty($backtopage) || ($cancel && empty($id))) {
140 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
141 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
142 $backtopage = $backurlforlist;
144 $backtopage = DOL_URL_ROOT.
'/projet/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
150 if (!empty($backtopageforcancel)) {
151 header(
"Location: ".$backtopageforcancel);
153 } elseif (!empty($backtopage)) {
154 header(
"Location: ".$backtopage);
160 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
163 if ($action ==
'confirm_setdraft' && $confirm ==
'yes' && $permissiontoadd) {
164 $result = $object->setStatut($object::STATUS_DRAFT,
null,
'',
'PROJECT_MODIFY');
175 if ($action ==
'add' && $permissiontoadd) {
178 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")),
null,
'errors');
182 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"ProjectLabel")),
null,
'errors');
186 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
187 if (
GETPOST(
'usage_opportunity') !=
'' && !(
GETPOST(
'opp_status') > 0)) {
189 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfUsage"),
null,
'errors');
191 if (
GETPOST(
'opp_amount') !=
'' && !(
GETPOST(
'opp_status') > 0)) {
193 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfAmount"),
null,
'errors');
198 if (!empty($conf->global->PROJECT_CREATE_NO_DRAFT) && !$error) {
207 $object->ref =
GETPOST(
'ref',
'alphanohtml');
208 $object->title =
GETPOST(
'title',
'alphanohtml');
209 $object->socid =
GETPOST(
'socid',
'int');
210 $object->description =
GETPOST(
'description',
'restricthtml');
211 $object->public =
GETPOST(
'public',
'alphanohtml');
213 $object->budget_amount =
price2num(
GETPOST(
'budget_amount',
'alphanohtml'));
215 $object->date_start = $date_start;
216 $object->date_end = $date_end;
217 $object->date_start_event = $date_start_event;
218 $object->date_end_event = $date_end_event;
219 $object->location = $location;
220 $object->statut = $status;
221 $object->opp_status = $opp_status;
222 $object->opp_percent = $opp_percent;
223 $object->usage_opportunity = (
GETPOST(
'usage_opportunity',
'alpha') ==
'on' ? 1 : 0);
224 $object->usage_task = (
GETPOST(
'usage_task',
'alpha') ==
'on' ? 1 : 0);
225 $object->usage_bill_time = (
GETPOST(
'usage_bill_time',
'alpha') ==
'on' ? 1 : 0);
226 $object->usage_organize_event = (
GETPOST(
'usage_organize_event',
'alpha') ==
'on' ? 1 : 0);
229 $ret = $extrafields->setOptionalsFromPost(
null, $object);
234 $result = $object->create($user);
235 if (!$error && $result > 0) {
237 $typeofcontact =
'PROJECTLEADER';
238 $result = $object->add_contact($user->id, $typeofcontact,
'internal');
244 } elseif ($result < 0) {
245 $langs->load(
"errors");
250 $langs->load(
"errors");
254 if (!$error && !empty($object->id) > 0) {
256 $categories =
GETPOST(
'categories',
'array');
257 $result = $object->setCategories($categories);
259 $langs->load(
"errors");
268 if (!empty($backtopage)) {
269 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--|__ID__/', $object->id, $backtopage);
270 $backtopage = $backtopage.
'&projectid='.$object->id;
271 header(
"Location: ".$backtopage);
274 header(
"Location:card.php?id=".$object->id);
279 unset($_POST[
"ref"]);
287 if ($action ==
'update' && empty(
GETPOST(
'cancel')) && $permissiontoadd) {
292 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")),
null,
'errors');
296 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"ProjectLabel")),
null,
'errors');
302 $object->oldcopy = clone $object;
304 $old_start_date = $object->date_start;
306 $object->ref =
GETPOST(
'ref',
'alpha');
307 $object->title =
GETPOST(
'title',
'alphanohtml');
308 $object->statut =
GETPOST(
'status',
'int');
309 $object->socid =
GETPOST(
'socid',
'int');
310 $object->description =
GETPOST(
'description',
'restricthtml');
311 $object->public =
GETPOST(
'public',
'alpha');
312 $object->date_start = (!
GETPOST(
'projectstart')) ?
'' : $date_start;
313 $object->date_end = (!
GETPOST(
'projectend')) ?
'' : $date_end;
314 $object->date_start_event = (!
GETPOST(
'date_start_event')) ?
'' : $date_start_event;
315 $object->date_end_event = (!
GETPOST(
'date_end_event')) ?
'' : $date_end_event;
316 $object->location = $location;
317 if (GETPOSTISSET(
'opp_amount')) {
320 if (GETPOSTISSET(
'budget_amount')) {
323 if (GETPOSTISSET(
'opp_status')) {
324 $object->opp_status = $opp_status;
326 if (GETPOSTISSET(
'opp_percent')) {
327 $object->opp_percent = $opp_percent;
329 $object->usage_opportunity = (
GETPOST(
'usage_opportunity',
'alpha') ==
'on' ? 1 : 0);
330 $object->usage_task = (
GETPOST(
'usage_task',
'alpha') ==
'on' ? 1 : 0);
331 $object->usage_bill_time = (
GETPOST(
'usage_bill_time',
'alpha') ==
'on' ? 1 : 0);
332 $object->usage_organize_event = (
GETPOST(
'usage_organize_event',
'alpha') ==
'on' ? 1 : 0);
335 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
341 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
342 if ($object->opp_amount && ($object->opp_status <= 0)) {
344 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfAmount"),
null,
'errors');
349 $result = $object->update($user);
359 $categories =
GETPOST(
'categories',
'array');
360 $result = $object->setCategories($categories);
369 if (
GETPOST(
"reportdate") && ($object->date_start != $old_start_date)) {
370 $result = $object->shiftTaskDate($old_start_date);
373 setEventMessages($langs->trans(
"ErrorShiftTaskDate").
':'.$object->error, $object->errors,
'errors');
380 $resclose = $object->setClose($user);
383 setEventMessages($langs->trans(
"FailedToCloseProject").
':'.$object->error, $object->errors,
'errors');
394 if (
GETPOST(
'socid',
'int') > 0) {
395 $object->fetch_thirdparty(
GETPOST(
'socid',
'int'));
397 unset($object->thirdparty);
403 if ($action ==
'builddoc' && $permissiontoadd) {
406 $object->setDocModel($user,
GETPOST(
'model',
'alpha'));
409 $outputlangs = $langs;
410 if (
GETPOST(
'lang_id',
'aZ09')) {
412 $outputlangs->setDefaultLang(
GETPOST(
'lang_id',
'aZ09'));
414 $result = $object->generateDocument($object->model_pdf, $outputlangs);
422 if ($action ==
'remove_file' && $permissiontoadd) {
423 if ($object->id > 0) {
424 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
426 $langs->load(
"other");
427 $upload_dir = $conf->project->multidir_output[$object->entity];
428 $file = $upload_dir.
'/'.
GETPOST(
'file');
440 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $permissiontoadd) {
441 $result = $object->setValid($user);
447 if ($action ==
'confirm_close' && $confirm ==
'yes' && $permissiontoadd) {
448 $result = $object->setClose($user);
454 if ($action ==
'confirm_reopen' && $confirm ==
'yes' && $permissiontoadd) {
455 $result = $object->setValid($user);
461 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
463 $result = $object->delete($user);
467 if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
468 $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
469 $tmpurl = preg_replace(
'/__SOCID__/', $object->socid, $tmpurl);
470 $urlback = $tmpurl.(preg_match(
'/\?/', $tmpurl) ?
'&' :
'?').
'restore_lastsearch_values=1';
472 $urlback = DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1';
475 header(
"Location: ".$urlback);
483 if ($action ==
'confirm_clone' && $permissiontoadd && $confirm ==
'yes') {
484 $clone_contacts =
GETPOST(
'clone_contacts') ? 1 : 0;
485 $clone_tasks =
GETPOST(
'clone_tasks') ? 1 : 0;
486 $clone_project_files =
GETPOST(
'clone_project_files') ? 1 : 0;
487 $clone_task_files =
GETPOST(
'clone_task_files') ? 1 : 0;
488 $clone_notes =
GETPOST(
'clone_notes') ? 1 : 0;
489 $move_date =
GETPOST(
'move_date') ? 1 : 0;
490 $clone_thirdparty =
GETPOST(
'socid',
'int') ?
GETPOST(
'socid',
'int') : 0;
492 $result = $object->createFromClone($user, $object->id, $clone_contacts, $clone_tasks, $clone_project_files, $clone_task_files, $clone_notes, $move_date, 0, $clone_thirdparty);
498 $newobject->fetch($result);
499 $newobject->fetch_optionals();
500 $newobject->fetch_thirdparty();
501 $object = $newobject;
503 $comefromclone =
true;
505 setEventMessages($langs->trans(
"ProjectCreatedInDolibarr", $newobject->ref),
"",
'mesgs');
511 $triggersendname =
'PROJECT_SENTBYMAIL';
513 $autocopy =
'MAIN_MAIL_AUTOCOPY_PROJECT_TO';
514 $trackid =
'proj'.$object->id;
515 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
523$form =
new Form($db);
526$userstatic =
new User($db);
528$title = $langs->trans(
"Project").
' - '.$object->ref.(!empty($object->thirdparty->name) ?
' - '.$object->thirdparty->name :
'').(!empty($object->title) ?
' - '.$object->title :
'');
529if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/projectnameonly/', $conf->global->MAIN_HTML_TITLE)) {
530 $title = $object->ref.(!empty($object->thirdparty->name) ?
' - '.$object->thirdparty->name :
'').(!empty($object->title) ?
' - '.$object->title :
'');
533$help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:Modul_Projekte";
537$titleboth = $langs->trans(
"LeadsOrProjects");
538$titlenew = $langs->trans(
"NewLeadOrProject");
540 $titleboth = $langs->trans(
"Projects");
541 $titlenew = $langs->trans(
"NewProject");
544 $titleboth = $langs->trans(
"Leads");
545 $titlenew = $langs->trans(
"NewLead");
548if ($action ==
'create' && $user->rights->projet->creer) {
553 $thirdparty =
new Societe($db);
555 $thirdparty->fetch($socid);
560 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
561 print
'<input type="hidden" name="action" value="add">';
562 print
'<input type="hidden" name="token" value="'.newToken().
'">';
563 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
564 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
565 print
'<input type="hidden" name="backtopagejsfields" value="'.$backtopagejsfields.
'">';
566 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
570 print
'<table class="border centpercent tableforfieldcreate">';
573 $modele = empty($conf->global->PROJECT_ADDON) ?
'mod_project_simple' : $conf->global->PROJECT_ADDON;
576 $file =
''; $classname =
''; $filefound = 0;
577 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
578 foreach ($dirmodels as $reldir) {
579 $file =
dol_buildpath($reldir.
"core/modules/project/".$modele.
'.php', 0);
580 if (file_exists($file)) {
582 $classname = $modele;
589 $modProject =
new $classname;
591 $defaultref = $modProject->getNextValue($thirdparty, $object);
594 if (is_numeric($defaultref) && $defaultref <= 0) {
600 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).
'">';
602 print
' '.$form->textwithpicto(
'', $langs->trans(
"YouCanCompleteRef", $suggestedref));
607 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>';
610 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled(
'eventorganization')) {
611 print
'<tr><td class="tdtop">';
612 print $langs->trans(
"Usage");
615 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
616 print
'<input type="checkbox" id="usage_opportunity" name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') ?
' checked="checked"' :
'') :
' checked="checked"').
'"> ';
617 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
618 print
'<label for="usage_opportunity">'.$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext).
'</label>';
620 print
'$( document ).ready(function() {
621 jQuery("#usage_opportunity").change(function() {
622 if (jQuery("#usage_opportunity").prop("checked")) {
623 console.log("Show opportunities fields");
624 jQuery(".classuseopportunity").show();
626 console.log("Hide opportunities fields "+jQuery("#usage_opportunity").prop("checked"));
627 jQuery(".classuseopportunity").hide();
631 if (GETPOSTISSET(
'usage_opportunity') && !
GETPOST(
'usage_opportunity')) {
632 print
'jQuery(".classuseopportunity").hide();';
638 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
639 print
'<input type="checkbox" id="usage_task" name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') ?
' checked="checked"' :
'') :
' checked="checked"').
'"> ';
640 $htmltext = $langs->trans(
"ProjectFollowTasks");
641 print
'<label for="usage_task">'.$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext).
'</label>';
643 print
'$( document ).ready(function() {
644 jQuery("#usage_task").change(function() {
645 if (jQuery("#usage_task").prop("checked")) {
646 console.log("Show task fields");
647 jQuery(".classusetask").show();
649 console.log("Hide tasks fields "+jQuery("#usage_task").prop("checked"));
650 jQuery(".classusetask").hide();
654 if (GETPOSTISSET(
'usage_task') && !
GETPOST(
'usage_task')) {
655 print
'jQuery(".classusetask").hide();';
661 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
662 print
'<input type="checkbox" id="usage_bill_time" name="usage_bill_time"'.(GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time',
'alpha') ?
' checked="checked"' :
'') :
'').
'"> ';
663 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
664 print
'<label for="usage_bill_time">'.$form->textwithpicto($langs->trans(
"BillTime"), $htmltext).
'</label>';
666 print
'$( document ).ready(function() {
667 jQuery("#usage_bill_time").change(function() {
668 if (jQuery("#usage_bill_time").prop("checked")) {
669 console.log("Show bill time fields");
670 jQuery(".classusebilltime").show();
672 console.log("Hide bill time fields "+jQuery("#usage_bill_time").prop("checked"));
673 jQuery(".classusebilltime").hide();
677 if (GETPOSTISSET(
'usage_bill_time') && !
GETPOST(
'usage_bill_time')) {
678 print
'jQuery(".classusebilltime").hide();';
684 if (isModEnabled(
'eventorganization')) {
685 print
'<input type="checkbox" id="usage_organize_event" name="usage_organize_event"'.(GETPOSTISSET(
'usage_organize_event') ? (
GETPOST(
'usage_organize_event',
'alpha') ?
' checked="checked"' :
'') :
'').
'"> ';
686 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
687 print
'<label for="usage_organize_event">'.$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext).
'</label>';
689 print
'$( document ).ready(function() {
690 jQuery("#usage_organize_event").change(function() {
691 if (jQuery("#usage_organize_event").prop("checked")) {
692 console.log("Show organize event fields");
693 jQuery(".classuseorganizeevent").show();
695 console.log("Hide organize event fields "+jQuery("#usage_organize_event").prop("checked"));
696 jQuery(".classuseorganizeevent").hide();
700 if (!
GETPOST(
'usage_organize_event')) {
701 print
'jQuery(".classuseorganizeevent").hide();';
711 if (isModEnabled(
'societe')) {
713 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'<span class="fieldrequired">');
714 print $langs->trans(
"ThirdParty");
715 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'</span>');
716 print
'</td><td class="maxwidthonsmartphone">';
718 if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) {
719 $filter = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
721 $text =
img_picto(
'',
'company').$form->select_company(
GETPOST(
'socid',
'int'),
'socid', $filter,
'SelectThirdParty', 1, 0, array(), 0,
'minwidth300 widthcentpercentminusxx maxwidth500');
722 if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) {
723 $texthelp = $langs->trans(
"IfNeedToUseOtherObjectKeepEmpty");
724 print $form->textwithtooltip($text.
' '.
img_help(), $texthelp, 1);
728 if (!GETPOSTISSET(
'backtopage')) {
729 $url =
'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?action=create');
730 $newbutton =
'<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddThirdParty").
'"></span>';
733 $tmpbacktopagejsfields =
'addthirdparty:socid,search_socid';
734 print
dolButtonToOpenUrlInDialogPopup(
'addthirdparty', $langs->transnoentitiesnoconv(
'AddThirdParty'), $newbutton, $url,
'',
'',
'', $tmpbacktopagejsfields);
736 print
' <a href="'.DOL_URL_ROOT.$url.
'">'.$newbutton.
'</a>';
744 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
745 print
'<input type="hidden" name="status" value="'.$status.
'">';
746 print $object->LibStatut($status, 4);
751 print
'<tr><td>'.$langs->trans(
"Visibility").
'</td><td class="maxwidthonsmartphone">';
753 if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) {
754 $array[0] = $langs->trans(
"PrivateProject");
756 if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) {
757 $array[1] = $langs->trans(
"SharedProject");
760 if (count($array) > 0) {
761 print $form->selectarray(
'public', $array,
GETPOST(
'public'), 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
763 print
'<input type="hidden" name="public" id="public" value="'.GETPOST(
'public').
'">';
766 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
767 print $langs->trans(
"PrivateProject");
769 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
770 print $langs->trans(
"SharedProject");
775 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
777 print
'<tr class="classuseopportunity"><td><span class="fieldrequired">'.$langs->trans(
"OpportunityStatus").
'</span></td>';
778 print
'<td class="maxwidthonsmartphone">';
779 print $formproject->selectOpportunityStatus(
'opp_status', GETPOSTISSET(
'opp_status') ?
GETPOST(
'opp_status') : $object->opp_status, 1, 0, 0, 0,
'', 0, 1);
782 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>';
783 print
'<input type="hidden" name="opp_percent_not_set" id="opp_percent_not_set" value="'.dol_escape_htmltag(GETPOSTISSET(
'opp_percent') ?
'0' :
'1').
'">';
788 print
'<tr class="classuseopportunity"><td>'.$langs->trans(
"OpportunityAmount").
'</td>';
789 print
'<td><input class="width75 right" type="text" name="opp_amount" value="'.dol_escape_htmltag(GETPOSTISSET(
'opp_amount') ?
GETPOST(
'opp_amount') :
'').
'">';
790 print
' '.$langs->getCurrencySymbol($conf->currency);
796 print
'<tr><td>'.$langs->trans(
"Budget").
'</td>';
797 print
'<td><input class="width75 right" type="text" name="budget_amount" value="'.dol_escape_htmltag(GETPOSTISSET(
'budget_amount') ?
GETPOST(
'budget_amount') :
'').
'">';
798 print
' '.$langs->getCurrencySymbol($conf->currency);
803 print
'<tr><td>'.$langs->trans(
"Date").(isModEnabled(
'eventorganization') ?
' <span class="classuseorganizeevent">('.$langs->trans(
"Project").
')</span>' :
'').
'</td><td>';
804 print $form->selectDate(($date_start ? $date_start :
''),
'projectstart', 0, 0, 0,
'', 1, 0);
805 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
806 print $form->selectDate(($date_end ? $date_end : -1),
'projectend', 0, 0, 0,
'', 1, 0);
809 if (isModEnabled(
'eventorganization')) {
811 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Date").
' ('.$langs->trans(
"Event").
')</td><td>';
812 print $form->selectDate(($date_start_event ? $date_start_event : -1),
'date_start_event', 1, 1, 1,
'', 1, 0);
813 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
814 print $form->selectDate(($date_end_event ? $date_end_event : -1),
'date_end_event', 1, 1, 1,
'', 1, 0);
818 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Location").
'</td>';
819 print
'<td><input class="minwidth300 maxwidth500" type="text" name="location" value="'.dol_escape_htmltag($location).
'"></td>';
824 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
826 $doleditor =
new DolEditor(
'description',
GETPOST(
"description",
'restricthtml'),
'', 90,
'dolibarr_notes',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_3,
'90%');
827 $doleditor->Create();
830 if (isModEnabled(
'categorie')) {
832 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
833 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT,
'',
'parent', 64, 0, 1);
834 $arrayselected =
GETPOST(
'categories',
'array');
835 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
840 $parameters = array();
841 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
842 print $hookmanager->resPrint;
843 if (empty($reshook)) {
844 print $object->showOptionals($extrafields,
'create');
851 print $form->buttonsSaveCancel(
'CreateDraft');
857 print
'<script type="text/javascript">
858 jQuery(document).ready(function() {
859 function change_percent()
861 var element = jQuery("#opp_status option:selected");
862 var defaultpercent = element.attr("defaultpercent");
863 /*if (jQuery("#opp_percent_not_set").val() == "") */
864 jQuery("#opp_percent").val(defaultpercent);
868 jQuery("#opp_status").change(function() {
872 jQuery("#usage_task").change(function() {
873 console.log("We click on usage task "+jQuery("#usage_task").is(":checked"));
874 if (! jQuery("#usage_task").is(":checked")) {
875 jQuery("#usage_bill_time").prop("checked", false);
879 jQuery("#usage_bill_time").change(function() {
880 console.log("We click on usage to bill time");
881 if (jQuery("#usage_bill_time").is(":checked")) {
882 jQuery("#usage_task").prop("checked", true);
887} elseif ($object->id > 0) {
892 $res = $object->fetch_optionals();
895 $userAccess = $object->restrictedProjectArea($user,
'read');
896 $userWrite = $object->restrictedProjectArea($user,
'write');
897 $userDelete = $object->restrictedProjectArea($user,
'delete');
902 if ($action ==
'validate') {
903 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ValidateProject'), $langs->trans(
'ConfirmValidateProject'),
'confirm_validate',
'', 0, 1);
906 if ($action ==
'close') {
907 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"CloseAProject"), $langs->trans(
"ConfirmCloseAProject"),
"confirm_close",
'',
'', 1);
910 if ($action ==
'reopen') {
911 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"ReOpenAProject"), $langs->trans(
"ConfirmReOpenAProject"),
"confirm_reopen",
'',
'', 1);
914 if ($action ==
'delete') {
915 $text = $langs->trans(
"ConfirmDeleteAProject");
916 $task =
new Task($db);
917 $taskarray = $task->getTasksArray(0, 0, $object->id, 0, 0);
918 $nboftask = count($taskarray);
920 $text .=
'<br>'.img_warning().
' '.$langs->trans(
"ThisWillAlsoRemoveTasks", $nboftask);
922 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"DeleteAProject"), $text,
"confirm_delete",
'',
'', 1);
926 if ($action ==
'clone') {
927 $formquestion = array(
928 'text' => $langs->trans(
"ConfirmClone"),
929 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')),
930 array(
'type' =>
'checkbox',
'name' =>
'clone_contacts',
'label' => $langs->trans(
"CloneContacts"),
'value' => true),
931 array(
'type' =>
'checkbox',
'name' =>
'clone_tasks',
'label' => $langs->trans(
"CloneTasks"),
'value' => true),
932 array(
'type' =>
'checkbox',
'name' =>
'move_date',
'label' => $langs->trans(
"CloneMoveDate"),
'value' => true),
933 array(
'type' =>
'checkbox',
'name' =>
'clone_notes',
'label' => $langs->trans(
"CloneNotes"),
'value' => true),
934 array(
'type' =>
'checkbox',
'name' =>
'clone_project_files',
'label' => $langs->trans(
"CloneProjectFiles"),
'value' => false),
935 array(
'type' =>
'checkbox',
'name' =>
'clone_task_files',
'label' => $langs->trans(
"CloneTaskFiles"),
'value' => false)
938 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"ToClone"), $langs->trans(
"ConfirmCloneProject"),
"confirm_clone", $formquestion,
'', 1, 400, 590);
942 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
943 print
'<input type="hidden" name="token" value="'.newToken().
'">';
944 print
'<input type="hidden" name="action" value="update">';
945 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
946 print
'<input type="hidden" name="comefromclone" value="'.$comefromclone.
'">';
950 if ($action ==
'edit' && $userWrite > 0) {
951 print
dol_get_fiche_head($head,
'project', $langs->trans(
"Project"), 0, ($object->public ?
'projectpub' :
'project'));
953 print
'<table class="border centpercent">';
956 $suggestedref = $object->ref;
957 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Ref").
'</td>';
958 print
'<td><input size="25" name="ref" value="'.$suggestedref.
'">';
959 print
' '.$form->textwithpicto(
'', $langs->trans(
"YouCanCompleteRef", $suggestedref));
963 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
964 print
'<td><input class="quatrevingtpercent" name="title" value="'.dol_escape_htmltag($object->title).
'"></td></tr>';
967 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td><td>';
968 print
'<select class="flat" name="status" id="status">';
969 foreach ($object->statuts_short as $key => $val) {
970 print
'<option value="'.$key.
'"'.((GETPOSTISSET(
'status') ?
GETPOST(
'status') : $object->
statut) == $key ?
' selected="selected"' :
'').
'>'.$langs->trans($val).
'</option>';
977 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled(
'eventorganization')) {
978 print
'<tr><td class="tdtop">';
979 print $langs->trans(
"Usage");
982 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
983 print
'<input type="checkbox" id="usage_opportunity" name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'> ';
984 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
985 print
'<label for="usage_opportunity">'.$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext).
'</label>';
987 print
'$( document ).ready(function() {
988 jQuery("#usage_opportunity").change(function() {
989 set_usage_opportunity();
992 set_usage_opportunity();
994 function set_usage_opportunity() {
995 console.log("set_usage_opportunity");
996 if (jQuery("#usage_opportunity").prop("checked")) {
997 console.log("Show opportunities fields");
998 jQuery(".classuseopportunity").show();
1000 console.log("Hide opportunities fields "+jQuery("#usage_opportunity").prop("checked"));
1001 jQuery(".classuseopportunity").hide();
1008 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
1009 print
'<input type="checkbox" id="usage_task" name="usage_task"' . (GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')) .
'> ';
1010 $htmltext = $langs->trans(
"ProjectFollowTasks");
1011 print
'<label for="usage_task">'.$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext).
'</label>';
1013 print
'$( document ).ready(function() {
1014 jQuery("#usage_task").change(function() {
1020 function set_usage_task() {
1021 console.log("set_usage_task");
1022 if (jQuery("#usage_task").prop("checked")) {
1023 console.log("Show task fields");
1024 jQuery(".classusetask").show();
1026 console.log("Hide task fields "+jQuery("#usage_task").prop("checked"));
1027 jQuery(".classusetask").hide();
1034 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
1035 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"' :
'')) .
'> ';
1036 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
1037 print
'<label for="usage_bill_time">'.$form->textwithpicto($langs->trans(
"BillTime"), $htmltext).
'</label>';
1039 print
'$( document ).ready(function() {
1040 jQuery("#usage_bill_time").change(function() {
1041 set_usage_bill_time();
1044 set_usage_bill_time();
1046 function set_usage_bill_time() {
1047 console.log("set_usage_bill_time");
1048 if (jQuery("#usage_bill_time").prop("checked")) {
1049 console.log("Show bill time fields");
1050 jQuery(".classusebilltime").show();
1052 console.log("Hide bill time fields "+jQuery("#usage_bill_time").prop("checked"));
1053 jQuery(".classusebilltime").hide();
1060 if (isModEnabled(
'eventorganization')) {
1061 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"' :
'')) .
'> ';
1062 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
1063 print
'<label for="usage_organize_event">'.$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext).
'</label>';
1065 print
'$( document ).ready(function() {
1066 jQuery("#usage_organize_event").change(function() {
1072 function set_usage_event() {
1073 console.log("set_usage_event");
1074 if (jQuery("#usage_organize_event").prop("checked")) {
1075 console.log("Show organize event fields");
1076 jQuery(".classuseorganizeevent").show();
1078 console.log("Hide organize event fields "+jQuery("#usage_organize_event").prop("checked"));
1079 jQuery(".classuseorganizeevent").hide();
1090 if (isModEnabled(
'societe')) {
1092 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'<span class="fieldrequired">');
1093 print $langs->trans(
"ThirdParty");
1094 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'</span>');
1097 if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) {
1098 $filter = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
1100 $text =
img_picto(
'',
'company',
'class="pictofixedwidth"');
1101 $text .= $form->select_company($object->thirdparty->id,
'socid', $filter,
'None', 1, 0, array(), 0,
'minwidth300');
1102 if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) {
1103 $texthelp = $langs->trans(
"IfNeedToUseOtherObjectKeepEmpty");
1104 print $form->textwithtooltip($text.
' '.
img_help(), $texthelp, 1, 0,
'',
'', 2);
1112 print
'<tr><td>'.$langs->trans(
"Visibility").
'</td><td>';
1114 if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) {
1115 $array[0] = $langs->trans(
"PrivateProject");
1117 if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) {
1118 $array[1] = $langs->trans(
"SharedProject");
1121 if (count($array) > 0) {
1122 print $form->selectarray(
'public', $array, $object->public, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1124 print
'<input type="hidden" id="public" name="public" value="'.$object->public.
'">';
1126 if ($object->public == 0) {
1127 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
1128 print $langs->trans(
"PrivateProject");
1130 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
1131 print $langs->trans(
"SharedProject");
1136 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
1137 $classfortr = ($object->usage_opportunity ?
'' :
' hideobject');
1139 print
'<tr class="classuseopportunity'.$classfortr.
'"><td>'.$langs->trans(
"OpportunityStatus").
'</td>';
1142 print $formproject->selectOpportunityStatus(
'opp_status', $object->opp_status, 1, 0, 0, 0,
'minwidth150 inline-block valignmiddle', 1, 1);
1145 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) :
'')).
'"> %';
1146 print
'<span id="oldopppercent" class="opacitymedium"></span>';
1149 print
'<div id="divtocloseproject" class="inline-block valign clearboth paddingtop" style="display: none;">';
1150 print
'<input type="checkbox" id="inputcloseproject" name="closeproject" />';
1151 print
'<label for="inputcloseproject">';
1152 print $form->textwithpicto($langs->trans(
"AlsoCloseAProject"), $langs->trans(
"AlsoCloseAProjectTooltip")).
'</label>';
1159 print
'<tr class="classuseopportunity'.$classfortr.
'"><td>'.$langs->trans(
"OpportunityAmount").
'</td>';
1160 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) :
'')).
'">';
1161 print $langs->getCurrencySymbol($conf->currency);
1167 print
'<tr><td>'.$langs->trans(
"Budget").
'</td>';
1168 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) :
'')).
'">';
1169 print $langs->getCurrencySymbol($conf->currency);
1174 print
'<tr><td>'.$langs->trans(
"Date").(isModEnabled(
'eventorganization') ?
' <span class="classuseorganizeevent">('.$langs->trans(
"Project").
')</span>' :
'').
'</td><td>';
1175 print $form->selectDate($object->date_start ? $object->date_start : -1,
'projectstart', 0, 0, 0,
'', 1, 0);
1176 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
1177 print $form->selectDate($object->date_end ? $object->date_end : -1,
'projectend', 0, 0, 0,
'', 1, 0);
1178 $object->getLinesArray(
null, 0);
1179 if (!empty($object->usage_task) && !empty($object->lines)) {
1180 print
' <span id="divreportdate" class="hidden"> <input type="checkbox" class="valignmiddle" id="reportdate" name="reportdate" value="yes" ';
1181 if ($comefromclone) {
1184 print
'/><label for="reportdate" class="valignmiddle opacitymedium">'.$langs->trans(
"ProjectReportDate").
'</label></span>';
1188 if (isModEnabled(
'eventorganization')) {
1190 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Date").
' ('.$langs->trans(
"Event").
')</td><td>';
1191 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);
1192 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
1193 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);
1197 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Location").
'</td>';
1198 print
'<td><input class="minwidth300 maxwidth500" type="text" name="location" value="'.dol_escape_htmltag(GETPOSTISSET(
'location') ?
GETPOST(
'location') : $object->location).
'"></td>';
1203 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
1205 $doleditor =
new DolEditor(
'description', $object->description,
'', 90,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_3,
'90%');
1206 $doleditor->Create();
1210 if (isModEnabled(
'categorie')) {
1211 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
1212 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT,
'',
'parent', 64, 0, 1);
1214 $cats = $c->containing($object->id, Categorie::TYPE_PROJECT);
1215 foreach ($cats as $cat) {
1216 $arrayselected[] = $cat->id;
1218 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0,
'0');
1223 $parameters = array();
1224 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1225 print $hookmanager->resPrint;
1226 if (empty($reshook)) {
1227 print $object->showOptionals($extrafields,
'edit');
1232 print
dol_get_fiche_head($head,
'project', $langs->trans(
"Project"), -1, ($object->public ?
'projectpub' :
'project'));
1236 if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
1237 $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
1238 $tmpurl = preg_replace(
'/__SOCID__/', $object->socid, $tmpurl);
1239 $linkback =
'<a href="'.$tmpurl.(preg_match(
'/\?/', $tmpurl) ?
'&' :
'?').
'restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1241 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1244 $morehtmlref =
'<div class="refidno">';
1247 $morehtmlref .=
'<br>';
1249 if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
1250 $morehtmlref .= $object->thirdparty->getNomUrl(1,
'project');
1252 $morehtmlref .=
'</div>';
1255 if (empty($user->rights->projet->all->lire)) {
1256 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
1257 $object->next_prev_filter =
"rowid IN (".$db->sanitize(count($objectsListId) ? join(
',', array_keys($objectsListId)) :
'0').
")";
1260 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1262 print
'<div class="fichecenter">';
1263 print
'<div class="fichehalfleft">';
1264 print
'<div class="underbanner clearboth"></div>';
1266 print
'<table class="border tableforfield centpercent">';
1269 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled(
'eventorganization')) {
1270 print
'<tr><td class="tdtop">';
1271 print $langs->trans(
"Usage");
1274 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
1275 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'> ';
1276 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
1277 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
1280 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
1281 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')).
'> ';
1282 $htmltext = $langs->trans(
"ProjectFollowTasks");
1283 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
1286 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
1287 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"' :
'')).
'> ';
1288 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
1289 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
1293 if (isModEnabled(
'eventorganization')) {
1294 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"' :
'')).
'> ';
1295 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
1296 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
1302 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
1303 if ($object->public) {
1304 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
1305 print $langs->trans(
'SharedProject');
1307 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
1308 print $langs->trans(
'PrivateProject');
1312 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && !empty($object->usage_opportunity)) {
1314 print
'<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
1315 $code =
dol_getIdFromCode($db, $object->opp_status,
'c_lead_status',
'rowid',
'code');
1317 print $langs->trans(
"OppStatus".$code);
1321 print
' <span title="'.$langs->trans(
"OpportunityProbability").
'"> / ';
1322 if (strcmp($object->opp_percent,
'')) {
1323 print
price($object->opp_percent, 0, $langs, 1, 0).
' %';
1325 print
'</span></td></tr>';
1328 print
'<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
1329 if (strcmp($object->opp_amount,
'')) {
1330 print
'<span class="amount">'.price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency).
'</span>';
1331 if (strcmp($object->opp_percent,
'')) {
1332 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>';
1339 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
1340 if (!is_null($object->budget_amount) && strcmp($object->budget_amount,
'')) {
1341 print
'<span class="amount">'.price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
1346 print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
1348 print ($start ? $start :
'?');
1350 print
' <span class="opacitymedium">-</span> ';
1351 print ($end ? $end :
'?');
1352 if ($object->hasDelay()) {
1359 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1364 print
'<div class="fichehalfright">';
1365 print
'<div class="underbanner clearboth"></div>';
1367 print
'<table class="border tableforfield centpercent">';
1370 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
1375 if (isModEnabled(
'categorie')) {
1376 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
1377 print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
1386 print
'<div class="clearboth"></div>';
1391 if ($action ==
'edit' && $userWrite > 0) {
1392 print $form->buttonsSaveCancel();
1398 print
'<script type="text/javascript">
1399 jQuery(document).ready(function() {
1400 jQuery("#usage_task").change(function() {
1401 console.log("We click on usage task "+jQuery("#usage_task").is(":checked"));
1402 if (! jQuery("#usage_task").is(":checked")) {
1403 jQuery("#usage_bill_time").prop("checked", false);
1407 jQuery("#usage_bill_time").change(function() {
1408 console.log("We click on usage to bill time");
1409 if (jQuery("#usage_bill_time").is(":checked")) {
1410 jQuery("#usage_task").prop("checked", true);
1414 jQuery("#projectstart").change(function() {
1415 console.log("We modify the start date");
1416 jQuery("#divreportdate").show();
1422 if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
1424 $defaultcheckedwhenoppclose = 1;
1425 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
1426 $defaultcheckedwhenoppclose = 0;
1429 print
'<!-- Javascript to manage opportunity status change -->';
1430 print
'<script type="text/javascript">
1431 jQuery(document).ready(function() {
1432 function change_percent()
1434 var element = jQuery("#opp_status option:selected");
1435 var defaultpercent = element.attr("defaultpercent");
1436 var defaultcloseproject = '.((int) $defaultcheckedwhenoppclose).
';
1437 var elemcode = element.attr("elemcode");
1438 var oldpercent = \''.
dol_escape_js($object->opp_percent).
'\';
1440 console.log(
"We select "+elemcode);
1443 var closeproject = 0;
1444 if (elemcode == \
'LOST\') closeproject = 1;
1445 if (elemcode == \'WON\') closeproject = defaultcloseproject;
1446 if (closeproject) jQuery("#inputcloseproject").prop("checked", true);
1447 else jQuery("#inputcloseproject").prop("checked", false);
1449 /* Make the close project checkbox visible or not */
1450 console.log("closeproject="+closeproject);
1451 if (elemcode == \'WON\' || elemcode == \'LOST\')
1453 jQuery("#divtocloseproject").show();
1457 jQuery("#divtocloseproject").hide();
1460 /* Change percent with default percent (defaultpercent) if new status (defaultpercent) is higher than current (jQuery("#opp_percent").val()) */
1461 if (oldpercent != \'\' && (parseFloat(defaultpercent) < parseFloat(oldpercent)))
1463 console.log("oldpercent="+oldpercent+" defaultpercent="+defaultpercent+" def < old");
1464 if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') {
1465 jQuery("#oldopppercent").text(\' - '.
dol_escape_js($langs->transnoentities(
"PreviousValue")).
': \'+price2numjs(oldpercent)+\' %\');
1468 if (parseFloat(oldpercent) != 100 && elemcode != \'LOST\') { jQuery("#opp_percent").val(oldpercent); }
1469 else { jQuery("#opp_percent").val(price2numjs(defaultpercent)); }
1471 console.log("oldpercent="+oldpercent+" defaultpercent="+defaultpercent);
1472 if (jQuery("#opp_percent").val() == \'\' || (parseFloat(jQuery("#opp_percent").val()) < parseFloat(defaultpercent))) {
1473 if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') {
1474 jQuery("#oldopppercent").text(\' - '.
dol_escape_js($langs->transnoentities(
"PreviousValue")).
': \'+price2numjs(oldpercent)+\' %\');
1476 jQuery("#opp_percent").val(price2numjs(defaultpercent));
1481 jQuery("#opp_status").change(function() {
1493 print
'<div class="tabsAction">';
1494 $parameters = array();
1495 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1497 if (empty($reshook)) {
1498 if ($action !=
"edit" && $action !=
'presend') {
1508 if (empty($user->socid)) {
1510 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend&token='.newToken().
'&id='.$object->id.
'&mode=init#formmailbeforetitle',
'');
1530 if ($userWrite > 0) {
1531 print
dolGetButtonAction(
'', $langs->trans(
'SetToDraft'),
'default', $_SERVER[
"PHP_SELF"].
'?action=confirm_setdraft&confirm=yes&token='.newToken().
'&id='.$object->id,
'');
1533 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'SetToDraft'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1540 if ($userWrite > 0) {
1541 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?action=edit&token='.newToken().
'&id='.$object->id,
'');
1543 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Modify'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1549 if ($userWrite > 0) {
1550 print
dolGetButtonAction(
'', $langs->trans(
'Validate'),
'default', $_SERVER[
"PHP_SELF"].
'?action=validate&token='.newToken().
'&id='.$object->id,
'');
1552 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1558 if ($userWrite > 0) {
1559 print
dolGetButtonAction(
'', $langs->trans(
'Close'),
'default', $_SERVER[
"PHP_SELF"].
'?action=close&token='.newToken().
'&id='.$object->id,
'');
1561 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Close'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1567 if ($userWrite > 0) {
1568 print
dolGetButtonAction(
'', $langs->trans(
'ReOpen'),
'default', $_SERVER[
"PHP_SELF"].
'?action=reopen&token='.newToken().
'&id='.$object->id,
'');
1570 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'ReOpen'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1575 if (empty($conf->global->PROJECT_HIDE_CREATE_OBJECT_BUTTON)) {
1576 $arrayforbutaction = array(
1577 10 => array(
'lang'=>
'propal',
'enabled'=>isModEnabled(
"propal"),
'perm'=>$user->hasRight(
'propal',
'creer'),
'label' =>
'AddProp',
'url'=>
'/comm/propal/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid),
1578 20 => array(
'lang'=>
'orders',
'enabled'=>isModEnabled(
"commande"),
'perm'=>$user->hasRight(
'commande',
'creer'),
'label' =>
'CreateOrder',
'url'=>
'/commande/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid),
1579 30 => array(
'lang'=>
'bills',
'enabled'=>isModEnabled(
"facture"),
'perm'=>$user->hasRight(
'facture',
'creer'),
'label' =>
'CreateBill',
'url'=>
'/compta/facture/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid),
1580 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.
'&socid='.$object->socid),
1581 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.
'&socid='.$object->socid),
1582 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.
'&socid='.$object->socid),
1583 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),
1584 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),
1585 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),
1586 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),
1589 $params = array(
'backtopage' => $_SERVER[
"PHP_SELF"].
'?id='.$object->id);
1591 print
dolGetButtonAction($langs->trans(
"Create"),
'',
'default', $arrayforbutaction,
'', 1, $params);
1595 if ($user->hasRight(
'projet',
'creer')) {
1596 if ($userWrite > 0) {
1597 print
dolGetButtonAction(
'', $langs->trans(
'ToClone'),
'default', $_SERVER[
"PHP_SELF"].
'?action=clone&token='.newToken().
'&id='.$object->id,
'');
1599 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'ToClone'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1604 if ($user->hasRight(
'projet',
'supprimer') || ($object->statut ==
Project::STATUS_DRAFT && $user->hasRight(
'projet',
'creer'))) {
1605 if ($userDelete > 0 || ($object->statut ==
Project::STATUS_DRAFT && $user->hasRight(
'projet',
'creer'))) {
1606 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $_SERVER[
"PHP_SELF"].
'?action=delete&token='.newToken().
'&id='.$object->id,
'');
1608 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Delete'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1616 if (
GETPOST(
'modelselected')) {
1617 $action =
'presend';
1620 if ($action !=
'presend') {
1621 print
'<div class="fichecenter"><div class="fichehalfleft">';
1622 print
'<a name="builddoc"></a>';
1628 $filedir = $conf->project->multidir_output[$object->entity].
"/".
dol_sanitizeFileName($object->ref);
1629 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1630 $genallowed = ($user->hasRight(
'projet',
'lire') && $userAccess > 0);
1631 $delallowed = ($user->hasRight(
'projet',
'creer') && $userWrite > 0);
1633 print $formfile->showdocuments(
'project', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 0, 0,
'',
'',
'',
'',
'', $object);
1635 print
'</div><div class="fichehalfright">';
1639 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/projet/messaging.php?id='.$object->id);
1642 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1644 $somethingshown =
$formactions->showactions($object,
'project', 0, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1646 print
'</div></div>';
1650 $modelmail =
'project';
1651 $defaulttopic =
'SendProjectRef';
1652 $defaulttopiclang =
'projects';
1653 $diroutput = $conf->project->multidir_output[$object->entity];
1654 $autocopy =
'MAIN_MAIL_AUTOCOPY_PROJECT_TO';
1655 $trackid =
'proj'.$object->id;
1657 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
1660 $parameters = array();
1661 $reshook = $hookmanager->executeHooks(
'mainCardTabAddMore', $parameters, $object, $action);
1663 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...
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.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
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.