From 9493e252c9ff75b06467a881fe23a5cc25093af7 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 15 Sep 2014 09:55:09 +0200 Subject: [PATCH 1/4] add refext into fecth product --- htdocs/product/class/product.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d7bdec82079..e6695b75bc6 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1206,6 +1206,7 @@ class Product extends CommonObject $sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; $sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,"; $sql.= " datec, tms, import_key, entity, desiredstock"; + $sql.= " ,ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; if ($id) $sql.= " WHERE rowid = ".$this->db->escape($id); else @@ -1277,6 +1278,7 @@ class Product extends CommonObject $this->date_modification = $obj->tms; $this->import_key = $obj->import_key; $this->entity = $obj->entity; + $this->ref_ext = $obj->ref_ext; $this->db->free($resql); From d225d92c0b48f9937fb753eae301742445748f3b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 17 Sep 2014 16:03:21 +0200 Subject: [PATCH 2/4] Fix: remove hook restriction ! --- htdocs/core/lib/functions2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 2bd3c757e47..8e70f265f2c 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1325,7 +1325,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0) if (! $tmpdir) { unset($listofdir[$key]); continue; } if (is_dir($tmpdir)) { - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$','','name',SORT_ASC,0,true); // Disable hook for the moment + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$'); if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } From f0ebd7721d60185e95b9b403d60185f0b73bcb36 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Sep 2014 17:49:39 +0200 Subject: [PATCH 3/4] Fix: Restore sort feature. Still did not see why previous commit is a bug fix of dolibarr bug. --- htdocs/core/lib/functions2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 8e70f265f2c..58422dcda36 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1325,7 +1325,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0) if (! $tmpdir) { unset($listofdir[$key]); continue; } if (is_dir($tmpdir)) { - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$'); + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$','','name',SORT_ASC,0); if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } From 015b0d80361207ef45fe9b916ec5f2b4f5d0f465 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Sep 2014 10:05:37 +0200 Subject: [PATCH 4/4] Fix: Bad calculation of total Fix: Warning message not translated --- htdocs/.gitignore | 1 + htdocs/core/lib/project.lib.php | 51 +++++++++++++++++++++------------ htdocs/langs/en_US/errors.lang | 2 ++ htdocs/projet/index.php | 5 ++-- htdocs/projet/tasks/index.php | 3 +- 5 files changed, 41 insertions(+), 21 deletions(-) diff --git a/htdocs/.gitignore b/htdocs/.gitignore index a4ebd2bb7c7..e7d542c9320 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -2,6 +2,7 @@ /custom* /extensions* /nltechno* +/teclib* /bootstrap* /google* /multicompany* diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 1dccb2c2456..3062fe1783a 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -228,7 +228,14 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $numlines=count($lines); - $total=0; + // We declare counter as global because we want to edit them into recursive call + global $total_projectlinesa_spent,$total_projectlinesa_planned,$total_projectlinesa_spent_if_planned; + if ($level == 0) + { + $total_projectlinesa_spent=0; + $total_projectlinesa_planned=0; + $total_projectlinesa_spent_if_planned=0; + } for ($i = 0 ; $i < $numlines ; $i++) { @@ -293,8 +300,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t if ($showproject) { + // Project ref print ""; - //var_dump($taskrole); if ($showlineingray) print ''; $projectstatic->id=$lines[$i]->fk_project; $projectstatic->ref=$lines[$i]->projectref; @@ -390,7 +397,9 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $level++; if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick); $level--; - $total += $lines[$i]->duration; + $total_projectlinesa_spent += $lines[$i]->duration; + $total_projectlinesa_planned += $lines[$i]->planned_workload; + if ($lines[$i]->planned_workload) $total_projectlinesa_spent_if_planned += $lines[$i]->duration; } } else @@ -399,7 +408,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } } - if ($total>0 && $level==0) + if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0) && $level==0) { print ''; print ''.$langs->trans("Total").''; @@ -407,10 +416,16 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; print ''; print ''; + print ''; + print convertSecondToTime($total_projectlinesa_planned, 'allhourmin'); + print ''; print ''; - print ''; - print ''.convertSecondToTime($total, 'allhourmin').''; - print ''; + print ''; + print convertSecondToTime($total_projectlinesa_spent, 'allhourmin'); + print ''; + print ''; + if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent_if_planned / $total_projectlinesa_planned,2).' %'; + print ''; if ($addordertick) print ''; print ''; } @@ -459,7 +474,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) { print "\n"; - + // Project print ""; $projectstatic->id=$lines[$i]->fk_project; @@ -468,14 +483,14 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr $projectstatic->label=$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]; print $projectstatic->getNomUrl(1); print ""; - + // Ref print ''; $taskstatic->id=$lines[$i]->id; $taskstatic->ref=$lines[$i]->id; print $taskstatic->getNomUrl(1); print ''; - + // Label task print ""; for ($k = 0 ; $k < $level ; $k++) @@ -486,28 +501,28 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr $taskstatic->ref=$lines[$i]->label; print $taskstatic->getNomUrl(0); print "\n"; - + // Date start print ''; print dol_print_date($lines[$i]->date_start,'dayhour'); print ''; - + // Date end print ''; print dol_print_date($lines[$i]->date_end,'dayhour'); print ''; - + // Planned Workload print ''; if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin'); else print '--:--'; print ''; - + // Progress declared % print ''; print $lines[$i]->progress.' %'; print ''; - + // Time spent print ''; if ($lines[$i]->duration) @@ -518,7 +533,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr } else print '--:--'; print "\n"; - + $disabledproject=1;$disabledtask=1; //print "x".$lines[$i]->fk_project; //var_dump($lines[$i]); @@ -534,7 +549,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr { $disabledtask=1; } - + print ''; $s =$form->select_date('',$lines[$i]->id,'','','',"addtime",1,0,1,$disabledtask); $s.='   '; @@ -546,7 +561,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject")); else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou")); print ''; - + print "\n"; } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 4e020ab3ae0..d98fa1756eb 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -146,3 +146,5 @@ WarningCloseAlways=Warning, closing is done even if amount differs between sourc WarningUsingThisBoxSlowDown=Warning, using this box slow down seriously all pages showing the box. WarningClickToDialUserSetupNotComplete=Setup of ClickToDial information for your user are not complete (see tab ClickToDial onto your user card). WarningNotRelevant=Irrelevant operation for this dataset +WarningTooManyDataPleaseUseMoreFilters=Too many data. Please use more filters + diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index a4b71c62393..97c0851d910 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -164,9 +164,10 @@ if ( $resql ) if ($num > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)) { -/* print ''; +/* $langs->load("errors"); + print ''; print ''; - print $langs->trans("TooManyDataPleaseUseMoreFilters"); + print $langs->trans("WarningTooManyDataPleaseUseMoreFilters"); print '';*/ } else diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index a798157dd11..e9fa7c6522a 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -121,9 +121,10 @@ print "\n"; if (count($tasksarray) > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)) { + $langs->load("errors"); print ''; print ''; - print $langs->trans("TooManyDataPleaseUseMoreFilters"); + print $langs->trans("WarningTooManyDataPleaseUseMoreFilters"); print ''; } else