This commit is contained in:
Rodolphe Quiedeville 2002-12-30 15:13:28 +00:00
parent ffae801b1c
commit 384b5ee54f
18 changed files with 1576 additions and 337 deletions

View File

@ -18,19 +18,19 @@
</p>
</sect>
<sect id="adh-statut">
Un adherent peut avoir plusieurs statuts differents ils sont.
<sect id="adh-statut">Statut
<p>
Un adherent peut avoir plusieurs statuts differents ils sont.
</p>
</sect>
<sect id="adh-classe">
<sect id="adh-classe">Classes PHP
<p>
Classes PHP utilisées pour ce module :
<list>
<item>adherent.class.php</item>
</list>
</p>
</sect>

View File

@ -1,12 +1,31 @@
<chapt id="dons">Dons
<sect id="don-suffix">Suffixe de commande
Le suffixe de commande des dons est la valeur 10.
<sect id="don-conf">Configuration
<p>
$this->enabled = 0;
/* Paiement en ligne */
$this->onlinepayment = 0;
/* Don minimum, 0 pas de limite */
$this->minimum = 0;
/* Email des moderateurs */
$this->email_moderator = "root@localhost";
</p>
</sect>
<sect id="don-suffix">Suffixe de commande
<p>
Le suffixe de commande des dons est la valeur 10.
</p>
</sect>
</chapt>
<!--

337
htdocs/adherent.class.php Normal file
View File

@ -0,0 +1,337 @@
<?PHP
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*/
class Adherent
{
var $id;
var $db;
var $prenom;
var $nom;
var $societe;
var $adresse;
var $cp;
var $ville;
var $pays;
var $typeid;
var $email;
var $public;
var $commentaire;
var $statut;
var $errorstr;
/*
*
*
*/
Function Adherent($DB, $soc_idp="")
{
$this->db = $DB ;
$this->statut = 0;
}
/*
*
*
*
*/
Function print_error_list()
{
$num = sizeof($this->errorstr);
for ($i = 0 ; $i < $num ; $i++)
{
print "<li>" . $this->errorstr[$i];
}
}
/*
*
*
*/
Function check($minimum=0)
{
$err = 0;
if (strlen(trim($this->societe)) == 0)
{
if ((strlen(trim($this->nom)) + strlen(trim($this->prenom))) == 0)
{
$error_string[$err] = "Vous devez saisir vos nom et prénom ou le nom de votre société.";
$err++;
}
}
if (strlen(trim($this->adresse)) == 0)
{
$error_string[$err] = "L'adresse saisie est invalide";
$err++;
}
if (strlen(trim($this->cp)) == 0)
{
$error_string[$err] = "Le code postal saisi est invalide";
$err++;
}
if (strlen(trim($this->ville)) == 0)
{
$error_string[$err] = "La ville saisie est invalide";
$err++;
}
if (strlen(trim($this->email)) == 0)
{
$error_string[$err] = "L'email saisi est invalide";
$err++;
}
$this->amount = trim($this->amount);
$map = range(0,9);
for ($i = 0; $i < strlen($this->amount) ; $i++)
{
if (!isset($map[substr($this->amount, $i, 1)] ))
{
$error_string[$err] = "Le montant du don contient un/des caractère(s) invalide(s)";
$err++;
$amount_invalid = 1;
break;
}
}
if (! $amount_invalid)
{
if ($this->amount == 0)
{
$error_string[$err] = "Le montant du don est null";
$err++;
}
else
{
if ($this->amount < $minimum && $minimum > 0)
{
$error_string[$err] = "Le montant minimum du don est de $minimum";
$err++;
}
}
}
/*
* Return errors
*
*/
if ($err)
{
$this->errorstr = $error_string;
return 0;
}
else
{
return 1;
}
}
/*
* Création
*
*
*/
Function create($userid)
{
/*
* Insertion dans la base
*/
$this->date = $this->db->idate($this->date);
$sql = "INSERT INTO llx_adherent (datec)";
$sql .= " VALUES (now())";
$result = $this->db->query($sql);
if ($result)
{
$this->id = $this->db->last_insert_id();
return $this->update();
}
else
{
print $this->db->error();
print "<h2><br>$sql<br></h2>";
return 0;
}
}
/*
* Mise à jour
*
*
*/
Function update()
{
$sql = "UPDATE llx_adherent SET ";
$sql .= "prenom = '".$this->prenom ."'";
$sql .= ",nom='".$this->nom."'";
$sql .= ",societe='".$this->societe."'";
$sql .= ",adresse='".$this->adresse."'";
$sql .= ",cp='".$this->cp."'";
$sql .= ",ville='".$this->ville."'";
$sql .= ",pays='".$this->pays."'";
$sql .= ",note='".$this->commentaire."'";
$sql .= ",email='".$this->email."'";
$sql .= ",statut=".$this->statut;
$sql .= ",fk_adherent_type=".$this->typeid;
$sql .= " WHERE rowid = $this->id";
$result = $this->db->query($sql);
if ($result)
{
return 1;
}
else
{
print $this->db->error();
print "<h2><br>$sql<br></h2>";
return 0;
}
}
/*
* Suppression du don
*
*/
Function delete($rowid)
{
$result = 0;
$sql = "DELETE FROM llx_adherent WHERE rowid = $rowid";
if ( $this->db->query( $sql) )
{
if ( $this->db->affected_rows() )
{
$sql = "DELETE FROM llx_cotisation WHERE fk_adherent = $rowid";
if ( $this->db->query( $sql) )
{
if ( $this->db->affected_rows() )
{
$result = 1;
}
}
}
}
else
{
print "Err : ".$this->db->error();
}
return $result;
}
/*
* Fetch
*
*
*/
Function fetch($rowid)
{
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.statut, d.adresse, d.cp, d.ville, d.pays, d.note, d.email, d.fk_adherent_type";
$sql .= ",".$this->db->pdate("d.datefin")." as datefin";
$sql .= " FROM llx_adherent as d";
$sql .= " WHERE d.rowid = $rowid";
if ( $this->db->query( $sql) )
{
if ($this->db->num_rows())
{
$obj = $this->db->fetch_object(0);
$this->id = $obj->rowid;
$this->typeid = $obj->fk_adherent_type;
$this->date = $obj->datedon;
$this->prenom = stripslashes($obj->prenom);
$this->nom = stripslashes($obj->nom);
$this->societe = stripslashes($obj->societe);
$this->statut = $obj->fk_statut;
$this->adresse = stripslashes($obj->adresse);
$this->cp = stripslashes($obj->cp);
$this->ville = stripslashes($obj->ville);
$this->email = stripslashes($obj->email);
$this->pays = stripslashes($obj->pays);
$this->datefin = $obj->datefin;
$this->commentaire = stripslashes($obj->note);
}
}
else
{
print $this->db->error();
}
}
/*
* Cotisation
*
*/
Function cotisation($date, $montant)
{
$sql = "INSERT INTO llx_cotisation (fk_adherent, dateadh, cotisation)";
$sql .= " VALUES ($this->id, ".$this->db->idate($date).", $montant)";
if ( $this->db->query( $sql) )
{
if ( $this->db->affected_rows() )
{
$datefin = mktime(12, 0 , 0,
strftime("%m",$date),
strftime("%d",$date),
strftime("%Y",$date)+1) - (24 * 3600);
$sql = "UPDATE llx_adherent SET datefin = ".$this->db->idate($datefin)." WHERE rowid =". $this->id;
if ( $this->db->query( $sql) )
{
return 1;
}
}
else
{
return 0;
}
}
else
{
print "Err : ".$this->db->error();
return 0;
}
}
}
?>

