Fix issue with form values not being available onn submit
authoreileen <emcnaughton@wikimedia.org>
Thu, 16 Apr 2020 01:37:00 +0000 (13:37 +1200)
committereileen <emcnaughton@wikimedia.org>
Thu, 16 Apr 2020 02:11:04 +0000 (14:11 +1200)
Possible fix for https://civicrm.stackexchange.com/questions/35323/missing-parameters-error-in-unsubscribe-confirmation

The theory is that not having committed the transaction is causing the session not to be saved

CRM/Mailing/Event/BAO/Unsubscribe.php
CRM/Mailing/Form/Unsubscribe.php

index 90c9601dcd484cbe386fdcd9c33cabfd5495e06f..920ae7d3bcfe3c43c2da490d73d009e24d18b5e8 100644 (file)
@@ -122,7 +122,6 @@ WHERE  email = %2
     }
 
     $contact_id = $q->contact_id;
-    $transaction = new CRM_Core_Transaction();
 
     $mailing_id = civicrm_api3('MailingJob', 'getvalue', ['id' => $job_id, 'return' => 'mailing_id']);
     $mailing_type = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $mailing_id, 'mailing_type', 'id');
@@ -262,7 +261,7 @@ WHERE  email = %2
         $groups[$do->group_id] = $do->title;
       }
     }
-
+    $transaction = new CRM_Core_Transaction();
     $contacts = [$contact_id];
     foreach ($groups as $group_id => $group_name) {
       $notremoved = FALSE;
index 9184967f57e4659b9759ce942e1274dbc8c9ef1c..4f2c4f78747be87579de2e9c831513ec5ad13c69 100644 (file)
@@ -121,7 +121,6 @@ class CRM_Mailing_Form_Unsubscribe extends CRM_Core_Form {
       CRM_Core_Session::setStatus($statusMsg, '', 'error');
 
     }
-
   }
 
 }