Feature Clone project (357)

Fix variable date property name, to be compliant with varaible naming
convention (create)
Add feature to shift task date when change project start date (option)
Add project start/end date on Project->Task View
This commit is contained in:
FHenry 2012-04-27 10:32:01 +02:00
parent a34cf11e22
commit 4fd00c50be
6 changed files with 40 additions and 13 deletions

View File

@ -85,6 +85,10 @@ 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. ThisWillAlsoRemoveTasks=This action will also delete all tasks of project (<b>%s</b> tasks at the moment) and all inputs of time spent.
IfNeedToUseOhterObjectKeepEmpty=If some objects (invoice, order, ...), belonging to another third party, must be linked to the project to create, keep this empty to have the project being multi third parties. IfNeedToUseOhterObjectKeepEmpty=If some objects (invoice, order, ...), belonging to another third party, must be linked to the project to create, keep this empty to have the project being multi third parties.
CloneProject=Clone project (associated task will be duplicated too)
ConfirmCloneProject=Are you sure to clone this project ?
ProjectReportDate=Change task date according project start date
ErrorShiftTaskDate=Impossible to shift task date according to new project start date
##### 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

@ -85,6 +85,10 @@ 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 tâches du projet (<b>%s</b> tâches actuellement) et le suivi des consommés. ThisWillAlsoRemoveTasks=Cette opération détruira également les tâches du projet (<b>%s</b> tâches actuellement) et le suivi des consommés.
IfNeedToUseOhterObjectKeepEmpty=Si des objets (facture, commande, ...), appartenant à un autre tiers que celui choisi, doivent être liés au projet à créer, laisser vide afin de laisser le projet multi-tiers. IfNeedToUseOhterObjectKeepEmpty=Si des objets (facture, commande, ...), appartenant à un autre tiers que celui choisi, doivent être liés au projet à créer, laisser vide afin de laisser le projet multi-tiers.
CloneProject=Cloner le projet (les taches associées sont dupliquées également)
ConfirmCloneProject=Êtes-vous sûr de vouloir cloner ce projet ?
ProjectReportDate=Reporter les dates des taches en fonction de la date de départ.
ErrorShiftTaskDate=Une erreur c'est produite dans le report des dates des taches.
##### 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

@ -52,7 +52,7 @@ class Project extends CommonObject
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $DB Database handler
*/ */
function __construct($db) function __construct($db)
{ {
@ -707,7 +707,7 @@ class Project extends CommonObject
{ {
global $user, $langs, $conf; global $user, $langs, $conf;
$now = dol_now(); $now = mktime();
// Charge tableau des produits prodids // Charge tableau des produits prodids
$prodids = array(); $prodids = array();

View File

@ -64,7 +64,7 @@ class Task extends CommonObject
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $DB Database handler
*/ */
function __construct($db) function __construct($db)
{ {
@ -305,6 +305,7 @@ class Task extends CommonObject
*/ */
function delete($user, $notrigger=0) function delete($user, $notrigger=0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
@ -391,7 +392,7 @@ class Task extends CommonObject
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
} }

View File

@ -117,7 +117,6 @@ if ($action == 'add' && $user->rights->projet->creer)
$db->begin(); $db->begin();
$project = new Project($db); $project = new Project($db);
$project->ref = GETPOST('ref','alpha'); $project->ref = GETPOST('ref','alpha');
$project->title = GETPOST('title','alpha'); $project->title = GETPOST('title','alpha');
$project->socid = GETPOST('socid','int'); $project->socid = GETPOST('socid','int');
@ -246,6 +245,7 @@ if ($action == 'builddoc' && $user->rights->projet->creer)
} }
} }
if ($action == 'confirm_validate' && GETPOST('confirm') == 'yes') if ($action == 'confirm_validate' && GETPOST('confirm') == 'yes')
{ {
$project = new Project($db); $project = new Project($db);
@ -315,6 +315,24 @@ if ($action == 'confirm_clone' && $user->rights->projet->creer && GETPOST('confi
} }
} }
if ($action == 'confirm_clone' && $user->rights->projet->creer && GETPOST('confirm') == 'yes')
{
$idtoclone=$id;
$project = new Project($db);
$project->fetch($idtoclone);
$result=$project->createFromClone($idtoclone,true,true,true,true);
if ($result <= 0)
{
$mesg='<div class="error">'.$project->error.'</div>';
}
else
{
$id=$result;
$action='edit';
$comefromclone=true;
}
}
/* /*
* View * View
@ -459,7 +477,11 @@ else
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$project->id,$langs->trans("DeleteAProject"),$text,"confirm_delete",'','',1); $ret=$form->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>';
} }
<<<<<<< OURS
// Clone confirmation // Clone confirmation
=======
// Clone confirmation
>>>>>>> THEIRS
if ($action == 'clone') if ($action == 'clone')
{ {
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$project->id,$langs->trans("CloneProject"),$langs->trans("ConfirmCloneProject"),"confirm_clone",'','',1); $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$project->id,$langs->trans("CloneProject"),$langs->trans("ConfirmCloneProject"),"confirm_clone",'','',1);
@ -486,9 +508,7 @@ else
// Customer // Customer
print '<tr><td>'.$langs->trans("Company").'</td><td>'; print '<tr><td>'.$langs->trans("Company").'</td><td>';
$text=$form->select_company($project->societe->id,'socid','',1,1); print $form->select_company($project->societe->id,'socid','',1,1);
$texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");
print $form->textwithtooltip($text.' '.img_help(),$texthelp,1);
print '</td></tr>'; print '</td></tr>';
// Visibility // Visibility

View File

@ -125,7 +125,6 @@ if (! empty($project_ref) && ! empty($withproject))
} }
} }
// Find upload dir after retreive is task if necessary
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
if ($object->fetch($id,$ref) > 0) if ($object->fetch($id,$ref) > 0)
@ -141,7 +140,6 @@ if ($id > 0 || ! empty($ref))
dol_print_error($db); dol_print_error($db);
} }
} }
/* /*
* View * View
*/ */