View File

@ -0,0 +1,207 @@
<?PHP
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*/
class AdherentType
{
var $id;
var $libelle;
var $statut;
var $cotisation; // Soumis à la cotisation
var $errorstr;
/*
*
*
*/
Function AdherentType($DB, $soc_idp="")
{
$this->db = $DB ;
$this->statut = 1;
}
/*
*
*
*
*/
Function print_error_list()
{
$num = sizeof($this->errorstr);
for ($i = 0 ; $i < $num ; $i++)
{
print "<li>" . $this->errorstr[$i];
}
}
/*
*
*
*/
/*
* Création
*
*
*/
Function create($userid)
{
/*
* Insertion dans la base
*/
$sql = "INSERT INTO llx_adherent_type (statut)";
$sql .= " VALUES ($this->statut)";
$result = $this->db->query($sql);
if ($result)
{
$this->id = $this->db->last_insert_id();
return $this->update();
}
else
{
print $this->db->error();
print "<h2><br>$sql<br></h2>";
return 0;
}
}
/*
* Mise à jour
*
*
*/
Function update()
{
$sql = "UPDATE llx_adherent_type SET ";
$sql .= "libelle = '".$this->libelle ."'";
$sql .= ",statut=".$this->statut;
$sql .= ",cotisation='".$this->cotisation."'";
$sql .= " WHERE rowid = $this->id";
$result = $this->db->query($sql);
if ($result)
{
return 1;
}
else
{
print $this->db->error();
print "<h2><br>$sql<br></h2>";
return 0;
}
}
/*
* Suppression
*
*/
Function delete($rowid)
{
$sql = "DELETE FROM llx_adherent_type WHERE rowid = $rowid";
if ( $this->db->query( $sql) )
{
if ( $this->db->affected_rows() )
{
return 1;
}
else
{
return 0;
}
}
else
{
print "Err : ".$this->db->error();
return 0;
}
}
/*
* Fetch
*
*
*/
Function fetch($rowid)
{
$sql = "SELECT d.rowid, d.libelle, d.statut, d.cotisation";
$sql .= " FROM llx_adherent_type as d";
$sql .= " WHERE d.rowid = $rowid";
if ( $this->db->query( $sql) )
{
if ($this->db->num_rows())
{
$obj = $this->db->fetch_object(0);
$this->id = $obj->rowid;
$this->libelle = $obj->libelle;
$this->statut = $obj->statut;
$this->cotisation = $obj->cotisation;
}
}
else
{
print $this->db->error();
}
}
/*
*
*
*
*/
Function liste_array()
{
$projets = array();
$sql = "SELECT rowid, libelle FROM llx_adherent_type";
if ($this->db->query($sql) )
{
$nump = $this->db->num_rows();
if ($nump)
{
$i = 0;
while ($i < $nump)
{
$obj = $this->db->fetch_object($i);
$projets[$obj->rowid] = $obj->libelle;
$i++;
}
}
return $projets;
}
else
{
print $this->db->error();
}
}
}
?>

View File

