Bug 33581: Disable sample holiday if libraries are not selected

If libraries are not selected we should not try to insert holidays, or
the installer will fail with a missing FK.

This patch simply disable and uncheck the checkbox when libraries are
not going to be inserted.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2023-06-07 11:31:20 +02:00 committed by Tomas Cohen Arazi
parent c4cb183ae1
commit 1137511e63
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -463,6 +463,15 @@
$( container ).find("input").prop("checked", state);
$( container ).find(".selectall,.deselectall").toggle();
});
function update_sample_libraries_holidays(){
let checked = $("#sample_libraries").prop("checked");
$("#sample_libraries_holidays").prop("disabled", !checked);
if (!checked) {
$("#sample_libraries_holidays").prop("checked", false);
}
};
$("#sample_libraries").on("change", update_sample_libraries_holidays);
$("#sample_libraries").change();
});
</script>
[% END %]