';
diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php
index 7c368437ffc..aa626fdb893 100644
--- a/htdocs/core/class/dolgraph.class.php
+++ b/htdocs/core/class/dolgraph.class.php
@@ -244,15 +244,15 @@ class DolGraph
$this->data = $data;
}
- /**
- * Set data
- *
- * @param array $datacolor Data color array(array(R,G,B),array(R,G,B)...)
- * @return void
- */
- function SetDataColor($datacolor)
- {
- $this->datacolor = $datacolor;
+ /**
+ * Set data
+ *
+ * @param array $datacolor Data color array(array(R,G,B),array(R,G,B)...)
+ * @return void
+ */
+ function SetDataColor($datacolor)
+ {
+ $this->datacolor = $datacolor;
}
/**
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 331ab1c3b98..ff31407b5b8 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -800,7 +800,21 @@ class Form
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
- $label=$obj->nom;
+
+ if ($conf->global->SOCIETE_ADD_REF_IN_LIST) {
+ if (($obj->client) && (!empty($obj->code_client))) {
+ $label = $obj->code_client. ' - ';
+ }
+ if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) {
+ $label .= $obj->code_fournisseur. ' - ';
+ }
+ $label.=' '.$obj->nom;
+ }
+ else
+ {
+ $label=$obj->nom;
+ }
+
if ($showtype)
{
if ($obj->client || $obj->fournisseur) $label.=' (';
diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php
index 20494adfc8a..b855eddaa41 100644
--- a/htdocs/core/modules/modSociete.class.php
+++ b/htdocs/core/modules/modSociete.class.php
@@ -124,6 +124,13 @@ class modSociete extends DolibarrModules
$this->const[$r][4] = 1;
$r++;
*/
+
+ $this->const[$r][0] = "SOCIETE_ADD_REF_IN_LIST";
+ $this->const[$r][1] = "yesno";
+ $this->const[$r][2] = "0";
+ $this->const[$r][3] = "Display customer ref into select list";
+ $this->const[$r][4] = 0;
+ $r++;
// Boxes
$this->boxes = array();
diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php
index 9413ff26b9c..13c23cb4f73 100644
--- a/htdocs/core/modules/project/task/mod_task_simple.php
+++ b/htdocs/core/modules/project/task/mod_task_simple.php
@@ -72,10 +72,11 @@ class mod_task_simple extends ModeleNumRefTask
$coyymm=''; $max='';
$posindice=8;
- $sql = "SELECT MAX(SUBSTRING(ref FROM ".$posindice.")) as max";
- $sql.= " FROM ".MAIN_DB_PREFIX."projet_task";
- $sql.= " WHERE ref LIKE '".$this->prefix."____-%'";
- $sql.= " AND entity = ".$conf->entity;
+ $sql = "SELECT MAX(SUBSTRING(task.ref FROM " . $posindice . ")) as max";
+ $sql .= " FROM " . MAIN_DB_PREFIX . "projet_task AS task, ";
+ $sql .= MAIN_DB_PREFIX . "projet AS project WHERE task.fk_projet=project.rowid";
+ $sql .= " AND task.ref LIKE '" . $this->prefix . "____-%'";
+ $sql .= " AND project.entity = " . $conf->entity;
$resql=$db->query($sql);
if ($resql)
{
diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php
index fb16e5cbadf..dbb3a215d5d 100644
--- a/htdocs/exports/class/export.class.php
+++ b/htdocs/exports/class/export.class.php
@@ -220,7 +220,12 @@ class Export
if ($i > 0) $sql.=', ';
else $i++;
- $newfield=$key.' as '.str_replace(array('.', '-'),'_',$key);;
+
+ if (strpos($key, ' as ')===false) {
+ $newfield=$key.' as '.str_replace(array('.', '-'),'_',$key);
+ } else {
+ $newfield=$key;
+ }
$sql.=$newfield;
}
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index e63a8c8ecb4..0cb281fa45b 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1002,6 +1002,7 @@ BrowserIsOK=You are using the web browser %s. This browser is ok for security an
BrowserIsKO=You are using the web browser %s. This browser is known to be a bad choice for security, performance and reliability. We recommand you to use Firefox, Chrome, Opera or Safari.
XDebugInstalled=XDebug est chargé.
XCacheInstalled=XCache is loaded.
+AddRefInList=Display customer/supplier ref into list (select list or combobox) and most of hyperlink
##### Module password generation
PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase.
PasswordGenerationNone=Do not suggest any generated password. Password must be type in manually.
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index b8e3c8fe48c..4341d453fba 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -1002,6 +1002,7 @@ BrowserIsOK=Vous utilisez le navigateur %s. Ce navigateur est réputé optimisé
BrowserIsKO=Vous utilisez le navigateur %s. Ce navigateur est déconseillé pour des raisons de sécurité, performance et qualité des pages restituées. Nous vous recommandons d'utiliser Firefox, Chrome, Opera ou Safari.
XDebugInstalled=XDebug est chargé.
XCacheInstalled=XCache est chargé.
+AddRefInList=Affiché le code client/fournisseur dans les liste (déroulante ou autocomplétion) et dans la pluspart des hyperliens
##### Module password generation
PasswordGenerationStandard=Renvoie un mot de passe généré selon l'algorithme interne de Dolibarr : 8 caractères, chiffres et caractères en minuscules mélangés.
PasswordGenerationNone=Ne propose pas de mots de passe générés. Le mot de passe est à saisir manuellement.
diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang
index bb444584721..916d4d9e6ff 100644
--- a/htdocs/langs/fr_FR/products.lang
+++ b/htdocs/langs/fr_FR/products.lang
@@ -199,3 +199,5 @@ CostPmpHT=Cout à l'achat HT
ProductUsedForBuild=Consommé automatiquement par la fabrication
ProductBuilded=Fabrication terminée
ProductsMultiPrice=Produits multi-prix
+ProductSellByQuarterHT=Chiffre d'affaire trimestrielle HT des produits
+ServiceSellByQuarterHT=Chiffre d'affaire trimestrielle HT des services
diff --git a/htdocs/product/index.php b/htdocs/product/index.php
index 247ddf7d5ff..f9eb16e23de 100644
--- a/htdocs/product/index.php
+++ b/htdocs/product/index.php
@@ -258,10 +258,121 @@ else
dol_print_error($db);
}
+// ici le récap des ventes par trimestre de service et de produit
+if (! empty($conf->product->enabled))
+ activitytrim(0);
+
+if (! empty($conf->service->enabled))
+ activitytrim(1);
+
//print '
';
print '';
llxFooter();
$db->close();
+
+function activitytrim($product_type)
+{
+ global $conf,$langs,$db;
+
+ // on affiche les 3 dernières années
+ $yearofbegindate=date('Y',dol_time_plus_duree(time(), -3, "y"));
+
+ // ventilation par trimestre
+ $sql = "SELECT DATE_FORMAT(p.datep,'%Y') as annee, DATE_FORMAT(p.datep,'%m') as mois, sum(fd.total_ht) as Mnttot";
+ $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as fd";
+ $sql.= " , ".MAIN_DB_PREFIX."paiement as p,".MAIN_DB_PREFIX."paiement_facture as pf";
+ $sql.= " WHERE f.fk_soc = s.rowid";
+ $sql.= " AND f.rowid = fd.fk_facture";
+ $sql.= " AND pf.fk_facture = f.rowid";
+ $sql.= " AND pf.fk_paiement= p.rowid";
+ $sql.= " AND fd.product_type=".$product_type;
+ $sql.= " AND s.entity = ".$conf->entity;
+ $sql.= " AND p.datep >= '".$db->idate(dol_get_first_day($yearofbegindate),1)."'";
+ $sql.= " GROUP BY annee, mois ";
+ $sql.= " ORDER BY annee, mois ";
+
+ $result = $db->query($sql);
+ if ($result)
+ {
+ $tmpyear=$beginyear;
+ $trim1=0;
+ $trim2=0;
+ $trim3=0;
+ $trim4=0;
+ $lgn = 0;
+ $num = $db->num_rows($result);
+
+ if ($num > 0 )
+ {
+ print ' ';
+ print '