From bdaaa1d03883b7785b70c75f6411de4a2cbc2f83 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sun, 26 Aug 2012 22:33:27 +0200 Subject: [PATCH] New: [ task #494 ] Send an email to foundation when a new member has auto-subscribed --- ChangeLog | 11 +++++++---- htdocs/adherents/admin/adherent.php | 3 +++ htdocs/core/lib/admin.lib.php | 3 ++- htdocs/langs/en_US/members.lang | 2 ++ htdocs/langs/fr_FR/members.lang | 2 ++ htdocs/public/members/new.php | 26 ++++++++++++++++++++++++++ 6 files changed, 42 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 96dc8d7d7ef..33370d56006 100644 --- a/ChangeLog +++ b/ChangeLog @@ -35,13 +35,13 @@ For users: - New: More surface control on stock correction page. - New: Add great britain provinces. - New: Update libs/tools/logo for DoliWamp. -- Fix: No images into product description lines as PDF generation does - not work with this. +- New: [ task #494 ] Send an email to foundation when a new member has auto-subscribed - New: [ task #326 ]: Add a numbering module to suggest automatically a product ref -- Fix: Errors weren't being shown in customer's & supplier's orders - New: Add conditional substitution IF/ELSEIF/ENDIF for ODT templates -- New: Basic implementation of hooks and triggers for a lot (most) of core modules: action/calendar, trips and expenses, dons, vat payment, contact/society, contract, product lines, expedition, order supplier and order invoice (lines included), intervention card, project, tasks - Fix: [ bug #499 ]: Supplier order input method not translated +- Fix: No images into product description lines as PDF generation does + not work with this. +- Fix: Errors weren't being shown in customer's & supplier's orders For developers: - New: Add webservice for thirdparty creation and list. @@ -55,6 +55,9 @@ For developers: ldap::connect, formadmin::select_lang, html::select_tva - New: Add custom substitution function for ODT product lines: mymodule_completesubstitutionarray_lines() +- New: Basic implementation of hooks and triggers for a lot (most) of core modules: + action/calendar, trips and expenses, dons, vat payment, contact/society, contract, product lines, + expedition, order supplier and order invoice (lines included), intervention card, project, tasks. For translators: - New: Update language files (de, tr, pt, ca, es, en, fr). diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 6cea7ce9389..02d9e7b90a2 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -6,6 +6,7 @@ * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.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 @@ -248,6 +249,8 @@ print '<br>'; * Edition des variables globales non rattache a un theme specifique */ $constantes=array( + 'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT', + 'ADHERENT_AUTOREGISTER_NOTIF_MAIL', 'ADHERENT_AUTOREGISTER_MAIL_SUBJECT', 'ADHERENT_AUTOREGISTER_MAIL', 'ADHERENT_MAIL_VALID_SUBJECT', diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index ef73cf5be70..873b92641b9 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1,6 +1,7 @@ <?php /* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr> + * Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.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 @@ -1093,7 +1094,7 @@ function form_constantes($tableau) print '</td><td>'; print '<input type="hidden" name="consttype" value="texte">'; } - else if (in_array($const,array('ADHERENT_AUTOREGISTER_MAIL','ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) + else if (in_array($const,array('ADHERENT_AUTOREGISTER_NOTIF_MAIL','ADHERENT_AUTOREGISTER_MAIL','ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) { require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('constvalue_'.$const,$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,5,60); diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index da6a0d5a577..188ac1c89f7 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -131,6 +131,8 @@ AddSubscription=Add subscription ShowSubscription=Show subscription MemberModifiedInDolibarr=Member modified in Dolibarr SendAnEMailToMember=Send information email to member +DescADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT=Sujet du mail reçu en cas d'auto-inscription d'un invité +DescADHERENT_AUTOREGISTER_NOTIF_MAIL=Mail reçu en cas d'auto-inscription d'un invité DescADHERENT_AUTOREGISTER_MAIL_SUBJECT=EMail subject for member autosubscription DescADHERENT_AUTOREGISTER_MAIL=EMail for member autosubscription DescADHERENT_MAIL_VALID_SUBJECT=EMail subject for member validation diff --git a/htdocs/langs/fr_FR/members.lang b/htdocs/langs/fr_FR/members.lang index c309f2d5c96..d2801a540f8 100644 --- a/htdocs/langs/fr_FR/members.lang +++ b/htdocs/langs/fr_FR/members.lang @@ -135,6 +135,8 @@ AddSubscription=Ajouter adhésion/cotisation ShowSubscription=Afficher adhésion MemberModifiedInDolibarr=Adhérent modifié dans Dolibarr SendAnEMailToMember=Envoyer email d'information à l'adhérent +DescADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT=Sujet du mail reçu en cas d'auto-inscription d'un invité +DescADHERENT_AUTOREGISTER_NOTIF_MAIL=Mail reçu en cas d'auto-inscription d'un invité DescADHERENT_AUTOREGISTER_MAIL_SUBJECT=Sujet du mail envoyé en cas d'auto-inscription d'un invité DescADHERENT_AUTOREGISTER_MAIL=Mail envoyé en cas d'auto-inscription d'un invité DescADHERENT_MAIL_VALID_SUBJECT=Sujet du mail de validation adhérent diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 70ac3033c1d..efd4b1c3d47 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -260,6 +260,32 @@ if ($action == 'add') $result=$adh->send_an_email($conf->global->ADHERENT_AUTOREGISTER_MAIL,$conf->global->ADHERENT_AUTOREGISTER_MAIL_SUBJECT,array(),array(),array(),"","",0,-1); } + // Send email to the foundation to say a new member subscribed with autosubscribe form + if (! empty($conf->global->MAIN_INFO_SOCIETE_MAIL) && ! empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT) && + ! empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL) ) + { + $to=$adh->makeSubstitution($conf->global->MAIN_INFO_SOCIETE_MAIL); + $from=$conf->global->ADHERENT_MAIL_FROM; + $mailfile = new CMailFile( + $conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT, + $to, + $from, + $adh->makeSubstitution($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL), + array(), + array(), + array(), + "", + "", + 0, + -1 + ); + + if (! $mailfile->sendfile()) + { + dol_syslog($langs->trans("ErrorFailedToSendMail",$from,$to), LOG_ERR); + } + } + if (! empty($backtopage)) $urlback=$backtopage; else if ($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION) { -- GitLab