mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
Comment & Warnings
This commit is contained in:
@@ -896,6 +896,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import']))
|
||||
$zeit_csv_import = new zeitaufzeichnung_csv_import($p, $zeit, $project_kurzbz_array, $projectphasen_kurzbz_array, $sperrdatum, $limitdatum, $projects_of_user, $projektph_of_user, $datum, $user);
|
||||
$zeit_csv_import->parseCSV();
|
||||
echo $zeit_csv_import->InfosToHTML();
|
||||
echo $zeit_csv_import->WarningsToHTML();
|
||||
echo $zeit_csv_import->ErrorsToHTML();
|
||||
}
|
||||
else if ($datum->formatDatum($von, $format='Y-m-d H:i:s') < $sperrdatum)
|
||||
|
||||
@@ -20,6 +20,7 @@ class zeitaufzeichnung_csv_import {
|
||||
protected $fh;
|
||||
|
||||
protected $errors;
|
||||
protected $warnings;
|
||||
protected $infos;
|
||||
|
||||
protected $anzahl;
|
||||
@@ -67,6 +68,7 @@ class zeitaufzeichnung_csv_import {
|
||||
|
||||
$this->user = $user;
|
||||
$this->errors = array();
|
||||
$this->warnings = array();
|
||||
$this->infos = array();
|
||||
}
|
||||
|
||||
@@ -87,6 +89,10 @@ class zeitaufzeichnung_csv_import {
|
||||
return !empty($this->errors);
|
||||
}
|
||||
|
||||
public function hasWarnings() {
|
||||
return !empty($this->warnings);
|
||||
}
|
||||
|
||||
public function hasInfos() {
|
||||
return !empty($this->infos);
|
||||
}
|
||||
@@ -99,6 +105,14 @@ class zeitaufzeichnung_csv_import {
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function WarningsToHTML() {
|
||||
$html = '';
|
||||
foreach ($this->errors as $msg) {
|
||||
$html .= '<span style="color:orange;"><b>' . $msg . '</b></span><br>' . "\n";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function InfosToHTML() {
|
||||
$html = '';
|
||||
foreach ($this->infos as $msg) {
|
||||
@@ -114,6 +128,13 @@ class zeitaufzeichnung_csv_import {
|
||||
$this->errors[] = $msg;
|
||||
}
|
||||
|
||||
protected function addWarning($msg, $prepend_current_line=false) {
|
||||
if( $prepend_current_line ) {
|
||||
$msg = 'Zeile ' . $this->current_line . ' - ' . $msg;
|
||||
}
|
||||
$this->warnings[] = $msg;
|
||||
}
|
||||
|
||||
protected function addInfo($msg) {
|
||||
$this->infos[] = $msg;
|
||||
}
|
||||
@@ -219,6 +240,7 @@ class zeitaufzeichnung_csv_import {
|
||||
}
|
||||
|
||||
protected function checkZeitsperren() {
|
||||
// NOTE(chris): checkZeitsperren() is defined in private/tools/zeitaufzeichnung.php
|
||||
$zscheck = checkZeitsperren($this->p, $this->user, $this->datum->formatDatum($this->data[self::STARTDT], $format = 'Y-m-d'));
|
||||
if ($zscheck['status'] === false) {
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ": " . $zscheck['msg']);
|
||||
@@ -360,7 +382,7 @@ class zeitaufzeichnung_csv_import {
|
||||
if ($v->homeoffice) {
|
||||
$this->zeit->homeoffice = true;
|
||||
} else {
|
||||
$this->addError($this->p->t("zeitaufzeichnung/homeofficeNichtErlaubt", ($vonCSV)));
|
||||
$this->addWarning($this->p->t("zeitaufzeichnung/homeofficeNichtErlaubt", ($vonCSV)));
|
||||
$this->zeit->homeoffice = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user