New: Project module support status of project and end date

This commit is contained in:
Laurent Destailleur 2010-01-04 22:04:04 +00:00
parent 2988b561c9
commit ed56542bff
4 changed files with 56 additions and 15 deletions

View File

@ -54,3 +54,7 @@ AffectedTo=Affected to
CantRemoveProject=This project can't be removed as it is referenced by some other objects (invoice, orders or other). See referers tab.
ValidateProject=Validate projet
ConfirmValidateProject=Are you sure you want to validate this project ?
CloseAProject=Close project
ConfirmCloseAProject=Are you sure you want to close this project ?
ReOpenAProject=Open project
ConfirmReOpenAProject=Are you sure you want to re-open this project ?

View File

@ -53,4 +53,8 @@ NotOwnerOfProject=Non responsable de ce projet privé
AffectedTo=Affecté à
CantRemoveProject=Ce projet ne peut être supprimé car il est référencé par de nombreux objets (factures, commandes ou autre). voir la liste sur l'onglet Reférents.
ValidateProject=Valider projet
ConfirmValidateProject=Etes vous sur de vouloir valider ce projet ?
ConfirmValidateProject=Etes-vous sur de vouloir valider ce projet ?
CloseAProject=Clore projet
ConfirmCloseAProject=Etes-vous sur de vouloir clore ce projet ?
ReOpenAProject=Réouvrir projet
ConfirmReOpenAProject=Etes-vous sur de vouloir rouvrir ce projet ?

View File

@ -333,7 +333,6 @@ class Project extends CommonObject
$sql.= " SET fk_statut = 1";
$sql.= " WHERE rowid = ".$this->id;
$sql.= " AND entity = ".$conf->entity;
$sql.= " AND fk_statut = 0";
dol_syslog("Project::setValid sql=".$sql);
$resql=$this->db->query($sql);
@ -378,7 +377,7 @@ class Project extends CommonObject
{
global $langs, $conf;
if ($this->statut != 1)
if ($this->statut != 2)
{
$this->db->begin();
@ -708,21 +707,25 @@ class Project extends CommonObject
{
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]);
}
if ($mode == 3)
{
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]);
}
if ($mode == 4)
{
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]);
}
if ($mode == 5)
{
if ($statut==0) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
if ($statut==1) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1');
if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]);
}
}

View File

@ -150,17 +150,29 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes')
$project->fetch($_GET["id"]);
$result = $project->setValid($user, $conf->projet->outputdir);
if ($result >= 0)
if ($result <= 0)
{
/* $outputlangs = $langs;
if (! empty($_REQUEST['lang_id']))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
$result=projet_create($db, $projet, $_REQUEST['model'], $outputlangs);
*/ }
else
$mesg='<div class="error">'.$project->error.'</div>';
}
}
if ($_REQUEST['action'] == 'confirm_close' && $_REQUEST['confirm'] == 'yes')
{
$project = new Project($db);
$project->fetch($_GET["id"]);
$result = $project->setClose($user, $conf->projet->outputdir);
if ($result <= 0)
{
$mesg='<div class="error">'.$project->error.'</div>';
}
}
if ($_REQUEST['action'] == 'confirm_reopen' && $_REQUEST['confirm'] == 'yes')
{
$project = new Project($db);
$project->fetch($_GET["id"]);
$result = $project->setValid($user, $conf->projet->outputdir);
if ($result <= 0)
{
$mesg='<div class="error">'.$project->error.'</div>';
}
@ -270,6 +282,18 @@ else
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$projet->id, $langs->trans('ValidateProject'), $langs->trans('ConfirmValidateProject'), 'confirm_validate','',0,1);
if ($ret == 'html') print '<br>';
}
// Confirmation close
if ($_GET["action"] == 'close')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("CloseAProject"),$langs->trans("ConfirmCloseAProject"),"confirm_close",'','',1);
if ($ret == 'html') print '<br>';
}
// Confirmation reopen
if ($_GET["action"] == 'reopen')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("ReOpenAProject"),$langs->trans("ConfirmReOpenAProject"),"confirm_reopen",'','',1);
if ($ret == 'html') print '<br>';
}
// Confirmation delete
if ($_GET["action"] == 'delete')
{
@ -377,17 +401,23 @@ else
}
// Modify
if ($user->rights->projet->creer)
if ($projet->statut != 2 && $user->rights->projet->creer)
{
print '<a class="butAction" href="fiche.php?id='.$projet->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>';
}
// Close
if ($user->rights->projet->creer)
if ($projet->statut != 2 && $user->rights->projet->creer)
{
print '<a class="butAction" href="fiche.php?id='.$projet->id.'&amp;action=close">'.$langs->trans("Close").'</a>';
}
// Reopen
if ($projet->statut == 2 && $user->rights->projet->creer)
{
print '<a class="butAction" href="fiche.php?id='.$projet->id.'&amp;action=reopen">'.$langs->trans("ReOpen").'</a>';
}
// Delete
if ($user->rights->projet->supprimer)
{