Commit 0d5b85b9 authored by jaapjansma's avatar jaapjansma

Fixed issue when output handler is not set breaking the whole form processor.

parent f4258cd6
Version 1.8 (not yet released)
===========
* Fixed issue when output handler is not set breaking the whole form processor.
Version 1.7
===========
* fixed notice in FormProcessor->invokeFormProcessor
* Fixed notice in FormProcessor->invokeFormProcessor
* Fixed #9 Error in the default value
* Fixed #11 Errors in DateType validation
* Added try out functionality.
......
......@@ -34,23 +34,25 @@
$row['actions'] = array_values(CRM_FormProcessor_BAO_FormProcessorAction::getValues(array('form_processor_instance_id' => $formProcessorInstance->id)));
$row['default_data_inputs'] = array_values(CRM_FormProcessor_BAO_FormProcessorDefaultDataInput::getValues(array('form_processor_instance_id' => $formProcessorInstance->id)));
$row['default_data_actions'] = array_values(CRM_FormProcessor_BAO_FormProcessorDefaultDataAction::getValues(array('form_processor_instance_id' => $formProcessorInstance->id)));
if (isset($row['output_handler_configuration']) && is_string($row['output_handler_configuration'])) {
$row['output_handler_configuration'] = json_decode($row['output_handler_configuration'], true);
}
if (empty($row['output_handler_configuration']) || !is_array($row['output_handler_configuration'])) {
$row['output_handler_configuration'] = array();
}
$handler = \Civi::service('form_processor_output_handler_factory')->getHandlerByName($row['output_handler']);
if ($handler) {
$configuration = $handler->getDefaultConfiguration();
if (isset($row['output_handler_configuration']) && is_string($row['output_handler_configuration'])) {
$row['output_handler_configuration'] = json_decode($row['output_handler_configuration'], true);
}
if (empty($row['output_handler_configuration']) || !is_array($row['output_handler_configuration'])) {
$row['output_handler_configuration'] = array();
}
foreach($row['output_handler_configuration'] as $name => $value) {
$configuration->set($name, $value);
}
$handler->setConfiguration($configuration);
$row['output_handler'] = $handler;
}
$handler = null;
if ($row['output_handler']) {
$handler = \Civi::service('form_processor_output_handler_factory')->getHandlerByName($row['output_handler']);
if ($handler) {
$configuration = $handler->getDefaultConfiguration();
foreach ($row['output_handler_configuration'] as $name => $value) {
$configuration->set($name, $value);
}
$handler->setConfiguration($configuration);
$row['output_handler'] = $handler;
}
}
if (isset($row['default_data_output_configuration']) && is_string($row['default_data_output_configuration'])) {
$row['default_data_output_configuration'] = json_decode($row['default_data_output_configuration'], true);
......
......@@ -28,7 +28,9 @@ function civicrm_api3_form_processor_instance_get($params) {
}
// Convert output handler object to array
$returnValues[$index]['output_handler'] = $returnValues[$index]['output_handler']->toArray();
if (is_object($returnValues[$index]['output_handler'])) {
$returnValues[$index]['output_handler'] = $returnValues[$index]['output_handler']->toArray();
}
$returnValues[$index]['try_out_url'] = \CRM_Utils_System::url('civicrm/admin/automation/formprocessor/run', ['_qf_formProcessorName' => $formProcessor['name']]);
}
return civicrm_api3_create_success($returnValues, $params, 'FormProcessorInstance', 'Get');
......
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