From bc08f313d28068b593399ca9dc82da40cf18024c Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville <rodolphe@quiedeville.org> Date: Sun, 29 Dec 2002 23:36:31 +0000 Subject: [PATCH] *** empty log message *** --- htdocs/adherents/type.php | 253 ++++++++++++++++++++++++++++++++++++++ mysql/tables/Makefile | 1 + mysql/tables/drop.sql | 2 + 3 files changed, 256 insertions(+) create mode 100644 htdocs/adherents/type.php diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php new file mode 100644 index 00000000000..9632b86cd17 --- /dev/null +++ b/htdocs/adherents/type.php @@ -0,0 +1,253 @@ +<?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"); +require("../adherent.class.php"); +require("../adherent_type.class.php"); +require("../cotisation.class.php"); +require("../paiement.class.php"); + + +$db = new Db(); + + +if ($HTTP_POST_VARS["action"] == 'add' && $user->admin) +{ + + $adht = new AdherentType($db); + + $adht->libelle = $HTTP_POST_VARS["libelle"]; + $adht->cotisation = $HTTP_POST_VARS["cotisation"]; + $adht->commentaire = $HTTP_POST_VARS["comment"]; + + if ($adht->create($user->id) ) + { + Header("Location: type.php"); + } +} + +if ($HTTP_POST_VARS["action"] == 'update' && $user->admin) +{ + + $adht = new AdherentType($db); + $adht->id = $rowid; + $adht->libelle = $HTTP_POST_VARS["libelle"]; + $adht->cotisation = $HTTP_POST_VARS["cotisation"]; + $adht->commentaire = $HTTP_POST_VARS["comment"]; + + if ($adht->update($user->id) ) + { + Header("Location: type.php"); + } +} + +if ($action == 'delete') +{ + $adh = new Adherent($db); + $adh->delete($rowid); + Header("Location: liste.php"); +} +if ($action == 'commentaire') +{ + $don = new Don($db); + $don->set_commentaire($rowid,$HTTP_POST_VARS["commentaire"]); + $action = "edit"; +} + + + +llxHeader(); + +/* ************************************************************************** */ +/* */ +/* Liste */ +/* */ +/* ************************************************************************** */ + +$sql = "SELECT d.rowid, d.libelle, d.cotisation"; +$sql .= " FROM llx_adherent_type as d"; + +$result = $db->query($sql); +if ($result) +{ + $num = $db->num_rows(); + $i = 0; + + print "<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"4\">"; + + print '<TR class="liste_titre">'; + print "<td>Id</td>"; + print "<td>Libelle</td><td>Soumis a cotisation</td><td> </td>"; + print "</TR>\n"; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print "<TR $bc[$var]>"; + print "<TD>".$objp->rowid."</td>\n"; + print '<TD>'.$objp->libelle.'</TD>'; + print '<TD>'.$objp->cotisation.'</TD>'; + print '<TD><a href="type.php?action=edit&rowid='.$objp->rowid.'">Editer</TD>'; + print "</tr>"; + $i++; + } + print "</table>"; +} +else +{ + print $sql; + print $db->error(); +} + + +print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr>"; + +/* + * Case 1 + */ + +print '<td align="center" width="25%">[<a href="type.php?action=create">Nouveau Type</a>]</td>'; + +/* + * Case 2 + */ + +print "<td align=\"center\" width=\"25%\">-</td>"; + +/* + * Case 3 + */ +print "<td align=\"center\" width=\"25%\">-</td>"; + +/* + * Case 4 + */ + +print "<td align=\"center\" width=\"25%\">-</td>"; + +print "</tr></table></form><p>"; + + + +/* ************************************************************************** */ +/* */ +/* Cr�ation d'une fiche don */ +/* */ +/* ************************************************************************** */ + + +if ($action == 'create') { + + $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"; + $sql .= " AND f.rowid = $facid"; + + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows(); + if ($num) { + $obj = $db->fetch_object( 0); + + $total = $obj->total; + } + } + print_titre("Nouveau type"); + 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>Libell�</td><td><input type="text" name="libelle" size="40"></td></tr>'; + + print '<tr><td>Soumis � cotisation</td><td>'; + + print '<select name="cotisation"><option value="yes">oui</option>'; + print '<option value="no">non</option></select>'; + + print '<tr><td valign="top">Commentaires :</td><td>'; + print "<textarea name=\"comment\" wrap=\"soft\" cols=\"40\" rows=\"15\"></textarea></td></tr>"; + + + print '<tr><td colspan="2" align="center"><input type="submit" value="Enregistrer"></td></tr>'; + print "</form>\n"; + print "</table>\n"; + + +} +/* ************************************************************************** */ +/* */ +/* Edition de la fiche */ +/* */ +/* ************************************************************************** */ +if ($rowid > 0 && $action == 'edit') +{ + + $adht = new AdherentType($db); + $adht->id = $rowid; + $adht->fetch($rowid); + + print_titre("Edition de la fiche"); + print "<form action=\"$PHP_SELF\" method=\"post\">"; + print '<table cellspacing="0" border="1" width="100%" cellpadding="3">'; + + print '<tr><td>Libell�</td><td class="valeur">'.$adht->libelle.' </td></tr>'; + print '<tr><td>Soumis � cotisation</td><td class="valeur">'.$adht->cotisation.' </td></tr>'; + print '<tr><td valign="top">Commentaires</td>'; + + print '<td valign="top" width="50%">'; + print nl2br($adht->commentaire).' </td></tr>'; + + print "</table>\n"; + + + /* + * + * + * + */ + print '<form method="post" action="'.$PHP_SELF.'?rowid='.$rowid.'">'; + print '<input type="hidden" name="rowid" value="'.$rowid.'">'; + print '<input type="hidden" name="action" value="update">'; + print '<table cellspacing="0" border="1" width="100%" cellpadding="3">'; + + print '<tr><td>Libell�</td><td><input type="text" name="libelle" size="40" value="'.$adht->libelle.'"></td></tr>'; + + print '<tr><td>Soumis � cotisation</td><td>'; + + $htmls = new Form($db); + + $htmls->selectyesno("cotisation",$adht->cotisation); + + print '<tr><td valign="top">Commentaires :</td><td>'; + print "<textarea name=\"comment\" wrap=\"soft\" cols=\"40\" rows=\"15\">".$adht->commentaire."</textarea></td></tr>"; + + print '<tr><td colspan="2" align="center"><input type="submit" value="Enregistrer"</td></tr>'; + print '</table>'; + print "</form>"; + +} + +$db->close(); + +llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>"); +?> diff --git a/mysql/tables/Makefile b/mysql/tables/Makefile index ba058de7c08..6038dee9c2f 100644 --- a/mysql/tables/Makefile +++ b/mysql/tables/Makefile @@ -35,6 +35,7 @@ create: $(MYSQL) $(OPTIONS) $(BASE) < c_stcomm.sql $(MYSQL) $(OPTIONS) $(BASE) < c_typent.sql $(MYSQL) $(OPTIONS) $(BASE) < llx_adherent.sql + $(MYSQL) $(OPTIONS) $(BASE) < llx_adherent_type.sql $(MYSQL) $(OPTIONS) $(BASE) < llx_bank.sql $(MYSQL) $(OPTIONS) $(BASE) < llx_bank_account.sql $(MYSQL) $(OPTIONS) $(BASE) < llx_bank_categ.sql diff --git a/mysql/tables/drop.sql b/mysql/tables/drop.sql index ce42c6faad8..4572009c6b8 100644 --- a/mysql/tables/drop.sql +++ b/mysql/tables/drop.sql @@ -45,6 +45,8 @@ drop table if exists c_typent ; drop table if exists llx_adherent; +drop table if exists llx_adherent_type; + drop table if exists llx_bank; drop table if exists llx_bank_account; -- GitLab