diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 91b2e27eeeb..f8f82d34c1a 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -448,7 +448,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $projectstatic->ref=$lines[$i]->projectref; $projectstatic->public=$lines[$i]->public; $projectstatic->title=$lines[$i]->projectlabel; - $projectstatic->bill_time=$lines[$i]->bill_time; + $projectstatic->usage_bill_time=$lines[$i]->usage_bill_time; $taskstatic->id=$lines[$i]->id; $taskstatic->ref=$lines[$i]->ref; @@ -572,7 +572,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t { // Time not billed print ''; - if ($lines[$i]->bill_time) + if ($lines[$i]->usage_bill_time) { print convertSecondToTime($lines[$i]->tobill, 'allhourmin'); $total_projectlinesa_tobill += $lines[$i]->tobill; @@ -585,7 +585,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t // Time billed print ''; - if ($lines[$i]->bill_time) + if ($lines[$i]->usage_bill_time) { print convertSecondToTime($lines[$i]->billed, 'allhourmin'); $total_projectlinesa_billed += $lines[$i]->billed; @@ -1047,7 +1047,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER["PHP_SELF"], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right '); - if (! empty($arrayfields['p.bill_time']['checked'])) print_liste_field_titre($arrayfields['p.bill_time']['label'], $_SERVER["PHP_SELF"], 'p.bill_time', "", $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['p.usage_bill_time']['checked'])) print_liste_field_titre($arrayfields['p.usage_bill_time']['label'], $_SERVER["PHP_SELF"], 'p.usage_bill_time', "", $param, '', $sortfield, $sortorder, 'right '); $extrafieldsobjectkey='projet'; $extrafieldsobjectprefix='efp.'; @@ -1082,10 +1082,10 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr print price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0, $conf->currency); print "\n"; } - if (! empty($arrayfields['p.bill_time']['checked'])) + if (! empty($arrayfields['p.usage_bill_time']['checked'])) { print ''; - print yn($lines[$i]->bill_time); + print yn($lines[$i]->usage_bill_time); print "\n"; } @@ -1427,7 +1427,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER["PHP_SELF"], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right '); - if (! empty($arrayfields['p.bill_time']['checked'])) print_liste_field_titre($arrayfields['p.bill_time']['label'], $_SERVER["PHP_SELF"], 'p.bill_time', "", $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['p.usage_bill_time']['checked'])) print_liste_field_titre($arrayfields['p.usage_bill_time']['label'], $_SERVER["PHP_SELF"], 'p.usage_bill_time', "", $param, '', $sortfield, $sortorder, 'right '); $extrafieldsobjectkey='projet'; $extrafieldsobjectprefix='efp.'; @@ -1462,10 +1462,10 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ print price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0, $conf->currency); print "\n"; } - if (! empty($arrayfields['p.bill_time']['checked'])) + if (! empty($arrayfields['p.usage_bill_time']['checked'])) { print ''; - print yn($lines[$i]->bill_time); + print yn($lines[$i]->usage_bill_time); print "\n"; } diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index fa1e923fd64..0c62cd910ba 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -325,7 +325,7 @@ if (($action=="create") || ($action=="edit")) if ($action=="edit") dol_fiche_head($head, 'card', $langs->trans("CronTask"), 0, 'cron'); else dol_fiche_head(''); - print ''; + print '
'; print '"; @@ -567,7 +567,7 @@ else // box add_jobs_box print '
'; print '
'; - print '
'; print $langs->trans('CronLabel')."
'; + print '
'; print '"; @@ -638,7 +638,7 @@ else print '
'; print '
'; - print '
'; print $langs->trans('CronLabel')."
'; + print '
'; print '"; @@ -697,7 +697,7 @@ else print '
'; print '
'; - print '
'; print $langs->trans('CronEvery')."
'; + print '
'; print ''; + // Usage (opp, task, bill time, ...) + print ''; + print ''; + print ''; + // Thirdparty if ($conf->societe->enabled) { @@ -619,17 +658,6 @@ if ($action == 'create' && $user->rights->projet->creer) print ''; print ''; - // Bill time - if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print ''; - print ''; - print ''; - } - if ($conf->categorie->enabled) { // Categories print ''; print ''; + // Status print ''; + // Usage + print ''; + print ''; + // Thirdparty if ($conf->societe->enabled) { @@ -857,17 +914,6 @@ elseif ($object->id > 0) print ''; print ''; - // Bill time - if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print ''; - print ''; - print ''; - } - // Tags-Categories if ($conf->categorie->enabled) { @@ -928,13 +974,41 @@ elseif ($object->id > 0) print '
'; print $langs->trans('CronDtLastLaunch').""; diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 3ac96e7a435..8efe44db103 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -81,3 +81,13 @@ ALTER TABLE llx_oauth_token ADD COLUMN fk_soc integer DEFAULT NULL after token; ALTER TABLE llx_mailing ADD COLUMN tms timestamp; ALTER TABLE llx_mailing_cibles ADD COLUMN tms timestamp; + +ALTER TABLE llx_projet ADD COLUMN usage_opportunity integer DEFAULT 0; +ALTER TABLE llx_projet ADD COLUMN usage_task integer DEFAULT 1; +ALTER TABLE llx_projet CHANGE COLUMN bill_time usage_bill_time integer DEFAULT 0; -- rename existing field +ALTER TABLE llx_projet ADD COLUMN usage_organize_event integer DEFAULT 0; + +UPDATE llx_projet set usage_opportunity = 1 WHERE fk_opp_status > 0; + + + \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_projet.sql b/htdocs/install/mysql/tables/llx_projet.sql index 7216a0f20b1..792a9237693 100644 --- a/htdocs/install/mysql/tables/llx_projet.sql +++ b/htdocs/install/mysql/tables/llx_projet.sql @@ -42,7 +42,10 @@ create table llx_projet --budget_days real, -- budget in days is sum of field planned_workload of tasks opp_amount double(24,8), budget_amount double(24,8), - bill_time integer DEFAULT 0, -- Set to 1 if time spent must be converted into invoices + usage_opportunity integer DEFAULT 0, -- Set to 1 if project is used to follow an opportunity + usage_task integer DEFAULT 1, -- Set to 1 if project is used to manage tasks and/or record timesheet + usage_bill_time integer DEFAULT 0, -- Set to 1 if time spent must be converted into invoices + usage_organize_event integer DEFAULT 0, -- Set to 1 if you want to use project to organize an event, receive attendees subscription model_pdf varchar(255), import_key varchar(14) -- Import key )ENGINE=innodb; diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang index 00c66c59002..250ff0e16bc 100644 --- a/htdocs/langs/fr_FR/projects.lang +++ b/htdocs/langs/fr_FR/projects.lang @@ -203,6 +203,8 @@ AssignTask=Assigner ProjectOverview=Vue d'ensemble ManageTasks=Utiliser les projets pour suivre les tâches et/ou saisir du temps consommé (feuilles de temps) ManageOpportunitiesStatus=Utiliser les projets pour suivre les affaires / opportunités +ProjectFollowOpportunity=Follow a lead or opportunity +ProjectFollowTasks=Follow tasks and time spent ProjectNbProjectByMonth=Nb de projets créés par mois ProjectNbTaskByMonth=Nb de tâches créées par mois ProjectOppAmountOfProjectsByMonth=Montant des opportunités par mois diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 52028ac7160..9a97f49135d 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -125,7 +125,7 @@ $arrayfields['t.progress']=array('label'=>'ProgressDeclared', 'checked'=>1, 'ena 'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>104), 'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>105), 'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110), - 'p.bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115), + 'p.usage_bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115), ); */ // Extra fields diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 80745b5d352..6343d40cbf7 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -133,7 +133,7 @@ $arrayfields=array(); 'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>104), 'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>105), 'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110), - 'p.bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115), + 'p.usage_bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115), );*/ $arrayfields['t.planned_workload']=array('label'=>'PlannedWorkload', 'checked'=>1, 'enabled'=>1, 'position'=>0); $arrayfields['t.progress']=array('label'=>'ProgressDeclared', 'checked'=>1, 'enabled'=>1, 'position'=>0); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 88bda602721..1e4ba396560 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -156,13 +156,16 @@ if (empty($reshook)) $object->public = GETPOST('public', 'alpha'); $object->opp_amount = price2num(GETPOST('opp_amount', 'alpha')); $object->budget_amount = price2num(GETPOST('budget_amount', 'alpha')); - $object->datec = dol_now(); + $object->date_c = dol_now(); $object->date_start = $date_start; $object->date_end = $date_end; $object->statut = $status; $object->opp_status = $opp_status; $object->opp_percent = $opp_percent; - $object->bill_time = (GETPOST('bill_time', 'alpha')=='on'?1:0); + $object->usage_opportunity = (GETPOST('usage_opportunity', 'alpha')=='on'?1:0); + $object->usage_task = (GETPOST('usage_task', 'alpha')=='on'?1:0); + $object->usage_bill_time = (GETPOST('usage_bill_time', 'alpha')=='on'?1:0); + $object->usage_organize_event = (GETPOST('usage_organize_event', 'alpha')=='on'?1:0); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); @@ -263,7 +266,10 @@ if (empty($reshook)) if (isset($_POST['budget_amount'])) $object->budget_amount= price2num(GETPOST('budget_amount', 'alpha')); if (isset($_POST['opp_status'])) $object->opp_status = $opp_status; if (isset($_POST['opp_percent'])) $object->opp_percent = $opp_percent; - $object->bill_time = (GETPOST('bill_time', 'alpha')=='on'?1:0); + $object->usage_opportunity = (GETPOST('usage_opportunity', 'alpha')=='on'?1:0); + $object->usage_task = (GETPOST('usage_task', 'alpha')=='on'?1:0); + $object->usage_bill_time = (GETPOST('usage_bill_time', 'alpha')=='on'?1:0); + $object->usage_organize_event = (GETPOST('usage_organize_event', 'alpha')=='on'?1:0); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); @@ -539,6 +545,39 @@ if ($action == 'create' && $user->rights->projet->creer) // Label print '
'.$langs->trans("Label").'
'; + print $langs->trans("Usage"); + print ''; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print ' '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print ' '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print ' '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + /* + print ' '; + $htmltext = $langs->trans("OrganizeEvent"); + print $form->textwithpicto($langs->trans("OrganizeEvent"), $htmltext);*/ + print '
'; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'.$langs->trans("Categories").''; @@ -769,6 +797,7 @@ elseif ($object->id > 0) print '
'.$langs->trans("Label").'
'.$langs->trans("Status").''; print ''; print '
'; + print $langs->trans("Usage"); + print ''; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print 'bill_time) ? ' checked="checked"' : '').'">
'; + // Usage + print ''; + print ''; + // Visibility print ''; - if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES) && ! empty($object->usage_opportunity)) { // Opportunity status print ''; - // Bill time - if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print ''; - print ''; - print ''; - } - // Categories if($conf->categorie->enabled) { print '
'; + print $langs->trans("Usage"); + print ''; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; if ($object->public) print $langs->trans('SharedProject'); else print $langs->trans('PrivateProject'); print '
'.$langs->trans("OpportunityStatus").''; @@ -990,17 +1064,6 @@ elseif ($object->id > 0) print nl2br($object->description); print '
'; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print ''.yn($object->bill_time).'
'.$langs->trans("Categories").''; @@ -1118,7 +1181,7 @@ elseif ($object->id > 0) print ''; } - // Modify + // Modify if ($object->statut != 2 && $user->rights->projet->creer) { if ($userWrite > 0) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 6e2b0a73a5e..3dcc486d266 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -88,7 +88,7 @@ class Project extends CommonObject public $user_close_id; public $public; //!< Tell if this is a public or private project public $budget_amount; - public $bill_time; // Is the time spent on project must be invoiced or not + public $usage_bill_time; // Is the time spent on project must be invoiced or not public $statuts_short; public $statuts_long; @@ -213,7 +213,10 @@ class Project extends CommonObject $sql.= ", datee"; $sql.= ", opp_amount"; $sql.= ", budget_amount"; - $sql.= ", bill_time"; + $sql.= ", usage_opportunity"; + $sql.= ", usage_task"; + $sql.= ", usage_bill_time"; + $sql.= ", usage_organize_event"; $sql.= ", note_private"; $sql.= ", note_public"; $sql.= ", entity"; @@ -232,7 +235,10 @@ class Project extends CommonObject $sql.= ", " . ($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); $sql.= ", " . (strcmp($this->opp_amount, '') ? price2num($this->opp_amount) : 'null'); $sql.= ", " . (strcmp($this->budget_amount, '') ? price2num($this->budget_amount) : 'null'); - $sql.= ", " . ($this->bill_time ? 1 : 0); + $sql.= ", " . ($this->usage_opportunity ? 1 : 0); + $sql.= ", " . ($this->usage_task ? 1 : 0); + $sql.= ", " . ($this->usage_bill_time ? 1 : 0); + $sql.= ", " . ($this->usage_organize_event ? 1 : 0); $sql.= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : 'null'); $sql.= ", ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : 'null'); $sql.= ", ".$conf->entity; @@ -338,7 +344,10 @@ class Project extends CommonObject $sql.= ", opp_amount = " . (strcmp($this->opp_amount, '') ? price2num($this->opp_amount) : "null"); $sql.= ", budget_amount = " . (strcmp($this->budget_amount, '') ? price2num($this->budget_amount) : "null"); $sql.= ", fk_user_modif = " . $user->id; - $sql.= ", bill_time = " . ($this->bill_time ? 1 : 0); + $sql.= ", usage_opportunity = " . ($this->usage_opportunity ? 1 : 0); + $sql.= ", usage_task = " . ($this->usage_task ? 1 : 0); + $sql.= ", usage_bill_time = " . ($this->usage_bill_time ? 1 : 0); + $sql.= ", usage_organize_event = " . ($this->usage_organize_event ? 1 : 0); $sql.= " WHERE rowid = " . $this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); @@ -437,7 +446,7 @@ class Project extends CommonObject $sql = "SELECT rowid, ref, title, description, public, datec, opp_amount, budget_amount,"; $sql.= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut, fk_opp_status, opp_percent,"; - $sql.= " note_private, note_public, model_pdf, bill_time, entity"; + $sql.= " note_private, note_public, model_pdf, usage_opportunity, usage_task, usage_bill_time, usage_organize_event, entity"; $sql.= " FROM " . MAIN_DB_PREFIX . "projet"; if (! empty($id)) { @@ -483,7 +492,10 @@ class Project extends CommonObject $this->opp_percent = $obj->opp_percent; $this->budget_amount = $obj->budget_amount; $this->modelpdf = $obj->model_pdf; - $this->bill_time = (int) $obj->bill_time; + $this->usage_opportunity = (int) $obj->usage_opportunity; + $this->usage_task = (int) $obj->usage_task; + $this->usage_bill_time = (int) $obj->usage_bill_time; + $this->usage_organize_event = (int) $obj->usage_organize_event; $this->entity = $obj->entity; $this->db->free($resql); @@ -1097,6 +1109,11 @@ class Project extends CommonObject $this->opp_amount = 20000; $this->budget_amount = 10000; + $this->usage_opportunity = 1; + $this->usage_task = 1; + $this->usage_bill_time = 1; + $this->usage_organize_event = 1; + /* $nbp = mt_rand(1, 9); $xnbp = 0; @@ -1845,9 +1862,9 @@ class Project extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Charge indicateurs this->nb pour le tableau de bord + * Charge indicateurs this->nb pour le tableau de bord * - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK */ public function load_state_board() { diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index ce4779e1a6d..ca8a2dd365a 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -748,7 +748,7 @@ class Task extends CommonObject // List of tasks (does not care about permissions. Filtering will be done later) $sql = "SELECT "; if ($filteronprojuser > 0 || $filterontaskuser > 0) $sql.= " DISTINCT"; // We may get several time the same record if user has several roles on same project/task - $sql.= " p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus, p.bill_time,"; + $sql.= " p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus, p.usage_bill_time,"; $sql.= " t.rowid as taskid, t.ref as taskref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut as status,"; $sql.= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang,"; $sql.= " s.rowid as thirdparty_id, s.nom as thirdparty_name, s.email as thirdparty_email,"; @@ -847,7 +847,7 @@ class Task extends CommonObject if ($morewherefilter) $sql.=$morewherefilter; if ($includebilltime) { - $sql.=" GROUP BY p.rowid, p.ref, p.title, p.public, p.fk_statut, p.bill_time,"; + $sql.=" GROUP BY p.rowid, p.ref, p.title, p.public, p.fk_statut, p.usage_bill_time,"; $sql.=" t.datec, t.dateo, t.datee, t.tms,"; $sql.=" t.rowid, t.ref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut,"; $sql.=" t.dateo, t.datee, t.planned_workload, t.rang,"; @@ -903,7 +903,7 @@ class Task extends CommonObject $tasks[$i]->projectref = $obj->ref; $tasks[$i]->projectlabel = $obj->plabel; $tasks[$i]->projectstatus = $obj->projectstatus; - $tasks[$i]->bill_time = $obj->bill_time; + $tasks[$i]->usage_bill_time = $obj->usage_bill_time; $tasks[$i]->label = $obj->label; $tasks[$i]->description = $obj->description; $tasks[$i]->fk_parent = $obj->fk_task_parent; // deprecated @@ -931,7 +931,7 @@ class Task extends CommonObject $tasks[$i]->opp_amount = $obj->opp_amount; $tasks[$i]->opp_percent = $obj->opp_percent; $tasks[$i]->budget_amount = $obj->budget_amount; - $tasks[$i]->bill_time = $obj->bill_time; + $tasks[$i]->usage_bill_time = $obj->usage_bill_time; if (!empty($extrafields->attributes['projet']['label'])) { diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 8bed0a87adc..4e4d514380e 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -180,7 +180,35 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print ''; + print '
'; + + // Usage + print ''; + print ''; // Visibility print ''; - if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $object->oopp_status) { // Opportunity status print ''; } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index ae3918de689..1dea9c72265 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -157,7 +157,35 @@ print '
'; print '
'; print '
'; -print '
'; + print $langs->trans("Usage"); + print ''; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; @@ -188,7 +216,7 @@ if ($id > 0 || ! empty($ref)) else print $langs->trans('PrivateProject'); print '
'.$langs->trans("OpportunityStatus").''; @@ -244,7 +272,7 @@ if ($id > 0 || ! empty($ref)) if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print '
'.$langs->trans("BillTime").''; - print yn($object->bill_time); + print yn($object->usage_bill_time); print '
'; +print '
'; + +// Usage +print ''; +print ''; // Visibility print ''; if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print ''; } diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 86e8d2dbde8..87920f2a977 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -134,6 +134,34 @@ if (($id > 0 && is_numeric($id)) || ! empty($ref)) print '
'; +print $langs->trans("Usage"); +print ''; +if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) +{ + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; +} +if (empty($conf->global->PROJECT_HIDE_TASKS)) +{ + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; +} +if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) +{ + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; +} +print '
'.$langs->trans("Visibility").''; @@ -221,7 +249,7 @@ print '
'.$langs->trans("BillTime").''; - print yn($object->bill_time); + print yn($object->usage_bill_time); print '
'; + // Usage + print ''; + print ''; + // Visibility print ''; } -if (! empty($arrayfields['p.bill_time']['checked'])) +if (! empty($arrayfields['p.usage_bill_time']['checked'])) { print ''; if (! $i) $totalarray['nbfield']++; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 12842b1751c..734904e9254 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -412,6 +412,34 @@ if ($id > 0 || ! empty($ref)) print '
'; + print $langs->trans("Usage"); + print ''; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; if ($object->public) print $langs->trans('SharedProject'); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 34dd5547f7b..5aa28bcddc8 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -129,7 +129,7 @@ $arrayfields=array( 'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>104), 'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>105), 'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110), - 'p.bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115), + 'p.usage_bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115), 'p.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500), 'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'p.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), @@ -279,7 +279,7 @@ if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0'; $distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. $sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut, p.fk_opp_status, p.public, p.fk_user_creat"; -$sql.= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount, p.bill_time"; +$sql.= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount, p.usage_bill_time"; $sql.= ", s.rowid as socid, s.nom as name, s.email"; $sql.= ", cls.code as opp_status_code"; // We'll need these fields in order to filter by categ @@ -619,7 +619,7 @@ if (! empty($arrayfields['p.budget_amount']['checked'])) print ''; print ''; print ''; @@ -674,7 +674,7 @@ if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER["PHP_SELF"], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right '); -if (! empty($arrayfields['p.bill_time']['checked'])) print_liste_field_titre($arrayfields['p.bill_time']['label'], $_SERVER["PHP_SELF"], 'p.bill_time', "", $param, '', $sortfield, $sortorder, 'right '); +if (! empty($arrayfields['p.usage_bill_time']['checked'])) print_liste_field_titre($arrayfields['p.usage_bill_time']['label'], $_SERVER["PHP_SELF"], 'p.usage_bill_time', "", $param, '', $sortfield, $sortorder, 'right '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -856,12 +856,12 @@ while ($i < min($num, $limit)) if (! $i) $totalarray['totalbudgetfield']=$totalarray['nbfield']; } // Bill time - if (! empty($arrayfields['p.bill_time']['checked'])) + if (! empty($arrayfields['p.usage_bill_time']['checked'])) { print ''; - if ($obj->bill_time) + if ($obj->usage_bill_time) { - print yn($obj->bill_time); + print yn($obj->usage_bill_time); } print '
'; + // Usage + print ''; + print ''; + // Visibility print ''; } @@ -751,7 +779,7 @@ elseif ($id > 0 || ! empty($ref)) // progress resume not searchable print ''; - if ($object->bill_time) + if ($object->usage_bill_time) { print ''; @@ -780,7 +808,7 @@ elseif ($id > 0 || ! empty($ref)) print_liste_field_titre("ProgressCalculated", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); print_liste_field_titre("ProgressDeclared", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); print_liste_field_titre("TaskProgressSummary", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center '); - if ($object->bill_time) + if ($object->usage_bill_time) { print_liste_field_titre("TimeToBill", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); print_liste_field_titre("TimeBilled", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); @@ -793,12 +821,12 @@ elseif ($id > 0 || ! empty($ref)) { // Show all lines in taskarray (recursive function to go down on tree) $j=0; $level=0; - $nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->bill_time?1:0)); + $nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time?1:0)); } else { $colspan=10; - if ($object->bill_time) $colspan+=2; + if ($object->usage_bill_time) $colspan+=2; print ''; } diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index 679f6a29dc2..2ecac789bc3 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -150,12 +150,64 @@ if ($id > 0 || ! empty($ref)) print '
'; + print $langs->trans("Usage"); + print ''; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; if ($object->public) print $langs->trans('SharedProject'); @@ -474,7 +502,7 @@ if ($id > 0 || ! empty($ref)) if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print '
'.$langs->trans("BillTime").''; - print yn($object->bill_time); + print yn($object->usage_bill_time); print '
'; print '
'.$langs->trans("NoTasks").'
'; + // Usage + print ''; + print ''; + // Visibility print ''; + // Usage + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES) && ! empty($object->usage_opportunity)) + { + // Opportunity status + print ''; + + // Opportunity percent + print ''; + + // Opportunity Amount + print ''; + } + // Date start - end print '
'; + print $langs->trans("Usage"); + print ''; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; if ($projectstatic->public) print $langs->trans('SharedProject'); else print $langs->trans('PrivateProject'); print '
'.$langs->trans("OpportunityStatus").''; + $code = dol_getIdFromCode($db, $projectstatic->opp_status, 'c_lead_status', 'rowid', 'code'); + if ($code) print $langs->trans("OppStatus".$code); + print '
'.$langs->trans("OpportunityProbability").''; + if (strcmp($object->opp_percent, '')) print price($projectstatic->opp_percent, 0, $langs, 1, 0).' %'; + print '
'.$langs->trans("OpportunityAmount").''; + /*if ($object->opp_status) + { + print price($obj->opp_amount, 1, $langs, 1, 0, -1, $conf->currency); + }*/ + if (strcmp($projectstatic->opp_amount, '')) print price($projectstatic->opp_amount, 0, $langs, 1, 0, -1, $conf->currency); + print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; $start = dol_print_date($projectstatic->date_start, 'day'); diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 3fe8abfa73b..12c0fdf43e9 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -220,7 +220,35 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print ''; + print '
'; + + // Usage + print ''; + print ''; // Visibility print '
'; + print $langs->trans("Usage"); + print ''; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 2b2f6ab4176..e6d8930f03d 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -165,6 +165,34 @@ if ($object->id > 0) print ''; + // Usage + print ''; + print ''; + // Visibility print '
'; + print $langs->trans("Usage"); + print ''; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; if ($projectstatic->public) print $langs->trans('SharedProject'); diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index a6b8c583da2..3b90f66f5b2 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -255,7 +255,7 @@ else dol_print_error($db); if (count($listoftaskcontacttype) == 0) $listoftaskcontacttype[0]='0'; // To avoid sql syntax error if not found $distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is assigned only once. -$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.datee as projectdatee, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate, p.bill_time,"; +$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.datee as projectdatee, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate, p.usage_bill_time,"; $sql.= " s.nom as name, s.rowid as socid,"; $sql.= " t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update,"; $sql.= " t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut"; @@ -792,7 +792,7 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['t.tobill']['checked'])) { print ''; - if ($obj->bill_time) + if ($obj->usage_bill_time) { print convertSecondToTime($obj->tobill, 'allhourmin'); $totalarray['totaltobill'] += $obj->tobill; @@ -809,7 +809,7 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['t.billed']['checked'])) { print ''; - if ($obj->bill_time) + if ($obj->usage_bill_time) { print convertSecondToTime($obj->billed, 'allhourmin'); $totalarray['totalbilled'] += $obj->billed; diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 02925f1092f..9c7095531f7 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -143,7 +143,35 @@ if ($object->id > 0) print '
'; print '
'; - print ''; + print '
'; + + // Usage + print ''; + print ''; // Visibility print '
'; + print $langs->trans("Usage"); + print ''; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; @@ -177,7 +205,7 @@ if ($object->id > 0) print '
'; print '
'; - print ''; + print '
'; // Description print '
'.$langs->trans("Description").''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index b3c3e151af8..e68976d8133 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -258,7 +258,35 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print ''; + print '
'; + + // Usage + print ''; + print ''; // Visibility print '
'; + print $langs->trans("Usage"); + print ''; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index a8178282676..8547b3d331c 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -509,7 +509,35 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; print '
'; - print ''; + print '
'; + + // Usage + print ''; + print ''; // Visibility print ''; } @@ -610,7 +638,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) } $massactionbutton = ''; - if ($projectstatic->bill_time) + if ($projectstatic->usage_bill_time) { $arrayofmassactions = array( 'generateinvoice'=>$langs->trans("GenerateBill"), @@ -747,7 +775,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $arrayfields['t.note']=array('label'=>$langs->trans("Note"), 'checked'=>1); $arrayfields['t.task_duration']=array('label'=>$langs->trans("Duration"), 'checked'=>1); $arrayfields['value'] =array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>(empty($conf->salaries->enabled)?0:1)); - $arrayfields['valuebilled'] =array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((! empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT))?0:1) && $projectstatic->bill_time)); + $arrayfields['valuebilled'] =array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((! empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT))?0:1) && $projectstatic->usage_bill_time)); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -1290,7 +1318,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; + print $langs->trans("Usage"); + print ''; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; @@ -554,7 +582,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print '
'.$langs->trans("BillTime").''; - print yn($projectstatic->bill_time); + print yn($projectstatic->usage_bill_time); print '
'; // invoice_id and invoice_line_id if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { - if ($projectstatic->bill_time) + if ($projectstatic->usage_bill_time) { if ($task_time->invoice_id) {