Fix save feature via REST services
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Features;
|
||||
namespace \Features\ActionsByEmail;
|
||||
/**
|
||||
* Description of ActionsByEmailFeature
|
||||
*
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
namespace Features\ActionsByEmail;
|
||||
/**
|
||||
* Description of ActionsByEmailService
|
||||
*
|
||||
*/
|
||||
class ActionsByEmailService
|
||||
{
|
||||
public function saveConfiguration($params)
|
||||
{
|
||||
switch ($params['type']) {
|
||||
case 'configuration':
|
||||
require_once 'classes/model/AbeConfiguration.php';
|
||||
$abeConfigurationInstance = new \AbeConfiguration();
|
||||
$abeConfigurationInstance->createOrUpdate($params['fields']);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
'type' => 'checkbox',
|
||||
'labelVisible' => false,
|
||||
'options' => array(
|
||||
array(
|
||||
'id' => 'formTimingControlOption',
|
||||
'label' => 'Register a Case Note when the recipient submits the Response',
|
||||
'type' => 'checkbox'
|
||||
'value' => '1'
|
||||
)
|
||||
)
|
||||
),
|
||||
// array(
|
||||
// 'name' => 'APPLY_CHANGES',
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Features;
|
||||
/**
|
||||
* Description of FeatureManager
|
||||
@@ -14,20 +13,51 @@ class FeaturesHandler
|
||||
}
|
||||
}
|
||||
|
||||
public function retrieveConfiguration($params)
|
||||
{
|
||||
foreach ($this->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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user