From e7d7f47da41450da14a49744b4901f58fe668de1 Mon Sep 17 00:00:00 2001 From: eileen Date: Sun, 15 Mar 2020 10:38:28 +1300 Subject: [PATCH] dev/core#1645 fix regression by removing form inheritence The Assign Account form is failing to load because it inherits indirectly from CRM_Admin_Form which now has a different visibility on the _id property. I took a look and there really is no reason for this complex inheritence - this is a standalone form and the setDefaults of the parent seems of no use, let alone the parent's parent. Assign, edit & browse seem to still work fine --- CRM/Financial/Form/FinancialTypeAccount.php | 40 ++++++++++++--------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/CRM/Financial/Form/FinancialTypeAccount.php b/CRM/Financial/Form/FinancialTypeAccount.php index 4058a29efe..3c0f438920 100644 --- a/CRM/Financial/Form/FinancialTypeAccount.php +++ b/CRM/Financial/Form/FinancialTypeAccount.php @@ -18,7 +18,7 @@ /** * This class generates form components for Financial Type Account */ -class CRM_Financial_Form_FinancialTypeAccount extends CRM_Contribute_Form { +class CRM_Financial_Form_FinancialTypeAccount extends CRM_Core_Form { /** * The financial type id saved to the session for an update. @@ -102,6 +102,28 @@ class CRM_Financial_Form_FinancialTypeAccount extends CRM_Contribute_Form { */ public function buildQuickForm() { parent::buildQuickForm(); + if ($this->_action & CRM_Core_Action::VIEW || $this->_action & CRM_Core_Action::PREVIEW) { + $this->addButtons([ + [ + 'type' => 'cancel', + 'name' => ts('Done'), + 'isDefault' => TRUE, + ], + ]); + } + else { + $this->addButtons([ + [ + 'type' => 'next', + 'name' => $this->_action & CRM_Core_Action::DELETE ? ts('Delete') : ts('Save'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); + } $this->setPageTitle(ts('Financial Type Account')); if ($this->_action & CRM_Core_Action::DELETE) { @@ -169,22 +191,6 @@ class CRM_Financial_Form_FinancialTypeAccount extends CRM_Contribute_Form { TRUE ); - $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Save'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'next', - 'name' => ts('Save and New'), - 'subName' => 'new', - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ]); $this->addFormRule(['CRM_Financial_Form_FinancialTypeAccount', 'formRule'], $this); } -- 2.25.1