';
$index = 1;
$html .= '';
foreach ($customGrid as $key => $value) {
$html .= '| getServicePath())) . '?ACTION=' . G::encrypt('processABE',
URL_KEY, true) . '&APP_UID=';
$html .= G::encrypt($this->getAppUid(), URL_KEY,
true) . '&DEL_INDEX=' . G::encrypt($this->getindex(), URL_KEY);
$html .= '&FIELD=' . G::encrypt($actionField, URL_KEY,
true) . '&VALUE=' . G::encrypt($value['abe_custom_value'], URL_KEY,
true);
$html .= '&ABER=' . G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY,
true) . '" target="_blank" >' . $value['abe_custom_label'];
$html .= ' | ' . (($index % 5 == 0) ? ' ' : ' ');
$index++;
}
$html .= ' ';
return $html;
}
/**
* Get the html template for link to fill a form
* @todo we need to revise this function
*
* @return string
*/
private function getServicePathTemplate()
{
$abeRequest = $this->getAbeRequest();
$html = '' . G::LoadTranslation('ID_ACTIONS_BY_EMAIL_LINK_TO_FILL_A_FORM') . '';
return $html;
}
/**
* Get the html template for use a field to generate actions links
* @todo we need to revise this function
*
* @return string
*/
private function getFieldTemplate()
{
$abeRequest = $this->getAbeRequest();
$variableService = new Variable();
$variables = $variableService->doGetVariables($this->getCasePropertiesKey('PRO_UID'));
$field = new stdClass();
$field->label = 'Test';
$field->type = 'dropdown';
$field->options = [];
$field->value = '';
$actionField = str_replace(
$this->getPrefix(),
'',
$this->getItemAbeProperties('ABE_ACTION_FIELD')
);
$dynUid = $this->getItemAbeProperties('DYN_UID');
$variables = G::json_decode($this->getItemAbeProperties('DYN_CONTENT'), true);
if (isset($variables['items'][0]['items'])) {
$fields = $variables['items'][0]['items'];
foreach ($fields as $key => $value) {
foreach ($value as $var) {
if (isset($var['variable'])) {
if ($var['variable'] == $actionField) {
$field->label = $var['label'];
$field->type = $var['type'];
$values = $var['options'];
foreach ($values as $val) {
$field->options[$val['value']] = $val['value'];
}
}
}
}
}
}
$obj = new PmDynaform(["CURRENT_DYNAFORM" => $dynUid]);
$this->addItemAbeProperties(['CURRENT_DYNAFORM' => $dynUid]);
$file = $obj->printPmDynaformAbe($this->getTaskAbeProperties());
$html = $file;
$html .= '' . $field->label . ' ';
return $html;
}
/**
* Register the request in the table ABE_REQUEST
*
* @return void
* @throws Exception
*/
private function registerRequest()
{
try {
$requestInstance = new AbeRequests();
$abeRequest['ABE_REQ_UID'] = $requestInstance->createOrUpdate($this->getAbeRequest());
$this->setAbeRequest($abeRequest);
} catch (Exception $error) {
throw $error;
}
}
/**
* Send the message
*
* @param string $template
* @param array $caseData
* @param array $configEmail
*
* @return object
* @throws Exception
*/
private function abeSendMessage($template, array $caseData, array $configEmail)
{
try {
$wsBaseInstance = new WsBase();
$result = $wsBaseInstance->sendMessage(
$this->getAppUid(),
$this->getEmailFrom(),
$this->getEmailTo(),
'',
'',
$this->getSubject(),
$template,
$caseData,
null,
true,
$this->getIndex(),
$configEmail,
0,
WsBase::MESSAGE_TYPE_ACTIONS_BY_EMAIL
);
return $result;
} catch (Exception $error) {
throw $error;
}
}
}
|