diff --git a/workflow/engine/Features/ActionsByEmail/ActionsByEmailFeature.php b/workflow/engine/Features/ActionsByEmail/ActionsByEmailFeature.php index 9644ed55a..92f7925e2 100644 --- a/workflow/engine/Features/ActionsByEmail/ActionsByEmailFeature.php +++ b/workflow/engine/Features/ActionsByEmail/ActionsByEmailFeature.php @@ -1,6 +1,6 @@ createOrUpdate($params['fields']); + break; + default: + break; + } + } +} diff --git a/workflow/engine/Features/ActionsByEmail/views/ActivityConfigurationView.php b/workflow/engine/Features/ActionsByEmail/views/ActivityConfigurationView.php index 80e77500f..5166e7349 100644 --- a/workflow/engine/Features/ActionsByEmail/views/ActivityConfigurationView.php +++ b/workflow/engine/Features/ActionsByEmail/views/ActivityConfigurationView.php @@ -55,20 +55,17 @@ class ActivityConfigurationView 'type' => 'dropdown', 'options' => array( array( - 'name' => '', + 'label' => '- None -', 'value' => '', - 'text' => '- None -', 'type' => 'default' ), array( - 'name' => 'LINK', + 'label' => 'Link to fill a form', 'value' => 'LINK', - 'text' => 'Link to fill a form', ), array( - 'name' => 'FIELD', + 'label' => 'Use a field to generate actions links', 'value' => 'FIELD', - 'text' => 'Use a field to generate actions links', ) ) ), @@ -84,9 +81,8 @@ class ActivityConfigurationView ), 'options' => array( array( - 'name' => '', 'value' => '', - 'text' => '- Select a Template -', + 'label' => '- Select a Template -', 'type' => 'default' ) ) @@ -118,9 +114,8 @@ class ActivityConfigurationView ), 'options' => array( array( - 'name' => '', 'value' => '', - 'text' => '- Select a Dynaform -', + 'label' => '- Select a Dynaform -', 'type' => 'default' ) ), @@ -137,9 +132,8 @@ class ActivityConfigurationView 'type' => 'dropdown', 'options' => array( array( - 'name' => '', 'value' => '', - 'text' => '- Send to the email of the assigned user to the task -', + 'label' => '- Send to the email of the assigned user to the task -', 'type' => 'default' ) ), @@ -165,9 +159,8 @@ class ActivityConfigurationView 'type' => 'dropdown', 'options' => array( array( - 'name' => '', 'value' => '', - 'text' => '- Select a Field -', + 'label' => '- Select a Field -', 'type' => 'default' ) ), @@ -186,10 +179,15 @@ class ActivityConfigurationView ), array( 'name' => 'ABE_CASE_NOTE_IN_RESPONSE', - 'value' => true, - 'default' => false, - 'label' => 'Register a Case Note when the recipient submits the Response', - 'type' => 'checkbox' + 'type' => 'checkbox', + 'labelVisible' => false, + 'options' => array( + array( + 'id' => 'formTimingControlOption', + 'label' => 'Register a Case Note when the recipient submits the Response', + 'value' => '1' + ) + ) ), // array( // 'name' => 'APPLY_CHANGES', diff --git a/workflow/engine/Features/FeaturesHandler.php b/workflow/engine/Features/FeaturesHandler.php index 188b24cfc..997b788b4 100644 --- a/workflow/engine/Features/FeaturesHandler.php +++ b/workflow/engine/Features/FeaturesHandler.php @@ -1,5 +1,4 @@ getFeatureList() as $feature) { + + } + } + + public function saveConfiguration($type, $configurationForms) + { + foreach ($configurationForms as $feature => $form) { + $service = $this->getFeatureService(array('name' => $feature)); + $service->saveConfiguration($form); + } + return true; + } + public function getFeatureList() { $invalidFolders = array('ViewContainers'); $featuresFolders = glob(PATH_FEATURES.'/*', GLOB_ONLYDIR); $features = array(); foreach ($featuresFolders as $directory) { - $feature = new stdClass(); - if (in_array($directory, $invalidFolders)) { + $feature = new \stdClass(); + $featureName = basename($directory); + if (in_array($featureName, $invalidFolders)) { continue; } - $feature->path = PATH_FEATURES . PATH_SEP . $directory; - $feature->name = $directory; + $feature->path = PATH_FEATURES . $featureName; + $feature->name = $featureName; $features[] = $feature; } return $features; } + + public function getFeatureService($params) + { + $features = $this->getFeatureList(); + foreach ($features as $feature) { + if ($params['name'] == $feature->name) { + $className = $feature->name . 'Service'; + $namespace = '\\Features\\' . $feature->name . '\\' . $className; + require_once $feature->path . PATH_SEP . $className . '.php'; + $service = new $namespace(); + return $service; + } + } + } } diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project/Activity.php b/workflow/engine/src/ProcessMaker/Services/Api/Project/Activity.php index 559852d2d..27ba8deca 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Project/Activity.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project/Activity.php @@ -106,6 +106,10 @@ class Activity extends Api } $task = new \ProcessMaker\BusinessModel\Task(); $properties = $task->updateProperties($prj_uid, $act_uid, $request_data); + /** features */ + $featureHandler = new \Features\FeaturesHandler(); + $featureHandler->saveConfiguration('activity', $request_data['properties']['_features']); + /** features */ } catch (\Exception $e) { throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); }