Fix undefined index by making sure that is_template is always defined
authorMatthew Wire <mjw@mjwconsult.co.uk>
Sun, 20 Mar 2022 20:53:20 +0000 (20:53 +0000)
committerMatthew Wire <mjw@mjwconsult.co.uk>
Sun, 20 Mar 2022 23:03:55 +0000 (23:03 +0000)
CRM/Contribute/Form/Contribution.php

index 7a58a71eb2b19cffa33a5adc85aedb964056c474..694b6b346c1665867d5d83c7b8ac3120276493bd 100644 (file)
@@ -280,16 +280,16 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       $this->assignPremiumProduct($this->_id);
       $this->buildValuesAndAssignOnline_Note_Type($this->_id, $this->_values);
     }
+    if (!isset($this->_values['is_template'])) {
+      $this->_values['is_template'] = FALSE;
+    }
+    $this->assign('is_template', $this->_values['is_template']);
 
     // when custom data is included in this page
     if (!empty($_POST['hidden_custom'])) {
       $this->applyCustomData('Contribution', $this->getFinancialTypeID(), $this->_id);
     }
 
-    if (!empty($this->_values['is_template'])) {
-      $this->assign('is_template', TRUE);
-    }
-
     $this->_lineItems = [];
     if ($this->_id) {
       if (!empty($this->_compId) && $this->_compContext === 'participant') {