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',
'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 $langs->load(
'errors');
141 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
142 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
144} elseif ($action ==
'specimentask') {
145 $modele =
GETPOST(
'module',
'alpha');
148 $project->initAsSpecimen();
153 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
154 foreach ($dirmodels as $reldir) {
155 $file =
dol_buildpath($reldir.
"core/modules/project/task/doc/pdf_".$modele.
".modules.php", 0);
156 if (file_exists($file)) {
157 $classname =
"pdf_".$modele;
162 if ($classname !==
'') {
166 '@phan-var-force ModelePDFTask $module';
169 if (
$module->write_file($project, $langs) > 0) {
170 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=project_task&file=SPECIMEN.pdf");
177 $langs->load(
'errors');
178 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
179 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
181} elseif ($action ==
'set') {
184} elseif ($action ==
'settask') {
187} elseif ($action ==
'del') {
194} elseif ($action ==
'deltask') {
201} elseif ($action ==
'setdoc') {
210} elseif ($action ==
'unsetdoc') {
213} elseif ($action ==
'setdoctask') {
217 $conf->global->PROJECT_TASK_ADDON_PDF = $value;
225} elseif ($action ==
'unsetdoctask') {
228} elseif ($action ==
'setmod') {
233} elseif ($action ==
'setmodtask') {
238} elseif ($action ==
'updateoptions') {
239 if (
GETPOST(
'PROJECT_USE_SEARCH_TO_SELECT')) {
240 $companysearch =
GETPOST(
'activate_PROJECT_USE_SEARCH_TO_SELECT',
'alpha');
242 $conf->global->PROJECT_USE_SEARCH_TO_SELECT = $companysearch;
245 if (
GETPOST(
'PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY')) {
246 $projectToSelect =
GETPOST(
'projectToSelect',
'alpha');
247 dolibarr_set_const($db,
'PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY', $projectToSelect,
'chaine', 0,
'',
$conf->entity);
249 if (
GETPOST(
'PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS')) {
250 $timesheetFreezeDuration =
GETPOST(
'timesheetFreezeDuration',
'alpha');
251 dolibarr_set_const($db,
'PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS', intval($timesheetFreezeDuration),
'chaine', 0,
'',
$conf->entity);
253} elseif (preg_match(
'/^(set|del)_?([A-Z_]+)$/', $action, $reg)) {
256 dol_print_error($db);
264$form =
new Form($db);
266$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
268llxHeader(
"", $langs->trans(
"ProjectsSetup"),
'',
'', 0, 0,
'',
'',
'',
'mod-project page-admin');
270$form =
new Form($db);
272$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>';
273print
load_fiche_titre($langs->trans(
"ProjectsSetup"), $linkback,
'title_setup');
283print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
284print
'<input type="hidden" name="token" value="'.newToken().
'">';
285print
'<input type="hidden" name="action" value="setmainoptions">';
287print
'<table class="noborder centpercent">';
288print
'<tr class="liste_titre">';
289print
"<td>".$langs->trans(
"Parameters").
"</td>\n";
290print
'<td class="right" width="60">'.$langs->trans(
"Value").
'</td>'.
"\n";
291print
'<td width="80"> </td></tr>'.
"\n";
293print
'<tr class="oddeven">';
294print
'<td width="80%">'.$langs->trans(
"ManageOpportunitiesStatus").
'</td>';
295print
'<td width="60" class="right">';
296print ajax_constantonoff(
"PROJECT_USE_OPPORTUNITIES", array(),
null, 0, 0, 1);
297print
'</td><td class="right">';
302print
'<tr class="oddeven">';
303print
'<td width="80%">'.$langs->trans(
"ManageTasks").
'</td>';
304print
'<td width="60" class="right">';
305print ajax_constantonoff(
"PROJECT_HIDE_TASKS", array(),
null, 1);
306print
'</td><td class="right">';
310print
'</table></form>';
321$project->initAsSpecimen();
323printNumberingModuleList(
'project',
'mod_project_',
'PROJECT_ADDON', $langs->trans(
"ProjectsNumberingModules"), $project);
330 $project->initAsSpecimen();
332 printNumberingModuleList(
'project/task',
'mod_task_',
'PROJECT_TASK_ADDON', $langs->trans(
"TasksNumberingModules"), $project,
'setmodtask');
342printDocumentModelList($type,
'project',
'PROJECT_ADDON_PDF', $langs->trans(
"ProjectsModelModule"), array(
343 'Logo' =>
'option_logo',
344),
false,
'', 1,
'unsetdoc');
357 $type =
'project_task';
361 $sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
362 $sql .=
" WHERE type = '".$db->escape($type).
"'";
363 $sql .=
" AND entity = ".((int)
$conf->entity);
365 $resql = $db->query($sql);
368 $num_rows = $db->num_rows($resql);
369 while ($i < $num_rows) {
370 $array = $db->fetch_array($resql);
371 if (is_array($array)) {
372 array_push($def, $array[0]);
377 dol_print_error($db);
380 print
'<div class="div-table-responsive-no-min">';
381 print
'<table class="noborder" width="100%">'.
"\n";
382 print
'<tr class="liste_titre">'.
"\n";
383 print
' <td width="100">'.$langs->trans(
"Name").
"</td>\n";
384 print
" <td>".$langs->trans(
"Description").
"</td>\n";
385 print
'<td class="center" width="60">'.$langs->trans(
"Activated").
"</td>\n";
386 print
'<td class="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
387 print
'<td class="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
388 print
'<td class="center" width="80">'.$langs->trans(
"Preview").
'</td>';
393 foreach ($dirmodels as $reldir) {
394 foreach (array(
'',
'/doc') as $valdir) {
395 $dir =
dol_buildpath($reldir.
"core/modules/project/task/".$valdir);
398 $handle = opendir($dir);
399 if (is_resource($handle)) {
401 while (($file = readdir($handle)) !==
false) {
407 foreach ($filelist as $file) {
408 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
409 if (file_exists($dir.
'/'.$file)) {
413 require_once $dir.
'/'.$file;
415 '@phan-var-force ModelePDFTask $module';
417 $modulequalified = 1;
419 $modulequalified = 0;
422 $modulequalified = 0;
425 if ($modulequalified) {
426 print
'<tr class="oddeven"><td width="100">';
429 if (method_exists(
$module,
'info')) {
437 if (in_array($name, $def)) {
438 print
'<td class="center">'.
"\n";
439 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=deltask&token='.
newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode(
$module->scandir).
'&label='.urlencode(
$module->name).
'">';
440 print img_picto($langs->trans(
"Enabled"),
'switch_on');
444 print
'<td class="center">'.
"\n";
445 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>';
450 print
'<td class="center">';
452 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>';
454 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>';
459 $htmltooltip =
''.$langs->trans(
"Name").
': '.
$module->name;
460 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.(
$module->type ?
$module->type : $langs->trans(
"Unknown"));
462 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.
$module->page_largeur.
'/'.
$module->page_hauteur;
464 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
465 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.yn(
$module->option_logo, 1, 1);
467 print
'<td class="center">';
468 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
472 print
'<td class="center">';
474 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimentask&token='.
newToken().
'&module='.$name.
'">'.img_object($langs->trans(
"Preview"),
'bill').
'</a>';
476 print img_object($langs->transnoentitiesnoconv(
"PreviewNotAvailable"),
'generic');
498$form =
new Form($db);
500print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
501print
'<input type="hidden" name="token" value="'.newToken().
'">';
502print
'<input type="hidden" name="action" value="updateoptions">';
503print
'<input type="hidden" name="page_y" value="">';
505print
'<div class="div-table-responsive-no-min">';
506print
'<table class="noborder centpercent">';
507print
'<tr class="liste_titre">';
508print
"<td>".$langs->trans(
"Parameters").
"</td>\n";
512print
'<tr class="oddeven">';
513print
'<td>'.$langs->trans(
"UseSearchToSelectProject").
'</td>';
514if (!
$conf->use_javascript_ajax) {
515 print
'<td class="nowrap right">';
516 print $langs->trans(
"NotAvailableWhenAjaxDisabled");
519 print
'<td class="right">';
521 0 => array(
'label' => $langs->trans(
"No")),
522 1 => array(
'label' => $langs->trans(
"Yes").
' ('.$langs->trans(
"NumberOfKeyToSearch", 1).
')',
'labelhtml' => $langs->trans(
"Yes").
' <span class="opacitymedium small">('.$langs->trans(
"NumberOfKeyToSearch", 1).
')</span>'),
523 2 => array(
'label' => $langs->trans(
"Yes").
' ('.$langs->trans(
"NumberOfKeyToSearch", 2).
')',
'labelhtml' => $langs->trans(
"Yes").
' <span class="opacitymedium small">('.$langs->trans(
"NumberOfKeyToSearch", 2).
')</span>'),
524 3 => array(
'label' => $langs->trans(
"Yes").
' ('.$langs->trans(
"NumberOfKeyToSearch", 3).
')',
'labelhtml' => $langs->trans(
"Yes").
' <span class="opacitymedium small">('.$langs->trans(
"NumberOfKeyToSearch", 3).
')</span>'),
526 print $form->selectarray(
"activate_PROJECT_USE_SEARCH_TO_SELECT", $arrval,
getDolGlobalString(
"PROJECT_USE_SEARCH_TO_SELECT"));
527 print
'<input type="submit" class="button small reposition" name="PROJECT_USE_SEARCH_TO_SELECT" value="'.$langs->trans(
"Modify").
'">';
532print
'<tr class="oddeven">';
533print
'<td>'.$langs->trans(
"AllowToSelectProjectFromOtherCompany").
'</td>';
534print
'<td class="right">';
535print
'<input type="text" id="projectToSelect" name="projectToSelect" value="' .
getDolGlobalString(
'PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY').
'"/> ';
536print $form->textwithpicto(
'', $langs->trans(
'AllowToLinkFromOtherCompany'));
537print
'<input type="submit" class="button small reposition" name="PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY" value="'.$langs->trans(
"Modify").
'">';
541$key =
'PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE';
542echo
'<tr class="oddeven">',
544$form->textwithpicto($langs->transnoentities($key), $langs->transnoentities($key .
'_help')),
547ajax_constantonoff($key),
551print
'<tr class="oddeven">';
552print
'<td>'.$langs->trans(
"TimesheetPreventAfterFollowingMonths").
'</td>';
553print
'<td class="right">';
554print
'<input type="number" class="width50" id="timesheetFreezeDuration" name="timesheetFreezeDuration" min="0" step="1" value="' .
getDolGlobalString(
'PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS').
'"/> ';
555print
'<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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage projects.
if(! $sortfield) if(! $sortorder) $module
dol_strlen($string, $stringencoding='UTF-8', $binarycount=0)
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.