@ -0,0 +1,102 @@
<?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*/
require("./pre.inc.php");
llxHeader();
$db = new Db();
if ($action == 'add') {
$datepaye = $db->idate(mktime(12, 0 , 0, $pmonth, $pday, $pyear));
$paiement = new Paiement($db);
$paiement->facid = $facid;
$paiement->datepaye = $datepaye;
$paiement->amount = $amount;
$paiement->author = $author;
$paiement->paiementid = $paiementid;
$paiement->num_paiement = $num_paiement;
$paiement->note = $note;
$paiement->create();
$action = '';
}
if ($sortorder == "") { $sortorder="DESC"; }
if ($sortfield == "") { $sortfield="c.dateadh"; }
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, c.cotisation, ".$db->pdate("c.dateadh")." as dateadh";
$sql .= " FROM llx_adherent as d, llx_cotisation as c";
$sql .= " WHERE d.rowid = c.fk_adherent";
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows();
$i = 0;
print_barre_liste("Liste des cotisations", $page, $PHP_SELF, "&statut=$statut");
print "<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"4\">";
print '<TR class="liste_titre">';
print "<td>Date</td>";
print "<td align=\"right\">Montant</TD>";
print "<td>Prenom Nom / Société</td>";
print "</TR>\n";
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object( $i);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".strftime("%d %B %Y",$objp->dateadh)."</a></td>\n";
print '<TD align="right">'.price($objp->cotisation).'</TD>';
print "<TD><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".stripslashes($objp->prenom)." ".stripslashes($objp->nom)." / ".stripslashes($objp->societe)."</a></TD>\n";
print "</tr>";
$i++;
}
print "</table>";
}
else
{
print $sql;
print $db->error();
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -20,47 +20,46 @@
*
*/
require("./pre.inc.php");
require("../../don.class.php");
require("../../paiement.class.php");
require("../adherent.class.php");
require("../adherent_type.class.php");
$db = new Db();
/*
* Enregistrer les modifs
*/
if ($action == 'update')
if ($action == 'update')
{
if ($amount > 0)
if ($HTTP_POST_VARS["bouton"] == "Enregistrer")
{
$don = new Don($db);
$adh = new Adherent($db);
$don->id = $HTTP_POST_VARS["rowid"];
$don->prenom = $prenom;
$don->nom = $nom;
$don->statut = $HTTP_POST_VARS["statutid"];
$don->societe = $societe;
$don->adresse = $adresse;
$don->amount = $amount;
$don->cp = $cp;
$don->ville = $ville;
$don->email = $email;
$don->date = mktime(12, 0 , 0, $remonth, $reday, $reyear);
$don->note = $note;
$don->pays = $pays;
$don->public = $public;
$don->projetid = $projetid;
$don->commentaire = $HTTP_POST_VARS["comment"];
$don->modepaiementid = $modepaiement;
$adh->id = $HTTP_POST_VARS["rowid"];
$adh->prenom = $prenom;
$adh->nom = $nom;
$adh->societe = $societe;
$adh->adresse = $adresse;
$adh->amount = $amount;
$adh->cp = $cp;
$adh->ville = $HTTP_POST_VARS["ville"];
$adh->email = $HTTP_POST_VARS["email"];
$adh->date = mktime(12, 0 , 0, $remonth, $reday, $reyear);
$adh->note = $HTTP_POST_VARS["note"];
$adh->pays = $HTTP_POST_VARS["pays"];
$adh->typeid = $HTTP_POST_VARS["type"];
$adh->commentaire = $HTTP_POST_VARS["comment"];
if ($don->update($user->id) )
if ($adh->update($user->id) )
{
Header("Location: fiche.php?rowid=$don->id&action=edit");
Header("Location: fiche.php?rowid=$adh->id&action=edit");
}
}
else
else
{
print "Erreur";
$action = "create";
Header("Location: fiche.php?rowid=$rowid&action=edit");
}
}
@ -71,9 +70,9 @@ llxHeader();
if ($rowid)
{
$don = new Don($db);
$don->id = $rowid;
$don->fetch($rowid);
$adh = new Adherent($db);
$adh->id = $rowid;
$adh->fetch($rowid);
$sql = "SELECT s.nom,s.idp, f.amount, f.total, f.facnumber";
$sql .= " FROM societe as s, llx_facture as f WHERE f.fk_soc = s.idp";
@ -88,79 +87,66 @@ if ($rowid)
$total = $obj->total;
}
}
print_titre("Saisir un don");
print_titre("Edition de la fiche adhérent");
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
print '<tr><td width="15%">Prénom</td><td class="valeur" width="35%">'.$adh->prenom.'&nbsp;</td>';
print '<td valign="top" width="50%">Commentaires</td></tr>';
print '<tr><td>Nom</td><td class="valeur">'.$adh->nom.'&nbsp;</td>';
print '<td rowspan="10" valign="top" width="50%">';
print nl2br($adh->commentaire).'&nbsp;</td></tr>';
print '<tr><td>Société</td><td class="valeur">'.$adh->societe.'&nbsp;</td></tr>';
print '<tr><td>Adresse</td><td class="valeur">'.nl2br($adh->adresse).'&nbsp;</td></tr>';
print '<tr><td>CP Ville</td><td class="valeur">'.$adh->cp.' '.$adh->ville.'&nbsp;</td></tr>';
print '<tr><td>Pays</td><td class="valeur">'.$adh->pays.'&nbsp;</td></tr>';
print '<tr><td>Email</td><td class="valeur">'.$adh->email.'&nbsp;</td></tr>';
print "</table>\n";
print "<hr>";
print "<form action=\"$PHP_SELF\" method=\"post\">";
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print "<input type=\"hidden\" name=\"rowid\" value=\"$rowid\">";
print "<tr><td>Date du don</td><td>";
print_date_select($don->date);
print "</td>";
print '<td rowspan="13" valign="top">Commentaires :<br>';
print '<textarea name="comment" wrap="soft" cols="40" rows="15">'.$don->commentaire.'</textarea></td></tr>';
print "<tr><td>Statut du don</td><td>";
$listst[0] = "Promesse à valider";
$listst[1] = "Promesse validée";
$listst[2] = "Don payé";
$listst[3] = "Don encaissé";
$sel = new Form($db);
$sel->select_array("statutid",$listst,$don->statut);
$htmls = new Form($db);
$adht = new AdherentType($db);
print "<tr><td>Type</td><td>";
$htmls->select_array("type", $adht->liste_array(), $adh->typeid);
print "</td></tr>";
print "<tr><td>Mode de paiement</td><td>\n";
$paiement = new Paiement($db);
$paiement->select("modepaiement","", $don->modepaiementid);
print "</td></tr>\n";
print "<tr><td>Projet</td><td>\n";
$prj = new ProjetDon($db);
$listeprj = $prj->liste_array();
$sel = new Form($db);
$sel->select_array("projetid",$listeprj,$don->projetid);
print '<tr><td width="15%">Prénom</td><td width="35%"><input type="text" name="prenom" size="40" value="'.$adh->prenom.'"></td>';
print '<td valign="top" width="50%">Commentaires</td></tr>';
print "<br>";
print "</td></tr>\n";
print '<tr><td>Nom</td><td><input type="text" name="nom" size="40" value="'.$adh->nom.'"></td>';
print "<tr><td>Don public</td><td><select name=\"public\">\n";
if ($don->public)
{
print '<option value="1" SELECTED>oui</option>';
print '<option value="0">non</option>';
}
else
{
print '<option value="1">oui</option>';
print '<option value="0" SELECTED>non</option>';
}
print "</select><br>";
print "</td></tr>\n";
print '<td rowspan="13" valign="top">';
print '<textarea name="comment" wrap="soft" cols="40" rows="15">'.$adh->commentaire.'</textarea></td></tr>';
print '<tr><td>Prénom</td><td><input type="text" name="prenom" size="40" value="'.$don->prenom.'"></td></tr>';
print '<tr><td>Nom</td><td><input type="text" name="nom" size="40" value="'.$don->nom.'"></td></tr>';
print '<tr><td>Societe</td><td><input type="text" name="societe" size="40" value="'.$don->societe.'"></td></tr>';
print '<tr><td>Societe</td><td><input type="text" name="societe" size="40" value="'.$adh->societe.'"></td></tr>';
print '<tr><td>Adresse</td><td>';
print '<textarea name="adresse" wrap="soft" cols="40" rows="3">'.$don->adresse.'</textarea></td></tr>';
print '<tr><td>CP Ville</td><td><input type="text" name="cp" size="8" value="'.$don->cp.'"> <input type="text" name="ville" size="40" value="'.$don->ville.'"></td></tr>';
print '<tr><td>Pays</td><td><input type="text" name="pays" size="40" value="'.$don->pays.'"></td></tr>';
print '<tr><td>Email</td><td><input type="text" name="email" size="40" value="'.$don->email.'"></td></tr>';
print '<tr><td>Montant</td><td><input type="text" name="amount" size="10" value="'.$don->amount.'"> euros</td></tr>';
print '<tr><td colspan="2" align="center"><input type="submit" value="Enregistrer"></td></tr>';
print "</form>\n";
print "</table>\n";
print '<textarea name="adresse" wrap="soft" cols="40" rows="3">'.$adh->adresse.'</textarea></td></tr>';
print '<tr><td>CP Ville</td><td><input type="text" name="cp" size="6" value="'.$adh->cp.'"> <input type="text" name="ville" size="20" value="'.$adh->ville.'"></td></tr>';
print '<tr><td>Pays</td><td><input type="text" name="pays" size="40" value="'.$adh->pays.'"></td></tr>';
print '<tr><td>Email</td><td><input type="text" name="email" size="40" value="'.$adh->email.'"></td></tr>';
print '<tr><td colspan="2" align="center">';
print '<input type="submit" name="bouton" value="Enregistrer">&nbsp;';
print '<input type="submit" value="Annuler">';
print '</td></tr>';
print '</form>';
print '</table>';
}

