champs optionnels

This commit is contained in:
jlb 2003-02-13 18:15:18 +00:00
parent b218b7e62e
commit 090ace66f3
3 changed files with 31 additions and 3 deletions

View File

@ -234,7 +234,23 @@ class Adherent
$sql .= " WHERE rowid = $this->id";
$result = $this->db->query($sql);
if (!$result)
{
print $this->db->error();
print "<h2><br>$sql<br></h2>";
return 0;
}
if(sizeof($this->array_options) > 0 ){
$sql = "REPLACE INTO llx_adherent_options SET adhid = $this->id";
foreach($this->array_options as $key => $value){
// recupere le nom de l'attribut
$attr=substr($key,8);
$sql.=",$attr = '".$this->array_options[$key]."'";
}
$result = $this->db->query($sql);
}
if ($result)
{
return 1;
@ -270,6 +286,14 @@ class Adherent
$result = 1;
}
}
$sql = "DELETE FROM llx_adherent_options WHERE adhid = $rowid";
if ( $this->db->query( $sql) )
{
if ( $this->db->affected_rows() )
{
$result = 1;
}
}
}
}
else

View File

@ -51,5 +51,7 @@ create table llx_adherent
fk_user_mod integer NOT NULL,
fk_user_valid integer NOT NULL,
datefin datetime NOT NULL, -- date de fin de validité de la cotisation
note text
note text,
UNIQUE INDEX(login)
);

View File

@ -29,7 +29,9 @@ create table llx_adherent_options
(
optid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
adhid integer NOT NULL -- id de l'adherent auquel correspond ces attributs optionnel
adhid integer NOT NULL, -- id de l'adherent auquel correspond ces attributs optionnel
-- telfixe varchar(15),
-- teljob varchar(15)
UNIQUE INDEX(adhid)
);