From 4fffeb3a89d51d828301528980520c87a510e7b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Mar 2015 10:52:27 +0100 Subject: [PATCH] Clean code --- htdocs/adherents/class/cotisation.class.php | 10 +++++----- htdocs/core/class/commonobject.class.php | 11 ++++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/adherents/class/cotisation.class.php b/htdocs/adherents/class/cotisation.class.php index 2e1966c371e..ee9358b51da 100644 --- a/htdocs/adherents/class/cotisation.class.php +++ b/htdocs/adherents/class/cotisation.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2008 Laurent Destailleur + * Copyright (C) 2006-2015 Laurent Destailleur * * 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 @@ -90,7 +90,7 @@ class Cotisation extends CommonObject } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -1; } } @@ -140,7 +140,7 @@ class Cotisation extends CommonObject } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -1; } } @@ -181,7 +181,7 @@ class Cotisation extends CommonObject else { $this->db->rollback(); - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -1; } } @@ -217,7 +217,7 @@ class Cotisation extends CommonObject $result=$member->fetch($this->fk_adherent); $result=$member->update_end_date($user); - if ($accountline->rowid > 0) // If we found bank account line (this means this->fk_bank defined) + if ($accountline->id > 0) // If we found bank account line (this means this->fk_bank defined) { $result=$accountline->delete($user); // Return false if refused because line is conciliated if ($result > 0) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f12938bda28..1fa6e924325 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -51,11 +51,6 @@ abstract class CommonObject */ public $errors; - /** - * @var string Column name of the ref field. - */ - protected $table_ref_field = ''; - /** * @var context Can be used to pass information when only object is provied to method */ @@ -86,6 +81,12 @@ abstract class CommonObject */ public $linkedObjects; + /** + * @var string Column name of the ref field. + */ + protected $table_ref_field = ''; + + // Following var are used by some objects only. We keep this property here in CommonObject to be able to provide common method using them.