From 2a8b61c07fe60d031d0af852c045b52dbbfbeac7 Mon Sep 17 00:00:00 2001 From: Paolo Date: Wed, 11 May 2022 18:29:10 +0200 Subject: [PATCH 01/25] - Added new library application/libraries/SignatureLib.php - Changed configs for the signature server in config/vilesci.config-default.inc.php - Changed include/dokument_export.class.php to make use of the new configs --- application/libraries/SignatureLib.php | 76 ++++++++++++++++++++++++++ config/vilesci.config-default.inc.php | 11 +++- include/dokument_export.class.php | 2 +- 3 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 application/libraries/SignatureLib.php diff --git a/application/libraries/SignatureLib.php b/application/libraries/SignatureLib.php new file mode 100644 index 000000000..b8c4374a3 --- /dev/null +++ b/application/libraries/SignatureLib.php @@ -0,0 +1,76 @@ +sendsJson() + ->authenticateWith(SIGNATUR_USER, SIGNATUR_PASSWORD) + ->body('{"filename": "'.basename($inputFileName).'", "content": "'.base64_encode($inputFileContent).'"}') + ->expectsJson() + ->send(); + } + } + catch(\Httpful\Exception\ConnectionErrorException $cee) // Httpful exception + { + $resultList = $cee->getMessage(); + } + catch (Exception $e) // any other exception + { + $resultList = $e->getMessage(); + } + + // If the response is fine + if (isset($resultPost->body) && is_object($resultPost->body) && isset($resultPost->body->retval)) + { + return $resultPost->body->retval; + } + + return $resultList; + } +} + diff --git a/config/vilesci.config-default.inc.php b/config/vilesci.config-default.inc.php index 5285eef3b..a3e4cbece 100644 --- a/config/vilesci.config-default.inc.php +++ b/config/vilesci.config-default.inc.php @@ -186,11 +186,16 @@ define('FHC_REST_PASSWORD', 'password'); * Signatur * DEFAULT: https://signatur.example.com/api/sign */ -define('SIGNATUR_URL', 'https://signatur.example.com/api/sign'); +// Generic URL +define('SIGNATUR_URL', 'https://signatur.dev.technikum-wien.at/api'); +// Sign API +define('SIGNATUR_SIGN_API', 'sign'); +// List API +define('SIGNATUR_LIST_API', 'list'); // User für Zugriff auf Signaturserver -define('SIGNATUR_USER', 'username'); +define('SIGNATUR_USER', 'fhcomplete'); // Passwort für Zugriff auf Signaturserver -define('SIGNATUR_PASSWORD', 'password'); +define('SIGNATUR_PASSWORD', 'Fhcomplet3Signature!'); // Signaturprofil das verwendet werden soll define('SIGNATUR_DEFAULT_PROFILE', 'FHC_AMT_GROSS_DE'); diff --git a/include/dokument_export.class.php b/include/dokument_export.class.php index 4f23a7dcd..3a6e57657 100644 --- a/include/dokument_export.class.php +++ b/include/dokument_export.class.php @@ -527,7 +527,7 @@ class dokument_export $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, SIGNATUR_URL); + curl_setopt($ch, CURLOPT_URL, SIGNATUR_URL.'/'.SIGNATUR_SIGN_API); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 7); curl_setopt($ch, CURLOPT_USERAGENT, "FH-Complete"); From d4042228d9114502fd0151510df15effa43b21e2 Mon Sep 17 00:00:00 2001 From: Paolo Date: Fri, 13 May 2022 20:11:31 +0200 Subject: [PATCH 02/25] - Better code and comments in application/libraries/SignatureLib->list - cis/private/lehre/abgabe_lektor_details.php and cis/private/lehre/abgabe_student_details.php check if the uploaded document contains digital signares and display a phrase - Added new phrase to locale/de-AT/abgabetool.php and locale/en-US/abgabetool.php --- application/libraries/SignatureLib.php | 15 +++--- cis/private/lehre/abgabe_lektor_details.php | 25 +++++++++- cis/private/lehre/abgabe_student_details.php | 49 ++++++++++++++++---- locale/de-AT/abgabetool.php | 1 + locale/en-US/abgabetool.php | 1 + 5 files changed, 73 insertions(+), 18 deletions(-) diff --git a/application/libraries/SignatureLib.php b/application/libraries/SignatureLib.php index b8c4374a3..132545219 100644 --- a/application/libraries/SignatureLib.php +++ b/application/libraries/SignatureLib.php @@ -33,16 +33,13 @@ class SignatureLib */ public static function list($inputFileName) { - // Generic error occurred - $resultList = 'Generic error occurred'; - try { // Get the content of the given file $inputFileContent = file_get_contents($inputFileName); if ($inputFileContent === false) // if failed { - $resultList = 'An error occurred while getting the content from: '.$inputFileName; + error_log('An error occurred while getting the content from: '.$inputFileName); } else { @@ -57,20 +54,22 @@ class SignatureLib } catch(\Httpful\Exception\ConnectionErrorException $cee) // Httpful exception { - $resultList = $cee->getMessage(); + error_log($cee->getMessage()); } catch (Exception $e) // any other exception { - $resultList = $e->getMessage(); + error_log($e->getMessage()); } // If the response is fine - if (isset($resultPost->body) && is_object($resultPost->body) && isset($resultPost->body->retval)) + if (isset($resultPost->body) && is_object($resultPost->body) + && isset($resultPost->body->retval) && is_array($resultPost->body->retval)) { return $resultPost->body->retval; } - return $resultList; + // Otherwise return a null as error + return null; } } diff --git a/cis/private/lehre/abgabe_lektor_details.php b/cis/private/lehre/abgabe_lektor_details.php index a508de098..e1b47369d 100644 --- a/cis/private/lehre/abgabe_lektor_details.php +++ b/cis/private/lehre/abgabe_lektor_details.php @@ -37,6 +37,7 @@ require_once('../../../include/phrasen.class.php'); require_once('../../../include/projektarbeit.class.php'); require_once('../../../include/projektbetreuer.class.php'); require_once('../../../include/sancho.inc.php'); +require_once('../../../application/libraries/SignatureLib.php'); if (!$db = new basis_db()) $db=false; @@ -642,7 +643,29 @@ $result=@$db->db_query($qry); } if(file_exists(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf')) { - $htmlstr .= " PDF"; + $uploadedDocumentSigned = null; + + // Check if the document is signed + $signList = SignatureLib::list(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf'); + if (is_array($signList) && count($signList) > 0) + { + // The document is signed + } + elseif ($signList === null) + { + $uploadedDocumentSigned = 'WARNING: signature server error'; + } + else + { + $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); + } + + $htmlstr .= " + + PDF + + ".$uploadedDocumentSigned." + "; } else { diff --git a/cis/private/lehre/abgabe_student_details.php b/cis/private/lehre/abgabe_student_details.php index 29d74ab66..b8a8f158e 100644 --- a/cis/private/lehre/abgabe_student_details.php +++ b/cis/private/lehre/abgabe_student_details.php @@ -36,6 +36,7 @@ require_once('../../../include/phrasen.class.php'); require_once('../../../include/projektarbeit.class.php'); require_once('../../../include/projektbetreuer.class.php'); require_once('../../../include/sancho.inc.php'); +require_once('../../../application/libraries/SignatureLib.php'); $anzeigesprache = getSprache(); $p = new phrasen($anzeigesprache); @@ -111,6 +112,7 @@ $titel = $projektarbeit_obj->titel; $person = new person(); $person->load($bid); $betreuer = $person->titelpre.' '.$person->vorname.' '.$person->nachname.' '.$person->titelpost; +$uploadedDocumentSigned = null; if($uid!=$user) { @@ -286,15 +288,20 @@ if($command=="update" && $error!=true) move_uploaded_file($_FILES['datei']['tmp_name'], PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); if(file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) { - exec('chmod 640 "'.PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'.'"'); - - $qry="UPDATE campus.tbl_paabgabe SET - abgabedatum = now(), - updatevon = ".$db->db_add_param($user).", - updateamum = now() - WHERE paabgabe_id=".$db->db_add_param($paabgabe_id, FHC_INTEGER); - $result=$db->db_query($qry); - echo $p->t('global/dateiErfolgreichHochgeladen'); + // 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 + { + $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); + } } else { @@ -311,6 +318,21 @@ if($command=="update" && $error!=true) } if(file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) { + // 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 + { + $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); + } + /*$qry="UPDATE campus.tbl_paabgabe SET abgabedatum = now(), updatevon = '".$user."', @@ -339,6 +361,15 @@ if($command=="update" && $error!=true) $htmlstr .= ''."\n"; $htmlstr .= ''."\n"; $htmlstr .= ''."\n"; + + // If there are info about the signed document + if ($uploadedDocumentSigned != null) + { + $htmlstr .= "\n"; + $htmlstr .= "".$uploadedDocumentSigned.""; + $htmlstr .= "\n"; + } + $htmlstr .= "\n"; $htmlstr .= "".$p->t('abgabetool/spracheDerArbeit').":"; $sprache = @$db->db_query("SELECT sprache FROM public.tbl_sprache"); diff --git a/locale/de-AT/abgabetool.php b/locale/de-AT/abgabetool.php index c4b17318b..6d1eb923f 100644 --- a/locale/de-AT/abgabetool.php +++ b/locale/de-AT/abgabetool.php @@ -91,4 +91,5 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Projektbeurteilung heru $this->phrasen['abgabetool/projektbeurteilungErstDownload']='Erst-/Begutachter'; $this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Zweitbegutachter'; $this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Fehler beim Ermitteln des Enduplaods der Projektarbeit'; +$this->phrasen['abgabetool/uploadedDocumentNotSigned']='The uploaded document is not signed DE'; ?> diff --git a/locale/en-US/abgabetool.php b/locale/en-US/abgabetool.php index b05456faa..c782dedcc 100644 --- a/locale/en-US/abgabetool.php +++ b/locale/en-US/abgabetool.php @@ -91,4 +91,5 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Thesis-Assessment downl $this->phrasen['abgabetool/projektbeurteilungErstDownload']='First-/Assessor'; $this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Second Assessor'; $this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Error when getting endupload of project work'; +$this->phrasen['abgabetool/uploadedDocumentNotSigned']='The uploaded document is not signed EN'; ?> From 22bba685ffcacdbb0ee1b2847cea3eab8b3c8a65 Mon Sep 17 00:00:00 2001 From: Paolo Date: Mon, 16 May 2022 16:15:48 +0200 Subject: [PATCH 03/25] Added new style to the warning --- cis/private/lehre/abgabe_lektor_details.php | 27 ++++++++++++-------- cis/private/lehre/abgabe_student_details.php | 24 ++++++++++------- locale/de-AT/abgabetool.php | 2 +- locale/en-US/abgabetool.php | 2 +- 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/cis/private/lehre/abgabe_lektor_details.php b/cis/private/lehre/abgabe_lektor_details.php index e1b47369d..29a1221af 100644 --- a/cis/private/lehre/abgabe_lektor_details.php +++ b/cis/private/lehre/abgabe_lektor_details.php @@ -641,6 +641,14 @@ $result=@$db->db_query($qry); { $htmlstr .= "               "; } + if($row->abgabedatum && $row->paabgabetyp_kurzbz=="end") + { + $htmlstr .= " zusätzliche Daten"; + } + else + { + $htmlstr .= "     "; + } if(file_exists(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf')) { $uploadedDocumentSigned = null; @@ -663,17 +671,14 @@ $result=@$db->db_query($qry); $htmlstr .= " PDF - - ".$uploadedDocumentSigned." - "; - } - else - { - $htmlstr .= "     "; - } - if($row->abgabedatum && $row->paabgabetyp_kurzbz=="end") - { - $htmlstr .= " zusätzliche Daten"; + "; + if ($uploadedDocumentSigned != null) + { + $htmlstr .= '
+ '.$uploadedDocumentSigned.' +
'; + } + $htmlstr .= ""; } else { diff --git a/cis/private/lehre/abgabe_student_details.php b/cis/private/lehre/abgabe_student_details.php index b8a8f158e..949749a3b 100644 --- a/cis/private/lehre/abgabe_student_details.php +++ b/cis/private/lehre/abgabe_student_details.php @@ -361,15 +361,6 @@ if($command=="update" && $error!=true) $htmlstr .= ''."\n"; $htmlstr .= ''."\n"; $htmlstr .= ''."\n"; - - // If there are info about the signed document - if ($uploadedDocumentSigned != null) - { - $htmlstr .= "\n"; - $htmlstr .= "".$uploadedDocumentSigned.""; - $htmlstr .= "\n"; - } - $htmlstr .= "\n"; $htmlstr .= "".$p->t('abgabetool/spracheDerArbeit').":"; $sprache = @$db->db_query("SELECT sprache FROM public.tbl_sprache"); @@ -403,6 +394,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/locale/de-AT/abgabetool.php b/locale/de-AT/abgabetool.php index 6d1eb923f..093b56255 100644 --- a/locale/de-AT/abgabetool.php +++ b/locale/de-AT/abgabetool.php @@ -91,5 +91,5 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Projektbeurteilung heru $this->phrasen['abgabetool/projektbeurteilungErstDownload']='Erst-/Begutachter'; $this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Zweitbegutachter'; $this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Fehler beim Ermitteln des Enduplaods der Projektarbeit'; -$this->phrasen['abgabetool/uploadedDocumentNotSigned']='The uploaded document is not signed DE'; +$this->phrasen['abgabetool/uploadedDocumentNotSigned']='Warning! The uploaded document is not signed DE'; ?> diff --git a/locale/en-US/abgabetool.php b/locale/en-US/abgabetool.php index c782dedcc..333e21272 100644 --- a/locale/en-US/abgabetool.php +++ b/locale/en-US/abgabetool.php @@ -91,5 +91,5 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Thesis-Assessment downl $this->phrasen['abgabetool/projektbeurteilungErstDownload']='First-/Assessor'; $this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Second Assessor'; $this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Error when getting endupload of project work'; -$this->phrasen['abgabetool/uploadedDocumentNotSigned']='The uploaded document is not signed EN'; +$this->phrasen['abgabetool/uploadedDocumentNotSigned']='Warning! The uploaded document is not signed'; ?> From 2d2383639617fe349f8263927d607556afb7d6e7 Mon Sep 17 00:00:00 2001 From: Paolo Date: Mon, 16 May 2022 16:23:15 +0200 Subject: [PATCH 04/25] Translated german phrase --- locale/de-AT/abgabetool.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/de-AT/abgabetool.php b/locale/de-AT/abgabetool.php index 093b56255..378544811 100644 --- a/locale/de-AT/abgabetool.php +++ b/locale/de-AT/abgabetool.php @@ -91,5 +91,5 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Projektbeurteilung heru $this->phrasen['abgabetool/projektbeurteilungErstDownload']='Erst-/Begutachter'; $this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Zweitbegutachter'; $this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Fehler beim Ermitteln des Enduplaods der Projektarbeit'; -$this->phrasen['abgabetool/uploadedDocumentNotSigned']='Warning! The uploaded document is not signed DE'; +$this->phrasen['abgabetool/uploadedDocumentNotSigned']='Warnung! Das hochgeladene Dokument ist nicht signiert'; ?> From 94a1534c14e3ec3781adef1be5db921b0e29c68e Mon Sep 17 00:00:00 2001 From: Paolo Date: Mon, 23 May 2022 14:42:59 +0200 Subject: [PATCH 05/25] - Warning Wrap on small Screens in Leturer side - Perform Signatur Check only on Files from Type Endupload --- cis/private/lehre/abgabe_lektor_details.php | 57 ++++++++++++-------- cis/private/lehre/abgabe_student_details.php | 28 +++------- 2 files changed, 40 insertions(+), 45 deletions(-) diff --git a/cis/private/lehre/abgabe_lektor_details.php b/cis/private/lehre/abgabe_lektor_details.php index 29a1221af..f0a19c89a 100644 --- a/cis/private/lehre/abgabe_lektor_details.php +++ b/cis/private/lehre/abgabe_lektor_details.php @@ -548,6 +548,8 @@ $htmlstr .= " $result=@$db->db_query($qry); while ($row=@$db->db_fetch_object($result)) { + $uploadedDocumentSigned = null; + $htmlstr .= "
\n"; $htmlstr .= "\n"; $htmlstr .= "\n"; @@ -649,43 +651,52 @@ $result=@$db->db_query($qry); { $htmlstr .= "     "; } - if(file_exists(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf')) - { - $uploadedDocumentSigned = null; - // Check if the document is signed - $signList = SignatureLib::list(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf'); - if (is_array($signList) && count($signList) > 0) + if (file_exists(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf')) + { + if ($row->paabgabetyp_kurzbz == 'end') { - // The document is signed - } - elseif ($signList === null) - { - $uploadedDocumentSigned = 'WARNING: signature server error'; - } - else - { - $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); + // Check if the document is signed + $signList = SignatureLib::list(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf'); + if (is_array($signList) && count($signList) > 0) + { + // The document is signed + } + elseif ($signList === null) + { + $uploadedDocumentSigned = 'WARNING: signature server error'; + } + else + { + $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); + } } $htmlstr .= " PDF - "; - if ($uploadedDocumentSigned != null) - { - $htmlstr .= '
- '.$uploadedDocumentSigned.' -
'; - } - $htmlstr .= ""; + + "; } else { $htmlstr .= "     "; } + $htmlstr .= " \n"; + if ($uploadedDocumentSigned != null) + { + $htmlstr .= ' + + + +
+ '.$uploadedDocumentSigned.' +
+ + '; + } $htmlstr .= "
\n"; } diff --git a/cis/private/lehre/abgabe_student_details.php b/cis/private/lehre/abgabe_student_details.php index 949749a3b..ed29519ff 100644 --- a/cis/private/lehre/abgabe_student_details.php +++ b/cis/private/lehre/abgabe_student_details.php @@ -282,41 +282,25 @@ if($command=="update" && $error!=true) $extensions = explode(".", $_FILES['datei']['name']); if(strtoupper(end($extensions))=='PDF') { - if($paabgabetyp_kurzbz!='end') + if ($paabgabetyp_kurzbz != 'end') { //"normaler" Upload move_uploaded_file($_FILES['datei']['tmp_name'], PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); - if(file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) - { - // 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 - { - $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); - } - } - else + if (!file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) { echo $p->t('global/dateiNichtErfolgreichHochgeladen'); } } - 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')) + + if (file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) { // Check if the document is signed $signList = SignatureLib::list(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); From c354c69e212be33093bf27000ca9efa54a891e44 Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 24 May 2022 11:23:48 +0200 Subject: [PATCH 06/25] Fixed Zwischenabgabe file upload --- cis/private/lehre/abgabe_student_details.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cis/private/lehre/abgabe_student_details.php b/cis/private/lehre/abgabe_student_details.php index ed29519ff..f91f410ab 100644 --- a/cis/private/lehre/abgabe_student_details.php +++ b/cis/private/lehre/abgabe_student_details.php @@ -286,7 +286,19 @@ if($command=="update" && $error!=true) { //"normaler" Upload move_uploaded_file($_FILES['datei']['tmp_name'], PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); - if (!file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) + if (file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) + { + exec('chmod 640 "'.PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'.'"'); + + $qry="UPDATE campus.tbl_paabgabe SET + abgabedatum = now(), + updatevon = ".$db->db_add_param($user).", + updateamum = now() + WHERE paabgabe_id=".$db->db_add_param($paabgabe_id, FHC_INTEGER); + $result=$db->db_query($qry); + echo $p->t('global/dateiErfolgreichHochgeladen'); + } + else { echo $p->t('global/dateiNichtErfolgreichHochgeladen'); } From 7f2025c41405f261fa103ea4a242730c056f1c0f Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 24 May 2022 11:27:24 +0200 Subject: [PATCH 07/25] Added signature config entries to config/cis.config-default.inc.php --- config/cis.config-default.inc.php | 17 +++++++++++++++++ config/vilesci.config-default.inc.php | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/config/cis.config-default.inc.php b/config/cis.config-default.inc.php index 9d31548f6..d6f920259 100644 --- a/config/cis.config-default.inc.php +++ b/config/cis.config-default.inc.php @@ -204,6 +204,23 @@ define('TABLE_ID','_id'); define('TABLE_BEGIN','tbl_'); define('VIEW_BEGIN','vw_'); +/** + * Signatur + * DEFAULT: https://signatur.example.com/api/sign + */ +// Generic URL +define('SIGNATUR_URL', 'https://signatur.dev.technikum-wien.at/api'); +// Sign API +define('SIGNATUR_SIGN_API', 'sign'); +// List API +define('SIGNATUR_LIST_API', 'list'); +// User für Zugriff auf Signaturserver +define('SIGNATUR_USER', 'fhcomplete'); +// Passwort für Zugriff auf Signaturserver +define('SIGNATUR_PASSWORD', 'supersecretpassword'); +// Signaturprofil das verwendet werden soll +define('SIGNATUR_DEFAULT_PROFILE', 'FHC_AMT_GROSS_DE'); + //Gibt an, ob das Studienbuchblatt im CIS gedruckt werden kann define('CIS_DOKUMENTE_STUDIENBUCHLBATT_DRUCKEN',true); diff --git a/config/vilesci.config-default.inc.php b/config/vilesci.config-default.inc.php index a3e4cbece..c4232b020 100644 --- a/config/vilesci.config-default.inc.php +++ b/config/vilesci.config-default.inc.php @@ -195,7 +195,7 @@ define('SIGNATUR_LIST_API', 'list'); // User für Zugriff auf Signaturserver define('SIGNATUR_USER', 'fhcomplete'); // Passwort für Zugriff auf Signaturserver -define('SIGNATUR_PASSWORD', 'Fhcomplet3Signature!'); +define('SIGNATUR_PASSWORD', 'supersecretpassword'); // Signaturprofil das verwendet werden soll define('SIGNATUR_DEFAULT_PROFILE', 'FHC_AMT_GROSS_DE'); From 8880e07bf20d1332455a4a598e5cd44a4d42be8d Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 24 May 2022 12:22:30 +0200 Subject: [PATCH 08/25] include/dokument_export.class.php now checks the new signature server response structure --- include/dokument_export.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/dokument_export.class.php b/include/dokument_export.class.php index 3a6e57657..7d797cb21 100644 --- a/include/dokument_export.class.php +++ b/include/dokument_export.class.php @@ -559,18 +559,19 @@ class dokument_export curl_close($ch); $resultdata = json_decode($result); - if (isset($resultdata->success) && $resultdata->success == 'true') + // If it is success + if (isset($resultdata->error) && $resultdata->error == 0) { $this->signed_filename = $this->temp_folder .'/signed.pdf'; - file_put_contents($this->signed_filename, base64_decode($resultdata->document)); + file_put_contents($this->signed_filename, base64_decode($resultdata->retval)); return true; } - else + else // otherwise if it is an error { - if(isset($resultdata->errormsg)) - $this->errormsg = $resultdata->errormsg; + if(isset($resultdata->retval)) + $this->errormsg = $resultdata->retval; else - $this->errormsg = 'Unknown Error:'.print_r($resultdata,true); + $this->errormsg = 'Unknown Error:'.print_r($resultdata, true); return false; } } From ec07c4154d69bd9a84342347c9e19cda114da4db Mon Sep 17 00:00:00 2001 From: Nikolaus Krondraf Date: Tue, 20 Sep 2022 14:31:51 +0200 Subject: [PATCH 09/25] Problem behoben wodurch die Anrechnungen im FAS nicht angezeigt werden wenn diese ohne Anrechnungstool im FAS erfasst werden --- rdf/anrechnung.rdf.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/rdf/anrechnung.rdf.php b/rdf/anrechnung.rdf.php index 14fc1fd1a..8b4858679 100644 --- a/rdf/anrechnung.rdf.php +++ b/rdf/anrechnung.rdf.php @@ -32,8 +32,10 @@ if(is_numeric($anrechnung_id)) // Add last Anrechnungstatus $anrechnungstatus = new Anrechnung(); $anrechnungstatus->getLastAnrechnungstatus($anrechnung_id); - - $anrechnung->result[0]->status = $anrechnungstatus->result[0]->bezeichnung_mehrsprachig[DEFAULT_LANGUAGE]; + if(isset($anrechnungstatus->result[0])) + $anrechnung->result[0]->status = $anrechnungstatus->result[0]->bezeichnung_mehrsprachig[DEFAULT_LANGUAGE]; + else + $anrechnung->result[0]->status = ''; } elseif(is_numeric($prestudent_id)) { @@ -46,7 +48,10 @@ elseif(is_numeric($prestudent_id)) { $anrechnungstatus = new Anrechnung(); $status = $anrechnungstatus->getLastAnrechnungstatus($row->anrechnung_id); - $row->status = $anrechnungstatus->result[0]->bezeichnung_mehrsprachig[DEFAULT_LANGUAGE]; + if(isset($anrechnungstatus->result[0])) + $row->status = $anrechnungstatus->result[0]->bezeichnung_mehrsprachig[DEFAULT_LANGUAGE]; + else + $row->status = ''; } } } From 01107e361fdcbf01723c57e70e77e3f6b8ff0713 Mon Sep 17 00:00:00 2001 From: Nikolaus Krondraf Date: Fri, 18 Nov 2022 10:01:39 +0100 Subject: [PATCH 10/25] =?UTF-8?q?Studierende=20k=C3=B6nnen=20sich=20fr?= =?UTF-8?q?=C3=BChestens=202=20Monate=20vor=20Pr=C3=BCfung=20anmelden?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/private/lehre/pruefung/pruefung.js.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cis/private/lehre/pruefung/pruefung.js.php b/cis/private/lehre/pruefung/pruefung.js.php index f2435828d..6dda6e0fe 100644 --- a/cis/private/lehre/pruefung/pruefung.js.php +++ b/cis/private/lehre/pruefung/pruefung.js.php @@ -353,10 +353,9 @@ function writePruefungsTable(e, data, anmeldung) var time = termin[1].substring(0,5); termin = termin[0].split("-"); - // Wie viele Monate vor Prüfungen dürfen sich Studierende anmelden? - // Sperre "deaktiviert" indem man sich 24 Monate vorher anmelden darf + // Studierende dürfen sich 2 Monate vor Prüfungen anmelden? var minimumFrist = new Date(termin[0], termin[1]-1,termin[2]); - minimumFrist.setMonth(minimumFrist.getMonth() - 24); + minimumFrist.setMonth(minimumFrist.getMonth() - 2); termin = new Date(termin[0], termin[1]-1,termin[2]); var frist = termin; From 1ec742b8fe1f8fa366e69f371b40faf0b38df44d Mon Sep 17 00:00:00 2001 From: Nikolaus Krondraf Date: Fri, 18 Nov 2022 10:05:38 +0100 Subject: [PATCH 11/25] typo --- cis/private/lehre/pruefung/pruefung.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cis/private/lehre/pruefung/pruefung.js.php b/cis/private/lehre/pruefung/pruefung.js.php index 6dda6e0fe..f1bafe192 100644 --- a/cis/private/lehre/pruefung/pruefung.js.php +++ b/cis/private/lehre/pruefung/pruefung.js.php @@ -353,7 +353,7 @@ function writePruefungsTable(e, data, anmeldung) var time = termin[1].substring(0,5); termin = termin[0].split("-"); - // Studierende dürfen sich 2 Monate vor Prüfungen anmelden? + // Studierende dürfen sich 2 Monate vor Prüfungen anmelden var minimumFrist = new Date(termin[0], termin[1]-1,termin[2]); minimumFrist.setMonth(minimumFrist.getMonth() - 2); From 62550423a3a9536fc0d5b6f13c953e4a0a991c77 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Thu, 23 Feb 2023 16:07:52 +0100 Subject: [PATCH 12/25] - geparkt und onhold von der log tabelle in eine eigene tabelle verschoben - nicht mehr benoetigte funktionen entfernt - infocentertool angepasst - bewerbungstool angepasst - phrasen hinzugefuegt --- .../system/infocenter/InfoCenter.php | 119 +-------- .../system/infocenter/Rueckstellung.php | 116 +++++++++ application/libraries/PersonLogLib.php | 165 ------------ .../models/crm/RueckstellungStatus_model.php | 14 + .../models/crm/Rueckstellung_model.php | 43 +++ .../system/infocenter/infocenterData.php | 54 ++-- .../system/infocenter/infocenterDetails.php | 35 +-- .../infocenter/infocenterZgvDetails.php | 1 + include/rueckstellung.class.php | 38 +++ public/js/infocenter/infocenterDetails.js | 246 +----------------- public/js/infocenter/rueckstellung.js | 203 +++++++++++++++ public/js/infocenter/zgvUeberpruefung.js | 4 +- system/dbupdate_3.4.php | 1 + ...49_infocenter_zurueckstellen_mit_grund.php | 64 +++++ system/phrasesupdate.php | 61 +++++ 15 files changed, 583 insertions(+), 581 deletions(-) create mode 100644 application/controllers/system/infocenter/Rueckstellung.php create mode 100644 application/models/crm/RueckstellungStatus_model.php create mode 100644 application/models/crm/Rueckstellung_model.php create mode 100644 include/rueckstellung.class.php create mode 100644 public/js/infocenter/rueckstellung.js create mode 100644 system/dbupdate_3.4/27949_infocenter_zurueckstellen_mit_grund.php diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index d027e559e..548b071d3 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -142,12 +142,6 @@ class InfoCenter extends Auth_Controller 'reloadNotizen' => array('infocenter:r', 'lehre/zgvpruefung:r'), 'reloadLogs' => 'infocenter:r', 'outputAkteContent' => array('infocenter:r', 'lehre/zgvpruefung:r'), - 'getPostponeDate' => array('infocenter:r', 'lehre/zgvpruefung:r'), - 'park' => 'infocenter:rw', - 'unpark' => 'infocenter:rw', - 'setOnHold' => 'infocenter:rw', - 'removeOnHold' => array('infocenter:rw', 'lehre/zgvpruefung:rw'), - 'getStudienjahrEnd' => array('infocenter:r', 'lehre/zgvpruefung:r'), 'setNavigationMenuArrayJson' => 'infocenter:r', 'getAbsageData' => 'infocenter:r', 'saveAbsageForAll' => 'infocenter:rw', @@ -164,6 +158,7 @@ class InfoCenter extends Auth_Controller $this->load->model('crm/Statusgrund_model', 'StatusgrundModel'); $this->load->model('crm/ZGVPruefung_model', 'ZGVPruefungModel'); $this->load->model('crm/ZGVPruefungStatus_model', 'ZGVPruefungStatusModel'); + $this->load->model('crm/Rueckstellung_model', 'RueckstellungModel'); $this->load->model('person/Notiz_model', 'NotizModel'); $this->load->model('person/Person_model', 'PersonModel'); $this->load->model('system/Message_model', 'MessageModel'); @@ -606,7 +601,7 @@ class InfoCenter extends Auth_Controller } /** - * Sendet bei einer neuen ZGV Prüfung die Mail raus an den Studiengang + * Sendet bei einer neuen ZGV Prüfung eine Mail an den Studiengang */ private function sendZgvMail($mail, $typ, $person){ $data = array( @@ -697,7 +692,7 @@ class InfoCenter extends Auth_Controller /** * Fügt einen neuen ZGV Status hinzu oder updated einen bestehenden - * Falls es erfolgreich war, sendet er die Mail raus + * Falls es erfolgreich war, wird eine Mail rausgeschickt */ public function zgvRueckfragen() { @@ -751,7 +746,8 @@ class InfoCenter extends Auth_Controller $this->sendZgvMail($mail, $typ, $person); elseif (isError($insert)) $this->terminateWithJsonError('Fehler beim Speichern'); - }else + } + else { $insert = $this->ZGVPruefungModel->insert( array( @@ -781,7 +777,7 @@ class InfoCenter extends Auth_Controller } $hold = false; - if ($this->personloglib->getOnHoldDate($person_id) !== null) + if (hasData($this->RueckstellungModel->getByPersonId($person_id, 'onhold_zgv'))) $hold = true; $this->outputJsonSuccess( @@ -1162,107 +1158,7 @@ class InfoCenter extends Auth_Controller ->set_output($aktecontent->retval) ->_display(); } - - /** - * Gets the date until which a person is parked - * @param $person_id - */ - public function getPostponeDate($person_id) - { - $result = array( - 'type' => null, - 'date' => null - ); - - $parkedDate = $this->personloglib->getParkedDate($person_id); - - if (isset($parkedDate)) - { - $result['type'] = 'parked'; - $result['date'] = $parkedDate; - } - else - { - $onholdDate = $this->personloglib->getOnHoldDate($person_id); - - if (isset($onholdDate)) - { - $result['type'] = 'onhold'; - $result['date'] = $onholdDate; - } - } - - $this->outputJsonSuccess($result); - } - - /** - * Initializes parking of a person, i.e. a person is not expected to do any actions while parked - */ - public function park() - { - $person_id = $this->input->post('person_id'); - $date = $this->input->post('parkdate'); - - $result = $this->personloglib->park($person_id, date_format(date_create($date), 'Y-m-d'), self::TAETIGKEIT, self::APP, null, $this->_uid); - - $this->outputJson($result); - } - - /** - * Removes parking of a person - */ - public function unPark() - { - $person_id = $this->input->post('person_id'); - - $result = $this->personloglib->unPark($person_id); - - $this->outputJson($result); - } - - /** - * Sets a person on hold ("zurückstellen") - */ - public function setOnHold() - { - $person_id = $this->input->post('person_id'); - $date = $this->input->post('onholddate'); - - $result = $this->personloglib->setOnHold($person_id, date_format(date_create($date), 'Y-m-d'), self::TAETIGKEIT, self::APP, null, $this->_uid); - - $this->outputJson($result); - } - - /** - * Removed on hold status of a person - */ - public function removeOnHold() - { - $person_id = $this->input->post('person_id'); - - $result = $this->personloglib->removeOnHold($person_id); - - $this->outputJson($result); - } - - /** - * Gets the End date of the current Studienjahr - */ - public function getStudienjahrEnd() - { - $this->load->model('organisation/studienjahr_model', 'StudienjahrModel'); - - $result = $this->StudienjahrModel->getCurrStudienjahr(); - - $json = null; - - if (hasData($result)) - { - $json = $result->retval[0]->ende; - } - - $this->outputJsonSuccess(array($json)); - } + /** * Wrapper for setNavigationMenu, returns JSON message @@ -1484,7 +1380,6 @@ class InfoCenter extends Auth_Controller if($nachreichungAm < $today) $this->terminateWithJsonError($this->p->t('infocenter', 'nachreichDatumNichtVergangenheit')); - $akte = $this->AkteModel->loadWhere(array('person_id' => $person_id, 'dokument_kurzbz' => $allowedTypes[$typ])); if (hasData($akte)) { diff --git a/application/controllers/system/infocenter/Rueckstellung.php b/application/controllers/system/infocenter/Rueckstellung.php new file mode 100644 index 000000000..4d5bdbb81 --- /dev/null +++ b/application/controllers/system/infocenter/Rueckstellung.php @@ -0,0 +1,116 @@ + array('infocenter:r', 'lehre/zgvpruefung:r'), + 'set' => array('infocenter:r', 'lehre/zgvpruefung:r'), + 'delete' => array('infocenter:r', 'lehre/zgvpruefung:r'), + 'getStatus' => array('infocenter:rw', 'lehre/zgvpruefung:rw'), + 'getStudienjahrEnd' => array('infocenter:r', 'lehre/zgvpruefung:r'), + ) + ); + + $this->load->model('crm/Rueckstellung_model', 'RueckstellungModel'); + $this->load->model('crm/RueckstellungStatus_model', 'RueckstellungStatusModel'); + + $this->_setAuthUID(); // sets property uid + + $this->_ci =& get_instance(); // get code igniter instance + } + + public function get($person_id) + { + $result = null; + $rueckstellung = $this->_ci->RueckstellungModel->getByPersonId($person_id); + + if (isError($rueckstellung)) + $this->terminateWithJsonError($this->_ci->p->t('ui', 'fehlerBeimLesen')); + + if (hasData($rueckstellung)) + $result = getData($rueckstellung)[0]; + + $this->outputJsonSuccess($result); + } + + public function set() + { + $person_id = $this->input->post('person_id'); + $datum_bis = $this->input->post('datum_bis'); + $status_kurzbz = $this->input->post('status_kurzbz'); + + $result = $this->_ci->RueckstellungModel->set($person_id, date_format(date_create($datum_bis), 'Y-m-d'), $status_kurzbz, $this->_uid); + + $this->outputJson($result); + } + + public function delete() + { + $person_id = $this->input->post('person_id'); + $status = $this->input->post('status'); + + $rueckstellungd = $this->_ci->RueckstellungModel->getByPersonId($person_id, $status); + + if (isError($rueckstellungd)) + $this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimLesen')); + + + if (hasData($rueckstellungd)) + { + $rueckstellungd = getData($rueckstellungd)[0]; + $result = $this->_ci->RueckstellungModel->delete($rueckstellungd->rueckstellung_id); + + if (isError($result)) + $this->terminateWithJsonError($this->_ci->p->t('ui', 'fehlerBeimSpeichern')); + + $this->outputJson($result); + } + } + + public function getStatus($aktiv = true) + { + $result = $this->_ci->RueckstellungStatusModel->loadWhere(array('aktiv' => $aktiv)); + + if (isError($result)) + $this->terminateWithJsonError($this->_ci->p->t('ui', 'fehlerBeimLesen')); + + $this->outputJsonSuccess(getData($result)); + } + + /** + * Gets the End date of the current Studienjahr + */ + public function getStudienjahrEnd() + { + $this->load->model('organisation/studienjahr_model', 'StudienjahrModel'); + + $result = $this->_ci->StudienjahrModel->getCurrStudienjahr(); + + $json = null; + + if (hasData($result)) + { + $json = $result->retval[0]->ende; + } + + $this->outputJsonSuccess(array($json)); + } + + /** + * Retrieve the UID of the logged user and checks if it is valid + */ + private function _setAuthUID() + { + $this->_uid = getAuthUID(); + + if (!$this->_uid) show_error('User authentification failed'); + } +} \ No newline at end of file diff --git a/application/libraries/PersonLogLib.php b/application/libraries/PersonLogLib.php index fe9a82504..f4f434fad 100644 --- a/application/libraries/PersonLogLib.php +++ b/application/libraries/PersonLogLib.php @@ -7,9 +7,6 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); */ class PersonLogLib { - const PARKED_LOGNAME = 'Parked'; - const ONHOLD_LOGNAME = 'Onhold'; - /** * Constructor */ @@ -78,168 +75,6 @@ class PersonLogLib else show_error(getError($result)); } - - /** - * Parks a person, i.e. marks a person so no actions are expected for the person (e.g. as a prestudent) - * Done by adding a logentry in the future - * @param $person_id - * @param $date - * @param $taetigkeit_kurzbz - * @param string $app - * @param null $oe_kurzbz - * @param null $user - * @return insert object - */ - public function park($person_id, $date, $taetigkeit_kurzbz, $app = 'core', $oe_kurzbz = null, $user = null) - { - $onhold = $this->getOnHoldDate($person_id); - - if (hasData($onhold)) - return error("Person already on hold"); - - $logjson = array( - 'name' => self::PARKED_LOGNAME - ); - - return $this->_savePsLog($person_id, $date, $taetigkeit_kurzbz, $logjson, $app, $oe_kurzbz, $user); - } - - /** - * Unparks a person, i.e. removes all log entries in the future with logname for parking - * @param $person_id - * @return array with deleted logids - */ - public function unPark($person_id) - { - $deleted = array(); - - $result = $this->ci->PersonLogModel->getLogsInFuture($person_id); - if (hasData($result)) - { - foreach ($result->retval as $log) - { - $logdata = json_decode($log->logdata); - if (isset($logdata->name) && $logdata->name === self::PARKED_LOGNAME) - { - $delresult = $this->ci->PersonLogModel->deleteLog($log->log_id); - if (isSuccess($delresult)) - { - $deleted[] = $log->log_id; - } - } - } - } - - return success($deleted); - } - - /** - * Gets date until which a person is parked - * @param $person_id - * @return the date if person is parked, null otherwise - */ - public function getParkedDate($person_id) - { - $result = $this->ci->PersonLogModel->getLogsInFuture($person_id); - - $parkeddate = null; - - if (hasData($result)) - { - foreach ($result->retval as $log) - { - $logdata = json_decode($log->logdata); - if (isset($logdata->name) && $logdata->name === self::PARKED_LOGNAME) - { - $parkeddate = $log->zeitpunkt; - break; - } - } - } - - return $parkeddate; - } - - /** - * Sets person on hold, i.e. marks a person so no actions are expected for the person (e.g. as a prestudent). - * Done by adding a logentry with a special name. can be undone only manually by clicking button. - * @param $person_id - * @param $date - * @param $taetigkeit_kurzbz - * @param string $app - * @param null $oe_kurzbz - * @param null $user - * @return array - */ - public function setOnHold($person_id, $date, $taetigkeit_kurzbz, $app = 'core', $oe_kurzbz = null, $user = null) - { - $parked = $this->getParkedDate($person_id); - - if (hasData($parked)) - return error("Person already parked"); - - $logjson = array( - 'name' => self::ONHOLD_LOGNAME - ); - - return $this->_savePsLog($person_id, $date, $taetigkeit_kurzbz, $logjson, $app, $oe_kurzbz, $user); - } - - /** - * Removes on hold status, i.e. removes all log entries with logname for on hold - * @param $person_id - * @return array - */ - public function removeOnHold($person_id) - { - $deleted = array(); - - $result = $this->ci->PersonLogModel->filterLog($person_id); - if (hasData($result)) - { - foreach ($result->retval as $log) - { - $logdata = json_decode($log->logdata); - if (isset($logdata->name) && $logdata->name === self::ONHOLD_LOGNAME) - { - $delresult = $this->ci->PersonLogModel->deleteLog($log->log_id); - if (isSuccess($delresult)) - { - $deleted[] = $log->log_id; - } - } - } - } - return success($deleted); - } - - /** - * Gets date until which a person is on hold - * @param $person_id - * @return the date if person is on hold, null otherwise - */ - public function getOnHoldDate($person_id) - { - $result = $this->ci->PersonLogModel->filterLog($person_id); - - $onholddate = null; - - if (hasData($result)) - { - foreach ($result->retval as $log) - { - $logdata = json_decode($log->logdata); - if (isset($logdata->name) && $logdata->name === self::ONHOLD_LOGNAME) - { - $onholddate = $log->zeitpunkt; - break; - } - } - } - - return $onholddate; - } - /** * Saves a processstate log with specified parameters, including a specified log date. * @param $person_id diff --git a/application/models/crm/RueckstellungStatus_model.php b/application/models/crm/RueckstellungStatus_model.php new file mode 100644 index 000000000..a4cb391f1 --- /dev/null +++ b/application/models/crm/RueckstellungStatus_model.php @@ -0,0 +1,14 @@ +dbTable = 'public.tbl_rueckstellung_status'; + $this->pk = 'status_kurzbz'; + } +} \ No newline at end of file diff --git a/application/models/crm/Rueckstellung_model.php b/application/models/crm/Rueckstellung_model.php new file mode 100644 index 000000000..4d4821132 --- /dev/null +++ b/application/models/crm/Rueckstellung_model.php @@ -0,0 +1,43 @@ +dbTable = 'public.tbl_rueckstellung'; + $this->pk = 'rueckstellung_id'; + $this->hasSequence = true; + } + + public function getByPersonId($person_id, $status = null) + { + $language_index = getUserLanguage() == 'German' ? 0 : 1; + + $this->addLimit(1); + $this->addJoin('tbl_rueckstellung_status', 'status_kurzbz'); + $this->addSelect('*, + array_to_json(bezeichnung_mehrsprachig::varchar[])->>'.$language_index . 'as bezeichnung'); + $this->addOrder('datum_bis', 'DESC'); + + $where['person_id'] = $person_id; + + if (!isEmptyString($status)) + $where['status_kurzbz'] = $status; + + return $this->loadWhere($where); + } + + public function set($person_id, $datum_bis, $status_kurzbz, $uid) + { + $exists = $this->getByPersonId($person_id, $status_kurzbz); + + if (hasData($exists)) + return error("Rueckstellung entry already exists"); + + return $this->insert(array('person_id' => $person_id, 'status_kurzbz' => $status_kurzbz, 'datum_bis' => $datum_bis, 'insertvon' => $uid)); + } +} \ No newline at end of file diff --git a/application/views/system/infocenter/infocenterData.php b/application/views/system/infocenter/infocenterData.php index de2bd1bca..de4d19bcb 100644 --- a/application/views/system/infocenter/infocenterData.php +++ b/application/views/system/infocenter/infocenterData.php @@ -7,9 +7,7 @@ $STUDIENGANG_TYP = '\''.$this->variablelib->getVar('infocenter_studiensgangtyp').'\''; $TAETIGKEIT_KURZBZ = '\'bewerbung\', \'kommunikation\''; $LOGDATA_NAME = '\'Login with code\', \'Login with user\', \'Interessent rejected\', \'Attempt to register with existing mailadress\', \'Access code sent\', \'Personal data saved\''; - $LOGDATA_NAME_PARKED = '\'Parked\''; - $LOGDATA_NAME_ONHOLD = '\'Onhold\''; - $LOGTYPE_KURZBZ = '\'Processstate\''; + $POSTPONE_STATUS_PARKED = '\'parked\''; $STATUS_KURZBZ = '\'Wartender\', \'Bewerber\', \'Aufgenommener\', \'Student\''; $ADDITIONAL_STG = $this->config->item('infocenter_studiengang_kz'); $AKTE_TYP = '\'identity\', \'zgv_bakk\''; @@ -27,8 +25,6 @@ p.staatsbuergerschaft AS "Nation", pl.zeitpunkt AS "LockDate", pl.lockuser AS "LockUser", - pd.parkdate AS "ParkDate", - ohd.onholddate AS "OnholdDate", ( SELECT l.zeitpunkt FROM system.tbl_log l @@ -291,7 +287,25 @@ LIMIT 1 ) LIMIT 1 - ) AS "InfoCenterMitarbeiter" + ) AS "InfoCenterMitarbeiter", + ( + SELECT datum_bis + FROM public.tbl_rueckstellung + WHERE datum_bis >= NOW() + AND status_kurzbz = '. $POSTPONE_STATUS_PARKED .' + AND person_id = p.person_id + ORDER BY datum_bis DESC + LIMIT 1 + ) AS "ParkDate", + ( + SELECT datum_bis + FROM public.tbl_rueckstellung + WHERE datum_bis >= NOW() + AND status_kurzbz != '. $POSTPONE_STATUS_PARKED .' + AND person_id = p.person_id + ORDER BY datum_bis DESC + LIMIT 1 + ) AS "OnholdDate" FROM public.tbl_person p LEFT JOIN ( SELECT tpl.person_id, @@ -302,22 +316,6 @@ JOIN public.tbl_person sp ON sb.person_id = sp.person_id WHERE tpl.app = '.$APP.' ) pl USING(person_id) - LEFT JOIN ( - SELECT l.person_id, - l.zeitpunkt AS parkdate - FROM system.tbl_log l - WHERE l.logtype_kurzbz = '.$LOGTYPE_KURZBZ.' - AND l.logdata->>\'name\' = '.$LOGDATA_NAME_PARKED.' - AND l.zeitpunkt >= NOW() - ) pd USING(person_id) - LEFT JOIN ( - SELECT l.person_id, - l.zeitpunkt AS onholddate - FROM system.tbl_log l - WHERE l.logtype_kurzbz = '.$LOGTYPE_KURZBZ.' - AND l.logdata->>\'name\' = '.$LOGDATA_NAME_ONHOLD.' - AND l.zeitpunkt >= NOW() - ) ohd USING(person_id) WHERE EXISTS ( SELECT 1 @@ -344,7 +342,7 @@ AND spss.studiensemester_kurzbz = '.$STUDIENSEMESTER.' ) ) - ORDER BY "LastAction" ASC'; + ORDER BY "OnholdDate" DESC NULLS FIRST, "ParkDate" DESC NULLS FIRST, "LastAction" ASC'; $filterWidgetArray = array( 'query' => $query, @@ -366,8 +364,6 @@ ucfirst($this->p->t('person', 'nation')), ucfirst($this->p->t('global', 'sperrdatum')), ucfirst($this->p->t('global', 'gesperrtVon')), - ucfirst($this->p->t('global', 'parkdatum')), - ucfirst($this->p->t('global', 'rueckstelldatum')), ucfirst($this->p->t('global', 'letzteAktion')), 'Aktionstyp', 'AnzahlAktePflicht', @@ -383,7 +379,9 @@ 'ZGV Nation MA', 'ZGV Gruppe BA', 'ZGV Gruppe MA', - 'InfoCenter Mitarbeiter' + 'InfoCenter Mitarbeiter', + ucfirst($this->p->t('global', 'parkdatum')), + ucfirst($this->p->t('global', 'rueckstelldatum')) ), 'formatRow' => function($datasetRaw) { @@ -434,6 +432,10 @@ { $datasetRaw->{'ParkDate'} = '-'; } + else + { + $datasetRaw->{'ParkDate'} = date_format(date_create($datasetRaw->{'ParkDate'}), 'Y-m-d H:i'); + } if ($datasetRaw->{'OnholdDate'} == null) { diff --git a/application/views/system/infocenter/infocenterDetails.php b/application/views/system/infocenter/infocenterDetails.php index 066e5cff6..401e34099 100644 --- a/application/views/system/infocenter/infocenterDetails.php +++ b/application/views/system/infocenter/infocenterDetails.php @@ -24,42 +24,15 @@ 'public/js/tablesort/tablesort.js', 'public/js/infocenter/messageList.js', 'public/js/infocenter/infocenterDetails.js', + 'public/js/infocenter/rueckstellung.js', 'public/js/infocenter/zgvUeberpruefung.js', 'public/js/infocenter/docUeberpruefung.js', 'public/js/infocenter/stammdaten.js' ), 'phrases' => array( - 'infocenter' => array( - 'notizHinzufuegen', - 'notizAendern', - 'bewerberParken', - 'bewerberAusparken', - 'nichtsZumAusparken', - 'fehlerBeimAusparken', - 'fehlerBeimParken', - 'bewerberGeparktBis', - 'bewerberOnHold', - 'bewerberOnHoldEntfernen', - 'bewerberOnHoldBis', - 'nichtsZumEntfernen', - 'fehlerBeimEntfernen', - 'rueckstelldatumUeberschritten', - 'parkenZurueckstellenInfo', - 'zgvInPruefung', - 'zgvErfuellt', - 'zgvNichtErfuellt', - 'zgvErfuelltPruefung', - 'datumUngueltig', - 'nachreichDatumNichtVergangenheit' - ), - 'ui' => array( - 'gespeichert', - 'fehlerBeimSpeichern' - ), - 'global' => array( - 'bis', - 'zeilen' - ) + 'infocenter', + 'ui', + 'global' ) ); diff --git a/application/views/system/infocenter/infocenterZgvDetails.php b/application/views/system/infocenter/infocenterZgvDetails.php index cf3ffad8b..7636647ab 100644 --- a/application/views/system/infocenter/infocenterZgvDetails.php +++ b/application/views/system/infocenter/infocenterZgvDetails.php @@ -26,6 +26,7 @@ 'public/js/tablesort/tablesort.js', 'public/js/infocenter/messageList.js', 'public/js/infocenter/infocenterDetails.js', + 'public/js/infocenter/rueckstellung.js', 'public/js/infocenter/zgvUeberpruefung.js' ), 'phrases' => array( diff --git a/include/rueckstellung.class.php b/include/rueckstellung.class.php new file mode 100644 index 000000000..82662f8bf --- /dev/null +++ b/include/rueckstellung.class.php @@ -0,0 +1,38 @@ +db_add_param($person_id)." + AND status_kurzbz = 'parked' + AND datum_bis >= now();"; + + if($this->db_query($qry)) + { + return true; + } + else + { + $this->errormsg = 'Fehler beim Löschen des geparkten Eintrages'; + return false; + } + } +} +?> diff --git a/public/js/infocenter/infocenterDetails.js b/public/js/infocenter/infocenterDetails.js index 7e6742fda..186479a8f 100644 --- a/public/js/infocenter/infocenterDetails.js +++ b/public/js/infocenter/infocenterDetails.js @@ -15,15 +15,11 @@ const STGFREIGABE_MESSAGE_VORLAGE_ANDERES_SEMESTER = "InfocenterSTGfreigegebenSe //Statusgründe for which no Studiengang Freigabe Message should be sent const FIT_PROGRAMM_STUDIENGAENGE = [10021, 10027]; -const PARKEDNAME = 'parked'; -const ONHOLDNAME = 'onhold'; - /** * javascript file for infocenterDetails page */ $(document).ready(function () { - InfocenterDetails._formatMessageTable(); InfocenterDetails._formatNotizTable(); InfocenterDetails._formatLogTable(); @@ -88,7 +84,7 @@ $(document).ready(function () ); //check if person is postponed (parked, on hold...) and display it - InfocenterDetails.getPostponeDate(personid); + Rueckstellung.get(personid); if ($(document).scrollTop() > 20) $("#scrollToTop").show(); @@ -374,155 +370,6 @@ var InfocenterDetails = { } ); }, - getStudienjahrEnd: function() - { - FHC_AjaxClient.ajaxCallGet( - CALLED_PATH + "/getStudienjahrEnd", - null, - { - successCallback: function(data, textStatus, jqXHR) { - if (FHC_AjaxClient.hasData(data)) - { - var engdate = $.datepicker.parseDate("yy-mm-dd", FHC_AjaxClient.getData(data)[0]); - - if (engdate.getDate() === 31) - engdate.setDate(engdate.getDate() - 1); - engdate.setMonth(engdate.getMonth() + 3); - - var gerdate = $.datepicker.formatDate("dd.mm.yy", engdate); - $("#postponedate").val(gerdate); - } - }, - errorCallback: function() - { - FHC_DialogLib.alertError("error when getting Studienjahr end"); - }, - veilTimeout: 0 - } - ); - }, - getPostponeDate: function(personid) - { - FHC_AjaxClient.ajaxCallGet( - CALLED_PATH + "/getPostponeDate/"+encodeURIComponent(personid), - null, - { - successCallback: function(data, textStatus, jqXHR) { - if (FHC_AjaxClient.hasData(data)) - { - var postponeobj = FHC_AjaxClient.getData(data); - InfocenterDetails._refreshPostpone(postponeobj); - InfocenterDetails._refreshLog(); - if (postponeobj === null || postponeobj.type === null) - InfocenterDetails.getStudienjahrEnd(); - } - }, - errorCallback: function() - { - FHC_DialogLib.alertError("error when getting parked status"); - }, - veilTimeout: 0 - } - ); - }, - parkPerson: function(personid, date) - { - var parkError = function(){ - $("#postponemsg").text(" Fehler beim Parken!"); - }; - - FHC_AjaxClient.ajaxCallPost( - CALLED_PATH + '/park', - { - "person_id": personid, - "parkdate": date - }, - { - successCallback: function(data, textStatus, jqXHR) { - if (FHC_AjaxClient.hasData(data)) - InfocenterDetails.getPostponeDate(personid); - else - { - parkError(); - } - }, - errorCallback: parkError, - veilTimeout: 0 - } - ); - }, - unparkPerson: function(personid) - { - FHC_AjaxClient.ajaxCallPost( - CALLED_PATH + '/unpark', - { - "person_id": personid - }, - { - successCallback: function(data, textStatus, jqXHR) { - if (FHC_AjaxClient.hasData(data)) - { - InfocenterDetails.getPostponeDate(personid); - } - else - $("#unpostponemsg").removeClass().addClass("text-warning").text(FHC_PhrasesLib.t('infocenter', 'nichtsZumAusparken')); - }, - errorCallback: function(){ - $("#unpostponemsg").removeClass().addClass("text-danger").text(FHC_PhrasesLib.t('infocenter', 'fehlerBeimAusparken')); - }, - veilTimeout: 0 - } - ); - }, - setPersonOnHold: function(personid, date) - { - var onHoldError = function(){ - $("#postponemsg").text(" Fehler beim Setzen auf On Hold!"); - }; - - FHC_AjaxClient.ajaxCallPost( - CALLED_PATH + '/setOnHold', - { - "person_id": personid, - "onholddate": date - }, - { - successCallback: function(data, textStatus, jqXHR) { - if (FHC_AjaxClient.hasData(data)) - InfocenterDetails.getPostponeDate(personid); - else - { - onHoldError(); - } - }, - errorCallback: onHoldError, - veilTimeout: 0 - } - ); - }, - removePersonOnHold: function(personid) - { - FHC_AjaxClient.ajaxCallPost( - CALLED_PATH + '/removeOnHold', - { - "person_id": personid - }, - { - successCallback: function(data, textStatus, jqXHR) { - if (FHC_AjaxClient.hasData(data)) - { - InfocenterDetails.getPostponeDate(personid); - } - else - $("#unpostponemsg").removeClass().addClass("text-warning").text(FHC_PhrasesLib.t('infocenter', 'nichtsZumEntfernen')); - }, - errorCallback: function(){ - $("#unpostponemsg").removeClass().addClass("text-danger").text(FHC_PhrasesLib.t('infocenter', 'fehlerBeimEntfernen')); - }, - veilTimeout: 0 - } - ); - }, getPrestudentData: function(personid, callback) { FHC_AjaxClient.ajaxCallGet( @@ -943,97 +790,6 @@ var InfocenterDetails = { } ); }, - _refreshPostpone: function(postponeobj) - { - var personid = $("#hiddenpersonid").val(); - if (postponeobj === null || postponeobj.date === null || postponeobj.type === null) - { - //show both park and on hold buttons if not parked and not on hold - $("#postponing").html( - '
'+ - '     '+ - '     '+ - ''+ - ''+ - '
'); - - $("#postponedate").datepicker({ - "dateFormat": "dd.mm.yy", - "minDate": 1 - }); - - $("#parklink").click( - - function () - { - var date = $("#postponedate").val(); - InfocenterDetails.parkPerson(personid, date); - } - ); - - $("#onholdlink").click( - - function () - { - var date = $("#postponedate").val(); - InfocenterDetails.setPersonOnHold(personid, date); - } - ); - } - else - { - //info if parked/on hold and possibility to undo parking/on hold - var postponedate = $.datepicker.parseDate("yy-mm-dd", postponeobj.date); - var gerpostponedate = $.datepicker.formatDate("dd.mm.yy", postponedate); - - //var postponehtml = ""; - var callbackforundo = null; - var removePhrase = ""; - var postponedPhrase = ""; - var postponedtext = ""; - - if (postponeobj.type === PARKEDNAME) - { - removePhrase = 'bewerberAusparken'; - postponedtext = FHC_PhrasesLib.t('infocenter', 'bewerberGeparktBis')+'  '+gerpostponedate; - - callbackforundo = function () - { - InfocenterDetails.unparkPerson(personid); - } - } - else if (postponeobj.type === ONHOLDNAME) - { - removePhrase = 'bewerberOnHoldEntfernen'; - postponedtext = FHC_PhrasesLib.t('infocenter', 'bewerberOnHoldBis')+'  '+gerpostponedate; - - var currdate = new Date(); - - if (currdate > postponedate) - postponedtext = ""+postponedtext+""; - - callbackforundo = function () - { - InfocenterDetails.removePersonOnHold(personid); - } - } - - var postponehtml = postponedtext+'     '+ - ' '+ - ''; - - - $("#postponing").html( - postponehtml - ); - - $("#unpostponelink").click( - callbackforundo - ); - } - }, _formatMessageTable: function() { Tablesort.addTablesorter("msgtable", [[0, 1], [2, 0]], ["zebra", "filter"], 2); diff --git a/public/js/infocenter/rueckstellung.js b/public/js/infocenter/rueckstellung.js new file mode 100644 index 000000000..c9ba32034 --- /dev/null +++ b/public/js/infocenter/rueckstellung.js @@ -0,0 +1,203 @@ +const CONTROLLER_RUECKSTELLUNG_URL = "system/infocenter/Rueckstellung"; + +var Rueckstellung = { + get: function(personid) + { + FHC_AjaxClient.ajaxCallGet( + CONTROLLER_RUECKSTELLUNG_URL + "/get/"+encodeURIComponent(personid), + null, + { + successCallback: function(data, textStatus, jqXHR) { + if (FHC_AjaxClient.hasData(data)) + { + var rueckstellungobj = FHC_AjaxClient.getData(data); + Rueckstellung._refreshRueckstellung(rueckstellungobj); + } + else + { + Rueckstellung._addRueckstellungButtons(); + } + + }, + errorCallback: function() + { + FHC_DialogLib.alertError("error when getting rueckstellung status"); + }, + veilTimeout: 0 + } + ); + }, + getStatus: function() + { + FHC_AjaxClient.ajaxCallGet( + CONTROLLER_RUECKSTELLUNG_URL + "/getStatus", + null, + { + successCallback: function(data, textStatus, jqXHR) { + if (FHC_AjaxClient.hasData(data)) + { + let status = FHC_AjaxClient.getData(data); + $.each(status, function(key, value) + { + $('#rueckstellungtype').append($("