Fix: Bug sur sauvegarde/affichage droit de vote et cotisation
This commit is contained in:
parent
a11322eb05
commit
a13a4a4299
@ -1,5 +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>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -20,14 +21,16 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \file htdocs/adherents/adherent_type.class.php
|
/**
|
||||||
|
\file htdocs/adherents/adherent_type.class.php
|
||||||
\ingroup adherent
|
\ingroup adherent
|
||||||
\brief Fichier de la classe gérant les types d'adhérents
|
\brief Fichier de la classe gérant les types d'adhérents
|
||||||
\author Rodolphe Quiedeville
|
\author Rodolphe Quiedeville
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \class AdherentType
|
/**
|
||||||
|
\class AdherentType
|
||||||
\brief Classe gérant les types d'adhérents
|
\brief Classe gérant les types d'adhérents
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -43,6 +46,7 @@ class AdherentType
|
|||||||
var $commentaire; /**< commentaire */
|
var $commentaire; /**< commentaire */
|
||||||
var $vote; /** droit de vote ? */
|
var $vote; /** droit de vote ? */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief AdherentType
|
\brief AdherentType
|
||||||
\param DB handler accès base de données
|
\param DB handler accès base de données
|
||||||
@ -54,6 +58,7 @@ class AdherentType
|
|||||||
$this->statut = 1;
|
$this->statut = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief print_error_list
|
\brief print_error_list
|
||||||
*/
|
*/
|
||||||
@ -67,16 +72,16 @@ class AdherentType
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief fonction qui permet de créer le status de l'adhérent
|
\brief Fonction qui permet de créer le status de l'adhérent
|
||||||
\param userid userid de l'adhérent
|
\param userid userid de l'adhérent
|
||||||
|
\return > 0 si ok, < 0 si ko
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function create($userid)
|
function create($userid)
|
||||||
{
|
{
|
||||||
/*
|
$this->statut=trim($this->statut);
|
||||||
* Insertion dans la base
|
|
||||||
*/
|
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (statut)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (statut)";
|
||||||
$sql .= " VALUES ($this->statut)";
|
$sql .= " VALUES ($this->statut)";
|
||||||
@ -90,12 +95,18 @@ class AdherentType
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Met a jour en base données du type
|
||||||
|
\return > 0 si ok, < 0 si ko
|
||||||
|
*/
|
||||||
function update()
|
function update()
|
||||||
{
|
{
|
||||||
|
$this->libelle=trim($this->libelle);
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type SET ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type SET ";
|
||||||
$sql .= "libelle = '".$this->libelle ."'";
|
$sql .= "libelle = '".$this->libelle ."'";
|
||||||
@ -115,14 +126,13 @@ class AdherentType
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $this->db->error();
|
$error=$this->db->error();
|
||||||
print "<h2><br>$sql<br></h2>";
|
return -1;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief fonction qui permet de supprimer le status de l'adhérent
|
\brief Fonction qui permet de supprimer le status de l'adhérent
|
||||||
\param rowid
|
\param rowid
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -156,7 +166,7 @@ class AdherentType
|
|||||||
|
|
||||||
function fetch($rowid)
|
function fetch($rowid)
|
||||||
{
|
{
|
||||||
$sql = "SELECT *";
|
$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";
|
||||||
|
|
||||||
@ -164,7 +174,6 @@ class AdherentType
|
|||||||
{
|
{
|
||||||
if ($this->db->num_rows())
|
if ($this->db->num_rows())
|
||||||
{
|
{
|
||||||
|
|
||||||
$obj = $this->db->fetch_object();
|
$obj = $this->db->fetch_object();
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
|
|||||||
@ -41,15 +41,21 @@ if ($_POST["action"] == 'add' && $user->admin)
|
|||||||
if ($_POST["button"] != $langs->trans("Cancel")) {
|
if ($_POST["button"] != $langs->trans("Cancel")) {
|
||||||
$adht = new AdherentType($db);
|
$adht = new AdherentType($db);
|
||||||
|
|
||||||
$adht->libelle = $_POST["libelle"];
|
$adht->libelle = trim($_POST["libelle"]);
|
||||||
$adht->cotisation = $yesno[$_POST["cotisation"]];
|
$adht->cotisation = $yesno[$_POST["cotisation"]];
|
||||||
$adht->commentaire = $_POST["comment"];
|
$adht->commentaire = trim($_POST["comment"]);
|
||||||
$adht->mail_valid = $_POST["mail_valid"];
|
$adht->mail_valid = trim($_POST["mail_valid"]);
|
||||||
$adht->vote = $yesno[$_POST["vote"]];
|
$adht->vote = $yesno[$_POST["vote"]];
|
||||||
|
|
||||||
if ($_POST["libelle"]) { $adht->create($user->id); }
|
if ($adht->libelle)
|
||||||
}
|
{
|
||||||
|
$id=$adht->create($user->id);
|
||||||
|
if ($id > 0)
|
||||||
|
{
|
||||||
Header("Location: type.php");
|
Header("Location: type.php");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["action"] == 'update' && $user->admin)
|
if ($_POST["action"] == 'update' && $user->admin)
|
||||||
@ -170,11 +176,11 @@ if ($_GET["action"] == 'create') {
|
|||||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40"></td></tr>';
|
print '<tr><td>'.$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>';
|
||||||
$htmls->selectyesno("cotisation","");
|
$htmls->selectyesnonum("cotisation","");
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||||
$htmls->selectyesno("vote","");
|
$htmls->selectyesnonum("vote","");
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("Comments").'</td><td>';
|
print '<tr><td valign="top">'.$langs->trans("Comments").'</td><td>';
|
||||||
@ -215,11 +221,11 @@ if ($_GET["rowid"] > 0 && $_GET["action"] == 'edit')
|
|||||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40" value="'.$adht->libelle.'"></td></tr>';
|
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40" value="'.$adht->libelle.'"></td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||||
$htmls->selectyesno("cotisation",$adht->cotisation);
|
$htmls->selectyesnonum("cotisation",$adht->cotisation);
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||||
$htmls->selectyesno("vote",$adht->vote);
|
$htmls->selectyesnonum("vote",$adht->vote);
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("Comments").'</td><td>';
|
print '<tr><td valign="top">'.$langs->trans("Comments").'</td><td>';
|
||||||
|
|||||||
@ -858,16 +858,16 @@ class Form
|
|||||||
|
|
||||||
print '<select class="flat" name="'.$name.'">'."\n";
|
print '<select class="flat" name="'.$name.'">'."\n";
|
||||||
|
|
||||||
if ($value == 'no' || $value == 0)
|
if ($value == 'yes' || $value == 1)
|
||||||
{
|
|
||||||
print '<option value="'.$yes.'">'.$langs->trans("yes").'</option>'."\n";
|
|
||||||
print '<option value="'.$no.'" selected>'.$langs->trans("no").'</option>'."\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
print '<option value="'.$yes.'" selected>'.$langs->trans("yes").'</option>'."\n";
|
print '<option value="'.$yes.'" selected>'.$langs->trans("yes").'</option>'."\n";
|
||||||
print '<option value="'.$no.'">'.$langs->trans("no").'</option>'."\n";
|
print '<option value="'.$no.'">'.$langs->trans("no").'</option>'."\n";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<option value="'.$yes.'">'.$langs->trans("yes").'</option>'."\n";
|
||||||
|
print '<option value="'.$no.'" selected>'.$langs->trans("no").'</option>'."\n";
|
||||||
|
}
|
||||||
print '</select>'."\n";
|
print '</select>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user