Merge remote-tracking branch 'origin/master'

This commit is contained in:
Manfred Kindl
2018-09-24 17:13:21 +02:00
26 changed files with 428 additions and 1371 deletions
+16
View File
@@ -421,6 +421,22 @@ class benutzerberechtigung extends basis_db
UNION
SELECT
benutzerberechtigung_id, tbl_benutzerfunktion.uid, tbl_benutzerrolle.funktion_kurzbz,
tbl_benutzerrolle.rolle_kurzbz, tbl_rolleberechtigung.berechtigung_kurzbz, tbl_benutzerrolle.art, tbl_rolleberechtigung.art art1,
tbl_benutzerfunktion.oe_kurzbz, tbl_benutzerrolle.studiensemester_kurzbz, tbl_benutzerrolle.start,
tbl_benutzerrolle.ende, tbl_benutzerrolle.negativ, tbl_benutzerrolle.updateamum, tbl_benutzerrolle.updatevon,
tbl_benutzerrolle.insertamum, tbl_benutzerrolle.insertvon,tbl_benutzerrolle.kostenstelle_id,tbl_benutzerrolle.anmerkung
FROM
system.tbl_benutzerrolle
JOIN public.tbl_benutzerfunktion USING(funktion_kurzbz)
JOIN system.tbl_rolleberechtigung ON(tbl_benutzerrolle.rolle_kurzbz=tbl_rolleberechtigung.rolle_kurzbz)
WHERE tbl_benutzerfunktion.uid=".$this->db_add_param($uid)."
AND (tbl_benutzerfunktion.datum_von IS NULL OR tbl_benutzerfunktion.datum_von<=now())
AND (tbl_benutzerfunktion.datum_bis IS NULL OR tbl_benutzerfunktion.datum_bis>=now())
UNION
SELECT
benutzerberechtigung_id, '', tbl_benutzerrolle.funktion_kurzbz,
tbl_benutzerrolle.rolle_kurzbz, tbl_benutzerrolle.berechtigung_kurzbz, tbl_benutzerrolle.art, tbl_benutzerrolle.art art1,
-38
View File
@@ -1097,42 +1097,4 @@ function PersonLog($person_id, $logtype_kurzbz, $logdata, $taetigkeit_kurzbz, $a
$personlog = new personlog();
$personlog->log($person_id, $logtype_kurzbz, $logdata, $taetigkeit_kurzbz, $app, $oe_kurzbz, $user);
}
/**
* Sendet einen Request an den CaseTime Server um die Daten dort zu speichern
*/
function getCaseTimeErrors($uid)
{
$ch = curl_init();
$url = CASETIME_SERVER.'/sync/get_zeitfehler';
$params = 'sachb='.$uid;
curl_setopt($ch, CURLOPT_URL, $url.'?'.$params ); //Url together with parameters
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Return data instead printing directly in Browser
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT , 7); //Timeout after 7 seconds
curl_setopt($ch, CURLOPT_USERAGENT , "FH-Complete CaseTime Addon");
curl_setopt($ch, CURLOPT_HEADER, 0);
$result = curl_exec($ch);
if(curl_errno($ch))
{
return 'Curl error: ' . curl_error($ch);
curl_close($ch);
}
else
{
curl_close($ch);
$data = json_decode($result);
if(isset($data->STATUS) && $data->STATUS=='OK')
{
return $data->RESULT;
}
else
return false;
}
}
?>
+40 -38
View File
@@ -23,8 +23,8 @@
/**
* Klasse Mail
* @create 2008-11-20
*
* Versendet ein Mail als Text, Html, CC und BCC Empfaenger,
*
* Versendet ein Mail als Text, Html, CC und BCC Empfaenger,
* Replyto und Attachments
*/
@@ -40,7 +40,7 @@ class mail
public $htmlContent;
public $attachments;
public $errormsg;
/**
* MAIL - Konstruktor
* $to Empfaenger
@@ -73,18 +73,18 @@ class mail
$this->BCC_recievers = ($this->BCC_recievers!=''?MAIL_DEBUG:'');
$this->replyTo = ($this->replyTo!=''?MAIL_DEBUG:'');
}
$mime_boundary_alternative = 'ALT+'.md5(time());
$mime_boundary_mixed = 'MIXD+'.md5(time());
$eol="\n";
if(defined('MAIL_FROM') && MAIL_FROM!='')
$this->sender = MAIL_FROM;
// Header
$header = '';
$header .= "From: {$this->sender}".$eol;
if (!empty($this->CC_recievers))
$header .= "CC: {$this->CC_recievers}".$eol;
if (!empty($this->BCC_recievers))
@@ -94,11 +94,13 @@ class mail
if (!empty($this->replyTo))
$header .= "Return-Path: {$this->replyTo}".$eol;
$header .= 'X-Mailer: FHComplete V1'.$eol;
$header .= 'X-Mailer: FHComplete V1'.$eol;
$header .= 'Mime-Version: 1.0'.$eol;
$header .= 'Precedence: bulk'.$eol;
$header .= 'Auto-Submitted: auto-generated'.$eol;
$header .= "Content-Type: multipart/related; boundary=\"$mime_boundary_mixed\"".$eol;
$header .= "Content-Transfer-Encoding: 8bit".$eol;
// Body
$mailbody = "";
$mailbody .= $eol;
@@ -112,8 +114,8 @@ class mail
$mailbody .= $this->textContent[0];
$mailbody .= $eol;
$mailbody .= $eol;
if (!empty($this->htmlContent[0]))
if (!empty($this->htmlContent[0]))
{
$mailbody .= "--$mime_boundary_alternative".$eol;
$mailbody .= "Content-Type: text/html; charset={$this->htmlContent[1]}".$eol;
@@ -126,17 +128,17 @@ class mail
$mailbody .= "--{$mime_boundary_alternative}--".$eol;
$mailbody .= $eol;
$mailbody .= "--$mime_boundary_mixed";
// Attachments Plain
if (is_array($this->attachmentsplain) && (count($this->attachmentsplain) > 0))
if (is_array($this->attachmentsplain) && (count($this->attachmentsplain) > 0))
{
foreach ($this->attachmentsplain as $attachment)
foreach ($this->attachmentsplain as $attachment)
{
$dispo = 'attachment';
$mailbody .= $eol;
$mailbody .= "Content-Disposition: $dispo; filename={$attachment[2]}".$eol;
$mailbody .= "Content-Type: {$attachment[1]}; name={$attachment[2]}".$eol;
$mailbody .= 'Content-Transfer-Encoding: '.$attachment[3].$eol;
$mailbody .= $eol;
$mailbody .= $attachment[0];
@@ -144,17 +146,17 @@ class mail
$mailbody .= "--$mime_boundary_mixed";
}
}
// Attachments Binary
if (is_array($this->attachments) && (count($this->attachments) > 0))
if (is_array($this->attachments) && (count($this->attachments) > 0))
{
foreach ($this->attachments as $attachment)
foreach ($this->attachments as $attachment)
{
$dispo = empty($attachment[3]) ? 'attachment' : 'inline';
$mailbody .= $eol;
$mailbody .= "Content-Disposition: $dispo; filename={$attachment[2]}".$eol;
$mailbody .= "Content-Type: {$attachment[1]}; name={$attachment[2]}".$eol;
if (!empty($attachment[3]))
$mailbody .= "Content-Type: {$attachment[1]}; name={$attachment[2]}".$eol;
if (!empty($attachment[3]))
{
$mailbody .= "Content-ID: <{$attachment[3]}>".$eol;
}
@@ -166,15 +168,15 @@ class mail
}
}
$mailbody .= "--".$eol;
// Subject Encoding setzen
$subject = "=?UTF-8?B?".base64_encode($this->subject)."?=";
// Senden
if(mail($this->to, $subject, $mailbody, $header))
return true;
else
return false;
else
return false;
}
/**
@@ -187,7 +189,7 @@ class mail
$this->textContent[2] = $encoding;
return true;
}
/**
* Setzt den HTMLText fuer ein Mail
*/
@@ -198,7 +200,7 @@ class mail
$this->htmlContent[2] = $encoding;
if (empty($this->textContent[0]))
$this->setTextContent(strip_tags($html), $charset, $encoding);
return true;
}
@@ -211,27 +213,27 @@ class mail
*/
public function addAttachmentBinary($file, $type, $name, $ContentID = "")
{
if (!file_exists($file))
if (!file_exists($file))
{
$this->errormsg = 'Attachment wurde nicht gefunden';
return false;
}
$handle = fopen($file,'rb');
if (!$handle)
if (!$handle)
{
$this->errormsg = 'Fehler beim Oeffnen der Datei';
return false;
}
$file_content = fread($handle,filesize($file));
@fclose($handle);
$attachment_string = chunk_split(base64_encode($file_content));
$this->attachments[] = Array($attachment_string, $type, $name, $ContentID);
return true;
}
/**
* Fuegt ein Bild zum Mail hinzu
* $image image-URL
@@ -242,16 +244,16 @@ class mail
public function addEmbeddedImage ($image, $type, $name = '', $ContentID)
{
$image_string = file_get_contents($image);
if (!$image_string)
if (!$image_string)
{
$this->errormsg = 'Fehler beim Einlesen der Datei';
return false;
}
$image_b64 = chunk_split(base64_encode($image_string), 76, "\n");
$this->attachments[] = Array($image_b64, $type, $name, $ContentID);
}
/**
* Fuegt ein Attachment zum Mail hinzu
* $content
@@ -272,14 +274,14 @@ class mail
$this->replyTo = $repl;
return true;
}
/**
* Setzt die CC Empfaenger
*/
public function setCCRecievers($rcvs)
{
$this->CC_recievers = '';
if (is_array($rcvs))
if (is_array($rcvs))
{
foreach ($rcvs as $rcv)
$this->CC_recievers .= ",$rcv";
@@ -291,14 +293,14 @@ class mail
}
return true;
}
/**
* Setzt die BCC Empfaenger
*/
public function setBCCRecievers($rcvs)
{
$this->BCC_recievers = '';
if (is_array($rcvs))
if (is_array($rcvs))
{
foreach ($rcvs as $rcv)
$this->BCC_recievers .= ",$rcv";
+17 -4
View File
@@ -1090,7 +1090,7 @@ class mitarbeiter extends benutzer
}
/**
* Gibt ein Array mit den UIDs der Untergebenen zurueck
* Gibt ein Array mit den UIDs der aktiv beschäftigten Untergebenen zurueck
*/
public function getUntergebene($uid=null)
{
@@ -1115,7 +1115,15 @@ class mitarbeiter extends benutzer
}
//Alle Personen holen die dieser Organisationseinheit untergeordnet sind
$qry = "SELECT distinct uid FROM public.tbl_benutzerfunktion WHERE ((funktion_kurzbz='oezuordnung' AND (false ";
$qry = "
SELECT distinct
uid
FROM
public.tbl_benutzerfunktion
JOIN
public.tbl_benutzer
USING (uid)
WHERE ((funktion_kurzbz='oezuordnung' AND (false ";
if($oe!='')
$qry.=" OR oe_kurzbz in($oe)";
@@ -1125,8 +1133,13 @@ class mitarbeiter extends benutzer
if($oe!='')
$qry.=" OR (funktion_kurzbz='ass' AND oe_kurzbz in($oe))";
$qry.= ") AND (tbl_benutzerfunktion.datum_von is null OR tbl_benutzerfunktion.datum_von<=now()) AND
(tbl_benutzerfunktion.datum_bis is null OR tbl_benutzerfunktion.datum_bis>=now());";
$qry.= ")
AND
(tbl_benutzerfunktion.datum_von is null OR tbl_benutzerfunktion.datum_von<=now())
AND
(tbl_benutzerfunktion.datum_bis is null OR tbl_benutzerfunktion.datum_bis>=now())
AND
tbl_benutzer.aktiv = 'true';";
if($this->db_query($qry))
{
+2 -2
View File
@@ -754,7 +754,7 @@ or not exists
//check if addon casetime is installed
$qrytable = "
SELECT EXISTS(
SELECT *
SELECT 1
FROM information_schema.tables
WHERE
table_schema = 'addon' AND
@@ -763,7 +763,7 @@ or not exists
";
$res = $this->db_query($qrytable);
if ($this->db_fetch_row($res)[0]===true)
if ($this->db_fetch_row($res)[0] == 't')
{
//check if sent timesheets for the UID exist
$where = "uid=".$this->db_add_param($user);