Fix scrutinizer bug reports

This commit is contained in:
Laurent Destailleur 2017-10-06 00:26:24 +02:00
parent 86e751bd45
commit 801a5180d6
12 changed files with 32 additions and 39 deletions

View File

@ -1562,7 +1562,7 @@ class Adherent extends CommonObject
*
* @param int $withpictoimg 0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
* @param int $maxlen length max label
* @param string $option Page for link
* @param string $option Page for link ('card', 'category', 'subscription', ...)
* @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login, 'ref'=Show ref
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
@ -1592,10 +1592,7 @@ class Adherent extends CommonObject
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
$label.='</div>';
if (empty($option) || $option == 'card' || $option == 'category')
{
$url = DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id;
}
$url = DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id;
if ($option == 'subscription')
{
$url = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$this->id;

View File

@ -59,7 +59,7 @@ class AdherentType extends CommonObject
public $note;
/** @var bool Can vote*/
public $vote;
/** @var bool Email sent during validation */
/** @var string Email sent during validation */
public $mail_valid;
/** @var array Array of members */
public $members=array();
@ -481,7 +481,7 @@ class AdherentType extends CommonObject
// Initialise parametres
$this->id = 0;
$this->ref = 0;
$this->ref = 'MTSPEC';
$this->specimen=1;
$this->label='MEMBERS TYPE SPECIMEN';

View File

@ -1749,7 +1749,7 @@ $db->close();
* @param Object $obj If we show a particular record, obj is filled with record fields
* @param string $tabname Name of SQL table
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
* @return void
* @return string '' or value of entity into table
*/
function fieldList($fieldlist, $obj='', $tabname='', $context='')
{
@ -1763,7 +1763,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
$formcompany = new FormCompany($db);
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
$withentity=null;
$withentity='';
foreach ($fieldlist as $field => $value)
{

View File

@ -104,7 +104,7 @@ class Documents extends DolibarrApi
{
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$this->invoice = new Facture($this->db);
$result = $this->invoice->fetch(0, $ref);
$result = $this->invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}

View File

@ -930,7 +930,7 @@ class ExtraFields
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
$value=price($value);
}
$out.='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
}
elseif ($type == 'double')
{

View File

@ -328,14 +328,14 @@ class DolibarrModules // Can not be abstract, because we need to insta
public $langfiles;
/**
* @var string[] Array of warnings to show when we activate the module
* @var array<string,string> Array of warnings to show when we activate the module
*
* array('always'='text') or array('FR'='text')
*/
public $warnings_activation;
/**
* @var string[] Array of warnings to show when we activate an external module
* @var array<string,string> Array of warnings to show when we activate an external module
*
* array('always'='text') or array('FR'='text')
*/

View File

@ -82,10 +82,9 @@ class EcmFiles //extends CommonObject
/**
* Create object into database
*
* @param User $user User that creates
* @param bool $notrigger false=launch triggers after, true=disable triggers
*
* @return int <0 if KO, Id of created object if OK
* @param User $user User that creates
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, Id of created object if OK
*/
public function create(User $user, $notrigger = false)
{
@ -144,8 +143,8 @@ class EcmFiles //extends CommonObject
if (empty($this->date_c)) $this->date_c = dol_now();
// If ref not defined
if (empty($ref)) $ref = dol_hash($this->filepath.'/'.$this->filename, 3);
$ref = dol_hash($this->filepath.'/'.$this->filename, 3);
if (! empty($this->ref)) $ref=$this->ref;
$maxposition=0;
if (empty($this->position)) // Get max used

View File

@ -1487,14 +1487,14 @@ class Expedition extends CommonObject
* Return clicable link of object (with eventually picto)
*
* @param int $withpicto Add picto into link
* @param int $option Where point the link
* @param string $option Where the link point to
* @param int $max Max length to show
* @param int $short Use short labels
* @param int $notooltip 1=No tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
function getNomUrl($withpicto=0, $option=0, $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1)
function getNomUrl($withpicto=0, $option='', $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1)
{
global $langs;

View File

@ -663,7 +663,7 @@ class Fichinter extends CommonObject
*/
function getNomUrl($withpicto=0, $option='', $notooltip=0, $save_lastsearch_value=-1)
{
global $langs;
global $conf, $langs;
$result='';
@ -674,13 +674,13 @@ class Fichinter extends CommonObject
$picto='intervention';
$url = DOL_URL_ROOT.'/fichinter/card.php?id='.$this->id;
//if ($option !== 'nolink')
//{
// Add param to save lastsearch_values or not
if ($option !== 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
//}
}
$linkclose='';
if (empty($notooltip))

View File

@ -781,12 +781,13 @@ class Holiday extends CommonObject
$num_rows = $this->db->num_rows($resql); // Note, we can have 2 records if on is morning and the other one is afternoon
if ($num_rows > 0)
{
$arrayofrecord=array();
$i=0;
while ($i < $num_rows)
{
$obj = $this->db->fetch_object($resql);
// Note: $obj->halday is 0:Full days, 2:Sart afternoon end morning, -1:Start afternoon, 1:End morning
// Note: $obj->halfday is 0:Full days, 2:Sart afternoon end morning, -1:Start afternoon, 1:End morning
$arrayofrecord[$obj->rowid]=array('date_start'=>$this->db->jdate($obj->date_start), 'date_end'=>$this->db->jdate($obj->date_end), 'halfday'=>$obj->halfday);
$i++;
}

View File

@ -2109,8 +2109,8 @@ class User extends CommonObject
if (! empty($_SESSION["disablemodules"])) $label.= '<br><b>'.$langs->trans("DisabledModules").':</b> <br>'.join(', ',explode(',',$_SESSION["disablemodules"]));
}
if ($option == 'leave') $url.= DOL_URL_ROOT.'/holiday/list.php?id='.$this->id;
else $link.= $url.= DOL_URL_ROOT.'/user/card.php?id='.$this->id;
$url = DOL_URL_ROOT.'/user/card.php?id='.$this->id;
if ($option == 'leave') $url = DOL_URL_ROOT.'/holiday/list.php?id='.$this->id;
if ($option != 'nolink')
{

View File

@ -1861,7 +1861,6 @@ function dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent)
if (! $result)
{
$error++;
setEventMessages('Failed to write file '.$filehtmlheader, null, 'errors');
return false;
}
@ -1887,14 +1886,13 @@ function dolSaveCssFile($filecss, $csscontent)
if (! empty($conf->global->MAIN_UMASK))
@chmod($filecss, octdec($conf->global->MAIN_UMASK));
if (! $result)
{
$error++;
setEventMessages('Failed to write file '.$filecss, null, 'errors');
return false;
}
if (! $result)
{
setEventMessages('Failed to write file '.$filecss, null, 'errors');
return false;
}
return true;
return true;
}
/**
@ -1917,7 +1915,6 @@ function dolSaveRobotFile($filerobot, $robotcontent)
if (! $result)
{
$error++;
setEventMessages('Failed to write file '.$filerobot, null, 'errors');
return false;
}
@ -1945,7 +1942,6 @@ function dolSaveHtaccessFile($filehtaccess, $htaccess)
if (! $result)
{
$error++;
setEventMessages('Failed to write file '.$filehtaccess, null, 'errors');
return false;
}