Fix save learning path without enable start time - refs BT#12085

pull/2487/head
Angel Fernando Quiroz Campos 9 years ago
parent d9e2c7220f
commit b749201ba5
  1. 13
      main/lp/learnpath.class.php
  2. 4
      main/lp/lp_edit.php

@ -779,12 +779,13 @@ class learnpath
if (empty($publicated_on)) { if (empty($publicated_on)) {
//by default the publication date is the same that the creation date //by default the publication date is the same that the creation date
//The behaviour above was changed due BT#2800 //The behaviour above was changed due BT#2800
global $_custom; // global $_custom;
if (isset($_custom['lps_hidden_when_no_start_date']) && $_custom['lps_hidden_when_no_start_date']) { // if (isset($_custom['lps_hidden_when_no_start_date']) && $_custom['lps_hidden_when_no_start_date']) {
$publicated_on = ''; // $publicated_on = null;
} else { // } else {
$publicated_on = api_get_utc_datetime(); // $publicated_on = null;
} // }
$publicated_on = null;
} else { } else {
$publicated_on = Database::escape_string(api_get_utc_datetime($publicated_on)); $publicated_on = Database::escape_string(api_get_utc_datetime($publicated_on));
} }

@ -157,7 +157,7 @@ $form->addElement(
); );
$display_date = 'none'; $display_date = 'none';
if (!empty($publicated_on)) { if (!empty($publicated_on) && $publicated_on !== '0000-00-00 00:00:00') {
$display_date = 'block'; $display_date = 'block';
$defaults['activate_start_date_check'] = 1; $defaults['activate_start_date_check'] = 1;
} }
@ -220,7 +220,7 @@ if ($enableLpExtraFields) {
} }
$defaults['publicated_on'] = (!empty($publicated_on))? api_get_local_time($publicated_on) : date('Y-m-d 12:00:00'); $defaults['publicated_on'] = !empty($publicated_on) && $publicated_on !== '0000-00-00 00:00:00' ? api_get_local_time($publicated_on) : null;
$defaults['expired_on'] = (!empty($expired_on) )? api_get_local_time($expired_on): date('Y-m-d 12:00:00', time()+84600); $defaults['expired_on'] = (!empty($expired_on) )? api_get_local_time($expired_on): date('Y-m-d 12:00:00', time()+84600);
$defaults['subscribe_users'] = $_SESSION['oLP']->getSubscribeUsers(); $defaults['subscribe_users'] = $_SESSION['oLP']->getSubscribeUsers();
$form->setDefaults($defaults); $form->setDefaults($defaults);

Loading…
Cancel
Save