Fix: Error management

This commit is contained in:
Laurent Destailleur 2010-03-26 23:03:04 +00:00
parent aba2a51fa2
commit 7df981b7e6
4 changed files with 23 additions and 19 deletions

View File

@ -952,8 +952,8 @@ class Adherent extends CommonObject
if ($ref) $sql.= " AND d.rowid='".$ref."'"; if ($ref) $sql.= " AND d.rowid='".$ref."'";
elseif ($fk_soc) $sql.= " AND d.fk_soc='".$fk_soc."'"; elseif ($fk_soc) $sql.= " AND d.fk_soc='".$fk_soc."'";
else $sql.= " AND d.rowid=".$rowid; else $sql.= " AND d.rowid=".$rowid;
dol_syslog("Adherent::fetch sql=".$sql);
dol_syslog("Adherent::fetch sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -1016,7 +1016,8 @@ class Adherent extends CommonObject
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
dol_syslog("Adherent::fetch ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }

View File

@ -82,7 +82,7 @@ class AdherentType extends CommonObject
function create($userid) function create($userid)
{ {
global $conf; global $conf;
$this->statut=trim($this->statut); $this->statut=trim($this->statut);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type ("; $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 = "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 .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql .= " WHERE d.rowid = ".$rowid; $sql .= " WHERE d.rowid = ".$rowid;
dol_syslog("Adherent_type::fetch sql=".$sql); dol_syslog("Adherent_type::fetch sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -200,7 +200,8 @@ class AdherentType extends CommonObject
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
dol_syslog("Adherent_type::fetch ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@ -212,7 +213,7 @@ class AdherentType extends CommonObject
function liste_array() function liste_array()
{ {
global $conf; global $conf;
$projets = array(); $projets = array();
$sql = "SELECT rowid, libelle"; $sql = "SELECT rowid, libelle";

View File

@ -992,11 +992,14 @@ if ($rowid && $action != 'edit')
$adh = new Adherent($db); $adh = new Adherent($db);
$adh->id = $rowid; $adh->id = $rowid;
$adh->fetch($rowid); $res=$adh->fetch($rowid);
$adh->fetch_optionals($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 = new AdherentType($db);
$adht->fetch($adh->typeid); $res=$adht->fetch($adh->typeid);
if ($res < 0) dol_print_error($db);
$html = new Form($db); $html = new Form($db);

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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); $form=new Form($db);
/* ************************************************************************** */
/* */ // Liste of members type
/* Liste des types d'adh<64>rents */
/* */
/* ************************************************************************** */
if (! $rowid && $_GET["action"] != 'create' && $_GET["action"] != 'edit') if (! $rowid && $_GET["action"] != 'create' && $_GET["action"] != 'edit')
{ {
@ -217,7 +214,7 @@ if ($_GET["action"] == 'create')
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40"></td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40"></td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>'; print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $htmls->selectyesno("cotisation",1,1); print $htmls->selectyesno("cotisation",1,1);
@ -245,11 +242,13 @@ if ($_GET["action"] == 'create')
} }
print '</td></tr>'; print '</td></tr>';
print '<tr><td colspan="2" align="center"><input type="submit" name="button" class="button" value="'.$langs->trans("Add").'"> &nbsp;'; print "</table>\n";
print '<input type="submit" name="button" class="button" value="'.$langs->trans("Cancel").'"></td></tr>';
print '<br>';
print '<center><input type="submit" name="button" class="button" value="'.$langs->trans("Add").'"> &nbsp; &nbsp; ';
print '<input type="submit" name="button" class="button" value="'.$langs->trans("Cancel").'"></center>';
print "</form>\n"; print "</form>\n";
print "</table>\n";
} }
/* ************************************************************************** */ /* ************************************************************************** */