diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php
index dc8f50241a1..d0eef1dc2f4 100644
--- a/htdocs/accountancy/admin/export.php
+++ b/htdocs/accountancy/admin/export.php
@@ -26,7 +26,7 @@
*/
require '../../main.inc.php';
-
+
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@@ -44,7 +44,7 @@ $action = GETPOST('action', 'alpha');
// Other parameters ACCOUNTING_*
$list = array (
- 'ACCOUNTING_SEPARATORCSV'
+ 'ACCOUNTING_SEPARATORCSV'
);
/*
@@ -52,26 +52,26 @@ $list = array (
*/
if ($action == 'update') {
$error = 0;
-
+
$modelcsv = GETPOST('modelcsv', 'int');
-
+
if (! empty($modelcsv)) {
-
+
if (! dolibarr_set_const($db, 'ACCOUNTING_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
} else {
$error ++;
}
-
+
foreach ( $list as $constname ) {
$constvalue = GETPOST($constname, 'alpha');
-
+
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
}
-
+
if (! $error) {
setEventMessage($langs->trans("SetupSaved"));
} else {
@@ -90,7 +90,7 @@ $form = new Form($db);
$linkback=''.$langs->trans("BackToModuleList").'';
print_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'setup');
-$head = admin_accounting_prepare_head(null);
+$head = admin_accounting_prepare_head();
dol_fiche_head($head, 'export', $langs->trans("Configuration"), 0, 'cron');
@@ -142,13 +142,13 @@ if ($num) {
foreach ( $list as $key ) {
$var = ! $var;
-
+
print '
';
-
+
// Param
$label = $langs->trans($key);
print '| ' . $label . ' | ';
-
+
// Value
print '';
print '';
diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php
index 065f01d2091..77dfea739e1 100644
--- a/htdocs/comm/action/class/cactioncomm.class.php
+++ b/htdocs/comm/action/class/cactioncomm.class.php
@@ -103,7 +103,7 @@ class CActionComm
* @param string $idorcode 'id' or 'code'
* @param string $excludetype Type to exclude
* @param string $onlyautoornot Group list by auto events or not
- * @return array Array of all event types if OK, <0 if KO
+ * @return mixed Array of all event types if OK, <0 if KO
*/
function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0)
{
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index 66a1c81e8e9..47ac4d1a390 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -755,6 +755,8 @@ class BonPrelevement extends CommonObject
$factures = array();
$factures_prev = array();
$factures_result = array();
+ $factures_prev_id=array();
+ $factures_errors=array();
if (! $error)
{
diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php
index 0644a5ae4fe..9aaa175f6f4 100644
--- a/htdocs/compta/salaries/class/paymentsalary.class.php
+++ b/htdocs/compta/salaries/class/paymentsalary.class.php
@@ -127,7 +127,7 @@ class PaymentSalary extends CommonObject
{
// Call trigger
$result=$this->call_trigger('PAYMENT_SALARY_MODIFY',$user);
- if ($result < 0) $error++;
+ if ($result < 0) $error++;
// End call triggers
//FIXME: Add rollback if trigger fail
@@ -223,12 +223,12 @@ class PaymentSalary extends CommonObject
global $conf, $langs;
$error=0;
-
+
// Call trigger
$result=$this->call_trigger('PAYMENT_SALARY_DELETE',$user);
if ($result < 0) return -1;
// End call triggers
-
+
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary";
$sql.= " WHERE rowid=".$this->id;
@@ -279,7 +279,7 @@ class PaymentSalary extends CommonObject
function create($user)
{
global $conf,$langs;
-
+
$error=0;
// Clean parameters
@@ -414,7 +414,6 @@ class PaymentSalary extends CommonObject
$this->fk_user,
DOL_URL_ROOT.'/user/card.php?id=',
$langs->trans("SalaryPayment").' '.$fuser->getFullName($langs).' '.dol_print_date($this->datesp,'dayrfc').' '.dol_print_date($this->dateep,'dayrfc'),
- '(User)',
'user'
);
@@ -427,9 +426,9 @@ class PaymentSalary extends CommonObject
// Call trigger
$result=$this->call_trigger('PAYMENT_SALARY_CREATE',$user);
- if ($result < 0) $error++;
+ if ($result < 0) $error++;
// End call triggers
-
+
}
else $error++;
diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php
index 44e62ad0f10..fb8bc162c83 100644
--- a/htdocs/compta/sociales/class/chargesociales.class.php
+++ b/htdocs/compta/sociales/class/chargesociales.class.php
@@ -62,17 +62,19 @@ class ChargeSociales extends CommonObject
/**
* Retrouve et charge une charge sociale
*
- * @param int $id 1 si trouve, 0 sinon
+ * @param int $id Id
+ * @param string $ref Ref
* @return void
*/
- function fetch($id)
+ function fetch($id, $ref='')
{
$sql = "SELECT cs.rowid, cs.date_ech,";
$sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode,";
$sql.= " c.libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs, ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql.= " WHERE cs.fk_type = c.id";
- $sql.= " AND cs.rowid = ".$id;
+ if ($ref) $sql.= " AND cs.rowid = ".$ref;
+ else $sql.= " AND cs.rowid = ".$id;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php
index 738582ad931..89d05b92b79 100644
--- a/htdocs/core/boxes/box_actions.php
+++ b/htdocs/core/boxes/box_actions.php
@@ -159,6 +159,7 @@ class box_actions extends ModeleBoxes
$actioncejour=false;
$contents=$this->info_box_contents;
$nblines=count($contents);
+ $bcx=array();
$bcx[0] = 'class="box_pair"';
$bcx[1] = 'class="box_impair"';
if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo"))
diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php
index 275154cd80e..c2918ddf1ee 100644
--- a/htdocs/core/boxes/modules_boxes.php
+++ b/htdocs/core/boxes/modules_boxes.php
@@ -181,6 +181,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
global $langs,$conf;
$MAXLENGTHBOX=60; // Mettre 0 pour pas de limite
+ $bcx=array();
$bcx[0] = 'class="box_pair"';
$bcx[1] = 'class="box_impair"';
$var = false;
diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php
index 088dfaf327b..f2208a24d30 100644
--- a/htdocs/core/class/ccountry.class.php
+++ b/htdocs/core/class/ccountry.class.php
@@ -256,10 +256,10 @@ class Ccountry // extends CommonObject
/**
- * Delete object in database
+ * Delete object in database
*
- * @param User $user User that delete
- * @param int $notrigger 0=launch triggers after, 1=disable triggers
+ * @param User $user User that delete
+ * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function delete($user, $notrigger=0)
diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php
index 2b70053cb28..941cef40be6 100644
--- a/htdocs/core/class/html.formsms.class.php
+++ b/htdocs/core/class/html.formsms.class.php
@@ -277,7 +277,7 @@ function limitChars(textarea, limit, infodiv)
{
$defaultmessage=$this->withbody;
}
- $defaultmessage=make_substitutions($defaultmessage,$this->substit,$langs);
+ $defaultmessage=make_substitutions($defaultmessage,$this->substit);
if (isset($_POST["message"])) $defaultmessage=$_POST["message"];
$defaultmessage=str_replace('\n',"\n",$defaultmessage);
diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php
index 88abc140104..95436a51e29 100644
--- a/htdocs/core/class/ldap.class.php
+++ b/htdocs/core/class/ldap.class.php
@@ -847,6 +847,7 @@ class Ldap
*/
function getAttributeValues($filterrecord,$attribute)
{
+ $attributes=array();
$attributes[0] = $attribute;
// We need to search for this user in order to get their entry.
@@ -1075,9 +1076,9 @@ class Ldap
$subcount = hexdec(substr($hex_sid,2,2)); // Get count of sub-auth entries
$auth = hexdec(substr($hex_sid,4,12)); // SECURITY_NT_AUTHORITY
$result = "$rev-$auth";
- for ($x=0;$x < $subcount; $x++) {
- $subauth[$x] = hexdec($this->littleEndian(substr($hex_sid,16+($x*8),8))); // get all SECURITY_NT_AUTHORITY
- $result .= "-".$subauth[$x];
+ for ($x=0;$x < $subcount; $x++)
+ {
+ $result .= "-".hexdec($this->littleEndian(substr($hex_sid,16+($x*8),8))); // get all SECURITY_NT_AUTHORITY
}
return $result;
}
@@ -1090,9 +1091,9 @@ class Ldap
* car conflit majuscule-minuscule. A n'utiliser que pour les pages
* 'Fiche LDAP' qui affiche champ lisibles par defaut.
*
- * @param string $checkDn DN de recherche (Ex: ou=users,cn=my-domain,cn=com)
- * @param string $filter Filtre de recherche (ex: (sn=nom_personne) )
- * @return array Tableau des reponses (cle en minuscule-valeur)
+ * @param string $checkDn DN de recherche (Ex: ou=users,cn=my-domain,cn=com)
+ * @param string $filter Search filter (ex: (sn=nom_personne) )
+ * @return array|int Array with answers (key lowercased - value)
*/
function search($checkDn, $filter)
{
diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php
index 8b5f2c86810..0fbf22b0745 100644
--- a/htdocs/core/db/Database.interface.php
+++ b/htdocs/core/db/Database.interface.php
@@ -121,9 +121,9 @@ interface Database
/**
* List tables into a database
*
- * @param string $database Name of database
- * @param string $table Nmae of table filter ('xxx%')
- * @return resource Resource
+ * @param string $database Name of database
+ * @param string $table Nmae of table filter ('xxx%')
+ * @return array List of tables in an array
*/
function DDLListTables($database, $table = '');
@@ -386,9 +386,9 @@ interface Database
* 19700101020000 -> 3600 with TZ+1 and gmt=0
* 19700101020000 -> 7200 whaterver is TZ if gmt=1
*
- * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
- * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
- * @return date Date TMS
+ * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
+ * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
+ * @return timestamp|string Date TMS
*/
function jdate($string, $gm=false);
diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php
index 21f0001b7e7..baf38bd9a39 100644
--- a/htdocs/core/db/DoliDB.class.php
+++ b/htdocs/core/db/DoliDB.class.php
@@ -158,8 +158,8 @@ abstract class DoliDB implements Database
/**
* Annulation d'une transaction et retour aux anciennes valeurs
*
- * @param string $log Add more log to default log line
- * @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
+ * @param string $log Add more log to default log line
+ * @return resource|int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
*/
function rollback($log='')
{
diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php
index e7313c73aee..8c29e2d6a77 100644
--- a/htdocs/core/lib/accounting.lib.php
+++ b/htdocs/core/lib/accounting.lib.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2013-2014 Alexandre Spangaro
+ * Copyright (C) 2013-2014 Alexandre Spangaro
* Copyright (C) 2014 Florian Henry
*
* This program is free software; you can redistribute it and/or modify
@@ -28,36 +28,36 @@
*
* @return array Array of tabs to show
*/
-function admin_accounting_prepare_head()
+function admin_accounting_prepare_head($object=null)
{
global $langs, $conf;
-
+
$h = 0;
$head = array ();
-
+
$head[$h][0] = dol_buildpath('/accountancy/admin/index.php', 1);
$head[$h][1] = $langs->trans("Configuration");
$head[$h][2] = 'general';
$h ++;
-
+
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin');
-
+
$head[$h][0] = dol_buildpath('/accountancy/admin/journaux.php', 1);
$head[$h][1] = $langs->trans("Journaux");
$head[$h][2] = 'journal';
$h ++;
-
+
$head[$h][0] = dol_buildpath('/accountancy/admin/export.php', 1);
$head[$h][1] = $langs->trans("Export");
$head[$h][2] = 'export';
$h ++;
-
+
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin', 'remove');
-
+
return $head;
}
@@ -70,23 +70,23 @@ function admin_accounting_prepare_head()
function accounting_prepare_head($object)
{
global $langs, $conf;
-
+
$h = 0;
$head = array ();
-
+
$head[$h][0] = dol_buildpath('/accountancy/admin/card.php', 1) . '?id=' . $object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h ++;
-
+
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_account');
-
+
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_account', 'remove');
-
+
return $head;
}
@@ -94,25 +94,25 @@ function accounting_prepare_head($object)
* Return general accounting account with defined length
*
* @param string $account General accounting account
- * @return string String with defined length
+ * @return string String with defined length
*/
function length_accountg($account)
{
global $conf;
-
+
$g = $conf->global->ACCOUNTING_LENGTH_GACCOUNT;
-
+
if (! empty($g)) {
// Clean parameters
$i = strlen($account);
-
+
if ($i >= 2) {
while ( $i < $g ) {
$account .= '0';
-
+
$i ++;
}
-
+
return $account;
} else {
return $account;
@@ -126,25 +126,25 @@ function length_accountg($account)
* Return auxiliary accounting account with defined length
*
* @param string $accounta Auxiliary accounting account
- * @return string String with defined length
+ * @return string String with defined length
*/
function length_accounta($accounta)
{
global $conf, $langs;
-
+
$a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT;
-
+
if (! empty($a)) {
// Clean parameters
$i = strlen($accounta);
-
+
if ($i >= 2) {
while ( $i < $a ) {
$accounta .= '0';
-
+
$i ++;
}
-
+
return $accounta;
} else {
return $accounta;
@@ -160,8 +160,8 @@ function length_accounta($accounta)
* @param string $txt Accounting account
* @param int $len Length
* @param int $end Number of characters
- *
- * @return string Formated string
+ *
+ * @return string Formated string
*/
function length_exportsage($txt, $len, $end)
{
@@ -169,11 +169,11 @@ function length_exportsage($txt, $len, $end)
// problem with this function, but we need to have the number of letter
if (strlen($txt) == $len) {
$res = $txt;
- }
+ }
elseif (strlen($txt) > $len) {
$res = substr($txt, 0, $len);
- }
+ }
else {
if ($end == 1) {
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 09c38435c0a..8c460f1d93a 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -3837,13 +3837,14 @@ function dol_html_entity_decode($a,$b,$c='UTF-8')
/**
* Replace htmlentities functions to manage errors
* http://php.net/manual/en/function.htmlentities.php
+ * TODO Remove this function to replace it with direct htmlentities.
*
* @param string $string The input string.
* @param int $flags Flags(see PHP doc above)
* @param string $encoding Encoding
* @param bool $double_encode When double_encode is turned off PHP will not encode existing html entities
* @return string $ret Encoded string
- * @deprecated Since PHP4 support is no longer available, this function does not make sense
+ * @deprecated Since PHP4 support is no longer available, this function does not make sense.
*/
function dol_htmlentities($string, $flags=null, $encoding='UTF-8', $double_encode=false)
{
@@ -3998,10 +3999,7 @@ function dol_concatdesc($text1,$text2,$forxml=false)
}
/**
- * Make substition into a string
- * There is two type of substitions:
- * - From $substitutionarray (oldval=>newval)
- * - From special constants (__XXX__=>f(objet->xxx)) by substitutions modules
+ * Make substition into a string replacing key with vals from $substitutionarray (oldval=>newval)
*
* @param string $chaine Source string in which we must do substitution
* @param array $substitutionarray Array with key->val to substitute
diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php
index b126df7bdc3..33ded69b802 100644
--- a/htdocs/core/lib/product.lib.php
+++ b/htdocs/core/lib/product.lib.php
@@ -316,6 +316,7 @@ function measuring_units_string($unit,$measuring_style='')
{
global $langs;
+ $measuring_units=array();
if ($measuring_style == 'weight')
{
$measuring_units[3] = $langs->trans("WeightUnitton");
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 51fa2cdf162..f5aef06ecf4 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -637,7 +637,7 @@ if (! defined('NOLOGIN'))
{
$db->rollback();
session_destroy();
- dol_print_error($db,'Error in some triggers on action USER_LOGIN',LOG_ERR);
+ dol_print_error($db,'Error in some triggers on action USER_LOGIN');
exit;
}
else
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 98b5d155ba7..4ec459fff85 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -1396,7 +1396,7 @@ class Product extends CommonObject
if (! $id && ! $ref && ! $ref_ext)
{
$this->error='ErrorWrongParameters';
- dol_print_error(get_class($this)."::fetch ".$this->error, LOG_ERR);
+ dol_print_error(get_class($this)."::fetch ".$this->error);
return -1;
}
diff --git a/htdocs/resource/class/resource.class.php b/htdocs/resource/class/resource.class.php
index 19768f569e3..4beac635568 100644
--- a/htdocs/resource/class/resource.class.php
+++ b/htdocs/resource/class/resource.class.php
@@ -633,7 +633,7 @@ class Resource extends CommonObject
if (! $this->table_element)
{
- dol_print_error('',get_class($this)."::load_previous_next_ref was called on objet with property table_element not defined", LOG_ERR);
+ dol_print_error('',get_class($this)."::load_previous_next_ref was called on objet with property table_element not defined");
return -1;
}
|