mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-02 03:19:27 +00:00
Merge branch 'bug-24113/ZeiterfassungBerücksichtigungVonAttributProjektZeitaufzeichnung' into feature-25177/ZeiterfassungMergedBrancheDeploy1
This commit is contained in:
@@ -605,9 +605,14 @@ echo '
|
||||
{
|
||||
projphasenhtml += "<option value = \'" + json[i].projektphase_id + "\'>";
|
||||
projphasenhtml += json[i].bezeichnung;
|
||||
|
||||
if(json[i].start != \'\' && json[i].ende !=\'\')
|
||||
{
|
||||
projphasenhtml += " ( "+json[i].start+" - "+json[i].ende+" )";
|
||||
projphasenhtml += " ( "+json[i].start+" - "+json[i].ende+ " )";
|
||||
}
|
||||
if (!json[i].zeitaufzeichnung_erlaubt)
|
||||
{
|
||||
projphasenhtml += " ---AP NICHT bebuchbar---";
|
||||
}
|
||||
projphasenhtml += "<\/option>";
|
||||
}
|
||||
@@ -665,6 +670,7 @@ echo '
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Pausenblock
|
||||
|
||||
function checkPausenblock()
|
||||
@@ -840,6 +846,10 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import']))
|
||||
$projektph_of_user = new projektphase();
|
||||
$projektphasen = $projektph_of_user->getProjectphaseForMitarbeiter($user);
|
||||
|
||||
$phaseBebuchbar = $projektph_of_user->getPhasenZA($projektphase_id);
|
||||
$projekt = new projekt();
|
||||
$projekt->load($projekt_kurzbz);
|
||||
|
||||
if ($_FILES['csv']['error'] == 0 && isset($_POST['import']))
|
||||
{
|
||||
$zeit_csv_import = new zeitaufzeichnung_import_csv($p, $user, $sperrdatum, $_FILES['csv']['tmp_name']);
|
||||
@@ -848,9 +858,11 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import']))
|
||||
}
|
||||
else if ($datum->formatDatum($von, $format='Y-m-d H:i:s') < $sperrdatum)
|
||||
echo '<span id="triggerPhasenReset" style="color:#ff0000"><b>' .$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum</b></span>';
|
||||
|
||||
// NOTE(chris): Save
|
||||
else if (isset($_POST['save']) || isset($_POST['edit']))
|
||||
{
|
||||
|
||||
$zeit_post_import = new zeitaufzeichnung_import_post($p, $user, isset($_POST['edit']), [
|
||||
'aktivitaet_kurzbz' => $aktivitaet_kurzbz,
|
||||
'beschreibung' => $beschreibung,
|
||||
@@ -867,6 +879,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import']))
|
||||
'von_pause' => $von_pause,
|
||||
'zeitaufzeichnung_id' => $zeitaufzeichnung_id,
|
||||
]);
|
||||
|
||||
$zeit_post_import->import();
|
||||
echo $zeit_post_import->OutputToHTML();
|
||||
if (!$zeit_post_import->hasErrors() && !$zeit_post_import->hasWarnings())
|
||||
@@ -1239,7 +1252,8 @@ if ($projekt->getProjekteMitarbeiter($user, true))
|
||||
else
|
||||
$selected = '';
|
||||
|
||||
echo '<option value="'.$db->convert_html_chars($projektphase->projektphase_id).'" '.$selected.'>'.$db->convert_html_chars($projektphase->bezeichnung). $phasentext.'</option>';
|
||||
echo '<option value="'.$db->convert_html_chars($projektphase->projektphase_id).'" '.$selected.'>'.$db->convert_html_chars($projektphase->bezeichnung).
|
||||
$phasentext. '</option>';
|
||||
}
|
||||
echo '</SELECT></span>';
|
||||
}
|
||||
|
||||
@@ -86,6 +86,7 @@ if (isset($_GET['projekt_kurzbz']))
|
||||
$item['bezeichnung'] = $row->bezeichnung;
|
||||
$item['start'] = $datum_obj->formatDatum($row->start, 'd.m.Y');
|
||||
$item['ende'] = $datum_obj->formatDatum($row->ende, 'd.m.Y');
|
||||
$item['zeitaufzeichnung_erlaubt'] = $row->zeitaufzeichnung;
|
||||
$result_obj[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -829,5 +829,39 @@ class projektphase extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt zurück, ob für eine Projektphase Zeitaufzeichnungsbuchung erlaubt ist
|
||||
* @param $projektphase_id die zu überprüfende Projektphase
|
||||
* @return boolean true, wenn Buchung erlaubt
|
||||
*/
|
||||
public function getPhasenZA($projektphase_id)
|
||||
{
|
||||
$qry = "
|
||||
SELECT
|
||||
fue.tbl_projektphase.zeitaufzeichnung
|
||||
FROM
|
||||
fue.tbl_projektphase
|
||||
WHERE
|
||||
tbl_projektphase.projektphase_id = ".$this->db_add_param($projektphase_id);
|
||||
|
||||
if ($this->db_query($qry))
|
||||
{
|
||||
if ($row = $this->db_fetch_object())
|
||||
{
|
||||
return $row->zeitaufzeichnung;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -21,7 +21,7 @@ class zeitaufzeichnung_import {
|
||||
protected $project;
|
||||
protected $phase;
|
||||
protected $limitdate;
|
||||
|
||||
|
||||
protected $zeit;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class zeitaufzeichnung_import {
|
||||
|
||||
$this->zeit = new zeitaufzeichnung();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
@@ -64,7 +64,7 @@ class zeitaufzeichnung_import {
|
||||
public function hasInfos() {
|
||||
return !empty($this->infos);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@@ -96,15 +96,15 @@ class zeitaufzeichnung_import {
|
||||
$html .= '<span style="color:green;"><b>' . $msg . '</b></span><br>' . "\n";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function OutputToHTML() {
|
||||
return $this->InfosToHTML() . $this->WarningsToHTML() . $this->ErrorsToHTML();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $msg
|
||||
* @return void
|
||||
@@ -112,7 +112,7 @@ class zeitaufzeichnung_import {
|
||||
protected function addError($msg) {
|
||||
$this->errors[] = $msg;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $msg
|
||||
* @return void
|
||||
@@ -120,7 +120,7 @@ class zeitaufzeichnung_import {
|
||||
protected function addWarning($msg) {
|
||||
$this->warnings[] = $msg;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $msg
|
||||
* @return void
|
||||
@@ -134,7 +134,7 @@ class zeitaufzeichnung_import {
|
||||
* @param string $uid The user id
|
||||
* @param string $day "Y-m-d" formatted datestring
|
||||
* @return void
|
||||
*
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkZeitsperren($uid, $day) {
|
||||
@@ -150,25 +150,25 @@ class zeitaufzeichnung_import {
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ": " . $this->p->t("zeitaufzeichnung/zeitsperreVorhanden", [$zsdate, $zs->result[0]->zeitsperretyp_kurzbz]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $date datetimestring
|
||||
* @return void
|
||||
*
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkLimitdatum($date) {
|
||||
if ($this->datum->formatDatum($date, 'Y-m-d H:i:s') > $this->limitdate) {
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Eingabe nicht möglich da (' . $date . ') zu weit in der Zukunft liegt.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $start datestring
|
||||
* @param string $end datestring
|
||||
* @param string $aktivitaet_kurzbz
|
||||
* @return void
|
||||
*
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkDienstreise($start, $end, $aktivitaet_kurzbz) {
|
||||
@@ -179,11 +179,11 @@ class zeitaufzeichnung_import {
|
||||
.': Eingabe nicht möglich, da keine Zeitaufzeichnung über mehrere Tage erlaubt ist (ausgenommen Dienstreisen).');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $end timestring
|
||||
* @return void
|
||||
*
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkTagesgenau($end) {
|
||||
@@ -193,13 +193,13 @@ class zeitaufzeichnung_import {
|
||||
.': Bitte Arbeitszeiten gemäß Arbeitsaufzeichnung Leitfaden tagesgenau abgrenzen: Nur Eingaben von 00:00 bis 23:59 erlaubt!');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $projekt_kurzbz
|
||||
* @param string $start datestring
|
||||
* @param string $end datestring
|
||||
* @return void
|
||||
*
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkProjectInterval($projekt_kurzbz, $start, $end) {
|
||||
@@ -207,13 +207,13 @@ class zeitaufzeichnung_import {
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt: (' . $start . ') (' . $end . ')');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $phase The Projektphase ID
|
||||
* @param string $start datestring
|
||||
* @param string $end datestring
|
||||
* @return void
|
||||
*
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkPhaseInterval($phase, $start, $end) {
|
||||
@@ -222,4 +222,33 @@ class zeitaufzeichnung_import {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $phase The Projektphase ID
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkPhaseBebuchbar($phase)
|
||||
{
|
||||
if ($this->phase->getPhasenZA($phase) == 'f')
|
||||
{
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Dieses Arbeitspaket darf nicht bebucht werden!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $phase The Projektphase ID
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkIfArbeitspaketZuWaehlen($projekt_kurzbz, $phase)
|
||||
{
|
||||
$this->project->load($projekt_kurzbz);
|
||||
if (!$this->project->zeitaufzeichnung && !$phase)
|
||||
{
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Bitte ein Arbeitspaket wählen!');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -163,7 +163,8 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import {
|
||||
$this->initData($data);
|
||||
$this->checkProject($data[self::PROJEKT], $data[self::PHASE]);
|
||||
$this->checkPhase($data[self::PHASE]);
|
||||
|
||||
$this->checkPhaseBebuchbar($data[self::PHASE]);
|
||||
$this->checkIfArbeitspaketZuWaehlen($data[self::PROJEKT], $data[self::PHASE]);
|
||||
$this->checkZeitsperren($this->user, $this->datum->formatDatum($data[self::STARTDT], 'Y-m-d'));
|
||||
$this->checkSperrdatum($data[self::STARTDT]);
|
||||
$this->checkLimitdatum($data[self::STARTDT]);
|
||||
|
||||
@@ -72,6 +72,8 @@ class zeitaufzeichnung_import_post extends zeitaufzeichnung_import {
|
||||
$this->checkDienstreise($this->data['von'], $this->data['bis'], $this->data['aktivitaet_kurzbz']);
|
||||
$this->checkTagesgenau($this->data['bis']);
|
||||
$this->processPause($this->data['von_pause'], $this->data['bis_pause']);
|
||||
$this->checkPhaseBebuchbar($this->data['projektphase_id']);
|
||||
$this->checkIfArbeitspaketZuWaehlen($this->data['projekt_kurzbz'], $this->data['projektphase_id']);
|
||||
$this->saveZeit();
|
||||
} catch (Exception $ex) {
|
||||
$this->addError($ex->getMessage());
|
||||
|
||||
Reference in New Issue
Block a user