diff --git a/application/libraries/SignatureLib.php b/application/libraries/SignatureLib.php new file mode 100644 index 000000000..132545219 --- /dev/null +++ b/application/libraries/SignatureLib.php @@ -0,0 +1,75 @@ +sendsJson() + ->authenticateWith(SIGNATUR_USER, SIGNATUR_PASSWORD) + ->body('{"filename": "'.basename($inputFileName).'", "content": "'.base64_encode($inputFileContent).'"}') + ->expectsJson() + ->send(); + } + } + catch(\Httpful\Exception\ConnectionErrorException $cee) // Httpful exception + { + error_log($cee->getMessage()); + } + catch (Exception $e) // any other exception + { + error_log($e->getMessage()); + } + + // If the response is fine + if (isset($resultPost->body) && is_object($resultPost->body) + && isset($resultPost->body->retval) && is_array($resultPost->body->retval)) + { + return $resultPost->body->retval; + } + + // Otherwise return a null as error + return null; + } +} + diff --git a/application/libraries/vertragsbestandteil/Gehaltsbestandteil.php b/application/libraries/vertragsbestandteil/Gehaltsbestandteil.php index 130c18547..f48a969c8 100644 --- a/application/libraries/vertragsbestandteil/Gehaltsbestandteil.php +++ b/application/libraries/vertragsbestandteil/Gehaltsbestandteil.php @@ -4,7 +4,7 @@ namespace vertragsbestandteil; /** * Salary always depends on employment (Dienstverhältnis) and optionally on part of contract (Vetragsbestandteil) */ -class Gehaltsbestandteil implements IValidation +class Gehaltsbestandteil implements IValidation, \JsonSerializable { protected $gehaltsbestandteil_id; protected $dienstverhaeltnis_id; @@ -230,6 +230,13 @@ class Gehaltsbestandteil implements IValidation return $this; } + public function jsonSerialize() + { + $vars = get_object_vars($this); + unset($vars['CI']); + return $vars; + } + public function toStdClass(): \stdClass { $tmp = array( diff --git a/application/libraries/vertragsbestandteil/Vertragsbestandteil.php b/application/libraries/vertragsbestandteil/Vertragsbestandteil.php index 73e2bcd8d..ffda62e08 100644 --- a/application/libraries/vertragsbestandteil/Vertragsbestandteil.php +++ b/application/libraries/vertragsbestandteil/Vertragsbestandteil.php @@ -100,6 +100,12 @@ abstract class Vertragsbestandteil implements \JsonSerializable, IValidation return $this->updatevon; } + public function setGehaltsbestandteile($gehaltsbestandteile) + { + $this->gehaltsbestandteile = $gehaltsbestandteile; + return $this; + } + public function setVertragsbestandteil_id($vertragsbestandteil_id) { $this->vertragsbestandteil_id = $vertragsbestandteil_id; diff --git a/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php b/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php index 6df37263c..d47b89342 100644 --- a/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php +++ b/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php @@ -76,7 +76,31 @@ class VertragsbestandteilLib public function fetchVertragsbestandteile($dienstverhaeltnis_id, $stichtag=null) { - return $this->VertragsbestandteilModel->getVertragsbestandteile($dienstverhaeltnis_id, $stichtag); + $vbs = $this->VertragsbestandteilModel->getVertragsbestandteile($dienstverhaeltnis_id, $stichtag); + $gbs = $this->GehaltsbestandteilLib->fetchGehaltsbestandteile($dienstverhaeltnis_id, $stichtag); + + $gbsByVBid = array(); + foreach( $gbs as $gb ) + { + if( intval($gb->getVertragsbestandteil_id()) > 0 ) + { + if( !isset($gbsByVBid[$gb->getVertragsbestandteil_id()]) + || !is_array($gbsByVBid[$gb->getVertragsbestandteil_id()]) ) { + $gbsByVBid[$gb->getVertragsbestandteil_id()] = array(); + } + $gbsByVBid[$gb->getVertragsbestandteil_id()][] = $gb; + } + } + + foreach ($vbs as $vb) + { + if( isset($gbsByVBid[$vb->getVertragsbestandteil_id()]) ) + { + $vb->setGehaltsbestandteile($gbsByVBid[$vb->getVertragsbestandteil_id()]); + } + } + + return $vbs; } public function fetchVertragsbestandteil($vertragsbestandteil_id) diff --git a/application/models/vertragsbestandteil/Gehaltsbestandteil_model.php b/application/models/vertragsbestandteil/Gehaltsbestandteil_model.php index 8236867ba..e3da82766 100644 --- a/application/models/vertragsbestandteil/Gehaltsbestandteil_model.php +++ b/application/models/vertragsbestandteil/Gehaltsbestandteil_model.php @@ -69,31 +69,31 @@ class Gehaltsbestandteil_model extends DB_Model implements IEncryption return $this->execQuery($qry, array($dienstverhaeltnis_id), $this->getEncryptedColumns()); } - public function getGehaltsbestandteile($dienstverhaeltnis_id=1, $stichtag=null) + public function getGehaltsbestandteile($dienstverhaeltnis_id, $stichtag=null, $includefuture=false) { $stichtagclause = ''; if( !is_null($stichtag) ) { $date = strftime('%Y-%m-%d', strtotime($stichtag)); - $stichtagclause = 'AND ' . $this->escape($date) - . ' BETWEEN COALESCE(v.von, \'1970-01-01\'::date)' - . ' AND COALESCE(v.bis, \'2170-01-01\'::date)'; + $stichtagclause = 'AND (' . $this->escape($date) + . ' BETWEEN COALESCE(von, \'1970-01-01\'::date)' + . ' AND COALESCE(bis, \'2170-01-01\'::date)'; + if( $includefuture ) + { + $stichtagclause .= ' OR COALESCE(v.von, \'1970-01-01\'::date) > ' + . $this->escape($date); + } + $stichtagclause .= ')'; } - $sql = <<addSelect('*'); + $where = <<escape($dienstverhaeltnis_id)} {$stichtagclause} - ; EOSQL; - $query = $this->execReadOnlyQuery( - $query, - array($dienstverhaeltnis_id), + $query = $this->loadWhere( + $where, $this->getEncryptedColumns() ); diff --git a/application/models/vertragsbestandteil/Vertragsbestandteil_model.php b/application/models/vertragsbestandteil/Vertragsbestandteil_model.php index 2c6273c8b..913fd6c34 100644 --- a/application/models/vertragsbestandteil/Vertragsbestandteil_model.php +++ b/application/models/vertragsbestandteil/Vertragsbestandteil_model.php @@ -59,15 +59,21 @@ EOSQL; return $sql; } - public function getVertragsbestandteile($dienstverhaeltnis_id=1, $stichtag=null) + public function getVertragsbestandteile($dienstverhaeltnis_id, $stichtag=null, $includefuture=false) { $stichtagclause = ''; if( !is_null($stichtag) ) { $date = strftime('%Y-%m-%d', strtotime($stichtag)); - $stichtagclause = 'AND ' . $this->escape($date) + $stichtagclause = 'AND (' . $this->escape($date) . ' BETWEEN COALESCE(v.von, \'1970-01-01\'::date)' . ' AND COALESCE(v.bis, \'2170-01-01\'::date)'; + if( $includefuture ) + { + $stichtagclause .= ' OR COALESCE(v.von, \'1970-01-01\'::date) > ' + . $this->escape($date); + } + $stichtagclause .= ')'; } $sql = <<db_fetch_object($result)) $htmlstr .= "\n"; $htmlstr .= "\n"; $htmlstr .= "\n"; - if(!$row->abgabedatum) + + $uploadedDocumentSigned = null; + if (!$row->abgabedatum) { if ($row->datumdb_fetch_object($result)) $fcol='#000000'; } } - //$htmlstr .= "fixtermin=='t'?'checked=\"checked\"':'')." >"; - //$htmlstr .= "fixtermin=='t'?'checked="checked" style="background-color:#FF0000;"':'')." disabled>"; + if($row->fixtermin=='t') { $htmlstr .= "J"; @@ -659,11 +661,12 @@ while ($row=@$db->db_fetch_object($result)) $htmlstr .= " \n"; $htmlstr .= " \n"; $htmlstr .= " ".($row->abgabedatum==''?' ':$datum_obj->formatDatum($row->abgabedatum,'d.m.Y'))."\n"; - if($user==$row->insertvon && $betreuerart!="Zweitbegutachter") + + if ($user==$row->insertvon && $betreuerart!="Zweitbegutachter") { $htmlstr .= " "; - if(!$row->abgabedatum) + if (!$row->abgabedatum) { $htmlstr .= " "; } @@ -692,6 +695,56 @@ while ($row=@$db->db_fetch_object($result)) { $htmlstr .= "     "; } + + if (file_exists(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf')) + { + $signaturVorhanden = false; + if ($row->paabgabetyp_kurzbz == 'end') + { + if(defined('ABGABETOOL_CHECK_SIGNATURE') && ABGABETOOL_CHECK_SIGNATURE) + { + // Check if the document is signed + $signList = SignatureLib::list(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf'); + if (is_array($signList) && count($signList) > 0) + { + $signaturVorhanden = true; + // The document is signed + } + elseif ($signList === null) + { + $uploadedDocumentSigned = 'WARNING: signature server error'; + } + else + { + $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); + } + } + } + if ($uploadedDocumentSigned != null) + { + $htmlstr .= ' + +
+ '.$uploadedDocumentSigned.' +
+ '; + } + elseif($signaturVorhanden) + { + $htmlstr .= ' + +
+ '.$p->t('abgabetool/uploadedDocumentSigned').' +
+ '; + } + } + else + { + $htmlstr .= "     "; + } + + $htmlstr .= " \n"; @@ -710,7 +763,7 @@ $htmlstr .= ''."\n"; //$htmlstr .= ""; $htmlstr .= "  "; -$htmlstr .= " \n"; +$htmlstr .= " \n"; $htmlstr .= " '."\n"; } - else + else // endupload type { //Upload der Endabgabe - Eingabe der Zusatzdaten $command='add'; - if(!$error) + if (!$error) { move_uploaded_file($_FILES['datei']['tmp_name'], PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); } - if(file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) + + $signaturVorhanden = true; + + if (file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) { + if(defined('ABGABETOOL_CHECK_SIGNATURE') && ABGABETOOL_CHECK_SIGNATURE) + { + // Check if the document is signed + $signList = SignatureLib::list(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); + if (is_array($signList) && count($signList) > 0) + { + // The document is signed + } + elseif ($signList === null) + { + $uploadedDocumentSigned = 'WARNING: signature server error'; + } + else + { + $signaturVorhanden = false; + $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSignedStudent'); + } + } + /*$qry="UPDATE campus.tbl_paabgabe SET abgabedatum = now(), updatevon = '".$user."', @@ -339,6 +393,7 @@ if($command=="update" && $error!=true) $htmlstr .= ''."\n"; $htmlstr .= ''."\n"; $htmlstr .= ''."\n"; + $htmlstr .= ''."\n"; $htmlstr .= "\n"; $htmlstr .= "".$p->t('abgabetool/spracheDerArbeit').":"; $sprache = @$db->db_query("SELECT sprache FROM public.tbl_sprache"); @@ -372,6 +427,21 @@ if($command=="update" && $error!=true) $htmlstr .= ''.$p->t('abgabetool/seitenanzahl').':* '."\n"; $htmlstr .=" \n"; + + // If there are info about the signed document + if ($uploadedDocumentSigned != null) + { + $htmlstr .= "\n"; + $htmlstr .= ""; + $htmlstr .= '
+ + '.$uploadedDocumentSigned.' +
'; + $htmlstr .= ""; + $htmlstr .= "\n"; + } + + $htmlstr .=" \n"; $htmlstr .="

