From e843748ff5770df04f8380e8545b3a9f9c919eed Mon Sep 17 00:00:00 2001 From: eileen Date: Wed, 18 Jul 2018 13:19:56 +1200 Subject: [PATCH] Fix misformatted start_date default on new contribution page Unreleased regression from https://github.com/civicrm/civicrm-core/pull/11881 see https://lab.civicrm.org/dev/core/issues/263 --- CRM/Contribute/Form/ContributionPage.php | 3 +++ CRM/Contribute/Form/ContributionPage/Settings.php | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/CRM/Contribute/Form/ContributionPage.php b/CRM/Contribute/Form/ContributionPage.php index 560a147502..bc3f23d03e 100644 --- a/CRM/Contribute/Form/ContributionPage.php +++ b/CRM/Contribute/Form/ContributionPage.php @@ -336,6 +336,9 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form { else { $defaults['is_active'] = 1; // set current date as start date + // @todo look to change to $defaults['start_date'] = date('Ymd His'); + // main settings form overrides this to implement above but this is left here + // 'in case' another extending form uses start_date - for now list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults(); } diff --git a/CRM/Contribute/Form/ContributionPage/Settings.php b/CRM/Contribute/Form/ContributionPage/Settings.php index 08dd22a176..7e94089ef4 100644 --- a/CRM/Contribute/Form/ContributionPage/Settings.php +++ b/CRM/Contribute/Form/ContributionPage/Settings.php @@ -44,6 +44,11 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ */ public function setDefaultValues() { $defaults = parent::setDefaultValues(); + // @todo handle properly on parent. + if (!$this->_id) { + $defaults['start_date'] = date('Y-m-d H:i:s'); + unset($defaults['start_time']); + } $soft_credit_types = CRM_Core_OptionGroup::values('soft_credit_type', TRUE, FALSE, FALSE, NULL, 'name'); if ($this->_id) { -- 2.25.1