30require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/modules/project/modules_project.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
42$langsLoad=array(
'projects',
'companies');
43if (isModEnabled(
'eventorganization')) {
44 $langsLoad[]=
'eventorganization';
47$langs->loadLangs($langsLoad);
51$action =
GETPOST(
'action',
'aZ09');
52$backtopage =
GETPOST(
'backtopage',
'alpha');
53$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
54$backtopagejsfields =
GETPOST(
'backtopagejsfields',
'alpha');
55$cancel =
GETPOST(
'cancel',
'alpha');
56$confirm =
GETPOST(
'confirm',
'aZ09');
59if (!empty($backtopagejsfields)) {
60 $tmpbacktopagejsfields = explode(
':', $backtopagejsfields);
61 $dol_openinpopup = $tmpbacktopagejsfields[0];
64$status =
GETPOST(
'status',
'int');
65$opp_status =
GETPOST(
'opp_status',
'int');
67$objcanvas =
GETPOST(
"objcanvas",
"alphanohtml");
68$comefromclone =
GETPOST(
"comefromclone",
"alphanohtml");
73$location =
GETPOST(
'location',
'alphanohtml');
77$mine =
GETPOST(
'mode') ==
'mine' ? 1 : 0;
81$hookmanager->initHooks(array(
'projectcard',
'globalcard'));
88if ($id > 0 || !empty($ref)) {
89 $ret = $object->fetch($id, $ref);
91 $object->fetch_thirdparty();
92 if (
getDolGlobalString(
'PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object,
'fetchComments') && empty($object->comments)) {
93 $object->fetchComments();
100$extrafields->fetch_name_optionals_label($object->table_element);
103$socid =
GETPOST(
'socid',
'int');
107if ($id ==
'' && $ref ==
'' && ($action !=
"create" && $action !=
"add" && $action !=
"update" && !
GETPOST(
"cancel"))) {
111$permissiontoadd = $user->hasRight(
'projet',
'creer');
112$permissiontodelete = $user->hasRight(
'projet',
'supprimer');
113$permissiondellink = $user->hasRight(
'projet',
'creer');
114$permissiontoeditextra = $permissiontoadd;
121$parameters = array(
'id'=>$socid,
'objcanvas'=>$objcanvas);
122$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
127if (empty($reshook)) {
128 $backurlforlist = DOL_URL_ROOT.
'/projet/list.php';
132 if (
GETPOST(
"comefromclone") == 1) {
133 $result = $object->delete($user);
135 header(
"Location: index.php");
139 setEventMessages($langs->trans(
"CantRemoveProject", $langs->transnoentitiesnoconv(
"ProjectOverview")),
null,
'errors');
144 if (empty($backtopage) || ($cancel && empty($id))) {
145 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
146 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
147 $backtopage = $backurlforlist;
149 $backtopage = DOL_URL_ROOT.
'/projet/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
155 if (!empty($backtopageforcancel)) {
156 header(
"Location: ".$backtopageforcancel);
158 } elseif (!empty($backtopage)) {
159 header(
"Location: ".$backtopage);
165 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
168 if ($action ==
'confirm_setdraft' && $confirm ==
'yes' && $permissiontoadd) {
169 $result = $object->setStatut($object::STATUS_DRAFT,
null,
'',
'PROJECT_MODIFY');
180 if ($action ==
'add' && $permissiontoadd) {
183 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")),
null,
'errors');
187 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"ProjectLabel")),
null,
'errors');
192 if (
GETPOST(
'usage_opportunity') !=
'' && !(
GETPOST(
'opp_status') > 0)) {
194 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfUsage"),
null,
'errors');
196 if (
GETPOST(
'opp_amount') !=
'' && !(
GETPOST(
'opp_status') > 0)) {
198 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfAmount"),
null,
'errors');
212 $object->ref =
GETPOST(
'ref',
'alphanohtml');
213 $object->fk_project =
GETPOST(
'fk_project',
'int');
214 $object->title =
GETPOST(
'title',
'alphanohtml');
215 $object->socid =
GETPOST(
'socid',
'int');
216 $object->description =
GETPOST(
'description',
'restricthtml');
217 $object->public =
GETPOST(
'public',
'alphanohtml');
219 $object->budget_amount =
price2num(
GETPOST(
'budget_amount',
'alphanohtml'));
221 $object->date_start = $date_start;
222 $object->date_end = $date_end;
223 $object->date_start_event = $date_start_event;
224 $object->date_end_event = $date_end_event;
225 $object->location = $location;
226 $object->statut = $status;
227 $object->opp_status = $opp_status;
228 $object->opp_percent = $opp_percent;
229 $object->usage_opportunity = (
GETPOST(
'usage_opportunity',
'alpha') ==
'on' ? 1 : 0);
230 $object->usage_task = (
GETPOST(
'usage_task',
'alpha') ==
'on' ? 1 : 0);
231 $object->usage_bill_time = (
GETPOST(
'usage_bill_time',
'alpha') ==
'on' ? 1 : 0);
232 $object->usage_organize_event = (
GETPOST(
'usage_organize_event',
'alpha') ==
'on' ? 1 : 0);
235 $ret = $extrafields->setOptionalsFromPost(
null, $object);
240 $result = $object->create($user);
241 if (!$error && $result > 0) {
243 $typeofcontact =
'PROJECTLEADER';
244 $result = $object->add_contact($user->id, $typeofcontact,
'internal');
250 } elseif ($result < 0) {
251 $langs->load(
"errors");
256 $langs->load(
"errors");
260 if (!$error && !empty($object->id) > 0) {
262 $categories =
GETPOST(
'categories',
'array');
263 $result = $object->setCategories($categories);
265 $langs->load(
"errors");
274 if (!empty($backtopage)) {
275 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--|__ID__/', $object->id, $backtopage);
276 $backtopage = $backtopage.
'&projectid='.$object->id;
277 header(
"Location: ".$backtopage);
280 header(
"Location:card.php?id=".$object->id);
285 unset($_POST[
"ref"]);
293 if ($action ==
'update' && empty(
GETPOST(
'cancel')) && $permissiontoadd) {
298 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")),
null,
'errors');
302 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"ProjectLabel")),
null,
'errors');
308 $object->oldcopy = clone $object;
310 $old_start_date = $object->date_start;
312 $object->ref =
GETPOST(
'ref',
'alpha');
313 $object->fk_project =
GETPOST(
'fk_project',
'int');
314 $object->title =
GETPOST(
'title',
'alphanohtml');
315 $object->statut =
GETPOST(
'status',
'int');
316 $object->socid =
GETPOST(
'socid',
'int');
317 $object->description =
GETPOST(
'description',
'restricthtml');
318 $object->public =
GETPOST(
'public',
'alpha');
319 $object->date_start = (!
GETPOST(
'projectstart')) ?
'' : $date_start;
320 $object->date_end = (!
GETPOST(
'projectend')) ?
'' : $date_end;
321 $object->date_start_event = (!
GETPOST(
'date_start_event')) ?
'' : $date_start_event;
322 $object->date_end_event = (!
GETPOST(
'date_end_event')) ?
'' : $date_end_event;
323 $object->location = $location;
324 if (GETPOSTISSET(
'opp_amount')) {
327 if (GETPOSTISSET(
'budget_amount')) {
330 if (GETPOSTISSET(
'opp_status')) {
331 $object->opp_status = $opp_status;
333 if (GETPOSTISSET(
'opp_percent')) {
334 $object->opp_percent = $opp_percent;
336 $object->usage_opportunity = (
GETPOST(
'usage_opportunity',
'alpha') ==
'on' ? 1 : 0);
337 $object->usage_task = (
GETPOST(
'usage_task',
'alpha') ==
'on' ? 1 : 0);
338 $object->usage_bill_time = (
GETPOST(
'usage_bill_time',
'alpha') ==
'on' ? 1 : 0);
339 $object->usage_organize_event = (
GETPOST(
'usage_organize_event',
'alpha') ==
'on' ? 1 : 0);
342 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
349 if ($object->opp_amount && ($object->opp_status <= 0)) {
351 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfAmount"),
null,
'errors');
356 $result = $object->update($user);
366 $categories =
GETPOST(
'categories',
'array');
367 $result = $object->setCategories($categories);
376 if (
GETPOST(
"reportdate") && ($object->date_start != $old_start_date)) {
377 $result = $object->shiftTaskDate($old_start_date);
380 setEventMessages($langs->trans(
"ErrorShiftTaskDate").
':'.$object->error, $object->errors,
'errors');
387 $resclose = $object->setClose($user);
390 setEventMessages($langs->trans(
"FailedToCloseProject").
':'.$object->error, $object->errors,
'errors');
401 if (
GETPOST(
'socid',
'int') > 0) {
402 $object->fetch_thirdparty(
GETPOST(
'socid',
'int'));
404 unset($object->thirdparty);
410 if ($action ==
'builddoc' && $permissiontoadd) {
413 $object->setDocModel($user,
GETPOST(
'model',
'alpha'));
416 $outputlangs = $langs;
417 if (
GETPOST(
'lang_id',
'aZ09')) {
419 $outputlangs->setDefaultLang(
GETPOST(
'lang_id',
'aZ09'));
421 $result = $object->generateDocument($object->model_pdf, $outputlangs);
429 if ($action ==
'remove_file' && $permissiontoadd) {
430 if ($object->id > 0) {
431 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
433 $langs->load(
"other");
434 $upload_dir = $conf->project->multidir_output[$object->entity];
435 $file = $upload_dir.
'/'.
GETPOST(
'file');
447 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $permissiontoadd) {
448 $result = $object->setValid($user);
454 if ($action ==
'confirm_close' && $confirm ==
'yes' && $permissiontoadd) {
455 $result = $object->setClose($user);
461 if ($action ==
'confirm_reopen' && $confirm ==
'yes' && $permissiontoadd) {
462 $result = $object->setValid($user);
468 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
470 $result = $object->delete($user);
474 if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
475 $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
476 $tmpurl = preg_replace(
'/__SOCID__/', $object->socid, $tmpurl);
477 $urlback = $tmpurl.(preg_match(
'/\?/', $tmpurl) ?
'&' :
'?').
'restore_lastsearch_values=1';
479 $urlback = DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1';
482 header(
"Location: ".$urlback);
490 if ($action ==
'confirm_clone' && $permissiontoadd && $confirm ==
'yes') {
491 $clone_contacts =
GETPOST(
'clone_contacts') ? 1 : 0;
492 $clone_tasks =
GETPOST(
'clone_tasks') ? 1 : 0;
493 $clone_project_files =
GETPOST(
'clone_project_files') ? 1 : 0;
494 $clone_task_files =
GETPOST(
'clone_task_files') ? 1 : 0;
495 $clone_notes =
GETPOST(
'clone_notes') ? 1 : 0;
496 $move_date =
GETPOST(
'move_date') ? 1 : 0;
497 $clone_thirdparty =
GETPOST(
'socid',
'int') ?
GETPOST(
'socid',
'int') : 0;
499 $result = $object->createFromClone($user, $object->id, $clone_contacts, $clone_tasks, $clone_project_files, $clone_task_files, $clone_notes, $move_date, 0, $clone_thirdparty);
505 $newobject->fetch($result);
507 setEventMessages($langs->trans(
"ProjectCreatedInDolibarr", $newobject->ref),
"",
'mesgs');
509 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.$result.
'&action=edit&comefromclone=1');
515 if ($action ==
'update_extras' && $permissiontoeditextra) {
516 $object->oldcopy =
dol_clone($object, 2);
518 $attribute_name =
GETPOST(
'attribute',
'aZ09');
521 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
527 $result = $object->updateExtraField($attribute_name,
'PROJECT_MODIFY');
535 $action =
'edit_extras';
540 $triggersendname =
'PROJECT_SENTBYMAIL';
542 $autocopy =
'MAIN_MAIL_AUTOCOPY_PROJECT_TO';
543 $trackid =
'proj'.$object->id;
544 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
552$form =
new Form($db);
555$userstatic =
new User($db);
557$title = $langs->trans(
"Project").
' - '.$object->ref.(!empty($object->thirdparty->name) ?
' - '.$object->thirdparty->name :
'').(!empty($object->title) ?
' - '.$object->title :
'');
558if (
getDolGlobalString(
'MAIN_HTML_TITLE') && preg_match(
'/projectnameonly/', $conf->global->MAIN_HTML_TITLE)) {
559 $title = $object->ref.(!empty($object->thirdparty->name) ?
' - '.$object->thirdparty->name :
'').(!empty($object->title) ?
' - '.$object->title :
'');
562$help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:Modul_Projekte";
566$titleboth = $langs->trans(
"LeadsOrProjects");
567$titlenew = $langs->trans(
"NewLeadOrProject");
569 $titleboth = $langs->trans(
"Projects");
570 $titlenew = $langs->trans(
"NewProject");
573 $titleboth = $langs->trans(
"Leads");
574 $titlenew = $langs->trans(
"NewLead");
577if ($action ==
'create' && $user->hasRight(
'projet',
'creer')) {
582 $thirdparty =
new Societe($db);
584 $thirdparty->fetch($socid);
589 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
590 print
'<input type="hidden" name="action" value="add">';
591 print
'<input type="hidden" name="token" value="'.newToken().
'">';
592 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
593 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
594 print
'<input type="hidden" name="backtopagejsfields" value="'.$backtopagejsfields.
'">';
595 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
599 print
'<table class="border centpercent tableforfieldcreate">';
602 $modele = !
getDolGlobalString(
'PROJECT_ADDON') ?
'mod_project_simple' : $conf->global->PROJECT_ADDON;
608 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
609 foreach ($dirmodels as $reldir) {
610 $file =
dol_buildpath($reldir.
"core/modules/project/".$modele.
'.php', 0);
611 if (file_exists($file)) {
613 $classname = $modele;
620 $modProject =
new $classname();
622 $defaultref = $modProject->getNextValue($thirdparty, $object);
625 if (is_numeric($defaultref) && $defaultref <= 0) {
631 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).
'">';
633 print
' '.$form->textwithpicto(
'', $langs->trans(
"YouCanCompleteRef", $suggestedref));
638 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>';
642 print
'<tr><td>'.$langs->trans(
"Parent").
'</td><td class="maxwidthonsmartphone">';
643 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
644 $formproject->select_projects(-1,
'',
'fk_project', 64, 0, 1, 1, 0, 0, 0,
'', 0, 0,
'',
'',
'');
650 print
'<tr><td class="tdtop">';
651 print $langs->trans(
"Usage");
655 print
'<input type="checkbox" id="usage_opportunity" name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') ?
' checked="checked"' :
'') :
' checked="checked"').
'"> ';
656 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
657 print
'<label for="usage_opportunity">'.$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext).
'</label>';
659 print
'$( document ).ready(function() {
660 jQuery("#usage_opportunity").change(function() {
661 if (jQuery("#usage_opportunity").prop("checked")) {
662 console.log("Show opportunities fields");
663 jQuery(".classuseopportunity").show();
665 console.log("Hide opportunities fields "+jQuery("#usage_opportunity").prop("checked"));
666 jQuery(".classuseopportunity").hide();
670 if (GETPOSTISSET(
'usage_opportunity') && !
GETPOST(
'usage_opportunity')) {
671 print
'jQuery(".classuseopportunity").hide();';
678 print
'<input type="checkbox" id="usage_task" name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') ?
' checked="checked"' :
'') :
' checked="checked"').
'"> ';
679 $htmltext = $langs->trans(
"ProjectFollowTasks");
680 print
'<label for="usage_task">'.$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext).
'</label>';
682 print
'$( document ).ready(function() {
683 jQuery("#usage_task").change(function() {
684 if (jQuery("#usage_task").prop("checked")) {
685 console.log("Show task fields");
686 jQuery(".classusetask").show();
688 console.log("Hide tasks fields "+jQuery("#usage_task").prop("checked"));
689 jQuery(".classusetask").hide();
693 if (GETPOSTISSET(
'usage_task') && !
GETPOST(
'usage_task')) {
694 print
'jQuery(".classusetask").hide();';
701 print
'<input type="checkbox" id="usage_bill_time" name="usage_bill_time"'.(GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time',
'alpha') ?
' checked="checked"' :
'') :
'').
'"> ';
702 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
703 print
'<label for="usage_bill_time">'.$form->textwithpicto($langs->trans(
"BillTime"), $htmltext).
'</label>';
705 print
'$( document ).ready(function() {
706 jQuery("#usage_bill_time").change(function() {
707 if (jQuery("#usage_bill_time").prop("checked")) {
708 console.log("Show bill time fields");
709 jQuery(".classusebilltime").show();
711 console.log("Hide bill time fields "+jQuery("#usage_bill_time").prop("checked"));
712 jQuery(".classusebilltime").hide();
716 if (GETPOSTISSET(
'usage_bill_time') && !
GETPOST(
'usage_bill_time')) {
717 print
'jQuery(".classusebilltime").hide();';
723 if (isModEnabled(
'eventorganization')) {
724 print
'<input type="checkbox" id="usage_organize_event" name="usage_organize_event"'.(GETPOSTISSET(
'usage_organize_event') ? (
GETPOST(
'usage_organize_event',
'alpha') ?
' checked="checked"' :
'') :
'').
'"> ';
725 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
726 print
'<label for="usage_organize_event">'.$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext).
'</label>';
728 print
'$( document ).ready(function() {
729 jQuery("#usage_organize_event").change(function() {
730 if (jQuery("#usage_organize_event").prop("checked")) {
731 console.log("Show organize event fields");
732 jQuery(".classuseorganizeevent").show();
734 console.log("Hide organize event fields "+jQuery("#usage_organize_event").prop("checked"));
735 jQuery(".classuseorganizeevent").hide();
739 if (!
GETPOST(
'usage_organize_event')) {
740 print
'jQuery(".classuseorganizeevent").hide();';
750 if (isModEnabled(
'societe')) {
752 print(!
getDolGlobalString(
'PROJECT_THIRDPARTY_REQUIRED') ?
'' :
'<span class="fieldrequired">');
753 print $langs->trans(
"ThirdParty");
755 print
'</td><td class="maxwidthonsmartphone">';
758 $filter = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
760 $text =
img_picto(
'',
'company').$form->select_company(
GETPOST(
'socid',
'int'),
'socid', $filter,
'SelectThirdParty', 1, 0, array(), 0,
'minwidth300 widthcentpercentminusxx maxwidth500');
761 if (!
getDolGlobalString(
'PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') && empty($conf->dol_use_jmobile)) {
762 $texthelp = $langs->trans(
"IfNeedToUseOtherObjectKeepEmpty");
763 print $form->textwithtooltip($text.
' '.
img_help(), $texthelp, 1);
767 if (!GETPOSTISSET(
'backtopage')) {
768 $url =
'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?action=create');
769 $newbutton =
'<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddThirdParty").
'"></span>';
772 $tmpbacktopagejsfields =
'addthirdparty:socid,search_socid';
773 print
dolButtonToOpenUrlInDialogPopup(
'addthirdparty', $langs->transnoentitiesnoconv(
'AddThirdParty'), $newbutton, $url,
'',
'',
'', $tmpbacktopagejsfields);
775 print
' <a href="'.DOL_URL_ROOT.$url.
'">'.$newbutton.
'</a>';
783 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
784 print
'<input type="hidden" name="status" value="'.$status.
'">';
785 print $object->LibStatut($status, 4);
790 print
'<tr><td>'.$langs->trans(
"Visibility").
'</td><td class="maxwidthonsmartphone">';
793 $array[0] = $langs->trans(
"PrivateProject");
796 $array[1] = $langs->trans(
"SharedProject");
799 if (count($array) > 0) {
800 print $form->selectarray(
'public', $array,
GETPOST(
'public'), 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
802 print
'<input type="hidden" name="public" id="public" value="'.GETPOST(
'public').
'">';
805 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
806 print $langs->trans(
"PrivateProject");
808 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
809 print $langs->trans(
"SharedProject");
816 print
'<tr class="classuseopportunity"><td><span class="fieldrequired">'.$langs->trans(
"OpportunityStatus").
'</span></td>';
817 print
'<td class="maxwidthonsmartphone">';
818 print $formproject->selectOpportunityStatus(
'opp_status', GETPOSTISSET(
'opp_status') ?
GETPOST(
'opp_status') : $object->opp_status, 1, 0, 0, 0,
'', 0, 1);
821 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>';
822 print
'<input type="hidden" name="opp_percent_not_set" id="opp_percent_not_set" value="'.dol_escape_htmltag(GETPOSTISSET(
'opp_percent') ?
'0' :
'1').
'">';
827 print
'<tr class="classuseopportunity"><td>'.$langs->trans(
"OpportunityAmount").
'</td>';
828 print
'<td><input class="width75 right" type="text" name="opp_amount" value="'.dol_escape_htmltag(GETPOSTISSET(
'opp_amount') ?
GETPOST(
'opp_amount') :
'').
'">';
829 print
' '.$langs->getCurrencySymbol($conf->currency);
835 print
'<tr><td>'.$langs->trans(
"Budget").
'</td>';
836 print
'<td><input class="width75 right" type="text" name="budget_amount" value="'.dol_escape_htmltag(GETPOSTISSET(
'budget_amount') ?
GETPOST(
'budget_amount') :
'').
'">';
837 print
' '.$langs->getCurrencySymbol($conf->currency);
842 print
'<tr><td>'.$langs->trans(
"Date").(isModEnabled(
'eventorganization') ?
' <span class="classuseorganizeevent">('.$langs->trans(
"Project").
')</span>' :
'').
'</td><td>';
843 print $form->selectDate(($date_start ? $date_start :
''),
'projectstart', 0, 0, 0,
'', 1, 0);
844 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
845 print $form->selectDate(($date_end ? $date_end : -1),
'projectend', 0, 0, 0,
'', 1, 0);
848 if (isModEnabled(
'eventorganization')) {
850 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Date").
' ('.$langs->trans(
"Event").
')</td><td>';
851 print $form->selectDate(($date_start_event ? $date_start_event : -1),
'date_start_event', 1, 1, 1,
'', 1, 0);
852 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
853 print $form->selectDate(($date_end_event ? $date_end_event : -1),
'date_end_event', 1, 1, 1,
'', 1, 0);
857 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Location").
'</td>';
858 print
'<td><input class="minwidth300 maxwidth500" type="text" name="location" value="'.dol_escape_htmltag($location).
'"></td>';
863 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
865 $doleditor =
new DolEditor(
'description',
GETPOST(
"description",
'restricthtml'),
'', 90,
'dolibarr_notes',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_3,
'90%');
866 $doleditor->Create();
869 if (isModEnabled(
'categorie')) {
871 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
872 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT,
'',
'parent', 64, 0, 1);
873 $arrayselected =
GETPOST(
'categories',
'array');
874 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
879 $parameters = array();
880 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
881 print $hookmanager->resPrint;
882 if (empty($reshook)) {
883 print $object->showOptionals($extrafields,
'create');
890 print $form->buttonsSaveCancel(
'CreateDraft');
896 print
'<script type="text/javascript">
897 jQuery(document).ready(function() {
898 function change_percent()
900 var element = jQuery("#opp_status option:selected");
901 var defaultpercent = element.attr("defaultpercent");
902 /*if (jQuery("#opp_percent_not_set").val() == "") */
903 jQuery("#opp_percent").val(defaultpercent);
907 jQuery("#opp_status").change(function() {
911 jQuery("#usage_task").change(function() {
912 console.log("We click on usage task "+jQuery("#usage_task").is(":checked"));
913 if (! jQuery("#usage_task").is(":checked")) {
914 jQuery("#usage_bill_time").prop("checked", false);
918 jQuery("#usage_bill_time").change(function() {
919 console.log("We click on usage to bill time");
920 if (jQuery("#usage_bill_time").is(":checked")) {
921 jQuery("#usage_task").prop("checked", true);
926} elseif ($object->id > 0) {
931 $res = $object->fetch_optionals();
934 $userAccess = $object->restrictedProjectArea($user,
'read');
935 $userWrite = $object->restrictedProjectArea($user,
'write');
936 $userDelete = $object->restrictedProjectArea($user,
'delete');
941 if ($action ==
'validate') {
942 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ValidateProject'), $langs->trans(
'ConfirmValidateProject'),
'confirm_validate',
'', 0, 1);
945 if ($action ==
'close') {
946 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"CloseAProject"), $langs->trans(
"ConfirmCloseAProject"),
"confirm_close",
'',
'', 1);
949 if ($action ==
'reopen') {
950 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"ReOpenAProject"), $langs->trans(
"ConfirmReOpenAProject"),
"confirm_reopen",
'',
'', 1);
953 if ($action ==
'delete') {
954 $text = $langs->trans(
"ConfirmDeleteAProject");
955 $task =
new Task($db);
956 $taskarray = $task->getTasksArray(0, 0, $object->id, 0, 0);
957 $nboftask = count($taskarray);
959 $text .=
'<br>'.img_warning().
' '.$langs->trans(
"ThisWillAlsoRemoveTasks", $nboftask);
961 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"DeleteAProject"), $text,
"confirm_delete",
'',
'', 1);
965 if ($action ==
'clone') {
966 $formquestion = array(
967 'text' => $langs->trans(
"ConfirmClone"),
968 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')),
969 array(
'type' =>
'checkbox',
'name' =>
'clone_contacts',
'label' => $langs->trans(
"CloneContacts"),
'value' => true),
970 array(
'type' =>
'checkbox',
'name' =>
'clone_tasks',
'label' => $langs->trans(
"CloneTasks"),
'value' => true),
971 array(
'type' =>
'checkbox',
'name' =>
'move_date',
'label' => $langs->trans(
"CloneMoveDate"),
'value' => true),
972 array(
'type' =>
'checkbox',
'name' =>
'clone_notes',
'label' => $langs->trans(
"CloneNotes"),
'value' => true),
973 array(
'type' =>
'checkbox',
'name' =>
'clone_project_files',
'label' => $langs->trans(
"CloneProjectFiles"),
'value' => false),
974 array(
'type' =>
'checkbox',
'name' =>
'clone_task_files',
'label' => $langs->trans(
"CloneTaskFiles"),
'value' => false)
977 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"ToClone"), $langs->trans(
"ConfirmCloneProject"),
"confirm_clone", $formquestion,
'', 1, 400, 590);
981 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
982 print
'<input type="hidden" name="token" value="'.newToken().
'">';
983 print
'<input type="hidden" name="action" value="update">';
984 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
985 print
'<input type="hidden" name="comefromclone" value="'.$comefromclone.
'">';
989 if ($action ==
'edit' && $userWrite > 0) {
990 print
dol_get_fiche_head($head,
'project', $langs->trans(
"Project"), 0, ($object->public ?
'projectpub' :
'project'));
992 print
'<table class="border centpercent">';
995 $suggestedref = $object->ref;
996 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Ref").
'</td>';
997 print
'<td><input size="25" name="ref" value="'.$suggestedref.
'">';
998 print
' '.$form->textwithpicto(
'', $langs->trans(
"YouCanCompleteRef", $suggestedref));
1002 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
1003 print
'<td><input class="quatrevingtpercent" name="title" value="'.dol_escape_htmltag($object->title).
'"></td></tr>';
1006 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td><td>';
1007 print
'<select class="flat" name="status" id="status">';
1008 $statuses = $object->labelStatusShort;
1010 unset($statuses[$object::STATUS_DRAFT]);
1012 foreach ($statuses as $key => $val) {
1013 print
'<option value="'.$key.
'"'.((GETPOSTISSET(
'status') ?
GETPOST(
'status') : $object->
statut) == $key ?
' selected="selected"' :
'').
'>'.$langs->trans($val).
'</option>';
1021 print
'<tr><td>'.$langs->trans(
"Parent").
'</td><td class="maxwidthonsmartphone">';
1022 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
1023 $formproject->select_projects(-1, $object->fk_project,
'fk_project', 64, 0, 1, 1, 0, 0, 0,
'', 0, 0,
'',
'',
'');
1029 print
'<tr><td class="tdtop">';
1030 print $langs->trans(
"Usage");
1034 print
'<input type="checkbox" id="usage_opportunity" name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'> ';
1035 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
1036 print
'<label for="usage_opportunity">'.$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext).
'</label>';
1038 print
'$( document ).ready(function() {
1039 jQuery("#usage_opportunity").change(function() {
1040 set_usage_opportunity();
1043 set_usage_opportunity();
1045 function set_usage_opportunity() {
1046 console.log("set_usage_opportunity");
1047 if (jQuery("#usage_opportunity").prop("checked")) {
1048 console.log("Show opportunities fields");
1049 jQuery(".classuseopportunity").show();
1051 console.log("Hide opportunities fields "+jQuery("#usage_opportunity").prop("checked"));
1052 jQuery(".classuseopportunity").hide();
1060 print
'<input type="checkbox" id="usage_task" name="usage_task"' . (GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')) .
'> ';
1061 $htmltext = $langs->trans(
"ProjectFollowTasks");
1062 print
'<label for="usage_task">'.$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext).
'</label>';
1064 print
'$( document ).ready(function() {
1065 jQuery("#usage_task").change(function() {
1071 function set_usage_task() {
1072 console.log("set_usage_task");
1073 if (jQuery("#usage_task").prop("checked")) {
1074 console.log("Show task fields");
1075 jQuery(".classusetask").show();
1077 console.log("Hide task fields "+jQuery("#usage_task").prop("checked"));
1078 jQuery(".classusetask").hide();
1086 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"' :
'')) .
'> ';
1087 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
1088 print
'<label for="usage_bill_time">'.$form->textwithpicto($langs->trans(
"BillTime"), $htmltext).
'</label>';
1090 print
'$( document ).ready(function() {
1091 jQuery("#usage_bill_time").change(function() {
1092 set_usage_bill_time();
1095 set_usage_bill_time();
1097 function set_usage_bill_time() {
1098 console.log("set_usage_bill_time");
1099 if (jQuery("#usage_bill_time").prop("checked")) {
1100 console.log("Show bill time fields");
1101 jQuery(".classusebilltime").show();
1103 console.log("Hide bill time fields "+jQuery("#usage_bill_time").prop("checked"));
1104 jQuery(".classusebilltime").hide();
1111 if (isModEnabled(
'eventorganization')) {
1112 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"' :
'')) .
'> ';
1113 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
1114 print
'<label for="usage_organize_event">'.$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext).
'</label>';
1116 print
'$( document ).ready(function() {
1117 jQuery("#usage_organize_event").change(function() {
1123 function set_usage_event() {
1124 console.log("set_usage_event");
1125 if (jQuery("#usage_organize_event").prop("checked")) {
1126 console.log("Show organize event fields");
1127 jQuery(".classuseorganizeevent").show();
1129 console.log("Hide organize event fields "+jQuery("#usage_organize_event").prop("checked"));
1130 jQuery(".classuseorganizeevent").hide();
1141 if (isModEnabled(
'societe')) {
1143 print(!
getDolGlobalString(
'PROJECT_THIRDPARTY_REQUIRED') ?
'' :
'<span class="fieldrequired">');
1144 print $langs->trans(
"ThirdParty");
1149 $filter = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
1151 $text =
img_picto(
'',
'company',
'class="pictofixedwidth"');
1152 $text .= $form->select_company(!empty($object->thirdparty->id) ? $object->thirdparty->id :
"",
'socid', $filter,
'None', 1, 0, array(), 0,
'minwidth300');
1153 if (!
getDolGlobalString(
'PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') && empty($conf->dol_use_jmobile)) {
1154 $texthelp = $langs->trans(
"IfNeedToUseOtherObjectKeepEmpty");
1155 print $form->textwithtooltip($text.
' '.
img_help(), $texthelp, 1, 0,
'',
'', 2);
1163 print
'<tr><td>'.$langs->trans(
"Visibility").
'</td><td>';
1166 $array[0] = $langs->trans(
"PrivateProject");
1169 $array[1] = $langs->trans(
"SharedProject");
1172 if (count($array) > 0) {
1173 print $form->selectarray(
'public', $array, $object->public, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1175 print
'<input type="hidden" id="public" name="public" value="'.$object->public.
'">';
1177 if ($object->public == 0) {
1178 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
1179 print $langs->trans(
"PrivateProject");
1181 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
1182 print $langs->trans(
"SharedProject");
1188 $classfortr = ($object->usage_opportunity ?
'' :
' hideobject');
1190 print
'<tr class="classuseopportunity'.$classfortr.
'"><td>'.$langs->trans(
"OpportunityStatus").
'</td>';
1193 print $formproject->selectOpportunityStatus(
'opp_status', $object->opp_status, 1, 0, 0, 0,
'minwidth150 inline-block valignmiddle', 1, 1);
1196 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) :
'')).
'"> %';
1197 print
'<span id="oldopppercent" class="opacitymedium"></span>';
1200 print
'<div id="divtocloseproject" class="inline-block valign clearboth paddingtop" style="display: none;">';
1201 print
'<input type="checkbox" id="inputcloseproject" name="closeproject" />';
1202 print
'<label for="inputcloseproject">';
1203 print $form->textwithpicto($langs->trans(
"AlsoCloseAProject"), $langs->trans(
"AlsoCloseAProjectTooltip")).
'</label>';
1210 print
'<tr class="classuseopportunity'.$classfortr.
'"><td>'.$langs->trans(
"OpportunityAmount").
'</td>';
1211 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) :
'')).
'">';
1212 print $langs->getCurrencySymbol($conf->currency);
1218 print
'<tr><td>'.$langs->trans(
"Budget").
'</td>';
1219 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) :
'')).
'">';
1220 print $langs->getCurrencySymbol($conf->currency);
1225 print
'<tr><td>'.$langs->trans(
"Date").(isModEnabled(
'eventorganization') ?
' <span class="classuseorganizeevent">('.$langs->trans(
"Project").
')</span>' :
'').
'</td><td>';
1226 print $form->selectDate($object->date_start ? $object->date_start : -1,
'projectstart', 0, 0, 0,
'', 1, 0);
1227 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
1228 print $form->selectDate($object->date_end ? $object->date_end : -1,
'projectend', 0, 0, 0,
'', 1, 0);
1229 $object->getLinesArray(
null, 0);
1230 if (!empty($object->usage_task) && !empty($object->lines)) {
1231 print
' <span id="divreportdate" class="hidden"> <input type="checkbox" class="valignmiddle" id="reportdate" name="reportdate" value="yes" ';
1232 if ($comefromclone) {
1235 print
'/><label for="reportdate" class="valignmiddle opacitymedium">'.$langs->trans(
"ProjectReportDate").
'</label></span>';
1239 if (isModEnabled(
'eventorganization')) {
1241 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Date").
' ('.$langs->trans(
"Event").
')</td><td>';
1242 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);
1243 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
1244 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);
1248 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Location").
'</td>';
1249 print
'<td><input class="minwidth300 maxwidth500" type="text" name="location" value="'.dol_escape_htmltag(GETPOSTISSET(
'location') ?
GETPOST(
'location') : $object->location).
'"></td>';
1254 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
1256 $doleditor =
new DolEditor(
'description', $object->description,
'', 90,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_3,
'90%');
1257 $doleditor->Create();
1261 if (isModEnabled(
'categorie')) {
1262 $arrayselected = array();
1263 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
1264 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT,
'',
'parent', 64, 0, 1);
1266 $cats = $c->containing($object->id, Categorie::TYPE_PROJECT);
1267 foreach ($cats as $cat) {
1268 $arrayselected[] = $cat->id;
1270 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0,
'0');
1275 $parameters = array();
1276 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1277 print $hookmanager->resPrint;
1278 if (empty($reshook)) {
1279 print $object->showOptionals($extrafields,
'edit');
1284 print
dol_get_fiche_head($head,
'project', $langs->trans(
"Project"), -1, ($object->public ?
'projectpub' :
'project'));
1288 if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
1289 $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
1290 $tmpurl = preg_replace(
'/__SOCID__/', $object->socid, $tmpurl);
1291 $linkback =
'<a href="'.$tmpurl.(preg_match(
'/\?/', $tmpurl) ?
'&' :
'?').
'restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1293 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1296 $morehtmlref =
'<div class="refidno">';
1299 $morehtmlref .=
'<br>';
1301 if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
1302 $morehtmlref .= $object->thirdparty->getNomUrl(1,
'project');
1306 if (!empty($object->fk_project) && $object->fk_project) {
1308 $parent->fetch($object->fk_project);
1309 $morehtmlref .= $langs->trans(
"Child of").
' '.$parent->getNomUrl(1,
'project').
' '.$parent->title;
1312 $morehtmlref .=
'</div>';
1315 if (!$user->hasRight(
'projet',
'all',
'lire')) {
1316 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
1317 $object->next_prev_filter =
"rowid IN (".$db->sanitize(count($objectsListId) ? join(
',', array_keys($objectsListId)) :
'0').
")";
1320 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1322 print
'<div class="fichecenter">';
1323 print
'<div class="fichehalfleft">';
1324 print
'<div class="underbanner clearboth"></div>';
1326 print
'<table class="border tableforfield centpercent">';
1330 print
'<tr><td class="tdtop">';
1331 print $langs->trans(
"Usage");
1335 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'> ';
1336 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
1337 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
1341 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')).
'> ';
1342 $htmltext = $langs->trans(
"ProjectFollowTasks");
1343 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
1347 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"' :
'')).
'> ';
1348 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
1349 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
1353 if (isModEnabled(
'eventorganization')) {
1354 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"' :
'')).
'> ';
1355 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
1356 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
1362 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
1363 if ($object->public) {
1364 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
1365 print $langs->trans(
'SharedProject');
1367 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
1368 print $langs->trans(
'PrivateProject');
1372 if (
getDolGlobalString(
'PROJECT_USE_OPPORTUNITIES') && !empty($object->usage_opportunity)) {
1374 print
'<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
1375 $code =
dol_getIdFromCode($db, $object->opp_status,
'c_lead_status',
'rowid',
'code');
1377 print $langs->trans(
"OppStatus".$code);
1381 print
' <span title="'.$langs->trans(
"OpportunityProbability").
'"> / ';
1382 if (strcmp($object->opp_percent,
'')) {
1383 print
price($object->opp_percent, 0, $langs, 1, 0).
' %';
1385 print
'</span></td></tr>';
1388 print
'<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
1389 if (strcmp($object->opp_amount,
'')) {
1390 print
'<span class="amount">'.price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency).
'</span>';
1391 if (strcmp($object->opp_percent,
'')) {
1392 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>';
1399 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
1400 if (!is_null($object->budget_amount) && strcmp($object->budget_amount,
'')) {
1401 print
'<span class="amount">'.price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
1406 print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
1408 print($start ? $start :
'?');
1410 print
' <span class="opacitymedium">-</span> ';
1411 print($end ? $end :
'?');
1412 if ($object->hasDelay()) {
1419 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1424 print
'<div class="fichehalfright">';
1425 print
'<div class="underbanner clearboth"></div>';
1427 print
'<table class="border tableforfield centpercent">';
1430 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
1435 if (isModEnabled(
'categorie')) {
1436 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
1437 print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
1446 print
'<div class="clearboth"></div>';
1451 if ($action ==
'edit' && $userWrite > 0) {
1452 print $form->buttonsSaveCancel();
1458 print
'<script type="text/javascript">
1459 jQuery(document).ready(function() {
1460 jQuery("#usage_task").change(function() {
1461 console.log("We click on usage task "+jQuery("#usage_task").is(":checked"));
1462 if (! jQuery("#usage_task").is(":checked")) {
1463 jQuery("#usage_bill_time").prop("checked", false);
1467 jQuery("#usage_bill_time").change(function() {
1468 console.log("We click on usage to bill time");
1469 if (jQuery("#usage_bill_time").is(":checked")) {
1470 jQuery("#usage_task").prop("checked", true);
1474 jQuery("#projectstart").change(function() {
1475 console.log("We modify the start date");
1476 jQuery("#divreportdate").show();
1482 if (!empty($conf->use_javascript_ajax) &&
getDolGlobalString(
'PROJECT_USE_OPPORTUNITIES')) {
1484 $defaultcheckedwhenoppclose = 1;
1486 $defaultcheckedwhenoppclose = 0;
1489 print
'<!-- Javascript to manage opportunity status change -->';
1490 print
'<script type="text/javascript">
1491 jQuery(document).ready(function() {
1492 function change_percent()
1494 var element = jQuery("#opp_status option:selected");
1495 var defaultpercent = element.attr("defaultpercent");
1496 var defaultcloseproject = '.((int) $defaultcheckedwhenoppclose).
';
1497 var elemcode = element.attr("elemcode");
1498 var oldpercent = \''.
dol_escape_js($object->opp_percent).
'\';
1500 console.log(
"We select "+elemcode);
1503 var closeproject = 0;
1504 if (elemcode == \
'LOST\') closeproject = 1;
1505 if (elemcode == \'WON\') closeproject = defaultcloseproject;
1506 if (closeproject) jQuery("#inputcloseproject").prop("checked", true);
1507 else jQuery("#inputcloseproject").prop("checked", false);
1509 /* Make the close project checkbox visible or not */
1510 console.log("closeproject="+closeproject);
1511 if (elemcode == \'WON\' || elemcode == \'LOST\')
1513 jQuery("#divtocloseproject").show();
1517 jQuery("#divtocloseproject").hide();
1520 /* Change percent with default percent (defaultpercent) if new status (defaultpercent) is higher than current (jQuery("#opp_percent").val()) */
1521 if (oldpercent != \'\' && (parseFloat(defaultpercent) < parseFloat(oldpercent)))
1523 console.log("oldpercent="+oldpercent+" defaultpercent="+defaultpercent+" def < old");
1524 if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') {
1525 jQuery("#oldopppercent").text(\' - '.
dol_escape_js($langs->transnoentities(
"PreviousValue")).
': \'+price2numjs(oldpercent)+\' %\');
1528 if (parseFloat(oldpercent) != 100 && elemcode != \'LOST\') { jQuery("#opp_percent").val(oldpercent); }
1529 else { jQuery("#opp_percent").val(price2numjs(defaultpercent)); }
1531 console.log("oldpercent="+oldpercent+" defaultpercent="+defaultpercent);
1532 if (jQuery("#opp_percent").val() == \'\' || (parseFloat(jQuery("#opp_percent").val()) < parseFloat(defaultpercent))) {
1533 if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') {
1534 jQuery("#oldopppercent").text(\' - '.
dol_escape_js($langs->transnoentities(
"PreviousValue")).
': \'+price2numjs(oldpercent)+\' %\');
1536 jQuery("#opp_percent").val(price2numjs(defaultpercent));
1541 jQuery("#opp_status").change(function() {
1553 print
'<div class="tabsAction">';
1554 $parameters = array();
1555 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1557 if (empty($reshook)) {
1558 if ($action !=
"edit" && $action !=
'presend') {
1568 if (empty($user->socid)) {
1570 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend&token='.newToken().
'&id='.$object->id.
'&mode=init#formmailbeforetitle',
'');
1590 if ($userWrite > 0) {
1591 print
dolGetButtonAction(
'', $langs->trans(
'SetToDraft'),
'default', $_SERVER[
"PHP_SELF"].
'?action=confirm_setdraft&confirm=yes&token='.newToken().
'&id='.$object->id,
'');
1593 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'SetToDraft'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1600 if ($userWrite > 0) {
1601 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?action=edit&token='.newToken().
'&id='.$object->id,
'');
1603 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Modify'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1609 if ($userWrite > 0) {
1610 print
dolGetButtonAction(
'', $langs->trans(
'Validate'),
'default', $_SERVER[
"PHP_SELF"].
'?action=validate&token='.newToken().
'&id='.$object->id,
'');
1612 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1618 if ($userWrite > 0) {
1619 print
dolGetButtonAction(
'', $langs->trans(
'Close'),
'default', $_SERVER[
"PHP_SELF"].
'?action=close&token='.newToken().
'&id='.$object->id,
'');
1621 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Close'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1627 if ($userWrite > 0) {
1628 print
dolGetButtonAction(
'', $langs->trans(
'ReOpen'),
'default', $_SERVER[
"PHP_SELF"].
'?action=reopen&token='.newToken().
'&id='.$object->id,
'');
1630 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'ReOpen'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1637 $is_customer_or_prospect = (!empty($object->thirdparty->prospect) || !empty($object->thirdparty->client));
1638 $is_supplier_only= (!empty($object->thirdparty->fournisseur) && $is_customer_or_prospect ==
false);
1640 $arrayforbutaction = array(
1641 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),
1642 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),
1643 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),
1644 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 :
'')),
1645 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 :
'')),
1646 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 :
'')),
1647 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),
1648 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),
1649 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),
1650 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),
1653 $params = array(
'backtopage' => $_SERVER[
"PHP_SELF"].
'?id='.$object->id);
1655 print
dolGetButtonAction(
'', $langs->trans(
"Create"),
'default', $arrayforbutaction,
'', 1, $params);
1659 if ($user->hasRight(
'projet',
'creer')) {
1660 if ($userWrite > 0) {
1661 print
dolGetButtonAction(
'', $langs->trans(
'ToClone'),
'default', $_SERVER[
"PHP_SELF"].
'?action=clone&token='.newToken().
'&id='.$object->id,
'');
1663 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'ToClone'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1668 if ($user->hasRight(
'projet',
'supprimer') || ($object->statut ==
Project::STATUS_DRAFT && $user->hasRight(
'projet',
'creer'))) {
1669 if ($userDelete > 0 || ($object->statut ==
Project::STATUS_DRAFT && $user->hasRight(
'projet',
'creer'))) {
1670 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $_SERVER[
"PHP_SELF"].
'?action=delete&token='.newToken().
'&id='.$object->id,
'');
1672 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Delete'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1680 if (
GETPOST(
'modelselected')) {
1681 $action =
'presend';
1684 if ($action !=
'presend') {
1685 print
'<div class="fichecenter"><div class="fichehalfleft">';
1686 print
'<a name="builddoc"></a>';
1692 $children = $object->getChildren();
1694 print
'<table class="centpercent notopnoleftnoright table-fiche-title">';
1695 print
'<tr class="titre"><td class="nobordernopadding valignmiddle col-title">';
1696 print
'<div class="titre inline-block">'.$langs->trans(
'Sub-projects').
'</div>';
1697 print
'</td></tr></table>';
1699 print
'<div class="div-table-responsive-no-min">';
1700 print
'<table class="centpercent noborder'.($morecss ?
' '.$morecss :
'').
'">';
1701 print
'<tr class="liste_titre">';
1702 print
getTitleFieldOfList(
'Ref', 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'',
'',
'',
'', 1);
1703 print
getTitleFieldOfList(
'Title', 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'',
'',
'',
'', 1);
1704 print
getTitleFieldOfList(
'Status', 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'',
'',
'',
'', 1);
1708 $subproject =
new Project($db);
1709 foreach ($children as $child) {
1710 $subproject->fetch($child->rowid);
1711 print
'<tr class="oddeven">';
1712 print
'<td class="nowraponall">'.$subproject->getNomUrl(1,
'project').
'</td>';
1713 print
'<td class="nowraponall tdoverflowmax125">'.$child->title.
'</td>';
1714 print
'<td class="nowraponall">'.$subproject->getLibStatut(5).
'</td>';
1727 $filedir = $conf->project->multidir_output[$object->entity].
"/".
dol_sanitizeFileName($object->ref);
1728 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1729 $genallowed = ($user->hasRight(
'projet',
'lire') && $userAccess > 0);
1730 $delallowed = ($user->hasRight(
'projet',
'creer') && $userWrite > 0);
1732 print $formfile->showdocuments(
'project', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 0, 0,
'',
'',
'',
'',
'', $object);
1734 print
'</div><div class="fichehalfright">';
1738 $morehtmlcenter =
'<div class="nowraponall">';
1739 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/projet/messaging.php?id='.$object->id);
1740 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/projet/agenda.php?id='.$object->id);
1741 $morehtmlcenter .=
'</div>';
1744 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1746 $somethingshown =
$formactions->showactions($object,
'project', 0, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1748 print
'</div></div>';
1752 $modelmail =
'project';
1753 $defaulttopic =
'SendProjectRef';
1754 $defaulttopiclang =
'projects';
1755 $diroutput = $conf->project->multidir_output[$object->entity];
1756 $autocopy =
'MAIN_MAIL_AUTOCOPY_PROJECT_TO';
1757 $trackid =
'proj'.$object->id;
1759 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
1762 $parameters = array();
1763 $reshook = $hookmanager->executeHooks(
'mainCardTabAddMore', $parameters, $object, $action);
1765 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.
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.
GETPOSTINT($paramname, $method=0)
Return value of a param into GET or POST supervariable.
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 a 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.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
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...
publicphonebutton2 phonegreen basiclayout basiclayout TotalHT VATCode TotalVAT TotalLT1 TotalLT2 TotalTTC TotalHT clearboth nowraponall right right takeposterminal SELECT e e e e e statut
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.