mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
Zusätzliche Prüfung hinzugefügt beim Download von Notizdokumenten ob
diese auch tatsächlich an einer Notiz hängen
This commit is contained in:
@@ -22,9 +22,10 @@
|
|||||||
* oder im Filesystem, in diesem Fall ist die Akte mit einer DMS ID verknuepft in welcher der Dateiname steht.
|
* oder im Filesystem, in diesem Fall ist die Akte mit einer DMS ID verknuepft in welcher der Dateiname steht.
|
||||||
*/
|
*/
|
||||||
require_once('../config/vilesci.config.inc.php');
|
require_once('../config/vilesci.config.inc.php');
|
||||||
require_once('../include/dms.class.php');
|
require_once('../include/dms.class.php');
|
||||||
require_once('../include/benutzerberechtigung.class.php');
|
require_once('../include/benutzerberechtigung.class.php');
|
||||||
require_once('../include/functions.inc.php');
|
require_once('../include/functions.inc.php');
|
||||||
|
require_once('../include/notiz.class.php');
|
||||||
|
|
||||||
$user = get_uid();
|
$user = get_uid();
|
||||||
$rechte = new benutzerberechtigung();
|
$rechte = new benutzerberechtigung();
|
||||||
@@ -34,11 +35,15 @@ if(!$rechte->isBerechtigt('admin') && !$rechte->isBerechtigt('assistenz') && !$r
|
|||||||
|
|
||||||
if(isset($_GET['id']) && is_numeric($_GET['id']))
|
if(isset($_GET['id']) && is_numeric($_GET['id']))
|
||||||
{
|
{
|
||||||
$dms = new dms();
|
$notiz = new notiz();
|
||||||
if(!$dms->load($_GET['id']))
|
if(!$notiz->isNotizDokument($_GET['id']))
|
||||||
die('Kein Dokument vorhanden');
|
die('Dokument wurde nicht gefunden oder haengt nicht an einer Notiz');
|
||||||
|
|
||||||
$filename=DMS_PATH.$dms->filename;
|
$dms = new dms();
|
||||||
|
if(!$dms->load($_GET['id']))
|
||||||
|
die('Kein Dokument vorhanden');
|
||||||
|
|
||||||
|
$filename=DMS_PATH.$dms->filename;
|
||||||
|
|
||||||
if(!isset($_GET['notimeupdate']))
|
if(!isset($_GET['notimeupdate']))
|
||||||
$dms->touch($dms->dms_id, $dms->version);
|
$dms->touch($dms->dms_id, $dms->version);
|
||||||
@@ -54,7 +59,7 @@ if(isset($_GET['id']) && is_numeric($_GET['id']))
|
|||||||
header('Content-Disposition: inline; filename="'.$dms->name.'"');
|
header('Content-Disposition: inline; filename="'.$dms->name.'"');
|
||||||
header('Content-Length: ' .filesize($filename));
|
header('Content-Length: ' .filesize($filename));
|
||||||
|
|
||||||
while (!feof($handle))
|
while (!feof($handle))
|
||||||
{
|
{
|
||||||
echo fread($handle, 8192);
|
echo fread($handle, 8192);
|
||||||
}
|
}
|
||||||
@@ -71,4 +76,4 @@ else
|
|||||||
echo "Ungueltige DMS-ID";
|
echo "Ungueltige DMS-ID";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
+68
-45
@@ -24,7 +24,7 @@ class notiz extends basis_db
|
|||||||
{
|
{
|
||||||
public $new;
|
public $new;
|
||||||
public $result=array();
|
public $result=array();
|
||||||
public $dokumente=array();
|
public $dokumente=array();
|
||||||
|
|
||||||
//Tabellenspalten
|
//Tabellenspalten
|
||||||
public $notiz_id;
|
public $notiz_id;
|
||||||
@@ -40,15 +40,15 @@ class notiz extends basis_db
|
|||||||
public $updateamum;
|
public $updateamum;
|
||||||
public $updatevon;
|
public $updatevon;
|
||||||
|
|
||||||
public $projekt_kurzbz;
|
public $projekt_kurzbz;
|
||||||
public $projektphase_id;
|
public $projektphase_id;
|
||||||
public $projekttask_id;
|
public $projekttask_id;
|
||||||
public $uid;
|
public $uid;
|
||||||
public $person_id;
|
public $person_id;
|
||||||
public $prestudent_id;
|
public $prestudent_id;
|
||||||
public $bestellung_id;
|
public $bestellung_id;
|
||||||
public $lehreinheit_id;
|
public $lehreinheit_id;
|
||||||
public $anrechnung_id;
|
public $anrechnung_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Konstruktor
|
* Konstruktor
|
||||||
@@ -93,7 +93,7 @@ class notiz extends basis_db
|
|||||||
$this->insertvon=$row->insertvon;
|
$this->insertvon=$row->insertvon;
|
||||||
$this->updateamum=$row->updateamum;
|
$this->updateamum=$row->updateamum;
|
||||||
$this->updatevon=$row->updatevon;
|
$this->updatevon=$row->updatevon;
|
||||||
$this->getDokumente($row->notiz_id);
|
$this->getDokumente($row->notiz_id);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -123,17 +123,17 @@ class notiz extends basis_db
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dokumente der Notiz löschen
|
// Dokumente der Notiz löschen
|
||||||
$this->getDokumente($notiz_id);
|
$this->getDokumente($notiz_id);
|
||||||
if(!empty($this->dokumente))
|
if(!empty($this->dokumente))
|
||||||
{
|
{
|
||||||
$dms = new dms();
|
$dms = new dms();
|
||||||
|
|
||||||
foreach($this->dokumente as $dms_id)
|
foreach($this->dokumente as $dms_id)
|
||||||
{
|
{
|
||||||
$dms->deleteDms($dms_id);
|
$dms->deleteDms($dms_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$qry = "Delete FROM public.tbl_notiz WHERE notiz_id=".$this->db_add_param($notiz_id, FHC_INTEGER);
|
$qry = "Delete FROM public.tbl_notiz WHERE notiz_id=".$this->db_add_param($notiz_id, FHC_INTEGER);
|
||||||
|
|
||||||
@@ -267,14 +267,14 @@ class notiz extends basis_db
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Speichert ein Dokument zur Notiz
|
* Speichert ein Dokument zur Notiz
|
||||||
* @param int $dms_id
|
* @param int $dms_id
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function saveDokument($dms_id)
|
public function saveDokument($dms_id)
|
||||||
{
|
{
|
||||||
$qry = "INSERT INTO public.tbl_notiz_dokument(notiz_id, dms_id) VALUES(".
|
$qry = "INSERT INTO public.tbl_notiz_dokument(notiz_id, dms_id) VALUES(".
|
||||||
$this->db_add_param($this->notiz_id, FHC_INTEGER).','.
|
$this->db_add_param($this->notiz_id, FHC_INTEGER).','.
|
||||||
$this->db_add_param($dms_id, FHC_INTEGER).');';
|
$this->db_add_param($dms_id, FHC_INTEGER).');';
|
||||||
|
|
||||||
@@ -287,7 +287,7 @@ class notiz extends basis_db
|
|||||||
$this->errormsg = 'Fehler beim Speichern der Daten';
|
$this->errormsg = 'Fehler beim Speichern der Daten';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -377,7 +377,7 @@ class notiz extends basis_db
|
|||||||
$obj->insertvon=$row->insertvon;
|
$obj->insertvon=$row->insertvon;
|
||||||
$obj->updateamum=$row->updateamum;
|
$obj->updateamum=$row->updateamum;
|
||||||
$obj->updatevon=$row->updatevon;
|
$obj->updatevon=$row->updatevon;
|
||||||
$obj->getDokumente($row->notiz_id);
|
$obj->getDokumente($row->notiz_id);
|
||||||
|
|
||||||
$this->result[] = $obj;
|
$this->result[] = $obj;
|
||||||
}
|
}
|
||||||
@@ -404,9 +404,9 @@ class notiz extends basis_db
|
|||||||
public.tbl_notiz
|
public.tbl_notiz
|
||||||
LEFT JOIN public.tbl_notizzuordnung USING(notiz_id)
|
LEFT JOIN public.tbl_notizzuordnung USING(notiz_id)
|
||||||
WHERE person_id = ' . $this->db_add_param($person_id, FHC_INTEGER) .
|
WHERE person_id = ' . $this->db_add_param($person_id, FHC_INTEGER) .
|
||||||
' AND (insertvon = ' . $this->db_add_param('online') .' OR insertvon = ' . $this->db_add_param('online_notiz').')
|
' AND (insertvon = ' . $this->db_add_param('online') .' OR insertvon = ' . $this->db_add_param('online_notiz').')
|
||||||
|
|
||||||
ORDER BY notiz_id';
|
ORDER BY notiz_id';
|
||||||
|
|
||||||
if($result = $this->db_query($qry))
|
if($result = $this->db_query($qry))
|
||||||
{
|
{
|
||||||
@@ -444,7 +444,7 @@ class notiz extends basis_db
|
|||||||
* (Name und Adresse der besuchten Schule) in eine Notiz mit
|
* (Name und Adresse der besuchten Schule) in eine Notiz mit
|
||||||
* insertvon = online_ausbildung gespeichert.
|
* insertvon = online_ausbildung gespeichert.
|
||||||
* Wird auf UDF umgebaut!
|
* Wird auf UDF umgebaut!
|
||||||
*
|
*
|
||||||
* Laedt die Notizen zur Ausbilund vom Bewerbungstool
|
* Laedt die Notizen zur Ausbilund vom Bewerbungstool
|
||||||
* @param $person_id int
|
* @param $person_id int
|
||||||
* @return boolean
|
* @return boolean
|
||||||
@@ -457,8 +457,8 @@ class notiz extends basis_db
|
|||||||
public.tbl_notiz
|
public.tbl_notiz
|
||||||
LEFT JOIN public.tbl_notizzuordnung USING(notiz_id)
|
LEFT JOIN public.tbl_notizzuordnung USING(notiz_id)
|
||||||
WHERE person_id = ' . $this->db_add_param($person_id, FHC_INTEGER) .
|
WHERE person_id = ' . $this->db_add_param($person_id, FHC_INTEGER) .
|
||||||
' AND insertvon = ' . $this->db_add_param('online_ausbildung') .
|
' AND insertvon = ' . $this->db_add_param('online_ausbildung') .
|
||||||
' ORDER BY notiz_id';
|
' ORDER BY notiz_id';
|
||||||
|
|
||||||
if($result = $this->db_query($qry))
|
if($result = $this->db_query($qry))
|
||||||
{
|
{
|
||||||
@@ -564,13 +564,13 @@ class notiz extends basis_db
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Laedt die Dokumente der Notiz
|
* Laedt die Dokumente der Notiz
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getDokumente($notiz_id)
|
public function getDokumente($notiz_id)
|
||||||
{
|
{
|
||||||
$qry = "SELECT dms_id FROM public.tbl_notiz_dokument WHERE notiz_id=".$this->db_add_param($notiz_id, FHC_INTEGER);
|
$qry = "SELECT dms_id FROM public.tbl_notiz_dokument WHERE notiz_id=".$this->db_add_param($notiz_id, FHC_INTEGER);
|
||||||
|
|
||||||
if($this->db_query($qry))
|
if($this->db_query($qry))
|
||||||
{
|
{
|
||||||
@@ -579,12 +579,35 @@ class notiz extends basis_db
|
|||||||
$this->dokumente[] = $row->dms_id;
|
$this->dokumente[] = $row->dms_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prueft ob das Dokument an einer Notiz haengt
|
||||||
|
* @param $dms_id DMS id des Dokuments.
|
||||||
|
* @return boolean true wenn das Dokument an einer Notiz hängt, sonst false.
|
||||||
|
*/
|
||||||
|
public function isNotizDokument($dms_id)
|
||||||
|
{
|
||||||
|
$qry = "SELECT * FROM public.tbl_notiz_dokument WHERE dms_id=".$this->db_add_param($dms_id, FHC_INTEGER);
|
||||||
|
|
||||||
|
if($result = $this->db_query($qry))
|
||||||
|
{
|
||||||
|
if($this->db_num_rows($result)>0)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user