diff --git a/htdocs/adherent.class.php b/htdocs/adherent.class.php index dc4f84d3b2d..966b071fe8a 100644 --- a/htdocs/adherent.class.php +++ b/htdocs/adherent.class.php @@ -115,7 +115,11 @@ class Adherent ); $texttosend = preg_replace ($patterns, $replace, $text); $subjectosend = preg_replace ($patterns, $replace, $subject); - return mail($recipients,$subjectosend,$texttosend); + if (defined('MAIN_MAIL_FROM') && MAIN_MAIL_FROM != ''){ + return mail($recipients,$subjectosend,$texttosend,"From: ".MAIN_MAIL_FROM."\nReply-To: ".MAIN_MAIL_FROM."\nX-Mailer: PHP/" . phpversion()); + }else{ + return mail($recipients,$subjectosend,$texttosend); + } } /* * diff --git a/htdocs/adherents/adherent_options.class.php b/htdocs/adherents/adherent_options.class.php index f40a64e3ed6..455dccfb4e1 100644 --- a/htdocs/adherents/adherent_options.class.php +++ b/htdocs/adherents/adherent_options.class.php @@ -118,7 +118,20 @@ class AdherentOptions */ if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-]*$/",$attrname)){ $sql = "ALTER TABLE llx_adherent_options "; - $sql .= " ADD $attrname $type($length)"; + switch ($type){ + case 'varchar' : + case 'interger' : + $sql .= " ADD $attrname $type($length)"; + break; + case 'text' : + case 'date' : + case 'datetime' : + $sql .= " ADD $attrname $type"; + break; + default: + $sql .= " ADD $attrname $type"; + break; + } if ($this->db->query($sql)) { @@ -214,7 +227,22 @@ class AdherentOptions Function update($attrname,$type='varchar',$length=255) { if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-]*$/",$attrname)){ - $sql = "ALTER TABLE llx_adherent_options MODIFY COLUMN $attrname $type($length)"; + $sql = "ALTER TABLE llx_adherent_options "; + switch ($type){ + case 'varchar' : + case 'interger' : + $sql .= " MODIFY COLUMN $attrname $type($length)"; + break; + case 'text' : + case 'date' : + case 'datetime' : + $sql .= " MODIFY COLUMN $attrname $type"; + break; + default: + $sql .= " MODIFY COLUMN $attrname $type"; + break; + } + //$sql .= "MODIFY COLUMN $attrname $type($length)"; if ( $this->db->query( $sql) ) { diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php index e329a2440dc..e9691e63d75 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/cotisations.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 @@ -61,6 +62,7 @@ if(isset($date_select) && $date_select != ''){ $sql .= " AND dateadh LIKE '$date_select%'"; } $result = $db->query($sql); +$Total=array(); if ($result) { $num = $db->num_rows(); diff --git a/htdocs/adherents/options.php b/htdocs/adherents/options.php index 10faa5afc63..bfc219ba349 100644 --- a/htdocs/adherents/options.php +++ b/htdocs/adherents/options.php @@ -30,12 +30,13 @@ require($GLOBALS["DOCUMENT_ROOT"]."/adherents/adherent_options.class.php"); $db = new Db(); $adho = new AdherentOptions($db); +$form = new Form($db); if ($HTTP_POST_VARS["action"] == 'add' && $user->admin) { // type et taille non encore pris en compte => varchar(255) if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-]*$/",$_POST['attrname'])){ - $adho->create($_POST['attrname']); + $adho->create($_POST['attrname'],$_POST['type'],$_POST['size']); } if (isset($_POST['label'])){ $adho->create_label($_POST['attrname'],$_POST['label']); @@ -48,6 +49,9 @@ if ($HTTP_POST_VARS["action"] == 'update' && $user->admin) //if ($adho->update($user->id) ) // { // } + if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-]*$/",$_POST['attrname'])){ + $adho->update($_POST['attrname'],$_POST['type'],$_POST['size']); + } if (isset($_POST['label'])){ $adho->update_label($_POST['attrname'],$_POST['label']); } @@ -100,30 +104,30 @@ if (sizeof($array_options)>0) } print ""; } -print "

"; +print "

"; /* * Case 1 */ -print ""; +print ""; /* * Case 2 */ -print ""; +print ""; /* * Case 3 */ -print ""; +print ""; /* * Case 4 */ -print ""; +print ""; print "
[Nouvel attribut][Nouvel attribut]------

"; @@ -144,17 +148,25 @@ if ($action == 'create') { print ''; - print 'Libellé'; - print 'Nom de l\'attribut (pas d\'espace et uniquement des carateres alphanumeriques)'; + print 'Libellé'; + print 'Nom de l\'attribut (pas d\'espace et uniquement des carateres alphanumeriques)'; - print 'Type (non pris en compte)'; + print 'Type (non pris en compte)'; + $form->select_array('type',array('varchar'=>'chaine', + 'text'=>'texte', + 'integer'=>'entier', + 'date'=>'date', + 'datetime'=>'date et heure')); + /* print ''; + */ print ''; print 'taille'; @@ -194,7 +206,16 @@ if (isset($attrname) && $attrname != '' && $action == 'edit') print 'Libellé'; print 'Nom de l\'attribut'.$attrname.' '; - print 'Type (non pris en compte)'; + list($type,$size)=preg_split('/\(|\)/',$adho->attribute_name[$attrname]); + print 'Type (non pris en compte)'; + $form->select_array('type',array('varchar'=>'chaine', + 'text'=>'texte', + 'integer'=>'entier', + 'date'=>'date', + 'datetime'=>'date et heure'),$type); + print ''; + // print 'Type (non pris en compte)'; + print 'taille'; print ''; print ''; print "";