Fix: Bugs reported by scrutinizer

This commit is contained in:
Laurent Destailleur 2014-11-15 15:19:37 +01:00
parent d0fb732cce
commit d98bfb1d8d
18 changed files with 84 additions and 79 deletions

View File

@ -90,7 +90,7 @@ $form = new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
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');

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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'
);

View File

@ -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);

View File

@ -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"))

View File

@ -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;

View File

@ -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);

View File

@ -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;
}
@ -1091,8 +1092,8 @@ class Ldap
* '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 $filter Search filter (ex: (sn=nom_personne) )
* @return array|int Array with answers (key lowercased - value)
*/
function search($checkDn, $filter)
{

View File

@ -123,7 +123,7 @@ interface Database
*
* @param string $database Name of database
* @param string $table Nmae of table filter ('xxx%')
* @return resource Resource
* @return array List of tables in an array
*/
function DDLListTables($database, $table = '');
@ -388,7 +388,7 @@ interface Database
*
* @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
* @return timestamp|string Date TMS
*/
function jdate($string, $gm=false);

View File

@ -159,7 +159,7 @@ 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
* @return resource|int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
*/
function rollback($log='')
{

View File

@ -28,7 +28,7 @@
*
* @return array Array of tabs to show
*/
function admin_accounting_prepare_head()
function admin_accounting_prepare_head($object=null)
{
global $langs, $conf;

View File

@ -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

View File

@ -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");

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}