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');
111$permissiontoeditextra = $permissiontoadd;
118$parameters = array(
'id'=>$socid,
'objcanvas'=>$objcanvas);
119$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
124if (empty($reshook)) {
125 $backurlforlist = DOL_URL_ROOT.
'/projet/list.php';
129 if (
GETPOST(
"comefromclone") == 1) {
130 $result = $object->delete($user);
132 header(
"Location: index.php");
136 setEventMessages($langs->trans(
"CantRemoveProject", $langs->transnoentitiesnoconv(
"ProjectOverview")),
null,
'errors');
141 if (empty($backtopage) || ($cancel && empty($id))) {
142 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
143 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
144 $backtopage = $backurlforlist;
146 $backtopage = DOL_URL_ROOT.
'/projet/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
152 if (!empty($backtopageforcancel)) {
153 header(
"Location: ".$backtopageforcancel);
155 } elseif (!empty($backtopage)) {
156 header(
"Location: ".$backtopage);
162 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
165 if ($action ==
'confirm_setdraft' && $confirm ==
'yes' && $permissiontoadd) {
166 $result = $object->setStatut($object::STATUS_DRAFT,
null,
'',
'PROJECT_MODIFY');
177 if ($action ==
'add' && $permissiontoadd) {
180 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")),
null,
'errors');
184 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"ProjectLabel")),
null,
'errors');
188 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
189 if (
GETPOST(
'usage_opportunity') !=
'' && !(
GETPOST(
'opp_status') > 0)) {
191 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfUsage"),
null,
'errors');
193 if (
GETPOST(
'opp_amount') !=
'' && !(
GETPOST(
'opp_status') > 0)) {
195 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfAmount"),
null,
'errors');
200 if (!empty($conf->global->PROJECT_CREATE_NO_DRAFT) && !$error) {
209 $object->ref =
GETPOST(
'ref',
'alphanohtml');
210 $object->title =
GETPOST(
'title',
'alphanohtml');
211 $object->socid =
GETPOST(
'socid',
'int');
212 $object->description =
GETPOST(
'description',
'restricthtml');
213 $object->public =
GETPOST(
'public',
'alphanohtml');
215 $object->budget_amount =
price2num(
GETPOST(
'budget_amount',
'alphanohtml'));
217 $object->date_start = $date_start;
218 $object->date_end = $date_end;
219 $object->date_start_event = $date_start_event;
220 $object->date_end_event = $date_end_event;
221 $object->location = $location;
222 $object->statut = $status;
223 $object->opp_status = $opp_status;
224 $object->opp_percent = $opp_percent;
225 $object->usage_opportunity = (
GETPOST(
'usage_opportunity',
'alpha') ==
'on' ? 1 : 0);
226 $object->usage_task = (
GETPOST(
'usage_task',
'alpha') ==
'on' ? 1 : 0);
227 $object->usage_bill_time = (
GETPOST(
'usage_bill_time',
'alpha') ==
'on' ? 1 : 0);
228 $object->usage_organize_event = (
GETPOST(
'usage_organize_event',
'alpha') ==
'on' ? 1 : 0);
231 $ret = $extrafields->setOptionalsFromPost(
null, $object);
236 $result = $object->create($user);
237 if (!$error && $result > 0) {
239 $typeofcontact =
'PROJECTLEADER';
240 $result = $object->add_contact($user->id, $typeofcontact,
'internal');
246 } elseif ($result < 0) {
247 $langs->load(
"errors");
252 $langs->load(
"errors");
256 if (!$error && !empty($object->id) > 0) {
258 $categories =
GETPOST(
'categories',
'array');
259 $result = $object->setCategories($categories);
261 $langs->load(
"errors");
270 if (!empty($backtopage)) {
271 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--|__ID__/', $object->id, $backtopage);
272 $backtopage = $backtopage.
'&projectid='.$object->id;
273 header(
"Location: ".$backtopage);
276 header(
"Location:card.php?id=".$object->id);
281 unset($_POST[
"ref"]);
289 if ($action ==
'update' && empty(
GETPOST(
'cancel')) && $permissiontoadd) {
294 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")),
null,
'errors');
298 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"ProjectLabel")),
null,
'errors');
304 $object->oldcopy = clone $object;
306 $old_start_date = $object->date_start;
308 $object->ref =
GETPOST(
'ref',
'alpha');
309 $object->title =
GETPOST(
'title',
'alphanohtml');
310 $object->statut =
GETPOST(
'status',
'int');
311 $object->socid =
GETPOST(
'socid',
'int');
312 $object->description =
GETPOST(
'description',
'restricthtml');
313 $object->public =
GETPOST(
'public',
'alpha');
314 $object->date_start = (!
GETPOST(
'projectstart')) ?
'' : $date_start;
315 $object->date_end = (!
GETPOST(
'projectend')) ?
'' : $date_end;
316 $object->date_start_event = (!
GETPOST(
'date_start_event')) ?
'' : $date_start_event;
317 $object->date_end_event = (!
GETPOST(
'date_end_event')) ?
'' : $date_end_event;
318 $object->location = $location;
319 if (GETPOSTISSET(
'opp_amount')) {
322 if (GETPOSTISSET(
'budget_amount')) {
325 if (GETPOSTISSET(
'opp_status')) {
326 $object->opp_status = $opp_status;
328 if (GETPOSTISSET(
'opp_percent')) {
329 $object->opp_percent = $opp_percent;
331 $object->usage_opportunity = (
GETPOST(
'usage_opportunity',
'alpha') ==
'on' ? 1 : 0);
332 $object->usage_task = (
GETPOST(
'usage_task',
'alpha') ==
'on' ? 1 : 0);
333 $object->usage_bill_time = (
GETPOST(
'usage_bill_time',
'alpha') ==
'on' ? 1 : 0);
334 $object->usage_organize_event = (
GETPOST(
'usage_organize_event',
'alpha') ==
'on' ? 1 : 0);
337 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
343 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
344 if ($object->opp_amount && ($object->opp_status <= 0)) {
346 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfAmount"),
null,
'errors');
351 $result = $object->update($user);
361 $categories =
GETPOST(
'categories',
'array');
362 $result = $object->setCategories($categories);
371 if (
GETPOST(
"reportdate") && ($object->date_start != $old_start_date)) {
372 $result = $object->shiftTaskDate($old_start_date);
375 setEventMessages($langs->trans(
"ErrorShiftTaskDate").
':'.$object->error, $object->errors,
'errors');
382 $resclose = $object->setClose($user);
385 setEventMessages($langs->trans(
"FailedToCloseProject").
':'.$object->error, $object->errors,
'errors');
396 if (
GETPOST(
'socid',
'int') > 0) {
397 $object->fetch_thirdparty(
GETPOST(
'socid',
'int'));
399 unset($object->thirdparty);
405 if ($action ==
'builddoc' && $permissiontoadd) {
408 $object->setDocModel($user,
GETPOST(
'model',
'alpha'));
411 $outputlangs = $langs;
412 if (
GETPOST(
'lang_id',
'aZ09')) {
414 $outputlangs->setDefaultLang(
GETPOST(
'lang_id',
'aZ09'));
416 $result = $object->generateDocument($object->model_pdf, $outputlangs);
424 if ($action ==
'remove_file' && $permissiontoadd) {
425 if ($object->id > 0) {
426 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
428 $langs->load(
"other");
429 $upload_dir = $conf->project->multidir_output[$object->entity];
430 $file = $upload_dir.
'/'.
GETPOST(
'file');
442 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $permissiontoadd) {
443 $result = $object->setValid($user);
449 if ($action ==
'confirm_close' && $confirm ==
'yes' && $permissiontoadd) {
450 $result = $object->setClose($user);
456 if ($action ==
'confirm_reopen' && $confirm ==
'yes' && $permissiontoadd) {
457 $result = $object->setValid($user);
463 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
465 $result = $object->delete($user);
469 if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
470 $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
471 $tmpurl = preg_replace(
'/__SOCID__/', $object->socid, $tmpurl);
472 $urlback = $tmpurl.(preg_match(
'/\?/', $tmpurl) ?
'&' :
'?').
'restore_lastsearch_values=1';
474 $urlback = DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1';
477 header(
"Location: ".$urlback);
485 if ($action ==
'confirm_clone' && $permissiontoadd && $confirm ==
'yes') {
486 $clone_contacts =
GETPOST(
'clone_contacts') ? 1 : 0;
487 $clone_tasks =
GETPOST(
'clone_tasks') ? 1 : 0;
488 $clone_project_files =
GETPOST(
'clone_project_files') ? 1 : 0;
489 $clone_task_files =
GETPOST(
'clone_task_files') ? 1 : 0;
490 $clone_notes =
GETPOST(
'clone_notes') ? 1 : 0;
491 $move_date =
GETPOST(
'move_date') ? 1 : 0;
492 $clone_thirdparty =
GETPOST(
'socid',
'int') ?
GETPOST(
'socid',
'int') : 0;
494 $result = $object->createFromClone($user, $object->id, $clone_contacts, $clone_tasks, $clone_project_files, $clone_task_files, $clone_notes, $move_date, 0, $clone_thirdparty);
500 $newobject->fetch($result);
502 setEventMessages($langs->trans(
"ProjectCreatedInDolibarr", $newobject->ref),
"",
'mesgs');
504 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.$result.
'&action=edit&comefromclone=1');
510 if ($action ==
'update_extras' && $permissiontoeditextra) {
511 $object->oldcopy =
dol_clone($object, 2);
513 $attribute_name =
GETPOST(
'attribute',
'aZ09');
516 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
522 $result = $object->updateExtraField($attribute_name,
'PROJECT_MODIFY');
530 $action =
'edit_extras';
535 $triggersendname =
'PROJECT_SENTBYMAIL';
537 $autocopy =
'MAIN_MAIL_AUTOCOPY_PROJECT_TO';
538 $trackid =
'proj'.$object->id;
539 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
547$form =
new Form($db);
550$userstatic =
new User($db);
552$title = $langs->trans(
"Project").
' - '.$object->ref.(!empty($object->thirdparty->name) ?
' - '.$object->thirdparty->name :
'').(!empty($object->title) ?
' - '.$object->title :
'');
553if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/projectnameonly/', $conf->global->MAIN_HTML_TITLE)) {
554 $title = $object->ref.(!empty($object->thirdparty->name) ?
' - '.$object->thirdparty->name :
'').(!empty($object->title) ?
' - '.$object->title :
'');
557$help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:Modul_Projekte";
561$titleboth = $langs->trans(
"LeadsOrProjects");
562$titlenew = $langs->trans(
"NewLeadOrProject");
564 $titleboth = $langs->trans(
"Projects");
565 $titlenew = $langs->trans(
"NewProject");
568 $titleboth = $langs->trans(
"Leads");
569 $titlenew = $langs->trans(
"NewLead");
572if ($action ==
'create' && $user->rights->projet->creer) {
577 $thirdparty =
new Societe($db);
579 $thirdparty->fetch($socid);
584 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
585 print
'<input type="hidden" name="action" value="add">';
586 print
'<input type="hidden" name="token" value="'.newToken().
'">';
587 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
588 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
589 print
'<input type="hidden" name="backtopagejsfields" value="'.$backtopagejsfields.
'">';
590 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
594 print
'<table class="border centpercent tableforfieldcreate">';
597 $modele = empty($conf->global->PROJECT_ADDON) ?
'mod_project_simple' : $conf->global->PROJECT_ADDON;
600 $file =
''; $classname =
''; $filefound = 0;
601 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
602 foreach ($dirmodels as $reldir) {
603 $file =
dol_buildpath($reldir.
"core/modules/project/".$modele.
'.php', 0);
604 if (file_exists($file)) {
606 $classname = $modele;
613 $modProject =
new $classname;
615 $defaultref = $modProject->getNextValue($thirdparty, $object);
618 if (is_numeric($defaultref) && $defaultref <= 0) {
624 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).
'">';
626 print
' '.$form->textwithpicto(
'', $langs->trans(
"YouCanCompleteRef", $suggestedref));
631 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>';
634 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled(
'eventorganization')) {
635 print
'<tr><td class="tdtop">';
636 print $langs->trans(
"Usage");
639 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
640 print
'<input type="checkbox" id="usage_opportunity" name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') ?
' checked="checked"' :
'') :
' checked="checked"').
'"> ';
641 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
642 print
'<label for="usage_opportunity">'.$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext).
'</label>';
644 print
'$( document ).ready(function() {
645 jQuery("#usage_opportunity").change(function() {
646 if (jQuery("#usage_opportunity").prop("checked")) {
647 console.log("Show opportunities fields");
648 jQuery(".classuseopportunity").show();
650 console.log("Hide opportunities fields "+jQuery("#usage_opportunity").prop("checked"));
651 jQuery(".classuseopportunity").hide();
655 if (GETPOSTISSET(
'usage_opportunity') && !
GETPOST(
'usage_opportunity')) {
656 print
'jQuery(".classuseopportunity").hide();';
662 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
663 print
'<input type="checkbox" id="usage_task" name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') ?
' checked="checked"' :
'') :
' checked="checked"').
'"> ';
664 $htmltext = $langs->trans(
"ProjectFollowTasks");
665 print
'<label for="usage_task">'.$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext).
'</label>';
667 print
'$( document ).ready(function() {
668 jQuery("#usage_task").change(function() {
669 if (jQuery("#usage_task").prop("checked")) {
670 console.log("Show task fields");
671 jQuery(".classusetask").show();
673 console.log("Hide tasks fields "+jQuery("#usage_task").prop("checked"));
674 jQuery(".classusetask").hide();
678 if (GETPOSTISSET(
'usage_task') && !
GETPOST(
'usage_task')) {
679 print
'jQuery(".classusetask").hide();';
685 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
686 print
'<input type="checkbox" id="usage_bill_time" name="usage_bill_time"'.(GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time',
'alpha') ?
' checked="checked"' :
'') :
'').
'"> ';
687 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
688 print
'<label for="usage_bill_time">'.$form->textwithpicto($langs->trans(
"BillTime"), $htmltext).
'</label>';
690 print
'$( document ).ready(function() {
691 jQuery("#usage_bill_time").change(function() {
692 if (jQuery("#usage_bill_time").prop("checked")) {
693 console.log("Show bill time fields");
694 jQuery(".classusebilltime").show();
696 console.log("Hide bill time fields "+jQuery("#usage_bill_time").prop("checked"));
697 jQuery(".classusebilltime").hide();
701 if (GETPOSTISSET(
'usage_bill_time') && !
GETPOST(
'usage_bill_time')) {
702 print
'jQuery(".classusebilltime").hide();';
708 if (isModEnabled(
'eventorganization')) {
709 print
'<input type="checkbox" id="usage_organize_event" name="usage_organize_event"'.(GETPOSTISSET(
'usage_organize_event') ? (
GETPOST(
'usage_organize_event',
'alpha') ?
' checked="checked"' :
'') :
'').
'"> ';
710 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
711 print
'<label for="usage_organize_event">'.$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext).
'</label>';
713 print
'$( document ).ready(function() {
714 jQuery("#usage_organize_event").change(function() {
715 if (jQuery("#usage_organize_event").prop("checked")) {
716 console.log("Show organize event fields");
717 jQuery(".classuseorganizeevent").show();
719 console.log("Hide organize event fields "+jQuery("#usage_organize_event").prop("checked"));
720 jQuery(".classuseorganizeevent").hide();
724 if (!
GETPOST(
'usage_organize_event')) {
725 print
'jQuery(".classuseorganizeevent").hide();';
735 if (isModEnabled(
'societe')) {
737 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'<span class="fieldrequired">');
738 print $langs->trans(
"ThirdParty");
739 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'</span>');
740 print
'</td><td class="maxwidthonsmartphone">';
742 if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) {
743 $filter = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
745 $text =
img_picto(
'',
'company').$form->select_company(
GETPOST(
'socid',
'int'),
'socid', $filter,
'SelectThirdParty', 1, 0, array(), 0,
'minwidth300 widthcentpercentminusxx maxwidth500');
746 if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) {
747 $texthelp = $langs->trans(
"IfNeedToUseOtherObjectKeepEmpty");
748 print $form->textwithtooltip($text.
' '.
img_help(), $texthelp, 1);
752 if (!GETPOSTISSET(
'backtopage')) {
753 $url =
'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?action=create');
754 $newbutton =
'<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddThirdParty").
'"></span>';
757 $tmpbacktopagejsfields =
'addthirdparty:socid,search_socid';
758 print
dolButtonToOpenUrlInDialogPopup(
'addthirdparty', $langs->transnoentitiesnoconv(
'AddThirdParty'), $newbutton, $url,
'',
'',
'', $tmpbacktopagejsfields);
760 print
' <a href="'.DOL_URL_ROOT.$url.
'">'.$newbutton.
'</a>';
768 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
769 print
'<input type="hidden" name="status" value="'.$status.
'">';
770 print $object->LibStatut($status, 4);
775 print
'<tr><td>'.$langs->trans(
"Visibility").
'</td><td class="maxwidthonsmartphone">';
777 if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) {
778 $array[0] = $langs->trans(
"PrivateProject");
780 if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) {
781 $array[1] = $langs->trans(
"SharedProject");
784 if (count($array) > 0) {
785 print $form->selectarray(
'public', $array,
GETPOST(
'public'), 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
787 print
'<input type="hidden" name="public" id="public" value="'.GETPOST(
'public').
'">';
790 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
791 print $langs->trans(
"PrivateProject");
793 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
794 print $langs->trans(
"SharedProject");
799 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
801 print
'<tr class="classuseopportunity"><td><span class="fieldrequired">'.$langs->trans(
"OpportunityStatus").
'</span></td>';
802 print
'<td class="maxwidthonsmartphone">';
803 print $formproject->selectOpportunityStatus(
'opp_status', GETPOSTISSET(
'opp_status') ?
GETPOST(
'opp_status') : $object->opp_status, 1, 0, 0, 0,
'', 0, 1);
806 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>';
807 print
'<input type="hidden" name="opp_percent_not_set" id="opp_percent_not_set" value="'.dol_escape_htmltag(GETPOSTISSET(
'opp_percent') ?
'0' :
'1').
'">';
812 print
'<tr class="classuseopportunity"><td>'.$langs->trans(
"OpportunityAmount").
'</td>';
813 print
'<td><input class="width75 right" type="text" name="opp_amount" value="'.dol_escape_htmltag(GETPOSTISSET(
'opp_amount') ?
GETPOST(
'opp_amount') :
'').
'">';
814 print
' '.$langs->getCurrencySymbol($conf->currency);
820 print
'<tr><td>'.$langs->trans(
"Budget").
'</td>';
821 print
'<td><input class="width75 right" type="text" name="budget_amount" value="'.dol_escape_htmltag(GETPOSTISSET(
'budget_amount') ?
GETPOST(
'budget_amount') :
'').
'">';
822 print
' '.$langs->getCurrencySymbol($conf->currency);
827 print
'<tr><td>'.$langs->trans(
"Date").(isModEnabled(
'eventorganization') ?
' <span class="classuseorganizeevent">('.$langs->trans(
"Project").
')</span>' :
'').
'</td><td>';
828 print $form->selectDate(($date_start ? $date_start :
''),
'projectstart', 0, 0, 0,
'', 1, 0);
829 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
830 print $form->selectDate(($date_end ? $date_end : -1),
'projectend', 0, 0, 0,
'', 1, 0);
833 if (isModEnabled(
'eventorganization')) {
835 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Date").
' ('.$langs->trans(
"Event").
')</td><td>';
836 print $form->selectDate(($date_start_event ? $date_start_event : -1),
'date_start_event', 1, 1, 1,
'', 1, 0);
837 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
838 print $form->selectDate(($date_end_event ? $date_end_event : -1),
'date_end_event', 1, 1, 1,
'', 1, 0);
842 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Location").
'</td>';
843 print
'<td><input class="minwidth300 maxwidth500" type="text" name="location" value="'.dol_escape_htmltag($location).
'"></td>';
848 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
850 $doleditor =
new DolEditor(
'description',
GETPOST(
"description",
'restricthtml'),
'', 90,
'dolibarr_notes',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_3,
'90%');
851 $doleditor->Create();
854 if (isModEnabled(
'categorie')) {
856 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
857 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT,
'',
'parent', 64, 0, 1);
858 $arrayselected =
GETPOST(
'categories',
'array');
859 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
864 $parameters = array();
865 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
866 print $hookmanager->resPrint;
867 if (empty($reshook)) {
868 print $object->showOptionals($extrafields,
'create');
875 print $form->buttonsSaveCancel(
'CreateDraft');
881 print
'<script type="text/javascript">
882 jQuery(document).ready(function() {
883 function change_percent()
885 var element = jQuery("#opp_status option:selected");
886 var defaultpercent = element.attr("defaultpercent");
887 /*if (jQuery("#opp_percent_not_set").val() == "") */
888 jQuery("#opp_percent").val(defaultpercent);
892 jQuery("#opp_status").change(function() {
896 jQuery("#usage_task").change(function() {
897 console.log("We click on usage task "+jQuery("#usage_task").is(":checked"));
898 if (! jQuery("#usage_task").is(":checked")) {
899 jQuery("#usage_bill_time").prop("checked", false);
903 jQuery("#usage_bill_time").change(function() {
904 console.log("We click on usage to bill time");
905 if (jQuery("#usage_bill_time").is(":checked")) {
906 jQuery("#usage_task").prop("checked", true);
911} elseif ($object->id > 0) {
916 $res = $object->fetch_optionals();
919 $userAccess = $object->restrictedProjectArea($user,
'read');
920 $userWrite = $object->restrictedProjectArea($user,
'write');
921 $userDelete = $object->restrictedProjectArea($user,
'delete');
926 if ($action ==
'validate') {
927 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ValidateProject'), $langs->trans(
'ConfirmValidateProject'),
'confirm_validate',
'', 0, 1);
930 if ($action ==
'close') {
931 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"CloseAProject"), $langs->trans(
"ConfirmCloseAProject"),
"confirm_close",
'',
'', 1);
934 if ($action ==
'reopen') {
935 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"ReOpenAProject"), $langs->trans(
"ConfirmReOpenAProject"),
"confirm_reopen",
'',
'', 1);
938 if ($action ==
'delete') {
939 $text = $langs->trans(
"ConfirmDeleteAProject");
940 $task =
new Task($db);
941 $taskarray = $task->getTasksArray(0, 0, $object->id, 0, 0);
942 $nboftask = count($taskarray);
944 $text .=
'<br>'.img_warning().
' '.$langs->trans(
"ThisWillAlsoRemoveTasks", $nboftask);
946 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"DeleteAProject"), $text,
"confirm_delete",
'',
'', 1);
950 if ($action ==
'clone') {
951 $formquestion = array(
952 'text' => $langs->trans(
"ConfirmClone"),
953 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')),
954 array(
'type' =>
'checkbox',
'name' =>
'clone_contacts',
'label' => $langs->trans(
"CloneContacts"),
'value' => true),
955 array(
'type' =>
'checkbox',
'name' =>
'clone_tasks',
'label' => $langs->trans(
"CloneTasks"),
'value' => true),
956 array(
'type' =>
'checkbox',
'name' =>
'move_date',
'label' => $langs->trans(
"CloneMoveDate"),
'value' => true),
957 array(
'type' =>
'checkbox',
'name' =>
'clone_notes',
'label' => $langs->trans(
"CloneNotes"),
'value' => true),
958 array(
'type' =>
'checkbox',
'name' =>
'clone_project_files',
'label' => $langs->trans(
"CloneProjectFiles"),
'value' => false),
959 array(
'type' =>
'checkbox',
'name' =>
'clone_task_files',
'label' => $langs->trans(
"CloneTaskFiles"),
'value' => false)
962 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"ToClone"), $langs->trans(
"ConfirmCloneProject"),
"confirm_clone", $formquestion,
'', 1, 400, 590);
966 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
967 print
'<input type="hidden" name="token" value="'.newToken().
'">';
968 print
'<input type="hidden" name="action" value="update">';
969 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
970 print
'<input type="hidden" name="comefromclone" value="'.$comefromclone.
'">';
974 if ($action ==
'edit' && $userWrite > 0) {
975 print
dol_get_fiche_head($head,
'project', $langs->trans(
"Project"), 0, ($object->public ?
'projectpub' :
'project'));
977 print
'<table class="border centpercent">';
980 $suggestedref = $object->ref;
981 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Ref").
'</td>';
982 print
'<td><input size="25" name="ref" value="'.$suggestedref.
'">';
983 print
' '.$form->textwithpicto(
'', $langs->trans(
"YouCanCompleteRef", $suggestedref));
987 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
988 print
'<td><input class="quatrevingtpercent" name="title" value="'.dol_escape_htmltag($object->title).
'"></td></tr>';
991 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td><td>';
992 print
'<select class="flat" name="status" id="status">';
993 foreach ($object->statuts_short as $key => $val) {
994 print
'<option value="'.$key.
'"'.((GETPOSTISSET(
'status') ?
GETPOST(
'status') : $object->
statut) == $key ?
' selected="selected"' :
'').
'>'.$langs->trans($val).
'</option>';
1001 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled(
'eventorganization')) {
1002 print
'<tr><td class="tdtop">';
1003 print $langs->trans(
"Usage");
1006 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
1007 print
'<input type="checkbox" id="usage_opportunity" name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'> ';
1008 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
1009 print
'<label for="usage_opportunity">'.$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext).
'</label>';
1011 print
'$( document ).ready(function() {
1012 jQuery("#usage_opportunity").change(function() {
1013 set_usage_opportunity();
1016 set_usage_opportunity();
1018 function set_usage_opportunity() {
1019 console.log("set_usage_opportunity");
1020 if (jQuery("#usage_opportunity").prop("checked")) {
1021 console.log("Show opportunities fields");
1022 jQuery(".classuseopportunity").show();
1024 console.log("Hide opportunities fields "+jQuery("#usage_opportunity").prop("checked"));
1025 jQuery(".classuseopportunity").hide();
1032 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
1033 print
'<input type="checkbox" id="usage_task" name="usage_task"' . (GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')) .
'> ';
1034 $htmltext = $langs->trans(
"ProjectFollowTasks");
1035 print
'<label for="usage_task">'.$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext).
'</label>';
1037 print
'$( document ).ready(function() {
1038 jQuery("#usage_task").change(function() {
1044 function set_usage_task() {
1045 console.log("set_usage_task");
1046 if (jQuery("#usage_task").prop("checked")) {
1047 console.log("Show task fields");
1048 jQuery(".classusetask").show();
1050 console.log("Hide task fields "+jQuery("#usage_task").prop("checked"));
1051 jQuery(".classusetask").hide();
1058 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
1059 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"' :
'')) .
'> ';
1060 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
1061 print
'<label for="usage_bill_time">'.$form->textwithpicto($langs->trans(
"BillTime"), $htmltext).
'</label>';
1063 print
'$( document ).ready(function() {
1064 jQuery("#usage_bill_time").change(function() {
1065 set_usage_bill_time();
1068 set_usage_bill_time();
1070 function set_usage_bill_time() {
1071 console.log("set_usage_bill_time");
1072 if (jQuery("#usage_bill_time").prop("checked")) {
1073 console.log("Show bill time fields");
1074 jQuery(".classusebilltime").show();
1076 console.log("Hide bill time fields "+jQuery("#usage_bill_time").prop("checked"));
1077 jQuery(".classusebilltime").hide();
1084 if (isModEnabled(
'eventorganization')) {
1085 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"' :
'')) .
'> ';
1086 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
1087 print
'<label for="usage_organize_event">'.$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext).
'</label>';
1089 print
'$( document ).ready(function() {
1090 jQuery("#usage_organize_event").change(function() {
1096 function set_usage_event() {
1097 console.log("set_usage_event");
1098 if (jQuery("#usage_organize_event").prop("checked")) {
1099 console.log("Show organize event fields");
1100 jQuery(".classuseorganizeevent").show();
1102 console.log("Hide organize event fields "+jQuery("#usage_organize_event").prop("checked"));
1103 jQuery(".classuseorganizeevent").hide();
1114 if (isModEnabled(
'societe')) {
1116 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'<span class="fieldrequired">');
1117 print $langs->trans(
"ThirdParty");
1118 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'</span>');
1121 if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) {
1122 $filter = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
1124 $text =
img_picto(
'',
'company',
'class="pictofixedwidth"');
1125 $text .= $form->select_company($object->thirdparty->id,
'socid', $filter,
'None', 1, 0, array(), 0,
'minwidth300');
1126 if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) {
1127 $texthelp = $langs->trans(
"IfNeedToUseOtherObjectKeepEmpty");
1128 print $form->textwithtooltip($text.
' '.
img_help(), $texthelp, 1, 0,
'',
'', 2);
1136 print
'<tr><td>'.$langs->trans(
"Visibility").
'</td><td>';
1138 if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) {
1139 $array[0] = $langs->trans(
"PrivateProject");
1141 if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) {
1142 $array[1] = $langs->trans(
"SharedProject");
1145 if (count($array) > 0) {
1146 print $form->selectarray(
'public', $array, $object->public, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1148 print
'<input type="hidden" id="public" name="public" value="'.$object->public.
'">';
1150 if ($object->public == 0) {
1151 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
1152 print $langs->trans(
"PrivateProject");
1154 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
1155 print $langs->trans(
"SharedProject");
1160 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
1161 $classfortr = ($object->usage_opportunity ?
'' :
' hideobject');
1163 print
'<tr class="classuseopportunity'.$classfortr.
'"><td>'.$langs->trans(
"OpportunityStatus").
'</td>';
1166 print $formproject->selectOpportunityStatus(
'opp_status', $object->opp_status, 1, 0, 0, 0,
'minwidth150 inline-block valignmiddle', 1, 1);
1169 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) :
'')).
'"> %';
1170 print
'<span id="oldopppercent" class="opacitymedium"></span>';
1173 print
'<div id="divtocloseproject" class="inline-block valign clearboth paddingtop" style="display: none;">';
1174 print
'<input type="checkbox" id="inputcloseproject" name="closeproject" />';
1175 print
'<label for="inputcloseproject">';
1176 print $form->textwithpicto($langs->trans(
"AlsoCloseAProject"), $langs->trans(
"AlsoCloseAProjectTooltip")).
'</label>';
1183 print
'<tr class="classuseopportunity'.$classfortr.
'"><td>'.$langs->trans(
"OpportunityAmount").
'</td>';
1184 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) :
'')).
'">';
1185 print $langs->getCurrencySymbol($conf->currency);
1191 print
'<tr><td>'.$langs->trans(
"Budget").
'</td>';
1192 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) :
'')).
'">';
1193 print $langs->getCurrencySymbol($conf->currency);
1198 print
'<tr><td>'.$langs->trans(
"Date").(isModEnabled(
'eventorganization') ?
' <span class="classuseorganizeevent">('.$langs->trans(
"Project").
')</span>' :
'').
'</td><td>';
1199 print $form->selectDate($object->date_start ? $object->date_start : -1,
'projectstart', 0, 0, 0,
'', 1, 0);
1200 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
1201 print $form->selectDate($object->date_end ? $object->date_end : -1,
'projectend', 0, 0, 0,
'', 1, 0);
1202 $object->getLinesArray(
null, 0);
1203 if (!empty($object->usage_task) && !empty($object->lines)) {
1204 print
' <span id="divreportdate" class="hidden"> <input type="checkbox" class="valignmiddle" id="reportdate" name="reportdate" value="yes" ';
1205 if ($comefromclone) {
1208 print
'/><label for="reportdate" class="valignmiddle opacitymedium">'.$langs->trans(
"ProjectReportDate").
'</label></span>';
1212 if (isModEnabled(
'eventorganization')) {
1214 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Date").
' ('.$langs->trans(
"Event").
')</td><td>';
1215 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);
1216 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
1217 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);
1221 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Location").
'</td>';
1222 print
'<td><input class="minwidth300 maxwidth500" type="text" name="location" value="'.dol_escape_htmltag(GETPOSTISSET(
'location') ?
GETPOST(
'location') : $object->location).
'"></td>';
1227 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
1229 $doleditor =
new DolEditor(
'description', $object->description,
'', 90,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_3,
'90%');
1230 $doleditor->Create();
1234 if (isModEnabled(
'categorie')) {
1235 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
1236 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT,
'',
'parent', 64, 0, 1);
1238 $cats = $c->containing($object->id, Categorie::TYPE_PROJECT);
1239 foreach ($cats as $cat) {
1240 $arrayselected[] = $cat->id;
1242 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0,
'0');
1247 $parameters = array();
1248 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1249 print $hookmanager->resPrint;
1250 if (empty($reshook)) {
1251 print $object->showOptionals($extrafields,
'edit');
1256 print
dol_get_fiche_head($head,
'project', $langs->trans(
"Project"), -1, ($object->public ?
'projectpub' :
'project'));
1260 if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
1261 $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
1262 $tmpurl = preg_replace(
'/__SOCID__/', $object->socid, $tmpurl);
1263 $linkback =
'<a href="'.$tmpurl.(preg_match(
'/\?/', $tmpurl) ?
'&' :
'?').
'restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1265 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1268 $morehtmlref =
'<div class="refidno">';
1271 $morehtmlref .=
'<br>';
1273 if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
1274 $morehtmlref .= $object->thirdparty->getNomUrl(1,
'project');
1276 $morehtmlref .=
'</div>';
1279 if (empty($user->rights->projet->all->lire)) {
1280 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
1281 $object->next_prev_filter =
"rowid IN (".$db->sanitize(count($objectsListId) ? join(
',', array_keys($objectsListId)) :
'0').
")";
1284 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1286 print
'<div class="fichecenter">';
1287 print
'<div class="fichehalfleft">';
1288 print
'<div class="underbanner clearboth"></div>';
1290 print
'<table class="border tableforfield centpercent">';
1293 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled(
'eventorganization')) {
1294 print
'<tr><td class="tdtop">';
1295 print $langs->trans(
"Usage");
1298 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
1299 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'> ';
1300 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
1301 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
1304 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
1305 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')).
'> ';
1306 $htmltext = $langs->trans(
"ProjectFollowTasks");
1307 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
1310 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
1311 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"' :
'')).
'> ';
1312 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
1313 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
1317 if (isModEnabled(
'eventorganization')) {
1318 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"' :
'')).
'> ';
1319 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
1320 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
1326 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
1327 if ($object->public) {
1328 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
1329 print $langs->trans(
'SharedProject');
1331 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
1332 print $langs->trans(
'PrivateProject');
1336 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && !empty($object->usage_opportunity)) {
1338 print
'<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
1339 $code =
dol_getIdFromCode($db, $object->opp_status,
'c_lead_status',
'rowid',
'code');
1341 print $langs->trans(
"OppStatus".$code);
1345 print
' <span title="'.$langs->trans(
"OpportunityProbability").
'"> / ';
1346 if (strcmp($object->opp_percent,
'')) {
1347 print
price($object->opp_percent, 0, $langs, 1, 0).
' %';
1349 print
'</span></td></tr>';
1352 print
'<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
1353 if (strcmp($object->opp_amount,
'')) {
1354 print
'<span class="amount">'.price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency).
'</span>';
1355 if (strcmp($object->opp_percent,
'')) {
1356 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>';
1363 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
1364 if (!is_null($object->budget_amount) && strcmp($object->budget_amount,
'')) {
1365 print
'<span class="amount">'.price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
1370 print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
1372 print ($start ? $start :
'?');
1374 print
' <span class="opacitymedium">-</span> ';
1375 print ($end ? $end :
'?');
1376 if ($object->hasDelay()) {
1383 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1388 print
'<div class="fichehalfright">';
1389 print
'<div class="underbanner clearboth"></div>';
1391 print
'<table class="border tableforfield centpercent">';
1394 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
1399 if (isModEnabled(
'categorie')) {
1400 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
1401 print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
1410 print
'<div class="clearboth"></div>';
1415 if ($action ==
'edit' && $userWrite > 0) {
1416 print $form->buttonsSaveCancel();
1422 print
'<script type="text/javascript">
1423 jQuery(document).ready(function() {
1424 jQuery("#usage_task").change(function() {
1425 console.log("We click on usage task "+jQuery("#usage_task").is(":checked"));
1426 if (! jQuery("#usage_task").is(":checked")) {
1427 jQuery("#usage_bill_time").prop("checked", false);
1431 jQuery("#usage_bill_time").change(function() {
1432 console.log("We click on usage to bill time");
1433 if (jQuery("#usage_bill_time").is(":checked")) {
1434 jQuery("#usage_task").prop("checked", true);
1438 jQuery("#projectstart").change(function() {
1439 console.log("We modify the start date");
1440 jQuery("#divreportdate").show();
1446 if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
1448 $defaultcheckedwhenoppclose = 1;
1449 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
1450 $defaultcheckedwhenoppclose = 0;
1453 print
'<!-- Javascript to manage opportunity status change -->';
1454 print
'<script type="text/javascript">
1455 jQuery(document).ready(function() {
1456 function change_percent()
1458 var element = jQuery("#opp_status option:selected");
1459 var defaultpercent = element.attr("defaultpercent");
1460 var defaultcloseproject = '.((int) $defaultcheckedwhenoppclose).
';
1461 var elemcode = element.attr("elemcode");
1462 var oldpercent = \''.
dol_escape_js($object->opp_percent).
'\';
1464 console.log(
"We select "+elemcode);
1467 var closeproject = 0;
1468 if (elemcode == \
'LOST\') closeproject = 1;
1469 if (elemcode == \'WON\') closeproject = defaultcloseproject;
1470 if (closeproject) jQuery("#inputcloseproject").prop("checked", true);
1471 else jQuery("#inputcloseproject").prop("checked", false);
1473 /* Make the close project checkbox visible or not */
1474 console.log("closeproject="+closeproject);
1475 if (elemcode == \'WON\' || elemcode == \'LOST\')
1477 jQuery("#divtocloseproject").show();
1481 jQuery("#divtocloseproject").hide();
1484 /* Change percent with default percent (defaultpercent) if new status (defaultpercent) is higher than current (jQuery("#opp_percent").val()) */
1485 if (oldpercent != \'\' && (parseFloat(defaultpercent) < parseFloat(oldpercent)))
1487 console.log("oldpercent="+oldpercent+" defaultpercent="+defaultpercent+" def < old");
1488 if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') {
1489 jQuery("#oldopppercent").text(\' - '.
dol_escape_js($langs->transnoentities(
"PreviousValue")).
': \'+price2numjs(oldpercent)+\' %\');
1492 if (parseFloat(oldpercent) != 100 && elemcode != \'LOST\') { jQuery("#opp_percent").val(oldpercent); }
1493 else { jQuery("#opp_percent").val(price2numjs(defaultpercent)); }
1495 console.log("oldpercent="+oldpercent+" defaultpercent="+defaultpercent);
1496 if (jQuery("#opp_percent").val() == \'\' || (parseFloat(jQuery("#opp_percent").val()) < parseFloat(defaultpercent))) {
1497 if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') {
1498 jQuery("#oldopppercent").text(\' - '.
dol_escape_js($langs->transnoentities(
"PreviousValue")).
': \'+price2numjs(oldpercent)+\' %\');
1500 jQuery("#opp_percent").val(price2numjs(defaultpercent));
1505 jQuery("#opp_status").change(function() {
1517 print
'<div class="tabsAction">';
1518 $parameters = array();
1519 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1521 if (empty($reshook)) {
1522 if ($action !=
"edit" && $action !=
'presend') {
1532 if (empty($user->socid)) {
1534 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend&token='.newToken().
'&id='.$object->id.
'&mode=init#formmailbeforetitle',
'');
1554 if ($userWrite > 0) {
1555 print
dolGetButtonAction(
'', $langs->trans(
'SetToDraft'),
'default', $_SERVER[
"PHP_SELF"].
'?action=confirm_setdraft&confirm=yes&token='.newToken().
'&id='.$object->id,
'');
1557 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'SetToDraft'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1564 if ($userWrite > 0) {
1565 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?action=edit&token='.newToken().
'&id='.$object->id,
'');
1567 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Modify'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1573 if ($userWrite > 0) {
1574 print
dolGetButtonAction(
'', $langs->trans(
'Validate'),
'default', $_SERVER[
"PHP_SELF"].
'?action=validate&token='.newToken().
'&id='.$object->id,
'');
1576 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1582 if ($userWrite > 0) {
1583 print
dolGetButtonAction(
'', $langs->trans(
'Close'),
'default', $_SERVER[
"PHP_SELF"].
'?action=close&token='.newToken().
'&id='.$object->id,
'');
1585 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Close'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1591 if ($userWrite > 0) {
1592 print
dolGetButtonAction(
'', $langs->trans(
'ReOpen'),
'default', $_SERVER[
"PHP_SELF"].
'?action=reopen&token='.newToken().
'&id='.$object->id,
'');
1594 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'ReOpen'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1599 if (empty($conf->global->PROJECT_HIDE_CREATE_OBJECT_BUTTON)) {
1601 $is_customer_or_prospect = (!empty($object->thirdparty->prospect) || !empty($object->thirdparty->client));
1602 $is_supplier_only= (!empty($object->thirdparty->fournisseur) && $is_customer_or_prospect ==
false);
1604 $arrayforbutaction = array(
1605 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),
1606 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),
1607 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),
1608 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 :
'')),
1609 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 :
'')),
1610 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 :
'')),
1611 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),
1612 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),
1613 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),
1614 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),
1617 $params = array(
'backtopage' => $_SERVER[
"PHP_SELF"].
'?id='.$object->id);
1619 print
dolGetButtonAction($langs->trans(
"Create"),
'',
'default', $arrayforbutaction,
'', 1, $params);
1623 if ($user->hasRight(
'projet',
'creer')) {
1624 if ($userWrite > 0) {
1625 print
dolGetButtonAction(
'', $langs->trans(
'ToClone'),
'default', $_SERVER[
"PHP_SELF"].
'?action=clone&token='.newToken().
'&id='.$object->id,
'');
1627 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'ToClone'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1632 if ($user->hasRight(
'projet',
'supprimer') || ($object->statut ==
Project::STATUS_DRAFT && $user->hasRight(
'projet',
'creer'))) {
1633 if ($userDelete > 0 || ($object->statut ==
Project::STATUS_DRAFT && $user->hasRight(
'projet',
'creer'))) {
1634 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $_SERVER[
"PHP_SELF"].
'?action=delete&token='.newToken().
'&id='.$object->id,
'');
1636 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Delete'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1644 if (
GETPOST(
'modelselected')) {
1645 $action =
'presend';
1648 if ($action !=
'presend') {
1649 print
'<div class="fichecenter"><div class="fichehalfleft">';
1650 print
'<a name="builddoc"></a>';
1656 $filedir = $conf->project->multidir_output[$object->entity].
"/".
dol_sanitizeFileName($object->ref);
1657 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1658 $genallowed = ($user->hasRight(
'projet',
'lire') && $userAccess > 0);
1659 $delallowed = ($user->hasRight(
'projet',
'creer') && $userWrite > 0);
1661 print $formfile->showdocuments(
'project', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 0, 0,
'',
'',
'',
'',
'', $object);
1663 print
'</div><div class="fichehalfright">';
1667 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/projet/messaging.php?id='.$object->id);
1670 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1672 $somethingshown =
$formactions->showactions($object,
'project', 0, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1674 print
'</div></div>';
1678 $modelmail =
'project';
1679 $defaulttopic =
'SendProjectRef';
1680 $defaulttopiclang =
'projects';
1681 $diroutput = $conf->project->multidir_output[$object->entity];
1682 $autocopy =
'MAIN_MAIL_AUTOCOPY_PROJECT_TO';
1683 $trackid =
'proj'.$object->id;
1685 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
1688 $parameters = array();
1689 $reshook = $hookmanager->executeHooks(
'mainCardTabAddMore', $parameters, $object, $action);
1691 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.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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.