Skip to content

Commit

Permalink
Option do not prefill offline message.
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Jan 13, 2021
1 parent 7631029 commit 5241d59
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@
<div class="form-group">
<label><?php echo erLhcoreClassAbstract::renderInput('close_on_unload', $fields['close_on_unload'], $object)?> <?php echo $fields['close_on_unload']['trans'];?></label>
</div>

<div class="form-group">
<label><?php echo erLhcoreClassAbstract::renderInput('dont_prefill_offline', $fields['dont_prefill_offline'], $object)?> <?php echo $fields['dont_prefill_offline']['trans'];?></label>
</div>

<div class="form-group">
<label><?php echo $fields['switch_to_human']['trans'];?></label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,16 @@
'validation_definition' => new ezcInputFormDefinitionElement(
ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'
)),
'dont_prefill_offline' => array(
'type' => 'checkbox',
'main_attr' => 'bot_configuration_array',
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/widgettheme','Do not prefill offline message with chat messages.'),
'required' => false,
'hidden' => true,
'nginit' => true,
'validation_definition' => new ezcInputFormDefinitionElement(
ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'
)),
'survey_button' => array(
'type' => 'checkbox',
'main_attr' => 'bot_configuration_array',
Expand Down
8 changes: 6 additions & 2 deletions lhc_web/modules/lhchat/chatwidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,12 @@
$inputData->departament_id = $chatPrefill->dep_id;
$inputData->email = $chatPrefill->email;
$inputData->phone = $chatPrefill->phone;
$inputData->accept_tos = true;
$inputData->question = erLhcoreClassChat::getFirstUserMessage($chatPrefill->id);
$inputData->accept_tos = true;

if (!($theme instanceof erLhAbstractModelWidgetTheme && isset($theme->bot_configuration_array['dont_prefill_offline']) && $theme->bot_configuration_array['dont_prefill_offline'] == true)) {
$inputData->question = erLhcoreClassChat::getFirstUserMessage($chatPrefill->id);
}

} else {
unset($chatPrefill);
}
Expand Down

0 comments on commit 5241d59

Please sign in to comment.