From 93f1392e878f87054e9c1ef801237640418940a0 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Mon, 26 May 2014 09:07:18 +0200
Subject: [PATCH] Fix: Bugs reported by scrutinizer

---
 .../default/actions_adherentcard_default.class.php   |  2 +-
 htdocs/adherents/card_subscriptions.php              |  4 ++--
 htdocs/adherents/class/adherent.class.php            |  2 ++
 htdocs/adherents/class/adherent_type.class.php       | 12 +++++++-----
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php
index dad66600d0e..b88e4b2134f 100644
--- a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php
+++ b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php
@@ -62,7 +62,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
 	 */
 	private function getTitle($action)
 	{
-		global $langs;
+		global $langs,$conf;
 
 		$out='';
 
diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php
index 91c786b2a10..4851c8bf82a 100644
--- a/htdocs/adherents/card_subscriptions.php
+++ b/htdocs/adherents/card_subscriptions.php
@@ -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
         {
             $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']='';
             $action='';
         }
@@ -172,7 +172,7 @@ if ($action == 'setsocid')
             if (! $error)
             {
                 $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']='';
                 $action='';
             }
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 73036747a6c..77cbff2918a 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -95,6 +95,8 @@ class Adherent extends CommonObject
     var $first_subscription_date;
     var $first_subscription_amount;
     var $last_subscription_date;
+    var $last_subscription_date_start;
+    var $last_subscription_date_end;
     var $last_subscription_amount;
     var $subscriptions=array();
 
diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php
index 66f7508fa20..9fbe5ea3d6a 100644
--- a/htdocs/adherents/class/adherent_type.class.php
+++ b/htdocs/adherents/class/adherent_type.class.php
@@ -99,8 +99,10 @@ class AdherentType extends CommonObject
      */
     function update($user)
     {
-    	global $hookmanager;
-    	
+    	global $hookmanager,$conf;
+
+    	$error=0;
+
         $this->libelle=trim($this->libelle);
 
         $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)
         	$hookmanager->initHooks(array('membertypedao'));
         	$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($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
@@ -132,8 +134,8 @@ class AdherentType extends CommonObject
         		}
         	}
         	else if ($reshook < 0) $error++;
-        	
-        	
+
+
             return 1;
         }
         else
-- 
GitLab