From de89893d5720189e0bb301b56903b4de4e3146c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Feb 2018 14:09:15 +0100 Subject: [PATCH] NEW Show total of time consumed in week in time spent entry page --- htdocs/core/js/timesheet.js | 16 +++++- .../class/fournisseur.commande.class.php | 50 +++---------------- htdocs/projet/activity/perday.php | 9 +++- htdocs/projet/activity/perweek.php | 12 ++--- htdocs/projet/tasks/time.php | 11 ++-- htdocs/theme/eldy/style.css.php | 3 ++ htdocs/theme/md/style.css.php | 3 ++ 7 files changed, 45 insertions(+), 59 deletions(-) diff --git a/htdocs/core/js/timesheet.js b/htdocs/core/js/timesheet.js index 20a713ce220..ae7d839919c 100644 --- a/htdocs/core/js/timesheet.js +++ b/htdocs/core/js/timesheet.js @@ -216,6 +216,21 @@ function updateTotal(days,mode) if (total.getHours() || total.getMinutes()) jQuery('.totalDay'+days).addClass("bold"); else jQuery('.totalDay'+days).removeClass("bold"); jQuery('.totalDay'+days).text(pad(total.getHours())+':'+pad(total.getMinutes())); + + var total = new Date(0); + total.setHours(0); + total.setMinutes(0); + for (var i=0; i<7; i++) + { + var taskTime= new Date(0); + result=parseTime(jQuery('.totalDay'+i).text(),taskTime); + if (result >= 0) + { + total.setHours(total.getHours()+taskTime.getHours()); + total.setMinutes(total.getMinutes()+taskTime.getMinutes()); + } + } + jQuery('.totalDayAll').text(pad(total.getHours())+':'+pad(total.getMinutes())); } else { @@ -260,7 +275,6 @@ function updateTotal(days,mode) else jQuery('.totalDay'+days).removeClass("bold"); jQuery('.totalDay'+days).text(total); } - } \ No newline at end of file diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index e13e08acd7b..cf007659487 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2964,12 +2964,12 @@ class CommandeFournisseur extends CommonOrder } }elseif(! empty($conf->global->SUPPLIER_ORDER_MORE_THAN_WISHED) ) {//set livraison to 'tot' if more products received than wished. (and if $closeopenorder is set to 1 of course...) - + $close=0; - + if( count($diff_array) > 0 ) {//there are some difference between the two arrays - + //scan the array of results foreach($diff_array as $key => $value) {//if the quantity delivered is greater or equal to wish quantity @@ -2977,11 +2977,11 @@ class CommandeFournisseur extends CommonOrder { $close++; } - + } } - + if($close == count($diff_array)) {//all the products are received equal or more than the wished quantity if ($closeopenorder) @@ -3001,8 +3001,8 @@ class CommandeFournisseur extends CommonOrder } return 4; } - - + + } else {//all the products are not received @@ -3012,7 +3012,7 @@ class CommandeFournisseur extends CommonOrder } return 4; } - + } else { @@ -3157,40 +3157,6 @@ class CommandeFournisseurLigne extends CommonOrderLine } } - /** - * Mise a jour de l'objet ligne de commande en base - * - * @return int <0 si ko, >0 si ok - */ - public function updateTotal() - { - $this->db->begin(); - - // Mise a jour ligne en base - $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseurdet SET"; - $sql.= " total_ht='".price2num($this->total_ht)."'"; - $sql.= ",total_tva='".price2num($this->total_tva)."'"; - $sql.= ",total_localtax1='".price2num($this->total_localtax1)."'"; - $sql.= ",total_localtax2='".price2num($this->total_localtax2)."'"; - $sql.= ",total_ttc='".price2num($this->total_ttc)."'"; - $sql.= " WHERE rowid = ".$this->rowid; - - dol_syslog(get_class($this)."::updateTotal", LOG_DEBUG); - - $resql=$this->db->query($sql); - if ($resql) - { - $this->db->commit(); - return 1; - } - else - { - $this->error=$this->db->error(); - $this->db->rollback(); - return -2; - } - } - /** * Insert line into database * diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 85848eefedc..b61c5aff922 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -595,10 +595,15 @@ if (count($tasksarray) > 0) if ($isdiff) { print ''; - print ''; + print ''; print $langs->trans("OtherFilteredTasks"); print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; $timeonothertasks=($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]); //if ($timeonothertasks) //{ diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index d64a5fad6cd..a52ea4fd6d8 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -531,8 +531,8 @@ $colspan=7; if ($conf->use_javascript_ajax) { - print ' - '; + print ''; + print ''; print $langs->trans("Total"); print ' - '.$langs->trans("ExpectedWorkedHours").': '.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).''; print ''; @@ -547,8 +547,8 @@ if ($conf->use_javascript_ajax) print '
 
'; } - print ' - '; + print '
 
'; + print ''; } @@ -625,7 +625,7 @@ if (count($tasksarray) > 0) $cssweekend='weekend'; } - print ''; + print ''; $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd'); $timeonothertasks=($totalforeachday[$tmpday] - $totalforvisibletasks[$tmpday]); if ($timeonothertasks) @@ -658,7 +658,7 @@ if (count($tasksarray) > 0) print '
 
'; } - print ' + print '
 
'; } } diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 66323989d26..912551012b0 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -79,11 +79,7 @@ $projectstatic = new Project($db); $extrafields_project = new ExtraFields($db); $extrafields_task = new ExtraFields($db); -if ($projectid > 0 || ! empty($ref)) -{ - // fetch optionals attributes and labels - $extralabels_projet=$extrafields_project->fetch_name_optionals_label($projectstatic->table_element); -} +$extralabels_projet=$extrafields_project->fetch_name_optionals_label($projectstatic->table_element); $extralabels_task=$extrafields_task->fetch_name_optionals_label($object->table_element); @@ -278,10 +274,9 @@ if (! empty($project_ref) && ! empty($withproject)) // To show all time lines for project $projectidforalltimes=0; -if (GETPOST('projectid')) +if (GETPOST('projectid','none')) { - $projectidforalltimes=GETPOST('projectid','int'); - + $projectidforalltimes=GETPOST('projectid','int'); } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 2b150d64a5e..df41d1301ef 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -407,6 +407,9 @@ td.onholidayallday { td.leftborder, td.hide0 { border-left: 1px solid #ccc; } +td.leftborder, td.hide6 { + border-right: 1px solid #ccc; +} td.actionbuttons a { padding-left: 6px; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 07c02ba74fa..40b3fefc634 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -411,6 +411,9 @@ td.actionbuttons a { td.leftborder, td.hide0 { border-left: 1px solid #ccc; } +td.leftborder, td.hide6 { + border-right: 1px solid #ccc; +} select.flat, form.flat select { font-weight: normal;