mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 18:02:18 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c4683f71db |
@@ -222,4 +222,84 @@ class zeitaufzeichnung_import {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $start datetime
|
||||||
|
* @param string $end datetime
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function processPause($start, $end) {
|
||||||
|
if (isset($_POST['genPause'])) {
|
||||||
|
$p_start = $this->datum->formatDatum($start, 'Y-m-d H:i:s');
|
||||||
|
$p_end = $this->datum->formatDatum($end, 'Y-m-d H:i:s');
|
||||||
|
$this->checkPauseInArbeitszeit($p_start, $p_end);
|
||||||
|
$this->checkPauseValid($p_start, $p_end);
|
||||||
|
$this->savePauseGeneric($start, $end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $start "Y-m-d H:i:s" formatted datetime
|
||||||
|
* @param string $end "Y-m-d H:i:s" formatted datetime
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
protected function checkPauseInArbeitszeit($start, $end) {
|
||||||
|
if ($this->zeit->start > $start || $this->zeit->ende < $end) {
|
||||||
|
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Pause außerhalb der Arbeitszeit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $start "Y-m-d H:i:s" formatted datetime
|
||||||
|
* @param string $end "Y-m-d H:i:s" formatted datetime
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
protected function checkPauseValid($start, $end) {
|
||||||
|
if ($start > $end) {
|
||||||
|
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Fehlerhafte Pausenzeiten');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $start datetime
|
||||||
|
* @param string $end datetime
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function savePauseGeneric($start, $end) {
|
||||||
|
//Eintrag Arbeit bis zur Pause
|
||||||
|
$ende = $this->zeit->ende;
|
||||||
|
$this->zeit->ende = $this->datum->formatDatum($start, 'Y-m-d H:i:s');
|
||||||
|
if (!$this->zeit->save()) {
|
||||||
|
$this->addError($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $this->zeit->errormsg);
|
||||||
|
}
|
||||||
|
//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 = $this->user;
|
||||||
|
$pause->insertvon = $this->user;
|
||||||
|
$pause->uid = $this->user;
|
||||||
|
$pause->aktivitaet_kurzbz = 'Pause';
|
||||||
|
$pause->homeoffice = $this->zeit->homeoffice;
|
||||||
|
$pause->start = $this->datum->formatDatum($start, 'Y-m-d H:i:s');
|
||||||
|
$pause->ende = $this->datum->formatDatum($end, 'Y-m-d H:i:s');
|
||||||
|
$pause->beschreibung = '';
|
||||||
|
if (!$pause->save()) {
|
||||||
|
$this->addError($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $pause->errormsg);
|
||||||
|
}
|
||||||
|
// Eintrag Arbeit ab der Pause
|
||||||
|
if ($this->zeit->new == false) {
|
||||||
|
$this->zeit->new = true;
|
||||||
|
$this->zeit->insertamum = date('Y-m-d H:i:s');
|
||||||
|
$this->zeit->insertvon = $this->user;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->zeit->start = $this->datum->formatDatum($end, 'Y-m-d H:i:s');
|
||||||
|
$this->zeit->ende = $ende;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,6 +176,8 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import {
|
|||||||
$this->mapLehreIntern($data);
|
$this->mapLehreIntern($data);
|
||||||
$this->prepareZeitaufzeichnung($data);
|
$this->prepareZeitaufzeichnung($data);
|
||||||
$this->checkImporttage($data[self::STARTDT]);
|
$this->checkImporttage($data[self::STARTDT]);
|
||||||
|
$this->checkPauseInArbeitszeit($data[self::STARTDT], $data[self::ENDEDT]);
|
||||||
|
$this->checkPauseValid($data[self::STARTDT], $data[self::ENDEDT]);
|
||||||
$this->saveZeit($data[self::STARTDT], $data[self::ENDEDT]);
|
$this->saveZeit($data[self::STARTDT], $data[self::ENDEDT]);
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
$this->addError($ex->getMessage(), true);
|
$this->addError($ex->getMessage(), true);
|
||||||
@@ -383,6 +385,8 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function savePause() {
|
protected function savePause() {
|
||||||
$pause = new zeitaufzeichnung();
|
$pause = new zeitaufzeichnung();
|
||||||
@@ -399,7 +403,7 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import {
|
|||||||
$pause->homeoffice = $this->zeit->homeoffice;
|
$pause->homeoffice = $this->zeit->homeoffice;
|
||||||
if(!$pause->save())
|
if(!$pause->save())
|
||||||
{
|
{
|
||||||
$this->addError($this->p->t("global/fehlerBeimSpeichernDerDaten").': '.$pause->errormsg, true);
|
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': '.$pause->errormsg, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -407,6 +411,7 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import {
|
|||||||
* @param string $start datetimestring
|
* @param string $start datetimestring
|
||||||
* @param string $end datetimestring
|
* @param string $end datetimestring
|
||||||
* @return void
|
* @return void
|
||||||
|
|
||||||
*/
|
*/
|
||||||
protected function saveZeit($start, $end) {
|
protected function saveZeit($start, $end) {
|
||||||
if ($start != $end) {
|
if ($start != $end) {
|
||||||
@@ -418,6 +423,7 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import {
|
|||||||
} else {
|
} else {
|
||||||
$this->anzahl++;
|
$this->anzahl++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -126,86 +126,6 @@ class zeitaufzeichnung_import_post extends zeitaufzeichnung_import {
|
|||||||
$this->zeit->kunde_uid = $kunde_uid;
|
$this->zeit->kunde_uid = $kunde_uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $start datetime
|
|
||||||
* @param string $end datetime
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function processPause($start, $end) {
|
|
||||||
if (isset($_POST['genPause'])) {
|
|
||||||
$p_start = $this->datum->formatDatum($start, 'Y-m-d H:i:s');
|
|
||||||
$p_end = $this->datum->formatDatum($end, 'Y-m-d H:i:s');
|
|
||||||
$this->checkPauseInArbeitszeit($p_start, $p_end);
|
|
||||||
$this->checkPauseValid($p_start, $p_end);
|
|
||||||
$this->savePause($start, $end);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $start "Y-m-d H:i:s" formatted datetime
|
|
||||||
* @param string $end "Y-m-d H:i:s" formatted datetime
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
protected function checkPauseInArbeitszeit($start, $end) {
|
|
||||||
if ($this->zeit->start > $start || $this->zeit->ende < $end) {
|
|
||||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Pause außerhalb der Arbeitszeit');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $start "Y-m-d H:i:s" formatted datetime
|
|
||||||
* @param string $end "Y-m-d H:i:s" formatted datetime
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
protected function checkPauseValid($start, $end) {
|
|
||||||
if ($start > $end) {
|
|
||||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Fehlerhafte Pausenzeiten');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $start datetime
|
|
||||||
* @param string $end datetime
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function savePause($start, $end) {
|
|
||||||
//Eintrag Arbeit bis zur Pause
|
|
||||||
$ende = $this->zeit->ende;
|
|
||||||
$this->zeit->ende = $this->datum->formatDatum($start, 'Y-m-d H:i:s');
|
|
||||||
if (!$this->zeit->save()) {
|
|
||||||
$this->addError($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $this->zeit->errormsg);
|
|
||||||
}
|
|
||||||
//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 = $this->user;
|
|
||||||
$pause->insertvon = $this->user;
|
|
||||||
$pause->uid = $this->user;
|
|
||||||
$pause->aktivitaet_kurzbz = 'Pause';
|
|
||||||
$pause->homeoffice = $this->zeit->homeoffice;
|
|
||||||
$pause->start = $this->datum->formatDatum($start, 'Y-m-d H:i:s');
|
|
||||||
$pause->ende = $this->datum->formatDatum($end, 'Y-m-d H:i:s');
|
|
||||||
$pause->beschreibung = '';
|
|
||||||
if (!$pause->save()) {
|
|
||||||
$this->addError($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $pause->errormsg);
|
|
||||||
}
|
|
||||||
// Eintrag Arbeit ab der Pause
|
|
||||||
if ($this->zeit->new == false) {
|
|
||||||
$this->zeit->new = true;
|
|
||||||
$this->zeit->insertamum = date('Y-m-d H:i:s');
|
|
||||||
$this->zeit->insertvon = $this->user;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->zeit->start = $this->datum->formatDatum($end, 'Y-m-d H:i:s');
|
|
||||||
$this->zeit->ende = $ende;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user