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');
54 $dol_openinpopup =
GETPOST(
'dol_openinpopup',
'aZ09');
56 $status =
GETPOST(
'status',
'int');
57 $opp_status =
GETPOST(
'opp_status',
'int');
59 $objcanvas =
GETPOST(
"objcanvas",
"alphanohtml");
60 $comefromclone =
GETPOST(
"comefromclone",
"alphanohtml");
63 $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'));
64 $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'));
65 $location =
GETPOST(
'location',
'alphanohtml');
68 $mine =
GETPOST(
'mode') ==
'mine' ? 1 : 0;
72 $hookmanager->initHooks(array(
'projectcard',
'globalcard'));
79 if ($id > 0 || !empty($ref)) {
80 $ret = $object->fetch($id, $ref);
82 $object->fetch_thirdparty();
83 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object,
'fetchComments') && empty($object->comments)) {
84 $object->fetchComments();
91 $extrafields->fetch_name_optionals_label($object->table_element);
94 $socid =
GETPOST(
'socid',
'int');
98 if ($id ==
'' && $ref ==
'' && ($action !=
"create" && $action !=
"add" && $action !=
"update" && !
GETPOST(
"cancel"))) {
102 $permissiontoadd = $user->rights->projet->creer;
103 $permissiontodelete = $user->rights->projet->supprimer;
104 $permissiondellink = $user->rights->projet->creer;
111 $parameters = array(
'id'=>$socid,
'objcanvas'=>$objcanvas);
112 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
117 if (empty($reshook)) {
118 $backurlforlist = DOL_URL_ROOT.
'/projet/list.php';
122 if (
GETPOST(
"comefromclone") == 1) {
123 $result = $object->delete($user);
125 header(
"Location: index.php");
129 setEventMessages($langs->trans(
"CantRemoveProject", $langs->transnoentitiesnoconv(
"ProjectOverview")),
null,
'errors');
134 if (empty($backtopage) || ($cancel && empty($id))) {
135 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
136 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
137 $backtopage = $backurlforlist;
139 $backtopage = DOL_URL_ROOT.
'/projet/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
145 if (!empty($backtopageforcancel)) {
146 header(
"Location: ".$backtopageforcancel);
148 } elseif (!empty($backtopage)) {
149 header(
"Location: ".$backtopage);
155 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
158 if ($action ==
'confirm_setdraft' && $confirm ==
'yes' && $permissiontoadd) {
159 $result = $object->setStatut($object::STATUS_DRAFT,
null,
'',
'PROJECT_MODIFY');
170 if ($action ==
'add' && $permissiontoadd) {
173 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")),
null,
'errors');
177 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"ProjectLabel")),
null,
'errors');
181 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
182 if (
GETPOST(
'opp_amount') !=
'' && !(
GETPOST(
'opp_status') > 0)) {
184 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfAmount"),
null,
'errors');
189 if (!empty($conf->global->PROJECT_CREATE_NO_DRAFT)) {
198 $object->ref =
GETPOST(
'ref',
'alphanohtml');
199 $object->title =
GETPOST(
'title',
'alphanohtml');
200 $object->socid =
GETPOST(
'socid',
'int');
201 $object->description =
GETPOST(
'description',
'restricthtml');
202 $object->public =
GETPOST(
'public',
'alphanohtml');
204 $object->budget_amount =
price2num(
GETPOST(
'budget_amount',
'alphanohtml'));
206 $object->date_start = $date_start;
207 $object->date_end = $date_end;
208 $object->date_start_event = $date_start_event;
209 $object->date_end_event = $date_end_event;
210 $object->location = $location;
211 $object->statut = $status;
212 $object->opp_status = $opp_status;
213 $object->opp_percent = $opp_percent;
214 $object->usage_opportunity = (
GETPOST(
'usage_opportunity',
'alpha') ==
'on' ? 1 : 0);
215 $object->usage_task = (
GETPOST(
'usage_task',
'alpha') ==
'on' ? 1 : 0);
216 $object->usage_bill_time = (
GETPOST(
'usage_bill_time',
'alpha') ==
'on' ? 1 : 0);
217 $object->usage_organize_event = (
GETPOST(
'usage_organize_event',
'alpha') ==
'on' ? 1 : 0);
220 $ret = $extrafields->setOptionalsFromPost(
null, $object);
225 $result = $object->create($user);
226 if (!$error && $result > 0) {
228 $typeofcontact =
'PROJECTLEADER';
229 $result = $object->add_contact($user->id, $typeofcontact,
'internal');
235 } elseif ($result < 0) {
236 $langs->load(
"errors");
241 $langs->load(
"errors");
245 if (!$error && !empty($object->id) > 0) {
247 $categories =
GETPOST(
'categories',
'array');
248 $result = $object->setCategories($categories);
250 $langs->load(
"errors");
259 if (!empty($backtopage)) {
260 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--|__ID__/', $object->id, $backtopage);
261 $backtopage = $backtopage.
'&projectid='.$object->id;
262 header(
"Location: ".$backtopage);
265 header(
"Location:card.php?id=".$object->id);
270 unset($_POST[
"ref"]);
278 if ($action ==
'update' && empty(
GETPOST(
'cancel')) && $permissiontoadd) {
283 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")),
null,
'errors');
287 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"ProjectLabel")),
null,
'errors');
293 $object->oldcopy = clone $object;
295 $old_start_date = $object->date_start;
297 $object->ref =
GETPOST(
'ref',
'alpha');
298 $object->title =
GETPOST(
'title',
'alphanohtml');
299 $object->statut =
GETPOST(
'status',
'int');
300 $object->socid =
GETPOST(
'socid',
'int');
301 $object->description =
GETPOST(
'description',
'restricthtml');
302 $object->public =
GETPOST(
'public',
'alpha');
303 $object->date_start = (!
GETPOST(
'projectstart')) ?
'' : $date_start;
304 $object->date_end = (!
GETPOST(
'projectend')) ?
'' : $date_end;
305 $object->date_start_event = (!
GETPOST(
'date_start_event')) ?
'' : $date_start_event;
306 $object->date_end_event = (!
GETPOST(
'date_end_event')) ?
'' : $date_end_event;
307 $object->location = $location;
315 $object->opp_status = $opp_status;
318 $object->opp_percent = $opp_percent;
320 $object->usage_opportunity = (
GETPOST(
'usage_opportunity',
'alpha') ==
'on' ? 1 : 0);
321 $object->usage_task = (
GETPOST(
'usage_task',
'alpha') ==
'on' ? 1 : 0);
322 $object->usage_bill_time = (
GETPOST(
'usage_bill_time',
'alpha') ==
'on' ? 1 : 0);
323 $object->usage_organize_event = (
GETPOST(
'usage_organize_event',
'alpha') ==
'on' ? 1 : 0);
326 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
332 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
333 if ($object->opp_amount && ($object->opp_status <= 0)) {
335 setEventMessages($langs->trans(
"ErrorOppStatusRequiredIfAmount"),
null,
'errors');
340 $result = $object->update($user);
350 $categories =
GETPOST(
'categories',
'array');
351 $result = $object->setCategories($categories);
360 if (
GETPOST(
"reportdate") && ($object->date_start != $old_start_date)) {
361 $result = $object->shiftTaskDate($old_start_date);
364 setEventMessages($langs->trans(
"ErrorShiftTaskDate").
':'.$object->error, $object->errors,
'errors');
371 $resclose = $object->setClose($user);
374 setEventMessages($langs->trans(
"FailedToCloseProject").
':'.$object->error, $object->errors,
'errors');
385 if (
GETPOST(
'socid',
'int') > 0) {
386 $object->fetch_thirdparty(
GETPOST(
'socid',
'int'));
388 unset($object->thirdparty);
394 if ($action ==
'builddoc' && $permissiontoadd) {
397 $object->setDocModel($user,
GETPOST(
'model',
'alpha'));
400 $outputlangs = $langs;
401 if (
GETPOST(
'lang_id',
'aZ09')) {
403 $outputlangs->setDefaultLang(
GETPOST(
'lang_id',
'aZ09'));
405 $result = $object->generateDocument($object->model_pdf, $outputlangs);
413 if ($action ==
'remove_file' && $permissiontoadd) {
414 if ($object->id > 0) {
415 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
417 $langs->load(
"other");
418 $upload_dir = $conf->project->multidir_output[$object->entity];
419 $file = $upload_dir.
'/'.
GETPOST(
'file');
431 if ($action ==
'confirm_validate' && $confirm ==
'yes' && $permissiontoadd) {
432 $result = $object->setValid($user);
438 if ($action ==
'confirm_close' && $confirm ==
'yes' && $permissiontoadd) {
439 $result = $object->setClose($user);
445 if ($action ==
'confirm_reopen' && $confirm ==
'yes' && $permissiontoadd) {
446 $result = $object->setValid($user);
452 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
454 $result = $object->delete($user);
457 header(
"Location: list.php?restore_lastsearch_values=1");
465 if ($action ==
'confirm_clone' && $permissiontoadd && $confirm ==
'yes') {
466 $clone_contacts =
GETPOST(
'clone_contacts') ? 1 : 0;
467 $clone_tasks =
GETPOST(
'clone_tasks') ? 1 : 0;
468 $clone_project_files =
GETPOST(
'clone_project_files') ? 1 : 0;
469 $clone_task_files =
GETPOST(
'clone_task_files') ? 1 : 0;
470 $clone_notes =
GETPOST(
'clone_notes') ? 1 : 0;
471 $move_date =
GETPOST(
'move_date') ? 1 : 0;
472 $clone_thirdparty =
GETPOST(
'socid',
'int') ?
GETPOST(
'socid',
'int') : 0;
474 $result = $object->createFromClone($user, $object->id, $clone_contacts, $clone_tasks, $clone_project_files, $clone_task_files, $clone_notes, $move_date, 0, $clone_thirdparty);
480 $newobject->fetch($result);
481 $newobject->fetch_optionals();
482 $newobject->fetch_thirdparty();
483 $object = $newobject;
485 $comefromclone =
true;
490 $triggersendname =
'PROJECT_SENTBYMAIL';
492 $autocopy =
'MAIN_MAIL_AUTOCOPY_PROJECT_TO';
493 $trackid =
'proj'.$object->id;
494 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
505 $userstatic =
new User($db);
507 $title = $langs->trans(
"Project").
' - '.$object->ref.(!empty($object->thirdparty->name) ?
' - '.$object->thirdparty->name :
'').(!empty($object->title) ?
' - '.$object->title :
'');
508 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/projectnameonly/', $conf->global->MAIN_HTML_TITLE)) {
509 $title = $object->ref.(!empty($object->thirdparty->name) ?
' - '.$object->thirdparty->name :
'').(!empty($object->title) ?
' - '.$object->title :
'');
512 $help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:Modul_Projekte";
516 $titleboth = $langs->trans(
"LeadsOrProjects");
517 $titlenew = $langs->trans(
"NewLeadOrProject");
519 $titleboth = $langs->trans(
"Projects");
520 $titlenew = $langs->trans(
"NewProject");
523 $titleboth = $langs->trans(
"Leads");
524 $titlenew = $langs->trans(
"NewLead");
527 if ($action ==
'create' && $user->rights->projet->creer) {
532 $thirdparty =
new Societe($db);
534 $thirdparty->fetch($socid);
539 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
540 print
'<input type="hidden" name="action" value="add">';
541 print
'<input type="hidden" name="token" value="'.newToken().
'">';
542 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
543 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
544 print
'<input type="hidden" name="backtopagejsfields" value="'.$backtopagejsfields.
'">';
548 print
'<table class="border centpercent tableforfieldcreate">';
551 $modele = empty($conf->global->PROJECT_ADDON) ?
'mod_project_simple' : $conf->global->PROJECT_ADDON;
554 $file =
''; $classname =
''; $filefound = 0;
555 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
556 foreach ($dirmodels as $reldir) {
557 $file =
dol_buildpath($reldir.
"core/modules/project/".$modele.
'.php', 0);
558 if (file_exists($file)) {
560 $classname = $modele;
567 $modProject =
new $classname;
569 $defaultref = $modProject->getNextValue($thirdparty, $object);
572 if (is_numeric($defaultref) && $defaultref <= 0) {
578 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).
'">';
580 print
' '.$form->textwithpicto(
'', $langs->trans(
"YouCanCompleteRef", $suggestedref));
585 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>';
588 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) ||
isModEnabled(
'eventorganization')) {
589 print
'<tr><td class="tdtop">';
590 print $langs->trans(
"Usage");
593 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
594 print
'<input type="checkbox" id="usage_opportunity" name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') ?
' checked="checked"' :
'') :
' checked="checked"').
'"> ';
595 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
596 print
'<label for="usage_opportunity">'.$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext).
'</label>';
598 print
'$( document ).ready(function() {
599 jQuery("#usage_opportunity").change(function() {
600 if (jQuery("#usage_opportunity").prop("checked")) {
601 console.log("Show opportunities fields");
602 jQuery(".classuseopportunity").show();
604 console.log("Hide opportunities fields "+jQuery("#usage_opportunity").prop("checked"));
605 jQuery(".classuseopportunity").hide();
610 print
'jQuery(".classuseopportunity").hide();';
616 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
617 print
'<input type="checkbox" id="usage_task" name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') ?
' checked="checked"' :
'') :
' checked="checked"').
'"> ';
618 $htmltext = $langs->trans(
"ProjectFollowTasks");
619 print
'<label for="usage_task">'.$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext).
'</label>';
621 print
'$( document ).ready(function() {
622 jQuery("#usage_task").change(function() {
623 if (jQuery("#usage_task").prop("checked")) {
624 console.log("Show task fields");
625 jQuery(".classusetask").show();
627 console.log("Hide tasks fields "+jQuery("#usage_task").prop("checked"));
628 jQuery(".classusetask").hide();
633 print
'jQuery(".classusetask").hide();';
639 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
640 print
'<input type="checkbox" id="usage_bill_time" name="usage_bill_time"'.(GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time',
'alpha') ?
' checked="checked"' :
'') :
'').
'"> ';
641 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
642 print
'<label for="usage_bill_time">'.$form->textwithpicto($langs->trans(
"BillTime"), $htmltext).
'</label>';
644 print
'$( document ).ready(function() {
645 jQuery("#usage_bill_time").change(function() {
646 if (jQuery("#usage_bill_time").prop("checked")) {
647 console.log("Show bill time fields");
648 jQuery(".classusebilltime").show();
650 console.log("Hide bill time fields "+jQuery("#usage_bill_time").prop("checked"));
651 jQuery(".classusebilltime").hide();
656 print
'jQuery(".classusebilltime").hide();';
663 print
'<input type="checkbox" id="usage_organize_event" name="usage_organize_event"'.(GETPOSTISSET(
'usage_organize_event') ? (
GETPOST(
'usage_organize_event',
'alpha') ?
' checked="checked"' :
'') :
'').
'"> ';
664 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
665 print
'<label for="usage_organize_event">'.$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext).
'</label>';
667 print
'$( document ).ready(function() {
668 jQuery("#usage_organize_event").change(function() {
669 if (jQuery("#usage_organize_event").prop("checked")) {
670 console.log("Show organize event fields");
671 jQuery(".classuseorganizeevent").show();
673 console.log("Hide organize event fields "+jQuery("#usage_organize_event").prop("checked"));
674 jQuery(".classuseorganizeevent").hide();
678 if (!
GETPOST(
'usage_organize_event')) {
679 print
'jQuery(".classuseorganizeevent").hide();';
691 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'<span class="fieldrequired">');
692 print $langs->trans(
"ThirdParty");
693 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'</span>');
694 print
'</td><td class="maxwidthonsmartphone">';
696 if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) {
697 $filteronlist = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
699 $text =
img_picto(
'',
'company').$form->select_company(
GETPOST(
'socid',
'int'),
'socid', $filteronlist,
'SelectThirdParty', 1, 0, array(), 0,
'minwidth300 widthcentpercentminusxx maxwidth500');
700 if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) {
701 $texthelp = $langs->trans(
"IfNeedToUseOtherObjectKeepEmpty");
702 print
$form->textwithtooltip($text.
' '.
img_help(), $texthelp, 1);
707 $url =
'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?action=create');
708 $newbutton =
'<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddThirdParty").
'"></span>';
711 $tmpbacktopagejsfields =
'addthirdparty:socid,search_socid';
712 print
dolButtonToOpenUrlInDialogPopup(
'addthirdparty', $langs->transnoentitiesnoconv(
'AddThirdParty'), $newbutton, $url,
'',
'', $tmpbacktopagejsfields);
714 print
' <a href="'.DOL_URL_ROOT.$url.
'">'.$newbutton.
'</a>';
722 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
723 print
'<input type="hidden" name="status" value="'.$status.
'">';
724 print $object->LibStatut($status, 4);
729 print
'<tr><td>'.$langs->trans(
"Visibility").
'</td><td class="maxwidthonsmartphone">';
731 if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) {
732 $array[0] = $langs->trans(
"PrivateProject");
734 if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) {
735 $array[1] = $langs->trans(
"SharedProject");
738 if (count($array) > 0) {
739 print
$form->selectarray(
'public', $array,
GETPOST(
'public'), 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
741 print
'<input type="hidden" name="public" id="public" value="'.GETPOST(
'public').
'">';
744 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
745 print $langs->trans(
"PrivateProject");
747 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
748 print $langs->trans(
"SharedProject");
753 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
755 print
'<tr class="classuseopportunity"><td>'.$langs->trans(
"OpportunityStatus").
'</td>';
756 print
'<td class="maxwidthonsmartphone">';
757 print $formproject->selectOpportunityStatus(
'opp_status',
GETPOSTISSET(
'opp_status') ?
GETPOST(
'opp_status') : $object->opp_status, 1, 0, 0, 0,
'', 0, 1);
760 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>';
761 print
'<input type="hidden" name="opp_percent_not_set" id="opp_percent_not_set" value="'.dol_escape_htmltag(
GETPOSTISSET(
'opp_percent') ?
'0' :
'1').
'">';
766 print
'<tr class="classuseopportunity"><td>'.$langs->trans(
"OpportunityAmount").
'</td>';
767 print
'<td><input class="width75 right" type="text" name="opp_amount" value="'.dol_escape_htmltag(
GETPOSTISSET(
'opp_amount') ?
GETPOST(
'opp_amount') :
'').
'">';
768 print
' '.$langs->getCurrencySymbol($conf->currency);
774 print
'<tr><td>'.$langs->trans(
"Budget").
'</td>';
775 print
'<td><input class="width75 right" type="text" name="budget_amount" value="'.dol_escape_htmltag(
GETPOSTISSET(
'budget_amount') ?
GETPOST(
'budget_amount') :
'').
'">';
776 print
' '.$langs->getCurrencySymbol($conf->currency);
781 print
'<tr><td>'.$langs->trans(
"Date").(isModEnabled(
'eventorganization') ?
' <span class="classuseorganizeevent">('.$langs->trans(
"Project").
')</span>' :
'').
'</td><td>';
782 print
$form->selectDate(($date_start ? $date_start :
''),
'projectstart', 0, 0, 0,
'', 1, 0);
783 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
784 print
$form->selectDate(($date_end ? $date_end : -1),
'projectend', 0, 0, 0,
'', 1, 0);
789 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Date").
' ('.$langs->trans(
"Event").
')</td><td>';
790 print
$form->selectDate(($date_start_event ? $date_start_event : -1),
'date_start_event', 1, 1, 1,
'', 1, 0);
791 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
792 print
$form->selectDate(($date_end_event ? $date_end_event : -1),
'date_end_event', 1, 1, 1,
'', 1, 0);
796 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Location").
'</td>';
797 print
'<td><input class="minwidth300 maxwidth500" type="text" name="location" value="'.dol_escape_htmltag($location).
'"></td>';
802 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
804 $doleditor =
new DolEditor(
'description',
GETPOST(
"description",
'restricthtml'),
'', 90,
'dolibarr_notes',
'',
false,
true,
getDolGlobalString(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_3,
'90%');
805 $doleditor->Create();
810 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
811 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_PROJECT,
'',
'parent', 64, 0, 1);
812 $arrayselected =
GETPOST(
'categories',
'array');
813 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
819 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
820 print $hookmanager->resPrint;
821 if (empty($reshook)) {
822 print $object->showOptionals($extrafields,
'create');
829 print
$form->buttonsSaveCancel(
'CreateDraft');
835 print
'<script type="text/javascript">
836 jQuery(document).ready(function() {
837 function change_percent()
839 var element = jQuery("#opp_status option:selected");
840 var defaultpercent = element.attr("defaultpercent");
841 /*if (jQuery("#opp_percent_not_set").val() == "") */
842 jQuery("#opp_percent").val(defaultpercent);
846 jQuery("#opp_status").change(function() {
850 jQuery("#usage_task").change(function() {
851 console.log("We click on usage task "+jQuery("#usage_task").is(":checked"));
852 if (! jQuery("#usage_task").is(":checked")) {
853 jQuery("#usage_bill_time").prop("checked", false);
857 jQuery("#usage_bill_time").change(function() {
858 console.log("We click on usage to bill time");
859 if (jQuery("#usage_bill_time").is(":checked")) {
860 jQuery("#usage_task").prop("checked", true);
865 } elseif ($object->id > 0) {
870 $res = $object->fetch_optionals();
873 $userAccess = $object->restrictedProjectArea($user,
'read');
874 $userWrite = $object->restrictedProjectArea($user,
'write');
875 $userDelete = $object->restrictedProjectArea($user,
'delete');
880 if ($action ==
'validate') {
881 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ValidateProject'), $langs->trans(
'ConfirmValidateProject'),
'confirm_validate',
'', 0, 1);
884 if ($action ==
'close') {
885 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"CloseAProject"), $langs->trans(
"ConfirmCloseAProject"),
"confirm_close",
'',
'', 1);
888 if ($action ==
'reopen') {
889 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"ReOpenAProject"), $langs->trans(
"ConfirmReOpenAProject"),
"confirm_reopen",
'',
'', 1);
892 if ($action ==
'delete') {
893 $text = $langs->trans(
"ConfirmDeleteAProject");
894 $task =
new Task($db);
895 $taskarray = $task->getTasksArray(0, 0, $object->id, 0, 0);
896 $nboftask = count($taskarray);
898 $text .=
'<br>'.img_warning().
' '.$langs->trans(
"ThisWillAlsoRemoveTasks", $nboftask);
900 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"DeleteAProject"), $text,
"confirm_delete",
'',
'', 1);
904 if ($action ==
'clone') {
905 $formquestion = array(
906 'text' => $langs->trans(
"ConfirmClone"),
907 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')),
908 array(
'type' =>
'checkbox',
'name' =>
'clone_contacts',
'label' => $langs->trans(
"CloneContacts"),
'value' =>
true),
909 array(
'type' =>
'checkbox',
'name' =>
'clone_tasks',
'label' => $langs->trans(
"CloneTasks"),
'value' =>
true),
910 array(
'type' =>
'checkbox',
'name' =>
'move_date',
'label' => $langs->trans(
"CloneMoveDate"),
'value' =>
true),
911 array(
'type' =>
'checkbox',
'name' =>
'clone_notes',
'label' => $langs->trans(
"CloneNotes"),
'value' =>
true),
912 array(
'type' =>
'checkbox',
'name' =>
'clone_project_files',
'label' => $langs->trans(
"CloneProjectFiles"),
'value' =>
false),
913 array(
'type' =>
'checkbox',
'name' =>
'clone_task_files',
'label' => $langs->trans(
"CloneTaskFiles"),
'value' =>
false)
916 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"ToClone"), $langs->trans(
"ConfirmCloneProject"),
"confirm_clone", $formquestion,
'', 1, 400, 590);
920 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
921 print
'<input type="hidden" name="token" value="'.newToken().
'">';
922 print
'<input type="hidden" name="action" value="update">';
923 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
924 print
'<input type="hidden" name="comefromclone" value="'.$comefromclone.
'">';
928 if ($action ==
'edit' && $userWrite > 0) {
929 print
dol_get_fiche_head($head,
'project', $langs->trans(
"Project"), 0, ($object->public ?
'projectpub' :
'project'));
931 print
'<table class="border centpercent">';
934 $suggestedref = $object->ref;
935 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Ref").
'</td>';
936 print
'<td><input size="25" name="ref" value="'.$suggestedref.
'">';
937 print
' '.$form->textwithpicto(
'', $langs->trans(
"YouCanCompleteRef", $suggestedref));
941 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
942 print
'<td><input class="quatrevingtpercent" name="title" value="'.dol_escape_htmltag($object->title).
'"></td></tr>';
945 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td><td>';
946 print
'<select class="flat" name="status" id="status">';
947 foreach ($object->statuts_short as $key => $val) {
948 print
'<option value="'.$key.
'"'.((
GETPOSTISSET(
'status') ?
GETPOST(
'status') : $object->statut) == $key ?
' selected="selected"' :
'').
'>'.$langs->trans($val).
'</option>';
955 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) ||
isModEnabled(
'eventorganization')) {
956 print
'<tr><td class="tdtop">';
957 print $langs->trans(
"Usage");
960 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
961 print
'<input type="checkbox" id="usage_opportunity" name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'> ';
962 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
963 print
'<label for="usage_opportunity">'.$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext).
'</label>';
965 print
'$( document ).ready(function() {
966 jQuery("#usage_opportunity").change(function() {
967 set_usage_opportunity();
970 set_usage_opportunity();
972 function set_usage_opportunity() {
973 console.log("set_usage_opportunity");
974 if (jQuery("#usage_opportunity").prop("checked")) {
975 console.log("Show opportunities fields");
976 jQuery(".classuseopportunity").show();
978 console.log("Hide opportunities fields "+jQuery("#usage_opportunity").prop("checked"));
979 jQuery(".classuseopportunity").hide();
986 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
987 print
'<input type="checkbox" id="usage_task" name="usage_task"' . (
GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')) .
'> ';
988 $htmltext = $langs->trans(
"ProjectFollowTasks");
989 print
'<label for="usage_task">'.$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext).
'</label>';
991 print
'$( document ).ready(function() {
992 jQuery("#usage_task").change(function() {
998 function set_usage_task() {
999 console.log("set_usage_task");
1000 if (jQuery("#usage_task").prop("checked")) {
1001 console.log("Show task fields");
1002 jQuery(".classusetask").show();
1004 console.log("Hide task fields "+jQuery("#usage_task").prop("checked"));
1005 jQuery(".classusetask").hide();
1012 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
1013 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"' :
'')) .
'> ';
1014 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
1015 print
'<label for="usage_bill_time">'.$form->textwithpicto($langs->trans(
"BillTime"), $htmltext).
'</label>';
1017 print
'$( document ).ready(function() {
1018 jQuery("#usage_bill_time").change(function() {
1019 set_usage_bill_time();
1022 set_usage_bill_time();
1024 function set_usage_bill_time() {
1025 console.log("set_usage_bill_time");
1026 if (jQuery("#usage_bill_time").prop("checked")) {
1027 console.log("Show bill time fields");
1028 jQuery(".classusebilltime").show();
1030 console.log("Hide bill time fields "+jQuery("#usage_bill_time").prop("checked"));
1031 jQuery(".classusebilltime").hide();
1039 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"' :
'')) .
'> ';
1040 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
1041 print
'<label for="usage_organize_event">'.$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext).
'</label>';
1043 print
'$( document ).ready(function() {
1044 jQuery("#usage_organize_event").change(function() {
1050 function set_usage_event() {
1051 console.log("set_usage_event");
1052 if (jQuery("#usage_organize_event").prop("checked")) {
1053 console.log("Show organize event fields");
1054 jQuery(".classuseorganizeevent").show();
1056 console.log("Hide organize event fields "+jQuery("#usage_organize_event").prop("checked"));
1057 jQuery(".classuseorganizeevent").hide();
1070 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'<span class="fieldrequired">');
1071 print $langs->trans(
"ThirdParty");
1072 print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ?
'' :
'</span>');
1075 if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) {
1076 $filteronlist = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
1078 $text =
img_picto(
'',
'company',
'class="pictofixedwidth"');
1079 $text .=
$form->select_company($object->thirdparty->id,
'socid', $filteronlist,
'None', 1, 0, array(), 0,
'minwidth300');
1080 if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) {
1081 $texthelp = $langs->trans(
"IfNeedToUseOtherObjectKeepEmpty");
1082 print
$form->textwithtooltip($text.
' '.
img_help(), $texthelp, 1, 0,
'',
'', 2);
1090 print
'<tr><td>'.$langs->trans(
"Visibility").
'</td><td>';
1092 if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) {
1093 $array[0] = $langs->trans(
"PrivateProject");
1095 if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) {
1096 $array[1] = $langs->trans(
"SharedProject");
1099 if (count($array) > 0) {
1100 print
$form->selectarray(
'public', $array, $object->public, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1102 print
'<input type="hidden" id="public" name="public" value="'.$object->public.
'">';
1104 if ($object->public == 0) {
1105 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
1106 print $langs->trans(
"PrivateProject");
1108 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
1109 print $langs->trans(
"SharedProject");
1114 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
1115 $classfortr = ($object->usage_opportunity ?
'' :
' hideobject');
1117 print
'<tr class="classuseopportunity'.$classfortr.
'"><td>'.$langs->trans(
"OpportunityStatus").
'</td>';
1120 print $formproject->selectOpportunityStatus(
'opp_status', $object->opp_status, 1, 0, 0, 0,
'minwidth150 inline-block valignmiddle', 1, 1);
1123 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) :
'')).
'"> %';
1124 print
'<span id="oldopppercent" class="opacitymedium"></span>';
1127 print
'<div id="divtocloseproject" class="inline-block valign clearboth paddingtop" style="display: none;">';
1128 print
'<input type="checkbox" id="inputcloseproject" name="closeproject" />';
1129 print
'<label for="inputcloseproject">';
1130 print
$form->textwithpicto($langs->trans(
"AlsoCloseAProject"), $langs->trans(
"AlsoCloseAProjectTooltip")).
'</label>';
1137 print
'<tr class="classuseopportunity'.$classfortr.
'"><td>'.$langs->trans(
"OpportunityAmount").
'</td>';
1138 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) :
'')).
'">';
1139 print $langs->getCurrencySymbol($conf->currency);
1145 print
'<tr><td>'.$langs->trans(
"Budget").
'</td>';
1146 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) :
'')).
'">';
1147 print $langs->getCurrencySymbol($conf->currency);
1152 print
'<tr><td>'.$langs->trans(
"Date").(isModEnabled(
'eventorganization') ?
' <span class="classuseorganizeevent">('.$langs->trans(
"Project").
')</span>' :
'').
'</td><td>';
1153 print
$form->selectDate($object->date_start ? $object->date_start : -1,
'projectstart', 0, 0, 0,
'', 1, 0);
1154 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
1155 print
$form->selectDate($object->date_end ? $object->date_end : -1,
'projectend', 0, 0, 0,
'', 1, 0);
1156 $object->getLinesArray(
null, 0);
1157 if (!empty($object->usage_task) && !empty($object->lines)) {
1158 print
' <span id="divreportdate" class="hidden"> <input type="checkbox" class="valignmiddle" id="reportdate" name="reportdate" value="yes" ';
1159 if ($comefromclone) {
1162 print
'/><label for="reportdate" class="valignmiddle opacitymedium">'.$langs->trans(
"ProjectReportDate").
'</label></span>';
1168 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Date").
' ('.$langs->trans(
"Event").
')</td><td>';
1169 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);
1170 print
' <span class="opacitymedium"> '.$langs->trans(
"to").
' </span> ';
1171 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);
1175 print
'<tr class="classuseorganizeevent"><td>'.$langs->trans(
"Location").
'</td>';
1176 print
'<td><input class="minwidth300 maxwidth500" type="text" name="location" value="'.dol_escape_htmltag(
GETPOSTISSET(
'location') ?
GETPOST(
'location') : $object->location).
'"></td>';
1181 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
1183 $doleditor =
new DolEditor(
'description', $object->description,
'', 90,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_3,
'90%');
1184 $doleditor->Create();
1189 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
1190 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_PROJECT,
'',
'parent', 64, 0, 1);
1192 $cats = $c->containing($object->id, Categorie::TYPE_PROJECT);
1193 foreach ($cats as $cat) {
1194 $arrayselected[] = $cat->id;
1196 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0,
'0');
1202 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
1203 print $hookmanager->resPrint;
1204 if (empty($reshook)) {
1205 print $object->showOptionals($extrafields,
'edit');
1210 print
dol_get_fiche_head($head,
'project', $langs->trans(
"Project"), -1, ($object->public ?
'projectpub' :
'project'));
1214 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1216 $morehtmlref =
'<div class="refidno">';
1219 $morehtmlref .=
'<br>';
1221 if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
1222 $morehtmlref .= $object->thirdparty->getNomUrl(1,
'project');
1224 $morehtmlref .=
'</div>';
1227 if (empty($user->rights->projet->all->lire)) {
1228 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
1229 $object->next_prev_filter =
" rowid IN (".$db->sanitize(count($objectsListId) ? join(
',', array_keys($objectsListId)) :
'0').
")";
1232 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1234 print
'<div class="fichecenter">';
1235 print
'<div class="fichehalfleft">';
1236 print
'<div class="underbanner clearboth"></div>';
1238 print
'<table class="border tableforfield centpercent">';
1241 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) ||
isModEnabled(
'eventorganization')) {
1242 print
'<tr><td class="tdtop">';
1243 print $langs->trans(
"Usage");
1246 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
1247 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'> ';
1248 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
1249 print
$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
1252 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
1253 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')).
'> ';
1254 $htmltext = $langs->trans(
"ProjectFollowTasks");
1255 print
$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
1258 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
1259 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"' :
'')).
'> ';
1260 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
1261 print
$form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
1266 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"' :
'')).
'> ';
1267 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
1268 print
$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
1274 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
1275 if ($object->public) {
1276 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
1277 print $langs->trans(
'SharedProject');
1279 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
1280 print $langs->trans(
'PrivateProject');
1284 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && !empty($object->usage_opportunity)) {
1286 print
'<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
1287 $code =
dol_getIdFromCode($db, $object->opp_status,
'c_lead_status',
'rowid',
'code');
1289 print $langs->trans(
"OppStatus".$code);
1293 print
' <span title="'.$langs->trans(
"OpportunityProbability").
'"> / ';
1294 if (strcmp($object->opp_percent,
'')) {
1295 print
price($object->opp_percent, 0, $langs, 1, 0).
' %';
1297 print
'</span></td></tr>';
1300 print
'<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
1301 if (strcmp($object->opp_amount,
'')) {
1302 print
'<span class="amount">'.price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency).
'</span>';
1303 if (strcmp($object->opp_percent,
'')) {
1304 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>';
1311 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
1312 if (!is_null($object->budget_amount) && strcmp($object->budget_amount,
'')) {
1313 print
'<span class="amount">'.price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
1318 print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
1320 print ($start ? $start :
'?');
1322 print
' <span class="opacitymedium">-</span> ';
1323 print ($end ? $end :
'?');
1324 if ($object->hasDelay()) {
1331 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1336 print
'<div class="fichehalfright">';
1337 print
'<div class="underbanner clearboth"></div>';
1339 print
'<table class="border tableforfield centpercent">';
1342 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
1348 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
1349 print
$form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
1358 print
'<div class="clearboth"></div>';
1363 if ($action ==
'edit' && $userWrite > 0) {
1364 print
$form->buttonsSaveCancel();
1370 print
'<script type="text/javascript">
1371 jQuery(document).ready(function() {
1372 jQuery("#usage_task").change(function() {
1373 console.log("We click on usage task "+jQuery("#usage_task").is(":checked"));
1374 if (! jQuery("#usage_task").is(":checked")) {
1375 jQuery("#usage_bill_time").prop("checked", false);
1379 jQuery("#usage_bill_time").change(function() {
1380 console.log("We click on usage to bill time");
1381 if (jQuery("#usage_bill_time").is(":checked")) {
1382 jQuery("#usage_task").prop("checked", true);
1386 jQuery("#projectstart").change(function() {
1387 console.log("We modify the start date");
1388 jQuery("#divreportdate").show();
1394 if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
1396 $defaultcheckedwhenoppclose = 1;
1397 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
1398 $defaultcheckedwhenoppclose = 0;
1401 print
'<!-- Javascript to manage opportunity status change -->';
1402 print
'<script type="text/javascript">
1403 jQuery(document).ready(function() {
1404 function change_percent()
1406 var element = jQuery("#opp_status option:selected");
1407 var defaultpercent = element.attr("defaultpercent");
1408 var defaultcloseproject = '.((int) $defaultcheckedwhenoppclose).
';
1409 var elemcode = element.attr("elemcode");
1410 var oldpercent = \''.
dol_escape_js($object->opp_percent).
'\';
1412 console.log(
"We select "+elemcode);
1415 var closeproject = 0;
1416 if (elemcode == \
'LOST\') closeproject = 1;
1417 if (elemcode == \'WON\') closeproject = defaultcloseproject;
1418 if (closeproject) jQuery("#inputcloseproject").prop("checked", true);
1419 else jQuery("#inputcloseproject").prop("checked", false);
1421 /* Make the close project checkbox visible or not */
1422 console.log("closeproject="+closeproject);
1423 if (elemcode == \'WON\' || elemcode == \'LOST\')
1425 jQuery("#divtocloseproject").show();
1429 jQuery("#divtocloseproject").hide();
1432 /* Change percent with default percent (defaultpercent) if new status (defaultpercent) is higher than current (jQuery("#opp_percent").val()) */
1433 if (oldpercent != \'\' && (parseFloat(defaultpercent) < parseFloat(oldpercent)))
1435 console.log("oldpercent="+oldpercent+" defaultpercent="+defaultpercent+" def < old");
1436 if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') {
1437 jQuery("#oldopppercent").text(\' - '.
dol_escape_js($langs->transnoentities(
"PreviousValue")).
': \'+price2numjs(oldpercent)+\' %\');
1440 if (parseFloat(oldpercent) != 100 && elemcode != \'LOST\') { jQuery("#opp_percent").val(oldpercent); }
1441 else { jQuery("#opp_percent").val(price2numjs(defaultpercent)); }
1445 console.log("oldpercent="+oldpercent+" defaultpercent="+defaultpercent);
1446 if ((parseFloat(jQuery("#opp_percent").val()) < parseFloat(defaultpercent)));
1448 if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') jQuery("#oldopppercent").text(\' - '.
dol_escape_js($langs->transnoentities(
"PreviousValue")).
': \'+price2numjs(oldpercent)+\' %\');
1449 jQuery("#opp_percent").val(price2numjs(defaultpercent));
1454 jQuery("#opp_status").change(function() {
1466 print
'<div class="tabsAction">';
1468 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters, $object, $action);
1470 if (empty($reshook)) {
1471 if ($action !=
"edit" && $action !=
'presend') {
1481 if (empty($user->socid)) {
1483 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend&token='.
newToken().
'&id='.$object->id.
'&mode=init#formmailbeforetitle',
'');
1503 if ($userWrite > 0) {
1504 print
dolGetButtonAction(
'', $langs->trans(
'SetToDraft'),
'default', $_SERVER[
"PHP_SELF"].
'?action=confirm_setdraft&confirm=yes&token='.
newToken().
'&id='.$object->id,
'');
1506 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'SetToDraft'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1513 if ($userWrite > 0) {
1514 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'&id='.$object->id,
'');
1516 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Modify'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1522 if ($userWrite > 0) {
1523 print
dolGetButtonAction(
'', $langs->trans(
'Validate'),
'default', $_SERVER[
"PHP_SELF"].
'?action=validate&token='.
newToken().
'&id='.$object->id,
'');
1525 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1531 if ($userWrite > 0) {
1532 print
dolGetButtonAction(
'', $langs->trans(
'Close'),
'default', $_SERVER[
"PHP_SELF"].
'?action=close&token='.
newToken().
'&id='.$object->id,
'');
1534 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Close'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1540 if ($userWrite > 0) {
1541 print
dolGetButtonAction(
'', $langs->trans(
'ReOpen'),
'default', $_SERVER[
"PHP_SELF"].
'?action=reopen&token='.
newToken().
'&id='.$object->id,
'');
1543 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'ReOpen'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1548 if (!empty($conf->global->PROJECT_SHOW_CREATE_OBJECT_BUTTON)) {
1549 print
'<div class="dropdown inline-block">';
1550 print
'<a style="margin-right: auto;"class="dropdown-toggle butAction" data-toggle="dropdown">'.$langs->trans(
"Create").
'</a>';
1551 print
'<div class="dropdown-menu">';
1552 print
'<div class="dropdown-global-search-button-list" >';
1553 if (
isModEnabled(
"propal") && $user->rights->propal->creer) {
1554 $langs->load(
"propal");
1555 print
dolGetButtonAction(
'', $langs->trans(
'AddProp'),
'default', DOL_URL_ROOT.
'/comm/propal/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid,
'', 1, array(
'isDropDown' =>
true));
1557 if (
isModEnabled(
'commande') && $user->rights->commande->creer) {
1558 $langs->load(
"orders");
1559 print
dolGetButtonAction(
'', $langs->trans(
'CreateOrder'),
'default', DOL_URL_ROOT.
'/commande/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid,
'', 1, array(
'isDropDown' =>
true));
1561 if (
isModEnabled(
'facture') && $user->rights->facture->creer) {
1562 $langs->load(
"bills");
1563 print
dolGetButtonAction(
'', $langs->trans(
'CreateBill'),
'default', DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid,
'', 1, array(
'isDropDown' =>
true));
1565 if (
isModEnabled(
'supplier_proposal') && $user->rights->supplier_proposal->creer) {
1566 $langs->load(
"supplier_proposal");
1567 print
dolGetButtonAction(
'', $langs->trans(
'AddSupplierProposal'),
'default', DOL_URL_ROOT.
'/supplier_proposal/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid,
'', 1, array(
'isDropDown' =>
true));
1569 if (
isModEnabled(
"supplier_order") && ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer)) {
1570 $langs->load(
"suppliers");
1571 print
dolGetButtonAction(
'', $langs->trans(
'AddSupplierOrder'),
'default', DOL_URL_ROOT.
'/fourn/commande/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid,
'', 1, array(
'isDropDown' =>
true));
1573 if (
isModEnabled(
"supplier_invoice") && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) {
1574 $langs->load(
"suppliers");
1575 print
dolGetButtonAction(
'', $langs->trans(
'AddSupplierInvoice'),
'default', DOL_URL_ROOT.
'/fourn/facture/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid,
'', 1, array(
'isDropDown' =>
true));
1577 if (
isModEnabled(
'ficheinter') && $user->rights->ficheinter->creer) {
1578 $langs->load(
"interventions");
1579 print
dolGetButtonAction(
'', $langs->trans(
'AddIntervention'),
'default', DOL_URL_ROOT.
'/fichinter/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid,
'', 1, array(
'isDropDown' =>
true));
1581 if (
isModEnabled(
'contrat') && $user->rights->contrat->creer) {
1582 $langs->load(
"contracts");
1583 print
dolGetButtonAction(
'', $langs->trans(
'AddContract'),
'default', DOL_URL_ROOT.
'/contrat/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid,
'', 1, array(
'isDropDown' =>
true));
1585 if (
isModEnabled(
'expensereport') && $user->rights->expensereport->creer) {
1586 $langs->load(
"trips");
1587 print
dolGetButtonAction(
'', $langs->trans(
'AddTrip'),
'default', DOL_URL_ROOT.
'/expensereport/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid,
'', 1, array(
'isDropDown' =>
true));
1589 if (
isModEnabled(
'don') && $user->rights->don->creer) {
1590 $langs->load(
"donations");
1591 print
dolGetButtonAction(
'', $langs->trans(
'AddDonation'),
'default', DOL_URL_ROOT.
'/don/card.php?action=create&projectid='.$object->id.
'&socid='.$object->socid,
'', 1, array(
'isDropDown' =>
true));
1598 if ($user->rights->projet->creer) {
1599 if ($userWrite > 0) {
1600 print
dolGetButtonAction(
'', $langs->trans(
'ToClone'),
'default', $_SERVER[
"PHP_SELF"].
'?action=clone&token='.
newToken().
'&id='.$object->id,
'');
1602 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'ToClone'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1607 if ($user->rights->projet->supprimer || ($object->statut ==
Project::STATUS_DRAFT && $user->rights->projet->creer)) {
1608 if ($userDelete > 0 || ($object->statut ==
Project::STATUS_DRAFT && $user->rights->projet->creer)) {
1609 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.$object->id,
'');
1611 print
dolGetButtonAction($langs->trans(
'NotOwnerOfProject'), $langs->trans(
'Delete'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
1619 if (
GETPOST(
'modelselected')) {
1620 $action =
'presend';
1623 if ($action !=
'presend') {
1624 print
'<div class="fichecenter"><div class="fichehalfleft">';
1625 print
'<a name="builddoc"></a>';
1631 $filedir = $conf->project->multidir_output[$object->entity].
"/".
dol_sanitizeFileName($object->ref);
1632 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1633 $genallowed = ($user->rights->projet->lire && $userAccess > 0);
1634 $delallowed = ($user->rights->projet->creer && $userWrite > 0);
1636 print $formfile->showdocuments(
'project', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 0, 0,
'',
'',
'',
'',
'', $object);
1638 print
'</div><div class="fichehalfright">';
1642 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/projet/messaging.php?id='.$object->id);
1645 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1647 $somethingshown =
$formactions->showactions($object,
'project', 0, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1649 print
'</div></div>';
1653 $modelmail =
'project';
1654 $defaulttopic =
'SendProjectRef';
1655 $diroutput = $conf->project->multidir_output[$object->entity];
1656 $autocopy =
'MAIN_MAIL_AUTOCOPY_PROJECT_TO';
1657 $trackid =
'proj'.$object->id;
1659 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
1663 $reshook = $hookmanager->executeHooks(
'mainCardTabAddMore',
$parameters, $object, $action);
1665 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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
img_help($usehelpcursor=1, $usealttitle=1)
Show help logo with cursor "?".
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='button bordertransp', $backtopagejsfields='')
Return HTML code to output a button to open a dialog popup box.
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.
setEventMessage($mesgs, $style='mesgs')
Set event message in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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...
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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.