Fix: Gere erreur creation type adherent
This commit is contained in:
parent
d76e0c6dfd
commit
55348c7381
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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
|
* 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
|
||||||
@ -18,7 +18,6 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
* $Source$
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,6 +36,10 @@
|
|||||||
|
|
||||||
class AdherentType
|
class AdherentType
|
||||||
{
|
{
|
||||||
|
var $error;
|
||||||
|
var $errors=array();
|
||||||
|
var $db;
|
||||||
|
|
||||||
var $id;
|
var $id;
|
||||||
var $libelle;
|
var $libelle;
|
||||||
var $statut;
|
var $statut;
|
||||||
@ -45,8 +48,6 @@ class AdherentType
|
|||||||
var $commentaire; /**< commentaire */
|
var $commentaire; /**< commentaire */
|
||||||
var $mail_valid; /**< mail envoye lors de la validation */
|
var $mail_valid; /**< mail envoye lors de la validation */
|
||||||
|
|
||||||
var $error;
|
|
||||||
var $db;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -83,8 +84,8 @@ class AdherentType
|
|||||||
{
|
{
|
||||||
$this->statut=trim($this->statut);
|
$this->statut=trim($this->statut);
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (statut)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (libelle)";
|
||||||
$sql.= " VALUES ($this->statut)";
|
$sql.= " VALUES ('".addslashes($this->libelle)."')";
|
||||||
|
|
||||||
dolibarr_syslog("Adherent_type::create sql=".$sql);
|
dolibarr_syslog("Adherent_type::create sql=".$sql);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -95,6 +96,7 @@ class AdherentType
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->error=$this->db->error().' sql='.$sql;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,13 +110,14 @@ class AdherentType
|
|||||||
{
|
{
|
||||||
$this->libelle=trim($this->libelle);
|
$this->libelle=trim($this->libelle);
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type SET ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type ";
|
||||||
$sql .= "libelle = '".$this->libelle ."'";
|
$sql.= "SET ";
|
||||||
$sql .= ",statut=".$this->statut;
|
$sql.= "statut=".$this->statut.",";
|
||||||
$sql .= ",cotisation='".$this->cotisation."'";
|
$sql.= "libelle = '".addslashes($this->libelle) ."',";
|
||||||
$sql .= ",note='".$this->commentaire."'";
|
$sql.= "cotisation='".$this->cotisation."',";
|
||||||
$sql .= ",vote='".$this->vote."'";
|
$sql.= "note='".addslashes($this->commentaire)."',";
|
||||||
$sql .= ",mail_valid='".$this->mail_valid."'";
|
$sql.= "vote='".$this->vote."',";
|
||||||
|
$sql.= "mail_valid='".addslashes($this->mail_valid)."'";
|
||||||
|
|
||||||
$sql .= " WHERE rowid = $this->id";
|
$sql .= " WHERE rowid = $this->id";
|
||||||
|
|
||||||
@ -126,7 +129,7 @@ class AdherentType
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error=$this->db->error();
|
$this->error=$this->db->error().' sql='.$sql;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,6 +63,11 @@ if ($_POST["action"] == 'add')
|
|||||||
Header("Location: type.php");
|
Header("Location: type.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg=$adht->error;
|
||||||
|
$_GET["action"] = 'create';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -205,11 +210,11 @@ if ($_GET["action"] == 'create')
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||||
print $htmls->selectyesnonum("cotisation",1);
|
print $htmls->selectyesnonum("cotisation",1);
|
||||||
print '</tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||||
print $htmls->selectyesnonum("vote",0);
|
print $htmls->selectyesnonum("vote",0);
|
||||||
print '</tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("Comments").'</td><td>';
|
print '<tr><td valign="top">'.$langs->trans("Comments").'</td><td>';
|
||||||
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"60\" rows=\"3\"></textarea></td></tr>";
|
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 '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||||
print $htmls->selectyesnonum("cotisation",$adht->cotisation);
|
print $htmls->selectyesnonum("cotisation",$adht->cotisation);
|
||||||
print '</tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||||
print $htmls->selectyesnonum("vote",$adht->vote);
|
print $htmls->selectyesnonum("vote",$adht->vote);
|
||||||
print '</tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("Comments").'</td><td>';
|
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>";
|
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"90\" rows=\"3\">".$adht->commentaire."</textarea></td></tr>";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user