2015-02-27 17:37:12 -04:00
|
|
|
<?php
|
2015-03-09 17:47:57 -04:00
|
|
|
|
2015-03-13 12:42:51 -04:00
|
|
|
namespace ProcessMaker\BusinessModel;
|
2015-03-09 17:47:57 -04:00
|
|
|
|
2015-02-27 17:37:12 -04:00
|
|
|
/**
|
|
|
|
|
* Description of ActionsByEmailService
|
|
|
|
|
*
|
|
|
|
|
*/
|
2015-03-13 12:42:51 -04:00
|
|
|
class ActionsByEmail
|
2015-02-27 17:37:12 -04:00
|
|
|
{
|
2015-03-09 17:47:57 -04:00
|
|
|
|
2015-02-27 17:37:12 -04:00
|
|
|
public function saveConfiguration($params)
|
|
|
|
|
{
|
2015-03-09 17:47:57 -04:00
|
|
|
if (\PMLicensedFeatures
|
|
|
|
|
::getSingleton()
|
2015-03-10 16:32:57 -04:00
|
|
|
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
|
2015-03-13 12:42:51 -04:00
|
|
|
$feature = $params['ActionsByEmail'];
|
|
|
|
|
switch ($feature['type']) {
|
2015-03-09 17:47:57 -04:00
|
|
|
case 'configuration':
|
|
|
|
|
require_once 'classes/model/AbeConfiguration.php';
|
|
|
|
|
$abeConfigurationInstance = new \AbeConfiguration();
|
2015-03-13 12:42:51 -04:00
|
|
|
$noteValues = json_decode($feature['fields']['ABE_CASE_NOTE_IN_RESPONSE']);
|
2015-03-09 17:47:57 -04:00
|
|
|
foreach ($noteValues as $value) {
|
2015-03-13 12:42:51 -04:00
|
|
|
$feature['fields']['ABE_CASE_NOTE_IN_RESPONSE'] = $value;
|
2015-03-09 17:47:57 -04:00
|
|
|
}
|
2015-03-13 12:42:51 -04:00
|
|
|
$abeConfigurationInstance->createOrUpdate($feature['fields']);
|
2015-03-09 17:47:57 -04:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2015-02-27 17:37:12 -04:00
|
|
|
}
|
|
|
|
|
}
|
2015-03-02 17:42:19 -04:00
|
|
|
|
|
|
|
|
public function loadConfiguration($params)
|
|
|
|
|
{
|
2015-03-09 17:47:57 -04:00
|
|
|
if ($params['type'] != 'activity'
|
2015-03-10 16:32:57 -04:00
|
|
|
|| !\PMLicensedFeatures
|
2015-03-09 17:47:57 -04:00
|
|
|
::getSingleton()
|
2015-03-12 16:27:00 -04:00
|
|
|
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0='))
|
2015-03-09 17:47:57 -04:00
|
|
|
{
|
2015-03-10 16:32:57 -04:00
|
|
|
return false;
|
2015-03-02 17:42:19 -04:00
|
|
|
}
|
|
|
|
|
require_once 'classes/model/AbeConfiguration.php';
|
|
|
|
|
|
|
|
|
|
$criteria = new \Criteria();
|
|
|
|
|
$criteria->add(\AbeConfigurationPeer::PRO_UID, $params['PRO_UID']);
|
|
|
|
|
$criteria->add(\AbeConfigurationPeer::TAS_UID, $params['TAS_UID']);
|
|
|
|
|
$result = \AbeConfigurationPeer::doSelectRS($criteria);
|
|
|
|
|
$result->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
|
|
|
|
$result->next();
|
|
|
|
|
$configuration = array();
|
|
|
|
|
if ($configuration = $result->getRow()) {
|
|
|
|
|
$configuration['ABE_EMAIL_FIELD_VALUE'] = $configuration['ABE_EMAIL_FIELD'];
|
|
|
|
|
$configuration['ABE_ACTION_FIELD_VALUE'] = $configuration['ABE_ACTION_FIELD'];
|
|
|
|
|
$configuration['ABE_CASE_NOTE_IN_RESPONSE'] = $configuration['ABE_CASE_NOTE_IN_RESPONSE'] ? '["1"]' : '[]';
|
|
|
|
|
}
|
|
|
|
|
$configuration['feature'] = 'ActionsByEmail';
|
|
|
|
|
$configuration['prefix'] = 'abe';
|
|
|
|
|
$configuration['PRO_UID'] = $params['PRO_UID'];
|
|
|
|
|
$configuration['TAS_UID'] = $params['TAS_UID'];
|
|
|
|
|
$configuration['SYS_LANG'] = SYS_LANG;
|
|
|
|
|
return $configuration;
|
|
|
|
|
}
|
2015-03-09 17:47:57 -04:00
|
|
|
|
2015-02-27 17:37:12 -04:00
|
|
|
}
|