From a9a191819f23a589bb9382ec5b90b1d0ff7b1e81 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Dec 2018 21:25:28 +0100 Subject: [PATCH] Work on billing time spent --- htdocs/langs/en_US/projects.lang | 1 + htdocs/projet/card.php | 8 ++++---- htdocs/projet/contact.php | 2 +- htdocs/projet/element.php | 2 +- htdocs/projet/list.php | 21 ++++++++++++++++++++- htdocs/projet/tasks.php | 2 +- 6 files changed, 28 insertions(+), 8 deletions(-) diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 2655ebbdc05..12333c0de9d 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -56,6 +56,7 @@ WorkloadNotDefined=Workload not defined NewTimeSpent=Time spent MyTimeSpent=My time spent BillTime=Bill the time spent +BillTimeShort=Bill time Tasks=Tasks Task=Task TaskDateStart=Task start date diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 8bf377a9844..6c9db443487 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -618,9 +618,9 @@ if ($action == 'create' && $user->rights->projet->creer) print ''; print ''; print ''; - +var_dump($conf->global->PROJECT_USE_TASKS); // Bill time - if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print ''.$langs->trans("BillTime").''; print ''; @@ -855,7 +855,7 @@ elseif ($object->id > 0) print ''; // Bill time - if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print ''.$langs->trans("BillTime").''; print 'bill_time) ? ' checked="checked"' : '').'">'; @@ -985,7 +985,7 @@ elseif ($object->id > 0) print ''; // Bill time - if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print ''.$langs->trans("BillTime").''; print ''.yn($object->bill_time).''; diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index cd2e722ecd3..3a68eb9b5d4 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -241,7 +241,7 @@ if ($id > 0 || ! empty($ref)) print ''; // Bill time - if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print ''.$langs->trans("BillTime").''; print yn($object->bill_time); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 5494c893b2a..59fda8f2123 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -218,7 +218,7 @@ print nl2br($object->description); print ''; // Bill time -if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) +if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print ''.$langs->trans("BillTime").''; print yn($object->bill_time); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index dac11d34519..b220af0d96a 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -128,6 +128,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.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 +280,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"; +$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.= ", s.nom as name, s.rowid as socid"; $sql.= ", cls.code as opp_status_code"; // We'll need these fields in order to filter by categ @@ -620,6 +621,12 @@ if (! empty($arrayfields['p.budget_amount']['checked'])) print ''; print ''; } +if (! empty($arrayfields['p.bill_time']['checked'])) +{ + print ''; + print ''; + print ''; +} // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -669,6 +676,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,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'],$_SERVER["PHP_SELF"],'p.opp_percent',"",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'],$_SERVER["PHP_SELF"],'p.budget_amount',"",$param,'align="right"',$sortfield,$sortorder); +if (! empty($arrayfields['p.bill_time']['checked'])) print_liste_field_titre($arrayfields['p.bill_time']['label'],$_SERVER["PHP_SELF"],'p.bill_time',"",$param,'align="right"',$sortfield,$sortorder); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -847,6 +855,17 @@ while ($i < min($num,$limit)) if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalbudgetfield']=$totalarray['nbfield']; } + // Bill time + if (! empty($arrayfields['p.bill_time']['checked'])) + { + print ''; + if ($obj->bill_time) + { + print yn($obj->bill_time); + } + print ''; + if (! $i) $totalarray['nbfield']++; + } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 2f06f698b14..04605c33065 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -417,7 +417,7 @@ if ($id > 0 || ! empty($ref)) print ''; // Bill time - if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print ''.$langs->trans("BillTime").''; print yn($object->bill_time);