mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
Merge branch 'feature-4834/Zeitaufzeichnung_OhneUeberlappung'
This commit is contained in:
@@ -37,8 +37,8 @@ $person = new person();
|
||||
$person->getPersonFromBenutzer($user);
|
||||
|
||||
|
||||
$show = (isset($_POST['show']) ? $_POST['show'] : 'aktuell'); //show: alle / aktuell
|
||||
$is_popup = (isset($_GET['verpflichtend']) && $_GET['verpflichtend'] == true) ? true : false;
|
||||
$show = (isset($_POST['show']) ? $_POST['show'] : 'aktuell'); //show: alle / aktuell
|
||||
$is_popup = (isset($_GET['verpflichtend']) && $_GET['verpflichtend'] == true) ? true : false;
|
||||
//Leiter OEs holen
|
||||
$benutzerfunktion = new benutzerfunktion();
|
||||
$benutzerfunktion->getBenutzerFunktionen('Leitung', '', '', $user);
|
||||
@@ -80,7 +80,7 @@ if($type=='bestaetigen' && is_numeric($ampel_id))
|
||||
$message='';
|
||||
if($ampel->load($ampel_id))
|
||||
{
|
||||
if($ampel->isZugeteilt($user, $ampel->benutzer_select))
|
||||
if($ampel->isZugeteilt($user, $ampel->benutzer_select))
|
||||
{
|
||||
if(!$ampel->isBestaetigt($user, $ampel_id))
|
||||
{
|
||||
@@ -88,7 +88,7 @@ if($type=='bestaetigen' && is_numeric($ampel_id))
|
||||
{
|
||||
echo '<script type="text/javascript">window.parent.loadampel();</script>';
|
||||
header('Refresh:0');
|
||||
exit;
|
||||
exit;
|
||||
}
|
||||
else
|
||||
$message = '<span class="error">'.$ampel->errormsg.'</span>';
|
||||
@@ -99,7 +99,7 @@ if($type=='bestaetigen' && is_numeric($ampel_id))
|
||||
}
|
||||
else
|
||||
$message = '<span class="error">'.$p->t('tools/ampelNichtGefunden').'</span>';
|
||||
|
||||
|
||||
if ($message != '')
|
||||
echo '<div class="alert alert-danger" role="alert">' . $message . '</div>';
|
||||
}
|
||||
@@ -107,7 +107,7 @@ if($type=='bestaetigen' && is_numeric($ampel_id))
|
||||
|
||||
//get all user ampeln
|
||||
list(
|
||||
$user_ampel_arr,
|
||||
$user_ampel_arr,
|
||||
$cnt_ueberfaellig) = //counts overdue ampeln (not expired)
|
||||
getUserAmpelData($user);
|
||||
|
||||
@@ -118,7 +118,7 @@ if (!empty($user_ampel_arr))
|
||||
}
|
||||
|
||||
//filter ampeln for popup (if at least one mandatory, which is neither expired nor before vorlaufzeit)
|
||||
if ($is_popup)
|
||||
if ($is_popup)
|
||||
{
|
||||
list(
|
||||
$user_ampel_arr,
|
||||
@@ -135,14 +135,14 @@ if (!$is_popup && $show == 'aktuell')
|
||||
function getUserAmpelData($user)
|
||||
{
|
||||
$cnt_ueberfaellig = 0;
|
||||
|
||||
|
||||
$ampel = new ampel();
|
||||
$ampel->loadUserAmpel($user, true);
|
||||
$user_ampel_arr = array();
|
||||
|
||||
|
||||
$datum = new datum();
|
||||
$now = $datum->mktime_fromdate(date('Y-m-d'));
|
||||
|
||||
|
||||
foreach($ampel->result as $row)
|
||||
{
|
||||
$deadline = $datum->mktime_fromdate($row->deadline);
|
||||
@@ -150,23 +150,23 @@ function getUserAmpelData($user)
|
||||
$verfallszeit = $row->verfallszeit;
|
||||
$bestaetigt = $ampel->isBestaetigt($user, $row->ampel_id);
|
||||
$verpflichtend = $row->verpflichtend; // 't'/'f'
|
||||
|
||||
|
||||
$datum_liegt_vor_vorlaufzeit = false;
|
||||
$datum_liegt_nach_verfallszeit = false;
|
||||
|
||||
|
||||
if (!is_null($vorlaufzeit))
|
||||
$datum_liegt_vor_vorlaufzeit = $now < strtotime('-' . $vorlaufzeit . ' day', $deadline);
|
||||
|
||||
$datum_liegt_vor_vorlaufzeit = $now < strtotime('-' . $vorlaufzeit . ' day', $deadline);
|
||||
|
||||
if (!is_null($verfallszeit))
|
||||
$datum_liegt_nach_verfallszeit = $now > strtotime('+' . $verfallszeit . ' day', $deadline);
|
||||
|
||||
//default
|
||||
$show_ampel = true; //true while actual date is not before vorlaufzeit
|
||||
$abgelaufen = false; //false while actual date is not after verfallszeit
|
||||
$active = true; //true while not confirmed or expired
|
||||
$active = true; //true while not confirmed or expired
|
||||
$status = 'gelb'; //yellow while not overdue (red) or confirmed (green)
|
||||
$status_ampel = ''; //ampel image
|
||||
|
||||
|
||||
if ($bestaetigt)
|
||||
$status = 'gruen';
|
||||
|
||||
@@ -174,21 +174,21 @@ function getUserAmpelData($user)
|
||||
if ($datum_liegt_vor_vorlaufzeit)
|
||||
$show_ampel = false;
|
||||
|
||||
|
||||
|
||||
if ($datum_liegt_nach_verfallszeit)
|
||||
$abgelaufen = true;
|
||||
|
||||
|
||||
if ($now >= $deadline && !$bestaetigt)
|
||||
if ($now >= $deadline && !$bestaetigt)
|
||||
{
|
||||
if (!$abgelaufen)
|
||||
$cnt_ueberfaellig++;
|
||||
$status = 'rot';
|
||||
}
|
||||
|
||||
|
||||
if ($bestaetigt || $abgelaufen)
|
||||
$active = false;
|
||||
|
||||
|
||||
//assign png-image to ampelstatus
|
||||
switch($status)
|
||||
{
|
||||
@@ -205,7 +205,7 @@ function getUserAmpelData($user)
|
||||
$status_ampel= '<img name="A" src="../../../skin/images/ampel_gruen.png" >';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$user_ampel_arr[] = array(
|
||||
'ampel_id' => $row->ampel_id,
|
||||
'kurzbz' => $row->kurzbz,
|
||||
@@ -216,23 +216,23 @@ function getUserAmpelData($user)
|
||||
'bestaetigt' => $bestaetigt,
|
||||
'deadline' => $row->deadline,
|
||||
'vorlaufzeit' => $row->vorlaufzeit,
|
||||
'verfallszeit' => $row->verfallszeit,
|
||||
'verfallszeit' => $row->verfallszeit,
|
||||
'beschreibung' => $row->beschreibung,
|
||||
'abgelaufen' => $abgelaufen,
|
||||
'active' => $active);
|
||||
}
|
||||
|
||||
|
||||
return array($user_ampel_arr, $cnt_ueberfaellig);
|
||||
}
|
||||
function sortUserAmpelData($user_ampel_arr)
|
||||
{
|
||||
//first: sort deadline
|
||||
$deadline_arr = array();
|
||||
foreach ($user_ampel_arr as $key => $val)
|
||||
foreach ($user_ampel_arr as $key => $val)
|
||||
{
|
||||
$deadline_arr[$key] = $val['deadline'];
|
||||
}
|
||||
|
||||
|
||||
array_multisort($deadline_arr, SORT_DESC, $user_ampel_arr);
|
||||
|
||||
//second: sort inactive after active
|
||||
@@ -247,7 +247,7 @@ function sortUserAmpelData($user_ampel_arr)
|
||||
else
|
||||
{
|
||||
$inactive_ampel_arr[] = $user_ampel;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $user_ampel_arr = array_merge($active_ampel_arr, $inactive_ampel_arr);
|
||||
}
|
||||
@@ -292,7 +292,7 @@ function getActualUserAmpelData($user_ampel_arr, $semester_start)
|
||||
|
||||
<!--style for sancho typewriting effect-->
|
||||
<style>
|
||||
|
||||
|
||||
.cursor:after {
|
||||
opacity: 0;
|
||||
animation: cursor 1s infinite;
|
||||
@@ -314,7 +314,7 @@ function getActualUserAmpelData($user_ampel_arr, $semester_start)
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!--script for sancho typewriting effect-->
|
||||
<script>
|
||||
@@ -344,39 +344,39 @@ function typeWrite(span){
|
||||
|
||||
|
||||
<body style="font-family: Arial, Helvetica, sans-serif; font-size: 13px;">
|
||||
<div class="container-fluid" style="padding: 0px;">
|
||||
|
||||
<?php
|
||||
<div class="container-fluid" style="padding: 0px;">
|
||||
|
||||
<?php
|
||||
//title in CIS
|
||||
if (!$is_popup)
|
||||
echo '<h3>' . $p->t('tools/ampelsystem') . '</h3>';
|
||||
|
||||
|
||||
//***************************************** AROUSE SANCHO for mandatory ampeln
|
||||
if ($is_popup)
|
||||
{
|
||||
//sancho message if mandatory ampeln exist
|
||||
if (count($user_ampel_arr) > 0)
|
||||
{
|
||||
echo '
|
||||
echo '
|
||||
<div>
|
||||
<img src="../../../skin/images/sancho/sancho_header_du_hast_verpflichtende_ampeln.jpg" alt="sancho_verpflichtende_ampeln" style="width: 100%;">
|
||||
</div>
|
||||
</div>
|
||||
<p><br><br></p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<!--***************************************** PANEL-GROUP -->
|
||||
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true" style="padding-left: 15px; padding-right:15px;">
|
||||
|
||||
<!--***************************************** radiobuttons actual term / all -->
|
||||
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true" style="padding-left: 15px; padding-right:15px;">
|
||||
|
||||
<!--***************************************** radiobuttons actual term / all -->
|
||||
<?php
|
||||
if (!$is_popup)
|
||||
{
|
||||
?>
|
||||
<form method="POST" action="">
|
||||
<?php echo $p->t('tools/ampelAnzeigeFuer') ?>
|
||||
<label class="radio-inline">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="show" value="aktuell" <?php if ($show == 'aktuell') echo 'checked'; ?> onclick="submit()"> <?php echo $p->t('tools/ampelNurAktuellesStudiensemester') ?>
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
@@ -386,21 +386,21 @@ function typeWrite(span){
|
||||
<p><br><br></p>
|
||||
<?php
|
||||
} //end if
|
||||
|
||||
|
||||
|
||||
//***************************************** COLLAPSED PANELS WITH AMPELN
|
||||
|
||||
|
||||
$cnt = 1; //counter to set iterative id's
|
||||
$cnt_inactive = 1; //counter to set only one heading line for inactive ampeln
|
||||
$cnt_active = 0;
|
||||
|
||||
|
||||
//show panel "no actual ampeln" if there are no active ampeln
|
||||
foreach ($user_ampel_arr as $user_ampel)
|
||||
{
|
||||
if ($user_ampel['active'] == true)
|
||||
$cnt_active++;
|
||||
}
|
||||
|
||||
|
||||
if ($cnt_active == 0 && !$is_popup)
|
||||
{
|
||||
echo '
|
||||
@@ -411,7 +411,7 @@ function typeWrite(span){
|
||||
<small>' . $p->t('tools/ampelKeineAktuellenTxt'). '</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
</div>';
|
||||
}
|
||||
elseif ($cnt_active != 0 && !$is_popup)
|
||||
{
|
||||
@@ -422,16 +422,16 @@ function typeWrite(span){
|
||||
<h4>' . $p->t('tools/ampelAktuelleAmpeln'). '</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
</div>';
|
||||
}
|
||||
|
||||
|
||||
//fill panel with ampeln
|
||||
foreach ($user_ampel_arr as $user_ampel)
|
||||
{
|
||||
|
||||
|
||||
//use only ampeln that are not overdue
|
||||
if ($user_ampel['show_ampel'] == true)
|
||||
{
|
||||
{
|
||||
//heading line for inactive ampeln
|
||||
if ($user_ampel['active'] == false && $cnt_inactive == 1)
|
||||
{
|
||||
@@ -444,33 +444,33 @@ function typeWrite(span){
|
||||
<small>' . $p->t('tools/ampelAbgelaufenTxt'). '</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
</div>';
|
||||
$cnt_inactive++;
|
||||
}
|
||||
?>
|
||||
<div class="panel">
|
||||
<div class="row" style="margin-bottom: 15px">
|
||||
<div class="panel-heading <?php if ($user_ampel['abgelaufen'] || $user_ampel['bestaetigt']) echo 'text-muted' ?>" style="background-color: transparent" role="tab" id="heading<?php echo $cnt ?>">
|
||||
<div class="panel-heading <?php if ($user_ampel['abgelaufen'] || $user_ampel['bestaetigt']) echo 'text-muted' ?>" style="background-color: transparent" role="tab" id="heading<?php echo $cnt ?>">
|
||||
<div class="col-xs-4">
|
||||
<h5 class="panel-title" style="text-decoration: none; font-size: 14px;">
|
||||
<a class="collapsed" style="text-decoration: none;" role="button" data-toggle="collapse" data-parent="#accordion"
|
||||
<a class="collapsed" style="text-decoration: none;" role="button" data-toggle="collapse" data-parent="#accordion"
|
||||
href="#collapse<?php echo $cnt ?>" aria-expanded="false" aria-controls="collapse<?php echo $cnt ?>">
|
||||
<?php echo $user_ampel['kurzbz'] ?>
|
||||
</a>
|
||||
</h5>
|
||||
<small <?php if ($user_ampel['status'] == 'rot' && !$user_ampel['abgelaufen']) echo 'style="color: red; font-weight : bold;"'?>><?php echo $p->t('global/faelligAm') . ' '; echo date('d.m.Y', strtotime($user_ampel['deadline'])) ?></small>
|
||||
<small <?php if ($user_ampel['status'] == 'rot' && !$user_ampel['abgelaufen']) echo 'style="color: red; font-weight : bold;"'?>><?php echo $p->t('global/faelligAm') . ' '; echo date('d.m.Y', strtotime($user_ampel['deadline'])) ?></small>
|
||||
</div>
|
||||
<div class="col-xs-2">
|
||||
<?php echo $user_ampel['status_ampel'] ?>
|
||||
</div>
|
||||
<div class="col-xs-2"><small>
|
||||
<?php
|
||||
<div class="col-xs-2"><small>
|
||||
<?php
|
||||
if ($user_ampel['bestaetigt']) echo 'bestätigt';
|
||||
if ($user_ampel['abgelaufen'])
|
||||
{
|
||||
if ($user_ampel['bestaetigt'])
|
||||
echo " &<br>";
|
||||
else
|
||||
else
|
||||
echo "nicht bestätigt &<br>";
|
||||
echo 'abgelaufen';
|
||||
}
|
||||
@@ -478,29 +478,27 @@ function typeWrite(span){
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<form method="POST" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ampel_id='. urlencode($user_ampel['ampel_id']) . '&type=bestaetigen'; ?>">
|
||||
<button name="type" type="submit" class="btn btn-default pull-right"
|
||||
<?php if ($user_ampel['abgelaufen'] || $user_ampel['bestaetigt']) echo 'disabled data-toggle="tooltip" data-placement="top" title="' . $p->t('tools/ampelBestaetigtAbgelaufen'). '"'?>><?php echo $p->t('global/bestaetigen') ?>
|
||||
</button>
|
||||
<button type="button" class="btn btn-default pull-right collapsed" style="margin-right: 10px;" data-toggle="collapse" data-parent="#accordion"
|
||||
href="#collapse<?php echo $cnt ?>" aria-expanded="false" aria-controls="collapse<?php echo $cnt ?>"><?php echo $p->t('global/lesen') ?></button>
|
||||
|
||||
<button type="button" class="btn btn-default pull-right collapsed" style="margin-right: 0 px;" data-toggle="collapse" data-parent="#accordion"
|
||||
href="#collapse<?php echo $cnt ?>" aria-expanded="false" aria-controls="collapse<?php echo $cnt ?>"><?php echo $p->t('global/anzeigen') ?></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="collapse<?php echo $cnt ?>" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading<?php echo $cnt ?>">
|
||||
<div class="panel-body" style="font-size: 12px;">
|
||||
<?php echo $user_ampel['beschreibung'][$sprache] ?>
|
||||
<?php echo $user_ampel['beschreibung'][$sprache] ?>
|
||||
<p><br></p>
|
||||
<form method="POST" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ampel_id='. urlencode($user_ampel['ampel_id']) . '&type=bestaetigen'; ?>">
|
||||
<button type="type" type="submit" class="btn btn-default pull-right"
|
||||
<button type="type" type="submit" class="btn btn-default pull-right"
|
||||
<?php if ($user_ampel['abgelaufen'] || $user_ampel['bestaetigt']) echo 'disabled data-toggle="tooltip" data-placement="top" title="' . $p->t('tools/ampelBestaetigtAbgelaufen'). '"'?>><?php echo $p->t('global/bestaetigen') ?>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$cnt++;
|
||||
<?php
|
||||
$cnt++;
|
||||
} //end if
|
||||
} //end foreach
|
||||
?>
|
||||
@@ -509,4 +507,3 @@ function typeWrite(span){
|
||||
</div> <!--end container -->
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -126,6 +126,12 @@ $von = $von_datum.' '.$von_uhrzeit;
|
||||
$bis_datum = (isset($_REQUEST['bis_datum'])?$_REQUEST['bis_datum']:date('d.m.Y'));
|
||||
$bis_uhrzeit = (isset($_POST['bis_uhrzeit'])?$_POST['bis_uhrzeit']:date('H:i',mktime(date('H'), date('i')+10)));
|
||||
$bis = $bis_datum.' '.$bis_uhrzeit;
|
||||
|
||||
$pause_von = (isset($_POST['pause_von'])?$_POST['pause_von']:date('H:i'));
|
||||
$pause_bis = (isset($_POST['pause_bis'])?$_POST['pause_bis']:date('H:i'));
|
||||
$von_pause = $von_datum.' '.$pause_von;
|
||||
$bis_pause = $bis_datum.' '.$pause_bis;
|
||||
|
||||
$beschreibung = (isset($_POST['beschreibung'])?$_POST['beschreibung']:'');
|
||||
$service_id = (isset($_POST['service_id'])?$_POST['service_id']:'');
|
||||
$kunde_uid = (isset($_POST['kunde_uid'])?$_POST['kunde_uid']:'');
|
||||
@@ -233,6 +239,8 @@ echo '
|
||||
return row[0] + " " + row[1] + " " + row[2];
|
||||
}
|
||||
|
||||
checkPausenblock();
|
||||
|
||||
$("#kunde_name").autocomplete({
|
||||
source: "zeitaufzeichnung_autocomplete.php?autocomplete=kunde",
|
||||
minLength:2,
|
||||
@@ -539,6 +547,86 @@ echo '
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Pausenblock
|
||||
|
||||
function checkPausenblock()
|
||||
{
|
||||
var sel = $("#aktivitaet").val();
|
||||
var activities = ["Admin", "Lehre", "FuE", "Operativ", "Betrieb", "Design"];
|
||||
if (activities.includes(sel))
|
||||
showPausenblock();
|
||||
else
|
||||
hidePausenblock();
|
||||
}
|
||||
|
||||
function hidePausenblock()
|
||||
{
|
||||
$("#pause_von").val("");
|
||||
$("#pause_bis").val("");
|
||||
$("#genPause").attr("checked", false);
|
||||
$("#pausenblock").hide();
|
||||
}
|
||||
function showPausenblock()
|
||||
{
|
||||
$("#pausenblock").show();
|
||||
}
|
||||
|
||||
function checkPausenzeit()
|
||||
{
|
||||
if ($("#genPause").is(":checked"))
|
||||
{
|
||||
setPausenzeit();
|
||||
}
|
||||
else
|
||||
{
|
||||
clearPausenzeit();
|
||||
}
|
||||
}
|
||||
|
||||
function setPausenzeit()
|
||||
{
|
||||
var von_stunden, bis_stunden, von_minuten, bis_minuten, Uhrzeit2, Uhrzeit1, spanne;
|
||||
Uhrzeit1 = $("#von_uhrzeit").val();
|
||||
von_stunden = Uhrzeit1.substring(0,2);
|
||||
von_minuten = Uhrzeit1.substring(3,5);
|
||||
Uhrzeit2 = $("#bis_uhrzeit").val();
|
||||
bis_stunden = Uhrzeit2.substring(0,2);
|
||||
bis_minuten = Uhrzeit2.substring(3,5);
|
||||
spanne = (bis_stunden*60+parseInt(bis_minuten))-(von_stunden*60+parseInt(von_minuten));
|
||||
|
||||
if (spanne <= 40)
|
||||
{
|
||||
alert("'.$p->t("zeitaufzeichnung/zeitraumZuKurz").'");
|
||||
$("#genPause").attr("checked", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
var pausenstart = Math.floor((spanne/2-15)+(von_stunden*60+parseInt(von_minuten)));
|
||||
var pausenstart_stunde = Math.floor(pausenstart/60);
|
||||
var pausenstart_minute = pausenstart - pausenstart_stunde*60;
|
||||
pausenstart_stunde = (pausenstart_stunde < 10 ? "0"+pausenstart_stunde : pausenstart_stunde);
|
||||
pausenstart_minute = (pausenstart_minute < 10 ? "0"+pausenstart_minute : pausenstart_minute);
|
||||
var beginn_pause = pausenstart_stunde + ":" + pausenstart_minute;
|
||||
|
||||
var pausenende = pausenstart + parseInt(30);
|
||||
var pausenende_stunde = Math.floor(pausenende/60);
|
||||
var pausenende_minute = pausenende - pausenende_stunde*60;
|
||||
pausenende_stunde = (pausenende_stunde < 10 ? "0"+pausenende_stunde : pausenende_stunde);
|
||||
pausenende_minute = (pausenende_minute < 10 ? "0"+pausenende_minute : pausenende_minute);
|
||||
|
||||
var ende_pause = pausenende_stunde + ":" + pausenende_minute;
|
||||
|
||||
$("#pause_von").val(beginn_pause);
|
||||
$("#pause_bis").val(ende_pause);
|
||||
}
|
||||
}
|
||||
|
||||
function clearPausenzeit()
|
||||
{
|
||||
$("#pause_von").val("");
|
||||
$("#pause_bis").val("");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
@@ -753,12 +841,78 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import']))
|
||||
$zeit->projektphase_id = $projektphase_id;
|
||||
$zeit->service_id = $service_id;
|
||||
$zeit->kunde_uid = $kunde_uid;
|
||||
|
||||
if(!$zeit->save())
|
||||
$saveerror = 0;
|
||||
if (isset($_POST['genPause']) && (isset($_POST['save']) || isset($_POST['edit'])))
|
||||
{
|
||||
echo '<span style="color:red"><b>'.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.'</b></span>';
|
||||
|
||||
$p_start = $datum->formatDatum($von_pause, $format='Y-m-d H:i:s');
|
||||
$p_end = $datum->formatDatum($bis_pause, $format='Y-m-d H:i:s');
|
||||
|
||||
// checken ob Pause innerhalb der Arbeitszeit ist
|
||||
if ($zeit->start > $p_start || $zeit->ende < $p_end)
|
||||
{
|
||||
echo '<span style="color:red"><b>'.$p->t("global/fehlerBeimSpeichernDerDaten").': Pause außerhalb der Arbeitszeit</b></span><br>';
|
||||
$saveerror = 1;
|
||||
|
||||
}
|
||||
elseif ($p_start > $p_end)
|
||||
{
|
||||
echo '<span style="color:red"><b>'.$p->t("global/fehlerBeimSpeichernDerDaten").': Fehlerhafte Pausenzeiten</b></span><br>';
|
||||
$saveerror = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Eintrag Arbeit bis zur Pause
|
||||
$zeit->ende = $datum->formatDatum($von_pause, $format='Y-m-d H:i:s');
|
||||
if(!$zeit->save())
|
||||
{
|
||||
echo '<span style="color:red"><b>'.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.'</b></span><br>';
|
||||
$saveerror = 1;
|
||||
}
|
||||
//Eintrag für die Pause
|
||||
$pause = new zeitaufzeichnung();
|
||||
$pause->new = true;
|
||||
$pause->insertamum = date('Y-m-d H:i:s');
|
||||
$pause->updateamum = date('Y-m-d H:i:s');
|
||||
$pause->updatevon = $user;
|
||||
$pause->insertvon = $user;
|
||||
$pause->uid = $user;
|
||||
$pause->aktivitaet_kurzbz = 'Pause';
|
||||
$pause->start = $datum->formatDatum($von_pause, $format='Y-m-d H:i:s');
|
||||
$pause->ende = $datum->formatDatum($bis_pause, $format='Y-m-d H:i:s');
|
||||
$pause->beschreibung = '';
|
||||
if(!$pause->save())
|
||||
{
|
||||
echo '<span style="color:red"><b>'.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$pause->errormsg.'</b></span><br>';
|
||||
$saveerror = 1;
|
||||
}
|
||||
// Eintrag Arbeit ab der Pause
|
||||
if ($zeit->new == false)
|
||||
{
|
||||
$zeit->new = true;
|
||||
$zeit->insertamum = date('Y-m-d H:i:s');
|
||||
$zeit->insertvon = $user;
|
||||
}
|
||||
|
||||
$zeit->start = $datum->formatDatum($bis_pause, $format='Y-m-d H:i:s');
|
||||
$zeit->ende = $datum->formatDatum($bis, $format='Y-m-d H:i:s');
|
||||
if(!$zeit->save())
|
||||
{
|
||||
echo '<span style="color:red"><b>'.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.'</b></span><br>';
|
||||
$saveerror = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
elseif (!isset($_POST['genPause']))
|
||||
{
|
||||
if(!$zeit->save())
|
||||
{
|
||||
echo '<span style="color:red"><b>'.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.'</b></span>';
|
||||
$saveerror = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($saveerror == 0)
|
||||
{
|
||||
echo '<span style="color:green"><b>'.$p->t("global/datenWurdenGespeichert").'</b></span>';
|
||||
|
||||
@@ -780,6 +934,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import']))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Datensatz loeschen
|
||||
if(isset($_GET['type']) && $_GET['type']=='delete')
|
||||
{
|
||||
@@ -956,7 +1111,7 @@ if($projekt->getProjekteMitarbeiter($user, true))
|
||||
// $qry = "SELECT * FROM fue.tbl_aktivitaet where sort != 5 or sort is null ORDER by sort,beschreibung";
|
||||
if($result = $db->db_query($qry))
|
||||
{
|
||||
echo '<SELECT name="aktivitaet" id="aktivitaet">';
|
||||
echo '<SELECT name="aktivitaet" id="aktivitaet" onChange="checkPausenblock()">';
|
||||
if ($za_simple == 0)
|
||||
echo '<OPTION value="">-- '.$p->t('zeitaufzeichnung/keineAuswahl').' --</OPTION>';
|
||||
//else
|
||||
@@ -1173,6 +1328,16 @@ if($projekt->getProjekteMitarbeiter($user, true))
|
||||
<input onchange="checkZeiten()" type="text" class="timepicker" id="bis_uhrzeit" name="bis_uhrzeit" value="'.$db->convert_html_chars($datum->formatDatum($bis, $format='H:i')).'" size="4">
|
||||
</td>
|
||||
<tr>';
|
||||
echo '
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td colspan="3">
|
||||
<span id="pausenblock">
|
||||
<input type="checkbox" name="genPause" id="genPause" onChange="checkPausenzeit()"> '.$p->t("zeitaufzeichnung/pauseEinfuegen").' <input type="text" name="pause_von" class="timepicker" size="4" id="pause_von"> - <input type="text" name="pause_bis" class="timepicker" size="4" id="pause_bis">
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
';
|
||||
//Beschreibung
|
||||
echo '<tr><td>'.$p->t("global/beschreibung").'</td><td colspan="3"><textarea style="font-size: 13px" name="beschreibung" cols="60" maxlength="256">'.$db->convert_html_chars($beschreibung).'</textarea></td></tr>';
|
||||
echo '<tr><td></td><td></td><td></td><td align="right">';
|
||||
@@ -1327,11 +1492,13 @@ if($projekt->getProjekteMitarbeiter($user, true))
|
||||
$elsumme = $h2*3600+$m2*60;
|
||||
if ($tagessaldo > 18000 && $tagessaldo < 19800 && $pflichtpause==false && $elsumme == 0)
|
||||
{
|
||||
$pausesumme = $tagessaldo-18000;
|
||||
//$pausesumme = $tagessaldo-18000;
|
||||
$pausesumme = $pausesumme;
|
||||
}
|
||||
else if ($tagessaldo>18000 && $pflichtpause==false && $elsumme == 0)
|
||||
{
|
||||
$pausesumme = $pausesumme+1800;
|
||||
//$pausesumme = $pausesumme+1800;
|
||||
$pausesumme = $pausesumme;
|
||||
}
|
||||
if ($elsumme > 0){
|
||||
$pausesumme = $pausesumme + $elsumme;
|
||||
@@ -1339,6 +1506,13 @@ if($projekt->getProjekteMitarbeiter($user, true))
|
||||
}
|
||||
|
||||
$tagessaldo = $tagessaldo-$pausesumme;
|
||||
// fehlende Pausen berechnen
|
||||
$pausefehlt_str = '';
|
||||
if ($tagessaldo > 19800 && $pausesumme < 1800)
|
||||
$pausefehlt_str = '<span style="color:red; font-weight:bold;">-- Pause fehlt oder zu kurz --</span>';
|
||||
elseif ($tagessaldo > 18000 && $tagessaldo < 19800 && $pausesumme < $tagessaldo - 18000)
|
||||
$pausefehlt_str = '<span style="color:red; font-weight:bold;">-- Pause fehlt oder zu kurz --</span>';
|
||||
|
||||
$tagessaldo = date('H:i', ($tagessaldo));
|
||||
$colspan = ($za_simple)?6:8;
|
||||
echo '<tr id="tag_row_'.$datum->formatDatum($tag,'d_m_Y').'"><td '.$style.' colspan="'.$colspan.'")>';
|
||||
@@ -1350,7 +1524,7 @@ if($projekt->getProjekteMitarbeiter($user, true))
|
||||
$langindex = 1;
|
||||
else
|
||||
$langindex = 2;
|
||||
echo '<b>'.$tagbez[$langindex][$datum->formatDatum($tag,'N')].' '.$datum->formatDatum($tag,'d.m.Y').'</b> <span id="tag_'.$datum->formatDatum($tag,'d_m_Y').'">'.$zeitsperre_text.'</span>';
|
||||
echo '<b>'.$tagbez[$langindex][$datum->formatDatum($tag,'N')].' '.$datum->formatDatum($tag,'d.m.Y').'</b> <span id="tag_'.$datum->formatDatum($tag,'d_m_Y').'">'.$zeitsperre_text.'</span>'.$pausefehlt_str;
|
||||
if ($ersumme != '00:00')
|
||||
$erstr = ' (+ '.$ersumme.' ER)';
|
||||
else
|
||||
@@ -1359,8 +1533,8 @@ if($projekt->getProjekteMitarbeiter($user, true))
|
||||
}
|
||||
echo '</td>
|
||||
<td align="right" colspan="2" '.$style.'>
|
||||
<b>'.$p->t("zeitaufzeichnung/arbeitszeit").': '.$datum->formatDatum($tagesbeginn, $format='H:i').'-'.$datum->formatDatum($tagesende, $format='H:i').' '.$p->t("eventkalender/uhr").'</b><br>LehreExtern /
|
||||
'.$p->t("zeitaufzeichnung/pause").' '.($pflichtpause==false?$p->t("zeitaufzeichnung/inklusivePflichtpause"):'').':
|
||||
<b>'.$p->t("zeitaufzeichnung/arbeitszeit").': '.$datum->formatDatum($tagesbeginn, $format='H:i').'-'.$datum->formatDatum($tagesende, $format='H:i').' '.$p->t("eventkalender/uhr").'</b><br>
|
||||
'.$p->t("zeitaufzeichnung/pause").':
|
||||
</td>
|
||||
<td '.$style.' align="right"><b>'.$tagessaldo.$erstr.'</b><br>'.date('H:i', ($pausesumme-3600)).'</td>
|
||||
<td '.$style.' colspan="3" align="right">';
|
||||
|
||||
@@ -172,17 +172,28 @@ class zeitaufzeichnung extends basis_db
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->aktivitaet_kurzbz != 'Ersatzruhe')
|
||||
if ($this->aktivitaet_kurzbz != 'Ersatzruhe' && $this->aktivitaet_kurzbz != 'DienstreiseMT')
|
||||
{
|
||||
$check_qry = "SELECT count(*) from campus.tbl_zeitaufzeichnung where uid=".$this->db_add_param($this->uid)." and aktivitaet_kurzbz = 'Ersatzruhe' and (start < ".$this->db_add_param($this->ende)." and ende > ".$this->db_add_param($this->start).")";
|
||||
$check_qry = "SELECT count(*) from campus.tbl_zeitaufzeichnung where uid=".$this->db_add_param($this->uid)." and aktivitaet_kurzbz != 'DienstreiseMT' and (start < ".$this->db_add_param($this->ende)." and ende > ".$this->db_add_param($this->start).")";
|
||||
if($this->db_query($check_qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object())
|
||||
{
|
||||
if ($row->count)
|
||||
if ($this->new)
|
||||
{
|
||||
$this->errormsg = 'Eintrag darf nicht mit Ersatzruhe Überlappen!';
|
||||
return false;
|
||||
if ($row->count)
|
||||
{
|
||||
$this->errormsg = 'Einträge dürfen nicht Überlappen!';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($row->count > 1)
|
||||
{
|
||||
$this->errormsg = 'Einträge dürfen nicht Überlappen!';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,3 +60,5 @@ $this->phrasen['zeitaufzeichnung/keineprojekte']='keine Projekte vorhanden';
|
||||
$this->phrasen['zeitaufzeichnung/summe']='Summe:';
|
||||
$this->phrasen['zeitaufzeichnung/dienstreise']='Dienstreise';
|
||||
$this->phrasen['zeitaufzeichnung/projektphase']='AP';
|
||||
$this->phrasen['zeitaufzeichnung/pauseEinfuegen']='Pause automatisch einfügen';
|
||||
$this->phrasen['zeitaufzeichnung/zeitraumZuKurz']='Zeitraum zu kurz für automatische Pause';
|
||||
|
||||
@@ -60,3 +60,5 @@ $this->phrasen['zeitaufzeichnung/keineprojekte']='no projects exist';
|
||||
$this->phrasen['zeitaufzeichnung/summe']='Sum:';
|
||||
$this->phrasen['zeitaufzeichnung/dienstreise']='Business Trip';
|
||||
$this->phrasen['zeitaufzeichnung/projektphase']='WP';
|
||||
$this->phrasen['zeitaufzeichnung/pauseEinfuegen']='insert break automatically';
|
||||
$this->phrasen['zeitaufzeichnung/zeitraumZuKurz']='Timeslot too short for automatic break.';
|
||||
|
||||
Reference in New Issue
Block a user