Enhance autofill of end date when creating an event
This commit is contained in:
parent
b721930b3b
commit
bca9a84710
@ -839,7 +839,6 @@ if ($action == 'create')
|
|||||||
$("#p2").removeAttr("disabled");
|
$("#p2").removeAttr("disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setdatefields();
|
|
||||||
$("#fullday").change(function() {
|
$("#fullday").change(function() {
|
||||||
console.log("setdatefields");
|
console.log("setdatefields");
|
||||||
setdatefields();
|
setdatefields();
|
||||||
@ -858,6 +857,20 @@ if ($action == 'create')
|
|||||||
if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
|
if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
|
||||||
else $("#dateend").removeClass("fieldrequired");
|
else $("#dateend").removeClass("fieldrequired");
|
||||||
});
|
});
|
||||||
|
$("#aphour,#apmin").change(function() {
|
||||||
|
if ($("#actioncode").val() == \'AC_RDV\') {
|
||||||
|
console.log("Start date was changed, we modify end date "+(parseInt($("#aphour").val()))+" "+$("#apmin").val()+" -> "+("00" + (parseInt($("#aphour").val()) + 1)).substr(-2,2));
|
||||||
|
$("#p2hour").val(("00" + (parseInt($("#aphour").val()) + 1)).substr(-2,2));
|
||||||
|
$("#p2min").val($("#apmin").val());
|
||||||
|
$("#p2day").val($("#apday").val());
|
||||||
|
$("#p2month").val($("#apmonth").val());
|
||||||
|
$("#p2year").val($("#apyear").val());
|
||||||
|
$("#p2").val($("#ap").val());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
|
||||||
|
else $("#dateend").removeClass("fieldrequired");
|
||||||
|
setdatefields();
|
||||||
})';
|
})';
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
}
|
}
|
||||||
@ -880,8 +893,8 @@ if ($action == 'create')
|
|||||||
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||||
{
|
{
|
||||||
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("Type").'</span></b></td><td>';
|
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("Type").'</span></b></td><td>';
|
||||||
$default = (empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT) ? '' : $conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT);
|
$default = (empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT) ? 'AC_RDV' : $conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT);
|
||||||
$formactions->select_type_actions(GETPOST("actioncode", 'aZ09') ?GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default), "actioncode", "systemauto", 0, -1);
|
$formactions->select_type_actions(GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default), "actioncode", "systemauto", 0, -1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5594,9 +5594,11 @@ class Form
|
|||||||
if ($addnowlink == 1)
|
if ($addnowlink == 1)
|
||||||
{
|
{
|
||||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H', 'tzuser').'\');';
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H', 'tzuser').'\');';
|
||||||
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
|
||||||
} elseif ($addnowlink == 2)
|
} elseif ($addnowlink == 2)
|
||||||
{
|
{
|
||||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());';
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());';
|
||||||
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fullday) $reset_scripts .= ' } ';
|
if ($fullday) $reset_scripts .= ' } ';
|
||||||
@ -5609,9 +5611,11 @@ class Form
|
|||||||
if ($addnowlink == 1)
|
if ($addnowlink == 1)
|
||||||
{
|
{
|
||||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M', 'tzuser').'\');';
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M', 'tzuser').'\');';
|
||||||
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
|
||||||
} elseif ($addnowlink == 2)
|
} elseif ($addnowlink == 2)
|
||||||
{
|
{
|
||||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());';
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());';
|
||||||
|
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
|
||||||
}
|
}
|
||||||
if ($fullday) $reset_scripts .= ' } ';
|
if ($fullday) $reset_scripts .= ' } ';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user