From 6b5fec25d0a0b0ef79d675b35b51970c26a9a0f9 Mon Sep 17 00:00:00 2001 From: jlb Date: Tue, 4 Mar 2003 15:23:13 +0000 Subject: [PATCH] rajout (pour les cdg) de la possibilite d'envoye un mail de bienvenue distinct par type d'adherent. rajout de la possibilite de configurer les subject des differents mail (new, edit, valid et resil) rajout de la possibilite de configurer les mailing-lists (mailman) cia les constantes. il reste a faire un script pour rajouter les utilisateurs dans les listes mailman. --- htdocs/adherent_type.class.php | 8 ++- htdocs/adherents/fiche.php | 41 +++++++++----- htdocs/adherents/type.php | 59 +++++++++++++-------- htdocs/admin/const.php | 2 +- htdocs/conf/conf.class.php3.sample | 13 +++-- htdocs/main.inc.php3 | 28 ++++++++++ htdocs/public/adherents/new.php | 4 +- htdocs/public/adherents/priv_edit.php | 4 +- mysql/data/data.sql | 17 +++++- mysql/tables/llx_adherent_type.sql | 3 +- scripts/adherents/{ => mailman}/adh2list.pl | 0 11 files changed, 130 insertions(+), 49 deletions(-) rename scripts/adherents/{ => mailman}/adh2list.pl (100%) diff --git a/htdocs/adherent_type.class.php b/htdocs/adherent_type.class.php index 226b4ec075a..938b6a20a28 100644 --- a/htdocs/adherent_type.class.php +++ b/htdocs/adherent_type.class.php @@ -27,6 +27,8 @@ class AdherentType var $statut; var $cotisation; // Soumis à la cotisation var $errorstr; + var $mail_valid; // mail envoye lors de la validation + var $commentaire; // commentaire /* * * @@ -94,6 +96,8 @@ class AdherentType $sql .= "libelle = '".$this->libelle ."'"; $sql .= ",statut=".$this->statut; $sql .= ",cotisation='".$this->cotisation."'"; + $sql .= ",note='".$this->commentaire."'"; + $sql .= ",mail_valid='".$this->mail_valid."'"; $sql .= " WHERE rowid = $this->id"; @@ -145,7 +149,7 @@ class AdherentType */ Function fetch($rowid) { - $sql = "SELECT d.rowid, d.libelle, d.statut, d.cotisation"; + $sql = "SELECT *"; $sql .= " FROM llx_adherent_type as d"; $sql .= " WHERE d.rowid = $rowid"; @@ -160,6 +164,8 @@ class AdherentType $this->libelle = $obj->libelle; $this->statut = $obj->statut; $this->cotisation = $obj->cotisation; + $this->mail_valid = $obj->mail_valid; + $this->commentaire = $obj->note; } } else diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index ea88b97585e..a76ba60e586 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -92,14 +92,25 @@ if ($HTTP_POST_VARS["action"] == 'confirm_valid' && $HTTP_POST_VARS["confirm"] = $adh = new Adherent($db, $rowid); $adh->validate($user->id); $adh->fetch($rowid); - //$mesg=preg_replace("/%INFO%/","Prenom : $adh->prenom\nNom : $adh->nom\nSociete = $adh->societe\nAdresse = $adh->adresse\nCode Postal : $adh->cp\nVille : $adh->ville\nPays : $adh->pays\nEmail : $adh->email\nLogin : $adh->login\nPassword : $adh->pass\nNote : $adh->note\n\nServeur : http://$SERVER_NAME/public/adherents/",$conf->adherent->email_valid); - //mail($adh->email,"Vos coordonnees sur http://$SERVER_NAME/",$mesg); - $adh->send_an_email($adh->email,$conf->adherent->email_valid,'Vos coordonnees sur %SERVEUR%'); - if ($conf->adherent->use_mailman == 1){ - foreach ($conf->adherent->mailman_lists as $key){ - $adh->add_to_mailman($adh->email,$key,$conf->adherent->mailman_dir); + + $adht = new AdherentType($db); + $adht->fetch($adh->typeid); + + if (isset($adht->mail_valid) && $adht->mail_valid != '') + { + $adh->send_an_email($adh->email,$adht->mail_valid,$conf->adherent->email_valid_subject); + } + else + { + $adh->send_an_email($adh->email,$conf->adherent->email_valid,$conf->adherent->email_valid_subject); + } + if ($conf->adherent->use_mailman == 1) + { + foreach ($conf->adherent->mailman_lists as $key) + { + $adh->add_to_mailman($adh->email,$key,$conf->adherent->mailman_dir); + } } - } } @@ -108,14 +119,16 @@ if ($HTTP_POST_VARS["action"] == 'confirm_resign' && $HTTP_POST_VARS["confirm"] $adh = new Adherent($db, $rowid); $adh->resiliate($user->id); $adh->fetch($rowid); - //$mesg=preg_replace("/%INFO%/","Prenom : $adh->prenom\nNom : $adh->nom\nSociete = $adh->societe\nAdresse = $adh->adresse\nCode Postal : $adh->cp\nVille : $adh->ville\nPays : $adh->pays\nEmail : $adh->email\nLogin : $adh->login\nPassword : $adh->pass\nNote : $adh->note\n\nServeur : http://$SERVER_NAME/public/adherents/",$conf->adherent->email_resil); - //mail($adh->email,"Vos coordonnees sur http://$SERVER_NAME/",$mesg); - $adh->send_an_email($adh->email,$conf->adherent->email_resil,'Vos coordonnees sur %SERVEUR%'); - if ($conf->adherent->use_mailman == 1){ - foreach ($conf->adherent->mailman_lists as $key){ - $adh->del_to_mailman($adh->email,$key,$conf->adherent->mailman_dir); + + $adh->send_an_email($adh->email,$conf->adherent->email_resil,$conf->adherent->email_resil_subject); + + if ($conf->adherent->use_mailman == 1) + { + foreach ($conf->adherent->mailman_lists as $key) + { + $adh->del_to_mailman($adh->email,$key,$conf->adherent->mailman_dir); + } } - } } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 72849ebfd83..0a0f10ffa85 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.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 @@ -20,10 +21,10 @@ * */ require("./pre.inc.php"); -require("../adherent.class.php"); -require("../adherent_type.class.php"); -require("../cotisation.class.php"); -require("../paiement.class.php"); +require($GLOBALS["DOCUMENT_ROOT"]."/adherent.class.php"); +require($GLOBALS["DOCUMENT_ROOT"]."/adherent_type.class.php"); +//require($GLOBALS["DOCUMENT_ROOT"]."/cotisation.class.php"); +//require($GLOBALS["DOCUMENT_ROOT"]."/paiement.class.php"); $db = new Db(); @@ -37,7 +38,8 @@ if ($HTTP_POST_VARS["action"] == 'add' && $user->admin) $adht->libelle = $HTTP_POST_VARS["libelle"]; $adht->cotisation = $HTTP_POST_VARS["cotisation"]; $adht->commentaire = $HTTP_POST_VARS["comment"]; - + $adht->mail_valid = $HTTP_POST_VARS["mail_valid"]; + if ($adht->create($user->id) ) { Header("Location: type.php"); @@ -52,7 +54,8 @@ if ($HTTP_POST_VARS["action"] == 'update' && $user->admin) $adht->libelle = $HTTP_POST_VARS["libelle"]; $adht->cotisation = $HTTP_POST_VARS["cotisation"]; $adht->commentaire = $HTTP_POST_VARS["comment"]; - + $adht->mail_valid = $HTTP_POST_VARS["mail_valid"]; + if ($adht->update($user->id) ) { Header("Location: type.php"); @@ -97,7 +100,7 @@ if ($result) print ''; print "Id"; - print "LibelléSoumis à cotisation "; + print "LibelléCotisation ? "; print "\n"; $var=True; @@ -160,19 +163,23 @@ print "

