26 require
'../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/modules/project/modules_project.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
38 $langs->loadLangs(array(
'projects',
'companies'));
42 $action =
GETPOST(
'action',
'aZ09');
43 $backtopage =
GETPOST(
'backtopage',
'alpha');
44 $cancel =
GETPOST(
'cancel',
'alpha');
45 $confirm =
GETPOST(
'confirm',
'aZ09');
46 $status =
GETPOST(
'status',
'int');
47 $opp_status =
GETPOST(
'opp_status',
'int');
50 if ($id ==
'' && $ref ==
'' && ($action !=
"create" && $action !=
"add" && $action !=
"update" && !$_POST[
"cancel"]))
accessforbidden();
52 $mine =
GETPOST(
'mode') ==
'mine' ? 1 : 0;
56 $hookmanager->initHooks(array(
'projectcard',
'globalcard'));
63 if ($id > 0 || !empty($ref))
65 $ret = $object->fetch($id, $ref);
67 $object->fetch_thirdparty();
68 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object,
'fetchComments') && empty($object->comments)) $object->fetchComments();
74 $socid =
GETPOST(
'socid',
'int');
76 $result =
restrictedArea($user,
'projet', $object->id,
'projet&project');
79 $extrafields->fetch_name_optionals_label($object->table_element);
89 $parameters = array(
'id'=>$socid,
'objcanvas'=>$objcanvas);
90 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
91 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
98 if (
GETPOST(
"comefromclone") == 1)
100 $result = $object->delete($user);
103 header(
"Location: index.php");
107 setEventMessages($langs->trans(
"CantRemoveProject", $langs->transnoentitiesnoconv(
"ProjectOverview")), null,
'errors');
112 header(
"Location: ".$backtopage);
119 if ($action ==
'add' && $user->rights->projet->creer)
124 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")), null,
'errors');
129 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"ProjectLabel")), null,
'errors');
136 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfAmount"), null,
'errors');
140 if (!empty($conf->global->PROJECT_CREATE_NO_DRAFT))
151 $object->ref =
GETPOST(
'ref',
'alphanohtml');
152 $object->title =
GETPOST(
'title',
'alphanohtml');
153 $object->socid =
GETPOST(
'socid',
'int');
154 $object->description =
GETPOST(
'description',
'restricthtml');
155 $object->public =
GETPOST(
'public',
'alphanohtml');
157 $object->budget_amount =
price2num(
GETPOST(
'budget_amount',
'alphanohtml'));
159 $object->date_start = $date_start;
160 $object->date_end = $date_end;
161 $object->statut = $status;
162 $object->opp_status = $opp_status;
163 $object->opp_percent = $opp_percent;
164 $object->usage_opportunity = (
GETPOST(
'usage_opportunity',
'alpha') ==
'on' ? 1 : 0);
165 $object->usage_task = (
GETPOST(
'usage_task',
'alpha') ==
'on' ? 1 : 0);
166 $object->usage_bill_time = (
GETPOST(
'usage_bill_time',
'alpha') ==
'on' ? 1 : 0);
167 $object->usage_organize_event = (
GETPOST(
'usage_organize_event',
'alpha') ==
'on' ? 1 : 0);
170 $ret = $extrafields->setOptionalsFromPost(null, $object);
171 if ($ret < 0) $error++;
173 $result = $object->create($user);
174 if (!$error && $result > 0)
177 $typeofcontact =
'PROJECTLEADER';
178 $result = $object->add_contact($user->id, $typeofcontact,
'internal');
181 $langs->load(
"errors");
186 $langs->load(
"errors");
190 if (!$error && !empty($object->id) > 0)
193 $categories =
GETPOST(
'categories',
'array');
194 $result = $object->setCategories($categories);
196 $langs->load(
"errors");
206 if (!empty($backtopage))
208 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--/', $object->id, $backtopage);
209 $backtopage = $backtopage.
'&projectid='.$object->id;
210 header(
"Location: ".$backtopage);
213 header(
"Location:card.php?id=".$object->id);
226 if ($action ==
'update' && !$_POST[
"cancel"] && $user->rights->projet->creer)
234 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")), null,
'errors');
236 if (empty($_POST[
"title"]))
240 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"ProjectLabel")), null,
'errors');
247 $object->oldcopy = clone $object;
249 $old_start_date = $object->date_start;
251 $object->ref =
GETPOST(
'ref',
'alpha');
252 $object->title =
GETPOST(
'title',
'alphanohtml');
253 $object->statut =
GETPOST(
'status',
'int');
254 $object->socid =
GETPOST(
'socid',
'int');
255 $object->description =
GETPOST(
'description',
'restricthtml');
256 $object->public =
GETPOST(
'public',
'alpha');
257 $object->date_start = (!
GETPOST(
'projectstart')) ?
'' : $date_start;
258 $object->date_end = (!
GETPOST(
'projectend')) ?
'' : $date_end;
261 if (
GETPOSTISSET(
'opp_status')) $object->opp_status = $opp_status;
262 if (
GETPOSTISSET(
'opp_percent')) $object->opp_percent = $opp_percent;
263 $object->usage_opportunity = (
GETPOST(
'usage_opportunity',
'alpha') ==
'on' ? 1 : 0);
264 $object->usage_task = (
GETPOST(
'usage_task',
'alpha') ==
'on' ? 1 : 0);
265 $object->usage_bill_time = (
GETPOST(
'usage_bill_time',
'alpha') ==
'on' ? 1 : 0);
266 $object->usage_organize_event = (
GETPOST(
'usage_organize_event',
'alpha') ==
'on' ? 1 : 0);
269 $ret = $extrafields->setOptionalsFromPost(null, $object);
270 if ($ret < 0) $error++;
273 if ($object->opp_amount && ($object->opp_status <= 0))
276 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfAmount"), null,
'errors');
281 $result = $object->update($user);
285 if ($result == -4)
setEventMessages($langs->trans(
"ErrorRefAlreadyExists"), null,
'errors');
289 $categories =
GETPOST(
'categories',
'array');
290 $result = $object->setCategories($categories);
301 if (
GETPOST(
"reportdate") && ($object->date_start != $old_start_date))
303 $result = $object->shiftTaskDate($old_start_date);
307 setEventMessages($langs->trans(
"ErrorShiftTaskDate").
':'.$object->error, $object->errors,
'errors');
315 $resclose = $object->setClose($user);
319 setEventMessages($langs->trans(
"FailedToCloseProject").
':'.$object->error, $object->errors,
'errors');
331 if (
GETPOST(
'socid',
'int') > 0) $object->fetch_thirdparty(
GETPOST(
'socid',
'int'));
332 else unset($object->thirdparty);
337 if ($action ==
'builddoc' && $user->rights->projet->creer)
340 if (
GETPOST(
'model')) $object->setDocModel($user,
GETPOST(
'model',
'alpha'));
342 $outputlangs = $langs;
343 if (
GETPOST(
'lang_id',
'aZ09'))
346 $outputlangs->setDefaultLang(
GETPOST(
'lang_id',
'aZ09'));
348 $result = $object->generateDocument($object->model_pdf, $outputlangs);
357 if ($action ==
'remove_file' && $user->rights->projet->creer)
361 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
363 $langs->load(
"other");
364 $upload_dir = $conf->projet->dir_output;
365 $file = $upload_dir.
'/'.
GETPOST(
'file');
375 if ($action ==
'confirm_validate' && $confirm ==
'yes')
377 $result = $object->setValid($user);
384 if ($action ==
'confirm_close' && $confirm ==
'yes')
386 $result = $object->setClose($user);
393 if ($action ==
'confirm_reopen' && $confirm ==
'yes')
395 $result = $object->setValid($user);
402 if ($action ==
'confirm_delete' &&
GETPOST(
"confirm") ==
"yes" && $user->rights->projet->supprimer)
405 $result = $object->delete($user);
409 header(
"Location: list.php?restore_lastsearch_values=1");
417 if ($action ==
'confirm_clone' && $user->rights->projet->creer && $confirm ==
'yes')
419 $clone_contacts =
GETPOST(
'clone_contacts') ? 1 : 0;
420 $clone_tasks =
GETPOST(
'clone_tasks') ? 1 : 0;
421 $clone_project_files =
GETPOST(
'clone_project_files') ? 1 : 0;
422 $clone_task_files =
GETPOST(
'clone_task_files') ? 1 : 0;
423 $clone_notes =
GETPOST(
'clone_notes') ? 1 : 0;
424 $move_date =
GETPOST(
'move_date') ? 1 : 0;
425 $clone_thirdparty =
GETPOST(
'socid',
'int') ?
GETPOST(
'socid',
'int') : 0;
427 $result = $object->createFromClone($user, $object->id, $clone_contacts, $clone_tasks, $clone_project_files, $clone_task_files, $clone_notes, $move_date, 0, $clone_thirdparty);
434 $newobject->fetch($result);
435 $newobject->fetch_optionals();
436 $newobject->fetch_thirdparty();
437 $object = $newobject;
439 $comefromclone =
true;
444 $triggersendname =
'PROJECT_SENTBYMAIL';
446 $autocopy =
'MAIN_MAIL_AUTOCOPY_PROJECT_TO';
447 $trackid =
'proj'.$object->id;
448 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
456 $form =
new Form($db);
459 $userstatic =
new User($db);
461 $title = $langs->trans(
"Project").
' - '.$object->ref.($object->thirdparty->name ?
' - '.$object->thirdparty->name :
'').($object->title ?
' - '.$object->title :
'');
462 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/projectnameonly/', $conf->global->MAIN_HTML_TITLE)) $title = $object->ref.($object->thirdparty->name ?
' - '.$object->thirdparty->name :
'').($object->title ?
' - '.$object->title :
'');
463 $help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
467 $titleboth = $langs->trans(
"LeadsOrProjects");
468 $titlenew = $langs->trans(
"NewLeadOrProject");
469 if ($conf->global->PROJECT_USE_OPPORTUNITIES == 0) {
470 $titleboth = $langs->trans(
"Projects");
471 $titlenew = $langs->trans(
"NewProject");
473 if ($conf->global->PROJECT_USE_OPPORTUNITIES == 2) {
474 $titleboth = $langs->trans(
"Leads");
475 $titlenew = $langs->trans(
"NewLead");
478 if ($action ==
'create' && $user->rights->projet->creer)
484 $thirdparty =
new Societe($db);
485 if ($socid > 0) $thirdparty->fetch($socid);
489 print '<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
490 print '<input type="hidden" name="token" value="'.newToken().
'">';
491 print '<input type="hidden" name="action" value="add">';
492 print '<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
496 print '<table class="border centpercent tableforfieldcreate">';
499 $modele = empty($conf->global->PROJECT_ADDON) ?
'mod_project_simple' : $conf->global->PROJECT_ADDON;
502 $file =
''; $classname =
''; $filefound = 0;
503 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
504 foreach ($dirmodels as $reldir)
506 $file =
dol_buildpath($reldir.
"core/modules/project/".$modele.
'.php', 0);
507 if (file_exists($file))
510 $classname = $modele;
518 $modProject =
new $classname;
520 $defaultref = $modProject->getNextValue($thirdparty, $object);
523 if (is_numeric($defaultref) && $defaultref <= 0) $defaultref =
'';
526 $suggestedref = ($_POST[
"ref"] ? $_POST[
"ref"] : $defaultref);
527 print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Ref").
'</span></td><td><input size="12" type="text" name="ref" value="'.
dol_escape_htmltag($suggestedref).
'">';
528 print ' '.$form->textwithpicto(
'', $langs->trans(
"YouCanCompleteRef", $suggestedref));
532 print '<tr><td><span class="fieldrequired">'.$langs->trans(
"ProjectLabel").
'</span></td><td><input class="minwidth500" type="text" name="title" value="'.
dol_escape_htmltag(
GETPOST(
"title",
'alphanohtml')).
'" autofocus></td></tr>';
535 print '<tr><td class="tdtop">';
536 print $langs->trans(
"Usage");
539 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
540 print '<input type="checkbox" id="usage_opportunity" name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') :
' checked="checked"').
'"> ';
541 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
542 print '<label for="usage_opportunity">'.$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext).
'</label>';
544 print '$( document ).ready(function() {
545 jQuery("#usage_opportunity").change(function() {
546 if (jQuery("#usage_opportunity").prop("checked")) {
547 console.log("Show opportunities fields");
548 jQuery(".classuseopportunity").show();
550 console.log("Hide opportunities fields "+jQuery("#usage_opportunity").prop("checked"));
551 jQuery(".classuseopportunity").hide();
558 if (empty($conf->global->PROJECT_HIDE_TASKS))
560 print '<input type="checkbox" id="usage_task" name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') :
' checked="checked"').
'"> ';
561 $htmltext = $langs->trans(
"ProjectFollowTasks");
562 print '<label for="usage_task">'.$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext).
'</label>';
565 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT))
567 print '<input type="checkbox" id="usage_bill_time" name="usage_bill_time"'.(GETPOST(
'usage_bill_time',
'alpha') !=
'' ?
' checked="checked"' :
'').
'"> ';
568 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
569 print '<label for="usage_bill_time">'.$form->textwithpicto($langs->trans(
"BillTime"), $htmltext).
'</label>';
580 if ($conf->societe->enabled)
583 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'<span class="fieldrequired">');
584 print $langs->trans(
"ThirdParty");
585 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'</span>');
586 print '</td><td class="maxwidthonsmartphone">';
588 if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
589 $text =
img_picto(
'',
'company').$form->select_company(
GETPOST(
'socid',
'int'),
'socid', $filteronlist,
'SelectThirdParty', 1, 0, array(), 0,
'minwidth300 widthcentpercentminusxx');
590 if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile))
592 $texthelp = $langs->trans(
"IfNeedToUseOtherObjectKeepEmpty");
593 print $form->textwithtooltip($text.
' '.
img_help(), $texthelp, 1);
595 if (!
GETPOSTISSET(
'backtopage'))
print ' <a href="'.DOL_URL_ROOT.
'/societe/card.php?action=create&backtopage='.urlencode(
$_SERVER[
"PHP_SELF"].
'?action=create').
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddThirdParty").
'"></span></a>';
602 print '<tr><td>'.$langs->trans(
"Status").
'</td><td>';
603 print '<input type="hidden" name="status" value="'.$status.
'">';
604 print $object->LibStatut($status, 4);
609 print '<tr><td>'.$langs->trans(
"Visibility").
'</td><td class="maxwidthonsmartphone">';
611 if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) $array[0] = $langs->trans(
"PrivateProject");
612 if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) $array[1] = $langs->trans(
"SharedProject");
613 print $form->selectarray(
'public', $array,
GETPOST(
'public') ?
GETPOST(
'public') : $object->public, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
617 print '<tr><td>'.$langs->trans(
"DateStart").
'</td><td>';
618 print $form->selectDate(($date_start ? $date_start :
''),
'projectstart', 0, 0, 0,
'', 1, 0);
622 print '<tr><td>'.$langs->trans(
"DateEnd").
'</td><td>';
623 print $form->selectDate(($date_end ? $date_end : -1),
'projectend', 0, 0, 0,
'', 1, 0);
626 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
629 print '<tr class="classuseopportunity"><td>'.$langs->trans(
"OpportunityStatus").
'</td>';
630 print '<td class="maxwidthonsmartphone">';
631 print $formproject->selectOpportunityStatus(
'opp_status',
GETPOST(
'opp_status') ?
GETPOST(
'opp_status') : $object->opp_status, 1, 0, 0, 0,
'', 0, 1);
635 print '<tr class="classuseopportunity"><td>'.$langs->trans(
"OpportunityProbability").
'</td>';
636 print '<td><input size="5" type="text" id="opp_percent" name="opp_percent" value="'.dol_escape_htmltag(
GETPOSTISSET(
'opp_percent') ?
GETPOST(
'opp_percent') :
'').
'"><span class="hideonsmartphone"> %</span>';
637 print '<input type="hidden" name="opp_percent_not_set" id="opp_percent_not_set" value="'.dol_escape_htmltag(
GETPOSTISSET(
'opp_percent') ?
'0' :
'1').
'">';
642 print '<tr class="classuseopportunity"><td>'.$langs->trans(
"OpportunityAmount").
'</td>';
643 print '<td><input size="5" type="text" name="opp_amount" value="'.dol_escape_htmltag(
GETPOSTISSET(
'opp_amount') ?
GETPOST(
'opp_amount') :
'').
'"></td>';
648 print '<tr><td>'.$langs->trans(
"Budget").
'</td>';
649 print '<td><input size="5" type="text" name="budget_amount" value="'.dol_escape_htmltag(
GETPOSTISSET(
'budget_amount') ?
GETPOST(
'budget_amount') :
'').
'"></td>';
653 print '<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
655 $doleditor =
new DolEditor(
'description',
GETPOST(
"description",
'restricthtml'),
'', 90,
'dolibarr_notes',
'',
false,
true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_3,
'90%');
656 $doleditor->Create();
659 if ($conf->categorie->enabled) {
661 print '<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
662 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT,
'',
'parent', 64, 0, 1);
663 $arrayselected =
GETPOST(
'categories',
'array');
664 print img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
669 $parameters = array();
670 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
671 print $hookmanager->resPrint;
674 print $object->showOptionals($extrafields,
'create');
681 print '<div class="center">';
682 print '<input type="submit" class="button" value="'.$langs->trans(
"CreateDraft").
'">';
683 if (!empty($backtopage))
685 print ' ';
686 print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
688 print ' ';
689 print '<input type="button" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'" onClick="javascript:history.go(-1)">';
696 print '<script type="text/javascript" language="javascript">
697 jQuery(document).ready(function() {
698 function change_percent()
700 var element = jQuery("#opp_status option:selected");
701 var defaultpercent = element.attr("defaultpercent");
702 /*if (jQuery("#opp_percent_not_set").val() == "") */
703 jQuery("#opp_percent").val(defaultpercent);
706 jQuery("#opp_status").change(function() {
710 jQuery("#usage_task").change(function() {
711 console.log("We click on usage task "+jQuery("#usage_task").is(":checked"));
712 if (! jQuery("#usage_task").is(":checked")) {
713 jQuery("#usage_bill_time").prop("checked", false);
717 jQuery("#usage_bill_time").change(function() {
718 console.log("We click on usage to bill time");
719 if (jQuery("#usage_bill_time").is(":checked")) {
720 jQuery("#usage_task").prop("checked", true);
725 } elseif ($object->id > 0)
731 $res = $object->fetch_optionals();
734 $userAccess = $object->restrictedProjectArea($user,
'read');
735 $userWrite = $object->restrictedProjectArea($user,
'write');
736 $userDelete = $object->restrictedProjectArea($user,
'delete');
741 if ($action ==
'validate')
743 print $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ValidateProject'), $langs->trans(
'ConfirmValidateProject'),
'confirm_validate',
'', 0, 1);
746 if ($action ==
'close')
748 print $form->formconfirm(
$_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"CloseAProject"), $langs->trans(
"ConfirmCloseAProject"),
"confirm_close",
'',
'', 1);
751 if ($action ==
'reopen')
753 print $form->formconfirm(
$_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"ReOpenAProject"), $langs->trans(
"ConfirmReOpenAProject"),
"confirm_reopen",
'',
'', 1);
756 if ($action ==
'delete')
758 $text = $langs->trans(
"ConfirmDeleteAProject");
759 $task =
new Task($db);
760 $taskarray = $task->getTasksArray(0, 0, $object->id, 0, 0);
761 $nboftask = count($taskarray);
762 if ($nboftask) $text .=
'<br>'.img_warning().
' '.$langs->trans(
"ThisWillAlsoRemoveTasks", $nboftask);
763 print $form->formconfirm(
$_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"DeleteAProject"), $text,
"confirm_delete",
'',
'', 1);
767 if ($action ==
'clone')
769 $formquestion = array(
770 'text' => $langs->trans(
"ConfirmClone"),
771 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')),
772 array(
'type' =>
'checkbox',
'name' =>
'clone_contacts',
'label' => $langs->trans(
"CloneContacts"),
'value' =>
true),
773 array(
'type' =>
'checkbox',
'name' =>
'clone_tasks',
'label' => $langs->trans(
"CloneTasks"),
'value' =>
true),
774 array(
'type' =>
'checkbox',
'name' =>
'move_date',
'label' => $langs->trans(
"CloneMoveDate"),
'value' =>
true),
775 array(
'type' =>
'checkbox',
'name' =>
'clone_notes',
'label' => $langs->trans(
"CloneNotes"),
'value' =>
true),
776 array(
'type' =>
'checkbox',
'name' =>
'clone_project_files',
'label' => $langs->trans(
"CloneProjectFiles"),
'value' =>
false),
777 array(
'type' =>
'checkbox',
'name' =>
'clone_task_files',
'label' => $langs->trans(
"CloneTaskFiles"),
'value' =>
false)
780 print $form->formconfirm(
$_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"ToClone"), $langs->trans(
"ConfirmCloneProject"),
"confirm_clone", $formquestion,
'', 1, 300, 590);
784 print '<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
785 print '<input type="hidden" name="token" value="'.newToken().
'">';
786 print '<input type="hidden" name="action" value="update">';
787 print '<input type="hidden" name="id" value="'.$object->id.
'">';
788 print '<input type="hidden" name="comefromclone" value="'.$comefromclone.
'">';
792 if ($action ==
'edit' && $userWrite > 0)
794 print dol_get_fiche_head($head,
'project', $langs->trans(
"Project"), 0, ($object->public ?
'projectpub' :
'project'));
796 print '<table class="border centpercent">';
799 $suggestedref = $object->ref;
800 print '<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Ref").
'</td>';
801 print '<td><input size="12" name="ref" value="'.$suggestedref.
'">';
802 print ' '.$form->textwithpicto(
'', $langs->trans(
"YouCanCompleteRef", $suggestedref));
806 print '<tr><td class="fieldrequired">'.$langs->trans(
"ProjectLabel").
'</td>';
807 print '<td><input class="quatrevingtpercent" name="title" value="'.dol_escape_htmltag($object->title).
'"></td></tr>';
810 print '<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td><td>';
811 print '<select class="flat" name="status">';
812 foreach ($object->statuts_short as $key => $val)
814 print '<option value="'.$key.
'"'.((
GETPOSTISSET(
'status') ?
GETPOST(
'status') : $object->
statut) == $key ?
' selected="selected"' :
'').
'>'.$langs->trans($val).
'</option>';
820 print '<tr><td class="tdtop">';
821 print $langs->trans(
"Usage");
824 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
826 print '<input type="checkbox" id="usage_opportunity" name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
827 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
828 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
830 print '$( document ).ready(function() {
831 jQuery("#usage_opportunity").change(function() {
832 if (jQuery("#usage_opportunity").prop("checked")) {
833 console.log("Show opportunities fields");
834 jQuery(".classuseopportunity").show();
836 console.log("Hide opportunities fields "+jQuery("#usage_opportunity").prop("checked"));
837 jQuery(".classuseopportunity").hide();
844 if (empty($conf->global->PROJECT_HIDE_TASKS))
846 print '<input type="checkbox" name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')).
'"> ';
847 $htmltext = $langs->trans(
"ProjectFollowTasks");
848 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
851 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT))
853 print '<input type="checkbox" name="usage_bill_time"'.(GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_bill_time ?
' checked="checked"' :
'')).
'"> ';
854 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
855 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
861 if ($conf->societe->enabled)
864 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'<span class="fieldrequired">');
865 print $langs->trans(
"ThirdParty");
866 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'</span>');
869 if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
870 $text = $form->select_company($object->thirdparty->id,
'socid', $filteronlist,
'None', 1, 0, array(), 0,
'minwidth300');
871 if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile))
873 $texthelp = $langs->trans(
"IfNeedToUseOtherObjectKeepEmpty");
874 print $form->textwithtooltip($text.
' '.
img_help(), $texthelp, 1, 0,
'',
'', 2);
880 print '<tr><td>'.$langs->trans(
"Visibility").
'</td><td>';
882 if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) $array[0] = $langs->trans(
"PrivateProject");
883 if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) $array[1] = $langs->trans(
"SharedProject");
884 print $form->selectarray(
'public', $array, $object->public, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
887 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
889 $classfortr = ($object->usage_opportunity ?
'' :
' hideobject');
891 print '<tr class="classuseopportunity'.$classfortr.
'"><td>'.$langs->trans(
"OpportunityStatus").
'</td>';
893 print $formproject->selectOpportunityStatus(
'opp_status', $object->opp_status, 1, 0, 0, 0,
'inline-block valignmiddle', 0, 1);
894 print '<div id="divtocloseproject" class="inline-block valign" style="display: none;"> ';
895 print '<input type="checkbox" id="inputcloseproject" name="closeproject" /> ';
896 print $langs->trans(
"AlsoCloseAProject");
902 print '<tr class="classuseopportunity'.$classfortr.
'"><td>'.$langs->trans(
"OpportunityProbability").
'</td>';
903 print '<td><input size="5" type="text" id="opp_percent" name="opp_percent" value="'.(GETPOSTISSET(
'opp_percent') ?
GETPOST(
'opp_percent') : (strcmp($object->opp_percent,
'') ?
vatrate($object->opp_percent) :
'')).
'"> %';
904 print '<span id="oldopppercent"></span>';
909 print '<tr class="classuseopportunity'.$classfortr.
'"><td>'.$langs->trans(
"OpportunityAmount").
'</td>';
910 print '<td><input size="5" type="text" name="opp_amount" value="'.(GETPOSTISSET(
'opp_amount') ?
GETPOST(
'opp_amount') : (strcmp($object->opp_amount,
'') ?
price2num($object->opp_amount) :
'')).
'"></td>';
915 print '<tr><td>'.$langs->trans(
"DateStart").
'</td><td>';
916 print $form->selectDate($object->date_start ? $object->date_start : -1,
'projectstart', 0, 0, 0,
'', 1, 0);
917 print ' <input type="checkbox" class="valignmiddle" name="reportdate" value="yes" ';
918 if ($comefromclone) {
print ' checked '; }
919 print '/> '.$langs->trans(
"ProjectReportDate");
923 print '<tr><td>'.$langs->trans(
"DateEnd").
'</td><td>';
924 print $form->selectDate($object->date_end ? $object->date_end : -1,
'projectend', 0, 0, 0,
'', 1, 0);
928 print '<tr><td>'.$langs->trans(
"Budget").
'</td>';
929 print '<td><input size="5" type="text" name="budget_amount" value="'.(GETPOSTISSET(
'budget_amount') ?
GETPOST(
'budget_amount') : (strcmp($object->budget_amount,
'') ?
price2num($object->budget_amount) :
'')).
'"></td>';
933 print '<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
935 $doleditor =
new DolEditor(
'description', $object->description,
'', 90,
'dolibarr_notes',
'',
false,
true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_3,
'90%');
936 $doleditor->Create();
940 if ($conf->categorie->enabled)
942 print '<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
943 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT,
'',
'parent', 64, 0, 1);
945 $cats = $c->containing($object->id, Categorie::TYPE_PROJECT);
946 foreach ($cats as $cat) {
947 $arrayselected[] = $cat->id;
949 print img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0,
'0');
954 $parameters = array();
955 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
956 print $hookmanager->resPrint;
959 print $object->showOptionals($extrafields,
'edit');
964 print dol_get_fiche_head($head,
'project', $langs->trans(
"Project"), -1, ($object->public ?
'projectpub' :
'project'));
968 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
970 $morehtmlref =
'<div class="refidno">';
974 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : ';
975 if ($object->thirdparty->id > 0)
977 $morehtmlref .= $object->thirdparty->getNomUrl(1,
'project');
979 $morehtmlref .=
'</div>';
982 if (!$user->rights->projet->all->lire)
984 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
985 $object->next_prev_filter =
" rowid in (".(count($objectsListId) ?join(
',', array_keys($objectsListId)) :
'0').
")";
988 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
991 print '<div class="fichecenter">';
992 print '<div class="fichehalfleft">';
993 print '<div class="underbanner clearboth"></div>';
995 print '<table class="border tableforfield" width="100%">';
998 print '<tr><td class="tdtop">';
999 print $langs->trans(
"Usage");
1002 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
1004 print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
1005 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
1006 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
1009 if (empty($conf->global->PROJECT_HIDE_TASKS))
1011 print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')).
'"> ';
1012 $htmltext = $langs->trans(
"ProjectFollowTasks");
1013 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
1016 if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
1018 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"' :
'')).
'"> ';
1019 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
1020 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
1026 print '<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
1027 if ($object->public)
print $langs->trans(
'SharedProject');
1028 else print $langs->trans(
'PrivateProject');
1031 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && !empty($object->usage_opportunity))
1034 print '<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
1035 $code =
dol_getIdFromCode($db, $object->opp_status,
'c_lead_status',
'rowid',
'code');
1036 if ($code)
print $langs->trans(
"OppStatus".$code);
1040 print '<tr><td>'.$langs->trans(
"OpportunityProbability").
'</td><td>';
1041 if (strcmp($object->opp_percent,
''))
print price($object->opp_percent, 0, $langs, 1, 0).
' %';
1045 print '<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
1050 if (strcmp($object->opp_amount,
''))
print price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency);
1054 print '<tr><td>'.$langs->trans(
'OpportunityWeightedAmount').
'</td><td>';
1055 if (strcmp($object->opp_amount,
'') && strcmp($object->opp_percent,
''))
print price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency);
1060 print '<tr><td>'.$langs->trans(
"DateStart").
' - '.$langs->trans(
"DateEnd").
'</td><td>';
1062 print ($start ? $start :
'?');
1065 print ($end ? $end :
'?');
1070 print '<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
1071 if (strcmp($object->budget_amount,
''))
print price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
1076 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1081 print '<div class="fichehalfright">';
1082 print '<div class="ficheaddleft">';
1083 print '<div class="underbanner clearboth"></div>';
1085 print '<table class="border tableforfield" width="100%">';
1088 print '<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
1093 if ($conf->categorie->enabled) {
1094 print '<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
1095 print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
1105 print '<div class="clearboth"></div>';
1110 if ($action ==
'edit' && $userWrite > 0)
1112 print '<div class="center">';
1113 print '<input name="update" class="button" type="submit" value="'.$langs->trans(
"Modify").
'"> ';
1114 print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1121 if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PROJECT_USE_OPPORTUNITIES))
1124 $defaultcheckedwhenoppclose = 1;
1125 if (empty($conf->global->PROJECT_HIDE_TASKS)) $defaultcheckedwhenoppclose = 0;
1127 print '<!-- Javascript to manage opportunity status change -->';
1128 print '<script type="text/javascript" language="javascript">
1129 jQuery(document).ready(function() {
1130 function change_percent()
1132 var element = jQuery("#opp_status option:selected");
1133 var defaultpercent = element.attr("defaultpercent");
1134 var defaultcloseproject = '.$defaultcheckedwhenoppclose.
';
1135 var elemcode = element.attr("elemcode");
1136 var oldpercent = \''.
dol_escape_js($object->opp_percent).
'\';
1138 console.log(
"We select "+elemcode);
1141 var closeproject = 0;
1142 if (elemcode == \
'LOST\') closeproject = 1;
1143 if (elemcode == \'WON\') closeproject = defaultcloseproject;
1144 if (closeproject) jQuery("#inputcloseproject").prop("checked", true);
1145 else jQuery("#inputcloseproject").prop("checked", false);
1147 /* Make the close project checkbox visible or not */
1148 console.log("closeproject="+closeproject);
1149 if (elemcode == \'WON\' || elemcode == \'LOST\')
1151 jQuery("#divtocloseproject").show();
1155 jQuery("#divtocloseproject").hide();
1158 /* Change percent with default percent (defaultpercent) if new status (defaultpercent) is higher than current (jQuery("#opp_percent").val()) */
1159 console.log("oldpercent="+oldpercent);
1160 if (oldpercent != \'\' && (parseFloat(defaultpercent) < parseFloat(oldpercent)))
1162 if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') jQuery("#oldopppercent").text(\' - '.
dol_escape_js($langs->transnoentities(
"PreviousValue")).
': \'+oldpercent+\' %\');
1163 if (parseFloat(oldpercent) != 100) { jQuery("#opp_percent").val(oldpercent); }
1164 else { jQuery("#opp_percent").val(defaultpercent); }
1168 if ((parseFloat(jQuery("#opp_percent").val()) < parseFloat(defaultpercent)));
1170 if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') jQuery("#oldopppercent").text(\' - '.
dol_escape_js($langs->transnoentities(
"PreviousValue")).
': \'+oldpercent+\' %\');
1171 jQuery("#opp_percent").val(defaultpercent);
1176 jQuery("#opp_status").change(function() {
1186 print '<div class="tabsAction">';
1187 $parameters = array();
1188 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1190 if (empty($reshook))
1192 if ($action !=
"edit" && $action !=
'presend')
1203 if (empty($user->socid)) {
1204 if ($object->statut != 2)
1206 print '<a class="butAction" href="card.php?id='.$object->id.
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendMail').
'</a>';
1211 if ($object->statut != 2 && $user->rights->projet->creer)
1215 print '<a class="butAction" href="card.php?id='.$object->id.
'&action=edit">'.$langs->trans(
"Modify").
'</a>';
1217 print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotOwnerOfProject").
'">'.$langs->trans(
'Modify').
'</a>';
1222 if ($object->statut == 0 && $user->rights->projet->creer)
1226 print '<a class="butAction" href="card.php?id='.$object->id.
'&action=validate">'.$langs->trans(
"Validate").
'</a>';
1228 print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotOwnerOfProject").
'">'.$langs->trans(
'Validate').
'</a>';
1233 if ($object->statut == 1 && $user->rights->projet->creer)
1237 print '<a class="butAction" href="card.php?id='.$object->id.
'&action=close">'.$langs->trans(
"Close").
'</a>';
1239 print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotOwnerOfProject").
'">'.$langs->trans(
'Close').
'</a>';
1244 if ($object->statut == 2 && $user->rights->projet->creer)
1248 print '<a class="butAction" href="card.php?id='.$object->id.
'&action=reopen">'.$langs->trans(
"ReOpen").
'</a>';
1250 print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotOwnerOfProject").
'">'.$langs->trans(
'ReOpen').
'</a>';
1255 if (!empty($conf->global->PROJECT_SHOW_CREATE_OBJECT_BUTTON))
1257 if (!empty($conf->propal->enabled) && $user->rights->propal->creer)
1259 $langs->load(
"propal");
1260 print '<a class="butAction" href="'.DOL_URL_ROOT.
'/comm/propal/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid.
'">'.$langs->trans(
"AddProp").
'</a>';
1262 if (!empty($conf->commande->enabled) && $user->rights->commande->creer)
1264 $langs->load(
"orders");
1265 print '<a class="butAction" href="'.DOL_URL_ROOT.
'/commande/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid.
'">'.$langs->trans(
"CreateOrder").
'</a>';
1267 if (!empty($conf->facture->enabled) && $user->rights->facture->creer)
1269 $langs->load(
"bills");
1270 print '<a class="butAction" href="'.DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid.
'">'.$langs->trans(
"CreateBill").
'</a>';
1272 if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->creer)
1274 $langs->load(
"supplier_proposal");
1275 print '<a class="butAction" href="'.DOL_URL_ROOT.
'/supplier_proposal/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid.
'">'.$langs->trans(
"AddSupplierProposal").
'</a>';
1277 if (!empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->creer)
1279 $langs->load(
"suppliers");
1280 print '<a class="butAction" href="'.DOL_URL_ROOT.
'/fourn/commande/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid.
'">'.$langs->trans(
"AddSupplierOrder").
'</a>';
1282 if (!empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->creer)
1284 $langs->load(
"suppliers");
1285 print '<a class="butAction" href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid.
'">'.$langs->trans(
"AddSupplierInvoice").
'</a>';
1287 if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer)
1289 $langs->load(
"interventions");
1290 print '<a class="butAction" href="'.DOL_URL_ROOT.
'/fichinter/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid.
'">'.$langs->trans(
"AddIntervention").
'</a>';
1292 if (!empty($conf->contrat->enabled) && $user->rights->contrat->creer)
1294 $langs->load(
"contracts");
1295 print '<a class="butAction" href="'.DOL_URL_ROOT.
'/contrat/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid.
'">'.$langs->trans(
"AddContract").
'</a>';
1297 if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->creer)
1299 $langs->load(
"trips");
1300 print '<a class="butAction" href="'.DOL_URL_ROOT.
'/expensereport/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid.
'">'.$langs->trans(
"AddTrip").
'</a>';
1302 if (!empty($conf->don->enabled) && $user->rights->don->creer)
1304 $langs->load(
"donations");
1305 print '<a class="butAction" href="'.DOL_URL_ROOT.
'/don/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid.
'">'.$langs->trans(
"AddDonation").
'</a>';
1310 if ($user->rights->projet->creer)
1314 print '<a class="butAction" href="card.php?id='.$object->id.
'&action=clone">'.$langs->trans(
'ToClone').
'</a>';
1316 print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotOwnerOfProject").
'">'.$langs->trans(
'ToClone').
'</a>';
1321 if ($user->rights->projet->supprimer || ($object->statut == 0 && $user->rights->projet->creer))
1323 if ($userDelete > 0 || ($object->statut == 0 && $user->rights->projet->creer))
1325 print '<a class="butActionDelete" href="card.php?id='.$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
'</a>';
1327 print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotOwnerOfProject").
'">'.$langs->trans(
'Delete').
'</a>';
1335 if (
GETPOST(
'modelselected')) {
1336 $action =
'presend';
1339 if ($action !=
'presend')
1341 print '<div class="fichecenter"><div class="fichehalfleft">';
1342 print '<a name="builddoc"></a>';
1349 $urlsource =
$_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1350 $genallowed = ($user->rights->projet->lire && $userAccess > 0);
1351 $delallowed = ($user->rights->projet->creer && $userWrite > 0);
1353 print $formfile->showdocuments(
'project', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf);
1355 print '</div><div class="fichehalfright"><div class="ficheaddleft">';
1359 $morehtmlright =
'<a href="'.DOL_URL_ROOT.
'/projet/info.php?id='.$object->id.
'">';
1360 $morehtmlright .= $langs->trans(
"SeeAll");
1361 $morehtmlright .=
'</a>';
1364 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1366 $somethingshown =
$formactions->showactions($object,
'project', 0, 1,
'', $MAXEVENT,
'', $morehtmlright);
1368 print '</div></div></div>';
1372 $modelmail =
'project';
1373 $defaulttopic =
'SendProjectRef';
1374 $diroutput = $conf->projet->dir_output;
1375 $autocopy =
'MAIN_MAIL_AUTOCOPY_PROJECT_TO';
1376 $trackid =
'proj'.$object->id;
1378 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
1381 $parameters = array();
1382 $reshook = $hookmanager->executeHooks(
'mainCardTabAddMore', $parameters, $object, $action);
1384 print $langs->trans(
"RecordNotFound");
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
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...
if(!empty($arrayfields['u.datec']['checked'])) print_liste_field_titre("DateCreationShort"u if(!empty($arrayfields['u.tms']['checked'])) print_liste_field_titre("DateModificationShort"u if(!empty($arrayfields['u.statut']['checked'])) print_liste_field_titre("Status"u statut
img_help($usehelpcursor=1, $usealttitle=1)
Show help logo with cursor "?".
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
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...
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
const STATUS_VALIDATED
Open/Validated status.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
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...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage categories.
Class to manage projects.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
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_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1)
Remove a file or several files with a mask.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=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 Calling this function terminate execution ...
Class to manage translations.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages...
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_getIdFromCode($db, $key, $tablename, $fieldkey= 'code', $fieldid= 'id', $entityfilter=0)
Return an id or code from a code or id.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
project_prepare_head(Project $project)
Prepare array with list of tabs.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage a WYSIWYG editor.
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.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...