';
diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php
index c2620fd34df..5d8dce0fd73 100644
--- a/htdocs/compta/tva/clients.php
+++ b/htdocs/compta/tva/clients.php
@@ -35,6 +35,7 @@ $langs->load("bills");
$langs->load("compta");
$langs->load("companies");
$langs->load("products");
+$langs->load("other");
// Date range
$year=GETPOST("year");
diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php
index 681448e901e..f551e92cb9d 100644
--- a/htdocs/compta/tva/quadri_detail.php
+++ b/htdocs/compta/tva/quadri_detail.php
@@ -41,6 +41,7 @@ $langs->load("bills");
$langs->load("compta");
$langs->load("companies");
$langs->load("products");
+$langs->load("other");
// Date range
$year=GETPOST("year");
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 30c97e9f1ef..1c7c3ffb634 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -100,7 +100,7 @@ class ExtraFields
* @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour')
* @param int $pos Position of attribute
* @param int $size Size/length of attribute
- * @param string $elementtype Element type ('member', 'product', 'company', ...)
+ * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param string $default_value Defaulted value
@@ -113,6 +113,8 @@ class ExtraFields
if (empty($attrname)) return -1;
if (empty($label)) return -1;
+ if ($elementtype == 'thirdparty') $elementtype='societe';
+
// Create field into database except for separator type which is not stored in database
if ($type != 'separate')
{
@@ -145,7 +147,7 @@ class ExtraFields
* @param string $attrname code of attribute
* @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour')
* @param int $length Size/length of attribute
- * @param string $elementtype Element type ('member', 'product', 'company', 'contact', ...)
+ * @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param string $default_value Default value for field
@@ -155,6 +157,8 @@ class ExtraFields
*/
private function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0, $required=0, $default_value='',$param='')
{
+ if ($elementtype == 'thirdparty') $elementtype='societe';
+
$table=$elementtype.'_extrafields';
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9_]*$/",$attrname) && ! is_numeric($attrname))
@@ -216,7 +220,7 @@ class ExtraFields
* @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour', 'float')
* @param int $pos Position of attribute
* @param int $size Size/length of attribute
- * @param string $elementtype Element type ('member', 'product', 'company', ...)
+ * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param array||string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
@@ -227,6 +231,8 @@ class ExtraFields
{
global $conf;
+ if ($elementtype == 'thirdparty') $elementtype='societe';
+
// Clean parameters
if (empty($pos)) $pos=0;
@@ -277,11 +283,13 @@ class ExtraFields
* Delete an optional attribute
*
* @param string $attrname Code of attribute to delete
- * @param string $elementtype Element type ('member', 'product', 'company', 'contact', ...)
+ * @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
* @return int < 0 if KO, 0 if nothing is done, 1 if OK
*/
function delete($attrname, $elementtype='member')
{
+ if ($elementtype == 'thirdparty') $elementtype='societe';
+
$table=$elementtype.'_extrafields';
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
@@ -307,13 +315,15 @@ class ExtraFields
* Delete description of an optional attribute
*
* @param string $attrname Code of attribute to delete
- * @param string $elementtype Element type ('member', 'product', 'company', ...)
+ * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
* @return int < 0 if KO, 0 if nothing is done, 1 if OK
*/
private function delete_label($attrname, $elementtype='member')
{
global $conf;
+ if ($elementtype == 'thirdparty') $elementtype='societe';
+
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."extrafields";
@@ -347,7 +357,7 @@ class ExtraFields
* @param string $label Label of attribute
* @param string $type Type of attribute
* @param int $length Length of attribute
- * @param string $elementtype Element type ('member', 'product', 'company', 'contact', ...)
+ * @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param int $pos Position of attribute
@@ -357,6 +367,8 @@ class ExtraFields
*/
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0)
{
+ if ($elementtype == 'thirdparty') $elementtype='societe';
+
$table=$elementtype.'_extrafields';
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
@@ -433,7 +445,7 @@ class ExtraFields
* @param string $label Label of attribute
* @param string $type Type of attribute
* @param int $size Length of attribute
- * @param string $elementtype Element type ('member', 'product', 'company', ...)
+ * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param int $pos Position of attribute
@@ -446,6 +458,8 @@ class ExtraFields
global $conf;
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required);
+ if ($elementtype == 'thirdparty') $elementtype='societe';
+
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
{
$this->db->begin();
@@ -513,7 +527,7 @@ class ExtraFields
/**
* Load array this->attribute_xxx like attribute_label, attribute_type, ...
*
- * @param string $elementtype Type of element ('adherent', 'commande', societe', 'facture', 'propal', 'product', ...)
+ * @param string $elementtype Type of element ('adherent', 'commande', thirdparty', 'facture', 'propal', 'product', ...)
* @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED
* @return array Array of attributes for all extra fields
*/
@@ -521,6 +535,8 @@ class ExtraFields
{
global $conf;
+ if ($elementtype == 'thirdparty') $elementtype='societe';
+
$array_name_label=array();
// For avoid conflicts with external modules
diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php
index 95436a51e29..dc844ee3f02 100644
--- a/htdocs/core/class/ldap.class.php
+++ b/htdocs/core/class/ldap.class.php
@@ -176,7 +176,10 @@ class Ldap
if (is_resource($this->connection))
{
+ // 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")
{
diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php
index 7381fd77b93..58e79da87b9 100644
--- a/htdocs/core/db/pgsql.class.php
+++ b/htdocs/core/db/pgsql.class.php
@@ -7,6 +7,7 @@
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2012 Yann Droneaud
* Copyright (C) 2012 Florian Henry
+ * Copyright (C) 2015 Marcos GarcĂa
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -255,7 +256,7 @@ class DoliDBPgsql extends DoliDB
$newreg3=preg_replace('/ NOT NULL/i','',$newreg3);
$newreg3=preg_replace('/ NULL/i','',$newreg3);
$newreg3=preg_replace('/ DEFAULT 0/i','',$newreg3);
- $newreg3=preg_replace('/ DEFAULT \'[0-9a-zA-Z_@]*\'/i','',$newreg3);
+ $newreg3=preg_replace('/ DEFAULT \'?[0-9a-zA-Z_@]*\'?/i','',$newreg3);
$line.= "ALTER TABLE ".$reg[1]." ALTER COLUMN ".$reg[2]." TYPE ".$newreg3;
// TODO Add alter to set default value or null/not null if there is this in $reg[3]
}
diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php
index 741dd98de6d..1aea8f9e37b 100644
--- a/htdocs/core/lib/product.lib.php
+++ b/htdocs/core/lib/product.lib.php
@@ -57,11 +57,6 @@ function product_prepare_head($object, $user)
$h++;
}
- $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$object->id;
- $head[$h][1] = $langs->trans("Photos");
- $head[$h][2] = 'photos';
- $h++;
-
// Show category tab
if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
@@ -116,14 +111,19 @@ function product_prepare_head($object, $user)
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'product');
- // Attachments
+ $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$object->id;
+ $head[$h][1] = $langs->trans("Photos");
+ $head[$h][2] = 'photos';
+ $h++;
+
+ // Attachments
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if (! empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
$head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents');
- if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')';
+ if($nbFiles > 0) $head[$h][1].= ' '.$nbFiles.'';
$head[$h][2] = 'documents';
$h++;
diff --git a/htdocs/core/modules/syslog/mod_syslog_chromephp.php b/htdocs/core/modules/syslog/mod_syslog_chromephp.php
index 06d37dfa431..b2520d27d7b 100644
--- a/htdocs/core/modules/syslog/mod_syslog_chromephp.php
+++ b/htdocs/core/modules/syslog/mod_syslog_chromephp.php
@@ -42,7 +42,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
/**
* Is the module active ?
*
- * @return boolean
+ * @return int
*/
public function isActive()
{
@@ -51,8 +51,13 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
{
if (empty($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH)) $conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH='/usr/share/php';
set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH);
- $res = @include_once 'ChromePhp.class.php';
+
+ //print 'rrrrr'.get_include_path();
+ $res = include_once('ChromePhp.php');
+ if (! $res) $res=@include_once('ChromePhp.class.php');
+
restore_include_path();
+
if ($res)
{
return 1;
@@ -77,10 +82,11 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
return array(
array(
- 'name' => $langs->trans('IncludePath'),
+ 'name' => $langs->trans('IncludePath','SYSLOG_CHROMEPHP_INCLUDEPATH'),
'constant' => 'SYSLOG_CHROMEPHP_INCLUDEPATH',
'default' => '/usr/share/php',
- 'attr' => 'size="40"'
+ 'attr' => 'size="60"',
+ 'example' => DOL_DOCUMENT_ROOT.'/includes/chromephp'
)
);
}
@@ -88,24 +94,19 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
/**
* Return if configuration is valid
*
- * @return boolean True if configuration ok
+ * @return array Array of errors. Empty array if ok.
*/
public function checkConfiguration()
{
- global $langs;
+ global $langs,$conf;
$errors = array();
- $oldinclude = get_include_path();
- set_include_path(SYSLOG_CHROMEPHP_INCLUDEPATH);
-
- if (!file_exists('ChromePhp.class.php'))
+ if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php'))
{
- $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php');
+ $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php');
}
- set_include_path($oldinclude);
-
return $errors;
}
@@ -122,16 +123,18 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
if (! empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) return; // Global option to disable output of this handler
//We check the configuration to avoid showing PHP warnings
- if (count($this->checkConfiguration())) return false;
+ if (count($this->checkConfiguration()) > 0) return false;
try
{
// Warning ChromePHP must be into PHP include path. It is not possible to use into require_once() a constant from
// database or config file because we must be able to log data before database or config file read.
$oldinclude=get_include_path();
- set_include_path(SYSLOG_CHROMEPHP_INCLUDEPATH);
- include_once 'ChromePhp.class.php';
+ set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH);
+ $res = @include_once('ChromePhp.php');
+ if (! $res) $res=@include_once('ChromePhp.class.php');
set_include_path($oldinclude);
+
ob_start(); // To be sure headers are not flushed until all page is completely processed
if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']);
elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']);
diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php
index 331b7331194..92d2302bea7 100644
--- a/htdocs/core/modules/syslog/mod_syslog_file.php
+++ b/htdocs/core/modules/syslog/mod_syslog_file.php
@@ -45,11 +45,11 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
/**
* Is the module active ?
*
- * @return boolean
+ * @return int
*/
public function isActive()
{
- return true;
+ return 1;
}
/**
@@ -74,7 +74,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
/**
* Return if configuration is valid
*
- * @return boolean True if configuration ok
+ * @return array Array of errors. Empty array if ok.
*/
public function checkConfiguration()
{
diff --git a/htdocs/core/modules/syslog/mod_syslog_firephp.php b/htdocs/core/modules/syslog/mod_syslog_firephp.php
index 31a3fb13431..31addd8b17a 100644
--- a/htdocs/core/modules/syslog/mod_syslog_firephp.php
+++ b/htdocs/core/modules/syslog/mod_syslog_firephp.php
@@ -42,7 +42,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
/**
* Is the module active ?
*
- * @return boolean
+ * @return int
*/
public function isActive()
{
@@ -53,7 +53,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
restore_include_path();
if ($res)
{
- return true;
+ return 1;
}
}
catch(Exception $e)
@@ -61,7 +61,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
print ''."\n";
}
- return false;
+ return -1;
}
///**
@@ -86,7 +86,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
/**
* Return if configuration is valid
*
- * @return boolean True if configuration ok
+ * @return array Array of errors. Empty array if ok.
*/
public function checkConfiguration()
{
diff --git a/htdocs/core/modules/syslog/mod_syslog_syslog.php b/htdocs/core/modules/syslog/mod_syslog_syslog.php
index 58ac241695c..2043225857b 100644
--- a/htdocs/core/modules/syslog/mod_syslog_syslog.php
+++ b/htdocs/core/modules/syslog/mod_syslog_syslog.php
@@ -42,14 +42,14 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
/**
* Is the module active ?
*
- * @return boolean
+ * @return int
*/
public function isActive()
{
// This function does not exists on some ISP (Ex: Free in France)
- if (!function_exists('openlog')) return false;
+ if (!function_exists('openlog')) return 0;
- return true;
+ return 1;
}
/**
@@ -73,7 +73,7 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
/**
* Return if configuration is valid
*
- * @return boolean True if configuration ok
+ * @return array Array of errors. Empty array if ok.
*/
public function checkConfiguration()
{
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index f3e752ed9d4..26aeffad655 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -1270,14 +1270,14 @@ if ($action == 'create')
print '