Fix: Bugs reported by scrutinizer

This commit is contained in:
Laurent Destailleur 2014-05-26 09:07:18 +02:00
parent 6137d7ed45
commit 93f1392e87
4 changed files with 12 additions and 8 deletions

View File

@ -62,7 +62,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
*/ */
private function getTitle($action) private function getTitle($action)
{ {
global $langs; global $langs,$conf;
$out=''; $out='';

View File

@ -138,7 +138,7 @@ if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights
if ($_POST["userid"] != $object->user_id) // If link differs from currently in database if ($_POST["userid"] != $object->user_id) // If link differs from currently in database
{ {
$result=$object->setUserId($_POST["userid"]); $result=$object->setUserId($_POST["userid"]);
if ($result < 0) dol_print_error($object->db,$object->error); if ($result < 0) dol_print_error('',$object->error);
$_POST['action']=''; $_POST['action']='';
$action=''; $action='';
} }
@ -172,7 +172,7 @@ if ($action == 'setsocid')
if (! $error) if (! $error)
{ {
$result=$object->setThirdPartyId(GETPOST('socid','int')); $result=$object->setThirdPartyId(GETPOST('socid','int'));
if ($result < 0) dol_print_error($object->db,$object->error); if ($result < 0) dol_print_error('',$object->error);
$_POST['action']=''; $_POST['action']='';
$action=''; $action='';
} }

View File

@ -95,6 +95,8 @@ class Adherent extends CommonObject
var $first_subscription_date; var $first_subscription_date;
var $first_subscription_amount; var $first_subscription_amount;
var $last_subscription_date; var $last_subscription_date;
var $last_subscription_date_start;
var $last_subscription_date_end;
var $last_subscription_amount; var $last_subscription_amount;
var $subscriptions=array(); var $subscriptions=array();

View File

@ -99,8 +99,10 @@ class AdherentType extends CommonObject
*/ */
function update($user) function update($user)
{ {
global $hookmanager; global $hookmanager,$conf;
$error=0;
$this->libelle=trim($this->libelle); $this->libelle=trim($this->libelle);
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type "; $sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type ";
@ -119,7 +121,7 @@ class AdherentType extends CommonObject
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)
$hookmanager->initHooks(array('membertypedao')); $hookmanager->initHooks(array('membertypedao'));
$parameters=array('membertype'=>$this->id); $parameters=array('membertype'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,'update'); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) if (empty($reshook))
{ {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
@ -132,8 +134,8 @@ class AdherentType extends CommonObject
} }
} }
else if ($reshook < 0) $error++; else if ($reshook < 0) $error++;
return 1; return 1;
} }
else else