Commit b148ef95 authored by jaapjansma's avatar jaapjansma
Browse files

Fixed issue with try out in CiviCRM versions after 5.31.

parent b5bad69f
Version 1.20 (not yet released) Version 1.20
============ ============
* Fixed issue with try out in CiviCRM versions after 5.31.
Version 1.19 Version 1.19
============ ============
......
...@@ -95,7 +95,15 @@ class CRM_FormProcessor_Form_RunFormProcessor extends CRM_Core_Form { ...@@ -95,7 +95,15 @@ class CRM_FormProcessor_Form_RunFormProcessor extends CRM_Core_Form {
], ],
]); ]);
$refreshButton = false;
if (isset($this->_submitValues['_qf_RunFormProcessor_refresh']) && $this->_submitValues['_qf_RunFormProcessor_refresh'] == E::ts('Load')) { if (isset($this->_submitValues['_qf_RunFormProcessor_refresh']) && $this->_submitValues['_qf_RunFormProcessor_refresh'] == E::ts('Load')) {
// Before CiviCRM version 5.31 the submit button value was the label of the button.
$refreshButton = true;
} elseif (isset($this->_submitValues['_qf_RunFormProcessor_refresh']) && $this->_submitValues['_qf_RunFormProcessor_refresh'] == '1') {
// CiviCRM version 5.31 onwards set a '1' value on the submit button.
$refreshButton = true;
}
if ($refreshButton) {
$this->loadDefaultData($this->formProcessorName); $this->loadDefaultData($this->formProcessorName);
} }
} }
...@@ -139,14 +147,32 @@ class CRM_FormProcessor_Form_RunFormProcessor extends CRM_Core_Form { ...@@ -139,14 +147,32 @@ class CRM_FormProcessor_Form_RunFormProcessor extends CRM_Core_Form {
* @since 1.0 * @since 1.0
*/ */
public function validate() { public function validate() {
$return = parent::validate(); // TODO: Change the autogenerated stub $return = parent::validate();
$submitButton = false;
if (isset($this->_submitValues['_qf_RunFormProcessor_submit']) && $this->_submitValues['_qf_RunFormProcessor_submit'] == E::ts('Submit')) {
// Before CiviCRM version 5.31 the submit button value was the label of the button.
$submitButton = true;
} elseif (isset($this->_submitValues['_qf_RunFormProcessor_submit']) && $this->_submitValues['_qf_RunFormProcessor_submit'] == '1') {
// CiviCRM version 5.31 onwards set a '1' value on the submit button.
$submitButton = true;
}
$refreshButton = false;
if (isset($this->_submitValues['_qf_RunFormProcessor_refresh']) && $this->_submitValues['_qf_RunFormProcessor_refresh'] == E::ts('Load')) { if (isset($this->_submitValues['_qf_RunFormProcessor_refresh']) && $this->_submitValues['_qf_RunFormProcessor_refresh'] == E::ts('Load')) {
// Before CiviCRM version 5.31 the submit button value was the label of the button.
$refreshButton = true;
} elseif (isset($this->_submitValues['_qf_RunFormProcessor_refresh']) && $this->_submitValues['_qf_RunFormProcessor_refresh'] == '1') {
// CiviCRM version 5.31 onwards set a '1' value on the submit button.
$refreshButton = true;
}
if ($refreshButton) {
foreach($this->fields as $field) { foreach($this->fields as $field) {
if (isset($this->_errors[$field['name']])) { if (isset($this->_errors[$field['name']])) {
unset($this->_errors[$field['name']]); unset($this->_errors[$field['name']]);
} }
} }
} elseif (isset($this->_submitValues['_qf_RunFormProcessor_submit']) && $this->_submitValues['_qf_RunFormProcessor_submit'] == E::ts('Submit')) { } elseif ($submitButton) {
foreach($this->defaultFields as $field) { foreach($this->defaultFields as $field) {
$submitFieldName = $this->formProcessorName.'_default_'.$field['name']; $submitFieldName = $this->formProcessorName.'_default_'.$field['name'];
if (isset($this->_errors[$submitFieldName])) { if (isset($this->_errors[$submitFieldName])) {
...@@ -167,7 +193,15 @@ class CRM_FormProcessor_Form_RunFormProcessor extends CRM_Core_Form { ...@@ -167,7 +193,15 @@ class CRM_FormProcessor_Form_RunFormProcessor extends CRM_Core_Form {
* This is a virtual function and should be redefined if needed * This is a virtual function and should be redefined if needed
*/ */
public function postProcess() { public function postProcess() {
if (isset($this->_submitValues['_qf_RunFormProcessor_submit']) && $this->_submitValues['_qf_RunFormProcessor_submit'] == E::ts('Submit') && !count($this->_errors)) { $submitted = false;
if (isset($this->_submitValues['_qf_RunFormProcessor_submit']) && $this->_submitValues['_qf_RunFormProcessor_submit'] == E::ts('Submit')) {
// Before CiviCRM version 5.31 the submit button value was the label of the button.
$submitted = true;
} elseif (isset($this->_submitValues['_qf_RunFormProcessor_submit']) && $this->_submitValues['_qf_RunFormProcessor_submit'] == '1') {
// CiviCRM version 5.31 onwards set a '1' value on the submit button.
$submitted = true;
}
if ($submitted && !count($this->_errors)) {
$params = []; $params = [];
foreach($this->fields as $field) { foreach($this->fields as $field) {
$submitFieldName = $field['name']; $submitFieldName = $field['name'];
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url> <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
<url desc="Action-Provider Extension">https://lab.civicrm.org/extensions/action-provider</url> <url desc="Action-Provider Extension">https://lab.civicrm.org/extensions/action-provider</url>
</urls> </urls>
<releaseDate>2020-12-09</releaseDate> <releaseDate>2020-12-14</releaseDate>
<version>1.20-dev</version> <version>1.20</version>
<develStage>stable</develStage> <develStage>stable</develStage>
<compatibility> <compatibility>
<ver>4.7</ver> <ver>4.7</ver>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment