From d05c60baf0a04868aaa765ca20af4f93e144bb5b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Jun 2020 14:33:34 +0200 Subject: [PATCH 1/5] Fix css --- htdocs/admin/system/perf.php | 7 ------- htdocs/index.php | 2 +- htdocs/theme/eldy/global.inc.php | 8 ++++---- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index dd77c41a673..8d4360b37c0 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -552,13 +552,6 @@ else } print '
'; -// Database statistics update -/* -print '
'; -print ''.$langs->trans("DatabaseStatistics").': '; -print '
'; -*/ - // End of page llxFooter(); $db->close(); diff --git a/htdocs/index.php b/htdocs/index.php index 1e6b7bcf210..20e2d5f9c9a 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -897,7 +897,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) if (!empty($boxstatFromHook) || !empty($boxstatItems)) { $boxstat .= ''."\n"; $boxstat .= '
'; - $boxstat .= ''; + $boxstat .= '
'; $boxstat .= ''; $boxstat .= ''; print ''; print ''; +$total_revenue_ht = 0; + foreach ($listofreferent as $key => $value) { $name = $langs->trans($value['name']); @@ -780,7 +782,11 @@ foreach ($listofreferent as $key => $value) // Calculate margin if ($qualifiedforfinalprofit) { - if ($margin != "add") + if ($margin == 'add') { + $total_revenue_ht += $total_ht; + } + + if ($margin != "add") // Revert sign { $total_ht = -$total_ht; $total_ttc = -$total_ttc; @@ -811,11 +817,20 @@ foreach ($listofreferent as $key => $value) } // and the final balance print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''; +// and the margin (profit / revenues) +if ($total_revenue_ht) { + print ''; + print ''; + print ''; + print ''; + print ''; +} + print "
'; $boxstat .= '
'.$langs->trans("DolibarrStateBoard").'
'; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index a8bf76236fc..273073d7b5d 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1726,7 +1726,7 @@ div.heightref { min-height: 80px; } div.divphotoref { - padding-: 20px; + padding-: 30px; } div.paginationref { padding-bottom: 10px; @@ -3117,7 +3117,7 @@ table.listwithfilterbefore { /* Pagination */ div.refidpadding { - padding-top: 3px; + /* padding-top: 3px; */ } div.refid { font-weight: bold; @@ -3159,7 +3159,7 @@ div.pagination li { display: inline-block; padding-left: 0px; padding-right: 0px; - padding-top: 10px; + /* padding-top: 10px; */ padding-bottom: 5px; font-size: 1.1em; } @@ -3634,7 +3634,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) { width: 118px; } -td.tdboxstats .boxstats { +.boxtable:not(.widgetstats) td.tdboxstats .boxstats { box-shadow: 1px 1px 8px var(--colorboxstatsborder); } From 7c992eac5e7c36b5dba9efe1cca719aa75e0ee1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Jun 2020 15:52:17 +0200 Subject: [PATCH 2/5] Fix option PROJECT_ELEMENTS_FOR_MINUS_MARGIN --- htdocs/projet/element.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 0b46d14a7fa..2bd7e49d86d 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -540,12 +540,12 @@ if (! empty($conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN)) { } if (! empty($conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN)) { foreach($listofreferent as $key => $element) { - if ($listofreferent[$key]['margin'] == 'add') { + if ($listofreferent[$key]['margin'] == 'minus') { unset($listofreferent[$key]['margin']); } } - $newelementforplusmargin = explode(',', $conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN); - foreach($newelementforplusmargin as $value) { + $newelementforminusmargin = explode(',', $conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN); + foreach($newelementforminusmargin as $value) { $listofreferent[$value]['margin']='minus'; } } From 036371747611ab80857692df9859e203d178b5c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Jun 2020 16:05:00 +0200 Subject: [PATCH 3/5] Fix PROJECT_ELEMENTS_FOR_MINUS_MARGIN --- htdocs/projet/element.php | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 2bd7e49d86d..6878efcd6ab 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -535,7 +535,7 @@ if (! empty($conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN)) { } $newelementforplusmargin = explode(',', $conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN); foreach($newelementforplusmargin as $value) { - $listofreferent[$value]['margin']='add'; + $listofreferent[trim($value)]['margin']='add'; } } if (! empty($conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN)) { @@ -546,7 +546,7 @@ if (! empty($conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN)) { } $newelementforminusmargin = explode(',', $conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN); foreach($newelementforminusmargin as $value) { - $listofreferent[$value]['margin']='minus'; + $listofreferent[trim($value)]['margin']='minus'; } } @@ -651,6 +651,8 @@ print '
'.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").'
'.$langs->trans("Profit").''.price(price2num($balance_ht, 'MT')).''.price(price2num($balance_ttc, 'MT')).''.$langs->trans("Profit").''.price(price2num($balance_ht, 'MT')).''.price(price2num($balance_ttc, 'MT')).'
'.$langs->trans("Margin").''.price(price2num($balance_ht / $total_revenue_ht, 'MT')).'
"; From a854d955b826c7168cce80935570dbb6a975ae86 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Jun 2020 16:08:31 +0200 Subject: [PATCH 4/5] Fix rounding --- htdocs/projet/element.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 6878efcd6ab..2566dcb104d 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -826,7 +826,7 @@ print ''; if ($total_revenue_ht) { print ''; print ''.$langs->trans("Margin").''; - print ''.price(price2num($balance_ht / $total_revenue_ht, 'MT')).''; + print ''.round(100 * $balance_ht / $total_revenue_ht, 1).'%'; print ''; print ''; } From 1762e10e69f365f93be32080122b5f5ebdeb215c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Jun 2020 09:55:10 +0200 Subject: [PATCH 5/5] Fix return code not returned --- htdocs/modulebuilder/template/scripts/mymodule.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/scripts/mymodule.php b/htdocs/modulebuilder/template/scripts/mymodule.php index 02024759058..009dcabaafd 100644 --- a/htdocs/modulebuilder/template/scripts/mymodule.php +++ b/htdocs/modulebuilder/template/scripts/mymodule.php @@ -53,7 +53,10 @@ if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/master.i if (!$res && file_exists("../master.inc.php")) $res = @include "../master.inc.php"; if (!$res && file_exists("../../master.inc.php")) $res = @include "../../master.inc.php"; if (!$res && file_exists("../../../master.inc.php")) $res = @include "../../../master.inc.php"; -if (!$res) die("Include of master fails"); +if (!$res) { + print "Include of master fails"; + exit(-1); +} // After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file). // $user is created but empty.