From 053ae8224b45b0940d0539e35a4b9be5bfacfab3 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 27 Jul 2019 06:36:39 +0200 Subject: [PATCH 01/59] NEW Box use fiscal year (Thanks Yves57) --- .../boxes/box_graph_invoices_permonth.php | 23 +++++++++++++--- .../box_graph_invoices_supplier_permonth.php | 23 +++++++++++++--- .../core/boxes/box_graph_orders_permonth.php | 23 +++++++++++++--- .../box_graph_orders_supplier_permonth.php | 23 +++++++++++++--- .../boxes/box_graph_propales_permonth.php | 23 +++++++++++++--- htdocs/core/class/stats.class.php | 27 +++++++++++++------ 6 files changed, 114 insertions(+), 28 deletions(-) diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 5c747065138..ad2505374b8 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -74,6 +74,9 @@ class box_graph_invoices_permonth extends ModeleBoxes //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; //$facturestatic=new Facture($db); + $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0; + if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 0; + $text = $langs->trans("BoxCustomersInvoicesPerMonth", $max); $this->info_box_head = array( 'text' => $text, @@ -129,7 +132,7 @@ class box_graph_invoices_permonth extends ModeleBoxes // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($shownb) { - $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0)); + $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png"; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png'; @@ -146,7 +149,13 @@ class box_graph_invoices_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - $legend[]=$i; + if ($startmonth != 0) { + $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + } + else + { + $legend[]=$i; + } $i++; } $px1->SetLegend($legend); @@ -167,7 +176,7 @@ class box_graph_invoices_permonth extends ModeleBoxes // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($showtot) { - $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0)); + $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."invoicesamountinyear-".$endyear.".png"; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$endyear.'.png'; @@ -184,7 +193,13 @@ class box_graph_invoices_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - $legend[]=$i; + if ($startmonth != 0) { + $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + } + else + { + $legend[]=$i; + } $i++; } $px2->SetLegend($legend); diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index d06098daa3b..83779501df7 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -73,6 +73,9 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; + $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0; + if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 0; + $text = $langs->trans("BoxSuppliersInvoicesPerMonth", $max); $this->info_box_head = array( 'text' => $text, @@ -126,7 +129,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($shownb) { - $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0)); + $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."invoicessuppliernbinyear-".$year.".png"; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png'; @@ -143,7 +146,13 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - $legend[]=$i; + if ($startmonth != 0) { + $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + } + else + { + $legend[]=$i; + } $i++; } $px1->SetLegend($legend); @@ -164,7 +173,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($showtot) { - $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0)); + $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."invoicessupplieramountinyear-".$year.".png"; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$year.'.png'; @@ -181,7 +190,13 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - $legend[]=$i; + if ($startmonth != 0) { + $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + } + else + { + $legend[]=$i; + } $i++; } $px2->SetLegend($legend); diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 8c4cb250376..8aa465782b6 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -74,6 +74,9 @@ class box_graph_orders_permonth extends ModeleBoxes //include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; //$commandestatic=new Commande($db); + $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0; + if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 0; + $text = $langs->trans("BoxCustomersOrdersPerMonth", $max); $this->info_box_head = array( 'text' => $text, @@ -129,7 +132,7 @@ class box_graph_orders_permonth extends ModeleBoxes // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($shownb) { - $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0)); + $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."ordersnbinyear-".$endyear.".png"; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png'; @@ -144,7 +147,13 @@ class box_graph_orders_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - $legend[]=$i; + if ($startmonth != 0) { + $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + } + else + { + $legend[]=$i; + } $i++; } $px1->SetLegend($legend); @@ -165,7 +174,7 @@ class box_graph_orders_permonth extends ModeleBoxes // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($showtot) { - $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0)); + $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."ordersamountinyear-".$endyear.".png"; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png'; @@ -180,7 +189,13 @@ class box_graph_orders_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - $legend[]=$i; + if ($startmonth != 0) { + $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + } + else + { + $legend[]=$i; + } $i++; } $px2->SetLegend($legend); diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index a584c7288ca..a5d5c9e6c0f 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -73,6 +73,9 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; + $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0; + if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 0; + $text = $langs->trans("BoxSuppliersOrdersPerMonth", $max); $this->info_box_head = array( 'text' => $text, @@ -128,7 +131,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($shownb) { - $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0)); + $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."orderssuppliernbinyear-".$endyear.".png"; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png'; @@ -143,7 +146,13 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - $legend[]=$i; + if ($startmonth != 0) { + $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + } + else + { + $legend[]=$i; + } $i++; } $px1->SetLegend($legend); @@ -164,7 +173,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($showtot) { - $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0)); + $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."orderssupplieramountinyear-".$endyear.".png"; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png'; @@ -179,7 +188,13 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - $legend[]=$i; + if ($startmonth != 0) { + $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + } + else + { + $legend[]=$i; + } $i++; } $px2->SetLegend($legend); diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 861c5086704..763cdb855f9 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -74,6 +74,9 @@ class box_graph_propales_permonth extends ModeleBoxes //include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; //$propalstatic=new Propal($db); + $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0; + if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 0; + $langs->load("propal"); $text = $langs->trans("BoxProposalsPerMonth", $max); @@ -128,7 +131,7 @@ class box_graph_propales_permonth extends ModeleBoxes // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($shownb) { - $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0)); + $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $datatype1 = array_pad(array(), ($endyear-$startyear+1), 'bars'); $filenamenb = $dir."/".$prefix."propalsnbinyear-".$endyear.".png"; @@ -144,7 +147,13 @@ class box_graph_propales_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - $legend[]=$i; + if ($startmonth != 0) { + $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + } + else + { + $legend[]=$i; + } $i++; } $px1->SetLegend($legend); @@ -165,7 +174,7 @@ class box_graph_propales_permonth extends ModeleBoxes // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($showtot) { - $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0)); + $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $datatype2 = array_pad(array(), ($endyear-$startyear+1), 'bars'); //$datatype2 = array('lines','bars'); @@ -183,7 +192,13 @@ class box_graph_propales_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - $legend[]=$i; + if ($startmonth != 0) { + $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + } + else + { + $legend[]=$i; + } $i++; } $px2->SetLegend($legend); diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index 08025161a0d..b41c1d8dfa6 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -39,10 +39,12 @@ abstract class Stats * @param int $endyear Start year * @param int $startyear End year * @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save) - * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month - * @return array Array of values + * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month + * @param int $startmonth month of the fiscal year start minus 1; 0=january + * @return array Array of values + */ - public function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0) + public function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth=0) { global $conf,$user,$langs; @@ -86,6 +88,10 @@ abstract class Stats else { $year=$startyear; + if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) { + $startmonth = 0; + } + if ($startmonth != 0) $year = $year - 1; while ($year <= $endyear) { $datay[$year] = $this->getNbByMonth($year, $format); @@ -96,11 +102,11 @@ abstract class Stats for ($i = 0 ; $i < 12 ; $i++) { - $data[$i][]=$datay[$endyear][$i][0]; + $data[$i][]=$datay[$endyear][($i+$startmonth)%12][0]; $year=$startyear; while($year <= $endyear) { - $data[$i][]=$datay[$year][$i][1]; + $data[$i][]=$datay[$year - (1 - (int)(($i+$startmonth)/12)) + ($startmonth == 0 ? 1 : 0)][($i+$startmonth)%12][1]; $year++; } } @@ -134,9 +140,10 @@ abstract class Stats * @param int $startyear End year * @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save) * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month + * @param int $startmonth month of the fiscal year start minus 1; 0=january * @return array Array of values */ - public function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0) + public function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth=0) { global $conf,$user,$langs; @@ -181,6 +188,10 @@ abstract class Stats else { $year=$startyear; + if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) { + $startmonth = 0; + } + if ($startmonth != 0) $year = $year - 1; while($year <= $endyear) { $datay[$year] = $this->getAmountByMonth($year, $format); @@ -191,11 +202,11 @@ abstract class Stats // $data = array('xval'=>array(0=>xlabel,1=>yval1,2=>yval2...),...) for ($i = 0 ; $i < 12 ; $i++) { - $data[$i][]=$datay[$endyear][$i][0]; // set label + $data[$i][]=$datay[$endyear][($i+$startmonth)%12][0]; // set label $year=$startyear; while($year <= $endyear) { - $data[$i][]=$datay[$year][$i][1]; // set yval for x=i + $data[$i][]=$datay[$year - (1 - (int)(($i+$startmonth)/12)) + ($startmonth == 0 ? 1 : 0)][($i+$startmonth)%12][1]; // set yval for x=i $year++; } } From 83e2f71e079641e2ad85ab9db454418490f7f12d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 27 Jul 2019 07:56:33 +0200 Subject: [PATCH 02/59] Fix travis --- htdocs/core/boxes/box_graph_invoices_permonth.php | 6 ++++-- .../core/boxes/box_graph_invoices_supplier_permonth.php | 6 ++++-- htdocs/core/boxes/box_graph_orders_permonth.php | 6 ++++-- htdocs/core/boxes/box_graph_orders_supplier_permonth.php | 6 ++++-- htdocs/core/boxes/box_graph_propales_permonth.php | 6 ++++-- htdocs/core/class/stats.class.php | 8 ++++---- 6 files changed, 24 insertions(+), 14 deletions(-) diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index ad2505374b8..dc02d7421df 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -149,7 +149,8 @@ class box_graph_invoices_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) { + if ($startmonth != 0) + { $legend[]=sprintf("%d/%d",$i-2001, $i-2000); } else @@ -193,7 +194,8 @@ class box_graph_invoices_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) { + if ($startmonth != 0) + { $legend[]=sprintf("%d/%d",$i-2001, $i-2000); } else diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 83779501df7..12836031714 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -146,7 +146,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) { + if ($startmonth != 0) + { $legend[]=sprintf("%d/%d",$i-2001, $i-2000); } else @@ -190,7 +191,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) { + if ($startmonth != 0) + { $legend[]=sprintf("%d/%d",$i-2001, $i-2000); } else diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 8aa465782b6..b338d562132 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -147,7 +147,8 @@ class box_graph_orders_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) { + if ($startmonth != 0) + { $legend[]=sprintf("%d/%d",$i-2001, $i-2000); } else @@ -189,7 +190,8 @@ class box_graph_orders_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) { + if ($startmonth != 0) + { $legend[]=sprintf("%d/%d",$i-2001, $i-2000); } else diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index a5d5c9e6c0f..e9ec246fef0 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -146,7 +146,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) { + if ($startmonth != 0) + { $legend[]=sprintf("%d/%d",$i-2001, $i-2000); } else @@ -188,7 +189,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) { + if ($startmonth != 0) + { $legend[]=sprintf("%d/%d",$i-2001, $i-2000); } else diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 763cdb855f9..effe625b930 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -147,7 +147,8 @@ class box_graph_propales_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) { + if ($startmonth != 0) + { $legend[]=sprintf("%d/%d",$i-2001, $i-2000); } else @@ -192,7 +193,8 @@ class box_graph_propales_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) { + if ($startmonth != 0) + { $legend[]=sprintf("%d/%d",$i-2001, $i-2000); } else diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index b41c1d8dfa6..2544441e16b 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -40,11 +40,11 @@ abstract class Stats * @param int $startyear End year * @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save) * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month - * @param int $startmonth month of the fiscal year start minus 1; 0=january + * @param int $startmonth month of the fiscal year start min 1 max 12 ; if 0 = january * @return array Array of values */ - public function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth=0) + public function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 0) { global $conf,$user,$langs; @@ -140,10 +140,10 @@ abstract class Stats * @param int $startyear End year * @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save) * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month - * @param int $startmonth month of the fiscal year start minus 1; 0=january + * @param int $startmonth month of the fiscal year start min 1 max 12 ; if 0 = january * @return array Array of values */ - public function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth=0) + public function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 0) { global $conf,$user,$langs; From 3e69421ec3abdc9f650873c25cfb3a3088df12b7 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 28 Jul 2019 07:33:57 +0200 Subject: [PATCH 03/59] Fix travis --- htdocs/core/boxes/box_graph_invoices_permonth.php | 4 ++-- htdocs/core/boxes/box_graph_invoices_supplier_permonth.php | 4 ++-- htdocs/core/boxes/box_graph_orders_permonth.php | 4 ++-- htdocs/core/boxes/box_graph_orders_supplier_permonth.php | 4 ++-- htdocs/core/boxes/box_graph_propales_permonth.php | 2 +- htdocs/core/class/stats.class.php | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index dc02d7421df..d33600c0fc8 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -151,7 +151,7 @@ class box_graph_invoices_permonth extends ModeleBoxes { if ($startmonth != 0) { - $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } else { @@ -196,7 +196,7 @@ class box_graph_invoices_permonth extends ModeleBoxes { if ($startmonth != 0) { - $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } else { diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 12836031714..d01d5b6252f 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -148,7 +148,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes { if ($startmonth != 0) { - $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } else { @@ -193,7 +193,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes { if ($startmonth != 0) { - $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } else { diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index b338d562132..f9be1c79cea 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -149,7 +149,7 @@ class box_graph_orders_permonth extends ModeleBoxes { if ($startmonth != 0) { - $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } else { @@ -192,7 +192,7 @@ class box_graph_orders_permonth extends ModeleBoxes { if ($startmonth != 0) { - $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } else { diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index e9ec246fef0..1f907fc01be 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -148,7 +148,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes { if ($startmonth != 0) { - $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } else { @@ -191,7 +191,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes { if ($startmonth != 0) { - $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } else { diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index effe625b930..7179f255add 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -149,7 +149,7 @@ class box_graph_propales_permonth extends ModeleBoxes { if ($startmonth != 0) { - $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } else { diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index 2544441e16b..f873b0f5deb 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -106,7 +106,7 @@ abstract class Stats $year=$startyear; while($year <= $endyear) { - $data[$i][]=$datay[$year - (1 - (int)(($i+$startmonth)/12)) + ($startmonth == 0 ? 1 : 0)][($i+$startmonth)%12][1]; + $data[$i][]=$datay[$year - (1 - (int)(($i+$startmonth)/12)) + ($startmonth == 0 ? 1 : 0 )][($i+$startmonth)%12][1]; $year++; } } @@ -206,7 +206,7 @@ abstract class Stats $year=$startyear; while($year <= $endyear) { - $data[$i][]=$datay[$year - (1 - (int)(($i+$startmonth)/12)) + ($startmonth == 0 ? 1 : 0)][($i+$startmonth)%12][1]; // set yval for x=i + $data[$i][]=$datay[$year - (1 - (int)(($i+$startmonth)/12)) + ($startmonth == 0 ? 1 : 0 )][($i+$startmonth)%12][1]; // set yval for x=i $year++; } } From 8228979e6777fc71e3aaaedf884637713b401632 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 30 Jul 2019 09:18:18 +0200 Subject: [PATCH 04/59] Fix travis --- htdocs/core/class/stats.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index f873b0f5deb..a15800f8ce6 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -106,7 +106,7 @@ abstract class Stats $year=$startyear; while($year <= $endyear) { - $data[$i][]=$datay[$year - (1 - (int)(($i+$startmonth)/12)) + ($startmonth == 0 ? 1 : 0 )][($i+$startmonth)%12][1]; + $data[$i][]=$datay[$year - (1 - (int) (($i+$startmonth)/12)) + ($startmonth == 0 ? 1 : 0)][($i+$startmonth)%12][1]; $year++; } } @@ -206,7 +206,7 @@ abstract class Stats $year=$startyear; while($year <= $endyear) { - $data[$i][]=$datay[$year - (1 - (int)(($i+$startmonth)/12)) + ($startmonth == 0 ? 1 : 0 )][($i+$startmonth)%12][1]; // set yval for x=i + $data[$i][]=$datay[$year - (1 - (int) (($i+$startmonth)/12)) + ($startmonth == 0 ? 1 : 0)][($i+$startmonth)%12][1]; // set yval for x=i $year++; } } From b146004966870bca95acbd269b0563932a5e8356 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 30 Jul 2019 11:06:40 +0200 Subject: [PATCH 05/59] Fix travis --- htdocs/core/boxes/box_graph_propales_permonth.php | 2 +- htdocs/core/class/stats.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 7179f255add..78cbadc6fb2 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -195,7 +195,7 @@ class box_graph_propales_permonth extends ModeleBoxes { if ($startmonth != 0) { - $legend[]=sprintf("%d/%d",$i-2001, $i-2000); + $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } else { diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index a15800f8ce6..85a6f43ed4d 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -106,7 +106,7 @@ abstract class Stats $year=$startyear; while($year <= $endyear) { - $data[$i][]=$datay[$year - (1 - (int) (($i+$startmonth)/12)) + ($startmonth == 0 ? 1 : 0)][($i+$startmonth)%12][1]; + $data[$i][]=$datay[$year - (1 - ((int) ($i+$startmonth)/12) + ($startmonth == 0 ? 1 : 0))][($i+$startmonth)%12][1]; $year++; } } @@ -206,7 +206,7 @@ abstract class Stats $year=$startyear; while($year <= $endyear) { - $data[$i][]=$datay[$year - (1 - (int) (($i+$startmonth)/12)) + ($startmonth == 0 ? 1 : 0)][($i+$startmonth)%12][1]; // set yval for x=i + $data[$i][]=$datay[$year - (1 - ((int) ($i+$startmonth)/12) + ($startmonth == 0 ? 1 : 0))][($i+$startmonth)%12][1]; // set yval for x=i $year++; } } From f64092a1e84896b91d54c56cd7d9b49936bca74f Mon Sep 17 00:00:00 2001 From: atm-arnaud Date: Thu, 1 Aug 2019 11:00:49 +0200 Subject: [PATCH 06/59] FIX order or proposals billed if both workflow conf activated --- .../interface_20_modWorkflow_WorkflowManager.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 2c7ee724d2f..583701f7bc9 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -121,7 +121,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers if ($action == 'BILL_VALIDATE') { dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id ); - + $ret = null; + // First classify billed the order to allow the proposal classify process if (! empty($conf->commande->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) { @@ -142,7 +143,6 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } } - return $ret; } // Second classify billed the proposal. @@ -165,8 +165,9 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } } - return $ret; } + + return $ret; } // classify billed order & billed propososal From cd0d5c41f5d02952ba556f9487d03f3281024636 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Aug 2019 16:37:40 +0200 Subject: [PATCH 07/59] Update interface_20_modWorkflow_WorkflowManager.class.php --- .../triggers/interface_20_modWorkflow_WorkflowManager.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 583701f7bc9..8c849f5fa40 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -121,7 +121,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers if ($action == 'BILL_VALIDATE') { dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id ); - $ret = null; + $ret = 0; // First classify billed the order to allow the proposal classify process if (! empty($conf->commande->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) From 7a2e08a6812bec0ecfde8355ea999558f8dbf92e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 2 Aug 2019 11:41:40 +0200 Subject: [PATCH 08/59] Fix author in message / ticket API --- htdocs/ticket/class/api_tickets.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 060ddc36ff3..c23ec3da151 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -160,15 +160,15 @@ class Tickets extends DolibarrApi $num = count($this->ticket->cache_msgs_ticket); $i = 0; while ($i < $num) { - if ($this->ticket->cache_msgs_ticket[$i]['fk_user_action'] > 0) { + if ($this->ticket->cache_msgs_ticket[$i]['fk_user_author'] > 0) { $user_action = new User($this->db); - $user_action->fetch($this->ticket->cache_msgs_ticket[$i]['fk_user_action']); + $user_action->fetch($this->ticket->cache_msgs_ticket[$i]['fk_user_author']); } // Now define messages $messages[] = array( 'id' => $this->ticket->cache_msgs_ticket[$i]['id'], - 'fk_user_action' => $this->ticket->cache_msgs_ticket[$i]['fk_user_action'], + 'fk_user_action' => $this->ticket->cache_msgs_ticket[$i]['fk_user_author'], 'fk_user_action_socid' => $user_action->socid, 'fk_user_action_string' => dolGetFirstLastname($user_action->firstname, $user_action->lastname), 'message' => $this->ticket->cache_msgs_ticket[$i]['message'], @@ -195,6 +195,7 @@ class Tickets extends DolibarrApi // Now define messages $history[] = array( 'id' => $this->ticket->cache_logs_ticket[$i]['id'], + 'fk_user_author' => $this->ticket->cache_msgs_ticket[$i]['fk_user_author'], 'fk_user_action' => $this->ticket->cache_logs_ticket[$i]['fk_user_create'], 'fk_user_action_string' => dolGetFirstLastname($user_action->firstname, $user_action->lastname), 'message' => $this->ticket->cache_logs_ticket[$i]['message'], From 74e3a423fdea0c85d1e1e6ee9bc8bceff710df67 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 2 Aug 2019 12:35:00 +0200 Subject: [PATCH 09/59] Fix document list for products in API --- htdocs/api/class/api_documents.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index f4a7084b336..48d6bf5b903 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -368,7 +368,7 @@ class Documents extends DolibarrApi throw new RestException(404, 'Product not found'); } - $upload_dir = $conf->product->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'product'); + $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref); } elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') { From 3a0c1954d6358c5e1909871ba146b68559d01c51 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 2 Aug 2019 13:23:15 +0200 Subject: [PATCH 10/59] Fix application_fee_amount need fix in v10 too --- htdocs/stripe/class/stripe.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index c731637fce6..69c422c8c7c 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -403,7 +403,7 @@ class Stripe extends CommonObject if ($conf->entity!=$conf->global->STRIPECONNECT_PRINCIPAL && $stripefee > 0) { - $dataforintent["application_fee"] = $stripefee; + $dataforintent["application_fee_amount"] = $stripefee; } if ($usethirdpartyemailforreceiptemail && is_object($object) && $object->thirdparty->email) { @@ -730,7 +730,7 @@ class Stripe extends CommonObject ); if ($conf->entity!=$conf->global->STRIPECONNECT_PRINCIPAL && $stripefee > 0) { - $paymentarray["application_fee"] = $stripefee; + $paymentarray["application_fee_amount"] = $stripefee; } if ($societe->email && $usethirdpartyemailforreceiptemail) { From 2d34a0c4c164d3caa5c9f5c3a5355d064a051f8b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 2 Aug 2019 14:48:45 +0200 Subject: [PATCH 11/59] Fix table in admin stripe.php --- htdocs/stripe/admin/stripe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index c2b2143f277..02039f3edc2 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -254,7 +254,7 @@ if (empty($conf->stripeconnect->enabled)) print price($conf->global->STRIPE_APPLICATION_FEE_PERCENT); print '% + '; print price($conf->global->STRIPE_APPLICATION_FEE); - print ' '.$langs->getCurrencySymbol($conf->currency).' '.$langs->trans("minimum").' '.price($conf->global->STRIPE_APPLICATION_FEE_MINIMAL).' '.$langs->getCurrencySymbol($conf->currency).' '; + print ' '.$langs->getCurrencySymbol($conf->currency).' '.$langs->trans("minimum").' '.price($conf->global->STRIPE_APPLICATION_FEE_MINIMAL).' '.$langs->getCurrencySymbol($conf->currency); print ''; } From 7eb48a3f9ce8ff8ff452dfcef059c1bb16c7f22e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 3 Aug 2019 06:04:42 +0200 Subject: [PATCH 12/59] Fix month of the fiscal year start min 1 max 12 / january = 1 --- .../boxes/box_graph_invoices_permonth.php | 8 ++--- .../box_graph_invoices_supplier_permonth.php | 8 ++--- .../core/boxes/box_graph_orders_permonth.php | 8 ++--- .../box_graph_orders_supplier_permonth.php | 8 ++--- .../boxes/box_graph_propales_permonth.php | 8 ++--- htdocs/core/class/stats.class.php | 35 +++++++++---------- 6 files changed, 37 insertions(+), 38 deletions(-) diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index d33600c0fc8..6e5afe5df99 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -74,8 +74,8 @@ class box_graph_invoices_permonth extends ModeleBoxes //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; //$facturestatic=new Facture($db); - $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0; - if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 0; + $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1; + if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1; $text = $langs->trans("BoxCustomersInvoicesPerMonth", $max); $this->info_box_head = array( @@ -149,7 +149,7 @@ class box_graph_invoices_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) + if ($startmonth != 1) { $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } @@ -194,7 +194,7 @@ class box_graph_invoices_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) + if ($startmonth != 1) { $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index d01d5b6252f..df4f4afc146 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -73,8 +73,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; - $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0; - if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 0; + $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1; + if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1; $text = $langs->trans("BoxSuppliersInvoicesPerMonth", $max); $this->info_box_head = array( @@ -146,7 +146,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) + if ($startmonth != 1) { $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } @@ -191,7 +191,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) + if ($startmonth != 1) { $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index f9be1c79cea..b530b4ea268 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -74,8 +74,8 @@ class box_graph_orders_permonth extends ModeleBoxes //include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; //$commandestatic=new Commande($db); - $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0; - if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 0; + $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1; + if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1; $text = $langs->trans("BoxCustomersOrdersPerMonth", $max); $this->info_box_head = array( @@ -147,7 +147,7 @@ class box_graph_orders_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) + if ($startmonth != 1) { $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } @@ -190,7 +190,7 @@ class box_graph_orders_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) + if ($startmonth != 1) { $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 1f907fc01be..8359ddbe070 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -73,8 +73,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; - $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0; - if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 0; + $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1; + if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1; $text = $langs->trans("BoxSuppliersOrdersPerMonth", $max); $this->info_box_head = array( @@ -146,7 +146,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) + if ($startmonth != 1) { $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } @@ -189,7 +189,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) + if ($startmonth != 1) { $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 78cbadc6fb2..75673ee3fce 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -74,8 +74,8 @@ class box_graph_propales_permonth extends ModeleBoxes //include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; //$propalstatic=new Propal($db); - $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0; - if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 0; + $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1; + if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1; $langs->load("propal"); @@ -147,7 +147,7 @@ class box_graph_propales_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) + if ($startmonth != 1) { $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } @@ -193,7 +193,7 @@ class box_graph_propales_permonth extends ModeleBoxes $i=$startyear;$legend=array(); while ($i <= $endyear) { - if ($startmonth != 0) + if ($startmonth != 1) { $legend[]=sprintf("%d/%d", $i-2001, $i-2000); } diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index 85a6f43ed4d..8df81bd4495 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -40,11 +40,11 @@ abstract class Stats * @param int $startyear End year * @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save) * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month - * @param int $startmonth month of the fiscal year start min 1 max 12 ; if 0 = january + * @param int $startmonth month of the fiscal year start min 1 max 12 ; if 1 = january * @return array Array of values */ - public function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 0) + public function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 1) { global $conf,$user,$langs; @@ -88,10 +88,8 @@ abstract class Stats else { $year=$startyear; - if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) { - $startmonth = 0; - } - if ($startmonth != 0) $year = $year - 1; + $sm = $startmonth - 1; + if ($sm != 0) $year = $year - 1; while ($year <= $endyear) { $datay[$year] = $this->getNbByMonth($year, $format); @@ -102,11 +100,11 @@ abstract class Stats for ($i = 0 ; $i < 12 ; $i++) { - $data[$i][]=$datay[$endyear][($i+$startmonth)%12][0]; + $data[$i][]=$datay[$endyear][($i+$sm)%12][0]; $year=$startyear; while($year <= $endyear) { - $data[$i][]=$datay[$year - (1 - ((int) ($i+$startmonth)/12) + ($startmonth == 0 ? 1 : 0))][($i+$startmonth)%12][1]; + $data[$i][]=$datay[$year - (1 - ((int) ($i+$sm)/12)) + ($sm == 0 ? 1 : 0)][($i+$sm)%12][1]; $year++; } } @@ -140,10 +138,10 @@ abstract class Stats * @param int $startyear End year * @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save) * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month - * @param int $startmonth month of the fiscal year start min 1 max 12 ; if 0 = january + * @param int $startmonth month of the fiscal year start min 1 max 12 ; if 1 = january * @return array Array of values */ - public function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 0) + public function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 1) { global $conf,$user,$langs; @@ -188,10 +186,8 @@ abstract class Stats else { $year=$startyear; - if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) { - $startmonth = 0; - } - if ($startmonth != 0) $year = $year - 1; + $sm = $startmonth - 1; + if ($sm != 0) $year = $year - 1; while($year <= $endyear) { $datay[$year] = $this->getAmountByMonth($year, $format); @@ -202,11 +198,11 @@ abstract class Stats // $data = array('xval'=>array(0=>xlabel,1=>yval1,2=>yval2...),...) for ($i = 0 ; $i < 12 ; $i++) { - $data[$i][]=$datay[$endyear][($i+$startmonth)%12][0]; // set label + $data[$i][]=$datay[$endyear][($i+$sm)%12][0]; // set label $year=$startyear; while($year <= $endyear) { - $data[$i][]=$datay[$year - (1 - ((int) ($i+$startmonth)/12) + ($startmonth == 0 ? 1 : 0))][($i+$startmonth)%12][1]; // set yval for x=i + $data[$i][]=$datay[$year - (1 - ((int) ($i+$sm)/12)) + ($sm == 0 ? 1 : 0)][($i+$sm)%12][1]; // set yval for x=i $year++; } } @@ -422,7 +418,8 @@ abstract class Stats // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** - * Renvoie le nombre de proposition par mois pour une annee donnee + * Renvoie le nombre de documents par mois pour une annee donnee + * Return number of documents per month for a given year * * @param int $year Year * @param string $sql SQL @@ -481,7 +478,8 @@ abstract class Stats // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** - * Renvoie le nombre d'element par mois pour une annee donnee + * Renvoie le montant totalise par mois pour une annee donnee + * Return the amount per month for a given year * * @param int $year Year * @param string $sql SQL @@ -538,6 +536,7 @@ abstract class Stats // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Renvoie le montant moyen par mois pour une annee donnee + * Return the amount average par month for a given year * * @param int $year Year * @param string $sql SQL From 13eef54392e8a5f415c4c2eef0bdb8e3b0350ca4 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Aug 2019 12:31:13 +0200 Subject: [PATCH 13/59] Fix round for application fee in stripe --- htdocs/stripe/class/stripe.class.php | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index c731637fce6..28ba74fa91b 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -319,14 +319,14 @@ class Stripe extends CommonObject if (! in_array($currency_code, $arrayzerounitcurrency)) $stripeamount = $amount * 100; else $stripeamount = $amount; - $fee = round($amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE); + $fee = $amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE; if ($fee >= $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL && $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL > $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) { - $fee = round($conf->global->STRIPE_APPLICATION_FEE_MAXIMAL); + $fee = $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL; } elseif ($fee < $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) { - $fee = round($conf->global->STRIPE_APPLICATION_FEE_MINIMAL); + $fee = $conf->global->STRIPE_APPLICATION_FEE_MINIMAL; } - if (! in_array($currency_code, $arrayzerounitcurrency)) $stripefee = $fee * 100; - else $stripefee = $fee; + if (! in_array($currency, $arrayzerounitcurrency)) $stripefee = round($fee * 100); + else $stripefee = round($fee); $paymentintent = null; @@ -708,15 +708,14 @@ class Stripe extends CommonObject $charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$description")); } } else { - $fee = round($amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE); - if ($fee >= $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL && $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL > $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) { - $fee = round($conf->global->STRIPE_APPLICATION_FEE_MAXIMAL); - } - elseif ($fee < $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) { - $fee = round($conf->global->STRIPE_APPLICATION_FEE_MINIMAL); - } - if (! in_array($currency, $arrayzerounitcurrency)) $stripefee = $fee * 100; - else $stripefee = $fee; + $fee = $amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE; + if ($fee >= $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL && $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL > $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) { + $fee = $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL; + } elseif ($fee < $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) { + $fee = $conf->global->STRIPE_APPLICATION_FEE_MINIMAL; + } + if (! in_array($currency, $arrayzerounitcurrency)) $stripefee = round($fee * 100); + else $stripefee = round($fee); $paymentarray = array( "amount" => "$stripeamount", From d30ce126e0838cb7f174cb88dd2be842f83e08f3 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Aug 2019 13:00:52 +0200 Subject: [PATCH 14/59] Fix update stripe api for more compliance to API --- htdocs/stripe/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index 5638a10d332..17ca74b7955 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -55,4 +55,4 @@ else \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); \Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version -\Stripe\Stripe::setApiVersion("2019-03-14"); // force version API +\Stripe\Stripe::setApiVersion("2019-05-16"); // force version API From 07cc21a113187c85887bdfe9844be9d370697067 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Aug 2019 20:35:53 +0200 Subject: [PATCH 15/59] Fix display payment intent in stripe's charge list --- htdocs/stripe/charge.php | 47 +++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index e8823119e30..80c633b0254 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -121,6 +121,31 @@ if (!$rowid) //print $list; foreach ($list->data as $charge) { + if ($charge->refunded=='1'){ + $status = img_picto($langs->trans("refunded"), 'statut6'); + } elseif ($charge->paid=='1'){ + $status = img_picto($langs->trans("".$charge->status.""), 'statut4'); + } else { + $label="Message: ".$charge->failure_message."
"; + $label.="Réseau: ".$charge->outcome->network_status."
"; + $label.="Statut: ".$langs->trans("".$charge->outcome->seller_message.""); + $status = $form->textwithpicto(img_picto($langs->trans("".$charge->status.""), 'statut8'), $label, 1); + } + + if ($charge->payment_method_details->type=='card') + { + $type = $langs->trans("card"); + } + elseif ($charge->source->type=='card'){ + $type = $langs->trans("card"); + } elseif ($charge->payment_method_details->type=='three_d_secure'){ + $type = $langs->trans("card3DS"); + } + + if (! empty($charge->payment_intent)) { + $charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent); + } + // The metadata FULLTAG is defined by the online payment page $FULLTAG=$charge->metadata->FULLTAG; @@ -205,31 +230,13 @@ if (!$rowid) print ''.dol_print_date($charge->created, '%d/%m/%Y %H:%M')."\n"; // Type print ''; - if ($charge->source->object=='card') - { - print $langs->trans("card"); - } - elseif ($charge->source->type=='card'){ - print $langs->trans("card"); - } elseif ($charge->source->type=='three_d_secure'){ - print $langs->trans("card3DS"); - } + print $type; print ''; // Amount print ''.price(($charge->amount-$charge->amount_refunded)/100, 0, '', 1, - 1, - 1, strtoupper($charge->currency)).""; // Status print ''; - if ($charge->refunded=='1'){ - print img_picto($langs->trans("refunded"), 'statut6'); - } elseif ($charge->paid=='1'){ - - print img_picto($langs->trans("".$charge->status.""), 'statut4'); - } else { - $label="Message: ".$charge->failure_message."
"; - $label.="Réseau: ".$charge->outcome->network_status."
"; - $label.="Statut: ".$langs->trans("".$charge->outcome->seller_message.""); - print $form->textwithpicto(img_picto($langs->trans("".$charge->status.""), 'statut8'), $label, 1); - } + print $status; print "\n"; print "\n"; From 7f42380f834b8b8dd69f80b3885a440b47a5b7df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Aug 2019 20:53:18 +0200 Subject: [PATCH 16/59] FIX Fatal situation if payment removed on expense report. Action set_unpaid was not available. --- htdocs/expensereport/card.php | 40 +++++++++++++++++-- .../class/expensereport.class.php | 4 +- htdocs/langs/en_US/bills.lang | 1 + htdocs/langs/fr_FR/bills.lang | 1 + 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index b57de324df6..14e86c49cb6 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -989,6 +989,34 @@ if (empty($reshook)) } } + if ($action == 'set_unpaid' && $id > 0 && $user->rights->expensereport->to_paid) + { + $object = new ExpenseReport($db); + $object->fetch($id); + + $result = $object->set_unpaid($user); + + if ($result > 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + } + if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid) { $object = new ExpenseReport($db); @@ -2373,8 +2401,8 @@ if ($action != 'create' && $action != 'edit') } - // If status is Appoved - // -------------------- + // If status is Approved + // --------------------- if ($user->rights->expensereport->approve && $object->fk_statut == 5) { @@ -2418,9 +2446,15 @@ if ($action != 'create' && $action != 'edit') print ''; } + if ($user->rights->expensereport->to_paid && $object->paid && $object->fk_statut == ExpenseReport::STATUS_CLOSED) + { + // Set unpaid + print ''; + } + // Clone if ($user->rights->expensereport->creer) { - print ''; + print ''; } /* If draft, validated, cancel, and user can create, he can always delete its card before it is approved */ diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index aec06b7972b..7dc986df07b 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1381,12 +1381,12 @@ class ExpenseReport extends CommonObject // phpcs:enable $error = 0; - if ($this->fk_c_deplacement_statuts != 5) + if ($this->paid) { $this->db->begin(); $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql.= " SET fk_statut = 5"; + $sql.= " SET paid = 0"; $sql.= ' WHERE rowid = '.$this->id; dol_syslog(get_class($this)."::set_unpaid sql=".$sql, LOG_DEBUG); diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 07370233e6c..393eebae4e4 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -94,6 +94,7 @@ PaymentHigherThanReminderToPay=Payment higher than reminder to pay HelpPaymentHigherThanReminderToPay=Attention, the payment amount of one or more bills is higher than the outstanding amount to pay.
Edit your entry, otherwise confirm and consider creating a credit note for the excess received for each overpaid invoice. HelpPaymentHigherThanReminderToPaySupplier=Attention, the payment amount of one or more bills is higher than the outstanding amount to pay.
Edit your entry, otherwise confirm and consider creating a credit note for the excess paid for each overpaid invoice. ClassifyPaid=Classify 'Paid' +ClassifyUnPaid=Classify 'Unpaid' ClassifyPaidPartially=Classify 'Paid partially' ClassifyCanceled=Classify 'Abandoned' ClassifyClosed=Classify 'Closed' diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 476298a9206..984617e1f09 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -95,6 +95,7 @@ HelpPaymentHigherThanReminderToPay=Attention, le montant de paiement pour une ou HelpPaymentHigherThanReminderToPaySupplier=Attention, le montant de paiement pour une ou plusieurs factures est supérieur au reste à payer.
Corrigez votre saisie, sinon, confirmez et pensez à créer un avoir pour l'excédent pour chaque facture surpayée. ClassifyPaid=Classer 'Payée' ClassifyPaidPartially=Classer 'Payée partiellement' +ClassifyUnPaid=Classer 'Non payée' ClassifyCanceled=Classer 'Abandonnée' ClassifyClosed=Classer 'Fermée' ClassifyUnBilled=Classer 'Non facturée' From 5339bb71ac2df1cfae61ab90acdce8c340179209 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Aug 2019 20:53:18 +0200 Subject: [PATCH 17/59] FIX Fatal situation if payment removed on expense report. Action set_unpaid was not available. --- htdocs/expensereport/card.php | 40 +++++++++++++++++-- .../class/expensereport.class.php | 4 +- htdocs/langs/en_US/bills.lang | 1 + htdocs/langs/fr_FR/bills.lang | 1 + 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 21e716d7ac1..22410ee4085 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -967,6 +967,34 @@ if (empty($reshook)) } } + if ($action == 'set_unpaid' && $id > 0 && $user->rights->expensereport->to_paid) + { + $object = new ExpenseReport($db); + $object->fetch($id); + + $result = $object->set_unpaid($user); + + if ($result > 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + } + if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid) { $object = new ExpenseReport($db); @@ -2349,8 +2377,8 @@ if ($action != 'create' && $action != 'edit') } - // If status is Appoved - // -------------------- + // If status is Approved + // --------------------- if ($user->rights->expensereport->approve && $object->fk_statut == 5) { @@ -2394,9 +2422,15 @@ if ($action != 'create' && $action != 'edit') print ''; } + if ($user->rights->expensereport->to_paid && $object->paid && $object->fk_statut == ExpenseReport::STATUS_CLOSED) + { + // Set unpaid + print ''; + } + // Clone if ($user->rights->expensereport->creer) { - print ''; + print ''; } /* If draft, validated, cancel, and user can create, he can always delete its card before it is approved */ diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 3f5029c4ef6..9bbf6617369 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1366,12 +1366,12 @@ class ExpenseReport extends CommonObject { $error = 0; - if ($this->fk_c_deplacement_statuts != 5) + if ($this->paid) { $this->db->begin(); $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql.= " SET fk_statut = 5"; + $sql.= " SET paid = 0"; $sql.= ' WHERE rowid = '.$this->id; dol_syslog(get_class($this)."::set_unpaid sql=".$sql, LOG_DEBUG); diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index fae0f88fcc5..02bddd4b923 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -94,6 +94,7 @@ PaymentHigherThanReminderToPay=Payment higher than reminder to pay HelpPaymentHigherThanReminderToPay=Attention, the payment amount of one or more bills is higher than the rest to pay.
Edit your entry, otherwise confirm and think about creating a credit note of the excess received for each overpaid invoices. HelpPaymentHigherThanReminderToPaySupplier=Attention, the payment amount of one or more bills is higher than the rest to pay.
Edit your entry, otherwise confirm and think about creating a credit note of the excess paid for each overpaid invoice. ClassifyPaid=Classify 'Paid' +ClassifyUnPaid=Classify 'Unpaid' ClassifyPaidPartially=Classify 'Paid partially' ClassifyCanceled=Classify 'Abandoned' ClassifyClosed=Classify 'Closed' diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 4b088f8dea2..cbdcd3aefaf 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -95,6 +95,7 @@ HelpPaymentHigherThanReminderToPay=Attention, le montant de paiement pour une ou HelpPaymentHigherThanReminderToPaySupplier=Attention, le montant de paiement pour une ou plusieurs factures est supérieur au reste à payer.
Corrigez votre saisie, sinon, confirmez et pensez à créer un avoir pour l'excédent pour chaque facture surpayée. ClassifyPaid=Classer 'Payée' ClassifyPaidPartially=Classer 'Payée partiellement' +ClassifyUnPaid=Classer 'Non payée' ClassifyCanceled=Classer 'Abandonnée' ClassifyClosed=Classer 'Fermée' ClassifyUnBilled=Classer 'Non facturée' From 4ed1ff5b9bc9231ef2945494974da3ee3f8367df Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Aug 2019 21:17:12 +0200 Subject: [PATCH 18/59] Fix display only stripe sources for customer --- htdocs/societe/paymentmodes.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index fdd4f54b6c8..4a34a2b360f 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -822,7 +822,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print '
'; // List of Stripe payment modes - if (! (empty($conf->stripe->enabled))) + if (! (empty($conf->stripe->enabled)) && $object->client) { $morehtmlright=''; if (! empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) @@ -1184,11 +1184,10 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } print ""; print ""; + print '
'; } - // List of bank accounts - print '
'; $morehtmlright= dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=create'); From 4633af3f5d84f175dd528d8c452138631172971d Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Aug 2019 21:19:47 +0200 Subject: [PATCH 19/59] Update charge.php --- htdocs/stripe/charge.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 80c633b0254..a524a62f6a3 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -130,16 +130,15 @@ if (!$rowid) $label.="Réseau: ".$charge->outcome->network_status."
"; $label.="Statut: ".$langs->trans("".$charge->outcome->seller_message.""); $status = $form->textwithpicto(img_picto($langs->trans("".$charge->status.""), 'statut8'), $label, 1); - } + } if ($charge->payment_method_details->type=='card') { $type = $langs->trans("card"); - } - elseif ($charge->source->type=='card'){ - $type = $langs->trans("card"); + } elseif ($charge->source->type=='card'){ + $type = $langs->trans("card"); } elseif ($charge->payment_method_details->type=='three_d_secure'){ - $type = $langs->trans("card3DS"); + $type = $langs->trans("card3DS"); } if (! empty($charge->payment_intent)) { From 0ede65448232e0cc652745344fa6fb2c53c0c0c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Aug 2019 13:15:49 +0200 Subject: [PATCH 20/59] Prepare 10.0.1 --- ChangeLog | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/ChangeLog b/ChangeLog index babd1f4db32..c78ad8674eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,112 @@ English Dolibarr ChangeLog -------------------------------------------------------------- + +***** ChangeLog for 10.0.1 compared to 10.0.0 ***** +FIX: #10930 +FIX: #10984 FIX: reposition on "Build backup" button +FIX: #11400 +FIX: #11412 +FIX: #11460 FIX: #11492 FIX: #11576 FIX: #11590 +FIX: #11463 +FIX: #11466 +FIX: #11498 +FIX: #11505 +FIX: #11506 +FIX: #11507 +FIX: #11509 +FIX: #11537 +FIX: #11543 +FIX: #11553 +FIX: #11584 +FIX: accounting mode must be taken from global conf, because there's no way to choose a mode with interface +FIX: Add message from public interface +FIX: add missing hook calls +FIX: Add warning when setup is strange +FIX: ajax call for line positioning when CSRFCHECK_WITH_TOKEN is on +FIX: API return 404 sometimes even if API exists +FIX: Attachment was lost when we validate an expense report +FIX: avoid conflict with "$classname" in card.php +FIX: Bad sql request +FIX: better compatibility with multicompany transverse mode +FIX: Better PHP compatibility +FIX: Block to link with tickets +FIX: Can't submit a ticket from public interface +FIX: categories import: prevent mismatch between category type and object type +FIX: Closing ticket from public interface +FIX: Column 'paid' missing in expense report +FIX: compatibility mysql 8. rank is reserved +FIX: Computed field were not calculated into lists. +FIX: Content of email for subscription +FIX: correct error in files with multiple spaces +FIX: CVE-2019-11199 +FIX: delete of links between objects +FIX: div not balanced +FIX: do not return formatted prices in json string +FIX: duplicate on the check (TODO field $onetrtd not used ?) +FIX: element name in update_price +FIX: empty product_use_units in product configuration +FIX: expedition card: infinite loop for printObjectLine hook if return > 0 +FIX: extrafield loading bug due to assumption that an object is a third party while it may be a contact if MAIN_USE_COMPANY_NAME_OF_CONTACT is set. +FIX: Fatal error on dol_htmloutput_mesg with corrupted array +FIX: Fatal situation if payment removed on expense report. Action +FIX: FEC Format - Missing date_creation in general ledger when you add a new transaction +FIX: FEC Format - Save translation of the journal label in database & nowrap on amount +FIX: floating point precision errors in the triggers of the workflow module +FIX: for #11232 +FIX: format of field with type timestamp +FIX: fournrprice log for insert +FIX: help text +FIX: import filter error +FIX: __INFOS__ tag not exists +FIX: issue #9300: install error with PostgreSQL using custom table prefix +FIX: issue #9300: install error with PostgreSQL when using custom table prefix +FIX: Language key +FIX: Limit of uploaded files (max_post_size was not used) +FIX: list of balance of leaves +FIX: minor spelling issues +FIX: missing "dropdown-icon" replacement +FIX: Missing field "Conciliated" into bank transaction export +FIX: missing filter by current contact +FIX: missing token +FIX: Missing where on entity +FIX: move sql request in INNER JOIN +FIX: name was able to be in field but went back to new line +FIX: Nowrap on amount +FIX: Online payment +FIX: on shipment delete confirm dialog, a new checkbox allows the user to choose if they want their stock re-incremented after the deletion. +FIX: option EXPORT_LABEL_FOR_SELECT to restore compatibility in export +FIX: Option THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION +FIX: outdated phpdoc +FIX: Permission for BOM menu +FIX: permission to delete a draft purchase order +FIX: phpcs +FIX: Position was lost when we edit the line of template invoice +FIX: product_use_units was set to 0 each time a conf in block other was set +FIX: propal createFrom hook: undefined parameter attached +FIX: Responsive of public interface of ticket +FIX: search by phone pro +FIX: Setup of TakePos was not possible after a clean install +FIX: Show list of events on tickets +FIX: socpeople assigned list in action com list +FIX: SQL problem on donation & nowrap on amount +FIX: stock increase on shipment deletion if STOCK_CALCULATE_ON_SHIPMENT_NEW: is set +FIX: stripe webhook ID constant set +FIX: summary of time spent in preview tab of projects +FIX: the feature to bill time spent was not enabled. +FIX: The new feature to attach document on lines was not correclty +FIX: The proposed new supplier code does not work +FIX: this function can not be private +FIX: tk9877 - PDF rouget requires product.lib.php (otherwise measuring_units_string() is not defined) +FIX: Update the file index table when we validate/rename a ref. +FIX: use rounding to compare the amounts +FIX: We must save code instead of value in database for template invoice modelpdf +FIX: we need to be able to add freeline with qty between 0 & 1 in supplierorder line +FIX: We should remove property comments only for project and task api. +FIX: When saving an action it didn't save the label based on the type of event if the label is empty and the type is customized +FIX: when STOCK_CALCULATE_ON_SHIPMENT_NEW: is set, deleting a "closed" shipment now increases stock as expected +FIX: wrong path sociales/index.php doesnt exist anymore + ***** ChangeLog for 10.0.0 compared to 9.0.0 ***** For Users: NEW: Module "Ticket" is available as a stable module. From e81ccf1cff92f4437e17215592dca8c8fcde2c18 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 4 Aug 2019 17:21:13 +0200 Subject: [PATCH 21/59] FIX addinf a "div" for better interaction with login submit button --- htdocs/core/tpl/login.tpl.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 7e3e479048b..3fb0aa25f2a 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -199,7 +199,10 @@ if ($captcha) {
-
+
+
+ +
'; - echo '
'; + echo '
'; if ($forgetpasslink) { $url=DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam; if (! empty($conf->global->MAIN_PASSWORD_FORGOTLINK)) $url=$conf->global->MAIN_PASSWORD_FORGOTLINK; From baa2e870d0e9b8f112e8298115cf6fdc7b9b631e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 5 Aug 2019 11:01:58 +0200 Subject: [PATCH 22/59] Update admin.lang found in admin/company.php --- htdocs/langs/en_US/admin.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index a1d042a07a1..de1e5f52fcd 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -395,6 +395,7 @@ ButtonHideUnauthorized=Hide buttons for non-admin users for unauthorized actions OldVATRates=Old VAT rate NewVATRates=New VAT rate PriceBaseTypeToChange=Modify on prices with base reference value defined on +PriceFormatInCurrentLanguage=Price Format In Current Language MassConvert=Launch mass convert String=String TextLong=Long text @@ -1857,4 +1858,4 @@ MAIN_OPTIMIZEFORTEXTBROWSER=Simplify interface for blind person MAIN_OPTIMIZEFORTEXTBROWSERDesc=Enable this option if you are a blind person, or use application from a text browser like lynx or links. ABankAccountMustBeDefinedOnPaymentModeSetup=Note: The bank account must be defined on the module of each payment mode (Paypal, Stripe, ...) to have this feature working. EXPORTS_SHARE_MODELS=Export models are share with everybody -ExportSetup=Setup of module Export \ No newline at end of file +ExportSetup=Setup of module Export From 41c07b9b4364dc5c6a261dcbd65cb00a68ee1d45 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 5 Aug 2019 13:10:26 +0200 Subject: [PATCH 23/59] fix bad test in delivery card --- htdocs/livraison/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index 2e1c9cb47c1..028ce581358 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -570,7 +570,7 @@ else } // Other attributes - if ($action = 'create_delivery') { + if ($action == 'create_delivery') { // copy from expedition $expeditionExtrafields = new Extrafields($db); $expeditionExtrafieldLabels = $expeditionExtrafields->fetch_name_optionals_label($expedition->table_element); From 1d4fc32c20f0beb8d5eb21965ae413e9fc616674 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 5 Aug 2019 13:13:56 +0200 Subject: [PATCH 24/59] fix second bad test --- htdocs/livraison/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index 028ce581358..13a6196d3a3 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -675,7 +675,7 @@ else $mode = ($object->statut == 0) ? 'edit' : 'view'; $line = new LivraisonLigne($db); $line->fetch_optionals($object->lines[$i]->id); - if ($action = 'create_delivery') { + if ($action == 'create_delivery') { $srcLine = new ExpeditionLigne($db); $expeditionLineExtrafields = new Extrafields($db); $expeditionLineExtrafieldLabels = $expeditionLineExtrafields->fetch_name_optionals_label($srcLine->table_element); From fde526f59df4343c991b40800b8406ed656e7028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 5 Aug 2019 14:58:50 +0200 Subject: [PATCH 25/59] Update pdf_einstein.modules.php --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index def09507b92..778b6525d21 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1221,7 +1221,7 @@ class pdf_einstein extends ModelePDFCommandes * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param string $titlekey Translation key to show as title of document - * @return void + * @return int Return topshift value */ function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="PdfOrderTitle") { From 7f23b77cbec9639f263d2ff8ad8a3b68e6885817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 5 Aug 2019 15:00:06 +0200 Subject: [PATCH 26/59] Update pdf_proforma.modules.php --- htdocs/core/modules/commande/doc/pdf_proforma.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index ebbe72f94c9..7a2c1f724c0 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -65,12 +65,12 @@ class pdf_proforma extends pdf_einstein * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param string $titlekey Translation key to show as title of document - * @return void + * @return int Return topshift value */ function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="InvoiceProForma") { global $conf,$langs,$hookmanager; - parent::_pagehead($pdf, $object, $showaddress, $outputlangs, $titlekey); + return parent::_pagehead($pdf, $object, $showaddress, $outputlangs, $titlekey); } } From f417c85186a22661cd05264ad98f74aab98b9d81 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 5 Aug 2019 20:49:41 +0200 Subject: [PATCH 27/59] NEW list by date_cloture on order list --- htdocs/commande/list.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index f64aadf0e53..cbc5ffc04e7 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -143,6 +143,7 @@ $arrayfields=array( 'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0), 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), + 'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500), 'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), 'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'position'=>1000, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) ); @@ -247,7 +248,7 @@ $sql.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,'; $sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,'; -$sql.= ' c.date_creation as date_creation, c.tms as date_update,'; +$sql.= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,'; $sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label"; if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc"; // Add fields from extrafields @@ -748,7 +749,8 @@ if ($resql) print $hookmanager->resPrint; if (! empty($arrayfields['c.datec']['checked'])) print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap '); if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'], $_SERVER["PHP_SELF"], "c.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); - if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['c.date_cloture']['checked'])) print_liste_field_titre($arrayfields['c.date_cloture']['label'], $_SERVER["PHP_SELF"], "c.date_cloture", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['c.facture']['checked'])) print_liste_field_titre($arrayfields['c.facture']['label'], $_SERVER["PHP_SELF"], 'c.facture', '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center '); print ''."\n"; @@ -1092,6 +1094,14 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } + // Date cloture + if (! empty($arrayfields['c.date_cloture']['checked'])) + { + print ''; + print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser'); + print ''; + if (! $i) $totalarray['nbfield']++; + } // Status if (! empty($arrayfields['c.fk_statut']['checked'])) { From 0cbb14462899e1632397e60eb4b24649e26aa355 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 5 Aug 2019 20:52:27 +0200 Subject: [PATCH 28/59] Update list.php sometimes we need to get last update or closed order --- htdocs/commande/list.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index cbc5ffc04e7..a25d863176e 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -694,6 +694,12 @@ if ($resql) print ''; print ''; } + // Date cloture + if (! empty($arrayfields['c.date_cloture']['checked'])) + { + print ''; + print ''; + } // Status if (! empty($arrayfields['c.fk_statut']['checked'])) { From 4de68397ae80f5ffee564966011731382b4b9de2 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 5 Aug 2019 21:03:48 +0200 Subject: [PATCH 29/59] NEW list by date_cloture on propal list --- htdocs/comm/propal/list.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 4377ebe6211..c6af61acab9 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -168,6 +168,7 @@ $arrayfields=array( 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1), 'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), 'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), + 'p.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500), 'p.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), ); // Extra fields @@ -269,7 +270,7 @@ $sql.= " typent.code as typent_code,"; $sql.= " ava.rowid as availability,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,'; -$sql.= ' p.datec as date_creation, p.tms as date_update,'; +$sql.= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,'; $sql.= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,"; $sql.= ' u.login'; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user"; @@ -688,6 +689,12 @@ if ($resql) print ''; print ''; } + // Date cloture + if (! empty($arrayfields['p.date_cloture']['checked'])) + { + print ''; + print ''; + } // Status if (! empty($arrayfields['p.fk_statut']['checked'])) { @@ -735,6 +742,7 @@ if ($resql) print $hookmanager->resPrint; if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + if (! empty($arrayfields['p.date_cloture']['checked'])) print_liste_field_titre($arrayfields['p.date_cloture']['label'], $_SERVER["PHP_SELF"], "p.date_cloture", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print ''."\n"; @@ -1073,6 +1081,14 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } + // Date cloture + if (! empty($arrayfields['p.date_cloture']['checked'])) + { + print ''; + print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser'); + print ''; + if (! $i) $totalarray['nbfield']++; + } // Status if (! empty($arrayfields['p.fk_statut']['checked'])) { From 05ac4eec52c8fe5c585dbc8171ee891e45742e9e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 6 Aug 2019 00:16:18 +0200 Subject: [PATCH 30/59] Update charge.php --- htdocs/stripe/charge.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index a524a62f6a3..9d4bf71c040 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -133,13 +133,13 @@ if (!$rowid) } if ($charge->payment_method_details->type=='card') - { + { $type = $langs->trans("card"); - } elseif ($charge->source->type=='card'){ + } elseif ($charge->source->type=='card'){ $type = $langs->trans("card"); - } elseif ($charge->payment_method_details->type=='three_d_secure'){ + } elseif ($charge->payment_method_details->type=='three_d_secure'){ $type = $langs->trans("card3DS"); - } + } if (! empty($charge->payment_intent)) { $charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent); From 69985339d86b1668704ce64c16f51699ca25717f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 6 Aug 2019 11:47:34 +0200 Subject: [PATCH 31/59] Update price_parser.class.php --- .../product/dynamic_price/class/price_parser.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php index 3249671d173..1dd98c6610e 100644 --- a/htdocs/product/dynamic_price/class/price_parser.class.php +++ b/htdocs/product/dynamic_price/class/price_parser.class.php @@ -259,9 +259,14 @@ class PriceParser return -1; } - //Get the supplier min + //Get the supplier min price $productFournisseur = new ProductFournisseur($this->db); - $supplier_min_price = $productFournisseur->find_min_price_product_fournisseur($product->id, 0, 0); + $res = $productFournisseur->find_min_price_product_fournisseur($product->id, 0, 0); + if ($res<1) { + $this->error_parser = array(25, null); + return -1; + } + $supplier_min_price = $productFournisseur->fourn_unitprice; //Accessible values by expressions $extra_values = array_merge($extra_values, array( From 97223bf2eb141c32e543286740bf2ba347da398b Mon Sep 17 00:00:00 2001 From: Tim Otte Date: Tue, 6 Aug 2019 15:10:13 +0200 Subject: [PATCH 32/59] Fixed expedition line rangs Rang is now transferred to the database --- htdocs/expedition/class/expedition.class.php | 30 +++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 97c67fd7701..29ff4ecb33e 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -353,7 +353,7 @@ class Expedition extends CommonObject { if (! isset($this->lines[$i]->detail_batch)) { // no batch management - if (! $this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty, $this->lines[$i]->array_options) > 0) + if (! $this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty, $this->lines[$i]->rang, $this->lines[$i]->array_options) > 0) { $error++; } @@ -444,7 +444,7 @@ class Expedition extends CommonObject * @param array $array_options extrafields array * @return int <0 if KO, line_id if OK */ - public function create_line($entrepot_id, $origin_line_id, $qty, $array_options = 0) + public function create_line($entrepot_id, $origin_line_id, $qty, $rang, $array_options = 0) { //phpcs:enable global $user; @@ -454,6 +454,7 @@ class Expedition extends CommonObject $expeditionline->entrepot_id = $entrepot_id; $expeditionline->fk_origin_line = $origin_line_id; $expeditionline->qty = $qty; + $expeditionline->rang = $rang; $expeditionline->array_options = $array_options; if (($lineId = $expeditionline->insert($user)) < 0) @@ -490,7 +491,7 @@ class Expedition extends CommonObject // create shipment lines foreach ($stockLocationQty as $stockLocation => $qty) { - if (($line_id = $this->create_line($stockLocation, $line_ext->origin_line_id, $qty, $array_options)) < 0) + if (($line_id = $this->create_line($stockLocation, $line_ext->origin_line_id, $qty, $line_ext->rang, $array_options)) < 0) { $error++; } @@ -926,6 +927,9 @@ class Expedition extends CommonObject $orderline = new OrderLine($this->db); $orderline->fetch($id); + // Copy the rang of the order line to the expedition line + $line->rang = $orderline->rang; + if (! empty($conf->stock->enabled) && ! empty($orderline->fk_product)) { $fk_product = $orderline->fk_product; @@ -1383,7 +1387,7 @@ class Expedition extends CommonObject $sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked, cd.product_type"; $sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva"; $sql.= ", cd.vat_src_code, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.info_bits, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht"; - $sql.= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc"; + $sql.= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc, cd.rang"; $sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot"; $sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type"; $sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch"; @@ -1452,6 +1456,7 @@ class Expedition extends CommonObject $line->label = $obj->custom_label; $line->description = $obj->description; $line->qty_asked = $obj->qty_asked; + $line->rang = $obj->rang; $line->weight = $obj->weight; $line->weight_units = $obj->weight_units; $line->length = $obj->length; @@ -2459,6 +2464,11 @@ class ExpeditionLigne extends CommonObjectLine */ public $product_desc; + /** + * @var int rang of line + */ + public $rang; + /** * @var float weight */ @@ -2579,16 +2589,28 @@ class ExpeditionLigne extends CommonObjectLine $this->db->begin(); + if (empty($this->rang)) $this->rang = 0; + + // Rank to use + $rangtouse = $this->rang; + if ($rangtouse == -1) + { + $rangmax = $this->line_max($fk_expedition); + $rangtouse = $rangmax + 1; + } + $sql = "INSERT INTO ".MAIN_DB_PREFIX."expeditiondet ("; $sql.= "fk_expedition"; $sql.= ", fk_entrepot"; $sql.= ", fk_origin_line"; $sql.= ", qty"; + $sql.= ", rang"; $sql.= ") VALUES ("; $sql.= $this->fk_expedition; $sql.= ", ".(empty($this->entrepot_id) ? 'NULL' : $this->entrepot_id); $sql.= ", ".$this->fk_origin_line; $sql.= ", ".$this->qty; + $sql.= ", ".$rangtouse; $sql.= ")"; dol_syslog(get_class($this)."::insert", LOG_DEBUG); From cafd4fc5997244d427ade2277c56b0781518d736 Mon Sep 17 00:00:00 2001 From: John Botella Date: Tue, 6 Aug 2019 15:24:42 +0200 Subject: [PATCH 33/59] New living color for chart --- htdocs/core/class/dolgraph.class.php | 2 +- htdocs/theme/eldy/theme_vars.inc.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 458f0bd4fad..5c45eb5836d 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1094,7 +1094,7 @@ class DolGraph $i++; } // shadowSize: 0 -> Drawing is faster without shadows - $this->stringtoshow.="\n".' ], { series: { shadowSize: 0, stack: stack, lines: { fill: false, steps: steps }, bars: { barWidth: 0.6 } }'."\n"; + $this->stringtoshow.="\n".' ], { series: { shadowSize: 0, stack: stack, lines: { fill: false, steps: steps }, bars: { barWidth: 0.6, fillColor: { colors: [{opacity: 0.9 }, {opacity: 0.85}] }} }'."\n"; // Xaxis $this->stringtoshow.=', xaxis: { ticks: ['."\n"; diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index f02c25113ef..b050425163e 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -32,7 +32,8 @@ global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; $theme_bordercolor = array(235,235,224); -$theme_datacolor = array(array(136,102,136), array(0,130,110), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(250,190,30), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); +$theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(250,190,30), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); + $theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4')); $theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC')); From 22202c2d27438dd83f96728562d5736ac33ba389 Mon Sep 17 00:00:00 2001 From: Tim Otte Date: Tue, 6 Aug 2019 15:33:26 +0200 Subject: [PATCH 34/59] Added missing parameter comment --- htdocs/expedition/class/expedition.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 29ff4ecb33e..f484c2690a6 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -441,6 +441,7 @@ class Expedition extends CommonObject * @param int $entrepot_id Id of warehouse * @param int $origin_line_id Id of source line * @param int $qty Quantity + * @param int $rang Rang * @param array $array_options extrafields array * @return int <0 if KO, line_id if OK */ From 7866c2c0d3af5121122f35a142a563e5ed85c4bb Mon Sep 17 00:00:00 2001 From: John Botella Date: Tue, 6 Aug 2019 15:42:12 +0200 Subject: [PATCH 35/59] change color --- htdocs/theme/eldy/theme_vars.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index b050425163e..4f5708ba556 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -32,7 +32,7 @@ global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; $theme_bordercolor = array(235,235,224); -$theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(250,190,30), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); +$theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250,190,30), array(221, 75, 57), array(0,166,90), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); $theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4')); $theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC')); From ee8d99351df76ef2e12a11a379b12c9ba69a64d3 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 6 Aug 2019 16:28:18 +0200 Subject: [PATCH 36/59] Update facture.php --- htdocs/product/stats/facture.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index d60c4d835a5..a11bfe14865 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -234,7 +234,9 @@ if ($id > 0 || ! empty($ref)) while ($i < min($num, $limit)) { $objp = $db->fetch_object($result); - + + if ($objp->type == Facture::TYPE_CREDIT_NOTE) $objp->qty=-($objp->qty); + $total_ht+=$objp->total_ht; $total_qty+=$objp->qty; From 0fc92b92a25da11770e8649805ae4b9226acbada Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 6 Aug 2019 16:47:54 +0200 Subject: [PATCH 37/59] Update facture.php --- htdocs/product/stats/facture.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index a11bfe14865..8eab980f1dc 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -235,7 +235,7 @@ if ($id > 0 || ! empty($ref)) { $objp = $db->fetch_object($result); - if ($objp->type == Facture::TYPE_CREDIT_NOTE) $objp->qty=-($objp->qty); + if ($objp->type == Facture::TYPE_CREDIT_NOTE) $objp->qty=-($objp->qty); $total_ht+=$objp->total_ht; $total_qty+=$objp->qty; From 4aeaa580eae40b65059acef11807dbc8d9570048 Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 7 Aug 2019 11:11:47 +0200 Subject: [PATCH 38/59] Add color blind option --- htdocs/core/lib/usergroups.lib.php | 39 ++++++++++++++++++++++++++++++ htdocs/langs/en_US/admin.lang | 5 ++++ htdocs/user/param_ihm.php | 6 +++++ 3 files changed, 50 insertions(+) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 7da112fa255..630ad5c796e 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -947,5 +947,44 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false) */ } + + // Use MAIN_OPTIMIZEFORTEXTBROWSER + if ($foruserprofile) + { + //$default=yn($conf->global->MAIN_OPTIMIZEFORCOLORBLIND); + $default=$langs->trans('No'); + print ''; + print ''.$langs->trans("MAIN_OPTIMIZEFORCOLORBLIND").''; + print ''; + + $colorBlindOptions = array( + 'none' => $langs->trans('No'), + 'protanopia' => $langs->trans('Protanopia'), + 'deuteranopes' => $langs->trans('Deuteranopes'), + 'tritanopes' => $langs->trans('Tritanopes'), + ); + + if ($edit) + { + print $form->selectArray('MAIN_OPTIMIZEFORCOLORBLIND', $colorBlindOptions, $fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND, 0); + } + else + { + if (!empty($fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND) && isset($colorBlindOptions[$fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND])){ + print $colorBlindOptions[$fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND]; + } + else{ + print yn(0); + } + } + print '   ('.$langs->trans("Default").': '.$default.') '; + print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORCOLORBLINDDesc")); + print ''; + print ''; + } + else + { + + } print ''; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 0f22d42327c..48d4d898de6 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1900,6 +1900,11 @@ OnMobileOnly=On small screen (smartphone) only DisableProspectCustomerType=Disable the "Prospect + Customer" third party type (so third party must be Prospect or Customer but can't be both) MAIN_OPTIMIZEFORTEXTBROWSER=Simplify interface for blind person MAIN_OPTIMIZEFORTEXTBROWSERDesc=Enable this option if you are a blind person, or if you use the application from a text browser like Lynx or Links. +MAIN_OPTIMIZEFORCOLORBLIND=Change interface's color for color blind person +MAIN_OPTIMIZEFORCOLORBLINDDesc=Enable this option if you are a color blind person, in some case interface will change color setup to increase contrast. +Protanopia=Protanopia +Deuteranopes=Deuteranopes +Tritanopes=Tritanopes ThisValueCanOverwrittenOnUserLevel=This value can be overwritten by each user from its user page - tab '%s' DefaultCustomerType=Default thirdparty type for "New customer" creation form ABankAccountMustBeDefinedOnPaymentModeSetup=Note: The bank account must be defined on the module of each payment mode (Paypal, Stripe, ...) to have this feature working. diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 90228aa952e..c33c26fa95b 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -152,6 +152,12 @@ if (empty($reshook)) { $tabparam["MAIN_OPTIMIZEFORTEXTBROWSER"] = 0; } + if (GETPOST('MAIN_OPTIMIZEFORCOLORBLIND')) { + $tabparam["MAIN_OPTIMIZEFORCOLORBLIND"] = GETPOST('MAIN_OPTIMIZEFORCOLORBLIND'); + } else { + $tabparam["MAIN_OPTIMIZEFORCOLORBLIND"] = 0; + } + $result = dol_set_user_param($db, $conf, $object, $tabparam); header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); From 63191dab7d5b4572f243bff03a0edf5308549498 Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 7 Aug 2019 12:03:19 +0200 Subject: [PATCH 39/59] Add user color blind option --- htdocs/core/class/dolgraph.class.php | 2 +- htdocs/core/lib/usergroups.lib.php | 2 +- htdocs/theme/eldy/theme_vars.inc.php | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 5c45eb5836d..6bc20742821 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -96,7 +96,7 @@ class DolGraph */ public function __construct($library = 'jflot') { - global $conf; + global $conf, $user; global $theme_bordercolor, $theme_datacolor, $theme_bgcolor; // To use old feature diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 630ad5c796e..ea7f9856509 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -958,7 +958,7 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false) print ''; $colorBlindOptions = array( - 'none' => $langs->trans('No'), + 0 => $langs->trans('No'), 'protanopia' => $langs->trans('Protanopia'), 'deuteranopes' => $langs->trans('Deuteranopes'), 'tritanopes' => $langs->trans('Tritanopes'), diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index 4f5708ba556..1fc1acb32bc 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -30,9 +30,14 @@ * if (is_readable($var_file)) include $var_file; */ -global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; +global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet, $user; $theme_bordercolor = array(235,235,224); $theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250,190,30), array(221, 75, 57), array(0,166,90), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); +if(!empty($user) && !empty($user->conf->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by graph +{ + // for now we use the same configuration for all types of color blind + $theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(120,120,120), array(253, 205, 102), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); +} $theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4')); $theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC')); From 401dc12b939c1e9c1ac4903db6dab1ae5f1bd358 Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 7 Aug 2019 12:15:55 +0200 Subject: [PATCH 40/59] Add color blind option in body for css impact --- htdocs/core/class/dolgraph.class.php | 2 +- htdocs/main.inc.php | 7 +++++++ htdocs/theme/eldy/theme_vars.inc.php | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 6bc20742821..5c45eb5836d 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -96,7 +96,7 @@ class DolGraph */ public function __construct($library = 'jflot') { - global $conf, $user; + global $conf; global $theme_bordercolor, $theme_datacolor, $theme_bgcolor; // To use old feature diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 7b983ca05eb..e1a1f333d1d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -902,6 +902,9 @@ elseif (! empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER=$user->conf->MAIN_OPTIMIZEFORTEXTBROWSER; } +// set MAIN_OPTIMIZEFORCOLORBLIND +$conf->global->MAIN_OPTIMIZEFORCOLORBLIND=$user->conf->MAIN_OPTIMIZEFORCOLORBLIND; + // Set terminal output option according to conf->browser. if (GETPOST('dol_hide_leftmenu', 'int') || ! empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu=1; if (GETPOST('dol_hide_topmenu', 'int') || ! empty($_SESSION['dol_hide_topmenu'])) $conf->dol_hide_topmenu=1; @@ -1087,6 +1090,10 @@ if (! function_exists("llxHeader")) if ($mainmenu != 'website') $tmpcsstouse=$morecssonbody; // We do not use sidebar-collpase by default to have menuhider open by default. } + if(!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)){ + $tmpcsstouse.= ' colorblind-'.strip_tags($conf->global->MAIN_OPTIMIZEFORCOLORBLIND); + } + print '' . "\n"; // top menu and left menu area diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index 1fc1acb32bc..a1ff5120c27 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -30,10 +30,10 @@ * if (is_readable($var_file)) include $var_file; */ -global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet, $user; +global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; $theme_bordercolor = array(235,235,224); $theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250,190,30), array(221, 75, 57), array(0,166,90), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); -if(!empty($user) && !empty($user->conf->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by graph +if(!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by dolgraph.class.php { // for now we use the same configuration for all types of color blind $theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(120,120,120), array(253, 205, 102), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); From 9e8843370691fc7b5e9b18551360e68ed7e8d55e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 7 Aug 2019 12:59:27 +0200 Subject: [PATCH 41/59] add intval to evalmath class --- htdocs/includes/evalmath/evalmath.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/includes/evalmath/evalmath.class.php b/htdocs/includes/evalmath/evalmath.class.php index 9426e82a8ff..9d970aed789 100644 --- a/htdocs/includes/evalmath/evalmath.class.php +++ b/htdocs/includes/evalmath/evalmath.class.php @@ -98,7 +98,7 @@ class EvalMath 'sin','sinh','arcsin','asin','arcsinh','asinh', 'cos','cosh','arccos','acos','arccosh','acosh', 'tan','tanh','arctan','atan','arctanh','atanh', - 'sqrt','abs','ln','log'); + 'sqrt','abs','ln','log','intval'); /** * Constructor From 28100f67acf32391d8c7d1048db92ed6c803d8ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 7 Aug 2019 13:25:14 +0200 Subject: [PATCH 42/59] Update llx_c_price_expression.sql --- htdocs/install/mysql/tables/llx_c_price_expression.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_c_price_expression.sql b/htdocs/install/mysql/tables/llx_c_price_expression.sql index 4c1788e4276..085f60fe537 100755 --- a/htdocs/install/mysql/tables/llx_c_price_expression.sql +++ b/htdocs/install/mysql/tables/llx_c_price_expression.sql @@ -20,5 +20,5 @@ create table llx_c_price_expression ( rowid integer AUTO_INCREMENT PRIMARY KEY, title varchar(20) NOT NULL, - expression varchar(80) NOT NULL + expression varchar(255) NOT NULL )ENGINE=innodb; From d55377981c6ebaf0b41bf6e56f91ee1265d0fdbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 7 Aug 2019 13:27:55 +0200 Subject: [PATCH 43/59] Update 10.0.0-11.0.0.sql --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index bd556d089cd..63a71d59f44 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -71,4 +71,6 @@ create table llx_payment_salary_extrafields ALTER TABLE llx_payment_salary_extrafields ADD INDEX idx_payment_salary_extrafields (fk_object); +ALTER TABLE llx_c_price_expression MODIFY COLUMN expression varchar(255) NOT NULL; + UPDATE llx_bank_url set url = REPLACE( url, 'compta/salaries/', 'salaries/'); From 372eddf0c6fbea4e06351f9085935c59fffa3fad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 7 Aug 2019 13:49:14 +0200 Subject: [PATCH 44/59] Update societe.class.php --- htdocs/societe/class/societe.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 6d936e5ce65..59b516fd96e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2167,6 +2167,8 @@ class Societe extends CommonObject { $label.= '
' . $langs->trans('Name') . ': '. $this->name; if (! empty($this->name_alias)) $label.=' ('.$this->name_alias.')'; + } + if (! empty($this->email)) { $label.= '
' . $langs->trans('Email') . ': '. $this->email; } if (! empty($this->country_code)) From 450878cd92bacf2498eff0a9c3a005595f483c4f Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 7 Aug 2019 15:13:59 +0200 Subject: [PATCH 45/59] Fix color deuteranopia --- htdocs/theme/eldy/theme_vars.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index a1ff5120c27..5472d5283f5 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -36,7 +36,7 @@ $theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250,190, if(!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by dolgraph.class.php { // for now we use the same configuration for all types of color blind - $theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(120,120,120), array(253, 205, 102), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); + $theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(169, 169, 169), array(253, 102, 136), array(120, 154, 190), array(146, 146, 55), array(0, 52, 251), array(196, 226, 161), array(222, 160, 41), array(85,135,150), array(150,135,80), array(150,80,150)); } $theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4')); From ef285a87a83012a000f74c7744b083dab4473ad0 Mon Sep 17 00:00:00 2001 From: Je2fb <46494485+Je2fb@users.noreply.github.com> Date: Wed, 7 Aug 2019 17:16:34 +0200 Subject: [PATCH 46/59] Update price_parser.class.php Calculation with supplier_min_price work --- htdocs/product/dynamic_price/class/price_parser.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php index dffb8ee0b2c..6706e9e4b0f 100644 --- a/htdocs/product/dynamic_price/class/price_parser.class.php +++ b/htdocs/product/dynamic_price/class/price_parser.class.php @@ -261,7 +261,9 @@ class PriceParser //Get the supplier min $productFournisseur = new ProductFournisseur($this->db); - $supplier_min_price = $productFournisseur->find_min_price_product_fournisseur($product->id, 0, 0); + //$supplier_min_price = $productFournisseur->find_min_price_product_fournisseur($product->id, 0, 0); + if ($productFournisseur->find_min_price_product_fournisseur($product->id, 0, 0) > 0) + $supplier_min_price = $productFournisseur->fourn_price; //Accessible values by expressions $extra_values = array_merge($extra_values, array( From af4d5aa549508ef6d71cdfabf915e1110493162a Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 7 Aug 2019 17:22:59 +0200 Subject: [PATCH 47/59] Fix color badges and status for color blind --- htdocs/theme/eldy/badges.inc.php | 107 ++++++++++++++++++--------- htdocs/theme/eldy/theme_vars.inc.php | 11 +++ 2 files changed, 81 insertions(+), 37 deletions(-) diff --git a/htdocs/theme/eldy/badges.inc.php b/htdocs/theme/eldy/badges.inc.php index 984315b0bde..0f635941a8e 100644 --- a/htdocs/theme/eldy/badges.inc.php +++ b/htdocs/theme/eldy/badges.inc.php @@ -115,6 +115,17 @@ a.badge-warning:focus, a.badge-warning:hover { background-color: ; } +/* WARNING colorblind */ +body[class^="colorblind-"] .badge-warning { + background-color: ; + } +body[class^="colorblind-"] a.badge-warning.focus,body[class^="colorblind-"] a.badge-warning:focus { + box-shadow: 0 0 0 0.2rem ; +} +body[class^="colorblind-"] a.badge-warning:focus, a.badge-warning:hover { + background-color: ; +} + /* INFO */ .badge-info { color: #fff !important; @@ -160,44 +171,66 @@ a.badge-dark:focus, a.badge-dark:hover { /* * STATUS BADGES */ - -/* Default Status */ - expemple $badgeStatusValidate, $badgeStatusClosed, $badgeStatusActive .... @@ -91,3 +96,9 @@ $badgeStatus6='#cad2d2'; $badgeStatus7='#baa32b'; $badgeStatus8='#be3013'; $badgeStatus9='#e7f0f0'; + +// status color ajustement for color blind +$colorblind_deuteranopes_badgeStatus4=$colorblind_deuteranopes_badgeStatus7=$colorblind_deuteranopes_badgeSuccess; //! text color black +$colorblind_deuteranopes_badgeStatus_textColor4=$colorblind_deuteranopes_badgeStatus_textColor7='#000'; +$colorblind_deuteranopes_badgeStatus1=$colorblind_deuteranopes_badgeWarning; +$colorblind_deuteranopes_badgeStatus_textColor1='#000'; From 322ec32ff53a442a82838ce521429df74f2a1fb2 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 7 Aug 2019 20:16:53 +0200 Subject: [PATCH 48/59] FIX duration when creating service --- htdocs/product/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 847c6325b50..ca3cec982df 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1028,7 +1028,7 @@ else if ($type == 1) { print ''.$langs->trans("Duration").''; - print ''; + print ''; print $formproduct->selectMeasuringUnits("duration_unit", "time", GETPOST('duration_value', 'alpha'), 0, 1); print ''; } From 4008ddc5670c3a6dd12df0349927704932dc5b55 Mon Sep 17 00:00:00 2001 From: Je2fb <46494485+Je2fb@users.noreply.github.com> Date: Thu, 8 Aug 2019 09:33:03 +0200 Subject: [PATCH 49/59] Update price_parser.class.php --- htdocs/product/dynamic_price/class/price_parser.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php index 6706e9e4b0f..32cb8d7a71c 100644 --- a/htdocs/product/dynamic_price/class/price_parser.class.php +++ b/htdocs/product/dynamic_price/class/price_parser.class.php @@ -263,7 +263,7 @@ class PriceParser $productFournisseur = new ProductFournisseur($this->db); //$supplier_min_price = $productFournisseur->find_min_price_product_fournisseur($product->id, 0, 0); if ($productFournisseur->find_min_price_product_fournisseur($product->id, 0, 0) > 0) - $supplier_min_price = $productFournisseur->fourn_price; + $supplier_min_price = $productFournisseur->fourn_unitprice; //Accessible values by expressions $extra_values = array_merge($extra_values, array( From 1a592f8f693ba678f1da338604dff1be8370a79b Mon Sep 17 00:00:00 2001 From: Je2fb <46494485+Je2fb@users.noreply.github.com> Date: Thu, 8 Aug 2019 09:34:59 +0200 Subject: [PATCH 50/59] Update price_parser.class.php --- htdocs/product/dynamic_price/class/price_parser.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php index 32cb8d7a71c..867fd7d8f9f 100644 --- a/htdocs/product/dynamic_price/class/price_parser.class.php +++ b/htdocs/product/dynamic_price/class/price_parser.class.php @@ -261,7 +261,6 @@ class PriceParser //Get the supplier min $productFournisseur = new ProductFournisseur($this->db); - //$supplier_min_price = $productFournisseur->find_min_price_product_fournisseur($product->id, 0, 0); if ($productFournisseur->find_min_price_product_fournisseur($product->id, 0, 0) > 0) $supplier_min_price = $productFournisseur->fourn_unitprice; From ae144a69101586788476c7bedfd293ada5f572b3 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 8 Aug 2019 17:31:16 +0200 Subject: [PATCH 51/59] NEW compute column value from others columns in import module --- .../modules/import/import_csv.modules.php | 23 +++++++++++++++++-- .../modules/import/import_xlsx.modules.php | 23 +++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 0a60d9dc0ae..606b23e2767 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -581,8 +581,27 @@ class ImportCsv extends ModeleImports if (is_numeric($defaultref) && $defaultref <= 0) $defaultref=''; $newval=$defaultref; } - - + elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='compute') + { + $file=(empty($objimport->array_import_convertvalue[0][$val]['classfile'])?$objimport->array_import_convertvalue[0][$val]['file']:$objimport->array_import_convertvalue[0][$val]['classfile']); + $class=$objimport->array_import_convertvalue[0][$val]['class']; + $method=$objimport->array_import_convertvalue[0][$val]['method']; + $resultload = dol_include_once($file); + if (empty($resultload)) + { + dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method); + break; + } + $classinstance=new $class($this->db); + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord)); + if ($res<0) { + if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); + else $this->errors[$error]['lib']='ErrorFieldValueNotIn'; + $this->errors[$error]['type']='FOREIGNKEY'; + $errorforthistable++; + $error++; + } + } elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='numeric') { $newval = price2num($newval); diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index af9c0e2c412..66670247a4c 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -608,8 +608,27 @@ class ImportXlsx extends ModeleImports if (is_numeric($defaultref) && $defaultref <= 0) $defaultref=''; $newval=$defaultref; } - - + elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='compute') + { + $file=(empty($objimport->array_import_convertvalue[0][$val]['classfile'])?$objimport->array_import_convertvalue[0][$val]['file']:$objimport->array_import_convertvalue[0][$val]['classfile']); + $class=$objimport->array_import_convertvalue[0][$val]['class']; + $method=$objimport->array_import_convertvalue[0][$val]['method']; + $resultload = dol_include_once($file); + if (empty($resultload)) + { + dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method); + break; + } + $classinstance=new $class($this->db); + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord)); + if ($res<0) { + if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); + else $this->errors[$error]['lib']='ErrorFieldValueNotIn'; + $this->errors[$error]['type']='FOREIGNKEY'; + $errorforthistable++; + $error++; + } + } elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='numeric') { $newval = price2num($newval); From aa462bac23e11a42dbcb7958362391a8e6bd665d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 9 Aug 2019 09:25:48 +0200 Subject: [PATCH 52/59] Add empty index.html --- htdocs/compta/bank/index.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 htdocs/compta/bank/index.html diff --git a/htdocs/compta/bank/index.html b/htdocs/compta/bank/index.html new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/htdocs/compta/bank/index.html @@ -0,0 +1 @@ + From 0b831ccdf73f7bd6bc8a5d1a59c270d4f0270fb1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 9 Aug 2019 09:33:14 +0200 Subject: [PATCH 53/59] FIX better help message with multicompany --- htdocs/product/admin/product.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 67bca85cfe0..fff393ffc2a 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -556,7 +556,14 @@ if (! empty($conf->fournisseur->enabled)) $rowspan++; print ''; -print ''.$langs->trans("PricingRule").''; +if (empty($conf->multicompany->enabled)) +{ + print ''.$langs->trans("PricingRule").''; +} +else +{ + print ''.$form->textwithpicto($langs->trans("PricingRule"), $langs->trans("SamePriceAlsoForSharedCompanies"), 1).''; +} print ''; $current_rule = 'PRODUCT_PRICE_UNIQ'; if (!empty($conf->global->PRODUIT_MULTIPRICES)) $current_rule='PRODUIT_MULTIPRICES'; @@ -564,10 +571,6 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) $current_rule='PRODUI if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) $current_rule='PRODUIT_CUSTOMER_PRICES'; if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) $current_rule='PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'; print $form->selectarray("princingrule", $select_pricing_rules, $current_rule); -if ( empty($conf->multicompany->enabled)) -{ - print $langs->trans("SamePriceAlsoForSharedCompanies"); -} print ''; print ''; print ''; From ae4efe9b75121284c97a5f2dad99aa2fbb0f235a Mon Sep 17 00:00:00 2001 From: Abbes Bahfir Date: Fri, 9 Aug 2019 10:02:41 +0100 Subject: [PATCH 54/59] fix:this is not accessible in static context --- htdocs/debugbar/class/TraceableDB.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index 775c2a7c300..db84d3f9fd0 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -143,7 +143,7 @@ class TraceableDB extends DoliDB */ public static function convertSQLFromMysql($line, $type = 'ddl') { - return $this->db->convertSQLFromMysql($line); + return self::$db->convertSQLFromMysql($line); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From d245ca371e27db2203b9ef7e5aa996405a1072f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Aug 2019 23:45:06 +0200 Subject: [PATCH 55/59] Update societe.class.php --- htdocs/societe/class/societe.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 59b516fd96e..01770e1bee1 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2168,9 +2168,7 @@ class Societe extends CommonObject $label.= '
' . $langs->trans('Name') . ': '. $this->name; if (! empty($this->name_alias)) $label.=' ('.$this->name_alias.')'; } - if (! empty($this->email)) { - $label.= '
' . $langs->trans('Email') . ': '. $this->email; - } + $label.= '
' . $langs->trans('Email') . ': '. $this->email; if (! empty($this->country_code)) $label.= '
' . $langs->trans('Country') . ': '. $this->country_code; if (! empty($this->tva_intra) || (! empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP) && strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'vatnumber') !== false)) From 8f2786cf7b9fa87820d385a693a7dfa7bf2ed0ab Mon Sep 17 00:00:00 2001 From: Abbes Bahfir Date: Fri, 9 Aug 2019 10:02:41 +0100 Subject: [PATCH 56/59] fix:this is not accessible in static context --- htdocs/debugbar/class/TraceableDB.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index 4edc39a74af..d4bfd291602 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -143,7 +143,7 @@ class TraceableDB extends DoliDB */ public static function convertSQLFromMysql($line, $type = 'ddl') { - return $this->db->convertSQLFromMysql($line); + return self::$db->convertSQLFromMysql($line); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From 2dee289fc6eda76e05cc185583f02b1578b4ed35 Mon Sep 17 00:00:00 2001 From: Je2fb <46494485+Je2fb@users.noreply.github.com> Date: Wed, 7 Aug 2019 17:16:34 +0200 Subject: [PATCH 57/59] Update price_parser.class.php Calculation with supplier_min_price work Conflicts: htdocs/product/dynamic_price/class/price_parser.class.php --- htdocs/product/dynamic_price/class/price_parser.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php index ef968f5e960..9b929f84946 100644 --- a/htdocs/product/dynamic_price/class/price_parser.class.php +++ b/htdocs/product/dynamic_price/class/price_parser.class.php @@ -262,9 +262,11 @@ class PriceParser return -1; } - //Get the supplier min - $productFournisseur = new ProductFournisseur($this->db); - $supplier_min_price = $productFournisseur->find_min_price_product_fournisseur($product->id, 0, 0); + //Get the supplier min + $productFournisseur = new ProductFournisseur($this->db); + if ($productFournisseur->find_min_price_product_fournisseur($product->id, 0, 0) > 0) { + $supplier_min_price = $productFournisseur->fourn_unitprice; + } //Accessible values by expressions $extra_values = array_merge($extra_values, array( From 14fabeb3776bc7ff6a59dd2b96a4bca78348033d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Aug 2019 00:46:20 +0200 Subject: [PATCH 58/59] Variable rangtouse -> ranktouse --- htdocs/comm/propal/class/propal.class.php | 8 ++++---- htdocs/commande/class/commande.class.php | 8 ++++---- htdocs/compta/facture/class/facture.class.php | 8 ++++---- htdocs/expedition/class/expedition.class.php | 8 ++++---- .../supplier_proposal/class/supplier_proposal.class.php | 8 ++++---- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 5faa94f2d08..598d34f7093 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -530,11 +530,11 @@ class Propal extends CommonObject $pu_ht_devise = $tabprice[19]; // Rang to use - $rangtouse = $rang; - if ($rangtouse == -1) + $ranktouse = $rang; + if ($ranktouse == -1) { $rangmax = $this->line_max($fk_parent_line); - $rangtouse = $rangmax + 1; + $ranktouse = $rangmax + 1; } // TODO A virer @@ -568,7 +568,7 @@ class Propal extends CommonObject $this->line->fk_remise_except=$fk_remise_except; $this->line->remise_percent=$remise_percent; $this->line->subprice=$pu_ht; - $this->line->rang=$rangtouse; + $this->line->rang=$ranktouse; $this->line->info_bits=$info_bits; $this->line->total_ht=$total_ht; $this->line->total_tva=$total_tva; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index b1e2262f109..23d9db8f246 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1457,11 +1457,11 @@ class Commande extends CommonOrder $pu_ht_devise = $tabprice[19]; // Rang to use - $rangtouse = $rang; - if ($rangtouse == -1) + $ranktouse = $rang; + if ($ranktouse == -1) { $rangmax = $this->line_max($fk_parent_line); - $rangtouse = $rangmax + 1; + $ranktouse = $rangmax + 1; } // TODO A virer @@ -1495,7 +1495,7 @@ class Commande extends CommonOrder $this->line->fk_remise_except=$fk_remise_except; $this->line->remise_percent=$remise_percent; $this->line->subprice=$pu_ht; - $this->line->rang=$rangtouse; + $this->line->rang=$ranktouse; $this->line->info_bits=$info_bits; $this->line->total_ht=$total_ht; $this->line->total_tva=$total_tva; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index c64c42e2971..7f5dde15c59 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2825,11 +2825,11 @@ class Facture extends CommonInvoice $pu_ht_devise = $tabprice[19]; // Rank to use - $rangtouse = $rang; - if ($rangtouse == -1) + $ranktouse = $rang; + if ($ranktouse == -1) { $rangmax = $this->line_max($fk_parent_line); - $rangtouse = $rangmax + 1; + $ranktouse = $rangmax + 1; } // Insert line @@ -2863,7 +2863,7 @@ class Facture extends CommonInvoice $this->line->date_start=$date_start; $this->line->date_end=$date_end; $this->line->ventil=$ventil; - $this->line->rang=$rangtouse; + $this->line->rang=$ranktouse; $this->line->info_bits=$info_bits; $this->line->fk_remise_except=$fk_remise_except; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index f484c2690a6..6200b14ce19 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -2593,11 +2593,11 @@ class ExpeditionLigne extends CommonObjectLine if (empty($this->rang)) $this->rang = 0; // Rank to use - $rangtouse = $this->rang; - if ($rangtouse == -1) + $ranktouse = $this->rang; + if ($ranktouse == -1) { $rangmax = $this->line_max($fk_expedition); - $rangtouse = $rangmax + 1; + $ranktouse = $rangmax + 1; } $sql = "INSERT INTO ".MAIN_DB_PREFIX."expeditiondet ("; @@ -2611,7 +2611,7 @@ class ExpeditionLigne extends CommonObjectLine $sql.= ", ".(empty($this->entrepot_id) ? 'NULL' : $this->entrepot_id); $sql.= ", ".$this->fk_origin_line; $sql.= ", ".$this->qty; - $sql.= ", ".$rangtouse; + $sql.= ", ".$ranktouse; $sql.= ")"; dol_syslog(get_class($this)."::insert", LOG_DEBUG); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index a84f18f5b7b..546a93763a6 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -524,11 +524,11 @@ class SupplierProposal extends CommonObject $pu_ht_devise = $tabprice[19]; // Rang to use - $rangtouse = $rang; - if ($rangtouse == -1) + $ranktouse = $rang; + if ($ranktouse == -1) { $rangmax = $this->line_max($fk_parent_line); - $rangtouse = $rangmax + 1; + $ranktouse = $rangmax + 1; } // TODO A virer @@ -556,7 +556,7 @@ class SupplierProposal extends CommonObject $this->line->fk_product=$fk_product; $this->line->remise_percent=$remise_percent; $this->line->subprice=$pu_ht; - $this->line->rang=$rangtouse; + $this->line->rang=$ranktouse; $this->line->info_bits=$info_bits; $this->line->total_ht=$total_ht; $this->line->total_tva=$total_tva; From 3351a1687c2f9a7a37b0b9ec5c4fdc32b8f4acba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Aug 2019 02:17:07 +0200 Subject: [PATCH 59/59] Fix phpcs --- htdocs/product/dynamic_price/class/price_parser.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php index f783a95e57d..016917372ad 100644 --- a/htdocs/product/dynamic_price/class/price_parser.class.php +++ b/htdocs/product/dynamic_price/class/price_parser.class.php @@ -271,7 +271,7 @@ class PriceParser } $supplier_min_price = $productFournisseur->fourn_unitprice; - //Accessible values by expressions + //Accessible values by expressions $extra_values = array_merge($extra_values, array( "supplier_min_price" => $supplier_min_price, ));