*
* This program is free software; you can redistribute it and/or modify
@@ -199,7 +199,7 @@ if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (
if ($filtert > 0 || $usergroup > 0)
{
$sql.= " AND (";
- if ($filtert > 0) $sql.= "(ar.fk_element = ".$filtert." OR a.fk_user_action=".$filtert.")";
+ if ($filtert > 0) $sql.= "(ar.fk_element = ".$filtert." OR (ar.fk_element IS NULL AND a.fk_user_action=".$filtert."))"; // The OR is for backward compatibility
if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
$sql.= ")";
}
@@ -368,7 +368,7 @@ if ($resql)
$actionstatic->type_code=$obj->type_code;
$actionstatic->type_label=$obj->type_label;
$actionstatic->label=$obj->label;
- print $actionstatic->getNomUrl(1,28);
+ print $actionstatic->getNomUrl(1,36);
print '';
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php
index 1ab418a9daa..e38097e4e3a 100644
--- a/htdocs/commande/class/commandestats.class.php
+++ b/htdocs/commande/class/commandestats.class.php
@@ -206,7 +206,7 @@ class CommandeStats extends Stats
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
- //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->where;
$sql.= " AND c.rowid = tl.fk_commande AND tl.fk_product = product.rowid";
$sql.= " AND c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year,1,false))."' AND '".$this->db->idate(dol_get_last_day($year,12,false))."'";
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 962570f55fa..a94448f5c12 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -2036,7 +2036,7 @@ if ($action == 'create')
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
}
- $absolute_discount = $soc->getAvailableDiscounts();
+ if(!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts();
if (! empty($conf->use_javascript_ajax))
{
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index 11d05c60a49..4c181d5c147 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -256,7 +256,7 @@ if ($resql)
print '';
print '';
print '| ';
- print '';
+ print '';
print ' | ';
print '';
print '';
diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php
index 2e58a686f8f..c8b9cc50f01 100644
--- a/htdocs/core/class/menubase.class.php
+++ b/htdocs/core/class/menubase.class.php
@@ -264,6 +264,8 @@ class Menubase
$sql.= " t.mainmenu,";
$sql.= " t.leftmenu,";
$sql.= " t.fk_menu,";
+ $sql.= " t.fk_mainmenu,";
+ $sql.= " t.fk_leftmenu,";
$sql.= " t.position,";
$sql.= " t.url,";
$sql.= " t.target,";
@@ -293,6 +295,8 @@ class Menubase
$this->mainmenu = $obj->mainmenu;
$this->leftmenu = $obj->leftmenu;
$this->fk_menu = $obj->fk_menu;
+ $this->fk_mainmenu = $obj->fk_mainmenu;
+ $this->fk_leftmenu = $obj->fk_leftmenu;
$this->position = $obj->position;
$this->url = $obj->url;
$this->target = $obj->target;
diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php
index 225568fd776..6fc0c9f013f 100644
--- a/htdocs/core/lib/treeview.lib.php
+++ b/htdocs/core/lib/treeview.lib.php
@@ -109,15 +109,17 @@ function tree_showpad(&$fulltree,$key,$silent=0)
* @param int $pere Array with parent ids ('rowid'=>,'mainmenu'=>,'leftmenu'=>,'fk_mainmenu=>,'fk_leftmenu=>)
* @param int $rang Level of element
* @param string $iddivjstree Id to use for parent ul element
+ * @param int $donoresetalreadyloaded Do not reset global array $donoresetalreadyloaded used to avoid to go down on an aleady processed record
+ * @param int $showfk Show fk links to parent into label
* @return void
*/
-function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree')
+function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetalreadyloaded=0, $showfk=0)
{
global $tree_recur_alreadyadded;
- if ($rang == 0) $tree_recur_alreadyadded=array();
+ if ($rang == 0 && empty($donoresetalreadyloaded)) $tree_recur_alreadyadded=array();
- if (empty($pere['rowid']))
+ if ($rang == 0)
{
// Test also done with jstree and dynatree (not able to have inside label)
print ' |