View File

@ -20,91 +20,66 @@
*
*/
require("./pre.inc.php");
require("../../don.class.php");
require("../../paiement.class.php");
require("../adherent.class.php");
require("../adherent_type.class.php");
require("../cotisation.class.php");
require("../paiement.class.php");
$db = new Db();
if ($action == 'add')
if ($HTTP_POST_VARS["action"] == 'cotisation')
{
$adh = new Adherent($db);
$adh->id = $rowid;
if ($amount > 0)
{
$don = new Don($db);
$don->prenom = $prenom;
$don->nom = $nom;
$don->societe = $societe;
$don->adresse = $adresse;
$don->amount = $amount;
$don->cp = $cp;
$don->ville = $ville;
$don->email = $email;
$don->date = mktime(12, 0 , 0, $remonth, $reday, $reyear);
$don->note = $note;
$don->pays = $pays;
$don->public = $public;
$don->projetid = $projetid;
$don->commentaire = $HTTP_POST_VARS["comment"];
$don->modepaiementid = $modepaiement;
if ($don->create($user->id) )
{
Header("Location: index.php");
}
if ($cotisation > 0)
{
$adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation);
}
else
{
print "Erreur";
$action = "create";
}
}
if ($action == 'delete')
{
$don = new Don($db);
$don->delete($rowid);
Header("Location: liste.php?statut=0");
}
if ($action == 'commentaire')
{
$don = new Don($db);
$don->set_commentaire($rowid,$HTTP_POST_VARS["commentaire"]);
$action = "edit";
}
if ($action == 'valid_promesse')
if ($HTTP_POST_VARS["action"] == 'add')
{
$don = new Don($db);
if ($don->valid_promesse($rowid, $user->id))
{
Header("Location: liste.php?statut=0");
}
}
if ($action == 'set_paye')
{
$don = new Don($db);
if ($don->set_paye($rowid, $modepaiement))
{
Header("Location: liste.php?statut=1");
}
}
if ($action == 'set_encaisse')
{
$don = new Don($db);
if ($don->set_encaisse($rowid))
{
Header("Location: liste.php?statut=2");
$adh = new Adherent($db);
$adh->prenom = $prenom;
$adh->nom = $nom;
$adh->societe = $societe;
$adh->adresse = $adresse;
$adh->cp = $cp;
$adh->ville = $ville;
$adh->email = $email;
$adh->note = $note;
$adh->pays = $pays;
$adh->typeid = $type;
$adh->commentaire = $HTTP_POST_VARS["comment"];
if ($adh->create($user->id) )
{
if ($cotisation > 0)
{
$adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation);
}
Header("Location: liste.php");
}
}
if ($HTTP_POST_VARS["action"] == 'confirm_delete' && $HTTP_POST_VARS["confirm"] == yes)
{
$adh = new Adherent($db);
$adh->delete($rowid);
Header("Location: liste.php");
}
llxHeader();
/* ************************************************************************** */
/* */
/* Création d'une fiche don */
/* Création d'une fiche */
/* */
/* ************************************************************************** */
@ -124,18 +99,37 @@ if ($action == 'create') {
$total = $obj->total;
}
}
print_titre("Saisir un don");
print_titre("Nouvel adhérent");
print "<form action=\"$PHP_SELF\" method=\"post\">";
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
print "<tr><td>Date du don</td><td>";
print_date_select();
print "</td>";
print '<input type="hidden" name="action" value="add">';
$htmls = new Form($db);
$adht = new AdherentType($db);
print "<tr><td>Type</td><td>";
$htmls->select_array("type", $adht->liste_array());
print "</td></tr>";
print '<tr><td>Prénom</td><td><input type="text" name="prenom" size="40"></td>';
print '<td rowspan="11" valign="top">Commentaires :<br>';
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"40\" rows=\"15\"></textarea></td></tr>";
print '<tr><td>Nom</td><td><input type="text" name="nom" size="40"></td></tr>';
print '<tr><td>Societe</td><td><input type="text" name="societe" size="40"></td></tr>';
print '<tr><td>Adresse</td><td>';
print '<textarea name="adresse" wrap="soft" cols="40" rows="3"></textarea></td></tr>';
print '<tr><td>CP Ville</td><td><input type="text" name="cp" size="8"> <input type="text" name="ville" size="40"></td></tr>';
print '<tr><td>Pays</td><td><input type="text" name="pays" size="40"></td></tr>';
print '<tr><td>Email</td><td><input type="text" name="email" size="40"></td></tr>';
print "<tr><td>Date de cotisation</td><td>";
print_date_select();
print "</td></tr>";
print "<tr><td>Mode de paiement</td><td>\n";
$paiement = new Paiement($db);
@ -144,45 +138,8 @@ if ($action == 'create') {
print "</td></tr>\n";
print "<tr><td>Projet</td><td><select name=\"projetid\">\n";
$sql = "SELECT rowid, libelle FROM llx_don_projet ORDER BY rowid";
if ($db->query($sql))
{
$num = $db->num_rows();
$i = 0;
while ($i < $num)
{
$objopt = $db->fetch_object( $i);
print "<option value=\"$objopt->rowid\">$objopt->libelle</option>\n";
$i++;
}
}
else
{
print $db->error();
}
print "</select><br>";
print "</td></tr>\n";
print '<tr><td>Cotisation</td><td><input type="text" name="cotisation" size="6"> euros</td></tr>';
print "<tr><td>Don public</td><td><select name=\"public\">\n";
print '<option value="1">oui</option>';
print '<option value="0">non</option>';
print "</select><br>";
print "</td></tr>\n";
print '<tr><td>Prénom</td><td><input type="text" name="prenom" size="40"></td></tr>';
print '<tr><td>Nom</td><td><input type="text" name="nom" size="40"></td></tr>';
print '<tr><td>Societe</td><td><input type="text" name="societe" size="40"></td></tr>';
print '<tr><td>Adresse</td><td>';
print '<textarea name="adresse" wrap="soft" cols="40" rows="3"></textarea></td></tr>';
print '<tr><td>CP Ville</td><td><input type="text" name="cp" size="8"> <input type="text" name="ville" size="40"></td></tr>';
print '<tr><td>Pays</td><td><input type="text" name="pays" size="40"></td></tr>';
print '<tr><td>Email</td><td><input type="text" name="email" size="40"></td></tr>';
print '<tr><td>Montant</td><td><input type="text" name="amount" size="10"> euros</td></tr>';
print '<tr><td colspan="2" align="center"><input type="submit" value="Enregistrer"></td></tr>';
print "</form>\n";
print "</table>\n";
@ -191,136 +148,185 @@ if ($action == 'create') {
}
/* ************************************************************************** */
/* */
/* Edition de la fiche don */
/* Edition de la fiche */
/* */
/* ************************************************************************** */
if ($rowid > 0 && $action == 'edit')
if ($rowid > 0)
{
$don = new Don($db);
$don->id = $rowid;
$don->fetch($rowid);
$adh = new Adherent($db);
$adh->id = $rowid;
$adh->fetch($rowid);
print_titre("Traitement du don");
print_titre("Edition de la fiche adhérent");
print "<form action=\"$PHP_SELF\" method=\"post\">";
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
print '<tr><td width="15%">Prénom</td><td class="valeur" width="35%">'.$adh->prenom.'&nbsp;</td>';
print '<td valign="top" width="50%">Commentaires</tr>';
print '<tr><td>Nom</td><td class="valeur">'.$adh->nom.'&nbsp;</td>';
print "<tr><td>Date du don</td><td>";
print strftime("%d %B %Y",$don->date);
print "</td>";
print '<td rowspan="11" valign="top" width="50%">Commentaires :<br>';
print nl2br($don->commentaire).'</td></tr>';
print '<td rowspan="11" valign="top" width="50%">';
print nl2br($adh->commentaire).'&nbsp;</td></tr>';
if ($don->statut == 1)
{
print "<tr><td>Mode de paiement</td><td>";
$paiement = new Paiement($db);
$paiement->select("modepaiement","crédit", $don->modepaiementid);
print "</td></tr>\n";
}
if ($don->statut > 1)
{
print "<tr><td>Mode de paiement</td><td>";
print $don->modepaiement;
print "</td></tr>\n";
}
print '<tr><td>Projet</td><td>'.$don->projet.'</td></tr>';
print "<tr><td>Don public</td><td>";
print $yn[$don->public];
print "</td></tr>\n";
print '<tr><td>Prénom</td><td>'.$don->prenom.'&nbsp;</td></tr>';
print '<tr><td>Nom</td><td>'.$don->nom.'&nbsp;</td></tr>';
print '<tr><td>Société</td><td>'.$don->societe.'&nbsp;</td></tr>';
print '<tr><td>Adresse</td><td>'.nl2br($don->adresse).'&nbsp;</td></tr>';
print '<tr><td>CP Ville</td><td>'.$don->cp.' '.$don->ville.'&nbsp;</td></tr>';
print '<tr><td>Pays</td><td>'.$don->pays.'&nbsp;</td></tr>';
print '<tr><td>Email</td><td>'.$don->email.'&nbsp;</td></tr>';
print '<tr><td>Montant</td><td>'.price($don->amount).' euros</td></tr>';
print '<tr><td>Société</td><td class="valeur">'.$adh->societe.'&nbsp;</td></tr>';
print '<tr><td>Adresse</td><td class="valeur">'.nl2br($adh->adresse).'&nbsp;</td></tr>';
print '<tr><td>CP Ville</td><td class="valeur">'.$adh->cp.' '.$adh->ville.'&nbsp;</td></tr>';
print '<tr><td>Pays</td><td class="valeur">'.$adh->pays.'&nbsp;</td></tr>';
print '<tr><td>Email</td><td class="valeur">'.$adh->email.'&nbsp;</td></tr>';
print "</table>\n";
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr>";
/*
* Case 1
*/
print '<td align="center" width="25%">[<a href="edit.php?rowid='.$don->id.'">Editer</a>]</td>';
/*
* Case 2
*/
if ($user->admin)
{
if ($don->statut == 1 && $resteapayer > 0)
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr>";
/*
* Case 1
*/
print '<td align="center" width="25%">[<a href="edit.php?rowid='.$adh->id.'">Editer</a>]</td>';
/*
* Case 2
*/
if ($adh->statut == 1 && $resteapayer > 0)
{
print "<td align=\"center\" width=\"25%\">[<a href=\"paiement.php3?facid=$facid&action=create\">Emettre un paiement</a>]</td>";
}
else
{
print "<td align=\"center\" width=\"25%\">-</td>";
}
/*
* Case 3
*/
print "<td align=\"center\" width=\"25%\">-</td>";
/*
* Case 4
*/
if ($adh->statut == 0)
{
print "<td align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?rowid=$adh->id&action=delete\">Supprimer</a>]</td>";
}
elseif ($adh->statut == 2)
{
print "<td align=\"center\" width=\"25%\">[<a href=\"paiement.php3?facid=$facid&action=create\">Emettre un paiement</a>]</td>";
print "<td align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?rowid=$adh->id&action=set_encaisse\">Encaisser</a>]</td>";
}
elseif ($don->statut == 0)
else
{
print "<td align=\"center\" width=\"25%\">-</td>";
}
print "</tr></table></form><p>";
}
/*
*
*
*
*/
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, c.cotisation, ".$db->pdate("c.dateadh")." as dateadh";
$sql .= " FROM llx_adherent as d, llx_cotisation as c";
$sql .= " WHERE d.rowid = c.fk_adherent AND d.rowid=$rowid";
$result = $db->query($sql);
if ($result)
{
print "<td align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?rowid=$don->id&action=valid_promesse\">Valider la promesse</a>]</td>";
$num = $db->num_rows();
$i = 0;
print "<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"4\">";
print '<TR class="liste_titre">';
print "<td>Cotisations</td>";
print "<td>Date</td>";
print "<td align=\"right\">Montant</TD>";
print "</TR>\n";
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object( $i);
$var=!$var;
print "<TR $bc[$var]><td>&nbsp;</td>";
print "<TD>".strftime("%d %B %Y",$objp->dateadh)."</td>\n";
print '<TD align="right">'.price($objp->cotisation).'</TD>';
print "</tr>";
$i++;
}
print "</table>";
}
else
{
print "<td align=\"center\" width=\"25%\">-</td>";
print $sql;
print $db->error();
}
/*
* Case 3
*
*
*
*/
if ($don->statut == 1 && abs($resteapayer == 0) && $don->paye == 0)
{
print "<td align=\"center\" width=\"25%\">";
print '<input type="hidden" name="action" value="set_paye">';
print '<input type="hidden" name="rowid" value="'.$don->id.'">';
print '<input type="submit" value="Classer Payé">';
print "</td>";
}
else
{
print "<td align=\"center\" width=\"25%\">-</td>";
}
/*
* Case 4
*/
if ($don->statut == 0)
{
print "<td align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?rowid=$don->id&action=delete\">Supprimer</a>]</td>";
}
elseif ($don->statut == 2)
{
print "<td align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?rowid=$don->id&action=set_encaisse\">Encaisser</a>]</td>";
}
else
{
print "<td align=\"center\" width=\"25%\">-</td>";
}
print "</tr></table></form><p>";
/* ************************************************************************** */
/* */
/* Commentaire */
/* */
/* ************************************************************************** */
print "<form action=\"$PHP_SELF\" method=\"post\">";
print '<input type="hidden" name="action" value="commentaire">';
print '<input type="hidden" name="rowid" value="'.$don->id.'">';
print '<form method="post" action="'.$PHP_SELF.'?rowid='.$rowid.'&action=edit">';
print '<input type="hidden" name="action" value="cotisation">';
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
print '<tr><td align="center">Commentaires</td></tr>';
print '<tr><td><textarea cols="60" rows="20" name="commentaire">'.$don->commentaire.'</textarea></td></tr>';
print '<tr><td align="center"><input type="submit" value="Enregistrer"></td></tr>';
print '</table></form>';
print '<tr><td width="15%">Fin adhésion</td><td width="35%" class="valeur">'.strftime("%d %B %Y",$adh->datefin).'&nbsp;</td>';
print '<td valign="top" width="50%">&nbsp;</td></tr>';
print '<tr><td colspan="3">Nouvelle adhésion</td></tr>';
print "<tr><td>Date de cotisation</td><td>";
print_date_select($adh->datefin + (3600*24));
print "</td><td>&nbsp;</td></tr>";
print "<tr><td>Mode de paiement</td><td>\n";
$paiement = new Paiement($db);
$paiement->select("modepaiement","crédit");
print "</td><td>&nbsp;</td></tr>\n";
print '<tr><td>Cotisation</td><td colspan="2"><input type="text" name="cotisation" size="6"> euros</td></tr>';
print '<tr><td colspan="2" align="center"><input type="submit" value="Enregistrer"</td></tr>';
print '</table>';
print "</form>";
/*
* Confirmation de la suppression de l'adhérent
*
*/
if ($action == 'delete')
{
print '<form method="post" action="'.$PHP_SELF.'?rowid='.$rowid.'">';
print '<input type="hidden" name="action" value="confirm_delete">';
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
print '<tr><td colspan="3">Supprimer un adhérent</td></tr>';
print "<tr><td colspan=\"3\">La suppression d'un adhérent entraine la suppression de toutes ses cotisations !!!</td></tr>";
print '<tr><td class="delete">Etes-vous sur de vouloir supprimer cet adhérent ?</td><td class="delete">';
$htmls = new Form($db);
$htmls->selectyesno("confirm","no");
print "</td>";
print '<td class="delete" align="center"><input type="submit" value="Confirmer"</td></tr>';
print '</table>';
print "</form>";
}
}
$db->close();

