Session: Improve access date values from template - refs BT#20928

pull/5007/head
christian 1 year ago
parent 347af69df5
commit ad2d2bbbd0
  1. 12
      public/main/inc/lib/sessionmanager.lib.php
  2. 10
      public/main/session/session_add.php

@ -8121,9 +8121,9 @@ class SessionManager
// Dates
$form->addDateTimePicker(
'access_start_date2',
'access_start_date',
[get_lang('Access start'), get_lang('Date on which the session is made available to all')],
['id' => 'access_start_date2']
['id' => 'access_start_date']
);
$form->addDateTimePicker(
@ -8133,19 +8133,19 @@ class SessionManager
);
$form->addRule(
['access_start_date2', 'access_end_date'],
['access_start_date', 'access_end_date'],
get_lang('Start date must be before the end date'),
'compare_datetime_text',
'< allow_empty'
);
$form->addDateTimePicker(
'display_start_date2',
'display_start_date',
[
get_lang('Start date to display'),
get_lang('Date that will be shown in the session information as the date on which the session starts'),
],
['id' => 'display_start_date2']
['id' => 'display_start_date']
);
$form->addDateTimePicker(
@ -8158,7 +8158,7 @@ class SessionManager
);
$form->addRule(
['display_start_date2', 'display_end_date'],
['display_start_date', 'display_end_date'],
get_lang('Start date must be before the end date'),
'compare_datetime_text',
'< allow_empty'

@ -164,7 +164,9 @@ $(function() {
function repopulateFormValues() {
var formValues = JSON.parse(sessionStorage.getItem('formValues'));
$.each(formValues, function(i, field) {
$('[name=\"' + field.name + '\"]').val(field.value);
if (field.name === 'coach_username' || field.name === 'name' || field.name === 'system_template') {
$('[name=\"' + field.name + '\"]').val(field.value);
}
});
}
@ -225,9 +227,9 @@ if (!$formSent) {
'show_description' => $session->getShowDescription(),
'duration' => $session->getDuration(),
'session_visibility' => $session->getVisibility(),
'display_start_date2' => $session->getDisplayStartDate() ? api_get_local_time($session->getDisplayStartDate()) : null,
'display_start_date' => $session->getDisplayStartDate() ? api_get_local_time($session->getDisplayStartDate()) : null,
'display_end_date' => $session->getDisplayEndDate() ? api_get_local_time($session->getDisplayEndDate()) : null,
'access_start_date2' => $session->getAccessStartDate() ? api_get_local_time($session->getAccessStartDate()) : null,
'access_start_date' => $session->getAccessStartDate() ? api_get_local_time($session->getAccessStartDate()) : null,
'access_end_date' => $session->getAccessEndDate() ? api_get_local_time($session->getAccessEndDate()) : null,
'coach_access_start_date' => $session->getCoachAccessStartDate() ? api_get_local_time($session->getCoachAccessStartDate()) : null,
'coach_access_end_date' => $session->getCoachAccessEndDate() ? api_get_local_time($session->getCoachAccessEndDate()) : null,
@ -241,7 +243,7 @@ if (!$formSent) {
'session_template' => $session->getName(),
];
} else {
$formDefaults['access_start_date2'] = $formDefaults['display_start_date2'] = api_get_local_time();
$formDefaults['access_start_date'] = $formDefaults['display_start_date'] = api_get_local_time();
$formDefaults['coach_username'] = [api_get_user_id()];
}
}

Loading…
Cancel
Save