From 7df981b7e644bae73bf5c8d45b49b2753ccf578f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Mar 2010 23:03:04 +0000 Subject: [PATCH] Fix: Error management --- htdocs/adherents/adherent.class.php | 5 +++-- htdocs/adherents/adherent_type.class.php | 9 +++++---- htdocs/adherents/fiche.php | 9 ++++++--- htdocs/adherents/type.php | 19 +++++++++---------- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index dc82864fb41..aeac72de64b 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -952,8 +952,8 @@ class Adherent extends CommonObject if ($ref) $sql.= " AND d.rowid='".$ref."'"; elseif ($fk_soc) $sql.= " AND d.fk_soc='".$fk_soc."'"; else $sql.= " AND d.rowid=".$rowid; - dol_syslog("Adherent::fetch sql=".$sql); + dol_syslog("Adherent::fetch sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -1016,7 +1016,8 @@ class Adherent extends CommonObject } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); + dol_syslog("Adherent::fetch ".$this->error, LOG_ERR); return -1; } } diff --git a/htdocs/adherents/adherent_type.class.php b/htdocs/adherents/adherent_type.class.php index 4e0f916f1a1..57549ee770d 100644 --- a/htdocs/adherents/adherent_type.class.php +++ b/htdocs/adherents/adherent_type.class.php @@ -82,7 +82,7 @@ class AdherentType extends CommonObject function create($userid) { global $conf; - + $this->statut=trim($this->statut); $sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type ("; @@ -177,7 +177,7 @@ class AdherentType extends CommonObject $sql = "SELECT d.rowid, d.libelle, d.statut, d.cotisation, d.mail_valid, d.note, d.vote"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " WHERE d.rowid = ".$rowid; - + dol_syslog("Adherent_type::fetch sql=".$sql); $resql=$this->db->query($sql); @@ -200,7 +200,8 @@ class AdherentType extends CommonObject } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); + dol_syslog("Adherent_type::fetch ".$this->error, LOG_ERR); return -1; } } @@ -212,7 +213,7 @@ class AdherentType extends CommonObject function liste_array() { global $conf; - + $projets = array(); $sql = "SELECT rowid, libelle"; diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index a92b5dde4dd..be17ae45074 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -992,11 +992,14 @@ if ($rowid && $action != 'edit') $adh = new Adherent($db); $adh->id = $rowid; - $adh->fetch($rowid); - $adh->fetch_optionals($rowid); + $res=$adh->fetch($rowid); + if ($res < 0) dol_print_error($db); + $res=$adh->fetch_optionals($rowid); + if ($res < 0) dol_print_error($db); $adht = new AdherentType($db); - $adht->fetch($adh->typeid); + $res=$adht->fetch($adh->typeid); + if ($res < 0) dol_print_error($db); $html = new Form($db); diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index bfc94b0d691..a13f0f11fed 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2004-2010 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 @@ -128,11 +128,8 @@ llxHeader('',$langs->trans("MembersTypeSetup"),'EN:Module_Foundations|FR:Module_ $form=new Form($db); -/* ************************************************************************** */ -/* */ -/* Liste des types d'adh�rents */ -/* */ -/* ************************************************************************** */ + +// Liste of members type if (! $rowid && $_GET["action"] != 'create' && $_GET["action"] != 'edit') { @@ -217,7 +214,7 @@ if ($_GET["action"] == 'create') print ''; - print ''.$langs->trans("Label").''; + print ''.$langs->trans("Label").''; print ''.$langs->trans("SubscriptionRequired").''; print $htmls->selectyesno("cotisation",1,1); @@ -245,11 +242,13 @@ if ($_GET["action"] == 'create') } print ''; - print '  '; - print ''; + print "\n"; + + print '
'; + print '
    '; + print '
'; print "\n"; - print "\n"; } /* ************************************************************************** */