petit debug sur l'affichage des cotisation et prise en compte des differents type des champs optionnels (chaine, texte, date, datetime)
This commit is contained in:
parent
6ac34dcafa
commit
f8e321a24e
@ -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);
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
|
||||
@ -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) )
|
||||
{
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.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
|
||||
@ -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();
|
||||
|
||||
@ -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 "</table>";
|
||||
}
|
||||
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr>";
|
||||
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr class=\"barreBouton\">";
|
||||
|
||||
/*
|
||||
* Case 1
|
||||
*/
|
||||
|
||||
print "<td align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?action=create\">Nouvel attribut</a>]</td>";
|
||||
print "<td align=\"center\" width=\"25%\" class=\"bouton\">[<a href=\"$PHP_SELF?action=create\">Nouvel attribut</a>]</td>";
|
||||
|
||||
/*
|
||||
* Case 2
|
||||
*/
|
||||
|
||||
print "<td align=\"center\" width=\"25%\">-</td>";
|
||||
print "<td align=\"center\" width=\"25%\" class=\"bouton\">-</td>";
|
||||
|
||||
/*
|
||||
* Case 3
|
||||
*/
|
||||
print "<td align=\"center\" width=\"25%\">-</td>";
|
||||
print "<td align=\"center\" width=\"25%\" class=\"bouton\">-</td>";
|
||||
|
||||
/*
|
||||
* Case 4
|
||||
*/
|
||||
|
||||
print "<td align=\"center\" width=\"25%\">-</td>";
|
||||
print "<td align=\"center\" width=\"25%\" class=\"bouton\">-</td>";
|
||||
|
||||
print "</tr></table></form><p>";
|
||||
|
||||
@ -144,17 +148,25 @@ if ($action == 'create') {
|
||||
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print '<tr><td>Libellé</td><td><input type="text" name="label" size="40"></td></tr>';
|
||||
print '<tr><td>Nom de l\'attribut (pas d\'espace et uniquement des carateres alphanumeriques)</td><td><input type="text" name="attrname" size="40"></td></tr>';
|
||||
print '<tr><td>Libellé</td><td class="valeur"><input type="text" name="label" size="40"></td></tr>';
|
||||
print '<tr><td>Nom de l\'attribut (pas d\'espace et uniquement des carateres alphanumeriques)</td><td class="valeur"><input type="text" name="attrname" size="40"></td></tr>';
|
||||
|
||||
print '<tr><td>Type (non pris en compte)</td><td>';
|
||||
print '<tr><td>Type (non pris en compte)</td><td class="valeur">';
|
||||
|
||||
$form->select_array('type',array('varchar'=>'chaine',
|
||||
'text'=>'texte',
|
||||
'integer'=>'entier',
|
||||
'date'=>'date',
|
||||
'datetime'=>'date et heure'));
|
||||
/*
|
||||
print '<select name="type">';
|
||||
print '<option value="varchar">chaine</option>';
|
||||
print '<option value="text">texte</option>';
|
||||
print '<option value="integer">entier</option>';
|
||||
print '<option value="date">date</option>';
|
||||
print '<option value="datetime">date et heure</option>';
|
||||
print '</select>';
|
||||
*/
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>taille</td><td><input type="text" name="size" size="5" value="255"></td></tr>';
|
||||
@ -194,7 +206,16 @@ if (isset($attrname) && $attrname != '' && $action == 'edit')
|
||||
|
||||
print '<tr><td>Libellé</td><td class="valeur"><input type="text" name="label" size="40" value="'.$adho->attribute_label[$attrname].'"></td></tr>';
|
||||
print '<tr><td>Nom de l\'attribut</td><td class="valeur">'.$attrname.' </td></tr>';
|
||||
print '<tr><td>Type (non pris en compte)</td><td class="valeur"><input type="text" name="type" size="40" value="'.$adho->attribute_name[$attrname].'"></td></tr>';
|
||||
list($type,$size)=preg_split('/\(|\)/',$adho->attribute_name[$attrname]);
|
||||
print '<tr><td>Type (non pris en compte)</td><td class="valeur">';
|
||||
$form->select_array('type',array('varchar'=>'chaine',
|
||||
'text'=>'texte',
|
||||
'integer'=>'entier',
|
||||
'date'=>'date',
|
||||
'datetime'=>'date et heure'),$type);
|
||||
print '</td></tr>';
|
||||
// print '<tr><td>Type (non pris en compte)</td><td class="valeur"><input type="text" name="type" size="40" value="'.$adho->attribute_name[$attrname].'"></td></tr>';
|
||||
print '<tr><td>taille</td><td class="valeur"><input type="text" name="size" size="5" value="'.$size.'"></td></tr>';
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" value="Enregistrer"</td></tr>';
|
||||
print '</table>';
|
||||
print "</form>";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user