From 8ab53012b71b2dd149ea743abfd4063f5faf489c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 3 Nov 2018 18:20:36 +0100 Subject: [PATCH 1/7] mode is only customer in stats fichinter --- htdocs/fichinter/stats/index.php | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index 1c0ba5764ed..0dacf19c600 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -30,7 +30,7 @@ $WIDTH=DolGraph::getDefaultGraphSizeForStats('width'); $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height'); $mode='customer'; -if ($mode == 'customer' && ! $user->rights->ficheinter->lire) accessforbidden(); +if (! $user->rights->ficheinter->lire) accessforbidden(); $userid=GETPOST('userid','int'); $socid=GETPOST('socid','int'); @@ -129,14 +129,12 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { $filenameamount = $dir.'/interventionsamountinyear-'.$user->id.'-'.$year.'.png'; - if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsamountinyear-'.$user->id.'-'.$year.'.png'; - if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstatssupplier&file=interventionsamountinyear-'.$user->id.'-'.$year.'.png'; + $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsamountinyear-'.$user->id.'-'.$year.'.png'; } else { $filenameamount = $dir.'/interventionsamountinyear-'.$year.'.png'; - if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsamountinyear-'.$year.'.png'; - if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstatssupplier&file=interventionsamountinyear-'.$year.'.png'; + $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsamountinyear-'.$year.'.png'; } $px2 = new DolGraph(); @@ -171,14 +169,12 @@ $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { $filename_avg = $dir.'/interventionsaverage-'.$user->id.'-'.$year.'.png'; - if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsaverage-'.$user->id.'-'.$year.'.png'; - if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstatssupplier&file=interventionsaverage-'.$user->id.'-'.$year.'.png'; + $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsaverage-'.$user->id.'-'.$year.'.png'; } else { $filename_avg = $dir.'/interventionsaverage-'.$year.'.png'; - if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsaverage-'.$year.'.png'; - if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstatssupplier&file=interventionsaverage-'.$year.'.png'; + $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsaverage-'.$year.'.png'; } $px3 = new DolGraph(); @@ -221,13 +217,12 @@ if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear; $h=0; $head = array(); -$head[$h][0] = DOL_URL_ROOT . '/commande/stats/index.php?mode='.$mode; +$head[$h][0] = DOL_URL_ROOT . '/fichinter/stats/index.php?mode='.$mode; $head[$h][1] = $langs->trans("ByMonthYear"); $head[$h][2] = 'byyear'; $h++; -if ($mode == 'customer') $type='order_stats'; -if ($mode == 'supplier') $type='supplier_order_stats'; +$type='fichinter_stats'; complete_head_from_modules($conf,$langs,null,$head,$h,$type); @@ -247,7 +242,6 @@ print '
'; // Company print ''.$langs->trans("ThirdParty").''; if ($mode == 'customer') $filter='s.client in (1,2,3)'; - if ($mode == 'supplier') $filter='s.fournisseur = 1'; print $form->select_company($socid,'socid',$filter,1,0,0,array(),0,'','style="width: 95%"'); print ''; // User From d6b909a28063712acfed8ba2e6b4a9d7ade4d1fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 3 Nov 2018 18:26:11 +0100 Subject: [PATCH 2/7] Update index.php --- htdocs/fichinter/stats/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index 0dacf19c600..39cad7ca4f1 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -217,12 +217,12 @@ if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear; $h=0; $head = array(); -$head[$h][0] = DOL_URL_ROOT . '/fichinter/stats/index.php?mode='.$mode; +$head[$h][0] = DOL_URL_ROOT . '/fichinter/stats/index.php'; $head[$h][1] = $langs->trans("ByMonthYear"); $head[$h][2] = 'byyear'; $h++; -$type='fichinter_stats'; +$type = 'fichinter_stats'; complete_head_from_modules($conf,$langs,null,$head,$h,$type); From 9d780a172272eb834b53c1c326595300d29327f3 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Wed, 7 Nov 2018 10:11:29 +0100 Subject: [PATCH 3/7] Fix sign --- htdocs/margin/tabs/thirdpartyMargins.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 5d80814099d..2f5ba9cc7b2 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -207,7 +207,10 @@ if ($socid > 0) $marginRate = ($objp->buying_price != 0)?(100 * $objp->marge / $objp->buying_price):'' ; $markRate = ($objp->selling_price != 0)?(100 * $objp->marge / $objp->selling_price):'' ; - + $sign = ''; + if($objp->type == Facture::TYPE_CREDIT_NOTE){ + $sign = '-'; + } print ''; print ''; @@ -219,11 +222,11 @@ if ($socid > 0) print dol_print_date($db->jdate($objp->datef),'day').""; print "".price($objp->selling_price, null, null, null, null, $rounding)."\n"; print "".price(($objp->type == 2 ? -1 : 1) * $objp->buying_price, null, null, null, null, $rounding)."\n"; - print "".price($objp->marge, null, null, null, null, $rounding)."\n"; + print "".$sign.price($objp->marge, null, null, null, null, $rounding)."\n"; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print "".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."\n"; + print "".(($marginRate === '')?'n/a':$sign.price($marginRate, null, null, null, null, $rounding)."%")."\n"; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print "".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."\n"; + print "".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."\n"; print ''.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).''; print "\n"; $i++; From 05a679a10c3a9957ac053aabede07ffa974abc01 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 7 Nov 2018 16:26:25 +0100 Subject: [PATCH 4/7] FIX : OppStatusShort doesn't exists --- htdocs/projet/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 6b3613a7b0a..5f683a251a2 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -533,7 +533,7 @@ if (! empty($arrayfields['p.public']['checked'])) if (! empty($arrayfields['p.fk_opp_status']['checked'])) { print ''; - print $formproject->selectOpportunityStatus('search_opp_status', $search_opp_status, 1, 1, 1, 0, 'maxwidth100'); + print $formproject->selectOpportunityStatus('search_opp_status', $search_opp_status, 1, 0, 1, 0, 'maxwidth100'); print ''; } if (! empty($arrayfields['p.opp_amount']['checked'])) From 70826c31912808e6ddce76783f416b245f41c3f8 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 7 Nov 2018 16:32:23 +0100 Subject: [PATCH 5/7] FIX : same on lines --- htdocs/projet/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 5f683a251a2..86f1c2ffcad 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -742,7 +742,7 @@ while ($i < min($num,$limit)) if (! empty($arrayfields['p.fk_opp_status']['checked'])) { print ''; - if ($obj->opp_status_code) print $langs->trans("OppStatusShort".$obj->opp_status_code); + if ($obj->opp_status_code) print $langs->trans("OppStatus".$obj->opp_status_code); print ''; if (! $i) $totalarray['nbfield']++; } From 670eed1e688dce5464d43bd031137a525fc1a399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 8 Nov 2018 12:13:07 +0100 Subject: [PATCH 6/7] Update index.php --- htdocs/fichinter/stats/index.php | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index 39cad7ca4f1..9bbbea09141 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -49,10 +49,7 @@ $endyear=$year; $object_status=GETPOST('object_status'); -$langs->load('interventions'); -$langs->load('companies'); -$langs->load('other'); -$langs->load('suppliers'); +$langs->loadLangs(array('interventions', 'companies', 'other', 'suppliers')); /* @@ -62,11 +59,8 @@ $langs->load('suppliers'); $form=new Form($db); $objectstatic=new FichInter($db); -if ($mode == 'customer') -{ - $title=$langs->trans("InterventionStatistics"); - $dir=$conf->ficheinter->dir_temp; -} +$title=$langs->trans("InterventionStatistics"); +$dir=$conf->ficheinter->dir_temp; llxHeader('', $title); @@ -79,19 +73,18 @@ if ($object_status != '' && $object_status > -1) $stats->where .= ' AND c.fk_sta // Build graphic number of object $data = $stats->getNbByMonthWithPrevYear($endyear,$startyear); -//var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) if (!$user->rights->societe->client->voir || $user->societe_id) { $filenamenb = $dir.'/interventionsnbinyear-'.$user->id.'-'.$year.'.png'; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsnbinyear-'.$user->id.'-'.$year.'.png'; + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsnbinyear-'.$user->id.'-'.$year.'.png'; } else { $filenamenb = $dir.'/interventionsnbinyear-'.$year.'.png'; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsnbinyear-'.$year.'.png'; + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsnbinyear-'.$year.'.png'; } $px1 = new DolGraph(); @@ -123,7 +116,6 @@ if (! $mesg) // Build graphic amount of object $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear); -//var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) if (!$user->rights->societe->client->voir || $user->societe_id) @@ -283,7 +275,8 @@ foreach ($data as $val) { $year = $val['year']; while (! empty($year) && $oldyear > $year+1) - { // If we have empty year + { + // If we have empty year $oldyear--; print ''; From 8bb1545ed012e38c3f7a2c664c2a2d8f05651fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 8 Nov 2018 12:16:05 +0100 Subject: [PATCH 7/7] Update index.php --- htdocs/fichinter/stats/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index 9bbbea09141..3551d8baab3 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -233,8 +233,8 @@ print '
'; print ''.$langs->trans("Filter").''; // Company print ''.$langs->trans("ThirdParty").''; - if ($mode == 'customer') $filter='s.client in (1,2,3)'; - print $form->select_company($socid,'socid',$filter,1,0,0,array(),0,'','style="width: 95%"'); + $filter = 's.client in (1,2,3)'; + print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, '', 'style="width: 95%"'); print ''; // User print ''.$langs->trans("CreatedBy").'';