Bonjour,

Ce qu'il faut, c'est ouvrir la fiche parent si le champ est vide:

        // Get member informations
        $adh = new Adherent();
        $adh->load($contrib->member);

        if ( $preferences->pref_mail_method > GaletteMail::METHOD_DISABLED ) {
            //Add variable $mailto to use email address of parent if email 
field is empty
                $mailto = '';
                        
            if ( $adh->email == '' && $adh->parent == ''  ) {
                $error_detected[] = _T("- You can't send a confirmation by 
email if the member hasn't got an address!");
            } else if ( $adh->email == '' ) {
                $parent = new Adherent(null, null);
                $parent->load($adh->parent);
                        
                if ( $parent->email == '' ) {
                    $error_detected[] = _T("- You can't send a confirmation by 
email if the parent of the member hasn't got an address!");
                } else {
                    $mailto = $parent->email;
                }
            } else {
                $mailto = $adh->email;
            }
                        
                $texts = new Texts(
                $texts_fields,
                $preferences,
                array(
                    'name_adh'          => 
custom_html_entity_decode($adh->sname),
                    'firstname_adh'     => 
custom_html_entity_decode($adh->surname),
                    'lastname_adh'      => 
custom_html_entity_decode($adh->name),
                    'mail_adh'          => custom_html_entity_decode($mailto),
                    'login_adh'         => 
custom_html_entity_decode($adh->login),
                    'deadline'          => 
custom_html_entity_decode($contrib->end_date),
                    'contrib_info'      => 
custom_html_entity_decode($contrib->info),
                    'contrib_amount'    => 
custom_html_entity_decode($contrib->amount),
                    'contrib_type'      => 
custom_html_entity_decode($contrib->type->libelle)
                )
            );

... Et remplacer $adh->email par $mailto dans les lignes suivantes.

J'ai fait cette modification aussi dans ajouter_adherent.php pour envoyer la 
notification lors de l'édition d'une fiche adhérent.

Cordialement,
Nicolas

-----Message d'origine-----
De : Galette-discussion [mailto:galette-discussion-boun...@gna.org] De la part 
de Johan
Envoyé : dimanche 9 octobre 2016 17:28
À : Galette general discussion
Objet : Re: [Galette-discussion] Bug Courriers automatiques adhérents enfants

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Le 9 octobre 2016 16:27:15 GMT+02:00, f.lass...@free.fr a écrit :
>Bonjour,
>
>Toujours sur la version 0.8.2.3 de Galette.
>
>En essayant d'utiliser la fonction "Notifier l'adhérent", lors de 
>l'édition d'une contribution, je me suis aperçu que la notification ne 
>pouvait pas être envoyée à un adhérent enfant (n'ayant pas 
>nécessairement d'adresse mail). J'en déduis qu'on ne remonte pas 
>l'adresse mail de son parent ... (Je sais, je suis chiant avec mes 
>remontées d'infos parents :P )
>
>J'ai donc cherché où on construisait ce mail ...
>J'ai édité le fichier "ajouter_contribution.php" comme suit :
>
>Ligne 247 :
>
>        // Get member informations
>$adh = new Adherent(['parent' => true]); //Ajout de "['parent' => 
>true]", pour remonter les informations du parent
>        $adh->load($contrib->member);
>
>Ligne 268 :
>
>       //if member mail is missing but there is a parent,
>       //take the parent email.
>       if (empty($email) && $adh->hasParent()) {
>           $email = $adh->parent->email;
>        }
>
>L'envoi du mail fonctionne toujours pour un adhérent parent mais, pour 
>un adhérent enfant, il me retourne :
>"
>- AVERTISSEMENT -
>
>Tentative d'envoi de courriel à un adhérent (XXXX XXXX) avec une 
>adresse invalide :"
>
>Le log de Galette me remonte :
>"2016-10-09 14:16:10 - 5 - PHP Notice: Trying to get property of 
>non-object in 
>/home/judocaze/www/galette0823/galette/ajouter_contribution.php on line 
>271"
>
>Si je ne me trompe pas, il me dit qu'il ne connait pas la dépendance 
>"parent" !?...
>
>Une idée, siouplait ??? :)
>
>Merci ! ;)
>Fred
>
>_______________________________________________
>Galette-discussion mailing list
>Galette-discussion@gna.org
>https://mail.gna.org/listinfo/galette-discussion

Salut,

La dépendance ne doit pas être chargée,  une fois de plus.

++
Johan
-----BEGIN PGP SIGNATURE-----
Version: APG v1.1.1

iQFNBAEBCgA3BQJX+mHnMBxKb2hhbiBDd2lrbGluc2tpIChBbmRyb2lkIGtleSkg
PGpvaGFuQHgtdG5kLmJlPgAKCRCwT9J8Q8BdXeLlCACQFW8zSqR48v3OTGX0WYWe
jX8bDILcOiRs1xWc77TSSzJr4WzXEcv4ZPaICi7Kpty1cNVQlB5og0ntbpQcIq4b
PsY9G7/1k+0Lq+DoevE/D+z8b4m3K6uhYYlzQ57LZt/wczJ1Sc479cy4bqu2wJzX
GSkhi7IMI5wy4Afmd9xbYjFgmILi0N8gSTBlaN3AfK/g7LYYSN6ZHN/v39wCMXYb
lXOQ6/g/wvtH6g+Z5L6sh/lzbjOlLnpjmR81dD9r9YbaT28YKNJsWw1Nf9xgF4Yx
qvOlx/nR/35BoxPIgfDQ0NPQyixsUaDiqqhKoSfJTKSH/nz75xMJKF9+md8Ptxy2
=/VHn
-----END PGP SIGNATURE-----


_______________________________________________
Galette-discussion mailing list
Galette-discussion@gna.org
https://mail.gna.org/listinfo/galette-discussion



_______________________________________________
Galette-discussion mailing list
Galette-discussion@gna.org
https://mail.gna.org/listinfo/galette-discussion

Répondre à