27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/modules/project/modules_project.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
39 $langsLoad=array(
'projects',
'companies');
41 $langsLoad[]=
'eventorganization';
44 $langs->loadLangs($langsLoad);
48 $action =
GETPOST(
'action',
'aZ09');
49 $backtopage =
GETPOST(
'backtopage',
'alpha');
50 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
51 $backtopagejsfields =
GETPOST(
'backtopagejsfields',
'alpha');
52 $cancel =
GETPOST(
'cancel',
'alpha');
53 $confirm =
GETPOST(
'confirm',
'aZ09');
56 if (!empty($backtopagejsfields)) {
57 $tmpbacktopagejsfields = explode(
':', $backtopagejsfields);
58 $dol_openinpopup = $tmpbacktopagejsfields[0];
61 $status =
GETPOST(
'status',
'int');
62 $opp_status =
GETPOST(
'opp_status',
'int');
64 $objcanvas =
GETPOST(
"objcanvas",
"alphanohtml");
65 $comefromclone =
GETPOST(
"comefromclone",
"alphanohtml");
68 $date_start_event =
dol_mktime(
GETPOST(
'date_start_eventhour',
'int'),
GETPOST(
'date_start_eventmin',
'int'),
GETPOST(
'date_start_eventsec',
'int'),
GETPOST(
'date_start_eventmonth',
'int'),
GETPOST(
'date_start_eventday',
'int'),
GETPOST(
'date_start_eventyear',
'int'));
69 $date_end_event =
dol_mktime(
GETPOST(
'date_end_eventhour',
'int'),
GETPOST(
'date_end_eventmin',
'int'),
GETPOST(
'date_end_eventsec',
'int'),
GETPOST(
'date_end_eventmonth',
'int'),
GETPOST(
'date_end_eventday',
'int'),
GETPOST(
'date_end_eventyear',
'int'));
70 $location =
GETPOST(
'location',
'alphanohtml');
73 $mine =
GETPOST(
'mode') ==
'mine' ? 1 : 0;
77 $hookmanager->initHooks(array(
'projectcard',
'globalcard'));
84 if ($id > 0 || !empty($ref)) {
85 $ret = $object->fetch($id, $ref);
87 $object->fetch_thirdparty();
88 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object,
'fetchComments') && empty($object->comments)) {
89 $object->fetchComments();
96 $extrafields->fetch_name_optionals_label($object->table_element);
99 $socid =
GETPOST(
'socid',
'int');
103 if ($id ==
'' && $ref ==
'' && ($action !=
"create" && $action !=
"add" && $action !=
"update" && !
GETPOST(
"cancel"))) {
107 $permissiontoadd = $user->hasRight(
'projet',
'creer');
108 $permissiontodelete = $user->hasRight(
'projet',
'supprimer');
109 $permissiondellink = $user->hasRight(
'projet',
'creer');
116 $parameters = array(
'id'=>$socid,
'objcanvas'=>$objcanvas);
117 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
122 if (empty($reshook)) {
123 $backurlforlist = DOL_URL_ROOT.
'/projet/list.php';
127 if (
GETPOST(
"comefromclone") == 1) {
128 $result = $object->delete($user);
130 header(
"Location: index.php");
134 setEventMessages($langs->trans(
"CantRemoveProject", $langs->transnoentitiesnoconv(
"ProjectOverview")),
null,
'errors');
139 if (empty($backtopage) || ($cancel && empty($id))) {
140 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
141 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
142 $backtopage = $backurlforlist;
144 $backtopage = DOL_URL_ROOT.
'/projet/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
150 if (!empty($backtopageforcancel)) {
151 header(
"Location: ".$backtopageforcancel);
153 } elseif (!empty($backtopage)) {
154 header(
"Location: ".$backtopage);
160 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
163 if ($action ==
'confirm_setdraft' && $confirm ==
'yes' && $permissiontoadd) {
164 $result = $object->setStatut($object::STATUS_DRAFT,
null,
'',
'PROJECT_MODIFY');
175 if ($action ==
'add' && $permissiontoadd) {
178 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")),
null,
'errors');
182 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"ProjectLabel")),
null,
'errors');
186 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
187 if (
GETPOST(
'usage_opportunity') !=
'' && !(
GETPOST(
'opp_status') > 0)) {
189 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfUsage"),
null,
'errors');
191 if (
GETPOST(
'opp_amount') !=
'' && !(
GETPOST(
'opp_status') > 0)) {
193 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfAmount"),
null,
'errors');
198 if (!empty($conf->global->PROJECT_CREATE_NO_DRAFT) && !$error) {
207 $object->ref =
GETPOST(
'ref',
'alphanohtml');
208 $object->title =
GETPOST(
'title',
'alphanohtml');
209 $object->socid =
GETPOST(
'socid',
'int');
210 $object->description =
GETPOST(
'description',
'restricthtml');
211 $object->public =
GETPOST(
'public',
'alphanohtml');
213 $object->budget_amount =
price2num(
GETPOST(
'budget_amount',
'alphanohtml'));
215 $object->date_start = $date_start;
216 $object->date_end = $date_end;
217 $object->date_start_event = $date_start_event;
218 $object->date_end_event = $date_end_event;
219 $object->location = $location;
220 $object->statut = $status;
221 $object->opp_status = $opp_status;
222 $object->opp_percent = $opp_percent;
223 $object->usage_opportunity = (
GETPOST(
'usage_opportunity',
'alpha') ==
'on' ? 1 : 0);
224 $object->usage_task = (
GETPOST(
'usage_task',
'alpha') ==
'on' ? 1 : 0);
225 $object->usage_bill_time = (
GETPOST(
'usage_bill_time',
'alpha') ==
'on' ? 1 : 0);
226 $object->usage_organize_event = (
GETPOST(
'usage_organize_event',
'alpha') ==
'on' ? 1 : 0);
229 $ret = $extrafields->setOptionalsFromPost(
null, $object);
234 $result = $object->create($user);
235 if (!$error && $result > 0) {
237 $typeofcontact =
'PROJECTLEADER';
238 $result = $object->add_contact($user->id, $typeofcontact,
'internal');
244 } elseif ($result < 0) {
245 $langs->load(
"errors");
250 $langs->load(
"errors");
254 if (!$error && !empty($object->id) > 0) {
256 $categories =
GETPOST(
'categories',
'array');
257 $result = $object->setCategories($categories);
259 $langs->load(
"errors");
268 if (!empty($backtopage)) {
269 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--|__ID__/', $object->id, $backtopage);
270 $backtopage = $backtopage.
'&projectid='.$object->id;
271 header(
"Location: ".$backtopage);
274 header(
"Location:card.php?id=".$object->id);
279 unset($_POST[
"ref"]);
287 if ($action ==
'update' && empty(
GETPOST(
'cancel')) && $permissiontoadd) {
292 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")),
null,
'errors');
296 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"ProjectLabel")),
null,
'errors');
302 $object->oldcopy = clone $object;
304 $old_start_date = $object->date_start;
306 $object->ref =
GETPOST(
'ref',
'alpha');
307 $object->title =
GETPOST(
'title',
'alphanohtml');
308 $object->statut =
GETPOST(
'status',
'int');
309 $object->socid =
GETPOST(
'socid',
'int');
310 $object->description =
GETPOST(
'description',
'restricthtml');
311 $object->public =
GETPOST(
'public',
'alpha');
312 $object->date_start = (!
GETPOST(
'projectstart')) ?
'' : $date_start;
313 $object->date_end = (!
GETPOST(
'projectend')) ?
'' : $date_end;
314 $object->date_start_event = (!
GETPOST(
'date_start_event')) ?
'' : $date_start_event;
315 $object->date_end_event = (!
GETPOST(
'date_end_event')) ?
'' : $date_end_event;
316 $object->location = $location;
324 $object->opp_status = $opp_status;
327 $object->opp_percent = $opp_percent;
329 $object->usage_opportunity = (
GETPOST(
'usage_opportunity',
'alpha') ==
'on' ? 1 : 0);
330 $object->usage_task = (
GETPOST(
'usage_task',
'alpha') ==
'on' ? 1 : 0);
331 $object->usage_bill_time = (
GETPOST(
'usage_bill_time',
'alpha') ==
'on' ? 1 : 0);
332 $object->usage_organize_event = (
GETPOST(
'usage_organize_event',
'alpha') ==
'on' ? 1 : 0);
335 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
341 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
342 if ($object->opp_amount && ($object->opp_status <= 0)) {
344 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfAmount"),
null,
'errors');
349 $result = $object->update($user);
359 $categories =
GETPOST(
'categories',
'array');
360 $result = $object->setCategories($categories);
369 if (
GETPOST(
"reportdate") && ($object->date_start != $old_start_date)) {
370 $result = $object->shiftTaskDate($old_start_date);
373 setEventMessages($langs->trans(
"ErrorShiftTaskDate").
':'.$object->error, $object->errors,
'errors');
380 $resclose = $object->setClose($user);
383 setEventMessages($langs->trans(
"FailedToCloseProject").
':'.$object->error, $object->errors,
'errors');
394 if (
GETPOST(
'socid',
'int') > 0) {
395 $object->fetch_thirdparty(
GETPOST(
'socid',
'int'));
397 unset($object->thirdparty);
403 if ($action ==
'builddoc' && $permissiontoadd) {
406 $object->setDocModel($user,
GETPOST(
'model',
'alpha'));
409 $outputlangs = $langs;
410 if (
GETPOST(
'lang_id',
'aZ09')) {
412 $outputlangs->setDefaultLang(
GETPOST(
'lang_id',
'aZ09'));
414 $result = $object->generateDocument($object->model_pdf, $outputlangs);
422 if ($action ==
'remove_file' && $permissiontoadd) {
423 if ($object->id > 0) {
424 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
426 $langs->load(
"other");
427 $upload_dir = $conf->project->multidir_output[$object->entity];
428 $file = $upload_dir.
'/'.
GETPOST(
'file');
440 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $permissiontoadd) {
441 $result = $object->setValid($user);
447 if ($action ==
'confirm_close' && $confirm ==
'yes' && $permissiontoadd) {
448 $result = $object->setClose($user);
454 if ($action ==
'confirm_reopen' && $confirm ==
'yes' && $permissiontoadd) {
455 $result = $object->setValid($user);
461 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
463 $result = $object->delete($user);
466 header(
"Location: list.php?restore_lastsearch_values=1");
474 if ($action ==
'confirm_clone' && $permissiontoadd && $confirm ==
'yes') {
475 $clone_contacts =
GETPOST(
'clone_contacts') ? 1 : 0;
476 $clone_tasks =
GETPOST(
'clone_tasks') ? 1 : 0;
477 $clone_project_files =
GETPOST(
'clone_project_files') ? 1 : 0;
478 $clone_task_files =
GETPOST(
'clone_task_files') ? 1 : 0;
479 $clone_notes =
GETPOST(
'clone_notes') ? 1 : 0;
480 $move_date =
GETPOST(
'move_date') ? 1 : 0;
481 $clone_thirdparty =
GETPOST(
'socid',
'int') ?
GETPOST(
'socid',
'int') : 0;
483 $result = $object->createFromClone($user, $object->id, $clone_contacts, $clone_tasks, $clone_project_files, $clone_task_files, $clone_notes, $move_date, 0, $clone_thirdparty);
489 $newobject->fetch($result);
490 $newobject->fetch_optionals();
491 $newobject->fetch_thirdparty();
492 $object = $newobject;
494 $comefromclone =
true;
499 $triggersendname =
'PROJECT_SENTBYMAIL';
501 $autocopy =
'MAIN_MAIL_AUTOCOPY_PROJECT_TO';
502 $trackid =
'proj'.$object->id;
503 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
514 $userstatic =
new User($db);
516 $title = $langs->trans(
"Project").
' - '.$object->ref.(!empty($object->thirdparty->name) ?
' - '.$object->thirdparty->name :
'').(!empty($object->title) ?
' - '.$object->title :
'');
517 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/projectnameonly/', $conf->global->MAIN_HTML_TITLE)) {
518 $title = $object->ref.(!empty($object->thirdparty->name) ?
' - '.$object->thirdparty->name :
'').(!empty($object->title) ?
' - '.$object->title :
'');
521 $help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:Modul_Projekte";
525 $titleboth = $langs->trans(
"LeadsOrProjects");
526 $titlenew = $langs->trans(
"NewLeadOrProject");
528 $titleboth = $langs->trans(
"Projects");
529 $titlenew = $langs->trans(
"NewProject");
532 $titleboth = $langs->trans(
"Leads");
533 $titlenew = $langs->trans(
"NewLead");
536 if ($action ==
'create' && $user->rights->projet->creer) {
541 $thirdparty =
new Societe($db);
543 $thirdparty->fetch($socid);
548 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
549 print
'<input type="hidden" name="action" value="add">';
550 print
'<input type="hidden" name="token" value="'.newToken().
'">';
551 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
552 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
553 print
'<input type="hidden" name="backtopagejsfields" value="'.$backtopagejsfields.
'">';
554 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
558 print
'<table class="border centpercent tableforfieldcreate">';
561 $modele = empty($conf->global->PROJECT_ADDON) ?
'mod_project_simple' : $conf->global->PROJECT_ADDON;
564 $file =
''; $classname =
''; $filefound = 0;
565 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
566 foreach ($dirmodels as $reldir) {
567 $file =
dol_buildpath($reldir.
"core/modules/project/".$modele.
'.php', 0);
568 if (file_exists($file)) {
570 $classname = $modele;
577 $modProject =
new $classname;
579 $defaultref = $modProject->getNextValue($thirdparty, $object);
582 if (is_numeric($defaultref) && $defaultref <= 0) {
588 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).
'">';
590 print
' '.$form->textwithpicto(
'', $langs->trans(
"YouCanCompleteRef", $suggestedref));
595 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>';
598 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) ||
isModEnabled(
'eventorganization')) {
599 print
'<tr><td class="tdtop">';
600 print $langs->trans(
"Usage");
603 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
604 print
'<input type="checkbox" id="usage_opportunity" name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') ?
' checked="checked"' :
'') :
' checked="checked"').
'"> ';
605 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
606 print
'<label for="usage_opportunity">'.$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext).
'</label>';
608 print
'$( document ).ready(function() {
609 jQuery("#usage_opportunity").change(function() {
610 if (jQuery("#usage_opportunity").prop("checked")) {
611 console.log("Show opportunities fields");
612 jQuery(".classuseopportunity").show();
614 console.log("Hide opportunities fields "+jQuery("#usage_opportunity").prop("checked"));
615 jQuery(".classuseopportunity").hide();
620 print
'jQuery(".classuseopportunity").hide();';
626 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
627 print
'<input type="checkbox" id="usage_task" name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') ?
' checked="checked"' :
'') :
' checked="checked"').
'"> ';
628 $htmltext = $langs->trans(
"ProjectFollowTasks");
629 print
'<label for="usage_task">'.$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext).
'</label>';
631 print
'$( document ).ready(function() {
632 jQuery("#usage_task").change(function() {
633 if (jQuery("#usage_task").prop("checked")) {
634 console.log("Show task fields");
635 jQuery(".classusetask").show();
637 console.log("Hide tasks fields "+jQuery("#usage_task").prop("checked"));
638 jQuery(".classusetask").hide();
643 print
'jQuery(".classusetask").hide();';
649 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
650 print
'<input type="checkbox" id="usage_bill_time" name="usage_bill_time"'.(GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time',
'alpha') ?
' checked="checked"' :
'') :
'').
'"> ';
651 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
652 print
'<label for="usage_bill_time">'.$form->textwithpicto($langs->trans(
"BillTime"), $htmltext).
'</label>';
654 print
'$( document ).ready(function() {
655 jQuery("#usage_bill_time").change(function() {
656 if (jQuery("#usage_bill_time").prop("checked")) {
657 console.log("Show bill time fields");
658 jQuery(".classusebilltime").show();
660 console.log("Hide bill time fields "+jQuery("#usage_bill_time").prop("checked"));
661 jQuery(".classusebilltime").hide();
666 print
'jQuery(".classusebilltime").hide();';
673 print
'<input type="checkbox" id="usage_organize_event" name="usage_organize_event"'.(GETPOSTISSET(
'usage_organize_event') ? (
GETPOST(
'usage_organize_event',
'alpha') ?
' checked="checked"' :
'') :
'').
'"> ';
674 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
675 print
'<label for="usage_organize_event">'.$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext).
'</label>';
677 print
'$( document ).ready(function() {
678 jQuery("#usage_organize_event").change(function() {
679 if (jQuery("#usage_organize_event").prop("checked")) {
680 console.log("Show organize event fields");
681 jQuery(".classuseorganizeevent").show();
683 console.log("Hide organize event fields "+jQuery("#usage_organize_event").prop("checked"));
684 jQuery(".classuseorganizeevent").hide();
688 if (!
GETPOST(
'usage_organize_event')) {
689 print
'jQuery(".classuseorganizeevent").hide();';
701 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'<span class="fieldrequired">');
702 print $langs->trans(
"ThirdParty");
703 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'</span>');
704 print
'</td><td class="maxwidthonsmartphone">';
706 if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) {
707 $filter = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
709 $text =
img_picto(
'',
'company').$form->select_company(
GETPOST(
'socid',
'int'),
'socid', $filter,
'SelectThirdParty', 1, 0, array(), 0,
'minwidth300 widthcentpercentminusxx maxwidth500');
710 if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) {
711 $texthelp = $langs->trans(
"IfNeedToUseOtherObjectKeepEmpty");
712 print
$form->textwithtooltip($text.
' '.
img_help(), $texthelp, 1);
717 $url =
'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?action=create');
718 $newbutton =
'<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddThirdParty").
'"></span>';
721 $tmpbacktopagejsfields =
'addthirdparty:socid,search_socid';
722 print
dolButtonToOpenUrlInDialogPopup(
'addthirdparty', $langs->transnoentitiesnoconv(
'AddThirdParty'), $newbutton, $url,
'',
'',
'', $tmpbacktopagejsfields);
724 print
' <a href="'.DOL_URL_ROOT.$url.
'">'.$newbutton.
'</a>';
732 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
733 print
'<input type="hidden" name="status" value="'.$status.
'">';
734 print $object->LibStatut($status, 4);
739 print
'<tr><td>'.$langs->trans(
"Visibility").
'</td><td class="maxwidthonsmartphone">';
741 if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) {
742 $array[0] = $langs->trans(
"PrivateProject");
744 if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) {
745 $array[1] = $langs->trans(
"SharedProject");
748 if (count($array) > 0) {
749 print
$form->selectarray(
'public', $array,
GETPOST(
'public'), 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
751 print
'<input type="hidden" name="public" id="public" value="'.GETPOST(
'public').
'">';
754 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
755 print $langs->trans(
"PrivateProject");
757 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
758 print $langs->trans(
"SharedProject");
763 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
765 print
'<tr class="classuseopportunity"><td><span class="fieldrequired">'.$langs->trans(
"OpportunityStatus").
'</span></td>';
766 print
'<td class="maxwidthonsmartphone">';
767 print $formproject->selectOpportunityStatus(
'opp_status',
GETPOSTISSET(
'opp_status') ?
GETPOST(
'opp_status') : $object->opp_status, 1, 0, 0, 0,
'', 0, 1);
770 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>';
771 print
'<input type="hidden" name="opp_percent_not_set" id="opp_percent_not_set" value="'.dol_escape_htmltag(
GETPOSTISSET(
'opp_percent') ?
'0' :
'1').
'">';
776 print
'<tr class="classuseopportunity"><td>'.$langs->trans(
"OpportunityAmount").
'</td>';
777 print
'<td><input class="width75 right" type="text" name="opp_amount" value="'.dol_escape_htmltag(
GETPOSTISSET(
'opp_amount') ?
GETPOST(
'opp_amount') :
'').
'">';
778 print
' '.$langs->getCurrencySymbol($conf->currency);
784 print
'<tr><td>'.$langs->trans(
"Budget").
'</td>';
785 print
'<td><input class="width75 right" type="text" name="budget_amount" value="'.dol_escape_htmltag(
GETPOSTISSET(
'budget_amount') ?
GETPOST(
'budget_amount') :
'').
'">';
786 print
' '.$langs->getCurrencySymbol($conf->currency);
791 print
'<tr><td>'.$langs->trans(
"Date").(isModEnabled(
'eventorganization') ?
' <span class="classuseorganizeevent">('.$langs->trans(
"Project").
')</span>' :
'').
'</td><td>';
792 print
$form->selectDate(($date_start ? $date_start :
''),
'projectstart', 0, 0, 0,
'', 1, 0);
793 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
794 print
$form->selectDate(($date_end ? $date_end : -1),
'projectend', 0, 0, 0,
'', 1, 0);
799 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Date").
' ('.$langs->trans(
"Event").
')</td><td>';
800 print
$form->selectDate(($date_start_event ? $date_start_event : -1),
'date_start_event', 1, 1, 1,
'', 1, 0);
801 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
802 print
$form->selectDate(($date_end_event ? $date_end_event : -1),
'date_end_event', 1, 1, 1,
'', 1, 0);
806 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Location").
'</td>';
807 print
'<td><input class="minwidth300 maxwidth500" type="text" name="location" value="'.dol_escape_htmltag($location).
'"></td>';
812 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
814 $doleditor =
new DolEditor(
'description',
GETPOST(
"description",
'restricthtml'),
'', 90,
'dolibarr_notes',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_3,
'90%');
815 $doleditor->Create();
820 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
821 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_PROJECT,
'',
'parent', 64, 0, 1);
822 $arrayselected =
GETPOST(
'categories',
'array');
823 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
829 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
830 print $hookmanager->resPrint;
831 if (empty($reshook)) {
832 print $object->showOptionals($extrafields,
'create');
839 print
$form->buttonsSaveCancel(
'CreateDraft');
845 print
'<script type="text/javascript">
846 jQuery(document).ready(function() {
847 function change_percent()
849 var element = jQuery("#opp_status option:selected");
850 var defaultpercent = element.attr("defaultpercent");
851 /*if (jQuery("#opp_percent_not_set").val() == "") */
852 jQuery("#opp_percent").val(defaultpercent);
856 jQuery("#opp_status").change(function() {
860 jQuery("#usage_task").change(function() {
861 console.log("We click on usage task "+jQuery("#usage_task").is(":checked"));
862 if (! jQuery("#usage_task").is(":checked")) {
863 jQuery("#usage_bill_time").prop("checked", false);
867 jQuery("#usage_bill_time").change(function() {
868 console.log("We click on usage to bill time");
869 if (jQuery("#usage_bill_time").is(":checked")) {
870 jQuery("#usage_task").prop("checked", true);
875 } elseif ($object->id > 0) {
880 $res = $object->fetch_optionals();
883 $userAccess = $object->restrictedProjectArea($user,
'read');
884 $userWrite = $object->restrictedProjectArea($user,
'write');
885 $userDelete = $object->restrictedProjectArea($user,
'delete');
890 if ($action ==
'validate') {
891 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ValidateProject'), $langs->trans(
'ConfirmValidateProject'),
'confirm_validate',
'', 0, 1);
894 if ($action ==
'close') {
895 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"CloseAProject"), $langs->trans(
"ConfirmCloseAProject"),
"confirm_close",
'',
'', 1);
898 if ($action ==
'reopen') {
899 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"ReOpenAProject"), $langs->trans(
"ConfirmReOpenAProject"),
"confirm_reopen",
'',
'', 1);
902 if ($action ==
'delete') {
903 $text = $langs->trans(
"ConfirmDeleteAProject");
904 $task =
new Task($db);
905 $taskarray = $task->getTasksArray(0, 0, $object->id, 0, 0);
906 $nboftask = count($taskarray);
908 $text .=
'<br>'.img_warning().
' '.$langs->trans(
"ThisWillAlsoRemoveTasks", $nboftask);
910 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"DeleteAProject"), $text,
"confirm_delete",
'',
'', 1);
914 if ($action ==
'clone') {
915 $formquestion = array(
916 'text' => $langs->trans(
"ConfirmClone"),
917 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')),
918 array(
'type' =>
'checkbox',
'name' =>
'clone_contacts',
'label' => $langs->trans(
"CloneContacts"),
'value' =>
true),
919 array(
'type' =>
'checkbox',
'name' =>
'clone_tasks',
'label' => $langs->trans(
"CloneTasks"),
'value' =>
true),
920 array(
'type' =>
'checkbox',
'name' =>
'move_date',
'label' => $langs->trans(
"CloneMoveDate"),
'value' =>
true),
921 array(
'type' =>
'checkbox',
'name' =>
'clone_notes',
'label' => $langs->trans(
"CloneNotes"),
'value' =>
true),
922 array(
'type' =>
'checkbox',
'name' =>
'clone_project_files',
'label' => $langs->trans(
"CloneProjectFiles"),
'value' =>
false),
923 array(
'type' =>
'checkbox',
'name' =>
'clone_task_files',
'label' => $langs->trans(
"CloneTaskFiles"),
'value' =>
false)
926 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"ToClone"), $langs->trans(
"ConfirmCloneProject"),
"confirm_clone", $formquestion,
'', 1, 400, 590);
930 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
931 print
'<input type="hidden" name="token" value="'.newToken().
'">';
932 print
'<input type="hidden" name="action" value="update">';
933 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
934 print
'<input type="hidden" name="comefromclone" value="'.$comefromclone.
'">';
938 if ($action ==
'edit' && $userWrite > 0) {
939 print
dol_get_fiche_head($head,
'project', $langs->trans(
"Project"), 0, ($object->public ?
'projectpub' :
'project'));
941 print
'<table class="border centpercent">';
944 $suggestedref = $object->ref;
945 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Ref").
'</td>';
946 print
'<td><input size="25" name="ref" value="'.$suggestedref.
'">';
947 print
' '.$form->textwithpicto(
'', $langs->trans(
"YouCanCompleteRef", $suggestedref));
951 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
952 print
'<td><input class="quatrevingtpercent" name="title" value="'.dol_escape_htmltag($object->title).
'"></td></tr>';
955 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td><td>';
956 print
'<select class="flat" name="status" id="status">';
957 foreach ($object->statuts_short as $key => $val) {
958 print
'<option value="'.$key.
'"'.((
GETPOSTISSET(
'status') ?
GETPOST(
'status') : $object->statut) == $key ?
' selected="selected"' :
'').
'>'.$langs->trans($val).
'</option>';
965 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) ||
isModEnabled(
'eventorganization')) {
966 print
'<tr><td class="tdtop">';
967 print $langs->trans(
"Usage");
970 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
971 print
'<input type="checkbox" id="usage_opportunity" name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'> ';
972 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
973 print
'<label for="usage_opportunity">'.$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext).
'</label>';
975 print
'$( document ).ready(function() {
976 jQuery("#usage_opportunity").change(function() {
977 set_usage_opportunity();
980 set_usage_opportunity();
982 function set_usage_opportunity() {
983 console.log("set_usage_opportunity");
984 if (jQuery("#usage_opportunity").prop("checked")) {
985 console.log("Show opportunities fields");
986 jQuery(".classuseopportunity").show();
988 console.log("Hide opportunities fields "+jQuery("#usage_opportunity").prop("checked"));
989 jQuery(".classuseopportunity").hide();
996 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
997 print
'<input type="checkbox" id="usage_task" name="usage_task"' . (
GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')) .
'> ';
998 $htmltext = $langs->trans(
"ProjectFollowTasks");
999 print
'<label for="usage_task">'.$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext).
'</label>';
1001 print
'$( document ).ready(function() {
1002 jQuery("#usage_task").change(function() {
1008 function set_usage_task() {
1009 console.log("set_usage_task");
1010 if (jQuery("#usage_task").prop("checked")) {
1011 console.log("Show task fields");
1012 jQuery(".classusetask").show();
1014 console.log("Hide task fields "+jQuery("#usage_task").prop("checked"));
1015 jQuery(".classusetask").hide();
1022 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
1023 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"' :
'')) .
'> ';
1024 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
1025 print
'<label for="usage_bill_time">'.$form->textwithpicto($langs->trans(
"BillTime"), $htmltext).
'</label>';
1027 print
'$( document ).ready(function() {
1028 jQuery("#usage_bill_time").change(function() {
1029 set_usage_bill_time();
1032 set_usage_bill_time();
1034 function set_usage_bill_time() {
1035 console.log("set_usage_bill_time");
1036 if (jQuery("#usage_bill_time").prop("checked")) {
1037 console.log("Show bill time fields");
1038 jQuery(".classusebilltime").show();
1040 console.log("Hide bill time fields "+jQuery("#usage_bill_time").prop("checked"));
1041 jQuery(".classusebilltime").hide();
1049 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"' :
'')) .
'> ';
1050 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
1051 print
'<label for="usage_organize_event">'.$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext).
'</label>';
1053 print
'$( document ).ready(function() {
1054 jQuery("#usage_organize_event").change(function() {
1060 function set_usage_event() {
1061 console.log("set_usage_event");
1062 if (jQuery("#usage_organize_event").prop("checked")) {
1063 console.log("Show organize event fields");
1064 jQuery(".classuseorganizeevent").show();
1066 console.log("Hide organize event fields "+jQuery("#usage_organize_event").prop("checked"));
1067 jQuery(".classuseorganizeevent").hide();
1080 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'<span class="fieldrequired">');
1081 print $langs->trans(
"ThirdParty");
1082 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'</span>');
1085 if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) {
1086 $filter = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
1088 $text =
img_picto(
'',
'company',
'class="pictofixedwidth"');
1089 $text .=
$form->select_company($object->thirdparty->id,
'socid', $filter,
'None', 1, 0, array(), 0,
'minwidth300');
1090 if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) {
1091 $texthelp = $langs->trans(
"IfNeedToUseOtherObjectKeepEmpty");
1092 print
$form->textwithtooltip($text.
' '.
img_help(), $texthelp, 1, 0,
'',
'', 2);
1100 print
'<tr><td>'.$langs->trans(
"Visibility").
'</td><td>';
1102 if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) {
1103 $array[0] = $langs->trans(
"PrivateProject");
1105 if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) {
1106 $array[1] = $langs->trans(
"SharedProject");
1109 if (count($array) > 0) {
1110 print
$form->selectarray(
'public', $array, $object->public, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1112 print
'<input type="hidden" id="public" name="public" value="'.$object->public.
'">';
1114 if ($object->public == 0) {
1115 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
1116 print $langs->trans(
"PrivateProject");
1118 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
1119 print $langs->trans(
"SharedProject");
1124 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
1125 $classfortr = ($object->usage_opportunity ?
'' :
' hideobject');
1127 print
'<tr class="classuseopportunity'.$classfortr.
'"><td>'.$langs->trans(
"OpportunityStatus").
'</td>';
1130 print $formproject->selectOpportunityStatus(
'opp_status', $object->opp_status, 1, 0, 0, 0,
'minwidth150 inline-block valignmiddle', 1, 1);
1133 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) :
'')).
'"> %';
1134 print
'<span id="oldopppercent" class="opacitymedium"></span>';
1137 print
'<div id="divtocloseproject" class="inline-block valign clearboth paddingtop" style="display: none;">';
1138 print
'<input type="checkbox" id="inputcloseproject" name="closeproject" />';
1139 print
'<label for="inputcloseproject">';
1140 print
$form->textwithpicto($langs->trans(
"AlsoCloseAProject"), $langs->trans(
"AlsoCloseAProjectTooltip")).
'</label>';
1147 print
'<tr class="classuseopportunity'.$classfortr.
'"><td>'.$langs->trans(
"OpportunityAmount").
'</td>';
1148 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) :
'')).
'">';
1149 print $langs->getCurrencySymbol($conf->currency);
1155 print
'<tr><td>'.$langs->trans(
"Budget").
'</td>';
1156 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) :
'')).
'">';
1157 print $langs->getCurrencySymbol($conf->currency);
1162 print
'<tr><td>'.$langs->trans(
"Date").(isModEnabled(
'eventorganization') ?
' <span class="classuseorganizeevent">('.$langs->trans(
"Project").
')</span>' :
'').
'</td><td>';
1163 print
$form->selectDate($object->date_start ? $object->date_start : -1,
'projectstart', 0, 0, 0,
'', 1, 0);
1164 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
1165 print
$form->selectDate($object->date_end ? $object->date_end : -1,
'projectend', 0, 0, 0,
'', 1, 0);
1166 $object->getLinesArray(
null, 0);
1167 if (!empty($object->usage_task) && !empty($object->lines)) {
1168 print
' <span id="divreportdate" class="hidden"> <input type="checkbox" class="valignmiddle" id="reportdate" name="reportdate" value="yes" ';
1169 if ($comefromclone) {
1172 print
'/><label for="reportdate" class="valignmiddle opacitymedium">'.$langs->trans(
"ProjectReportDate").
'</label></span>';
1178 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Date").
' ('.$langs->trans(
"Event").
')</td><td>';
1179 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);
1180 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
1181 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);
1185 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Location").
'</td>';
1186 print
'<td><input class="minwidth300 maxwidth500" type="text" name="location" value="'.dol_escape_htmltag(
GETPOSTISSET(
'location') ?
GETPOST(
'location') : $object->location).
'"></td>';
1191 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
1193 $doleditor =
new DolEditor(
'description', $object->description,
'', 90,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_3,
'90%');
1194 $doleditor->Create();
1199 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
1200 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_PROJECT,
'',
'parent', 64, 0, 1);
1202 $cats = $c->containing($object->id, Categorie::TYPE_PROJECT);
1203 foreach ($cats as $cat) {
1204 $arrayselected[] = $cat->id;
1206 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0,
'0');
1212 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
1213 print $hookmanager->resPrint;
1214 if (empty($reshook)) {
1215 print $object->showOptionals($extrafields,
'edit');
1220 print
dol_get_fiche_head($head,
'project', $langs->trans(
"Project"), -1, ($object->public ?
'projectpub' :
'project'));
1224 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1226 $morehtmlref =
'<div class="refidno">';
1229 $morehtmlref .=
'<br>';
1231 if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
1232 $morehtmlref .= $object->thirdparty->getNomUrl(1,
'project');
1234 $morehtmlref .=
'</div>';
1237 if (empty($user->rights->projet->all->lire)) {
1238 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
1239 $object->next_prev_filter =
" rowid IN (".$db->sanitize(count($objectsListId) ? join(
',', array_keys($objectsListId)) :
'0').
")";
1242 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1244 print
'<div class="fichecenter">';
1245 print
'<div class="fichehalfleft">';
1246 print
'<div class="underbanner clearboth"></div>';
1248 print
'<table class="border tableforfield centpercent">';
1251 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) ||
isModEnabled(
'eventorganization')) {
1252 print
'<tr><td class="tdtop">';
1253 print $langs->trans(
"Usage");
1256 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
1257 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'> ';
1258 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
1259 print
$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
1262 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
1263 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')).
'> ';
1264 $htmltext = $langs->trans(
"ProjectFollowTasks");
1265 print
$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
1268 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
1269 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"' :
'')).
'> ';
1270 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
1271 print
$form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
1276 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"' :
'')).
'> ';
1277 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
1278 print
$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
1284 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
1285 if ($object->public) {
1286 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
1287 print $langs->trans(
'SharedProject');
1289 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
1290 print $langs->trans(
'PrivateProject');
1294 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && !empty($object->usage_opportunity)) {
1296 print
'<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
1297 $code =
dol_getIdFromCode($db, $object->opp_status,
'c_lead_status',
'rowid',
'code');
1299 print $langs->trans(
"OppStatus".$code);
1303 print
' <span title="'.$langs->trans(
"OpportunityProbability").
'"> / ';
1304 if (strcmp($object->opp_percent,
'')) {
1305 print
price($object->opp_percent, 0, $langs, 1, 0).
' %';
1307 print
'</span></td></tr>';
1310 print
'<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
1311 if (strcmp($object->opp_amount,
'')) {
1312 print
'<span class="amount">'.price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency).
'</span>';
1313 if (strcmp($object->opp_percent,
'')) {
1314 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>';
1321 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
1322 if (!is_null($object->budget_amount) && strcmp($object->budget_amount,
'')) {
1323 print
'<span class="amount">'.price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
1328 print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
1330 print ($start ? $start :
'?');
1332 print
' <span class="opacitymedium">-</span> ';
1333 print ($end ? $end :
'?');
1334 if ($object->hasDelay()) {
1341 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1346 print
'<div class="fichehalfright">';
1347 print
'<div class="underbanner clearboth"></div>';
1349 print
'<table class="border tableforfield centpercent">';
1352 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
1358 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
1359 print
$form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
1368 print
'<div class="clearboth"></div>';
1373 if ($action ==
'edit' && $userWrite > 0) {
1374 print
$form->buttonsSaveCancel();
1380 print
'<script type="text/javascript">
1381 jQuery(document).ready(function() {
1382 jQuery("#usage_task").change(function() {
1383 console.log("We click on usage task "+jQuery("#usage_task").is(":checked"));
1384 if (! jQuery("#usage_task").is(":checked")) {
1385 jQuery("#usage_bill_time").prop("checked", false);
1389 jQuery("#usage_bill_time").change(function() {
1390 console.log("We click on usage to bill time");
1391 if (jQuery("#usage_bill_time").is(":checked")) {
1392 jQuery("#usage_task").prop("checked", true);
1396 jQuery("#projectstart").change(function() {
1397 console.log("We modify the start date");
1398 jQuery("#divreportdate").show();
1404 if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
1406 $defaultcheckedwhenoppclose = 1;
1407 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
1408 $defaultcheckedwhenoppclose = 0;
1411 print
'<!-- Javascript to manage opportunity status change -->';
1412 print
'<script type="text/javascript">
1413 jQuery(document).ready(function() {
1414 function change_percent()
1416 var element = jQuery("#opp_status option:selected");
1417 var defaultpercent = element.attr("defaultpercent");
1418 var defaultcloseproject = '.((int) $defaultcheckedwhenoppclose).
';
1419 var elemcode = element.attr("elemcode");
1420 var oldpercent = \''.
dol_escape_js($object->opp_percent).
'\';
1422 console.log(
"We select "+elemcode);
1425 var closeproject = 0;
1426 if (elemcode == \
'LOST\') closeproject = 1;
1427 if (elemcode == \'WON\') closeproject = defaultcloseproject;
1428 if (closeproject) jQuery("#inputcloseproject").prop("checked", true);
1429 else jQuery("#inputcloseproject").prop("checked", false);
1431 /* Make the close project checkbox visible or not */
1432 console.log("closeproject="+closeproject);
1433 if (elemcode == \'WON\' || elemcode == \'LOST\')
1435 jQuery("#divtocloseproject").show();
1439 jQuery("#divtocloseproject").hide();
1442 /* Change percent with default percent (defaultpercent) if new status (defaultpercent) is higher than current (jQuery("#opp_percent").val()) */
1443 if (oldpercent != \'\' && (parseFloat(defaultpercent) < parseFloat(oldpercent)))
1445 console.log("oldpercent="+oldpercent+" defaultpercent="+defaultpercent+" def < old");
1446 if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') {
1447 jQuery("#oldopppercent").text(\' - '.
dol_escape_js($langs->transnoentities(
"PreviousValue")).
': \'+price2numjs(oldpercent)+\' %\');
1450 if (parseFloat(oldpercent) != 100 && elemcode != \'LOST\') { jQuery("#opp_percent").val(oldpercent); }
1451 else { jQuery("#opp_percent").val(price2numjs(defaultpercent)); }
1453 console.log("oldpercent="+oldpercent+" defaultpercent="+defaultpercent);
1454 if (jQuery("#opp_percent").val() == \'\' || (parseFloat(jQuery("#opp_percent").val()) < parseFloat(defaultpercent))) {
1455 if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') {
1456 jQuery("#oldopppercent").text(\' - '.
dol_escape_js($langs->transnoentities(
"PreviousValue")).
': \'+price2numjs(oldpercent)+\' %\');
1458 jQuery("#opp_percent").val(price2numjs(defaultpercent));
1463 jQuery("#opp_status").change(function() {
1475 print
'<div class="tabsAction">';
1477 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters, $object, $action);
1479 if (empty($reshook)) {
1480 if ($action !=
"edit" && $action !=
'presend') {
1490 if (empty($user->socid)) {
1492 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend&token='.
newToken().
'&id='.$object->id.
'&mode=init#formmailbeforetitle',
'');
1512 if ($userWrite > 0) {
1513 print
dolGetButtonAction(
'', $langs->trans(
'SetToDraft'),
'default', $_SERVER[
"PHP_SELF"].
'?action=confirm_setdraft&confirm=yes&token='.
newToken().
'&id='.$object->id,
'');
1515 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'SetToDraft'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1522 if ($userWrite > 0) {
1523 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'&id='.$object->id,
'');
1525 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Modify'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1531 if ($userWrite > 0) {
1532 print
dolGetButtonAction(
'', $langs->trans(
'Validate'),
'default', $_SERVER[
"PHP_SELF"].
'?action=validate&token='.
newToken().
'&id='.$object->id,
'');
1534 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1540 if ($userWrite > 0) {
1541 print
dolGetButtonAction(
'', $langs->trans(
'Close'),
'default', $_SERVER[
"PHP_SELF"].
'?action=close&token='.
newToken().
'&id='.$object->id,
'');
1543 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Close'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1549 if ($userWrite > 0) {
1550 print
dolGetButtonAction(
'', $langs->trans(
'ReOpen'),
'default', $_SERVER[
"PHP_SELF"].
'?action=reopen&token='.
newToken().
'&id='.$object->id,
'');
1552 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'ReOpen'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1557 if (empty($conf->global->PROJECT_HIDE_CREATE_OBJECT_BUTTON)) {
1558 $arrayforbutaction = array(
1559 10 => array(
'lang'=>
'propal',
'enabled'=>
isModEnabled(
"propal"),
'perm'=>$user->hasRight(
'propal',
'creer'),
'label' =>
'AddProp',
'url'=>
'/comm/propal/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid),
1560 20 => array(
'lang'=>
'orders',
'enabled'=>
isModEnabled(
"commande"),
'perm'=>$user->hasRight(
'commande',
'creer'),
'label' =>
'CreateOrder',
'url'=>
'/commande/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid),
1561 30 => array(
'lang'=>
'bills',
'enabled'=>
isModEnabled(
"facture"),
'perm'=>$user->hasRight(
'facture',
'creer'),
'label' =>
'CreateBill',
'url'=>
'/compta/facture/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid),
1562 40 => array(
'lang'=>
'supplier_proposal',
'enabled'=>
isModEnabled(
"supplier_proposal"),
'perm'=>$user->hasRight(
'supplier_proposal',
'creer'),
'label' =>
'AddSupplierProposal',
'url'=>
'/supplier_proposal/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid),
1563 50 => array(
'lang'=>
'suppliers',
'enabled'=>
isModEnabled(
"supplier_order"),
'perm'=>$user->hasRight(
'fournisseur',
'commande',
'creer'),
'label' =>
'AddSupplierOrder',
'url'=>
'/fourn/commande/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid),
1564 60 => array(
'lang'=>
'suppliers',
'enabled'=>
isModEnabled(
"supplier_invoice"),
'perm'=>$user->hasRight(
'fournisseur',
'facture',
'creer'),
'label' =>
'AddSupplierInvoice',
'url'=>
'/fourn/facture/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid),
1565 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),
1566 80 => array(
'lang'=>
'contrats',
'enabled'=>
isModEnabled(
"contrat"),
'perm'=>$user->hasRight(
'contrat',
'creer'),
'label' =>
'AddContract',
'url'=>
'/contrat/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid),
1567 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),
1568 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),
1571 $params = array(
'backtopage' => $_SERVER[
"PHP_SELF"].
'?id='.$object->id);
1573 print
dolGetButtonAction($langs->trans(
"Create"),
'',
'default', $arrayforbutaction,
'', 1, $params);
1577 if ($user->hasRight(
'projet',
'creer')) {
1578 if ($userWrite > 0) {
1579 print
dolGetButtonAction(
'', $langs->trans(
'ToClone'),
'default', $_SERVER[
"PHP_SELF"].
'?action=clone&token='.
newToken().
'&id='.$object->id,
'');
1581 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'ToClone'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1586 if ($user->hasRight(
'projet',
'supprimer') || ($object->statut ==
Project::STATUS_DRAFT && $user->hasRight(
'projet',
'creer'))) {
1587 if ($userDelete > 0 || ($object->statut ==
Project::STATUS_DRAFT && $user->hasRight(
'projet',
'creer'))) {
1588 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.$object->id,
'');
1590 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Delete'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1598 if (
GETPOST(
'modelselected')) {
1599 $action =
'presend';
1602 if ($action !=
'presend') {
1603 print
'<div class="fichecenter"><div class="fichehalfleft">';
1604 print
'<a name="builddoc"></a>';
1610 $filedir = $conf->project->multidir_output[$object->entity].
"/".
dol_sanitizeFileName($object->ref);
1611 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1612 $genallowed = ($user->hasRight(
'projet',
'lire') && $userAccess > 0);
1613 $delallowed = ($user->hasRight(
'projet',
'creer') && $userWrite > 0);
1615 print $formfile->showdocuments(
'project', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 0, 0,
'',
'',
'',
'',
'', $object);
1617 print
'</div><div class="fichehalfright">';
1621 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/projet/messaging.php?id='.$object->id);
1624 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1626 $somethingshown =
$formactions->showactions($object,
'project', 0, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1628 print
'</div></div>';
1632 $modelmail =
'project';
1633 $defaulttopic =
'SendProjectRef';
1634 $diroutput = $conf->project->multidir_output[$object->entity];
1635 $autocopy =
'MAIN_MAIL_AUTOCOPY_PROJECT_TO';
1636 $trackid =
'proj'.$object->id;
1638 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
1642 $reshook = $hookmanager->executeHooks(
'mainCardTabAddMore',
$parameters, $object, $action);
1644 print $langs->trans(
"RecordNotFound");
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_help($usehelpcursor=1, $usealttitle=1)
Show help logo with cursor "?".
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $backtopagejsfields='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.