Fix: Bugs reported by scrutinizer
This commit is contained in:
parent
d0fb732cce
commit
d98bfb1d8d
@ -90,7 +90,7 @@ $form = new Form($db);
|
|||||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
print_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'setup');
|
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');
|
dol_fiche_head($head, 'export', $langs->trans("Configuration"), 0, 'cron');
|
||||||
|
|
||||||
|
|||||||
@ -103,7 +103,7 @@ class CActionComm
|
|||||||
* @param string $idorcode 'id' or 'code'
|
* @param string $idorcode 'id' or 'code'
|
||||||
* @param string $excludetype Type to exclude
|
* @param string $excludetype Type to exclude
|
||||||
* @param string $onlyautoornot Group list by auto events or not
|
* @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)
|
function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -755,6 +755,8 @@ class BonPrelevement extends CommonObject
|
|||||||
$factures = array();
|
$factures = array();
|
||||||
$factures_prev = array();
|
$factures_prev = array();
|
||||||
$factures_result = array();
|
$factures_result = array();
|
||||||
|
$factures_prev_id=array();
|
||||||
|
$factures_errors=array();
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -414,7 +414,6 @@ class PaymentSalary extends CommonObject
|
|||||||
$this->fk_user,
|
$this->fk_user,
|
||||||
DOL_URL_ROOT.'/user/card.php?id=',
|
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'),
|
$langs->trans("SalaryPayment").' '.$fuser->getFullName($langs).' '.dol_print_date($this->datesp,'dayrfc').' '.dol_print_date($this->dateep,'dayrfc'),
|
||||||
'(User)',
|
|
||||||
'user'
|
'user'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -62,17 +62,19 @@ class ChargeSociales extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Retrouve et charge une charge sociale
|
* Retrouve et charge une charge sociale
|
||||||
*
|
*
|
||||||
* @param int $id 1 si trouve, 0 sinon
|
* @param int $id Id
|
||||||
|
* @param string $ref Ref
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function fetch($id)
|
function fetch($id, $ref='')
|
||||||
{
|
{
|
||||||
$sql = "SELECT cs.rowid, cs.date_ech,";
|
$sql = "SELECT cs.rowid, cs.date_ech,";
|
||||||
$sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode,";
|
$sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode,";
|
||||||
$sql.= " c.libelle";
|
$sql.= " c.libelle";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs, ".MAIN_DB_PREFIX."c_chargesociales as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs, ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||||
$sql.= " WHERE cs.fk_type = c.id";
|
$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);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|||||||
@ -159,6 +159,7 @@ class box_actions extends ModeleBoxes
|
|||||||
$actioncejour=false;
|
$actioncejour=false;
|
||||||
$contents=$this->info_box_contents;
|
$contents=$this->info_box_contents;
|
||||||
$nblines=count($contents);
|
$nblines=count($contents);
|
||||||
|
$bcx=array();
|
||||||
$bcx[0] = 'class="box_pair"';
|
$bcx[0] = 'class="box_pair"';
|
||||||
$bcx[1] = 'class="box_impair"';
|
$bcx[1] = 'class="box_impair"';
|
||||||
if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo"))
|
if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo"))
|
||||||
|
|||||||
@ -181,6 +181,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
|||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
|
|
||||||
$MAXLENGTHBOX=60; // Mettre 0 pour pas de limite
|
$MAXLENGTHBOX=60; // Mettre 0 pour pas de limite
|
||||||
|
$bcx=array();
|
||||||
$bcx[0] = 'class="box_pair"';
|
$bcx[0] = 'class="box_pair"';
|
||||||
$bcx[1] = 'class="box_impair"';
|
$bcx[1] = 'class="box_impair"';
|
||||||
$var = false;
|
$var = false;
|
||||||
|
|||||||
@ -256,10 +256,10 @@ class Ccountry // extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete object in database
|
* Delete object in database
|
||||||
*
|
*
|
||||||
* @param User $user User that delete
|
* @param User $user User that delete
|
||||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function delete($user, $notrigger=0)
|
function delete($user, $notrigger=0)
|
||||||
|
|||||||
@ -277,7 +277,7 @@ function limitChars(textarea, limit, infodiv)
|
|||||||
{
|
{
|
||||||
$defaultmessage=$this->withbody;
|
$defaultmessage=$this->withbody;
|
||||||
}
|
}
|
||||||
$defaultmessage=make_substitutions($defaultmessage,$this->substit,$langs);
|
$defaultmessage=make_substitutions($defaultmessage,$this->substit);
|
||||||
if (isset($_POST["message"])) $defaultmessage=$_POST["message"];
|
if (isset($_POST["message"])) $defaultmessage=$_POST["message"];
|
||||||
$defaultmessage=str_replace('\n',"\n",$defaultmessage);
|
$defaultmessage=str_replace('\n',"\n",$defaultmessage);
|
||||||
|
|
||||||
|
|||||||
@ -847,6 +847,7 @@ class Ldap
|
|||||||
*/
|
*/
|
||||||
function getAttributeValues($filterrecord,$attribute)
|
function getAttributeValues($filterrecord,$attribute)
|
||||||
{
|
{
|
||||||
|
$attributes=array();
|
||||||
$attributes[0] = $attribute;
|
$attributes[0] = $attribute;
|
||||||
|
|
||||||
// We need to search for this user in order to get their entry.
|
// 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
|
$subcount = hexdec(substr($hex_sid,2,2)); // Get count of sub-auth entries
|
||||||
$auth = hexdec(substr($hex_sid,4,12)); // SECURITY_NT_AUTHORITY
|
$auth = hexdec(substr($hex_sid,4,12)); // SECURITY_NT_AUTHORITY
|
||||||
$result = "$rev-$auth";
|
$result = "$rev-$auth";
|
||||||
for ($x=0;$x < $subcount; $x++) {
|
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];
|
$result .= "-".hexdec($this->littleEndian(substr($hex_sid,16+($x*8),8))); // get all SECURITY_NT_AUTHORITY
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@ -1090,9 +1091,9 @@ class Ldap
|
|||||||
* car conflit majuscule-minuscule. A n'utiliser que pour les pages
|
* car conflit majuscule-minuscule. A n'utiliser que pour les pages
|
||||||
* 'Fiche LDAP' qui affiche champ lisibles par defaut.
|
* 'Fiche LDAP' qui affiche champ lisibles par defaut.
|
||||||
*
|
*
|
||||||
* @param string $checkDn DN de recherche (Ex: ou=users,cn=my-domain,cn=com)
|
* @param string $checkDn DN de recherche (Ex: ou=users,cn=my-domain,cn=com)
|
||||||
* @param string $filter Filtre de recherche (ex: (sn=nom_personne) )
|
* @param string $filter Search filter (ex: (sn=nom_personne) )
|
||||||
* @return array Tableau des reponses (cle en minuscule-valeur)
|
* @return array|int Array with answers (key lowercased - value)
|
||||||
*/
|
*/
|
||||||
function search($checkDn, $filter)
|
function search($checkDn, $filter)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -121,9 +121,9 @@ interface Database
|
|||||||
/**
|
/**
|
||||||
* List tables into a database
|
* List tables into a database
|
||||||
*
|
*
|
||||||
* @param string $database Name of database
|
* @param string $database Name of database
|
||||||
* @param string $table Nmae of table filter ('xxx%')
|
* @param string $table Nmae of table filter ('xxx%')
|
||||||
* @return resource Resource
|
* @return array List of tables in an array
|
||||||
*/
|
*/
|
||||||
function DDLListTables($database, $table = '');
|
function DDLListTables($database, $table = '');
|
||||||
|
|
||||||
@ -386,9 +386,9 @@ interface Database
|
|||||||
* 19700101020000 -> 3600 with TZ+1 and gmt=0
|
* 19700101020000 -> 3600 with TZ+1 and gmt=0
|
||||||
* 19700101020000 -> 7200 whaterver is TZ if gmt=1
|
* 19700101020000 -> 7200 whaterver is TZ if gmt=1
|
||||||
*
|
*
|
||||||
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
|
* @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
|
* @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
|
||||||
* @return date Date TMS
|
* @return timestamp|string Date TMS
|
||||||
*/
|
*/
|
||||||
function jdate($string, $gm=false);
|
function jdate($string, $gm=false);
|
||||||
|
|
||||||
|
|||||||
@ -158,8 +158,8 @@ abstract class DoliDB implements Database
|
|||||||
/**
|
/**
|
||||||
* Annulation d'une transaction et retour aux anciennes valeurs
|
* Annulation d'une transaction et retour aux anciennes valeurs
|
||||||
*
|
*
|
||||||
* @param string $log Add more log to default log line
|
* @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
|
* @return resource|int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
||||||
*/
|
*/
|
||||||
function rollback($log='')
|
function rollback($log='')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* @return array Array of tabs to show
|
* @return array Array of tabs to show
|
||||||
*/
|
*/
|
||||||
function admin_accounting_prepare_head()
|
function admin_accounting_prepare_head($object=null)
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
|
|||||||
@ -3837,13 +3837,14 @@ function dol_html_entity_decode($a,$b,$c='UTF-8')
|
|||||||
/**
|
/**
|
||||||
* Replace htmlentities functions to manage errors
|
* Replace htmlentities functions to manage errors
|
||||||
* http://php.net/manual/en/function.htmlentities.php
|
* 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 string $string The input string.
|
||||||
* @param int $flags Flags(see PHP doc above)
|
* @param int $flags Flags(see PHP doc above)
|
||||||
* @param string $encoding Encoding
|
* @param string $encoding Encoding
|
||||||
* @param bool $double_encode When double_encode is turned off PHP will not encode existing html entities
|
* @param bool $double_encode When double_encode is turned off PHP will not encode existing html entities
|
||||||
* @return string $ret Encoded string
|
* @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)
|
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
|
* Make substition into a string replacing key with vals from $substitutionarray (oldval=>newval)
|
||||||
* There is two type of substitions:
|
|
||||||
* - From $substitutionarray (oldval=>newval)
|
|
||||||
* - From special constants (__XXX__=>f(objet->xxx)) by substitutions modules
|
|
||||||
*
|
*
|
||||||
* @param string $chaine Source string in which we must do substitution
|
* @param string $chaine Source string in which we must do substitution
|
||||||
* @param array $substitutionarray Array with key->val to substitute
|
* @param array $substitutionarray Array with key->val to substitute
|
||||||
|
|||||||
@ -316,6 +316,7 @@ function measuring_units_string($unit,$measuring_style='')
|
|||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
|
$measuring_units=array();
|
||||||
if ($measuring_style == 'weight')
|
if ($measuring_style == 'weight')
|
||||||
{
|
{
|
||||||
$measuring_units[3] = $langs->trans("WeightUnitton");
|
$measuring_units[3] = $langs->trans("WeightUnitton");
|
||||||
|
|||||||
@ -637,7 +637,7 @@ if (! defined('NOLOGIN'))
|
|||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
session_destroy();
|
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;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -1396,7 +1396,7 @@ class Product extends CommonObject
|
|||||||
if (! $id && ! $ref && ! $ref_ext)
|
if (! $id && ! $ref && ! $ref_ext)
|
||||||
{
|
{
|
||||||
$this->error='ErrorWrongParameters';
|
$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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -633,7 +633,7 @@ class Resource extends CommonObject
|
|||||||
|
|
||||||
if (! $this->table_element)
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user