View File

@ -25,6 +25,16 @@ llxHeader();
$db = new Db();
print_titre("Gestion des adherents");
print '<TABLE border="0" cellspacing="0" cellpadding="4">';
print '<TR class="liste_titre">';
print "<td>&nbsp;</td>";
print "<td>Somme</td>";
print "</TR>\n";
$var=True;
$sql = "SELECT sum(d.amount) as somme , d.fk_statut FROM llx_don as d GROUP BY d.fk_statut";
@ -44,15 +54,6 @@ if ($result)
$db->free();
}
print_barre_liste("Dons", $page, $PHP_SELF);
print '<TABLE border="0" cellspacing="0" cellpadding="4">';
print '<TR class="liste_titre">';
print "<td>&nbsp;</td>";
print "<td>Somme</td>";
print "</TR>\n";
$var=True;
for ($i = 0 ; $i < 4 ; $i++)
{
@ -68,6 +69,8 @@ print "</table>";
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");

View File

@ -0,0 +1,85 @@
<?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*/
require("./pre.inc.php");
llxHeader();
$db = new Db();
if ($sortorder == "") { $sortorder="DESC"; }
if ($sortfield == "") { $sortfield="d.nom"; }
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, ".$db->pdate("d.datefin")." as datefin";
$sql .= " , d.email, t.libelle as type";
$sql .= " FROM llx_adherent as d, llx_adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid";
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows();
$i = 0;
print_barre_liste("Liste des adhérents", $page, $PHP_SELF, "&statut=$statut");
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print '<TR class="liste_titre">';
print "<td>Prenom Nom / Société</td>";
print "<td>Date</td>";
print "<td>Email</td>";
print "<td>Type</td>";
print "</TR>\n";
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object( $i);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".stripslashes($objp->prenom)." ".stripslashes($objp->nom)." / ".stripslashes($objp->societe)."</a></TD>\n";
print "<TD><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".strftime("%d %B %Y",$objp->datefin)."</a></td>\n";
print "<TD>$objp->email</TD>\n";
print "<TD>$objp->type</TD>\n";
print "</tr>";
$i++;
}
print "</table>";
}
else
{
print $sql;
print $db->error();
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -44,7 +44,7 @@ if ($result)
$db->free();
}
print_barre_liste("Dons", $page, $PHP_SELF);
print_titre("Dons");
print '<TABLE border="0" cellspacing="0" cellpadding="4">';
print '<TR class="liste_titre">';

