From 7515b2ba7bf78118bf270b70d48355fd15df8247 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Apr 2016 12:11:57 +0200 Subject: [PATCH] NEW Add a parameter on graph function to show a generic graph when no data are available. --- htdocs/core/class/dolgraph.class.php | 14 +- htdocs/core/lib/functions.lib.php | 12 +- htdocs/langs/en_US/main.lang | 1 + htdocs/projet/card.php | 8 +- htdocs/projet/graph_opportunities.inc.php | 6 +- htdocs/theme/eldy/img/nographyet.svg | 875 ++++++++++++++++++++++ htdocs/theme/eldy/style.css.php | 13 +- htdocs/theme/md/img/nographyet.svg | 875 ++++++++++++++++++++++ htdocs/theme/md/style.css.php | 13 +- 9 files changed, 1804 insertions(+), 13 deletions(-) create mode 100644 htdocs/theme/eldy/img/nographyet.svg create mode 100644 htdocs/theme/md/img/nographyet.svg diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 0b713de80ff..a4ee48f256b 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -600,7 +600,7 @@ class DolGraph /** - * Build a graph onto disk using Artichow library + * Build a graph onto disk using Artichow library and return img string to it * * @param string $file Image file name to use if we save onto disk * @param string $fileurl Url path to show image if saved onto disk @@ -779,7 +779,7 @@ class DolGraph /** - * Build a graph onto disk using JFlot library. Input when calling this method should be: + * Build a graph using JFlot library. Input when calling this method should be: * $this->data = array(array( 0=>'labelxA', 1=>yA), array('labelxB',yB)); or * $this->data = array(array('label'=>'labelxA','data'=>yA), array('labelxB',yB)); // TODO Syntax not supported. Removed when dol_print_graph_removed * $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // when there is n series to show for each x @@ -788,9 +788,10 @@ class DolGraph * $this->mode = 'depth' ??? * $this->bgcolorgrid * $this->datacolor + * $this->shownodatagraph * * @param string $file Image file name to use to save onto disk (also used as javascript unique id) - * @param string $fileurl Url path to show image if saved onto disk + * @param string $fileurl Url path to show image if saved onto disk. Never used here. * @return void */ private function draw_jflot($file,$fileurl) @@ -849,7 +850,14 @@ class DolGraph $this->stringtoshow =''."\n"; if (! empty($this->title)) $this->stringtoshow.='
'.$this->title.'
'; + if (! empty($this->shownographyet)) + { + $this->stringtoshow.='
'; + $this->stringtoshow.='
'.$langs->trans("NotEnoughDataYet").'
'; + return; + } $this->stringtoshow.='
'."\n"; + $this->stringtoshow.=''; } - else print 'BadValueForPArameterType'; + else print 'BadValueForParameterType'; } } diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index adae0e1800e..4b69e2c0dde 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -28,6 +28,7 @@ NoTemplateDefined=No template defined for this email type AvailableVariables=Available substitution variables NoTranslation=No translation NoRecordFound=No record found +NotEnoughDataYet=Not enough data NoError=No error Error=Error Errors=Errors diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index b59d725fecd..9f9dbc3bd2c 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -454,7 +454,7 @@ if ($action == 'create' && $user->rights->projet->creer) // Ref $suggestedref=($_POST["ref"]?$_POST["ref"]:$defaultref); - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print ' '.$form->textwithpicto('', $langs->trans("YouCanCompleteRef", $suggestedref)); print ''; @@ -532,7 +532,7 @@ if ($action == 'create' && $user->rights->projet->creer) // Description print ''.$langs->trans("Description").''; print ''; - print ''; + print ''; print ''; // Other options @@ -650,7 +650,7 @@ else // Ref $suggestedref=$object->ref; - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print ''; print ' '.$form->textwithpicto('', $langs->trans("YouCanCompleteRef", $suggestedref)); print ''; @@ -721,7 +721,7 @@ else // Description print ''.$langs->trans("Description").''; print ''; - print ''; + print ''; print ''; // Other options diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 558bd7307ee..199840bb1c6 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -16,6 +16,7 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $i = 0; $totalnb=0; + $totaloppnb=0; $totalamount=0; $ponderated_opp_amount=0; $valsnb=array(); @@ -32,6 +33,7 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $valsnb[$obj->opp_status]=$obj->nb; $valsamount[$obj->opp_status]=$obj->opp_amount; $totalnb+=$obj->nb; + if ($obj->opp_status) $totaloppnb+=$obj->nb; $totalamount+=$obj->opp_amount; $ponderated_opp_amount+=$obj->ponderated_opp_amount; } @@ -71,8 +73,8 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) if ($conf->use_javascript_ajax) { print ''; - $data=array('series'=>$dataseries); - dol_print_graph('stats',400,180,$data,1,'pie',0,'',0); + $data=array('series'=>$dataseries); + dol_print_graph('stats',400,180,$data,1,'pie',0,'',0,$totaloppnb?0:1); print ''; } //if ($totalinprocess != $total) diff --git a/htdocs/theme/eldy/img/nographyet.svg b/htdocs/theme/eldy/img/nographyet.svg new file mode 100644 index 00000000000..ba3b9faf92a --- /dev/null +++ b/htdocs/theme/eldy/img/nographyet.svg @@ -0,0 +1,875 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + Icon Set Graph + 2012-09-06T20:29:21 + Check others icons on my "Minimal Icon Set" collection.\nSet of simple icons useful for gui design and applications use interface. Icons representing various graph and plotting + https://openclipart.org/detail/172197/icon-set-graph-by-mi_brami-172197 + + + mi_brami + + + + + Icon + area + b&w + barcode + bars + black + data + graph + gray + icon + pie + plot + round + scatter + table + transparent + white + xy + + + + + + + + + + + diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index f7519e16f61..91fa27e5c33 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2878,9 +2878,20 @@ td.legendLabel { padding: 2px 2px 2px 0 !important; } .logo_setup { - content:url(); + content:url(); /* content is used to best fit the container */ display: inline-block; } +.nographyet +{ + content:url(); + display: inline-block; + opacity: 0.1; + background-repeat: no-repeat; +} +.nographyettext +{ + opacity: 0.5; +} div.titre { font-family: ; diff --git a/htdocs/theme/md/img/nographyet.svg b/htdocs/theme/md/img/nographyet.svg new file mode 100644 index 00000000000..ba3b9faf92a --- /dev/null +++ b/htdocs/theme/md/img/nographyet.svg @@ -0,0 +1,875 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + Icon Set Graph + 2012-09-06T20:29:21 + Check others icons on my "Minimal Icon Set" collection.\nSet of simple icons useful for gui design and applications use interface. Icons representing various graph and plotting + https://openclipart.org/detail/172197/icon-set-graph-by-mi_brami-172197 + + + mi_brami + + + + + Icon + area + b&w + barcode + bars + black + data + graph + gray + icon + pie + plot + round + scatter + table + transparent + white + xy + + + + + + + + + + + diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 9b5bbc5966e..35c1220a0b8 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2707,9 +2707,20 @@ td.legendLabel { padding: 2px 2px 2px 0 !important; } .logo_setup { - content:url(); + content:url(); /* content is used to best fit the container */ display: inline-block; } +.nographyet +{ + content:url(); + display: inline-block; + opacity: 0.1; + background-repeat: no-repeat; +} +.nographyettext +{ + opacity: 0.5; +} div.titre { font-family: ;