".$p->t('abgabetool/eidesstattlicheErklaerung')."

\n"; $htmlstr .= "".$p->t('abgabetool/gelesenUndAkzeptiert').":* "; $htmlstr .=" * ".$p->t('abgabetool/pflichtfeld')." diff --git a/cis/private/lehre/lvincoming.php b/cis/private/lehre/lvincoming.php deleted file mode 100644 index f81292aab..000000000 --- a/cis/private/lehre/lvincoming.php +++ /dev/null @@ -1,146 +0,0 @@ - - * Andreas Oesterreicher < andreas.oesterreicher@technikum-wien.at > - * Rudolf Hangl < rudolf.hangl@technikum-wien.at > - */ -require_once('../../../config/cis.config.inc.php'); -require_once('../../../include/studiensemester.class.php'); -require_once('../../../include/studiengang.class.php'); - -$db = new basis_db(); - -$stsem = new studiensemester(); -$stsem->getNextStudiensemester(); - -$stg = new studiengang(); -$stg->getAll(); -?> - - - - - - - - Lehrveranstaltungen - Übersicht - - - - -   - - - - - - - - - - - -
-  Lehrveranstaltungen - Übersicht ('.$stsem->studiensemester_kurzbz.') -
 
- '; - - $qry = "SELECT - tbl_lehrveranstaltung.lehrveranstaltung_id, tbl_lehrveranstaltung.studiengang_kz, - tbl_lehrveranstaltung.bezeichnung, tbl_lehrveranstaltung.semester, - tbl_lehrveranstaltung.bezeichnung_english, tbl_lehrveranstaltung.incoming, - tbl_lehrveranstaltung.sprache, - ( - SELECT - count(*) - FROM - campus.vw_student_lehrveranstaltung - JOIN public.tbl_student ON(uid=student_uid) - JOIN public.tbl_prestudentstatus USING(prestudent_id) - WHERE - lehrveranstaltung_id=tbl_lehrveranstaltung.lehrveranstaltung_id AND - lehreinheit_id in (SELECT lehreinheit_id FROM lehre.tbl_lehreinheit - WHERE lehrveranstaltung_id=tbl_lehrveranstaltung.lehrveranstaltung_id - AND tbl_lehreinheit.studiensemester_kurzbz='$stsem->studiensemester_kurzbz') - AND tbl_prestudentstatus.status_kurzbz='Incoming' - AND tbl_prestudentstatus.status_kurzbz='$stsem->studiensemester_kurzbz' - GROUP BY uid - ) as anzahlincoming - FROM - lehre.tbl_lehrveranstaltung JOIN public.tbl_studiengang USING(studiengang_kz) - WHERE - tbl_lehrveranstaltung.incoming>0 AND - tbl_lehrveranstaltung.aktiv AND - tbl_lehrveranstaltung.lehre - AND tbl_lehrveranstaltung.studiengang_kz>0 AND tbl_lehrveranstaltung.studiengang_kz<10000 - AND tbl_studiengang.aktiv - "; - - echo ' - - - - - - - - - - - - - - '; - if($result = $db->db_query($qry)) - { - $i=0; - while($row = $db->db_fetch_object($result)) - { - $freieplaetze = $row->incoming - $row->anzahlincoming; - if($freieplaetze<0) - $freieplaetze=0; - - $i++; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - } - } - echo '
IDStudiengangSemesterSpracheLehrveranstaltungLehrveranstaltung EnglischLV-InfoPlätze gesamtFreie Plätze
',$row->lehrveranstaltung_id,'',$stg->kuerzel_arr[$row->studiengang_kz],'',$row->semester,'',$row->sprache,'',$row->bezeichnung,'',$row->bezeichnung_english,' - Deutsch  - Englisch - ',$row->incoming,'',$freieplaetze,'
'; -?> -
- - - - - - diff --git a/cis/private/lvplan/raumsuche.php b/cis/private/lvplan/raumsuche.php index 0cb9677d4..7be028be8 100644 --- a/cis/private/lvplan/raumsuche.php +++ b/cis/private/lvplan/raumsuche.php @@ -47,11 +47,11 @@ echo ' - - - - - + + + + +