Bugfix SQL bug empty school dates

when creating new calendar, or copying from existing
Bugfix array_key_exists() expects param 2 to be array

when deleting the only existing calendar