Fix: Bugs reported by scrutinizer

This commit is contained in:
Laurent Destailleur 2014-11-15 16:20:03 +01:00
parent d98bfb1d8d
commit ad661256c0
10 changed files with 21 additions and 18 deletions

View File

@ -59,10 +59,10 @@ $max=100;
$form = new Form($db);
llxHeader('',$title);
$title = $langs->trans('FiscalYears');
llxHeader('',$title,LOG_ERR);
print_fiche_titre($langs->trans('FiscalYears'));
$sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut, f.entity";

View File

@ -70,7 +70,7 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$object->getCanvas($rowid);
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
$objcanvas='';
$objcanvas=null;
if (! empty($canvas))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';
@ -79,7 +79,7 @@ if (! empty($canvas))
}
// Security check
$result=restrictedArea($user,'adherent',$rowid,'','','fk_soc', 'rowid', $objcanvas);
$result=restrictedArea($user, 'adherent', $rowid, '', '', 'fk_soc', 'rowid', $objcanvas);
if ($rowid > 0)
{

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -37,6 +37,8 @@ $typeconst=array('yesno','texte','chaine');
$action = GETPOST('action','alpha');
$type='donation';
/*
* Action
@ -135,7 +137,7 @@ else if ($action == 'setart200') {
$res = dolibarr_set_const($db, "DONATION_ART200", $setart200, 'yesno', 0, '', $conf->entity);
if (! $res > 0)
$error ++;
if (! $error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs');
} else {
@ -147,7 +149,7 @@ else if ($action == 'setart238') {
$res = dolibarr_set_const($db, "DONATION_ART238", $setart238, 'yesno', 0, '', $conf->entity);
if (! $res > 0)
$error ++;
if (! $error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs');
} else {
@ -159,7 +161,7 @@ else if ($action == 'setart885') {
$res = dolibarr_set_const($db, "DONATION_ART885", $setart885, 'yesno', 0, '', $conf->entity);
if (! $res > 0)
$error ++;
if (! $error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs');
} else {
@ -183,7 +185,7 @@ print_fiche_titre($langs->trans("DonationsSetup"),$linkback,'setup');
* Params
*/
print_titre($langs->trans("Options"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
@ -207,11 +209,11 @@ print '</form>';
/*
* French params
*/
if ($conf->global->MAIN_LANG_DEFAULT == "fr_FR")
if ($conf->global->MAIN_LANG_DEFAULT == "fr_FR")
{
print '<br>';
print_titre($langs->trans("FrenchOptions"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans('Parameters') . '</td>';
@ -377,7 +379,7 @@ if (is_resource($handle))
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,-1,0);
print '</td>';
// Preview
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'" target="specimen">'.img_object($langs->trans("Preview"),'generic').'</a>';

View File

@ -34,7 +34,7 @@
*/
abstract class CommonObject
{
protected $db;
public $db;
public $error;
public $errors;
public $canvas; // Contains canvas name if it is

View File

@ -56,7 +56,7 @@ class ExtraFields
var $error;
var $errno;
static $type2label=array(
public static $type2label=array(
'varchar'=>'String',
'text'=>'TextLong',
'int'=>'Int',

View File

@ -26,6 +26,7 @@
/**
* Prepare array with list of admin tabs
*
* @param $object Object instance we show card
* @return array Array of tabs to show
*/
function admin_accounting_prepare_head($object=null)

View File

@ -74,7 +74,7 @@ if ($id > 0 || ! empty($ref))
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$canvas = !empty($object->canvas)?$object->canvas:GETPOST("canvas");
$objcanvas='';
$objcanvas=null;
if (! empty($canvas))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';

View File

@ -69,7 +69,7 @@ $limit = $conf->liste_limit;
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$canvas=GETPOST("canvas");
$objcanvas='';
$objcanvas=null;
if (! empty($canvas))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';

View File

@ -63,7 +63,7 @@ $search_categ = GETPOST("search_categ");
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$canvas=GETPOST("canvas");
$objcanvas='';
$objcanvas=null;
if (! empty($canvas))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';

View File

@ -65,7 +65,7 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$object->getCanvas($socid);
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
$objcanvas='';
$objcanvas=null;
if (! empty($canvas))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';