"; 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"; + /* + * $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); + * $result = $db->query($sql); + * if ($result) { + * $num = $db->num_rows(); + * if ($num) { + * $obj = $db->fetch_object( 0); + * + * $total = $obj->total; + * } + * } - $total = $obj->total; - } - } + */ + print_titre("Nouveau type"); print "

"; print ''; @@ -187,8 +194,10 @@ if ($action == 'create') { print ''; print '"; + print ""; + print '"; print ''; print "\n"; @@ -216,9 +225,14 @@ if ($rowid > 0 && $action == 'edit') print ''; print ''; - print ''; + print ''; + + print ''; + print "
Commentaires :'; - print "
Mail d\'acceuil :'; + print "
Soumis à cotisation'.$adht->cotisation.' 
Commentaires'; + print ''; print nl2br($adht->commentaire).' 
Mail d\'acceuil'; + print nl2br($adht->mail_valid).' 
\n"; @@ -241,7 +255,10 @@ if ($rowid > 0 && $action == 'edit') $htmls->selectyesno("cotisation",$adht->cotisation); print 'Commentaires :'; - print ""; + print ""; + + print 'Mail d\'acceuil :'; + print ""; print ''; print ''; diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index b333f7c141b..19d409efc63 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -69,7 +69,7 @@ if ($user->admin) } } -$sql = "SELECT rowid, name, value, type, note FROM llx_const"; +$sql = "SELECT rowid, name, value, type, note FROM llx_const ORDER BY name ASC"; $result = $db->query($sql); if ($result) { diff --git a/htdocs/conf/conf.class.php3.sample b/htdocs/conf/conf.class.php3.sample index 61ff840dbcd..eb9eff3465b 100644 --- a/htdocs/conf/conf.class.php3.sample +++ b/htdocs/conf/conf.class.php3.sample @@ -195,10 +195,15 @@ class AdherentConf { $this->use_mailman = 1; $this->mailman_dir = "/home/httpd/adherents.j1b.org/htdocs/adherents/ml/mailman"; $this->mailman_lists = array('lists1','list2'); - $this->email_new = "Merci de votre inscription. Votre adhesion devrait etre rapidement validee.\nVoici le rappel des coordonnees que vous avez rentrees (toute information erronee entrainera la non validation de votre inscription) :\n\n%INFO%\n\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l'adresse suivante :\nhttp://$SERVER_NAME/public/adherents/priv_edit.php\n\n"; - $this->email_edit = "Voici le rappel des coordonnees que vous avez modifiees (toute information erronee entrainera la non validation de votre inscription) :\n\n%INFO%\n\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l'adresse suivante :\nhttp://$SERVER_NAME/public/adherents/priv_edit.php\n\n"; - $this->email_valid = "Votre adhesion vient d'etre validee. Voici le rappel de vos coordonnees (toute information erronee entrainera la non validation de votre inscription) :\n\n%INFO%\n\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l'adresse suivante :\nhttp://$SERVER_NAME/public/adherents/priv_edit.php\n\n"; - $this->email_resil = "Votre adhesion sur http://$SERVER_NAME/ vient d'etre resilie.\nNous esperons vous revoir bientot\n"; + $this->email_new = "Merci de votre inscription. Votre adhesion devrait etre rapidement validee.\nVoici le rappel des coordonnees que vous avez rentrees (toute information erronee entrainera la non validation de votre inscription) :\n\n%INFO%\n\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l'adresse suivante :\n%SERVEUR%public/adherents/\n\n"; + $this->email_new_subject = 'Vos coordonnees sur %SERVEUR%'; + $this->email_edit = "Voici le rappel des coordonnees que vous avez modifiees (toute information erronee entrainera la non validation de votre inscription) :\n\n%INFO%\n\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l'adresse suivante :\n%SERVEUR%public/adherents/\n\n"; + $this->email_edit_subject = 'Vos coordonnees sur %SERVEUR%'; + $this->email_valid = "Votre adhesion vient d'etre validee. Voici le rappel de vos coordonnees (toute information erronee entrainera la non validation de votre inscription) :\n\n%INFO%\n\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l'adresse suivante :\n%SERVEUR%public/adherents/\n\n"; + $this->email_valid_subject = 'Vos coordonnees sur %SERVEUR%'; + $this->email_resil = "Votre adhesion sur %SERVEUR% vient d'etre resilie.\nNous esperons vous revoir bientot\n"; + $this->email_resil_subject = 'Vos coordonnees sur %SERVEUR%'; + } } /* diff --git a/htdocs/main.inc.php3 b/htdocs/main.inc.php3 index 106145d4ffe..1f85d375ce4 100644 --- a/htdocs/main.inc.php3 +++ b/htdocs/main.inc.php3 @@ -84,18 +84,46 @@ if (defined("MAIN_MAIL_RESIL")) { $conf->adherent->email_resil=MAIN_MAIL_RESIL; } +if (defined("MAIN_MAIL_RESIL_SUBJECT")) +{ + $conf->adherent->email_resil_subject=MAIN_MAIL_RESIL_SUBJECT; +} if (defined("MAIN_MAIL_VALID")) { $conf->adherent->email_valid=MAIN_MAIL_VALID; } +if (defined("MAIN_MAIL_VALID_SUBJECT")) +{ + $conf->adherent->email_valid_subject=MAIN_MAIL_VALID_SUBJECT; +} if (defined("MAIN_MAIL_EDIT")) { $conf->adherent->email_edit=MAIN_MAIL_EDIT; } +if (defined("MAIN_MAIL_EDIT_SUBJECT")) +{ + $conf->adherent->email_edit_subject=MAIN_MAIL_EDIT_SUBJECT; +} if (defined("MAIN_MAIL_NEW")) { $conf->adherent->email_new=MAIN_MAIL_NEW; } +if (defined("MAIN_MAIL_NEW_SUBJECT")) +{ + $conf->adherent->email_new_subject=MAIN_MAIL_NEW_SUBJECT; +} +if (defined("MAIN_MAILMAN_DIR")) +{ + $conf->adherent->mailman_dir=MAIN_MAILMAN_DIR; +} +if (defined("MAIN_MAILMAN_LISTS")) +{ + $conf->adherent->mailman_lists=explode(',',MAIN_MAILMAN_DIR); +} +if (defined("MAIN_USE_MAILMAN")) +{ + $conf->adherent->use_mailman=MAIN_USE_MAILMAN; +} /* */ if(!isset($application_lang)) diff --git a/htdocs/public/adherents/new.php b/htdocs/public/adherents/new.php index 8032ef1f0b0..5541a7dceb5 100644 --- a/htdocs/public/adherents/new.php +++ b/htdocs/public/adherents/new.php @@ -102,9 +102,7 @@ if ($HTTP_POST_VARS["action"] == 'add') $adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation); } // Envoi d'un Email de confirmation au nouvel adherent - //$mesg=preg_replace("/%INFO%/","Prenom : $prenom\nNom : $nom\nSociete = $societe\nAdresse = $adresse\nCode Postal : $cp\nVille : $ville\nPays : $pays\nEmail : $email\nLogin : $login\nPassword : $pass1\nNote : $note\n\nServeur : http://$SERVER_NAME/public/adherents/",$conf->adherent->email_new); - //mail($email,"Votre adhesion sur http://$SERVER_NAME/",$mesg); - $adh->send_an_email($email,$conf->adherent->email_new,'Vos coordonnees sur %SERVEUR%'); + $adh->send_an_email($email,$conf->adherent->email_new,$conf->adherent->email_new_subject); Header("Location: new.php?action=added"); } } diff --git a/htdocs/public/adherents/priv_edit.php b/htdocs/public/adherents/priv_edit.php index 4938092b9db..d18e01f81e1 100644 --- a/htdocs/public/adherents/priv_edit.php +++ b/htdocs/public/adherents/priv_edit.php @@ -109,9 +109,7 @@ if ($action == 'update') } if ($adh->update($user->id) ) { - //$mesg=preg_replace("/%INFO%/","Prenom : $prenom\nNom : $nom\nSociete = $societe\nAdresse = $adresse\nCode Postal : $cp\nVille : $ville\nPays : $pays\nEmail : $email\nLogin : $login\nPassword : $pass\nNote : $note\n\nServeur : http://$SERVER_NAME/public/adherents/",$conf->adherent->email_edit); - //mail($email,"Vos coordonnees sur http://$SERVER_NAME/",$mesg); - $adh->send_an_email($email,$conf->adherent->email_edit,'Vos coordonnees sur %SERVEUR%'); + $adh->send_an_email($email,$conf->adherent->email_edit,$conf->adherent->email_edit_subject); //Header("Location: fiche.php?rowid=$adh->id&action=edit"); Header("Location: $PHP_SELF"); } diff --git a/mysql/data/data.sql b/mysql/data/data.sql index 6a82fc67d39..44b97f24c02 100644 --- a/mysql/data/data.sql +++ b/mysql/data/data.sql @@ -39,6 +39,21 @@ insert into llx_const(name, value, type, note) values ('MAIN_SEARCHFORM_CONTACT' insert into llx_const(name, value, type, note) values ('COMPTA_ONLINE_PAYMENT_BPLC','1','yesno','Système de gestion de la banque populaire de Lorraine'); +INSERT INTO llx_const (name, value, type, note) VALUES ('MAIN_THEME','dolibarr','chaine','theme principal'); +INSERT INTO llx_const (name, value, type, note) VALUES ('MAIN_TITLE','Adherents test J1B','chaine','Titre des pages'); +INSERT INTO llx_const (name, value, type, note) VALUES ('MAIN_MAIL_RESIL','Votre adhesion sur %SERVEUR% vient d\'etre resilie.\r\nNous esperons vous revoir tres bientot','texte','Mail de Resiliation'); +INSERT INTO llx_const (name, value, type, note) VALUES ('MAIN_MAIL_VALID','MAIN\r\nVotre adhesion vient d\'etre validee. \r\nVoici le rappel de vos coordonnees (toute information erronee entrainera la non validation de votre inscription) :\r\n\r\n%INFO%\r\n\r\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l\'adresse suivante : \r\n%SERVEUR%public/adherents/','texte','Mail de validation'); +INSERT INTO llx_const (name, value, type, note) VALUES ('MAIN_MAIL_EDIT','Voici le rappel des coordonnees que vous avez modifiees (toute information erronee entrainera la non validation de votre inscription) :\r\n\r\n%INFO%\r\n\r\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l\'adresse suivante :\r\n%SERVEUR%public/adherents/','texte','Mail d\'edition'); +INSERT INTO llx_const (name, value, type, note) VALUES ('MAIN_MAIL_NEW','Merci de votre inscription. Votre adhesion devrait etre rapidement validee.\r\nVoici le rappel des coordonnees que vous avez rentrees (toute information erronee entrainera la non validation de votre inscription) :\r\n\r\n%INFO%\r\n\r\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l\'adresse suivante :\r\n%SERVEUR%public/adherents/','texte','Mail de nouvel inscription'); +INSERT INTO llx_const (name, value, type, note) VALUES ('MAIN_MAIL_VALID_SUBJECT','Votre adhésion a ete validée sur %SERVEUR%','chaine','sujet du mail de validation'); +INSERT INTO llx_const (name, value, type, note) VALUES ('MAIN_MAIL_RESIL_SUBJECT','Resiliation de votre adhesion sur %SERVEUR%','chaine','sujet du mail de resiliation'); +INSERT INTO llx_const (name, value, type, note) VALUES ('SIZE_LISTE_LIMIT','50','chaine','Taille des listes'); +INSERT INTO llx_const (name, value, type, note) VALUES ('MAIN_MAIL_NEW_SUBJECT','Bienvenue sur %SERVEUR%','chaine','Sujet du mail de nouvelle adhesion'); +INSERT INTO llx_const (name, value, type, note) VALUES ('MAIN_MAIL_EDIT_SUBJECT','Votre fiche a ete editee sur %SERVEUR%','chaine','Sujet du mail d\'edition'); + +INSERT INTO llx_const (name, value, type, note) VALUES ('MAIN_USE_MAILMAN','1','yesno','Utilisation de Mailman'); +INSERT INTO llx_const (name, value, type, note) VALUES ('MAIN_MAILMAN_LIST','lists1,lists2','chaine','Les listes sur lesquelles inscrire les adherents'); +INSERT INTO llx_const (name, value, type, note) VALUES ('MAIN_MAILMAN_DIR','/home/httpd/adherents.j1b.org/htdocs/adherents/ml/mailman','chaine','Repertoire dans lequel les nouveaux adherents aux listes sont ecris'); -- -- Constantes @@ -142,4 +157,4 @@ insert into c_propalst (id,label) values (4, 'Factur -- Utilisateur -- --insert into llx_user (name,firstname,code,login,pass,module_comm,module_compta,admin,webcal_login) ---values ('Quiedeville','Rodolphe','RQ','rodo','CRnN0Tam/s7z.',1,1,1,'rodo'); \ No newline at end of file +--values ('Quiedeville','Rodolphe','RQ','rodo','CRnN0Tam/s7z.',1,1,1,'rodo'); diff --git a/mysql/tables/llx_adherent_type.sql b/mysql/tables/llx_adherent_type.sql index 6b676dab1f1..c8bbf34e1c1 100644 --- a/mysql/tables/llx_adherent_type.sql +++ b/mysql/tables/llx_adherent_type.sql @@ -29,5 +29,6 @@ create table llx_adherent_type statut smallint NOT NULL DEFAULT 0, libelle varchar(50), cotisation enum('yes','no') NOT NULL DEFAULT 'yes', - note text + note text, + mail_valid text -- mail envoye a la validation ); diff --git a/scripts/adherents/adh2list.pl b/scripts/adherents/mailman/adh2list.pl similarity index 100% rename from scripts/adherents/adh2list.pl rename to scripts/adherents/mailman/adh2list.pl