View File

@ -144,17 +144,17 @@ class DonConf {
Function DonConf() {
$this->enabled = 0;
/*
* Paiement en ligne
*/
/* Paiement en ligne */
$this->onlinepayment = 0;
/*
* Don minimum, 0 pas de limite
*/
/* Don minimum, 0 pas de limite */
$this->minimum = 0;
/* Email des moderateurs */
$this->email_moderator = "root@localhost";
}
}
/*

464
htdocs/cotisation.class.php Normal file
View File

@ -0,0 +1,464 @@
<?PHP
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*/
class Cotisation
{
var $id;
var $db;
var $date;
var $amount;
var $prenom;
var $nom;
var $societe;
var $adresse;
var $cp;
var $ville;
var $pays;
var $email;
var $public;
var $projetid;
var $modepaiement;
var $modepaiementid;
var $commentaire;
var $statut;
var $projet;
var $errorstr;
/*
*
*
*/
Function Cotisation($DB, $soc_idp="")
{
$this->db = $DB ;
$this->modepaiementid = 0;
}
/*
*
*
*
*/
Function print_error_list()
{
$num = sizeof($this->errorstr);
for ($i = 0 ; $i < $num ; $i++)
{
print "<li>" . $this->errorstr[$i];
}
}
/*
*
*
*/
Function check($minimum=0)
{
$err = 0;
if (strlen(trim($this->societe)) == 0)
{
if ((strlen(trim($this->nom)) + strlen(trim($this->prenom))) == 0)
{
$error_string[$err] = "Vous devez saisir vos nom et prénom ou le nom de votre société.";
$err++;
}
}
if (strlen(trim($this->adresse)) == 0)
{
$error_string[$err] = "L'adresse saisie est invalide";
$err++;
}
if (strlen(trim($this->cp)) == 0)
{
$error_string[$err] = "Le code postal saisi est invalide";
$err++;
}
if (strlen(trim($this->ville)) == 0)
{
$error_string[$err] = "La ville saisie est invalide";
$err++;
}
if (strlen(trim($this->email)) == 0)
{
$error_string[$err] = "L'email saisi est invalide";
$err++;
}
$this->amount = trim($this->amount);
$map = range(0,9);
for ($i = 0; $i < strlen($this->amount) ; $i++)
{
if (!isset($map[substr($this->amount, $i, 1)] ))
{
$error_string[$err] = "Le montant du don contient un/des caractère(s) invalide(s)";
$err++;
$amount_invalid = 1;
break;
}
}
if (! $amount_invalid)
{
if ($this->amount == 0)
{
$error_string[$err] = "Le montant du don est null";
$err++;
}
else
{
if ($this->amount < $minimum && $minimum > 0)
{
$error_string[$err] = "Le montant minimum du don est de $minimum";
$err++;
}
}
}
/*
* Return errors
*
*/
if ($err)
{
$this->errorstr = $error_string;
return 0;
}
else
{
return 1;
}
}
/*
* Création
*
*
*/
Function create($userid)
{
/*
* Insertion dans la base
*/
$this->date = $this->db->idate($this->date);
$sql = "INSERT INTO llx_don (datec, amount, fk_paiement,prenom, nom, societe,adresse, cp, ville, pays, public, fk_don_projet, note, fk_user_author, datedon, email)";
$sql .= " VALUES (now(), $this->amount, $this->modepaiementid,'$this->prenom','$this->nom','$this->societe','$this->adresse', '$this->cp','$this->ville','$this->pays',$this->public, $this->projetid, '$this->commentaire', $userid, '$this->date','$this->email')";
$result = $this->db->query($sql);
if ($result)
{
return $this->db->last_insert_id();
}
else
{
print $this->db->error();
print "<h2><br>$sql<br></h2>";
return 0;
}
}
/*
* Mise à jour
*
*
*/
Function update($userid)
{
$this->date = $this->db->idate($this->date);
$sql = "UPDATE llx_don SET ";
$sql .= "amount = " . $this->amount;
$sql .= ",fk_paiement = ".$this->modepaiementid;
$sql .= ",prenom = '".$this->prenom ."'";
$sql .= ",nom='".$this->nom."'";
$sql .= ",societe='".$this->societe."'";
$sql .= ",adresse='".$this->adresse."'";
$sql .= ",cp='".$this->cp."'";
$sql .= ",ville='".$this->ville."'";
$sql .= ",pays='".$this->pays."'";
$sql .= ",public=".$this->public;
$sql .= ",fk_don_projet=".$this->projetid;
$sql .= ",note='".$this->commentaire."'";
$sql .= ",datedon='".$this->date."'";
$sql .= ",email='".$this->email."'";
$sql .= ",fk_statut=".$this->statut;
$sql .= " WHERE rowid = $this->id";
$result = $this->db->query($sql);
if ($result)
{
return 1;
}
else
{
print $this->db->error();
print "<h2><br>$sql<br></h2>";
return 0;
}
}
/*
* Suppression du don
*
*/
Function delete($rowid)
{
$sql = "DELETE FROM llx_don WHERE rowid = $rowid AND fk_statut = 0;";
if ( $this->db->query( $sql) )
{
if ( $this->db->affected_rows() )
{
return 1;
}
else
{
return 0;
}
}
else
{
print "Err : ".$this->db->error();
return 0;
}
}
/*
* Fetch
*
*
*/
Function fetch($rowid)
{
$sql = "SELECT d.rowid, ".$this->db->pdate("d.datedon")." as datedon, d.prenom, d.nom, d.societe, d.amount, p.libelle as projet, d.fk_statut, d.adresse, d.cp, d.ville, d.pays, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.fk_don_projet";
$sql .= " FROM llx_don as d, llx_don_projet as p, c_paiement as cp";
$sql .= " WHERE p.rowid = d.fk_don_projet AND cp.id = d.fk_paiement AND d.rowid = $rowid";
if ( $this->db->query( $sql) )
{
if ($this->db->num_rows())
{
$obj = $this->db->fetch_object(0);
$this->id = $obj->rowid;
$this->date = $obj->datedon;
$this->prenom = stripslashes($obj->prenom);
$this->nom = stripslashes($obj->nom);
$this->societe = stripslashes($obj->societe);
$this->statut = $obj->fk_statut;
$this->adresse = stripslashes($obj->adresse);
$this->cp = stripslashes($obj->cp);
$this->ville = stripslashes($obj->ville);
$this->email = stripslashes($obj->email);
$this->pays = stripslashes($obj->pays);
$this->projet = $obj->projet;
$this->projetid = $obj->fk_don_projet;
$this->public = $obj->public;
$this->modepaiementid = $obj->fk_paiement;
$this->modepaiement = $obj->libelle;
$this->amount = $obj->amount;
$this->commentaire = stripslashes($obj->note);
}
}
else
{
print $this->db->error();
}
}
/*
* Suppression du don
*
*/
Function valid_promesse($rowid, $userid)
{
$sql = "UPDATE llx_don SET fk_statut = 1, fk_user_valid = $userid WHERE rowid = $rowid AND fk_statut = 0;";
if ( $this->db->query( $sql) )
{
if ( $this->db->affected_rows() )
{
return 1;
}
else
{
return 0;
}
}
else
{
print "Err : ".$this->db->error();
return 0;
}
}
/*
* Classé comme payé, le don a été recu
*
*/
Function set_paye($rowid, $modepaiement='')
{
$sql = "UPDATE llx_don SET fk_statut = 2";
if ($modepaiement)
{
$sql .= ", fk_paiement=$modepaiement";
}
$sql .= " WHERE rowid = $rowid AND fk_statut = 1;";
if ( $this->db->query( $sql) )
{
if ( $this->db->affected_rows() )
{
return 1;
}
else
{
return 0;
}
}
else
{
print "Err : ".$this->db->error();
return 0;
}
}
/*
* Classé comme payé, le don a été recu
*
*/
Function set_commentaire($rowid, $commentaire='')
{
$sql = "UPDATE llx_don SET note = '$commentaire'";
$sql .= " WHERE rowid = $rowid ;";
if ( $this->db->query( $sql) )
{
if ( $this->db->affected_rows() )
{
return 1;
}
else
{
return 0;
}
}
else
{
print "Err : ".$this->db->error();
return 0;
}
}
/*
* Classé comme encaissé
*
*/
Function set_encaisse($rowid)
{
$sql = "UPDATE llx_don SET fk_statut = 3 WHERE rowid = $rowid AND fk_statut = 2;";
if ( $this->db->query( $sql) )
{
if ( $this->db->affected_rows() )
{
return 1;
}
else
{
return 0;
}
}
else
{
print "Err : ".$this->db->error();
return 0;
}
}
/*
* Somme des dons encaissés
*/
Function sum_actual()
{
$sql = "SELECT sum(amount)";
$sql .= " FROM llx_don";
$sql .= " WHERE fk_statut = 3";
if ( $this->db->query( $sql) )
{
$row = $this->db->fetch_row(0);
return $row[0];
}
}
/* Paiement recu en attente d'encaissement
*
*
*/
Function sum_pending()
{
$sql = "SELECT sum(amount)";
$sql .= " FROM llx_don";
$sql .= " WHERE fk_statut = 2";
if ( $this->db->query( $sql) )
{
$row = $this->db->fetch_row(0);
return $row[0];
}
}
/*
* Somme des promesses de dons validées
*
*/
Function sum_intent()
{
$sql = "SELECT sum(amount)";
$sql .= " FROM llx_don";
$sql .= " WHERE fk_statut = 1";
if ( $this->db->query( $sql) )
{
$row = $this->db->fetch_row(0);
return $row[0];
}
}
}
?>

