Skip to content

Commit

Permalink
Terms of service field support.
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Jul 14, 2021
1 parent 11d5ac3 commit c751411
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 11 deletions.
13 changes: 13 additions & 0 deletions classes/erlhcoreclasscbschedulervalidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,9 @@ public static function validateSchedule($item, $params) {
'description' => new ezcInputFormDefinitionElement(
ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'
),
'terms_agree' => new ezcInputFormDefinitionElement(
ezcInputFormDefinitionElement::OPTIONAL, 'boolean'
),
'email' => new ezcInputFormDefinitionElement(
ezcInputFormDefinitionElement::OPTIONAL, 'validate_email'
),
Expand Down Expand Up @@ -465,6 +468,16 @@ public static function validateSchedule($item, $params) {
$item->attempt = $form->attempt;
}

if ($form->hasValidData( 'terms_agree' ) && $form->terms_agree == true) {
$item->terms_agree = $form->terms_agree;
} else {
$cbOptions = erLhcoreClassModelChatConfig::fetch('lhcbscheduler_options');
$data = (array)$cbOptions->data;
if (isset($data['terms_of_service']) && $data['terms_of_service'] != '') {
$Errors['terms_of_service'] = erTranslationClassLhTranslation::getInstance()->getTranslation('module/cbscheduler','You have to agree to our terms of service.');
}
}

if ( !$form->hasValidData( 'username' ) || $form->username == '' ) {
$Errors['username'] = erTranslationClassLhTranslation::getInstance()->getTranslation('module/cbscheduler','Please enter a username');
} elseif ($form->hasValidData( 'username' )) {
Expand Down
4 changes: 2 additions & 2 deletions design/cbschedulertheme/js/cbscheduler.legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
var th = document.getElementsByTagName('head')[0];

// Insert CSS
var srcCSS = WWW_DIR_LHC_WEBPACK_ADMIN.replace('/design/defaulttheme/js/admin/dist/','') + '/extension/cbscheduler/design/cbschedulertheme/css/cbscheduler.css?v=5';
var srcCSS = WWW_DIR_LHC_WEBPACK_ADMIN.replace('/design/defaulttheme/js/admin/dist/','') + '/extension/cbscheduler/design/cbschedulertheme/css/cbscheduler.css?v=6';

var styleSheet = document.createElement("link");
styleSheet.setAttribute('rel',"stylesheet");
Expand All @@ -91,7 +91,7 @@
th.appendChild(styleSheet);

// Insert JS
var src = WWW_DIR_LHC_WEBPACK_ADMIN.replace('/design/defaulttheme/js/admin/dist/','') + '/extension/cbscheduler/design/cbschedulertheme/js/scheduler/dist/react.cbscheduler.app.js?v=5';
var src = WWW_DIR_LHC_WEBPACK_ADMIN.replace('/design/defaulttheme/js/admin/dist/','') + '/extension/cbscheduler/design/cbschedulertheme/js/scheduler/dist/react.cbscheduler.app.js?v=6';

var s = document.createElement('script');
s.setAttribute('type','text/javascript');
Expand Down
4 changes: 2 additions & 2 deletions design/cbschedulertheme/js/cbscheduler.widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
var th = document.getElementsByTagName('head')[0];

// Insert CSS
var srcCSS = window.lhcChat['staticJS']['chunk_js'].replace('/design/defaulttheme/js/widgetv2','') + '/extension/cbscheduler/design/cbschedulertheme/css/cbscheduler.css?v=5';
var srcCSS = window.lhcChat['staticJS']['chunk_js'].replace('/design/defaulttheme/js/widgetv2','') + '/extension/cbscheduler/design/cbschedulertheme/css/cbscheduler.css?v=6';

var styleSheet = document.createElement("link");
styleSheet.setAttribute('rel',"stylesheet");
Expand All @@ -102,7 +102,7 @@
th.appendChild(styleSheet);

// Insert JS
var src = window.lhcChat['staticJS']['chunk_js'].replace('/design/defaulttheme/js/widgetv2','') + '/extension/cbscheduler/design/cbschedulertheme/js/scheduler/dist/react.cbscheduler.app.js?v=5';
var src = window.lhcChat['staticJS']['chunk_js'].replace('/design/defaulttheme/js/widgetv2','') + '/extension/cbscheduler/design/cbschedulertheme/js/scheduler/dist/react.cbscheduler.app.js?v=6';

var s = document.createElement('script');
s.setAttribute('type','text/javascript');
Expand Down

This file was deleted.

Loading

0 comments on commit c751411

Please sign in to comment.