diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index a5555f85c82..4bb9fcf2dec 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -235,3 +235,4 @@ WarningYourLoginWasModifiedPleaseLogin=Your login was modified. For security pur WarningAnEntryAlreadyExistForTransKey=An entry already exists for the translation key for this language WarningNumberOfRecipientIsRestrictedInMassAction=Warning, number of different recipient is limited to %s when using the mass actions on lists WarningDateOfLineMustBeInExpenseReportRange=Warning, the date of line is not in the range of the expense report +WarningProjectClosed=Project is closed. You must re-open it before. \ No newline at end of file diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 2f06f698b14..e8e40dba814 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -450,108 +450,118 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print load_fiche_titre($langs->trans("NewTask"), '', 'title_project'); - print '
'; - print ''; - print ''; - print ''; - if (! empty($object->id)) print ''; - - dol_fiche_head(''); - - print ''; - - $defaultref=''; - $obj = empty($conf->global->PROJECT_TASK_ADDON)?'mod_task_simple':$conf->global->PROJECT_TASK_ADDON; - if (! empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.".php")) + if ($object->statut == Project::STATUS_CLOSED) { - require_once DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.'.php'; - $modTask = new $obj; - $defaultref = $modTask->getNextValue($object->thirdparty,null); - } - - if (is_numeric($defaultref) && $defaultref <= 0) $defaultref=''; - - // Ref - print ''; - - print ''; - - // List of projects - print ''; - - print ''; - - // Date start - print ''; - - // Date end - print ''; - - // Planned workload - print ''; - - // Progress - print ''; - - // Description - print ''; - print ''; - - // Other options - $parameters=array(); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$taskstatic,$action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - if (empty($reshook) && ! empty($extrafields_task->attribute_label)) - { - print $taskstatic->showOptionals($extrafields_task,'edit'); // Do not use $object here that is object of project - } - - print '
'.$langs->trans("Ref").''; - if (empty($duplicate_code_error)) - { - print (GETPOSTISSET("ref")?GETPOST("ref",'alpha'):$defaultref); + print '
'; + $langs->load("errors"); + print $langs->trans("WarningProjectClosed"); + print '
'; } else { - print $defaultref; + print ''; + print ''; + print ''; + print ''; + if (! empty($object->id)) print ''; + + dol_fiche_head(''); + + print ''; + + $defaultref=''; + $obj = empty($conf->global->PROJECT_TASK_ADDON)?'mod_task_simple':$conf->global->PROJECT_TASK_ADDON; + if (! empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.".php")) + { + require_once DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.'.php'; + $modTask = new $obj; + $defaultref = $modTask->getNextValue($object->thirdparty,null); + } + + if (is_numeric($defaultref) && $defaultref <= 0) $defaultref=''; + + // Ref + print ''; + + print ''; + + // List of projects + print ''; + + print ''; + + // Date start + print ''; + + // Date end + print ''; + + // Planned workload + print ''; + + // Progress + print ''; + + // Description + print ''; + print ''; + + // Other options + $parameters=array(); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$taskstatic,$action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + if (empty($reshook) && ! empty($extrafields_task->attribute_label)) + { + print $taskstatic->showOptionals($extrafields_task,'edit'); // Do not use $object here that is object of project + } + + print '
'.$langs->trans("Ref").''; + if (empty($duplicate_code_error)) + { + print (GETPOSTISSET("ref")?GETPOST("ref",'alpha'):$defaultref); + } + else + { + print $defaultref; + } + print ''; + print '
'.$langs->trans("Label").''; + print ''; + print '
'.$langs->trans("ChildOfProjectTask").''; + print $formother->selectProjectTasks(GETPOST('task_parent'), $projectid?$projectid:$object->id, 'task_parent', 0, 0, 1, 1, 0, '0,1', 'maxwidth500'); + print '
'.$langs->trans("AffectedTo").''; + $contactsofproject=(! empty($object->id)?$object->getListContactId('internal'):''); + if (is_array($contactsofproject) && count($contactsofproject)) + { + print $form->select_dolusers($user->id, 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, '', 'maxwidth300'); + } + else + { + print $langs->trans("NoUserAssignedToTheProject"); + } + print '
'.$langs->trans("DateStart").''; + print $form->selectDate(($date_start?$date_start:''), 'dateo', 1, 1, 0, '', 1, 1); + print '
'.$langs->trans("DateEnd").''; + print $form->selectDate(($date_end?$date_end:-1),'datee', -1, 1, 0, '', 1, 1); + print '
'.$langs->trans("PlannedWorkload").''; + print $form->select_duration('planned_workload', $planned_workload?$planned_workload : 0, 0, 'text'); + print '
'.$langs->trans("ProgressDeclared").''; + print $formother->select_percent($progress,'progress',0,5,0,100,1); + print '
'.$langs->trans("Description").''; + print ''; + print '
'; + + dol_fiche_end(); + + print '
'; + print ''; + print '     '; + print ''; + print '
'; + + print ''; } - print ''; - print '
'.$langs->trans("Label").''; - print ''; - print '
'.$langs->trans("ChildOfProjectTask").''; - print $formother->selectProjectTasks(GETPOST('task_parent'), $projectid?$projectid:$object->id, 'task_parent', 0, 0, 1, 1, 0, '0,1', 'maxwidth500'); - print '
'.$langs->trans("AffectedTo").''; - $contactsofproject=(! empty($object->id)?$object->getListContactId('internal'):''); - if (is_array($contactsofproject) && count($contactsofproject)) - { - print $form->select_dolusers($user->id, 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, '', 'maxwidth300'); - } - else - { - print $langs->trans("NoUserAssignedToTheProject"); - } - print '
'.$langs->trans("DateStart").''; - print $form->selectDate(($date_start?$date_start:''), 'dateo', 1, 1, 0, '', 1, 1); - print '
'.$langs->trans("DateEnd").''; - print $form->selectDate(($date_end?$date_end:-1),'datee', -1, 1, 0, '', 1, 1); - print '
'.$langs->trans("PlannedWorkload").''; - print $form->select_duration('planned_workload', $planned_workload?$planned_workload : 0, 0, 'text'); - print '
'.$langs->trans("ProgressDeclared").''; - print $formother->select_percent($progress,'progress',0,5,0,100,1); - print '
'.$langs->trans("Description").''; - print ''; - print '
'; - - dol_fiche_end(); - - print '
'; - print ''; - print '     '; - print ''; - print '
'; - - print ''; } else if ($id > 0 || ! empty($ref)) {