merge feature-11468/ZeitsperrenBeruecksichtigen into featuresZeiterfassung/Sprint177

This commit is contained in:
ma0068
2021-10-27 10:47:21 +02:00
parent 63949faef6
commit c3771b9cd0
2 changed files with 89 additions and 1 deletions
+30 -1
View File
@@ -751,6 +751,7 @@ echo '
Jahr=Datum.substring(6,10);
var checkedDay = Jahr + "-" + Monat + "-" + Tag;
checkBisverwendung(checkedDay, uid);
checkZeitsperre(checkedDay, uid);
}
function checkBisverwendung(day, uid)
@@ -775,6 +776,31 @@ echo '
});
}
function checkZeitsperre(day, uid)
{
$.ajax
({
url: "zeitaufzeichnung_zeitsperren.php",
data:
{
day: day,
uid: uid
},
success: function (json)
{
if (json.length > 1)
{
$("#buttonSave").hide();
}
else
{
$("#buttonSave").show();
}
$("#outputZs").html(json);
}
});
}
</script>
</head>
<body>
@@ -1652,6 +1678,9 @@ if ($projekt->getProjekteMitarbeiter($user, true))
</tr>
';
//Zeitsperren
echo '<p id="outputZs"></p>';
//Homeoffice Checkbox
echo '
<tr>
@@ -1672,7 +1701,7 @@ if ($projekt->getProjekteMitarbeiter($user, true))
echo '<tr><td></td><td></td><td></td><td align="right">';
//SpeichernButton
if($zeitaufzeichnung_id == '')
echo '<input type="submit" value="'.$p->t("global/speichern").'" name="save"></td></tr>';
echo '<input id="buttonSave" type="submit" value="'.$p->t("global/speichern").'" name="save"></td></tr>';
else
{
echo '<input type="hidden" value="" name="'.($alle===true?'alle':'').'">';
@@ -0,0 +1,59 @@
<?php
/* Copyright (C) 2021 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Author: Manuela Thamer <manuela.thamer@technikum-wien.at>
*/
/**
* Checks, if there is a zeitsperre for a certain date. It should not be possible
* to add a zeitaufzeichnung with a holiday (or else) entry on the same day.
*/
require_once('../../../config/cis.config.inc.php');
require_once('../../../include/globals.inc.php');
require_once('../../../include/phrasen.class.php');
require_once('../../../include/datum.class.php');
require_once('../../../include/Excel/excel.php');
require_once('../../../include/benutzer.class.php');
require_once('../../../include/benutzerberechtigung.class.php');
require_once('../../../include/mitarbeiter.class.php');
require_once('../../../include/zeitaufzeichnung.class.php');
require_once('../../../include/projekt.class.php');
require_once('../../../include/zeitsperre.class.php');
$sprache = getSprache();
$p = new phrasen($sprache);
if ((isset($_GET['uid'])) && (isset($_GET['day'])))
{
$uid = $_GET['uid'];
$day = $_GET['day'];
$zs = new zeitsperre();
$zs->getZeitsperrenForZeitaufzeichnung($uid, '180');
$zeitsperren = $zs->result;
if (array_key_exists($day, $zeitsperren))
{
echo '<span style="color:red"><b>'.$p->t('zeitaufzeichnung/zeitsperreVorhanden', [$day, $zeitsperren[$day]]).'</b></span><br>';
}
else
{
echo "";
}
}