diff --git a/html/AdminDienste.php b/html/AdminDienste.php index c70c6c3..33dd098 100644 --- a/html/AdminDienste.php +++ b/html/AdminDienste.php @@ -19,7 +19,7 @@ if ($AdminStatus != 1) { - + @@ -195,6 +195,11 @@ echo "

+

@@ -319,23 +324,23 @@ echo "

  • Helferdaten geändert
  • "; if ($AdminID != 0) { @@ -554,8 +554,7 @@ function ChangeDienst($db_link, $DienstID, $Was, $Wo, $Info, $Leiter, $Gruppe, $ $Gruppe = mysqli_real_escape_string($db_link, $Gruppe); $HelferLevel = mysqli_real_escape_string($db_link, $HelferLevel); // int (1,2) Teilnehmer oder Dauerhelfer - $sql = "UPDATE Dienst SET Was='" . $Was . "', Wo='" . $Wo . "', Info='" . $Info . "', Leiter=" . $Leiter . ", ElternDienstID=" . $Gruppe . " where DienstID=" . $DienstID; - + $sql = "UPDATE Dienst SET Was='{$Was}', Wo='{$Wo}', Info='{$Info}', Leiter={$Leiter}, ElternDienstID={$Gruppe} where DienstID={$DienstID}"; $db_erg = mysqli_query($db_link, $sql); if (! $db_erg) { echo "Fehler Change Dienst"; diff --git a/html/js/helferdb.js b/html/js/helferdb.js index a943637..7d1de4e 100644 --- a/html/js/helferdb.js +++ b/html/js/helferdb.js @@ -8,6 +8,28 @@ function showPassword(id) } } +function setEndDate() +{ + // js Date .toISOString automatically converts to UTC marking the string by "Z" at the end + // This is not understood by the browser when setting the value of the string + // UTC is 1h off resulting in a 1h wrong time if the Z is removed + // so we add the "Z" here, then remove it in the end + // this works for my local firefox. There should be a check if there already is a Z + // because maybe browsers also convert to UTC for the internal value + // but I guess in the worst case we have ZZ at the end and the js autofill fails + var checkBox = document.getElementById("Schicht-Automatic-Bis"); + if (checkBox.checked == true) + { + var start = new Date(document.getElementById("Schicht-Von").value+'Z'); + var delta = new Date("0000-01-01T"+ document.getElementById("Schicht-Dauer").value); + var end = new Date(start); + var endHours=start.getHours()+delta.getHours(); + end.setHours(endHours); + end.setMinutes(start.getMinutes()+delta.getMinutes()); + document.getElementById("Schicht-Bis").value=end.toISOString().replace(/.000Z/,"");; + } +} + //// https://www.w3schools.com/howto/howto_js_collapsible.asp //var coll = document.getElementsByClassName("collapsible"); //var i;