@@ -877,7 +877,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.paye,";
- $sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur";
+ $sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur, ff.date_lim_reglement";
$sql.= " ORDER BY ff.date_lim_reglement ASC";
$resql=$db->query($sql);
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 8f3c87725fa..d2c094fb025 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -2147,8 +2147,11 @@ class Contrat extends CommonObject
$line->total_ht=90;
$line->total_ttc=107.64; // 90 * 1.196
$line->total_tva=17.64;
- $prodid = mt_rand(1, $num_prods);
- $line->fk_product=$prodids[$prodid];
+ if ($num_prods > 0)
+ {
+ $prodid = mt_rand(1, $num_prods);
+ $line->fk_product=$prodids[$prodid];
+ }
$this->lines[$xnbp]=$line;
$xnbp++;
}
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/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php
index 997e27adb20..f1352f8e933 100644
--- a/htdocs/core/ajax/ajaxdirpreview.php
+++ b/htdocs/core/ajax/ajaxdirpreview.php
@@ -240,7 +240,10 @@ if ($section)
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$useglobalvars=1;
$form = new Form($db);
- $formquestion=array('urlfile'=>array('type'=>'hidden','value'=>$urlfile,'name'=>'urlfile'));
+ $formquestion=array(
+ 'urlfile'=>array('type'=>'hidden','value'=>$urlfile,'name'=>'urlfile'),
+ 'section'=>array('type'=>'hidden','value'=>$section,'name'=>'section')
+ );
print $form->formconfirm($url,$langs->trans("DeleteFile"),$langs->trans("ConfirmDeleteFile"),'confirm_deletefile',$formquestion,"no",($useajax?'deletefile':0));
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 3287ac5d4b7..c26251f2312 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -744,7 +744,8 @@ abstract class CommonObject
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
$sql.= " WHERE element_id = ".$this->id;
- $sql.= " AND fk_c_type_contact IN (".$listId.")";
+ if ($listId)
+ $sql.= " AND fk_c_type_contact IN (".$listId.")";
dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG);
if ($this->db->query($sql))
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 8d61733e138..283d189377c 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -1133,7 +1133,7 @@ class ExtraFields
if ($InfoFieldList[0] && class_exists($InfoFieldList[0]))
{
$object = new $InfoFieldList[0]($this->db);
- $object->fetch($value);
+ if (!empty($value)) $object->fetch($value);
$valuetoshow=$object->ref;
if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ref is id because name is not unique
$out.=' ';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 64d1538578b..175bc8873e1 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -2329,7 +2329,7 @@ class Form
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid";
- $sql.= " WHERE p.entity IN (".getEntity('product', 1).")";
+ $sql.= " WHERE p.entity IN (".getEntity('productprice', 1).")";
$sql.= " AND p.tobuy = 1";
$sql.= " AND s.fournisseur = 1";
$sql.= " AND p.rowid = ".$productid;
@@ -3812,7 +3812,7 @@ class Form
print ' ';
print '';
@@ -4091,7 +4091,7 @@ class Form
$out='';
$out.= '';
- if ($useempty) $out .= 'currency)?' selected="selected"':'').'>'.$langs->cache_currencies[$conf->currency]['label'].' ';
+ if ($useempty) $out .= ' ';
if (count($TCurrency) > 0)
{
foreach ($langs->cache_currencies as $code_iso => $currency)
diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php
index f3845734ec5..7c6fc0c5a77 100644
--- a/htdocs/core/class/ldap.class.php
+++ b/htdocs/core/class/ldap.class.php
@@ -162,68 +162,52 @@ class Ldap
return -1;
}
- if (! function_exists('ldap_connect'))
+ if (! function_exists("ldap_connect"))
{
- $this->error='Your PHP need extension ldap';
+ $this->error='LDAPFunctionsNotAvailableOnPHP';
dol_syslog(get_class($this)."::connect_bind ".$this->error, LOG_WARNING);
- return -1;
+ $return=-1;
}
-
- // Loop on each ldap server
- foreach ($this->server as $key => $host)
+
+ if (empty($this->error))
{
- if ($connected) break;
- if (empty($host)) continue;
-
- if (preg_match('/^ldap/',$host))
+ // Loop on each ldap server
+ foreach ($this->server as $key => $host)
{
- $this->connection = ldap_connect($host);
- }
- else
- {
- $this->connection = ldap_connect($host,$this->serverPort);
- }
-
- if (is_resource($this->connection))
- {
- // Begin TLS if requested by the configuration
- if (! empty($conf->global->LDAP_SERVER_USE_TLS))
- {
- if (! ldap_start_tls($this->connection))
- {
- dol_syslog(get_class($this)."::connect_bind failed to start tls", LOG_WARNING);
- $connected = 0;
- $this->close();
- }
- }
-
- // Execute the ldap_set_option here (after connect and before bind)
- $this->setVersion();
- ldap_set_option($this->connection, LDAP_OPT_SIZELIMIT, 0); // no limit here. should return true.
-
-
- if ($this->serverType == "activedirectory")
+ if ($connected) break;
+ if (empty($host)) continue;
+
+ if (preg_match('/^ldap/',$host))
{
- $result=$this->setReferrals();
- dol_syslog(get_class($this)."::connect_bind try bindauth for activedirectory on ".$host." user=".$this->searchUser." password=".preg_replace('/./','*',$this->searchPassword),LOG_DEBUG);
- $this->result=$this->bindauth($this->searchUser,$this->searchPassword);
- if ($this->result)
- {
- $this->bind=$this->result;
- $connected=2;
- break;
- }
- else
- {
- $this->error=ldap_errno($this->connection).' '.ldap_error($this->connection);
- }
+ $this->connection = ldap_connect($host);
}
else
{
- // Try in auth mode
- if ($this->searchUser && $this->searchPassword)
+ $this->connection = ldap_connect($host,$this->serverPort);
+ }
+
+ if (is_resource($this->connection))
+ {
+ // Begin TLS if requested by the configuration
+ if (! empty($conf->global->LDAP_SERVER_USE_TLS))
+ {
+ if (! ldap_start_tls($this->connection))
+ {
+ dol_syslog(get_class($this)."::connect_bind failed to start tls", LOG_WARNING);
+ $connected = 0;
+ $this->close();
+ }
+ }
+
+ // Execute the ldap_set_option here (after connect and before bind)
+ $this->setVersion();
+ ldap_set_option($this->connection, LDAP_OPT_SIZELIMIT, 0); // no limit here. should return true.
+
+
+ if ($this->serverType == "activedirectory")
{
- dol_syslog(get_class($this)."::connect_bind try bindauth on ".$host." user=".$this->searchUser." password=".preg_replace('/./','*',$this->searchPassword),LOG_DEBUG);
+ $result=$this->setReferrals();
+ dol_syslog(get_class($this)."::connect_bind try bindauth for activedirectory on ".$host." user=".$this->searchUser." password=".preg_replace('/./','*',$this->searchPassword),LOG_DEBUG);
$this->result=$this->bindauth($this->searchUser,$this->searchPassword);
if ($this->result)
{
@@ -236,26 +220,45 @@ class Ldap
$this->error=ldap_errno($this->connection).' '.ldap_error($this->connection);
}
}
- // Try in anonymous
- if (! $this->bind)
+ else
{
- dol_syslog(get_class($this)."::connect_bind try bind on ".$host,LOG_DEBUG);
- $result=$this->bind();
- if ($result)
+ // Try in auth mode
+ if ($this->searchUser && $this->searchPassword)
{
- $this->bind=$this->result;
- $connected=1;
- break;
+ dol_syslog(get_class($this)."::connect_bind try bindauth on ".$host." user=".$this->searchUser." password=".preg_replace('/./','*',$this->searchPassword),LOG_DEBUG);
+ $this->result=$this->bindauth($this->searchUser,$this->searchPassword);
+ if ($this->result)
+ {
+ $this->bind=$this->result;
+ $connected=2;
+ break;
+ }
+ else
+ {
+ $this->error=ldap_errno($this->connection).' '.ldap_error($this->connection);
+ }
}
- else
+ // Try in anonymous
+ if (! $this->bind)
{
- $this->error=ldap_errno($this->connection).' '.ldap_error($this->connection);
+ dol_syslog(get_class($this)."::connect_bind try bind on ".$host,LOG_DEBUG);
+ $result=$this->bind();
+ if ($result)
+ {
+ $this->bind=$this->result;
+ $connected=1;
+ break;
+ }
+ else
+ {
+ $this->error=ldap_errno($this->connection).' '.ldap_error($this->connection);
+ }
}
}
}
+
+ if (! $connected) $this->close();
}
-
- if (! $connected) $this->close();
}
if ($connected)
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/admin.lib.php b/htdocs/core/lib/admin.lib.php
index 4f08650e56b..9661f619055 100644
--- a/htdocs/core/lib/admin.lib.php
+++ b/htdocs/core/lib/admin.lib.php
@@ -736,17 +736,24 @@ function activateModule($value,$withdeps=1)
if (isset($objMod->depends) && is_array($objMod->depends) && ! empty($objMod->depends))
{
// Activation des modules dont le module depend
+ $TError=array();
$num = count($objMod->depends);
for ($i = 0; $i < $num; $i++)
{
+ $activate = false;
foreach ($modulesdir as $dir)
{
if (file_exists($dir.$objMod->depends[$i].".class.php"))
{
activateModule($objMod->depends[$i]);
+ $activate = true;
}
}
+
+ if (!$activate) $TError[] = $langs->trans('activateModuleDependNotSatisfied', $objMod->name, $objMod->depends[$i]);
}
+
+ setEventMessages('', $TError, 'errors');
}
if (isset($objMod->conflictwith) && is_array($objMod->conflictwith) && ! empty($objMod->conflictwith))
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 5864cbfa0da..f48b615c3fa 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -436,7 +436,7 @@ function dol_size($size,$type='')
*/
function dol_sanitizeFileName($str,$newstr='_',$unaccent=1)
{
- $filesystem_forbidden_chars = array('<','>',':','/','\\','?','*','|','"');
+ $filesystem_forbidden_chars = array('<','>',':','/','\\','?','*','|','"','°');
return dol_string_nospecial($unaccent?dol_string_unaccent($str):$str, $newstr, $filesystem_forbidden_chars);
}
@@ -902,8 +902,15 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if ($showimage) $morehtmlleft.=''.$object->show_photos($conf->product->multidir_output[$object->entity],'small',-$maxvisiblephotos,0,0,0,$width,0).'
';
else
{
- $nophoto='/public/theme/common/nophoto.png';
- $morehtmlleft.='';
+ if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) {
+ $nophoto='';
+ $morehtmlleft.='
';
+ }
+ else {
+ $nophoto='/public/theme/common/nophoto.png';
+ $morehtmlleft.='';
+ }
+
}
}
else
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 '