Fix: Gere erreur creation type adherent

This commit is contained in:
Laurent Destailleur 2007-05-02 09:42:20 +00:00
parent d76e0c6dfd
commit 55348c7381
2 changed files with 26 additions and 18 deletions

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -18,7 +18,6 @@
*
* $Id$
* $Source$
*
*/
/**
@ -37,6 +36,10 @@
class AdherentType
{
var $error;
var $errors=array();
var $db;
var $id;
var $libelle;
var $statut;
@ -45,8 +48,6 @@ class AdherentType
var $commentaire; /**< commentaire */
var $mail_valid; /**< mail envoye lors de la validation */
var $error;
var $db;
/**
@ -83,8 +84,8 @@ class AdherentType
{
$this->statut=trim($this->statut);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (statut)";
$sql.= " VALUES ($this->statut)";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (libelle)";
$sql.= " VALUES ('".addslashes($this->libelle)."')";
dolibarr_syslog("Adherent_type::create sql=".$sql);
$result = $this->db->query($sql);
@ -95,6 +96,7 @@ class AdherentType
}
else
{
$this->error=$this->db->error().' sql='.$sql;
return -1;
}
}
@ -108,13 +110,14 @@ class AdherentType
{
$this->libelle=trim($this->libelle);
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type SET ";
$sql .= "libelle = '".$this->libelle ."'";
$sql .= ",statut=".$this->statut;
$sql .= ",cotisation='".$this->cotisation."'";
$sql .= ",note='".$this->commentaire."'";
$sql .= ",vote='".$this->vote."'";
$sql .= ",mail_valid='".$this->mail_valid."'";
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type ";
$sql.= "SET ";
$sql.= "statut=".$this->statut.",";
$sql.= "libelle = '".addslashes($this->libelle) ."',";
$sql.= "cotisation='".$this->cotisation."',";
$sql.= "note='".addslashes($this->commentaire)."',";
$sql.= "vote='".$this->vote."',";
$sql.= "mail_valid='".addslashes($this->mail_valid)."'";
$sql .= " WHERE rowid = $this->id";
@ -126,7 +129,7 @@ class AdherentType
}
else
{
$error=$this->db->error();
$this->error=$this->db->error().' sql='.$sql;
return -1;
}
}

View File

@ -63,6 +63,11 @@ if ($_POST["action"] == 'add')
Header("Location: type.php");
exit;
}
else
{
$mesg=$adht->error;
$_GET["action"] = 'create';
}
}
else
{
@ -205,11 +210,11 @@ if ($_GET["action"] == 'create')
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $htmls->selectyesnonum("cotisation",1);
print '</tr>';
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print $htmls->selectyesnonum("vote",0);
print '</tr>';
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Comments").'</td><td>';
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"60\" rows=\"3\"></textarea></td></tr>";
@ -336,11 +341,11 @@ if ($rowid > 0)
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $htmls->selectyesnonum("cotisation",$adht->cotisation);
print '</tr>';
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print $htmls->selectyesnonum("vote",$adht->vote);
print '</tr>';
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Comments").'</td><td>';
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"90\" rows=\"3\">".$adht->commentaire."</textarea></td></tr>";