]> git.agnieray.net Git - galette.git/commitdiff
Contribution email was not sent to member
authorJohan Cwiklinski <johan@x-tnd.be>
Wed, 7 Oct 2020 02:27:19 +0000 (04:27 +0200)
committerJohan Cwiklinski <johan@x-tnd.be>
Wed, 7 Oct 2020 02:27:19 +0000 (04:27 +0200)
galette/lib/Galette/Controllers/Crud/ContributionsController.php
galette/lib/Galette/Events/ContribListener.php

index 5b82ba629b3fc4d4a4331f457abeeb35ef1c9b6a..32b96d9dd312bc018b2e99f65a20d4c332a864af 100644 (file)
@@ -571,6 +571,11 @@ class ContributionsController extends CrudController
             }
 
             if (count($error_detected) == 0) {
+                // send email to member
+                if (isset($post['mail_confirm']) && $post['mail_confirm'] == '1') {
+                    $contrib->setSendmail(); //flag to send creation email
+                }
+
                 $store = $contrib->store();
                 if ($store === true) {
                     $this->flash->addMessage(
@@ -585,11 +590,6 @@ class ContributionsController extends CrudController
         }
 
         if (count($error_detected) == 0) {
-            // send email to member
-            if (isset($post['mail_confirm']) && $post['mail_confirm'] == '1') {
-                $contrib->setSendmail(); //flag to send creation email
-            }
-
             $this->session->contribution = null;
             if ($contrib->isTransactionPart() && $contrib->transaction->getMissingAmount() > 0) {
                 //new contribution
index f609251e6ae0987a6fa242e0784aa367c8be7112..a614a598eca00291d21de23d25633cf37017a4ad 100644 (file)
@@ -192,12 +192,12 @@ class ContribListener implements ListenerProviderInterface
     /**
      * Send account email to member
      *
-     * @param Adherent $member Member
-     * @param boolean  $new    New member or editing existing one
+     * @param Contribution $contrib Contribution
+     * @param boolean      $new     New contribution or editing existing one
      *
      * @return void
      */
-    private function sendContribEmail(Adherent $member, $new)
+    private function sendContribEmail(Contribution $contrib, $new)
     {
         if ($this->preferences->pref_mail_method == GaletteMail::METHOD_DISABLED) {
             //if email has been disabled in the preferences, we should not be here ;