Fix scrutinizer errors

This commit is contained in:
Laurent Destailleur 2018-03-04 11:09:53 +01:00
parent 5839cedb4c
commit 6338328c90
10 changed files with 36 additions and 33 deletions

View File

@ -91,6 +91,8 @@ class box_graph_invoices_permonth extends ModeleBoxes
if ($user->rights->facture->lire)
{
$mesg = '';
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';

View File

@ -319,7 +319,7 @@ abstract class CommonDocGenerator
foreach($conf->global as $key => $val)
{
if (preg_match('/(_pass|password|secret|_key|key$)/i', $keyfound)) $newval = '*****forbidden*****';
if (preg_match('/(_pass|password|secret|_key|key$)/i', $key)) $newval = '*****forbidden*****';
else $newval = $val;
$array_other['__['.$key.']__'] = $newval;
}

View File

@ -4691,7 +4691,8 @@ abstract class CommonObject
if ($this->array_options[$key] != '' && is_array($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options']))
{
// If there is an encryption choice, we use it to crypt data before insert
$algo=reset(array_keys($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options']));
$tmparrays = array_keys($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options'])
$algo=reset($tmparrays);
if ($algo != '')
{
//global $action; // $action may be 'create', 'update', 'update_extras'...

View File

@ -235,6 +235,7 @@ class ExtraFields
$lengthdb='11';
} elseif ($type=='html') {
$typedb='text';
$lengthdb=$length;
} elseif($type=='password') {
$typedb='varchar';
$lengthdb='128';

View File

@ -194,6 +194,7 @@ class FormActions
$projectid = $object->fk_project;
if ($typeelement == 'project') $projectid = $object->id;
$buttontoaddnewevent='';
if (! empty($conf->agenda->enabled))
{
$buttontoaddnewevent = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(),'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid>0?'&socid='.$object->socid:'').($projectid>0?'&projectid='.$projectid:'').'&backtopage='.urlencode($urlbacktopage).'">';

View File

@ -164,7 +164,7 @@ class FormWebsite
*
* @param string $htmlname Name of select zone
* @param string $selected Selected value
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
* @param int $useempty 1=Add an empty value in list
* @param string $moreattrib More attributes on HTML select tag
* @return void
*/
@ -177,9 +177,9 @@ class FormWebsite
$arrayofsamples=array('corporatehome'=>'CorporateHomePage', 'empty'=>'EmptyPage');
$out = '';
$out .= '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
if ($useempty == 1 || ($useempty == 2 && $num > 1))
if ($useempty == 1 || $useempty == 2)
{
$out .= '<option value="-1">&nbsp;</option>';
}
@ -196,7 +196,6 @@ class FormWebsite
}
$out .= $langs->trans($val);
$out .= '</option>';
$i++;
}
$out .= "</select>";

View File

@ -1288,9 +1288,10 @@ function complete_elementList_with_modules(&$elementList)
$modules[$i] = $objMod;
$filename[$i]= $modName;
$orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module
$orders[$i] = $objMod->family."_".$j; // Sort on family then module number
$dirmod[$i] = $dir;
//print "x".$modName." ".$orders[$i]."\n<br>";
$dirmod[$i] = $dirroot;
if (! empty($objMod->module_parts['contactelement']))
{
$elementList[$objMod->name] = $langs->trans($objMod->name);

View File

@ -177,6 +177,7 @@ function redirectToContainer($containerref, $containeraliasalt='',$containerid=0
global $db, $website;
$newurl = '';
$result=0;
// We make redirect using the alternative alias, we must find the real $containerref
if ($containeraliasalt)

View File

@ -1169,7 +1169,7 @@ class Societe extends CommonObject
$sql .= ' WHERE s.entity IN ('.getEntity($this->element).')';
if ($rowid) $sql .= ' AND s.rowid = '.$rowid;
if ($ref) $sql .= " AND s.nom = '".$this->db->escape($ref)."'";
if ($ref_alias) $sql .= " AND s.nom_alias = '".$this->db->escape($nom_alias)."'";
if ($ref_alias) $sql .= " AND s.nom_alias = '".$this->db->escape($ref_alias)."'";
if ($ref_ext) $sql .= " AND s.ref_ext = '".$this->db->escape($ref_ext)."'";
if ($ref_int) $sql .= " AND s.ref_int = '".$this->db->escape($ref_int)."'";
if ($idprof1) $sql .= " AND s.siren = '".$this->db->escape($idprof1)."'";
@ -2833,10 +2833,10 @@ class Societe extends CommonObject
//Check NIF
if (preg_match('/(^[0-9]{8}[A-Z]{1}$)/', $string))
if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr($string, 0, 8) % 23, 1))
return 1;
else
return -1;
if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr($string, 0, 8) % 23, 1))
return 1;
else
return -1;
//algorithm checking type code CIF
$sum = $num[2] + $num[4] + $num[6];
@ -2846,31 +2846,31 @@ class Societe extends CommonObject
//Chek special NIF
if (preg_match('/^[KLM]{1}/', $string))
if ($num[8] == chr(64 + $n) || $num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr($string, 1, 8) % 23, 1))
return 1;
else
return -1;
if ($num[8] == chr(64 + $n) || $num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr($string, 1, 8) % 23, 1))
return 1;
else
return -1;
//Check CIF
if (preg_match('/^[ABCDEFGHJNPQRSUVW]{1}/', $string))
if ($num[8] == chr(64 + $n) || $num[8] == substr($n, strlen($n) - 1, 1))
return 2;
else
return -2;
if ($num[8] == chr(64 + $n) || $num[8] == substr($n, strlen($n) - 1, 1))
return 2;
else
return -2;
//Check NIE T
if (preg_match('/^[T]{1}/', $string))
if ($num[8] == preg_match('/^[T]{1}[A-Z0-9]{8}$/', $string))
return 3;
else
return -3;
if ($num[8] == preg_match('/^[T]{1}[A-Z0-9]{8}$/', $string))
return 3;
else
return -3;
//Check NIE XYZ
if (preg_match('/^[XYZ]{1}/', $string))
if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr(str_replace(array('X','Y','Z'), array('0','1','2'), $string), 0, 8) % 23, 1))
return 3;
else
return -3;
if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr(str_replace(array('X','Y','Z'), array('0','1','2'), $string), 0, 8) % 23, 1))
return 3;
else
return -3;
//Can not be verified
return -4;
@ -2894,9 +2894,6 @@ class Societe extends CommonObject
else {
return -1;
}
//Wrong format
return 0;
}
return $ok;

View File

@ -616,7 +616,7 @@ class Website extends CommonObject
// Generate the index.php page to be the home page
//-------------------------------------------------
$result = dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl);
$result = dolSaveIndexPage($pathofwebsitenew, $fileindex, $filetpl);
}
}