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 @@ + + * + * 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 ""; + + print ''; + print ""; + print ""; + print "\n"; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print ''; + print ''; + print ''; + print ""; + $i++; + } + print "
IdLibelleSoumis a cotisation 
".$objp->rowid."'.$objp->libelle.''.$objp->cotisation.'Editer
"; +} +else +{ + print $sql; + print $db->error(); +} + + +print "

"; + +/* + * Case 1 + */ + +print ''; + +/* + * Case 2 + */ + +print ""; + +/* + * Case 3 + */ +print ""; + +/* + * Case 4 + */ + +print ""; + +print "
[Nouveau Type]---

"; + + + +/* ************************************************************************** */ +/* */ +/* 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 "

"; + print ''; + + print ''; + + print ''; + + print '"; + + + print ''; + print "\n"; + print "
Libellé
Soumis à cotisation'; + + print ''; + + print '
Commentaires :'; + print "
\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 "
"; + print ''; + + print ''; + print ''; + print ''; + + print ''; + + print "
Libellé'.$adht->libelle.' 
Soumis à cotisation'.$adht->cotisation.' 
Commentaires'; + print nl2br($adht->commentaire).' 
\n"; + + + /* + * + * + * + */ + print ''; + print ''; + print ''; + print ''; + + print ''; + + print '"; + + print ''; + print '
Libellé
Soumis à cotisation'; + + $htmls = new Form($db); + + $htmls->selectyesno("cotisation",$adht->cotisation); + + print '
Commentaires :'; + print "
'; + print "
"; + +} + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> 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;