View File

@ -17,6 +17,11 @@
*
* $Id$
* $Source$
*/
/* Classe de gestion du système de paiement de la banque Populaire
* de Lorraine et Champagne
* http://www.cyberpaiement.tm.fr/
*
*/
@ -191,7 +196,7 @@ class Cyberpaiement
print "\n";
print '<input type="hidden" name="CHAMP006" value="'.$this->champ006.'">';
print "\n";
print '<input type="hidden" name="CHAMP007" value="'.$this->champ007.'">';
print '<input type="hidden" name="CHAMP007" value="'.$this->champ007.'ref='.$this->champ200.'">';
print "\n";
print '<input type="hidden" name="CHAMP008" value="'.$this->champ008.'">';
print "\n";

View File

@ -178,7 +178,7 @@ class Don
if ($result)
{
return 1;
return $this->db->last_insert_id();
}
else
{

View File

@ -126,7 +126,27 @@ class Form {
{
return $this->errorstr;
}
/*
*
* Yes/No
*
*/
Function selectyesno($name,$value='')
{
print '<select name="'.$name.'">';
if ($value == 'yes')
{
print '<option value="yes" SELECTED>oui</option>';
print '<option value="no">non</option>';
}
else
{
print '<option value="yes">oui</option>';
print '<option value="no" SELECTED>non</option>';
}
print '</select>';
}
}

View File

@ -53,6 +53,11 @@
</tr>
</table>
<script language="php">
require("merci_code.php");
</script>
<p>
L'initiative <a href="http://eucd.info/">EUCD.INFO</a> a
pour objet de préserver l'intérêt général menacé par la

View File

@ -31,7 +31,7 @@
<input type="hidden" name="CHAMP906" value="0000">
<input type="hidden" name="CHAMP002" value="1234567890">
<input type="hidden" name="CHAMP200" value="123456789012345">
<input type="hidden" name="CHAMP200" value="1">
<input type="hidden" name="CHAMP201" value="200">
<input type="submit" value="Test Retour">

View File

@ -1,7 +1,4 @@
-- ===================================================================
-- $Id$
-- $Source$
--
-- 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
-- the Free Software Foundation; either version 2 of the License, or
@ -16,6 +13,9 @@
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--
-- $Id$
-- $Source$
--
-- ===================================================================
-- statut
@ -27,7 +27,7 @@ create table llx_adherent
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
statut smallint NOT NULL DEFAULT 0,
fk_adherent_type smallint
fk_adherent_type smallint,
datec datetime,
prenom varchar(50),
nom varchar(50),