33require
'../../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
49$langs->loadLangs(array(
'admin',
'errors',
'other',
'projects'));
55$action =
GETPOST(
'action',
'aZ09');
56$modulepart =
GETPOST(
'modulepart',
'aZ09');
58$value =
GETPOST(
'value',
'alpha');
59$label =
GETPOST(
'label',
'alpha');
60$scandir =
GETPOST(
'scan_dir',
'alpha');
68include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
70if ($action ==
'updateMask') {
71 $maskconstproject =
GETPOST(
'maskconstproject',
'aZ09');
72 $maskproject =
GETPOST(
'maskproject',
'alpha');
75 if ($maskconstproject && preg_match(
'/_MASK$/', $maskconstproject)) {
84 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
86 setEventMessages($langs->trans(
"Error"),
null,
'errors');
90if ($action ==
'updateMaskTask') {
91 $maskconstmasktask =
GETPOST(
'maskconsttask',
'aZ09');
92 $masktaskt =
GETPOST(
'masktask',
'alpha');
94 if ($maskconstmasktask && preg_match(
'/_MASK$/', $maskconstmasktask)) {
103 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
105 setEventMessages($langs->trans(
"Error"),
null,
'errors');
107} elseif ($action ==
'specimen') {
108 $modele =
GETPOST(
'module',
'alpha');
111 $project->initAsSpecimen();
116 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
117 foreach ($dirmodels as $reldir) {
118 $file =
dol_buildpath($reldir.
"core/modules/project/doc/pdf_".$modele.
".modules.php", 0);
119 if (file_exists($file)) {
120 $classname =
"pdf_".$modele;
125 if ($classname !==
'') {
129 '@phan-var-force ModelePDFProjects $module';
132 if (
$module->write_file($project, $langs) > 0) {
133 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=project&file=SPECIMEN.pdf");
140 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
141 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
143} elseif ($action ==
'specimentask') {
144 $modele =
GETPOST(
'module',
'alpha');
147 $project->initAsSpecimen();
152 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
153 foreach ($dirmodels as $reldir) {
154 $file =
dol_buildpath($reldir.
"core/modules/project/task/doc/pdf_".$modele.
".modules.php", 0);
155 if (file_exists($file)) {
156 $classname =
"pdf_".$modele;
161 if ($classname !==
'') {
165 '@phan-var-force ModelePDFTask $module';
168 if (
$module->write_file($project, $langs) > 0) {
169 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=project_task&file=SPECIMEN.pdf");
176 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
177 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
179} elseif ($action ==
'set') {
182} elseif ($action ==
'settask') {
185} elseif ($action ==
'del') {
192} elseif ($action ==
'deltask') {
199} elseif ($action ==
'setdoc') {
208} elseif ($action ==
'unsetdoc') {
211} elseif ($action ==
'setdoctask') {
215 $conf->global->PROJECT_TASK_ADDON_PDF = $value;
223} elseif ($action ==
'unsetdoctask') {
226} elseif ($action ==
'setmod') {
231} elseif ($action ==
'setmodtask') {
236} elseif ($action ==
'updateoptions') {
237 if (
GETPOST(
'PROJECT_USE_SEARCH_TO_SELECT')) {
238 $companysearch =
GETPOST(
'activate_PROJECT_USE_SEARCH_TO_SELECT',
'alpha');
240 $conf->global->PROJECT_USE_SEARCH_TO_SELECT = $companysearch;
243 if (
GETPOST(
'PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY')) {
244 $projectToSelect =
GETPOST(
'projectToSelect',
'alpha');
245 dolibarr_set_const($db,
'PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY', $projectToSelect,
'chaine', 0,
'',
$conf->entity);
247 if (
GETPOST(
'PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS')) {
248 $timesheetFreezeDuration =
GETPOST(
'timesheetFreezeDuration',
'alpha');
249 dolibarr_set_const($db,
'PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS', intval($timesheetFreezeDuration),
'chaine', 0,
'',
$conf->entity);
251} elseif (preg_match(
'/^(set|del)_?([A-Z_]+)$/', $action, $reg)) {
254 dol_print_error($db);
262$form =
new Form($db);
264$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
266llxHeader(
"", $langs->trans(
"ProjectsSetup"),
'',
'', 0, 0,
'',
'',
'',
'mod-project page-admin');
268$form =
new Form($db);
270$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
271print
load_fiche_titre($langs->trans(
"ProjectsSetup"), $linkback,
'title_setup');
281print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
282print
'<input type="hidden" name="token" value="'.newToken().
'">';
283print
'<input type="hidden" name="action" value="setmainoptions">';
285print
'<table class="noborder centpercent">';
286print
'<tr class="liste_titre">';
287print
"<td>".$langs->trans(
"Parameters").
"</td>\n";
288print
'<td class="right" width="60">'.$langs->trans(
"Value").
'</td>'.
"\n";
289print
'<td width="80"> </td></tr>'.
"\n";
291print
'<tr class="oddeven">';
292print
'<td width="80%">'.$langs->trans(
"ManageOpportunitiesStatus").
'</td>';
293print
'<td width="60" class="right">';
294print ajax_constantonoff(
"PROJECT_USE_OPPORTUNITIES", array(),
null, 0, 0, 1);
295print
'</td><td class="right">';
300print
'<tr class="oddeven">';
301print
'<td width="80%">'.$langs->trans(
"ManageTasks").
'</td>';
302print
'<td width="60" class="right">';
303print ajax_constantonoff(
"PROJECT_HIDE_TASKS", array(),
null, 1);
304print
'</td><td class="right">';
308print
'</table></form>';
319$project->initAsSpecimen();
321printNumberingModuleList(
'project',
'mod_project_',
'PROJECT_ADDON', $langs->trans(
"ProjectsNumberingModules"), $project);
328 $project->initAsSpecimen();
330 printNumberingModuleList(
'project/task',
'mod_task_',
'PROJECT_TASK_ADDON', $langs->trans(
"TasksNumberingModules"), $project,
'setmodtask');
340printDocumentModelList($type,
'project',
'PROJECT_ADDON_PDF', $langs->trans(
"ProjectsModelModule"), array(
341 'Logo' =>
'option_logo',
342),
false,
'', 1,
'unsetdoc');
355 $type =
'project_task';
359 $sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
360 $sql .=
" WHERE type = '".$db->escape($type).
"'";
361 $sql .=
" AND entity = ".((int)
$conf->entity);
363 $resql = $db->query($sql);
366 $num_rows = $db->num_rows($resql);
367 while ($i < $num_rows) {
368 $array = $db->fetch_array($resql);
369 if (is_array($array)) {
370 array_push($def, $array[0]);
375 dol_print_error($db);
378 print
'<div class="div-table-responsive-no-min">';
379 print
'<table class="noborder" width="100%">'.
"\n";
380 print
'<tr class="liste_titre">'.
"\n";
381 print
' <td width="100">'.$langs->trans(
"Name").
"</td>\n";
382 print
" <td>".$langs->trans(
"Description").
"</td>\n";
383 print
'<td class="center" width="60">'.$langs->trans(
"Activated").
"</td>\n";
384 print
'<td class="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
385 print
'<td class="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
386 print
'<td class="center" width="80">'.$langs->trans(
"Preview").
'</td>';
391 foreach ($dirmodels as $reldir) {
392 foreach (array(
'',
'/doc') as $valdir) {
393 $dir =
dol_buildpath($reldir.
"core/modules/project/task/".$valdir);
396 $handle = opendir($dir);
397 if (is_resource($handle)) {
399 while (($file = readdir($handle)) !==
false) {
405 foreach ($filelist as $file) {
406 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
407 if (file_exists($dir.
'/'.$file)) {
411 require_once $dir.
'/'.$file;
413 '@phan-var-force ModelePDFTask $module';
415 $modulequalified = 1;
417 $modulequalified = 0;
420 $modulequalified = 0;
423 if ($modulequalified) {
424 print
'<tr class="oddeven"><td width="100">';
427 if (method_exists(
$module,
'info')) {
435 if (in_array($name, $def)) {
436 print
'<td class="center">'.
"\n";
437 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=deltask&token='.
newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode(
$module->scandir).
'&label='.urlencode(
$module->name).
'">';
438 print img_picto($langs->trans(
"Enabled"),
'switch_on');
442 print
'<td class="center">'.
"\n";
443 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=settask&token='.
newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode(
$module->scandir).
'&label='.urlencode(
$module->name).
'">'.img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
448 print
'<td class="center">';
450 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=unsetdoctask&token='.
newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode(
$module->scandir).
'&label='.urlencode(
$module->name).
'" alt="'.$langs->trans(
"Default").
'">'.img_picto($langs->trans(
"Disabled"),
'on').
'</a>';
452 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoctask&token='.
newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode(
$module->scandir).
'&label='.urlencode(
$module->name).
'" alt="'.$langs->trans(
"Default").
'">'.img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
457 $htmltooltip =
''.$langs->trans(
"Name").
': '.
$module->name;
458 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.(
$module->type ?
$module->type : $langs->trans(
"Unknown"));
460 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.
$module->page_largeur.
'/'.
$module->page_hauteur;
462 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
463 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.yn(
$module->option_logo, 1, 1);
465 print
'<td class="center">';
466 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
470 print
'<td class="center">';
472 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimentask&token='.
newToken().
'&module='.$name.
'">'.img_object($langs->trans(
"Preview"),
'bill').
'</a>';
474 print img_object($langs->transnoentitiesnoconv(
"PreviewNotAvailable"),
'generic');
496$form =
new Form($db);
498print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
499print
'<input type="hidden" name="token" value="'.newToken().
'">';
500print
'<input type="hidden" name="action" value="updateoptions">';
501print
'<input type="hidden" name="page_y" value="">';
503print
'<div class="div-table-responsive-no-min">';
504print
'<table class="noborder centpercent">';
505print
'<tr class="liste_titre">';
506print
"<td>".$langs->trans(
"Parameters").
"</td>\n";
510print
'<tr class="oddeven">';
511print
'<td>'.$langs->trans(
"UseSearchToSelectProject").
'</td>';
512if (!
$conf->use_javascript_ajax) {
513 print
'<td class="nowrap right">';
514 print $langs->trans(
"NotAvailableWhenAjaxDisabled");
517 print
'<td class="right">';
519 0 => array(
'label' => $langs->trans(
"No")),
520 1 => array(
'label' => $langs->trans(
"Yes").
' ('.$langs->trans(
"NumberOfKeyToSearch", 1).
')',
'labelhtml' => $langs->trans(
"Yes").
' <span class="opacitymedium small">('.$langs->trans(
"NumberOfKeyToSearch", 1).
')</span>'),
521 2 => array(
'label' => $langs->trans(
"Yes").
' ('.$langs->trans(
"NumberOfKeyToSearch", 2).
')',
'labelhtml' => $langs->trans(
"Yes").
' <span class="opacitymedium small">('.$langs->trans(
"NumberOfKeyToSearch", 2).
')</span>'),
522 3 => array(
'label' => $langs->trans(
"Yes").
' ('.$langs->trans(
"NumberOfKeyToSearch", 3).
')',
'labelhtml' => $langs->trans(
"Yes").
' <span class="opacitymedium small">('.$langs->trans(
"NumberOfKeyToSearch", 3).
')</span>'),
524 print $form->selectarray(
"activate_PROJECT_USE_SEARCH_TO_SELECT", $arrval,
getDolGlobalString(
"PROJECT_USE_SEARCH_TO_SELECT"));
525 print
'<input type="submit" class="button small reposition" name="PROJECT_USE_SEARCH_TO_SELECT" value="'.$langs->trans(
"Modify").
'">';
530print
'<tr class="oddeven">';
531print
'<td>'.$langs->trans(
"AllowToSelectProjectFromOtherCompany").
'</td>';
532print
'<td class="right">';
533print
'<input type="text" id="projectToSelect" name="projectToSelect" value="' .
getDolGlobalString(
'PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY').
'"/> ';
534print $form->textwithpicto(
'', $langs->trans(
'AllowToLinkFromOtherCompany'));
535print
'<input type="submit" class="button small reposition" name="PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY" value="'.$langs->trans(
"Modify").
'">';
539$key =
'PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE';
540echo
'<tr class="oddeven">',
542$form->textwithpicto($langs->transnoentities($key), $langs->transnoentities($key .
'_help')),
545ajax_constantonoff($key),
549print
'<tr class="oddeven">';
550print
'<td>'.$langs->trans(
"TimesheetPreventAfterFollowingMonths").
'</td>';
551print
'<td class="right">';
552print
'<input type="number" class="width50" id="timesheetFreezeDuration" name="timesheetFreezeDuration" min="0" step="1" value="' .
getDolGlobalString(
'PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS').
'"/> ';
553print
'<input type="submit" class="button small reposition" name="PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS" value="'.$langs->trans(
"Modify").
'">';
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
delDocumentModel($name, $type)
Delete document model used by doc generator.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage projects.
if(! $sortfield) if(! $sortorder) $module
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
project_admin_prepare_head()
Prepare array with list of tabs.
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.