Can remove a project if project has task.

This commit is contained in:
Laurent Destailleur 2011-05-18 12:33:38 +00:00
parent af0a8fccc8
commit ea26c7a4c4
5 changed files with 14 additions and 5 deletions

View File

@ -49,7 +49,8 @@ For users:
- New: task #11003: checkbox on checks to deposit - New: task #11003: checkbox on checks to deposit
- New: Numbering module for invoice use same number for invoice - New: Numbering module for invoice use same number for invoice
and credit note if mask is same. and credit note if mask is same.
- New: Add status into export. Add default language into export. - New: Add status into export. Add default language into export.
- New: Can remove a project if project has tasks.
- Fix: Better Postgresql compatibility. - Fix: Better Postgresql compatibility.
For developers: For developers:

View File

@ -83,6 +83,7 @@ NoTasks=No tasks for this project
LinkedToAnotherCompany=Linked to other third party LinkedToAnotherCompany=Linked to other third party
TaskIsNotAffectedToYou=Task not allocated to you TaskIsNotAffectedToYou=Task not allocated to you
ErrorTimeSpentIsEmpty=Time spent is empty ErrorTimeSpentIsEmpty=Time spent is empty
ThisWillAlsoRemoveTasks=This action will also delete all tasks of project (<b>%s</b> tasks at the moment) and all inputs of time spent.
##### Types de contacts ##### ##### Types de contacts #####
TypeContact_project_internal_PROJECTLEADER=Project leader TypeContact_project_internal_PROJECTLEADER=Project leader
TypeContact_project_external_PROJECTLEADER=Project leader TypeContact_project_external_PROJECTLEADER=Project leader

View File

@ -83,6 +83,7 @@ NoTasks=Aucune tâche pour ce projet
LinkedToAnotherCompany=Liés à autre société LinkedToAnotherCompany=Liés à autre société
TaskIsNotAffectedToYou=Tâche qui ne vous est pas affectée TaskIsNotAffectedToYou=Tâche qui ne vous est pas affectée
ErrorTimeSpentIsEmpty=Le temps consommé n'est pas renseigné ErrorTimeSpentIsEmpty=Le temps consommé n'est pas renseigné
ThisWillAlsoRemoveTasks=Cette opération détruira également les taches du projet (<b>%s</b> taches actuellement) et le suivi des consommés.
##### Types de contacts ##### ##### Types de contacts #####
TypeContact_project_internal_PROJECTLEADER=Chef de projet TypeContact_project_internal_PROJECTLEADER=Chef de projet
TypeContact_project_external_PROJECTLEADER=Chef de projet TypeContact_project_external_PROJECTLEADER=Chef de projet

View File

@ -281,9 +281,9 @@ class Project extends CommonObject
} }
/** /**
* \brief Return list of projects * Return list of projects
* \param socid To filter on a particular third party * @param socid To filter on a particular third party
* \return array Liste of projects * @return array Liste of projects
*/ */
function liste_array($socid='') function liste_array($socid='')
{ {

View File

@ -27,6 +27,7 @@
require("../main.inc.php"); require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php"); require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
require_once(DOL_DOCUMENT_ROOT."/projet/class/task.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/includes/modules/project/modules_project.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/project/modules_project.php");
@ -364,7 +365,12 @@ else
// Confirmation delete // Confirmation delete
if ($_GET["action"] == 'delete') if ($_GET["action"] == 'delete')
{ {
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$project->id,$langs->trans("DeleteAProject"),$langs->trans("ConfirmDeleteAProject"),"confirm_delete",'','',1); $text=$langs->trans("ConfirmDeleteAProject");
$task=new Task($db);
$taskarray=$task->getTasksArray(0,0,$project->id,0,0);
$nboftask=sizeof($taskarray);
if ($nboftask) $text.='<br>'.img_warning().' '.$langs->trans("ThisWillAlsoRemoveTasks",$nboftask);
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$project->id,$langs->trans("DeleteAProject"),$text,"confirm_delete",'','',1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }