diff --git a/htdocs/adherents/adherent_options.class.php b/htdocs/adherents/adherent_options.class.php
index f8f6d514def..fa95c874f49 100644
--- a/htdocs/adherents/adherent_options.class.php
+++ b/htdocs/adherents/adherent_options.class.php
@@ -146,6 +146,28 @@ class AdherentOptions
}
}
+
+ /*
+ * Modification d'un attribut
+ *
+ */
+ Function update($attrname,$type='varchar',$length=255)
+
+ {
+ $sql = "ALTER TABLE llx_adherent_options MODIFY COLUMN $attrname $type($length)";
+
+ if ( $this->db->query( $sql) )
+ {
+ return 1;
+ }
+ else
+ {
+ print "Err : ".$this->db->error();
+ print "
$sql
";
+ return 0;
+ }
+
+ }
/*
* fetch optional attribute name
diff --git a/htdocs/adherents/edit.php b/htdocs/adherents/edit.php
index 3de1710d49b..4e416e922b2 100644
--- a/htdocs/adherents/edit.php
+++ b/htdocs/adherents/edit.php
@@ -72,7 +72,7 @@ if ($action == 'update')
}
else
{
- Header("Location: edit.php?rowid=$adh->id");
+ Header("Location: $PHP_SELF?rowid=$adh->id");
}
}
diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php
index 728ba8d3c5b..2898a26a356 100644
--- a/htdocs/adherents/index.php
+++ b/htdocs/adherents/index.php
@@ -1,5 +1,6 @@
+ * Copyright (C) 2003 Jean-Louis Bergamo
*
* 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
diff --git a/htdocs/adherents/options.php b/htdocs/adherents/options.php
new file mode 100644
index 00000000000..09bbeedcc52
--- /dev/null
+++ b/htdocs/adherents/options.php
@@ -0,0 +1,218 @@
+
+ * Copyright (C) 2003 Jean-Louis Bergamo
+ *
+ * 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($GLOBALS["DOCUMENT_ROOT"]."/adherents/adherent_options.class.php");
+//require("../cotisation.class.php");
+//require("../paiement.class.php");
+
+
+$db = new Db();
+$adho = new AdherentOptions($db);
+
+if ($HTTP_POST_VARS["action"] == 'add' && $user->admin)
+{
+
+ //$adho->libelle = $HTTP_POST_VARS["attrname"];
+ //$adho->cotisation = $HTTP_POST_VARS["cotisation"];
+ //$adho->commentaire = $HTTP_POST_VARS["comment"];
+ if (preg_match("/^\w[a-zA-Z0-9-]*$/",$_POST['attrname'])){
+ $adho->create($_POST['attrname']);
+ }
+ Header("Location: $PHP_SELF");
+}
+
+if ($HTTP_POST_VARS["action"] == 'update' && $user->admin)
+{
+
+ // $adho->libelle = $HTTP_POST_VARS["libelle"];
+ // $adho->cotisation = $HTTP_POST_VARS["cotisation"];
+ // $adho->commentaire = $HTTP_POST_VARS["comment"];
+
+ // if ($adho->update($user->id) )
+ // {
+ // }
+ Header("Location: $PHP_SELF");
+
+}
+
+if ($_POST["action"] == 'delete' && $user->admin)
+{
+ if(isset($_POST["attrname"])){
+ $adho->delete($_POST["attrname"]);
+ }
+ Header("Location: $PHP_SELF");
+}
+if ($action == 'commentaire')
+{
+ $don = new Don($db);
+ $don->set_commentaire($rowid,$HTTP_POST_VARS["commentaire"]);
+ $action = "edit";
+}
+
+
+
+llxHeader();
+
+print_titre("Champs optionnels");
+
+/* ************************************************************************** */
+/* */
+/* */
+/* */
+/* ************************************************************************** */
+
+$array_options=$adho->fetch_name_optionals();
+
+if (sizeof($array_options)>0)
+{
+ print "";
+
+ print '';
+ print "| Libelle | ";
+ print "Nom de l'attribut | ";
+ print "type | | ";
+ print "
\n";
+
+ $var=True;
+ foreach($adho->attribute_name as $key => $value)
+ {
+ $var=!$var;
+ print "";
+ print "| | \n";
+ print "$key | \n";
+ print "$value | \n";
+ print "Editer | \n";
+ print "
";
+ // $i++;
+ }
+ print "
";
+}
+print "";
+
+/*
+ * Case 1
+ */
+
+print "| [Nouvel attribut] | ";
+
+/*
+ * Case 2
+ */
+
+print "- | ";
+
+/*
+ * Case 3
+ */
+print "- | ";
+
+/*
+ * Case 4
+ */
+
+print "- | ";
+
+print "
";
+
+
+
+/* ************************************************************************** */
+/* */
+/* Création d'une fiche don */
+/* */
+/* ************************************************************************** */
+
+
+if ($action == 'create') {
+
+ print_titre("Nouvel attribut");
+ print "
";
+
+}
+
+$db->close();
+
+llxFooter("Dernière modification $Date$ révision $Revision$");
+?>
diff --git a/htdocs/adherents/pre.inc.php b/htdocs/adherents/pre.inc.php
index 4a65da06e05..760db216939 100644
--- a/htdocs/adherents/pre.inc.php
+++ b/htdocs/adherents/pre.inc.php
@@ -50,7 +50,9 @@ function llxHeader($head = "") {
if ($user->admin)
{
- $menu->add("type.php","Configuration");
+ $menu->add("index.php","Configuration");
+ $menu->add_submenu("type.php","Type d'adhérent");
+ $menu->add_submenu("options.php","Champs optionnels");
}
left_menu($menu->liste);