diff --git a/application/controllers/jobs/IssueResolver.php b/application/controllers/jobs/IssueResolver.php new file mode 100755 index 000000000..17c4cb9ce --- /dev/null +++ b/application/controllers/jobs/IssueResolver.php @@ -0,0 +1,28 @@ + class (library) name for resolving + $this->_codeLibMappings = array( + 'CORE_ZGV_0001' => 'CORE_ZGV_0001', + 'CORE_ZGV_0002' => 'CORE_ZGV_0002', + 'CORE_ZGV_0003' => 'CORE_ZGV_0003', + 'CORE_ZGV_0004' => 'CORE_ZGV_0004', + 'CORE_ZGV_0005' => 'CORE_ZGV_0005', + 'CORE_INOUT_0001' => 'CORE_INOUT_0001', + 'CORE_INOUT_0002' => 'CORE_INOUT_0002', + 'CORE_INOUT_0003' => 'CORE_INOUT_0003', + 'CORE_INOUT_0004' => 'CORE_INOUT_0004', + 'CORE_INOUT_0005' => 'CORE_INOUT_0005', + 'CORE_INOUT_0006' => 'CORE_INOUT_0006' + ); + } +} diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php index 8e1b601aa..28edf4824 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php @@ -22,8 +22,8 @@ class approveAnrechnungDetail extends Auth_Controller // Set required permissions parent::__construct( array( - 'index' => 'lehre/anrechnung_genehmigen:rw', - 'download' => 'lehre/anrechnung_genehmigen:rw', + 'index' => 'lehre/anrechnung_genehmigen:r', + 'download' => 'lehre/anrechnung_genehmigen:r', 'approve' => 'lehre/anrechnung_genehmigen:rw', 'reject' => 'lehre/anrechnung_genehmigen:rw', 'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw', @@ -81,7 +81,7 @@ class approveAnrechnungDetail extends Auth_Controller } // Check if user is entitled to read the Anrechnung - self::_checkIfEntitledToReadAnrechnung($anrechnung_id); + $this->_checkIfEntitledToReadAnrechnung($anrechnung_id); // Get Anrechung data $anrechnungData = $this->anrechnunglib->getAnrechnungData($anrechnung_id); @@ -99,11 +99,16 @@ class approveAnrechnungDetail extends Auth_Controller // Get Genehmigung data $genehmigungData = $this->anrechnunglib->getGenehmigungData($anrechnung_id); + $hasReadOnlyAccess = + $this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $antragData->studiengang_kz) + && !$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 'suid', $antragData->studiengang_kz); + $viewData = array( 'antragData' => $antragData, 'anrechnungData' => $anrechnungData, 'empfehlungData' => $empfehlungData, - 'genehmigungData' => $genehmigungData + 'genehmigungData' => $genehmigungData, + 'hasReadOnlyAccess' => $hasReadOnlyAccess ); $this->load->view('lehre/anrechnung/approveAnrechnungDetail.php', $viewData); @@ -385,7 +390,7 @@ class approveAnrechnungDetail extends Auth_Controller } // Check if user is entitled to read dms doc - self::_checkIfEntitledToReadDMSDoc($dms_id); + $this->_checkIfEntitledToReadDMSDoc($dms_id); // Set filename to be used on downlaod $filename = $this->anrechnunglib->setFilenameOnDownload($dms_id); @@ -421,26 +426,13 @@ class approveAnrechnungDetail extends Auth_Controller 'lehrveranstaltung_id' => getData($result)[0]->lehrveranstaltung_id )); - if(!hasData($result)) - { - show_error('Failed loading Lehrveranstaltung'); - } + $studiengang_kz = getData($result)[0]->studiengang_kz; - // Get STGL - $result = $this->StudiengangModel->getLeitung(getData($result)[0]->studiengang_kz); - - if (hasData($result)) - { - foreach (getData($result) as $stgl) - { - if ($stgl->uid == $this->_uid) - { - return; - } - } - } - - show_error('You are not entitled to read this Anrechnung'); + // Check if user is entitled + if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $studiengang_kz)) + { + show_error('You are not entitled to read this page'); + } } /** @@ -460,23 +452,13 @@ class approveAnrechnungDetail extends Auth_Controller 'lehrveranstaltung_id' => $result->lehrveranstaltung_id )); - if(!$result = getData($result)[0]) - { - show_error('Failed loading Lehrveranstaltung'); - } + $studiengang_kz = getData($result)[0]->studiengang_kz; - // Get STGL - $result = $this->StudiengangModel->getLeitung($result->studiengang_kz); - - if($result = getData($result)[0]) - { - if ($result->uid == $this->_uid) - { - return; - } - } - - show_error('You are not entitled to read this document'); + // Check if user is entitled + if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $studiengang_kz)) + { + show_error('You are not entitled to read this document'); + } } /** diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php index 25c802caf..053988848 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php @@ -5,7 +5,8 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); class approveAnrechnungUebersicht extends Auth_Controller { const BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN = 'lehre/anrechnung_genehmigen'; - + const BERECHTIGUNG_ANRECHNUNG_ANLEGEN = 'lehre/anrechnung_anlegen'; + const REVIEW_ANRECHNUNG_URI = '/lehre/anrechnung/ReviewAnrechnungUebersicht'; const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP'; @@ -19,8 +20,8 @@ class approveAnrechnungUebersicht extends Auth_Controller // Set required permissions parent::__construct( array( - 'index' => 'lehre/anrechnung_genehmigen:rw', - 'download' => 'lehre/anrechnung_genehmigen:rw', + 'index' => 'lehre/anrechnung_genehmigen:r', + 'download' => 'lehre/anrechnung_genehmigen:r', 'approve' => 'lehre/anrechnung_genehmigen:rw', 'reject' => 'lehre/anrechnung_genehmigen:rw', 'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw' @@ -76,10 +77,19 @@ class approveAnrechnungUebersicht extends Auth_Controller { show_error(getError($studiengang_kz_arr)); } - + + $hasReadOnlyAccess = + $this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's') + && !$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 'suid'); + + // This permission is checked here to disable create Anrechnung button, if permission is not given + $hasCreateAnrechnungAccess = $this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_ANLEGEN, 's'); + $viewData = array( 'studiensemester_selected' => $studiensemester_kurzbz, - 'studiengaenge_entitled' => $studiengang_kz_arr + 'studiengaenge_entitled' => $studiengang_kz_arr, + 'hasReadOnlyAccess' => $hasReadOnlyAccess, + 'hasCreateAnrechnungAccess' => $hasCreateAnrechnungAccess ); $this->load->view('lehre/anrechnung/approveAnrechnungUebersicht.php', $viewData); @@ -239,7 +249,7 @@ class approveAnrechnungUebersicht extends Auth_Controller } // Check if user is entitled to read dms doc - self::_checkIfEntitledToReadDMSDoc($dms_id); + $this->_checkIfEntitledToReadDMSDoc($dms_id); // Set filename to be used on downlaod $filename = $this->anrechnunglib->setFilenameOnDownload($dms_id); @@ -281,22 +291,14 @@ class approveAnrechnungUebersicht extends Auth_Controller { show_error('Failed loading Lehrveranstaltung'); } + + $studiengang_kz = $result->studiengang_kz; - // Get STGL - $result = $this->StudiengangModel->getLeitung($result->studiengang_kz); - - if (hasData($result)) - { - foreach (getData($result) as $stgl) - { - if ($stgl->uid == $this->_uid) - { - return; - } - } - } - - show_error('You are not entitled to read this document'); + // Check if user is entitled + if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $studiengang_kz)) + { + show_error('You are not entitled to read this document'); + } } /** diff --git a/application/controllers/lehre/anrechnung/ReviewAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ReviewAnrechnungDetail.php index 78175f4e6..7981f0ac8 100644 --- a/application/controllers/lehre/anrechnung/ReviewAnrechnungDetail.php +++ b/application/controllers/lehre/anrechnung/ReviewAnrechnungDetail.php @@ -79,7 +79,7 @@ class reviewAnrechnungDetail extends Auth_Controller // Get Anrechung data $anrechnungData = $this->anrechnunglib->getAnrechnungData($anrechnung_id); - + // Get Antrag data $antragData = $this->anrechnunglib->getAntragData( $anrechnungData->prestudent_id, @@ -110,7 +110,7 @@ class reviewAnrechnungDetail extends Auth_Controller { return $this->outputJsonError('Fehler beim Übertragen der Daten.'); } - + // Get lectors person data if (!$person = getData($this->PersonModel->getByUID($this->_uid))[0]) { @@ -218,10 +218,10 @@ class reviewAnrechnungDetail extends Auth_Controller // Check if user is entitled to read dms doc self::_checkIfEntitledToReadDMSDoc($dms_id); - + // Set filename to be used on downlaod $filename = $this->anrechnunglib->setFilenameOnDownload($dms_id); - + // Download file $this->dmslib->download($dms_id, $filename); } @@ -320,7 +320,12 @@ class reviewAnrechnungDetail extends Auth_Controller foreach ($studiengang_kz_arr as $studiengang_kz) { // Get STGL mail address, if available, otherwise get assistance mail address - list ($to, $vorname) = $this->_getSTGLMailAddress($studiengang_kz); + $stgmail = $this->_getSTGLMailAddress($studiengang_kz); + + if(isSuccess($stgmail) && hasData($stgmail)) + list ($to, $vorname) = getData($stgmail)[0]; + else + show_error ('Failed retrieving DegreeProgram Mail'); // Get full name of lector $this->load->model('person/Person_model', 'PersonModel'); @@ -361,24 +366,28 @@ class reviewAnrechnungDetail extends Auth_Controller $result = $this->StudiengangModel->getLeitung($stg_kz); // Get STGL mail address, if available - if (hasData($result)) + if (isSuccess($result) && hasData($result)) { - return array( + return success(array( $result->retval[0]->uid. '@'. DOMAIN, $result->retval[0]->vorname - ); + )); } // ...otherwise get assistance mail address else { $result = $this->StudiengangModel->load($stg_kz); - if (hasData($result)) + if (isSuccess($result) && hasData($result)) { - return array( + return success(array( $result->retval[0]->email, '' - ); + )); + } + else + { + return error('Keine E-Mail für diesen Stg gefunden'); } } } diff --git a/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php b/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php index cd0b7afaf..e5475d0d0 100644 --- a/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php +++ b/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php @@ -5,15 +5,15 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); class reviewAnrechnungUebersicht extends Auth_Controller { const BERECHTIGUNG_ANRECHNUNG_EMPFEHLEN = 'lehre/anrechnung_empfehlen'; - + const APPROVE_ANRECHNUNG_URI = '/lehre/anrechnung/ApproveAnrechnungUebersicht'; - + const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP'; const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF'; const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor'; const ANRECHNUNGSTATUS_APPROVED = 'approved'; const ANRECHNUNGSTATUS_REJECTED = 'rejected'; - + public function __construct() { // Set required permissions @@ -25,24 +25,24 @@ class reviewAnrechnungUebersicht extends Auth_Controller 'dontRecommend' => 'lehre/anrechnung_empfehlen:rw' ) ); - + // Load models $this->load->model('education/Anrechnung_model', 'AnrechnungModel'); $this->load->model('education/Anrechnungstatus_model', 'AnrechnungstatusModel'); $this->load->model('content/DmsVersion_model', 'DmsVersionModel'); $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); - + // Load libraries $this->load->library('WidgetLib'); $this->load->library('PermissionLib'); $this->load->library('AnrechnungLib'); $this->load->library('DmsLib'); - + // Load helpers $this->load->helper('form'); $this->load->helper('url'); $this->load->helper('hlp_sancho_helper'); - + // Load language phrases $this->loadPhrases( array( @@ -54,12 +54,12 @@ class reviewAnrechnungUebersicht extends Auth_Controller 'table' ) ); - + $this->_setAuthUID(); - + $this->setControllerId(); } - + public function index() { // Get study semester @@ -70,14 +70,14 @@ class reviewAnrechnungUebersicht extends Auth_Controller $result = $this->StudiensemesterModel->getNearest(); $studiensemester_kurzbz = getData($result)[0]->studiensemester_kurzbz; } - + $viewData = array( 'studiensemester_selected' => $studiensemester_kurzbz ); - + $this->load->view('lehre/anrechnung/reviewAnrechnungUebersicht.php', $viewData); } - + /** * Recommend Anrechnungen. */ @@ -103,7 +103,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller ); } } - + // Output json to ajax if (isset($json) && !isEmptyArray($json)) { @@ -123,19 +123,19 @@ class reviewAnrechnungUebersicht extends Auth_Controller return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt')); } } - + /** * Dont recommend Anrechnungen. */ public function dontRecommend() { $data = $this->input->post('data'); - + if(isEmptyArray($data)) { return $this->outputJsonError('Fehler beim Übertragen der Daten.'); } - + foreach ($data as $item) { // Approve Anrechnung @@ -149,7 +149,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller ); } } - + // Output json to ajax if (isset($json) && !isEmptyArray($json)) { @@ -158,7 +158,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller { show_error('Failed sending emails'); } - + return $this->outputJsonSuccess($json); } else @@ -166,7 +166,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt')); } } - + /** * Download and open uploaded document (Nachweisdokument). */ @@ -178,28 +178,28 @@ class reviewAnrechnungUebersicht extends Auth_Controller { show_error('Wrong parameter'); } - + // Check if user is entitled to read dms doc self::_checkIfEntitledToReadDMSDoc($dms_id); - + // Set filename to be used on downlaod $filename = $this->anrechnunglib->setFilenameOnDownload($dms_id); - + // Download file $this->dmslib->download($dms_id, $filename); } - - + + /** * 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'); } - + /** * Check if user is entitled to read dms doc * @param $dms_id @@ -207,15 +207,15 @@ class reviewAnrechnungUebersicht extends Auth_Controller private function _checkIfEntitledToReadDMSDoc($dms_id) { $result = $this->AnrechnungModel->loadWhere(array('dms_id' => $dms_id)); - + if(!$result = getData($result)[0]) { show_error('Failed retrieving Anrechnung'); } - + $result = $this->LehrveranstaltungModel ->getLecturersByLv($result->studiensemester_kurzbz, $result->lehrveranstaltung_id); - + if($result = getData($result)) { $entitled_lector_arr = array_column($result, 'uid'); @@ -225,10 +225,10 @@ class reviewAnrechnungUebersicht extends Auth_Controller return; } } - + show_error('You are not entitled to read this document'); } - + /** * Send mails to STGL (if not present then to STGL assistance) * @param $mail_params @@ -239,36 +239,41 @@ class reviewAnrechnungUebersicht extends Auth_Controller { // Get studiengaenge $studiengang_kz_arr = array(); - + foreach ($mail_params as $item) { $this->AnrechnungModel->addSelect('studiengang_kz'); $this->AnrechnungModel->addJoin('public.tbl_prestudent', 'prestudent_id'); - + $studiengang_kz_arr[]= $this->AnrechnungModel->load($item['anrechnung_id'])->retval[0]->studiengang_kz; } - + $studiengang_kz_arr = array_unique($studiengang_kz_arr); - + // Send mail to STGL of each studiengang foreach ($studiengang_kz_arr as $studiengang_kz) { // Get STGL mail address, if available, otherwise get assistance mail address - list ($to, $vorname) = $this->_getSTGLMailAddress($studiengang_kz); - + $stgmail = $this->_getSTGLMailAddress($studiengang_kz); + + if(isSuccess($stgmail) && hasData($stgmail)) + list ($to, $vorname) = getData($stgmail)[0]; + else + show_error ('Failed retrieving DegreeProgram Mail'); + // Get full name of lector $this->load->model('person/Person_model', 'PersonModel'); if (!$lector_name = getData($this->PersonModel->getFullName($this->_uid))) { show_error ('Failed retrieving person'); } - + // Link to Antrag genehmigen $url = CIS_ROOT. 'cis/index.php?menu='. CIS_ROOT. 'cis/menu.php?content_id=&content='. CIS_ROOT. index_page(). self::APPROVE_ANRECHNUNG_URI; - + // Prepare mail content $body_fields = array( 'vorname' => $vorname, @@ -276,7 +281,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller 'empfehlung' => $empfehlung ? 'positive' : 'negative', 'link' => anchor($url, 'Anrechnungsanträge Übersicht') ); - + sendSanchoMail( 'AnrechnungEmpfehlungAbgeben', $body_fields, @@ -284,37 +289,41 @@ class reviewAnrechnungUebersicht extends Auth_Controller 'Anerkennung nachgewiesener Kenntnisse: Empfehlung wurde abgegeben' ); } - + return true; } - + // Get STGL mail address, if available, otherwise get assistance mail address private function _getSTGLMailAddress($stg_kz) { $this->load->model('organisation/Studiengang_model', 'StudiengangModel'); $result = $this->StudiengangModel->getLeitung($stg_kz); - + // Get STGL mail address, if available - if (hasData($result)) + if (isSuccess($result) && hasData($result)) { - return array( + return success(array( $result->retval[0]->uid. '@'. DOMAIN, $result->retval[0]->vorname - ); + )); } // ...otherwise get assistance mail address else { $result = $this->StudiengangModel->load($stg_kz); - - if (hasData($result)) + + if (isSuccess($result) && hasData($result)) { - return array( + return success(array( $result->retval[0]->email, '' - ); + )); + } + else + { + return error('Keine E-Mail für diesen Stg gefunden'); } } } - -} \ No newline at end of file + +} diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index a69a43220..25ee96b60 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -560,8 +560,10 @@ class InfoCenter extends Auth_Controller /** * Sendet bei einer neuen ZGV Prüfung die Mail raus an den Studiengang */ - private function sendZgvMail($mail, $typ){ + private function sendZgvMail($mail, $typ, $person){ $data = array( + 'vorname' => $person->vorname, + 'nachname' => $person->nachname, 'link' => site_url('system/infocenter/ZGVUeberpruefung') ); @@ -657,6 +659,16 @@ class InfoCenter extends Auth_Controller if (isEmptyString($prestudent_id) || isEmptyString($person_id)) $this->terminateWithJsonError('Prestudentid OR/AND Personid missing'); + $person = $this->PersonModel->load($person_id); + + if (isError($person)) + $this->terminateWithJsonError(getError($person)); + + if (!hasData($person)) + $this->terminateWithJsonError('Person existiert nicht.'); + + $person = getData($person)[0]; + $zgv = $this->ZGVPruefungStatusModel->getZgvStatusByPrestudent($prestudent_id); $data = $this->_getPersonAndStudiengangFromPrestudent($prestudent_id); @@ -688,7 +700,7 @@ class InfoCenter extends Auth_Controller $this->_log($person_id, 'updatezgv', array($zgv[0]->zgvpruefung_id, 'pruefung_stg')); if (isSuccess($insert)) - $this->sendZgvMail($mail, $typ); + $this->sendZgvMail($mail, $typ, $person); elseif (isError($insert)) $this->terminateWithJsonError('Fehler beim Speichern'); }else @@ -714,7 +726,7 @@ class InfoCenter extends Auth_Controller $this->_log($person_id, 'newzgv', array($zgvpruefung_id)); if (isSuccess($result)) - $this->sendZgvMail($mail, $typ); + $this->sendZgvMail($mail, $typ, $person); elseif (isError($result)) $this->terminateWithJsonError('Fehler beim Speichern'); } @@ -1708,9 +1720,15 @@ class InfoCenter extends Auth_Controller if (isset($locked->retval[0]->uid)) { - $lockedby = $locked->retval[0]->uid; - if ($lockedby !== $this->_uid) + if (!$lockedby = getData($this->PersonModel->getFullName($locked->retval[0]->uid))) + { + show_error('Failed retrieving person'); + } + + if ($locked->retval[0]->uid !== $this->_uid) + { $lockedbyother = true; + } } $stammdaten = $this->PersonModel->getPersonStammdaten($person_id, true); diff --git a/application/controllers/system/issues/Issues.php b/application/controllers/system/issues/Issues.php index e9764fb63..e0103cfec 100644 --- a/application/controllers/system/issues/Issues.php +++ b/application/controllers/system/issues/Issues.php @@ -58,21 +58,42 @@ class Issues extends Auth_Controller { $issue_ids = $this->input->post('issue_ids'); $status_kurzbz = $this->input->post('status_kurzbz'); - $verarbeitetvon = $this->_uid; + $user = $this->_uid; $errors = array(); foreach ($issue_ids as $issue_id) { - $issueRes = $this->issueslib->changeIssueStatus($issue_id, $status_kurzbz, $verarbeitetvon); + switch ($status_kurzbz) + { + case IssuesLib::STATUS_NEU: + $changeIssueMethod = 'setNeu'; + break; + case IssuesLib::STATUS_IN_BEARBEITUNG: + $changeIssueMethod = 'setInBearbeitung'; + break; + case IssuesLib::STATUS_BEHOBEN: + $changeIssueMethod = 'setBehoben'; + break; + default: + $changeIssueMethod = null; + break; + } - if (isError($issueRes)) - $errors[] = getError($issueRes); + if (isEmptyString($changeIssueMethod)) + $errors[] = error("Invalid issue status given"); + else + { + $issueRes = $this->issueslib->{$changeIssueMethod}($issue_id, $user); + + if (isError($issueRes)) + $errors[] = getError($issueRes); + } } if (!isEmptyArray($errors)) $this->outputJsonError(implode(", ", $errors)); else - $this->outputJsonSuccess("Status erfolgreich aktualisiert"); + $this->outputJsonSuccess("Status successfully refreshed"); } /** @@ -133,7 +154,7 @@ class Issues extends Auth_Controller // add oes for which there is the "manage issues" Berechtigung if (!$oe_kurzbz_berechtigt = $this->permissionlib->getOE_isEntitledFor(self::BERECHTIGUNG_KURZBZ)) - show_error('Keine Berechtigung oder Fehler bei Berechtigungsprüfung'); + show_error('No permission or error when checking permissions'); $all_oe_kurzbz_berechtigt = array_unique(array_merge($oe_kurzbz_for_funktion, $oe_kurzbz_berechtigt)); diff --git a/application/core/IIssueResolvedChecker.php b/application/core/IIssueResolvedChecker.php new file mode 100644 index 000000000..82da67ff7 --- /dev/null +++ b/application/core/IIssueResolvedChecker.php @@ -0,0 +1,15 @@ +load->model('system/Issue_model', 'IssueModel'); + + $this->load->library('IssuesLib'); + } + + /** + * Initializes issue resolution. + */ + public function run() + { + $this->logInfo("Issue resolve job started"); + + // load open issues with given errorcodes + $openIssuesRes = $this->IssueModel->getOpenIssues(array_keys($this->_codeLibMappings)); + + // log error if occured + if (isError($openIssuesRes)) + { + $this->logError(getError($openIssuesRes)); + } + else + { + // log info if no data found + if (!hasData($openIssuesRes)) + { + $this->logInfo("No open issues found"); + } + else + { + + $openIssues = getData($openIssuesRes); + + foreach ($openIssues as $issue) + { + if (isset($this->_codeLibMappings[$issue->fehlercode])) + { + $libName = $this->_codeLibMappings[$issue->fehlercode]; + + // add person id and oe kurzbz automatically as params, merge it with additional params + // decode bewerbung_parameter into assoc array + $params = array_merge( + array('issue_id' => $issue->issue_id, 'issue_person_id' => $issue->person_id, 'issue_oe_kurzbz' => $issue->oe_kurzbz), + isset($issue->behebung_parameter) ? json_decode($issue->behebung_parameter, true) : array() + ); + + // if called from extension (extension name set), path includes extension names, otherwise it is the core library folder + $libRootPath = isset($this->_extensionName) ? 'extensions/' . $this->_extensionName . '/' : ''; + $issuesLibPath = $libRootPath . self::ISSUES_FOLDER . '/'; + $issuesLibFilePath = DOC_ROOT . 'application/' . $libRootPath . 'libraries/' . self::ISSUES_FOLDER . '/' . $libName . '.php'; + + // check if library file exists + if (!file_exists($issuesLibFilePath)) + { + // log error and continue with next issue if not + $this->logError("Issue library file " . $issuesLibFilePath . " does not exist"); + continue; + } + + // load library connected to fehlercode + $this->load->library( + $issuesLibPath . $libName + ); + + $lowercaseLibName = mb_strtolower($libName); + + // check if method is defined in libary class + if (!is_callable(array($this->{$lowercaseLibName}, self::CHECK_ISSUE_RESOLVED_METHOD_NAME))) + { + // log error and continue with next issue if not + $this->logError("Method " . self::CHECK_ISSUE_RESOLVED_METHOD_NAME . " is not defined in library $lowercaseLibName"); + continue; + } + + // call the function for checking for issue resolution + $issueResolvedRes = $this->{$lowercaseLibName}->{self::CHECK_ISSUE_RESOLVED_METHOD_NAME}($params); + + if (isError($issueResolvedRes)) + { + $this->logError(getError($issueResolvedRes)); + } + else + { + $issueResolvedData = getData($issueResolvedRes); + + if ($issueResolvedData === true) + { + // set issue to resolved if needed + $behobenRes = $this->issueslib->setBehoben($issue->issue_id, null); + + if (isError($behobenRes)) + $this->logError(getError($behobenRes)); + else + $this->logInfo("Issue " . $issue->issue_id . " successfully resolved"); + } + } + } + } + } + } + + $this->logInfo("Issue resolve job ended"); + } +} diff --git a/application/helpers/hlp_header_helper.php b/application/helpers/hlp_header_helper.php index f8bbb9ad2..203834ebb 100644 --- a/application/helpers/hlp_header_helper.php +++ b/application/helpers/hlp_header_helper.php @@ -39,6 +39,24 @@ function printPageTitle($title) } } +/** + * Print the meta tag http-equiv refresh having as content the value of the given parameter + */ +function printRefreshMeta($refresh) +{ + if ($refresh != null) + { + if (is_numeric($refresh) && $refresh > 0) + { + echo ''; + } + else + { + show_error('The provided refresh parameter has to be a number greater then 0'); + } + } +} + /** * Generates tags for the style sheets you want to include, the parameter could by a string or an array of strings */ diff --git a/application/libraries/AnrechnungLib.php b/application/libraries/AnrechnungLib.php index 3bec62dce..ee197ab05 100644 --- a/application/libraries/AnrechnungLib.php +++ b/application/libraries/AnrechnungLib.php @@ -89,6 +89,7 @@ class AnrechnungLib $antrag_data->vorname = $person->vorname; $antrag_data->nachname = $person->nachname; $antrag_data->matrikelnr = $student->matrikelnr; + $antrag_data->studiengang_kz = $studiengang->studiengang_kz; $antrag_data->stg_bezeichnung = $studiengang->bezeichnung; $antrag_data->lektoren = $lv_lektoren_arr; $antrag_data->zgv = $latest_zgv_bezeichnung; diff --git a/application/libraries/IssuesLib.php b/application/libraries/IssuesLib.php index 1b06db333..d6488bc36 100644 --- a/application/libraries/IssuesLib.php +++ b/application/libraries/IssuesLib.php @@ -62,17 +62,17 @@ class IssuesLib * @param array $fehlertext_params params for sprint replace of error text in system.tbl_fehler * @return object success or error */ - public function addFhcIssue($fehler_kurzbz, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null) + public function addFhcIssue($fehler_kurzbz, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $resolution_params = null) { $fehlerRes = $this->_ci->FehlerModel->loadWhere(array('fehler_kurzbz' => $fehler_kurzbz)); if (hasData($fehlerRes)) { $fehlercode = getData($fehlerRes)[0]->fehlercode; - return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params); + return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params, $resolution_params); } else - return error("Fehler $fehler_kurzbz nicht gefunden"); + return error("Error $fehler_kurzbz not found"); } /** @@ -82,13 +82,13 @@ class IssuesLib * @param int $person_id * @param int $oe_kurzbz * @param array $fehlertext_params params for replacement of parts of error text - * @param bool $force_predefined if true, only predefined external issues are added + * @param bool $force_predefined if true, only predefined (with entry in fehler table) external issues are added * @return object success or error */ - public function addExternalIssue($fehlercode_extern, $inhalt_extern, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $force_predefined = false) + public function addExternalIssue($fehlercode_extern, $inhalt_extern, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null) { if (isEmptyString($fehlercode_extern)) - return error("fehlercode_extern fehlt"); + return error("fehlercode_extern missing"); // get external fehlercode (unique for each app) $this->_ci->FehlerModel->addSelect('fehlercode'); @@ -102,19 +102,13 @@ class IssuesLib if (isError($fehlerRes)) return $fehlerRes; - $fehlerData = getData($fehlerRes)[0]; - // check if there is a predefined custom error for the external issue if (hasData($fehlerRes)) { + $fehlerData = getData($fehlerRes)[0]; // if found, use the code $fehlercode = $fehlerData->fehlercode; } - elseif ($force_predefined === true) - { - // only added if predefined - return success("No definition found - not added"); - } else { // if predefined error is not found, insert with fallback code @@ -122,20 +116,70 @@ class IssuesLib } // add external issue - return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params, $fehlercode_extern, $inhalt_extern); + return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params, null, $fehlercode_extern, $inhalt_extern); + } + + /** + * Set issue to resolved. + * @param int $issue_id + * @param string $user uid of issue resolver + * @return object success or error + */ + public function setBehoben($issue_id, $user) + { + $data = array( + 'status_kurzbz' => self::STATUS_BEHOBEN, + 'verarbeitetvon' => $user, + 'verarbeitetamum' => date('Y-m-d H:i:s') + ); + + return $this->_changeIssueStatus($issue_id, $data, $user); + } + + /** + * Set issue to in progress. + * @param int $issue_id + * @param string $user uid of issue resovler + * @return object success or error + */ + public function setInBearbeitung($issue_id, $user) + { + $data = array( + 'status_kurzbz' => self::STATUS_IN_BEARBEITUNG, + 'verarbeitetvon' => $user + ); + + return $this->_changeIssueStatus($issue_id, $data, $user); + } + + /** + * Set issue to new. + * @param int $issue_id + * @param string $user uid of issue resolver + * @return object success or error + */ + public function setNeu($issue_id, $user) + { + $data = array( + 'status_kurzbz' => self::STATUS_NEU, + 'verarbeitetvon' => null, + 'verarbeitetamum' => null + ); + + return $this->_changeIssueStatus($issue_id, $data, $user); } /** * Changes status of an issue. * @param int $issue_id - * @param string $status_kurzbz the new status - * @param string $verarbeitetvon uid of person changing the status (needed for in Bearbeitung and behoben) + * @param array $sdata the data to save, including status + * @param string $user uid of person changing the status (needed for in Bearbeitung and behoben) * @return success or error */ - public function changeIssueStatus($issue_id, $status_kurzbz, $verarbeitetvon = null) + private function _changeIssueStatus($issue_id, $data, $user) { if (!isset($issue_id) || !is_numeric($issue_id)) - return error("Issue Id muss korrekt gesetzt sein."); + return error("Issue Id must be set correctly."); // check if given status is same as existing $this->_ci->IssueModel->addSelect('status_kurzbz'); @@ -143,39 +187,14 @@ class IssuesLib if (hasData($currStatus)) { - if (getData($currStatus)[0]->status_kurzbz == $status_kurzbz) - return success("Gleicher Status bereits gesetzt"); + if (getData($currStatus)[0]->status_kurzbz == $data['status_kurzbz']) + return success("Same status already set"); } else - return error("Fehler beim Holen des Status"); + return error("Error when getting status"); - $data = array( - 'status_kurzbz' => $status_kurzbz, - 'updatevon' => $verarbeitetvon, - 'updateamum' => date('Y-m-d H:i:s') - ); - - if ($status_kurzbz == self::STATUS_NEU) - { - - $data['verarbeitetvon'] = null; - } - - if ($status_kurzbz == self::STATUS_NEU || $status_kurzbz == self::STATUS_IN_BEARBEITUNG) - { - $data['verarbeitetamum'] = null; - } - - if ($status_kurzbz == self::STATUS_IN_BEARBEITUNG || $status_kurzbz == self::STATUS_BEHOBEN) - { - if (isset($verarbeitetvon)) - $data['verarbeitetvon'] = $verarbeitetvon; - else - return error("Verarbeitetvon nicht gesetzt"); - } - - if ($status_kurzbz == self::STATUS_BEHOBEN) - $data['verarbeitetamum'] = date('Y-m-d H:i:s'); + $data['updatevon'] = $user; + $data['updateamum'] = date('Y-m-d H:i:s'); return $this->_ci->IssueModel->update( array( @@ -191,14 +210,15 @@ class IssuesLib * @param int $person_id * @param string $oe_kurzbz * @param array $fehlertext_params + * @param string $resolution_params * @param string $fehlercode_extern * @param string $inhalt_extern * @return object success or error */ - private function _addIssue($fehlercode, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $fehlercode_extern = null, $inhalt_extern = null) + private function _addIssue($fehlercode, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $resolution_params = null, $fehlercode_extern = null, $inhalt_extern = null) { if (isEmptyString($person_id) && isEmptyString($oe_kurzbz)) - return error("Person_id oder oe_kurzbz muss gesetzt sein."); + return error("Person_id or oe_kurzbz must be set."); // get fehlertextVorlage and replace it with params $fehlerRes = $this->_ci->FehlerModel->load($fehlercode); @@ -218,6 +238,20 @@ class IssuesLib if ($openIssueCount == 0) { + if (isset($resolution_params)) + { + if (is_array($resolution_params)) + { + foreach ($resolution_params as $resolution_key => $resolution_param) + { + if (!is_string($resolution_key)) + return error("Invalid parameter for resolution, must be an associative array"); + } + } + else + return error("Invalid parameters for resolution"); + } + return $this->_ci->IssueModel->insert( array( 'fehlercode' => $fehlercode, @@ -228,6 +262,7 @@ class IssuesLib 'oe_kurzbz' => $oe_kurzbz, 'datum' => date('Y-m-d H:i:s'), 'status_kurzbz' => self::STATUS_NEU, + 'behebung_parameter' => isset($resolution_params) ? json_encode($resolution_params) : null, 'insertvon' => $this->_insertvon ) ); @@ -236,9 +271,9 @@ class IssuesLib return success($openIssueCount); } else - return error("Anzahl offener Issues konnte nicht ermittelt werden."); + return error("Number of open issues could not be determined"); } else - return error("Fehler $fehlercode nicht gefunden"); + return error("Error $fehlercode could not be found"); } } diff --git a/application/libraries/issues/CORE_INOUT_0001.php b/application/libraries/issues/CORE_INOUT_0001.php new file mode 100644 index 000000000..d62c73f9e --- /dev/null +++ b/application/libraries/issues/CORE_INOUT_0001.php @@ -0,0 +1,31 @@ +_ci =& get_instance(); // get code igniter instance + + $this->_ci->load->model('codex/Bisiozweck_model', 'BisiozweckModel'); + + // get all bisio Zwecke + $this->_ci->BisiozweckModel->addSelect('1'); + $bisiozweckRes = $this->_ci->BisiozweckModel->loadWhere(array('bisio_id' => $params['bisio_id'])); + + if (isError($bisiozweckRes)) + return $bisiozweckRes; + + if (hasData($bisiozweckRes)) + return success(true); // resolved if bisio Zweck exists + else + return success(false); // not resolved if no bisio zweck + } +} diff --git a/application/libraries/issues/CORE_INOUT_0002.php b/application/libraries/issues/CORE_INOUT_0002.php new file mode 100644 index 000000000..9868ccd25 --- /dev/null +++ b/application/libraries/issues/CORE_INOUT_0002.php @@ -0,0 +1,34 @@ +_ci =& get_instance(); // get code igniter instance + + $this->_ci->load->model('codex/Bisiozweck_model', 'BisiozweckModel'); + + // get all bisio Zwecke + $this->_ci->BisiozweckModel->addSelect('1'); + $bisiozweckRes = $this->_ci->BisiozweckModel->loadWhere(array('bisio_id' => $params['bisio_id'])); + + if (isError($bisiozweckRes)) + return $bisiozweckRes; + + if (hasData($bisiozweckRes)) + { + if (count(getData($bisiozweckRes)) <= 1) // resolved if one bisio Zweck + return success(true); + else + return success(false); // otherwise not resolved + } + else + return success(true); // resolved if no bisio zweck + } +} diff --git a/application/libraries/issues/CORE_INOUT_0003.php b/application/libraries/issues/CORE_INOUT_0003.php new file mode 100644 index 000000000..0fee6c061 --- /dev/null +++ b/application/libraries/issues/CORE_INOUT_0003.php @@ -0,0 +1,39 @@ +_ci =& get_instance(); // get code igniter instance + + $this->_ci->load->model('codex/Bisiozweck_model', 'BisiozweckModel'); + + // get all Zwecke + $this->_ci->BisiozweckModel->addSelect('zweck_code'); + $bisiozweckRes = $this->_ci->BisiozweckModel->loadWhere(array('bisio_id' => $params['bisio_id'])); + + if (isError($bisiozweckRes)) + return $bisiozweckRes; + + if (hasData($bisiozweckRes)) + { + $bisiozweckData = getData($bisiozweckRes); + + // resolved if Zweck is 1, 2 or 3 + if (count($bisiozweckData) == 1 && !in_array($bisiozweckData[0]->zweck_code, array(1, 2, 3))) + return success(false); + else + return success(true); + } + else + return success(true); + } +} diff --git a/application/libraries/issues/CORE_INOUT_0004.php b/application/libraries/issues/CORE_INOUT_0004.php new file mode 100644 index 000000000..703b108cc --- /dev/null +++ b/application/libraries/issues/CORE_INOUT_0004.php @@ -0,0 +1,57 @@ +_ci =& get_instance(); // get code igniter instance + + $this->_ci->load->model('codex/Aufenthaltfoerderung_model', 'AufenthaltfoerderungModel'); + + // get all Zwecke + $this->_ci->AufenthaltfoerderungModel->addSelect('tbl_aufenthaltfoerderung.aufenthaltfoerderung_code'); + $this->_ci->AufenthaltfoerderungModel->addJoin('bis.tbl_bisio_aufenthaltfoerderung', 'aufenthaltfoerderung_code'); + $this->_ci->AufenthaltfoerderungModel->addOrder('tbl_aufenthaltfoerderung.aufenthaltfoerderung_code'); + $bisioFoerderungRes = $this->_ci->AufenthaltfoerderungModel->loadWhere(array('bisio_id' => $params['bisio_id'])); + + if (isError($bisioFoerderungRes)) + return $bisioFoerderungRes; + + if (hasData($bisioFoerderungRes)) + { + // resolved if Aufenthaltsfoerderung exists + return success(true); + } + else + { + $this->_ci->load->model('codex/Bisio_model', 'BisioModel'); + + // get Bisio Aufenthaltsdauer + $aufenthaltsdauerRes = $this->_ci->BisioModel->getAufenthaltsdauer($params['bisio_id']); + + if (isError($aufenthaltsdauerRes)) + return $aufenthaltsdauerRes; + + if (hasData($aufenthaltsdauerRes)) + { + $aufenthaltsdauer = getData($aufenthaltsdauerRes); + + // check if stay >= 29 days. If yes and no Aufenthaltsfoerderung - not resolved + if ($aufenthaltsdauer >= 29) + return success(false); + else + return success(true); + } + else // no Aufenthaltsdauer - not resolved + return success(false); + } + } +} diff --git a/application/libraries/issues/CORE_INOUT_0005.php b/application/libraries/issues/CORE_INOUT_0005.php new file mode 100644 index 000000000..e655d2e36 --- /dev/null +++ b/application/libraries/issues/CORE_INOUT_0005.php @@ -0,0 +1,53 @@ +_ci =& get_instance(); // get code igniter instance + + $this->_ci->load->model('codex/Bisio_model', 'BisioModel'); + + // get all Zwecke + $this->_ci->BisioModel->addSelect('ects_angerechnet'); + $bisioRes = $this->_ci->BisioModel->loadWhere(array('bisio_id' => $params['bisio_id'])); + + if (isError($bisioRes)) + return $bisioRes; + + if (hasData($bisioRes) && !isEmptyString(getData($bisioRes)[0]->ects_angerechnet)) + { + // resolved if ects exists + return success(true); + } + else + { + // get Bisio Aufenthaltsdauer + $aufenthaltsdauerRes = $this->_ci->BisioModel->getAufenthaltsdauer($params['bisio_id']); + + if (isError($aufenthaltsdauerRes)) + return $aufenthaltsdauerRes; + + if (hasData($aufenthaltsdauerRes)) + { + $aufenthaltsdauer = getData($aufenthaltsdauerRes); + + // check if stay >= 29 days. If yes and no ects - not resolved + if ($aufenthaltsdauer >= 29) + return success(false); + else + return success(true); + } + else // no Aufenthaltsdauer - not resolved + return success(false); + } + } +} diff --git a/application/libraries/issues/CORE_INOUT_0006.php b/application/libraries/issues/CORE_INOUT_0006.php new file mode 100644 index 000000000..a447a9625 --- /dev/null +++ b/application/libraries/issues/CORE_INOUT_0006.php @@ -0,0 +1,54 @@ +_ci =& get_instance(); // get code igniter instance + + $this->_ci->load->model('codex/Bisio_model', 'BisioModel'); + //$this->_ci->load->model('codex/Aufenthaltfoerderung_model', 'AufenthaltfoerderungModel'); + + // get all Zwecke + $this->_ci->BisioModel->addSelect('ects_erworben'); + $bisioRes = $this->_ci->BisioModel->loadWhere(array('bisio_id' => $params['bisio_id'])); + + if (isError($bisioRes)) + return $bisioRes; + + if (hasData($bisioRes) && !isEmptyString(getData($bisioRes)[0]->ects_erworben)) + { + // resolved if ects exists + return success(true); + } + else + { + // get Bisio Aufenthaltsdauer + $aufenthaltsdauerRes = $this->_ci->BisioModel->getAufenthaltsdauer($params['bisio_id']); + + if (isError($aufenthaltsdauerRes)) + return $aufenthaltsdauerRes; + + if (hasData($aufenthaltsdauerRes)) + { + $aufenthaltsdauer = getData($aufenthaltsdauerRes); + + // check if stay >= 29 days. If yes and no ects - not resolved + if ($aufenthaltsdauer >= 29) + return success(false); + else + return success(true); + } + else // no Aufenthaltsdauer - not resolved + return success(false); + } + } +} diff --git a/application/libraries/issues/CORE_ZGV_0001.php b/application/libraries/issues/CORE_ZGV_0001.php new file mode 100644 index 000000000..47d27d30e --- /dev/null +++ b/application/libraries/issues/CORE_ZGV_0001.php @@ -0,0 +1,42 @@ +_ci =& get_instance(); // get code igniter instance + + // get zgvdatum of prestudent + $this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel'); + + $this->_ci->PrestudentModel->addSelect('zgvdatum'); + $prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']); + + if (isError($prestudentRes)) + return $prestudentRes; + + if (hasData($prestudentRes)) + { + $zgvdatum = getData($prestudentRes)[0]->zgvdatum; + + if (isEmptyString($zgvdatum)) + return success(false); + + // check if zgvdatum comes after today + if ($zgvdatum > date('Y-m-d')) + return success(false); + else + return success(true); + } + else + return success(false); + } +} diff --git a/application/libraries/issues/CORE_ZGV_0002.php b/application/libraries/issues/CORE_ZGV_0002.php new file mode 100644 index 000000000..d09380ddb --- /dev/null +++ b/application/libraries/issues/CORE_ZGV_0002.php @@ -0,0 +1,50 @@ +_ci =& get_instance(); // get code igniter instance + + // get zgvdatum of prestudent + $this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel'); + + $this->_ci->PrestudentModel->addSelect('zgvdatum, gebdatum'); + $this->_ci->PrestudentModel->addJoin('public.tbl_person', 'person_id'); + $prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']); + + if (isError($prestudentRes)) + return $prestudentRes; + + if (hasData($prestudentRes)) + { + $prestudentData = getData($prestudentRes)[0]; + + $zgvdatum = $prestudentData->zgvdatum; + + if (isEmptyString($zgvdatum)) + return success(false); + + $gebdatum = $prestudentData->gebdatum; + + if (isEmptyString($gebdatum)) + return success(false); + + // check if zgvdatum comes before geburtsdatum + if ($zgvdatum < $gebdatum) + return success(false); + else + return success(true); + } + else + return success(false); + } +} diff --git a/application/libraries/issues/CORE_ZGV_0003.php b/application/libraries/issues/CORE_ZGV_0003.php new file mode 100644 index 000000000..db0ab29db --- /dev/null +++ b/application/libraries/issues/CORE_ZGV_0003.php @@ -0,0 +1,42 @@ +_ci =& get_instance(); // get code igniter instance + + // get zgvdatum of prestudent + $this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel'); + + $this->_ci->PrestudentModel->addSelect('zgvmadatum'); + $prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']); + + if (isError($prestudentRes)) + return $prestudentRes; + + if (hasData($prestudentRes)) + { + $zgvdatum = getData($prestudentRes)[0]->zgvmadatum; + + if (isEmptyString($zgvdatum)) + return success(false); + + // check if zgvdatum comes after today + if ($zgvdatum > date('Y-m-d')) + return success(false); + else + return success(true); + } + else + return success(false); + } +} diff --git a/application/libraries/issues/CORE_ZGV_0004.php b/application/libraries/issues/CORE_ZGV_0004.php new file mode 100644 index 000000000..27488af00 --- /dev/null +++ b/application/libraries/issues/CORE_ZGV_0004.php @@ -0,0 +1,50 @@ +_ci =& get_instance(); // get code igniter instance + + // get zgvdatum of prestudent + $this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel'); + + $this->_ci->PrestudentModel->addSelect('zgvdatum, zgvmadatum'); + $prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']); + + if (isError($prestudentRes)) + return $prestudentRes; + + if (hasData($prestudentRes)) + { + $prestudentData = getData($prestudentRes)[0]; + + // get and compare zgvdatum and zgvmadatum + $zgvdatum = $prestudentData->zgvdatum; + + if (isEmptyString($zgvdatum)) + return success(false); + + $zgvmadatum = $prestudentData->zgvmadatum; + + if (isEmptyString($zgvmadatum)) + return success(false); + + // check if zgvmadatum comes after zgvdatum + if ($zgvmadatum < $zgvdatum) + return success(false); + else + return success(true); + } + else + return success(false); + } +} diff --git a/application/libraries/issues/CORE_ZGV_0005.php b/application/libraries/issues/CORE_ZGV_0005.php new file mode 100644 index 000000000..405f3d88d --- /dev/null +++ b/application/libraries/issues/CORE_ZGV_0005.php @@ -0,0 +1,50 @@ +_ci =& get_instance(); // get code igniter instance + + // get zgvdatum and geburtsdatum of prestudent + $this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel'); + + $this->_ci->PrestudentModel->addSelect('zgvmadatum, gebdatum'); + $this->_ci->PrestudentModel->addJoin('public.tbl_person', 'person_id'); + $prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']); + + if (isError($prestudentRes)) + return $prestudentRes; + + if (hasData($prestudentRes)) + { + $prestudentData = getData($prestudentRes)[0]; + + $zgvdatum = $prestudentData->zgvmadatum; + + if (isEmptyString($zgvdatum)) + return success(false); + + $gebdatum = $prestudentData->gebdatum; + + if (isEmptyString($gebdatum)) + return success(false); + + // check if zgvdatum comes before geburtsdatum + if ($zgvdatum < $gebdatum) + return success(false); + else + return success(true); + } + else + return success(false); + } +} diff --git a/application/models/codex/Bisio_model.php b/application/models/codex/Bisio_model.php index 5f35aec9a..1cff1dc54 100644 --- a/application/models/codex/Bisio_model.php +++ b/application/models/codex/Bisio_model.php @@ -11,4 +11,37 @@ class Bisio_model extends DB_Model $this->dbTable = 'bis.tbl_bisio'; $this->pk = 'bisio_id'; } + + /** + * Gets duration of stay in days by bisio_id. + * @param int $bisio_id + * @return object success with number of days or error + */ + public function getAufenthaltsdauer($bisio_id) + { + // get from and to date + $this->addSelect('von, bis'); + $bisioRes = $this->load($bisio_id); + + if (isError($bisioRes)) + return $bisioRes; + + if (hasData($bisioRes)) + { + $bisioData = getData($bisioRes)[0]; + + $avon = $bisioData->von; + $abis = $bisioData->bis; + + if (is_null($avon) || is_null($abis)) + return success("Von or bis date not set"); + + $vonDate = new DateTime($avon); + $bisDate = new DateTime($abis); + $interval = $vonDate->diff($bisDate); + return success($interval->days); + } + else + return success("Bisio not found"); + } } diff --git a/application/models/education/Zeugnisnote_model.php b/application/models/education/Zeugnisnote_model.php index 65607e252..a4185a7f4 100644 --- a/application/models/education/Zeugnisnote_model.php +++ b/application/models/education/Zeugnisnote_model.php @@ -86,9 +86,10 @@ class Zeugnisnote_model extends DB_Model * @param bool $lehre * @param bool $offiziell * @param bool $positiv + * @param bool $zeugnis * @return object */ - public function getByPerson($person_id, $studiensemester_kurzbz, $aktiv = true, $lehre = null, $offiziell = null, $positiv = null) + public function getByPerson($person_id, $studiensemester_kurzbz, $aktiv = true, $lehre = null, $offiziell = null, $positiv = null, $zeugnis = null) { $params = array($person_id, $studiensemester_kurzbz); @@ -129,6 +130,12 @@ class Zeugnisnote_model extends DB_Model $params[] = $positiv; } + if (isset($zeugnis)) + { + $qry .= ' AND lv.zeugnis = ?'; + $params[] = $zeugnis; + } + $qry .= ' ORDER BY zgnisnote.benotungsdatum'; return $this->execQuery($qry, $params); diff --git a/application/models/organisation/Studiengang_model.php b/application/models/organisation/Studiengang_model.php index 6358ca81e..e2b3bdfb7 100644 --- a/application/models/organisation/Studiengang_model.php +++ b/application/models/organisation/Studiengang_model.php @@ -448,10 +448,11 @@ class Studiengang_model extends DB_Model return $this->execQuery($query, array($typ)); } - + /** - * Get Studiengangsleitung - * @param null $studiengang_kz + * Get Studiengangsleitung/en of Studiengang/Studiengaenge. + * + * @param null $studiengang_kz Numeric or Array * @return array */ public function getLeitung($studiengang_kz = null) @@ -460,7 +461,12 @@ class Studiengang_model extends DB_Model $this->addJoin('public.tbl_benutzerfunktion', 'oe_kurzbz'); $this->addJoin('public.tbl_benutzer', 'uid'); $this->addJoin('public.tbl_person', 'person_id'); - + + if (!is_numeric($studiengang_kz) && !is_array($studiengang_kz)) + { + return error('Studiengangskennzahl ungültig'); + } + if (is_null($studiengang_kz)) { $condition = ' @@ -469,16 +475,21 @@ class Studiengang_model extends DB_Model AND ( datum_bis >= NOW() OR datum_bis IS NULL ) '; } - elseif (is_numeric($studiengang_kz)) + elseif (is_numeric($studiengang_kz) || is_array($studiengang_kz)) { + if (is_array($studiengang_kz)) + { + $studiengang_kz = array_map(array($this,'escape'), $studiengang_kz); + $studiengang_kz = implode(', ', $studiengang_kz); + } $condition = ' funktion_kurzbz = \'Leitung\' AND ( datum_von <= NOW() OR datum_von IS NULL ) AND ( datum_bis >= NOW() OR datum_bis IS NULL ) - AND studiengang_kz = ' . $this->db->escape($studiengang_kz) + AND studiengang_kz IN (' . $studiengang_kz. ')'; ; } - + return $this->loadWhere($condition); } diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index ec5522674..559700390 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -165,7 +165,7 @@ class Person_model extends DB_Model if (!hasData($person)) return success(null); - $this->KontaktModel->addSelect('kontakttyp, anmerkung, kontakt, zustellung'); + $this->KontaktModel->addSelect('kontakt_id, kontakttyp, anmerkung, kontakt, zustellung'); $this->KontaktModel->addOrder('kontakttyp'); $this->KontaktModel->addOrder('insertamum', 'DESC'); $where = $zustellung_only === true ? array('person_id' => $person_id, 'zustellung' => true) : array('person_id' => $person_id); @@ -268,16 +268,61 @@ class Person_model extends DB_Model public function checkDuplicate($person_id) { - $qry = "SELECT sp.person_id - FROM public.tbl_person p - LEFT JOIN public.tbl_person sp ON p.vorname = sp.vorname - AND p.nachname = sp.nachname - AND p.gebdatum = sp.gebdatum - JOIN public.tbl_prestudent ps ON sp.person_id = ps.person_id - JOIN public.tbl_prestudentstatus pss ON ps.prestudent_id = pss.prestudent_id - WHERE p.person_id = ? AND sp.person_id != ? AND pss.status_kurzbz = ?"; + $qry = "SELECT person_id + FROM public.tbl_prestudent p + JOIN + ( + SELECT DISTINCT ON(prestudent_id) * + FROM public.tbl_prestudentstatus + WHERE prestudent_id IN + ( + SELECT prestudent_id + FROM public.tbl_prestudent + WHERE person_id IN + ( + SELECT p2.person_id + FROM public.tbl_person p + JOIN public.tbl_person p2 + ON p.vorname = p2.vorname + AND p.nachname = p2.nachname + AND p.gebdatum = p2.gebdatum + AND p.person_id = ? + ) + ) + ORDER BY prestudent_id, datum DESC, insertamum DESC + ) ps USING(prestudent_id) + JOIN public.tbl_status USING(status_kurzbz) + WHERE status_kurzbz = 'Interessent' + AND studiengang_kz IN + ( + SELECT studiengang_kz + FROM public.tbl_prestudent p + JOIN + ( + SELECT DISTINCT ON(prestudent_id) * + FROM public.tbl_prestudentstatus + WHERE prestudent_id IN + ( + SELECT prestudent_id + FROM public.tbl_prestudent + WHERE person_id IN + ( + SELECT p2.person_id + FROM public.tbl_person p + JOIN public.tbl_person p2 + ON p.vorname = p2.vorname + AND p.nachname = p2.nachname + AND p.gebdatum = p2.gebdatum + AND p.person_id = ? + ) + ) + ORDER BY prestudent_id, datum DESC, insertamum DESC + ) ps USING(prestudent_id) + JOIN public.tbl_status USING(status_kurzbz) + WHERE status_kurzbz = 'Abbrecher' + ) + "; - - return $this->execQuery($qry, array($person_id, $person_id, 'Abbrecher')); + return $this->execQuery($qry, array($person_id, $person_id)); } } diff --git a/application/models/system/Issue_model.php b/application/models/system/Issue_model.php index 5dac85066..ab1f9ba6e 100644 --- a/application/models/system/Issue_model.php +++ b/application/models/system/Issue_model.php @@ -12,6 +12,45 @@ class Issue_model extends DB_Model $this->pk = 'issue_id'; } + /** + * Gets issues which are open, i.e. not resolved. + * @param array $fehlercodes only issues for given fehler are retrieved + * @param int $person_id + * @param string $oe_kurzbz + * @param string $fehlercode_extern + * @return object success with issues or error + */ + public function getOpenIssues($fehlercodes, $person_id = null, $oe_kurzbz = null, $fehlercode_extern = null) + { + $params = array($fehlercodes); + // issue exists for a fehlercode (or fehlercode_extern), person_id, oe_kurzbz, if not verarbeitet yet + $qry = 'SELECT issue_id, fehlercode, inhalt, fehlercode_extern, inhalt_extern, person_id, oe_kurzbz, + behebung_parameter, datum, verarbeitetvon, verarbeitetamum + FROM system.tbl_issue + WHERE fehlercode IN ? + AND verarbeitetamum IS NULL'; + + if (!isEmptyString($fehlercode_extern)) + { + $qry .= ' AND fehlercode_extern = ?'; + $params[] = $fehlercode_extern; + } + + if (isset($person_id)) + { + $qry .= ' AND person_id = ?'; + $params[] = $person_id; + } + + if (isset($oe_kurzbz)) + { + $qry .= ' AND oe_kurzbz = ?'; + $params[] = $oe_kurzbz; + } + + return $this->execQuery($qry, $params); + } + /** * Gets number of open (non-resolved) issues. * @param string $fehlercode unique error code diff --git a/application/views/lehre/anrechnung/approveAnrechnungDetail.php b/application/views/lehre/anrechnung/approveAnrechnungDetail.php index 4603708f4..cd38fd9ac 100644 --- a/application/views/lehre/anrechnung/approveAnrechnungDetail.php +++ b/application/views/lehre/anrechnung/approveAnrechnungDetail.php @@ -25,7 +25,8 @@ $this->load->view( 'bitteBegruendungAngeben', 'empfehlungWurdeAngefordert', 'anrechnungenWurdenGenehmigt', - 'anrechnungenWurdenAbgelehnt' + 'anrechnungenWurdenAbgelehnt', + 'nurLeseberechtigung' ), 'person' => array( 'student', @@ -72,7 +73,7 @@ $this->load->view( -
'.$p->t("global/fehlerBeimSpeichernDerDaten").': - Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektphasenzeitrahmen fällt.
| - ".$p->t("zeitaufzeichnung/neu")." | + ".$p->t("zeitaufzeichnung/neu")." | "; - CSV Import | + if (!$adminView) + { + echo + " + CSV Import | - CSV Export | + CSV Export | + "; + } - Projektübersichtexport"; + echo " Projektübersichtexport"; if($anzprojekte > 0) echo " | ".$p->t("zeitaufzeichnung/projektexport").""; echo " | @@ -1291,13 +1004,32 @@ if ($projekt->getProjekteMitarbeiter($user, true)) } echo ''; echo $p->t("zeitaufzeichnung/supportAnfragen"); - echo ' -
| ';
echo '
+
+
+
diff --git a/composer.json b/composer.json
index 145927be0..4d1c2a896 100644
--- a/composer.json
+++ b/composer.json
@@ -246,7 +246,7 @@
"afarkas/html5shiv": "3.7.*",
- "chriskacerguis/codeigniter-restserver": "3.0.*",
+ "chriskacerguis/codeigniter-restserver": "3.0.3",
"christianbach/tablesorter": "1.0.*",
"codeigniter/framework": "3.*",
"components/jquery": "3.*",
diff --git a/composer.lock b/composer.lock
index 467af9461..6fc201986 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "d9941245360c86434d18413999bdc812",
- "content-hash": "fbeb5d4ef943f6d1d55220cb844d11f1",
+ "hash": "ab181b377c4128ccde03cc50571b7ab6",
+ "content-hash": "e19ca762a6a929e69ae3b0e649fa4f6d",
"packages": [
{
"name": "BlackrockDigital/startbootstrap-sb-admin-2",
@@ -130,24 +130,24 @@
},
{
"name": "codeigniter/framework",
- "version": "3.1.11",
+ "version": "3.1.13",
"source": {
"type": "git",
"url": "https://github.com/bcit-ci/CodeIgniter.git",
- "reference": "b73eb19aed66190c10c9cad476da7c36c271d6dc"
+ "reference": "bcb17eb8ba53a85de154439d0ab8ff1bed047bc9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/bcit-ci/CodeIgniter/zipball/b73eb19aed66190c10c9cad476da7c36c271d6dc",
- "reference": "b73eb19aed66190c10c9cad476da7c36c271d6dc",
+ "url": "https://api.github.com/repos/bcit-ci/CodeIgniter/zipball/bcb17eb8ba53a85de154439d0ab8ff1bed047bc9",
+ "reference": "bcb17eb8ba53a85de154439d0ab8ff1bed047bc9",
"shasum": ""
},
"require": {
"php": ">=5.3.7"
},
"require-dev": {
- "mikey179/vfsstream": "1.1.*",
- "phpunit/phpunit": "4.* || 5.*"
+ "mikey179/vfsstream": "1.6.*",
+ "phpunit/phpunit": "4.* || 5.* || 9.*"
},
"suggest": {
"paragonie/random_compat": "Provides better randomness in PHP 5.x"
@@ -159,7 +159,7 @@
],
"description": "The CodeIgniter framework",
"homepage": "https://codeigniter.com",
- "time": "2019-09-19 12:08:45"
+ "time": "2022-03-03 13:21:49"
},
{
"name": "components/angular.js",
@@ -502,16 +502,16 @@
},
{
"name": "components/jquery",
- "version": "3.4.1",
+ "version": "3.6.0",
"source": {
"type": "git",
"url": "https://github.com/components/jquery.git",
- "reference": "901828b7968b18319e377dc23d466f28426ee083"
+ "reference": "6cf38ee1fd04b6adf8e7dda161283aa35be818c3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/components/jquery/zipball/901828b7968b18319e377dc23d466f28426ee083",
- "reference": "901828b7968b18319e377dc23d466f28426ee083",
+ "url": "https://api.github.com/repos/components/jquery/zipball/6cf38ee1fd04b6adf8e7dda161283aa35be818c3",
+ "reference": "6cf38ee1fd04b6adf8e7dda161283aa35be818c3",
"shasum": ""
},
"type": "component",
@@ -540,7 +540,7 @@
],
"description": "jQuery JavaScript Library",
"homepage": "http://jquery.com",
- "time": "2019-10-23 05:15:13"
+ "time": "2021-03-20 19:13:42"
},
{
"name": "components/jqueryui",
@@ -674,6 +674,7 @@
"captcha",
"security"
],
+ "abandoned": true,
"time": "2018-03-09 06:07:41"
},
{
@@ -750,16 +751,16 @@
},
{
"name": "fzaninotto/faker",
- "version": "v1.9.1",
+ "version": "v1.9.2",
"source": {
"type": "git",
"url": "https://github.com/fzaninotto/Faker.git",
- "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f"
+ "reference": "848d8125239d7dbf8ab25cb7f054f1a630e68c2e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/fc10d778e4b84d5bd315dad194661e091d307c6f",
- "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f",
+ "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/848d8125239d7dbf8ab25cb7f054f1a630e68c2e",
+ "reference": "848d8125239d7dbf8ab25cb7f054f1a630e68c2e",
"shasum": ""
},
"require": {
@@ -797,7 +798,7 @@
"fixtures"
],
"abandoned": true,
- "time": "2019-12-12 13:22:17"
+ "time": "2020-12-11 09:56:16"
},
{
"name": "joeldbirch/superfish",
@@ -1086,16 +1087,16 @@
},
{
"name": "ml/json-ld",
- "version": "1.1.0",
+ "version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/lanthaler/JsonLD.git",
- "reference": "b5f82820c255cb64067b1c7adbb819cad4afa70a"
+ "reference": "c74a1aed5979ed1cfb1be35a55a305fd30e30b93"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/lanthaler/JsonLD/zipball/b5f82820c255cb64067b1c7adbb819cad4afa70a",
- "reference": "b5f82820c255cb64067b1c7adbb819cad4afa70a",
+ "url": "https://api.github.com/repos/lanthaler/JsonLD/zipball/c74a1aed5979ed1cfb1be35a55a305fd30e30b93",
+ "reference": "c74a1aed5979ed1cfb1be35a55a305fd30e30b93",
"shasum": ""
},
"require": {
@@ -1131,7 +1132,7 @@
"JSON-LD",
"jsonld"
],
- "time": "2018-11-18 20:26:18"
+ "time": "2020-06-16 17:45:06"
},
{
"name": "moment/momentjs",
@@ -1146,16 +1147,16 @@
},
{
"name": "mottie/tablesorter",
- "version": "v2.31.2",
+ "version": "v2.31.3",
"source": {
"type": "git",
"url": "https://github.com/Mottie/tablesorter.git",
- "reference": "6a32e5acc294be5b6c420c83d70d66e096533d8f"
+ "reference": "7202d5faf8105a5ecd1a2b7a653777618713ffe5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Mottie/tablesorter/zipball/6a32e5acc294be5b6c420c83d70d66e096533d8f",
- "reference": "6a32e5acc294be5b6c420c83d70d66e096533d8f",
+ "url": "https://api.github.com/repos/Mottie/tablesorter/zipball/7202d5faf8105a5ecd1a2b7a653777618713ffe5",
+ "reference": "7202d5faf8105a5ecd1a2b7a653777618713ffe5",
"shasum": ""
},
"require": {
@@ -1193,7 +1194,7 @@
"sorting",
"table"
],
- "time": "2019-12-01 13:49:52"
+ "time": "2020-03-03 13:46:03"
},
{
"name": "nategood/httpful",
@@ -1322,16 +1323,16 @@
},
{
"name": "phpseclib/phpseclib",
- "version": "2.0.31",
+ "version": "2.0.36",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
- "reference": "233a920cb38636a43b18d428f9a8db1f0a1a08f4"
+ "reference": "a97547126396548c224703a267a30af1592be146"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/233a920cb38636a43b18d428f9a8db1f0a1a08f4",
- "reference": "233a920cb38636a43b18d428f9a8db1f0a1a08f4",
+ "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/a97547126396548c224703a267a30af1592be146",
+ "reference": "a97547126396548c224703a267a30af1592be146",
"shasum": ""
},
"require": {
@@ -1409,7 +1410,7 @@
"x.509",
"x509"
],
- "time": "2021-04-06 13:56:45"
+ "time": "2022-01-30 08:48:36"
},
{
"name": "rmariuzzo/jquery-checkboxes",
@@ -1435,16 +1436,16 @@
},
{
"name": "symfony/polyfill-ctype",
- "version": "v1.13.1",
+ "version": "v1.19.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
- "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3"
+ "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
- "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/aed596913b70fae57be53d86faa2e9ef85a2297b",
+ "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b",
"shasum": ""
},
"require": {
@@ -1456,16 +1457,20 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.13-dev"
+ "dev-main": "1.19-dev"
+ },
+ "thanks": {
+ "name": "symfony/polyfill",
+ "url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
- "psr-4": {
- "Symfony\\Polyfill\\Ctype\\": ""
- },
"files": [
"bootstrap.php"
- ]
+ ],
+ "psr-4": {
+ "Symfony\\Polyfill\\Ctype\\": ""
+ }
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -1489,7 +1494,7 @@
"polyfill",
"portable"
],
- "time": "2019-11-27 13:56:44"
+ "time": "2020-10-23 09:01:57"
},
{
"name": "tapmodo/Jcrop",
@@ -1504,16 +1509,16 @@
},
{
"name": "tinymce/tinymce",
- "version": "4.9.8",
+ "version": "4.9.11",
"source": {
"type": "git",
"url": "https://github.com/tinymce/tinymce-dist.git",
- "reference": "912df2bc85015c758e32d1262219f1653bbf9783"
+ "reference": "3a68b67d1120ab89c6760afeb787291703c9a7d5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/tinymce/tinymce-dist/zipball/912df2bc85015c758e32d1262219f1653bbf9783",
- "reference": "912df2bc85015c758e32d1262219f1653bbf9783",
+ "url": "https://api.github.com/repos/tinymce/tinymce-dist/zipball/3a68b67d1120ab89c6760afeb787291703c9a7d5",
+ "reference": "3a68b67d1120ab89c6760afeb787291703c9a7d5",
"shasum": ""
},
"type": "component",
@@ -1546,7 +1551,7 @@
"tinymce",
"wysiwyg"
],
- "time": "2020-01-28 05:03:01"
+ "time": "2020-07-13 05:29:19"
},
{
"name": "tomazdragar/SimpleCropper",
@@ -1611,16 +1616,16 @@
},
{
"name": "twig/twig",
- "version": "v1.42.4",
+ "version": "v1.42.5",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
- "reference": "e587180584c3d2d6cb864a0454e777bb6dcb6152"
+ "reference": "87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/twigphp/Twig/zipball/e587180584c3d2d6cb864a0454e777bb6dcb6152",
- "reference": "e587180584c3d2d6cb864a0454e777bb6dcb6152",
+ "url": "https://api.github.com/repos/twigphp/Twig/zipball/87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e",
+ "reference": "87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e",
"shasum": ""
},
"require": {
@@ -1629,8 +1634,7 @@
},
"require-dev": {
"psr/container": "^1.0",
- "symfony/debug": "^3.4|^4.2",
- "symfony/phpunit-bridge": "^4.4@dev|^5.0"
+ "symfony/phpunit-bridge": "^4.4|^5.0"
},
"type": "library",
"extra": {
@@ -1659,7 +1663,6 @@
},
{
"name": "Twig Team",
- "homepage": "https://twig.symfony.com/contributors",
"role": "Contributors"
},
{
@@ -1673,24 +1676,24 @@
"keywords": [
"templating"
],
- "time": "2019-11-11 16:49:32"
+ "time": "2020-02-11 05:59:23"
},
{
"name": "zetacomponents/base",
- "version": "1.9.1",
+ "version": "1.9.3",
"source": {
"type": "git",
"url": "https://github.com/zetacomponents/Base.git",
- "reference": "489e20235989ddc97fdd793af31ac803972454f1"
+ "reference": "2f432f4117a5aa2164d4fb1784f84db91dbdd3b8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/zetacomponents/Base/zipball/489e20235989ddc97fdd793af31ac803972454f1",
- "reference": "489e20235989ddc97fdd793af31ac803972454f1",
+ "url": "https://api.github.com/repos/zetacomponents/Base/zipball/2f432f4117a5aa2164d4fb1784f84db91dbdd3b8",
+ "reference": "2f432f4117a5aa2164d4fb1784f84db91dbdd3b8",
"shasum": ""
},
"require-dev": {
- "phpunit/phpunit": "~5.7",
+ "phpunit/phpunit": "~8.0",
"zetacomponents/unit-test": "*"
},
"type": "library",
@@ -1737,27 +1740,27 @@
],
"description": "The Base package provides the basic infrastructure that all packages rely on. Therefore every component relies on this package.",
"homepage": "https://github.com/zetacomponents",
- "time": "2017-11-28 11:30:00"
+ "time": "2021-07-25 15:46:08"
},
{
"name": "zetacomponents/database",
- "version": "1.5.1",
+ "version": "1.5.2",
"source": {
"type": "git",
"url": "https://github.com/zetacomponents/Database.git",
- "reference": "1750d34bf64b62f064c5b1aeb5374fbd06400904"
+ "reference": "85a2fd2af4e49f64d5c7616b6fb82c1b88de53b4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/zetacomponents/Database/zipball/1750d34bf64b62f064c5b1aeb5374fbd06400904",
- "reference": "1750d34bf64b62f064c5b1aeb5374fbd06400904",
+ "url": "https://api.github.com/repos/zetacomponents/Database/zipball/85a2fd2af4e49f64d5c7616b6fb82c1b88de53b4",
+ "reference": "85a2fd2af4e49f64d5c7616b6fb82c1b88de53b4",
"shasum": ""
},
"require": {
"zetacomponents/base": "~1.8"
},
"require-dev": {
- "phpunit/phpunit": "~5.7",
+ "phpunit/phpunit": "~8.0",
"zetacomponents/database-schema": "~1.5",
"zetacomponents/unit-test": "*"
},
@@ -1814,27 +1817,28 @@
],
"description": "A lightweight database layer on top of PHP's PDO that allows you to utilize a database without having to take care of differences in SQL dialects.",
"homepage": "https://github.com/zetacomponents",
- "time": "2017-11-28 10:55:26"
+ "time": "2022-02-11 17:18:33"
},
{
"name": "zetacomponents/document",
- "version": "1.3.1",
+ "version": "1.3.3",
"source": {
"type": "git",
"url": "https://github.com/zetacomponents/Document.git",
- "reference": "688abfde573cf3fe0730f82538fbd7aa9fc95bc8"
+ "reference": "196884f00871ea7dcbca9ab8bc85716f626e9cc3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/zetacomponents/Document/zipball/688abfde573cf3fe0730f82538fbd7aa9fc95bc8",
- "reference": "688abfde573cf3fe0730f82538fbd7aa9fc95bc8",
+ "url": "https://api.github.com/repos/zetacomponents/Document/zipball/196884f00871ea7dcbca9ab8bc85716f626e9cc3",
+ "reference": "196884f00871ea7dcbca9ab8bc85716f626e9cc3",
"shasum": ""
},
"require": {
- "zetacomponents/base": "*"
+ "zetacomponents/base": "~1.8"
},
"require-dev": {
- "zetacomponents/unit-test": "dev-master"
+ "phpunit/phpunit": "~8.0",
+ "zetacomponents/unit-test": "*"
},
"type": "library",
"autoload": {
@@ -1865,7 +1869,7 @@
],
"description": "The Document components provides a general conversion framework for different semantic document markup languages like XHTML, Docbook, RST and similar.",
"homepage": "https://github.com/zetacomponents",
- "time": "2013-12-19 11:40:00"
+ "time": "2022-02-11 17:26:31"
},
{
"name": "zetacomponents/workflow",
diff --git a/content/fas.xul.php b/content/fas.xul.php
index d1d43f473..19b24b0f0 100644
--- a/content/fas.xul.php
+++ b/content/fas.xul.php
@@ -903,7 +903,7 @@ foreach($addon_obj->result as $addon)
echo '
+
+
+
+
+
+ Vielen Dank für die Teilnahme an unserem Aufnahmeverfahren.++ Die zuständige Assistenz wird sich in den nächsten Tagen bei Ihnen melden. + + Zurück zur Startseite +
+
+ Thank you for participating in our admission procedure.++ The assistant in charge will contact you in the next few days. + + Back to startpage + '.$this->convert_html_chars($row->$name).' | ';
+ // Umwandeln von Punkt in Komma bei Float-Werten
+ if (is_numeric($row->$name))
+ {
+ if (strpos($row->$name,'.') != false)
+ $row->$name = number_format($row->$name,2,",","");
+ }
$this->csv.= '"'.$row->$name.'",';
}
diff --git a/include/zeitaufzeichnung.class.php b/include/zeitaufzeichnung.class.php
index 48e189c32..fd007d1ad 100644
--- a/include/zeitaufzeichnung.class.php
+++ b/include/zeitaufzeichnung.class.php
@@ -812,20 +812,141 @@ or not exists
$qry = "select max(datum) from addon.tbl_casetime_timesheet where ".$where." and abgeschicktamum is not null";
- if($result = $this->db_query($qry))
- {
+ if ($result = $this->db_query($qry))
+ {
$datum = $this->db_fetch_object($result);
return $datum->max;
- }
- else
- {
- return false;
- }
+ }
+ else
+ {
+ return false;
+ }
}
else
{
return false;
}
}
+
+ /**
+ * Prüft, ob es für einen bestimmten User für einen bestimmten Tag eine Zeitaufzeichnung gibt
+ * @param string $user Uid des zu prüfenden Users.
+ * @param date $vonDay Startdatum des zu prüfenden Zeitraumes im Format d.m.Y.
+ * @param date $bisDay Enddatum des zu prüfenden Zeitraumes im Format d.m.Y.
+ * @return boolean true, wenn vorhanden, sonst false
+ */
+ public function existsZeitaufzeichnung($user, $vonDay, $bisDay)
+ {
+ $datum = date($vonDay);
+ $year = substr($datum, 6, 4);
+ $month = substr($datum, 3, 2);
+ $day = substr($datum, 0, 2);
+
+ $datumbisDay = date($bisDay);
+ $yearbisDay = substr($datumbisDay, 6, 4);
+ $monthbisDay = substr($datumbisDay, 3, 2);
+ $daybisDay = substr($datumbisDay, 0, 2);
+
+ $bisDay = date("Y-m-d", (mktime(0, 0, 0, $monthbisDay, $daybisDay + 1, $yearbisDay)));
+ $datum = date("Y-m-d", (mktime(0, 0, 0, $month, $day, $year)));
+
+ $qry = "
+ SELECT *
+ FROM campus.tbl_zeitaufzeichnung
+ WHERE uid = ". $this->db_add_param($user). "
+ AND start >= ". $this->db_add_param($datum). "
+ AND ende < ". $this->db_add_param($bisDay). ";
+ ";
+
+ if ($this->db_query($qry))
+ {
+ $num_rows = $this->db_num_rows();
+ if ($num_rows >= 1)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /** Check, if there is a blocking PausenError
+ *
+ * @param string $uid User uid.
+ * @param string $datumday Day to be check in the format "Y-m-d".
+ * @return boolean True if there is a Pausen error.
+ */
+ public function checkPausenErrors($uid, $datumday)
+ {
+ $tagesbeginn = '';
+ $tagesende = '';
+ $pausesumme = 0;
+ $tagessaldo = '';
+ $elsumme = '00:00';
+ $pflichtpause = false;
+ $blockingError = false;
+ $datum = new datum();
+
+ $this->getListeUserFromTo($uid, $datumday, $datumday, null);
+
+ foreach ($this->result as $row)
+ {
+ $datumtag = $datum->formatDatum($row->datum, 'Y-m-d');
+
+ if (($tagesbeginn == '' || $datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn, $format = 'Y-m-d H:i:s')) > $datum->mktime_fromtimestamp($datum->formatDatum($row->start, $format = 'Y-m-d H:i:s'))) && $row->aktivitaet_kurzbz != 'LehreExtern' && $row->aktivitaet_kurzbz != 'Ersatzruhe')
+ $tagesbeginn = $datum->formatDatum($row->start, 'H:i');
+
+ if (($tagesende == '' || $datum->mktime_fromtimestamp($datum->formatDatum($tagesende, $format = 'Y-m-d H:i:s')) < $datum->mktime_fromtimestamp($datum->formatDatum($row->ende, $format = 'Y-m-d H:i:s'))) && $row->aktivitaet_kurzbz != 'LehreExtern' && $row->aktivitaet_kurzbz != 'Ersatzruhe')
+ $tagesende = $datum->formatDatum($row->ende, 'H:i');
+
+ if ($row->aktivitaet_kurzbz == "Pause")
+ {
+ list($h1, $m1) = explode(':', $row->diff);
+ $pausesumme += ($h1 * 3600 + $m1 * 60);
+ }
+ }
+
+ $tagessaldo = $datum->mktime_fromtimestamp($datum->formatDatum($tagesende, $format = 'Y-m-d H:i:s')) - $datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn, $format = 'Y-m-d H:i:s')) - 3600;
+
+ list($h2, $m2) = explode(':', $elsumme);
+ $elsumme = $h2 * 3600 + $m2 * 60;
+
+
+ if ($datum->formatDatum($datumday, 'Y-m-d') >= '2019-11-06')
+ {
+ $pausesumme = $pausesumme;
+ }
+ elseif ($tagessaldo > 18000 && $tagessaldo < 19800 && $pflichtpause == false && $elsumme == 0)
+ {
+ $pausesumme = $tagessaldo - 18000;
+ }
+ elseif ($tagessaldo > 18000 && $pflichtpause == false && $elsumme == 0)
+ {
+ $pausesumme = $pausesumme + 1800;
+ }
+
+ if ($elsumme > 0)
+ {
+ $pausesumme = $pausesumme + $elsumme;
+ $pflichtpause = true;
+ }
+
+ $tagessaldo = $tagessaldo - $pausesumme;
+
+ //check if blocking error
+ if (($tagessaldo > 19800 && $pausesumme < 1800) || ($tagessaldo > 18000 && $tagessaldo < 19800 && $pausesumme < $tagessaldo - 18000))
+ {
+ $blockingError = true;
+ }
+
+ return $blockingError;
+ }
+
}
?>
diff --git a/include/zeitaufzeichnung_import.class.php b/include/zeitaufzeichnung_import.class.php
new file mode 100644
index 000000000..e8e6a8b15
--- /dev/null
+++ b/include/zeitaufzeichnung_import.class.php
@@ -0,0 +1,225 @@
+errors = [];
+ $this->warnings = [];
+ $this->infos = [];
+
+ $this->p = $p;
+ $this->datum = new datum();
+
+ $this->project = new projekt();
+ $this->phase = new projektphase();
+ $this->limitdate = date('c', strtotime("+5 weeks"));
+
+ $this->zeit = new zeitaufzeichnung();
+ }
+
+
+ /**
+ * @return boolean
+ */
+ public function hasErrors() {
+ return !empty($this->errors);
+ }
+
+ /**
+ * @return boolean
+ */
+ public function hasWarnings() {
+ return !empty($this->warnings);
+ }
+
+ /**
+ * @return boolean
+ */
+ public function hasInfos() {
+ return !empty($this->infos);
+ }
+
+ /**
+ * @return string
+ */
+ public function ErrorsToHTML() {
+ $html = '';
+ foreach ($this->errors as $msg) {
+ $html .= '' . $msg . '' . "\n"; + } + return $html; + } + + /** + * @return string + */ + public function WarningsToHTML() { + $html = ''; + foreach ($this->warnings as $msg) { + $html .= '' . $msg . ' ' . "\n"; + } + return $html; + } + + /** + * @return string + */ + public function InfosToHTML() { + $html = ''; + foreach ($this->infos as $msg) { + $html .= '' . $msg . ' ' . "\n"; + } + return $html; + } + + /** + * @return string + */ + public function OutputToHTML() { + return $this->InfosToHTML() . $this->WarningsToHTML() . $this->ErrorsToHTML(); + } + + /** + * @param string $msg + * @return void + */ + protected function addError($msg) { + $this->errors[] = $msg; + } + + /** + * @param string $msg + * @return void + */ + protected function addWarning($msg) { + $this->warnings[] = $msg; + } + + /** + * @param string $msg + * @return void + */ + protected function addInfo($msg) { + $this->infos[] = $msg; + } + + + /** + * @param string $uid The user id + * @param string $day "Y-m-d" formatted datestring + * @return void + * + * @throws Exception + */ + protected function checkZeitsperren($uid, $day) { + $zs = new zeitsperre(); + + if (!$zs->getSperreByDate($uid, $day, null, zeitsperre::NUR_BLOCKIERENDE_ZEITSPERREN)) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ": Fehler beim Überprüfen der Zeitsperren"); + } + + if (count($zs->result) !== 0) { + $zsdate = new DateTime($day); + $zsdate = $zsdate->format('d.m.Y'); + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ": " . $this->p->t("zeitaufzeichnung/zeitsperreVorhanden", [$zsdate, $zs->result[0]->zeitsperretyp_kurzbz])); + } + } + + /** + * @param string $date datetimestring + * @return void + * + * @throws Exception + */ + protected function checkLimitdatum($date) { + if ($this->datum->formatDatum($date, 'Y-m-d H:i:s') > $this->limitdate) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Eingabe nicht möglich da (' . $date . ') zu weit in der Zukunft liegt.'); + } + } + + /** + * @param string $start datestring + * @param string $end datestring + * @param string $aktivitaet_kurzbz + * @return void + * + * @throws Exception + */ + protected function checkDienstreise($start, $end, $aktivitaet_kurzbz) { + $startDate = $this->datum->formatDatum($start, 'Y-m-d'); + $endDate = $this->datum->formatDatum($end, 'Y-m-d'); + if ($startDate != $endDate && $aktivitaet_kurzbz != "DienstreiseMT") { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") + .': Eingabe nicht möglich, da keine Zeitaufzeichnung über mehrere Tage erlaubt ist (ausgenommen Dienstreisen).'); + } + } + + /** + * @param string $end timestring + * @return void + * + * @throws Exception + */ + protected function checkTagesgenau($end) { + $endTime = $this->datum->formatDatum($end, 'H:i:s'); + if ($endTime == '00:00:00') { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") + .': Bitte Arbeitszeiten gemäß Arbeitsaufzeichnung Leitfaden tagesgenau abgrenzen: Nur Eingaben von 00:00 bis 23:59 erlaubt!'); + } + } + + /** + * @param string $projekt_kurzbz + * @param string $start datestring + * @param string $end datestring + * @return void + * + * @throws Exception + */ + protected function checkProjectInterval($projekt_kurzbz, $start, $end) { + if (!$this->project->checkProjectInCorrectTime($projekt_kurzbz, $start, $end)) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt: (' . $start . ') (' . $end . ')'); + } + } + + /** + * @param string $phase The Projektphase ID + * @param string $start datestring + * @param string $end datestring + * @return void + * + * @throws Exception + */ + protected function checkPhaseInterval($phase, $start, $end) { + if (!$this->phase->checkProjectphaseInCorrectTime($phase, $start, $end)) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektphasenzeitrahmen fällt: (' . $start . ') (' . $end . ')'); + } + } + +} diff --git a/include/zeitaufzeichnung_import_csv.class.php b/include/zeitaufzeichnung_import_csv.class.php new file mode 100644 index 000000000..27a240e45 --- /dev/null +++ b/include/zeitaufzeichnung_import_csv.class.php @@ -0,0 +1,435 @@ +user = $user; + $this->tmpname = $filename; + $this->sperrdatum = $sperrdatum; + + $this->project_kurzbz_array = []; + $projects = $this->project->getProjekteListForMitarbeiter($user); + foreach ($projects as $pp) + $this->project_kurzbz_array[] = (string) $pp->projekt_kurzbz; + + $this->projectphasen_kurzbz_array = []; + $projektphasen = $this->phase->getProjectphaseForMitarbeiter($user); + foreach ($projektphasen as $pp) + $this->projectphasen_kurzbz_array[] = (string) $pp->projektphase_id; + } + + + /** + * @param string $msg + * @param boolean $prepend_current_line + * @return void + */ + protected function addError($msg, $prepend_current_line = false) { + if( $prepend_current_line ) { + $msg = 'Zeile ' . $this->current_line . ' - ' . $msg; + } + $this->errors[] = $msg; + } + + + /** + * @return void + */ + public function import() { + try { + $this->checkMimeType(); + $this->openFileForReading(); + $this->checkEncoding(); + $this->iterateRows(); + $this->checkAndCleanup(); + } catch (Exception $ex) { + $this->addError($ex->getMessage()); + } + } + + + /** + * @return void + * + * @throws Exception + */ + protected function checkMimeType() { + $mimeType = mime_content_type($this->tmpname); + if ($mimeType !== 'text/plain' ) { + throw new Exception('Datei ist nicht im CSV Format.'); + } + } + + /** + * @return void + * + * @throws Exception + */ + protected function openFileForReading() { + if (false === ($this->fh = fopen($this->tmpname, 'r')) ) + { + throw new Exception('CSV - Datei konnte nicht zum lesen geöffnet werden.'); + } + } + + /** + * @return void + * + * @throws Exception + */ + protected function checkEncoding() { + $filecontent = file_get_contents($this->tmpname); + if (!mb_detect_encoding($filecontent, 'UTF-8', true) ) { + throw new Exception('Datei konnte nicht importiert werden. Encoding ist nicht UTF-8!'); + } + } + + /** + * @return void + */ + protected function iterateRows() { + set_time_limit(0); + + $this->anzahl = 0; + $this->importtage_array = array(); + $this->ende_vorher = date('Y-m-d H:i:s'); + + $data = null; + $this->current_line = 0; + while (($data = fgetcsv($this->fh, 1000, ';', '"')) !== FALSE) { + if ((false !== strpos($data[self::USER], '#')) + || count($data) < self::ANZAHL_PFLICHTFELDER) { + // ignore lines starting with # + continue; + } + $this->current_line++; + $this->processData($data); + } + } + + /** + * @param array $data + * @return void + */ + protected function processData($data) { + try { + $this->checkUser($data[self::USER]); + $this->initData($data); + $this->checkProject($data[self::PROJEKT], $data[self::PHASE]); + $this->checkPhase($data[self::PHASE]); + + $this->checkZeitsperren($this->user, $this->datum->formatDatum($data[self::STARTDT], 'Y-m-d')); + $this->checkSperrdatum($data[self::STARTDT]); + $this->checkLimitdatum($data[self::STARTDT]); + $this->checkDienstreise($data[self::STARTDT], $data[self::ENDEDT], $data[self::AKTIVITAET]); + $this->checkTagesgenau($data[self::ENDEDT]); + if(empty($data[self::PHASE])) + $this->checkProjectInterval($data[self::PROJEKT], $data[self::STARTDT], $data[self::ENDEDT]); + $this->checkPhaseInterval($data[self::PHASE], $data[self::STARTDT], $data[self::ENDEDT]); + $this->checkVals($data[self::OE],$data[self::PROJEKT],$data[self::PHASE],$data[self::SERVICE]); + $this->mapLehreIntern($data); + $this->prepareZeitaufzeichnung($data); + $this->checkImporttage($data[self::STARTDT]); + $this->saveZeit($data[self::STARTDT], $data[self::ENDEDT]); + } catch (Exception $ex) { + $this->addError($ex->getMessage(), true); + } + } + + /** + * @param string $user The User ID + * @return void + * + * @throws Exception + */ + protected function checkUser($user) { + if ($user !== $this->user || (strpos($user, '#') !== false)) + { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Falsche UID nicht importiert (' . $user . ')'); + } + } + + /** + * @param string $project The Project ID or empty string + * @param string $phase The Phase ID or empty string + * @return void + * + * @throws Exception + */ + protected function checkProject($project, $phase) { + if(!empty($project) && !in_array($project, $this->project_kurzbz_array) && empty($phase)) + { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgendem Projekt entweder nicht zugewiesen sind oder das Projekt schon abgeschlossen wurde: (' . $project . ')'); + } + + } + + /** + * @param string $phase The Phase ID or empty string + * @return void + * + * @throws Exception + */ + protected function checkPhase($phase) { + if(!empty($phase) && !in_array($phase, $this->projectphasen_kurzbz_array)) + { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgender Projektphase entweder nicht zugewiesen sind oder die Projektphase schon abgeschlossen wurde: (' . $phase . ')'); + } + } + + /** + * @param array $data + * @return void + */ + protected function initData(&$data) { + foreach ([self::OE, self::PROJEKT, self::PHASE, self::SERVICE] as $key) + if (!isset($data[$key])) + $data[$key] = NULL; + + if (!isset($data[self::HOMEOFFICE])) + $data[$key] = false; + } + + /** + * @param string $start datetimestring + * @return void + * + * @throws Exception + */ + protected function checkSperrdatum($start) { + if ($this->datum->formatDatum($start, 'Y-m-d H:i:s') < $this->sperrdatum) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Eingabe nicht möglich da vor dem Sperrdatum (' . $start . ')'); + } + + } + + /** + * @param string $oe_val + * @param string $project_val + * @param string $phase_val + * @param string $service_val + * @return void + * + * @throws Exception + */ + protected function checkVals($oe_val, $project_val, $phase_val, $service_val) { + $failedvals = $this->_checkVals($oe_val, $project_val, $phase_val, $service_val); + if( count($failedvals) > 0 ) + { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Fehlerhafte Werte ('.implode(', ', $failedvals).')'); + } + } + + /** + * @param string $oe_val + * @param string $project_val + * @param string $phase_val + * @param string $service_val + * @return array + */ + protected function _checkVals ($oe_val, $project_val, $phase_val, $service_val) { + $error = []; + if ($service_val && ( filter_var($service_val, FILTER_VALIDATE_INT) === false )) { + $error[] = 'service'; + } + if ($phase_val && ( filter_var($phase_val, FILTER_VALIDATE_INT) === false )) { + $error[] = 'phase'; + } + if ($oe_val) { + $oecheck = new organisationseinheit($oe_val); + if ($oecheck->errormsg) { + $error[] = 'OE'; + } + } + if ($project_val) { + $procheck = new projekt($project_val); + if ($procheck->errormsg) { + $error[] = 'projekt'; + } + } + return $error; + } + + /** + * @param array $data + * @return void + */ + protected function mapLehreIntern(&$data) { + if ($data[self::AKTIVITAET] == 'LehreIntern') { + $data[self::AKTIVITAET] = 'Lehre'; + } + } + + /** + * @param array $data + * @return void + */ + protected function prepareZeitaufzeichnung($data) { + $this->zeit->new = true; + $this->zeit->beschreibung = NULL; + $this->zeit->oe_kurzbz_1 = NULL; + $this->zeit->projekt_kurzbz = NULL; + $this->zeit->projektphase_id = NULL; + $this->zeit->service_id = NULL; + + $this->zeit->insertamum = date('Y-m-d H:i:s'); + $this->zeit->updateamum = date('Y-m-d H:i:s'); + $this->zeit->updatevon = $this->user; + $this->zeit->insertvon = $this->user; + $this->zeit->uid = $data[self::USER]; + $this->zeit->aktivitaet_kurzbz = $data[self::AKTIVITAET]; + $this->zeit->start = $this->datum->formatDatum($data[self::STARTDT], 'Y-m-d H:i:s'); + $this->zeit->ende = $this->datum->formatDatum($data[self::ENDEDT], 'Y-m-d H:i:s'); + if (isset($data[self::BESCHREIBUNG])) { + $this->zeit->beschreibung = $data[self::BESCHREIBUNG]; + } + if (isset($data[self::OE])) { + $this->zeit->oe_kurzbz_1 = $data[self::OE]; + } + if (isset($data[self::PROJEKT])) { + $this->zeit->projekt_kurzbz = $data[self::PROJEKT]; + } + if (isset($data[self::PHASE])) { + $this->zeit->projektphase_id = $data[self::PHASE]; + } + if (isset($data[self::SERVICE])) { + $this->zeit->service_id = $data[self::SERVICE]; + } + $this->zeit->homeoffice = false; + if (isset($data[self::HOMEOFFICE])) { + $this->zeit->homeoffice = (strtolower($data[self::HOMEOFFICE]) == 'true'); + if (strtolower($data[self::HOMEOFFICE]) == 'true') { + // check, ob homeoffice gemäß Bisverwendung + $vonCSV = $this->datum->formatDatum($data[self::STARTDT], 'Y-m-d'); + $verwendung = new bisverwendung(); + $verwendung->getVerwendungDatum($data[self::USER], $vonCSV); + + foreach ($verwendung->result as $v) { + if ($v->homeoffice) { + $this->zeit->homeoffice = true; + } else { + $this->addWarning($this->p->t("zeitaufzeichnung/homeofficeNichtErlaubt", [$vonCSV])); + $this->zeit->homeoffice = false; + } + } + } + } + } + + /** + * @param string $start datestring + * @return void + * + * @throws Exception + */ + protected function checkImporttage($start) { + $tag = $this->datum->formatDatum($start, 'Y-m-d'); + + if (!in_array($tag, $this->importtage_array)) { + $this->importtage_array[] = $tag; + $this->zeit->deleteEntriesForUser($this->user, $tag); + } else if ($this->ende_vorher < $this->zeit->start) { + $this->savePause(); + } + + $this->ende_vorher = $this->zeit->ende; + } + + /** + * @return void + */ + protected function savePause() { + $pause = new zeitaufzeichnung(); + $pause->new = true; + $pause->insertamum = date('Y-m-d H:i:s'); + $pause->updateamum = date('Y-m-d H:i:s'); + $pause->updatevon = $this->user; + $pause->insertvon = $this->user; + $pause->uid = $this->user; + $pause->aktivitaet_kurzbz = 'Pause'; + $pause->start = $this->ende_vorher; + $pause->ende = $this->zeit->start; + $pause->beschreibung = ''; + $pause->homeoffice = $this->zeit->homeoffice; + if(!$pause->save()) + { + $this->addError($this->p->t("global/fehlerBeimSpeichernDerDaten").': '.$pause->errormsg, true); + } + } + + /** + * @param string $start datetimestring + * @param string $end datetimestring + * @return void + */ + protected function saveZeit($start, $end) { + if ($start != $end) { + if (!$this->zeit->save()) { + $this->addError($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $this->zeit->errormsg . '(' . $this->zeit->start . ')', true); + } else { + $this->anzahl++; + } + } else { + $this->anzahl++; + } + } + + /** + * @return void + */ + protected function checkAndCleanup() { + if ($this->anzahl > 0) { + $this->addInfo($this->p->t("global/datenWurdenGespeichert") . ' (' . $this->anzahl . ')'); + foreach ($this->importtage_array as $ptag) { + $this->zeit->cleanPausenForUser($this->user, $ptag); + } + } + } + +} diff --git a/include/zeitaufzeichnung_import_post.class.php b/include/zeitaufzeichnung_import_post.class.php new file mode 100644 index 000000000..dc6381ecb --- /dev/null +++ b/include/zeitaufzeichnung_import_post.class.php @@ -0,0 +1,222 @@ +user = $user; + $this->edit = $edit; + $this->data = $data; + } + + + /** + * @return string + */ + public function ErrorsToHTML() { + $html = ''; + foreach ($this->errors as $msg) { + $html .= '' . $msg . ' ' . "\n"; + } + return $html; + } + + + /** + * @return void + */ + public function import() { + try { + $this->checkNew($this->data['zeitaufzeichnung_id']); + $this->prepareZeitaufzeichnung($this->data['aktivitaet_kurzbz'], $this->data['von'], $this->data['bis'], $this->data['beschreibung'], $this->data['oe_kurzbz_1'], $this->data['oe_kurzbz_2'], $this->data['projekt_kurzbz'], $this->data['projektphase_id'], $this->data['homeoffice'], $this->data['service_id'], $this->data['kunde_uid']); + $this->checkZeitsperren($this->user, $this->datum->formatDatum($this->data['von'], 'Y-m-d')); + $this->checkProjectInterval($this->data['projekt_kurzbz'], $this->data['von'], $this->data['bis']); + $this->checkLimitdatum($this->data['von']); + $this->checkLimitdatum($this->data['bis']); + $this->checkPhaseInterval($this->data['projektphase_id'], $this->data['von'], $this->data['bis']); + $this->checkDienstreise($this->data['von'], $this->data['bis'], $this->data['aktivitaet_kurzbz']); + $this->checkTagesgenau($this->data['bis']); + $this->processPause($this->data['von_pause'], $this->data['bis_pause']); + $this->saveZeit(); + } catch (Exception $ex) { + $this->addError($ex->getMessage()); + } + } + + /** + * @param string $zeitaufzeichnung_id + * @return void + */ + protected function checkNew($zeitaufzeichnung_id) { + if($this->edit) { + if(!$this->zeit->load($zeitaufzeichnung_id)) + die($this->p->t("global/fehlerBeimLadenDesDatensatzes")); + + $this->zeit->new = false; + } else { + $this->zeit->new = true; + $this->zeit->insertamum = date('Y-m-d H:i:s'); + $this->zeit->insertvon = $this->user; + } + } + + /** + * @param string $aktivitaet_kurzbz + * @param string $von datetime + * @param string $bis datetime + * @param string $beschreibung + * @param string $oe_kurzbz_1 + * @param string $oe_kurzbz_2 + * @param string $projekt_kurzbz + * @param string $projektphase_id + * @param boolean $homeoffice + * @param string $service_id + * @param string $kunde_uid + * @return void + */ + protected function prepareZeitaufzeichnung($aktivitaet_kurzbz, $von, $bis, $beschreibung, $oe_kurzbz_1, $oe_kurzbz_2, $projekt_kurzbz, $projektphase_id, $homeoffice, $service_id, $kunde_uid) { + $this->zeit->uid = $this->user; + $this->zeit->aktivitaet_kurzbz = $aktivitaet_kurzbz; + $this->zeit->start = $this->datum->formatDatum($von, 'Y-m-d H:i:s'); + $this->zeit->ende = $this->datum->formatDatum($bis, 'Y-m-d H:i:s'); + $this->zeit->beschreibung = $beschreibung; + $this->zeit->oe_kurzbz_1 = $oe_kurzbz_1; + $this->zeit->oe_kurzbz_2 = $oe_kurzbz_2; + $this->zeit->updateamum = date('Y-m-d H:i:s'); + $this->zeit->updatevon = $this->user; + $this->zeit->projekt_kurzbz = $projekt_kurzbz; + $this->zeit->projektphase_id = $projektphase_id; + $this->zeit->homeoffice = $homeoffice; + $this->zeit->service_id = $service_id; + $this->zeit->kunde_uid = $kunde_uid; + } + + /** + * @param string $start datetime + * @param string $end datetime + * @return void + */ + protected function processPause($start, $end) { + if (isset($_POST['genPause'])) { + $p_start = $this->datum->formatDatum($start, 'Y-m-d H:i:s'); + $p_end = $this->datum->formatDatum($end, 'Y-m-d H:i:s'); + $this->checkPauseInArbeitszeit($p_start, $p_end); + $this->checkPauseValid($p_start, $p_end); + $this->savePause($start, $end); + } + } + + /** + * @param string $start "Y-m-d H:i:s" formatted datetime + * @param string $end "Y-m-d H:i:s" formatted datetime + * @return void + * + * @throws Exception + */ + protected function checkPauseInArbeitszeit($start, $end) { + if ($this->zeit->start > $start || $this->zeit->ende < $end) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Pause außerhalb der Arbeitszeit'); + } + } + + /** + * @param string $start "Y-m-d H:i:s" formatted datetime + * @param string $end "Y-m-d H:i:s" formatted datetime + * @return void + * + * @throws Exception + */ + protected function checkPauseValid($start, $end) { + if ($start > $end) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Fehlerhafte Pausenzeiten'); + } + } + + /** + * @param string $start datetime + * @param string $end datetime + * @return void + */ + protected function savePause($start, $end) { + //Eintrag Arbeit bis zur Pause + $ende = $this->zeit->ende; + $this->zeit->ende = $this->datum->formatDatum($start, 'Y-m-d H:i:s'); + if (!$this->zeit->save()) { + $this->addError($p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $this->zeit->errormsg); + } + //Eintrag für die Pause + $pause = new zeitaufzeichnung(); + $pause->new = true; + $pause->insertamum = date('Y-m-d H:i:s'); + $pause->updateamum = date('Y-m-d H:i:s'); + $pause->updatevon = $this->user; + $pause->insertvon = $this->user; + $pause->uid = $this->user; + $pause->aktivitaet_kurzbz = 'Pause'; + $pause->homeoffice = $this->zeit->homeoffice; + $pause->start = $this->datum->formatDatum($start, 'Y-m-d H:i:s'); + $pause->ende = $this->datum->formatDatum($end, 'Y-m-d H:i:s'); + $pause->beschreibung = ''; + if (!$pause->save()) { + $this->addError($p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $pause->errormsg); + } + // Eintrag Arbeit ab der Pause + if ($this->zeit->new == false) { + $this->zeit->new = true; + $this->zeit->insertamum = date('Y-m-d H:i:s'); + $this->zeit->insertvon = $this->user; + } + + $this->zeit->start = $this->datum->formatDatum($end, 'Y-m-d H:i:s'); + $this->zeit->ende = $ende; + } + + /** + * @return void + * + * @throws Exception + */ + protected function saveZeit() { + if (!$this->zeit->save()) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $this->zeit->errormsg); + } else if (!$this->hasErrors()) { + $this->addInfo($this->p->t("global/datenWurdenGespeichert")); + } + } + +} diff --git a/include/zeitsperre.class.php b/include/zeitsperre.class.php index 681916c26..57d2ba09a 100644 --- a/include/zeitsperre.class.php +++ b/include/zeitsperre.class.php @@ -23,6 +23,9 @@ require_once(dirname(__FILE__).'/basis_db.class.php'); class zeitsperre extends basis_db { + const NUR_BLOCKIERENDE_ZEITSPERREN = true; + const BLOCKIERENDE_ZEITSPERREN = "'Krank','Urlaub','ZA','DienstV','PflegeU','DienstF','CovidSB','CovidKS'"; + public $new; // boolean public $result = array(); // news Objekt @@ -57,6 +60,11 @@ class zeitsperre extends basis_db $this->load($zeitsperre_id); } + public static function getBlockierendeZeitsperren() + { + return explode("','",trim(self::BLOCKIERENDE_ZEITSPERREN, '\'')); + } + /** * Laedt alle Zeitsperren eines Benutzers wo ende>=now() ist * @param $uid @@ -368,11 +376,13 @@ class zeitsperre extends basis_db * * @param $user * @param $datum - * @param $stunde + * @param $stunde optional, wird nur abgefragt, wenn != null + * @param $nurblockierend boolean default false * @return true wenn ok, false im Fehlerfall */ - public function getSperreByDate($user, $datum, $stunde) + public function getSperreByDate($user, $datum, $stunde=null, $nurblockierend=false) { + $this->result = array(); $qry = " SELECT * @@ -380,16 +390,23 @@ class zeitsperre extends basis_db campus.tbl_zeitsperre WHERE vondatum<=".$this->db_add_param($datum)." - AND bisdatum>=".$this->db_add_param($datum)." AND - ((vondatum=".$this->db_add_param($datum)." AND vonstunde<=".$this->db_add_param($stunde).") OR vonstunde is null OR vondatum<>".$this->db_add_param($datum).") AND - ((bisdatum=".$this->db_add_param($datum)." AND bisstunde>=".$this->db_add_param($stunde).") OR bisstunde is null OR bisdatum<>".$this->db_add_param($datum).") AND - mitarbeiter_uid=".$this->db_add_param($user); + AND bisdatum>=".$this->db_add_param($datum); + + if( $nurblockierend ) { + $qry .= " AND zeitsperretyp_kurzbz in (" . self::BLOCKIERENDE_ZEITSPERREN . ")"; + } + + if(!is_null($stunde)) + $qry.=" AND + ((vondatum=".$this->db_add_param($datum)." AND vonstunde<=".$this->db_add_param($stunde).") OR vonstunde is null OR vondatum<>".$this->db_add_param($datum).") AND + ((bisdatum=".$this->db_add_param($datum)." AND bisstunde>=".$this->db_add_param($stunde).") OR bisstunde is null OR bisdatum<>".$this->db_add_param($datum).")"; + + $qry .= "AND mitarbeiter_uid=".$this->db_add_param($user); if($result = $this->db_query($qry)) { while($row = $this->db_fetch_object($result)) { - $obj = new zeitsperre(); $obj->zeitsperre_id = $row->zeitsperre_id; @@ -482,7 +499,7 @@ class zeitsperre extends basis_db $qry = "select datum::date, freigabevon, zeitsperretyp_kurzbz from (SELECT generate_series(vondatum::timestamp, bisdatum::timestamp, '1 day') as datum, freigabevon, mitarbeiter_uid, zeitsperretyp_kurzbz FROM campus.tbl_zeitsperre where vonstunde is null and bisstunde is null) a - where a.mitarbeiter_uid = ".$this->db_add_param($uid)." and datum>(now() - interval '".$anz_tage." Days') and zeitsperretyp_kurzbz in ('Krank','Urlaub', 'ZA', 'DienstV','PflegeU', 'DienstF','CovidSB','CovidKS')"; + where a.mitarbeiter_uid = ".$this->db_add_param($uid)." and datum>(now() - interval '".$anz_tage." Days') and zeitsperretyp_kurzbz in (" . self::BLOCKIERENDE_ZEITSPERREN . ")"; diff --git a/locale/de-AT/zeitaufzeichnung.php b/locale/de-AT/zeitaufzeichnung.php index ad9a4de0c..8e9969856 100644 --- a/locale/de-AT/zeitaufzeichnung.php +++ b/locale/de-AT/zeitaufzeichnung.php @@ -65,3 +65,5 @@ $this->phrasen['zeitaufzeichnung/pauseEinfuegen']='Pause automatisch einfügen'; $this->phrasen['zeitaufzeichnung/zeitraumZuKurz']='Zeitraum zu kurz für automatische Pause'; $this->phrasen['zeitaufzeichnung/supportAnfragen']=' Supportanfragen unter zeiterfassung@technikum-wien.at'; $this->phrasen['zeitaufzeichnung/homeofficeNichtErlaubt']='Homeoffice für den Tag %s nicht erlaubt'; +$this->phrasen['zeitaufzeichnung/zeitsperreVorhanden']='Achtung: Für den Tag %s existiert eine ganztägige Zeitsperre vom Typ %s!'; +$this->phrasen['zeitaufzeichnung/zeitsperreVorhanden1']='Für diesen Tag ist bereits eine ganztägige Zeitsperre eingetragen!'; diff --git a/locale/de-AT/zeitsperre.php b/locale/de-AT/zeitsperre.php index 06476e33d..463c092cf 100644 --- a/locale/de-AT/zeitsperre.php +++ b/locale/de-AT/zeitsperre.php @@ -44,4 +44,7 @@ $this->phrasen['zeitsperre/legendeDurchwahl']='(123)...Durchwahl'; $this->phrasen['zeitsperre/vertretungNichtKorrekt']='Die angegebene Vertretung kann nicht gefunden werden. Bitte prüfen Sie die Vertretung und versuchen Sie es erneut.'; $this->phrasen['zeitsperre/vorSperrdatum']='Datum liegt vor dem Sperrdatum der Zeitliste'; $this->phrasen['zeitsperre/abwesend']='Abwesend'; +$this->phrasen['zeitsperre/zeitaufzeichnungVorhanden']='Es existiert mindestens eine Zeitaufzeichnung im angegebenen Zeitraum.'; +$this->phrasen['zeitsperre/zeitsperreEingetragen']='Für den %s existiert bereits eine Zeitsperre vom Typ %s. + Bitte löschen Sie diese bevor Sie eine neue für diesen Tag eintragen!'; ?> diff --git a/locale/en-US/zeitaufzeichnung.php b/locale/en-US/zeitaufzeichnung.php index 9e0b84ec1..9b06303d4 100644 --- a/locale/en-US/zeitaufzeichnung.php +++ b/locale/en-US/zeitaufzeichnung.php @@ -65,3 +65,4 @@ $this->phrasen['zeitaufzeichnung/pauseEinfuegen']='insert break automatically'; $this->phrasen['zeitaufzeichnung/zeitraumZuKurz']='Timeslot too short for automatic break.'; $this->phrasen['zeitaufzeichnung/supportAnfragen']=' Contact for support zeiterfassung@technikum-wien.at'; $this->phrasen['zeitaufzeichnung/homeofficeNichtErlaubt']='Homeoffice for day %s not allowed'; +$this->phrasen['zeitaufzeichnung/zeitsperreVorhanden']=' Please note: There is a timeout for the day %s: %s! '; diff --git a/locale/en-US/zeitsperre.php b/locale/en-US/zeitsperre.php index 43909358e..44123529f 100644 --- a/locale/en-US/zeitsperre.php +++ b/locale/en-US/zeitsperre.php @@ -44,4 +44,7 @@ $this->phrasen['zeitsperre/legendeDurchwahl']='(123)...Extension'; $this->phrasen['zeitsperre/vertretungNichtKorrekt']='The selected substitute is invalid. Please check the substitute an try again.'; $this->phrasen['zeitsperre/vorSperrdatum']='Date is before last open timesheet date'; $this->phrasen['zeitsperre/abwesend']='absent'; +$this->phrasen['zeitsperre/zeitaufzeichnungVorhanden']='It exists at least one time record in the specified period.'; +$this->phrasen['zeitsperre/zeitsperreEingetragen']='There already exists an unavailability on the %s of the type %s. + Please delete the existing before creating a new one for this date!'; ?> diff --git a/public/js/issues/issuesDataset.js b/public/js/issues/issuesDataset.js index ac3732844..57a8fb4fd 100644 --- a/public/js/issues/issuesDataset.js +++ b/public/js/issues/issuesDataset.js @@ -107,10 +107,12 @@ var IssuesDataset = { { successCallback: function(data, textStatus, jqXHR) { if (FHC_AjaxClient.isError(data)) + { FHC_DialogLib.alertError( FHC_PhrasesLib.t("fehlermonitoring", "statusAendernFehler") + ": " + FHC_AjaxClient.getError(data) ); + } else if (FHC_AjaxClient.hasData(data)) { FHC_FilterWidget.reloadDataset(); diff --git a/public/js/lehre/anrechnung/approveAnrechnungDetail.js b/public/js/lehre/anrechnung/approveAnrechnungDetail.js index c2c2899ee..c5c0519f3 100644 --- a/public/js/lehre/anrechnung/approveAnrechnungDetail.js +++ b/public/js/lehre/anrechnung/approveAnrechnungDetail.js @@ -10,6 +10,7 @@ $(function(){ const genehmigung_panel = $('#approveAnrechnungDetail-genehmigung-panel'); const begruendung_panel = $('#approveAnrechnungDetail-begruendung-panel'); + const hasReadOnlyAccess = $('#approveAnrechnungDetail-generell').data('readonly'); // Pruefen ob Promise unterstuetzt wird // Tabulator funktioniert nicht mit IE @@ -21,6 +22,11 @@ $(function(){ return; } + if (hasReadOnlyAccess) + { + approveAnrechnungDetail.disableEditElements(); + } + // Set status alert color approveAnrechnungDetail.setStatusAlertColor(); @@ -417,6 +423,34 @@ var approveAnrechnungDetail = { } ); }, + disableEditElements: function() + { + // Disable: + // ...button Empfehlung anfordern + $('#approveAnrechnungDetail-request-recommendation') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + // ...button Empfehlung zuruecknehmen + $('#approveAnrechnungDetail-withdraw-request-recommedation') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + // ...button Genehmigen + $('#approveAnrechnungDetail-approve-anrechnung-ask') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + // ...button Ablehnen + $('#approveAnrechnungDetail-reject-anrechnung-ask') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + // ...button Genehmigung zurücknehmen + $('#approveAnrechnungDetail-withdraw-anrechnung-approvement') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + // ... form Empfehlungsnotiz + $('#form-empfehlungNotiz :input') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + }, copyIntoTextarea: function(elem){ // Find closest textarea diff --git a/public/js/lehre/anrechnung/approveAnrechnungUebersicht.js b/public/js/lehre/anrechnung/approveAnrechnungUebersicht.js index ff3235e52..fe78217b9 100644 --- a/public/js/lehre/anrechnung/approveAnrechnungUebersicht.js +++ b/public/js/lehre/anrechnung/approveAnrechnungUebersicht.js @@ -148,6 +148,8 @@ $(function(){ const genehmigung_panel = $('#approveAnrechnungUebersicht-genehmigung-panel'); const begruendung_panel = $('#approveAnrechnungUebersicht-begruendung-panel'); + const hasReadOnlyAccess = $('#formApproveAnrechnungUebersicht').data('readonly'); + const hasCreateAnrechnungAccess = $('#formApproveAnrechnungUebersicht').data('createaccess'); // Pruefen ob Promise unterstuetzt wird // Tabulator funktioniert nicht mit IE @@ -165,6 +167,16 @@ $(function(){ $('#tableWidgetTabulator').tabulator('redraw', true); }); + if (hasReadOnlyAccess) + { + approveAnrechnung.disableEditElements(); + } + + if (!hasCreateAnrechnungAccess) + { + approveAnrechnung.disableCreateAnrechnungButton(); + } + // Set status alert color approveAnrechnung.setStatusAlertColor(); @@ -517,6 +529,30 @@ var approveAnrechnung = { $('#requestAnrechnung-status_kurzbz').closest('div').addClass('alert-warning'); } }, + disableEditElements: function() + { + // Disable: + // ...button Empfehlung anfordern + $('#approveAnrechnungUebersicht-request-recommendation') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + // ...button Ablehnen + $('#approveAnrechnungUebersicht-reject-anrechnungen-ask') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + // ...button Genehmigen + $('#approveAnrechnungUebersicht-approve-anrechnungen-ask') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + + }, + disableCreateAnrechnungButton: function() + { + // Disable button Antrag anlegen + $('#approveAnrechnungUebersicht-create-anrechnung') + .removeAttr('href') + .css({'color': 'grey', 'pointer-events': 'none'}); // property disabled does not work for link + }, copyIntoTextarea: function(elem){ // Find closest textarea diff --git a/rdf/projektphase.rdf.php b/rdf/projektphase.rdf.php index dfe3b1f4c..cf3a536df 100644 --- a/rdf/projektphase.rdf.php +++ b/rdf/projektphase.rdf.php @@ -36,9 +36,9 @@ $projekt_kurzbz = isset($_GET['projekt_kurzbz'])?$_GET['projekt_kurzbz'] : ''; if($projektphase_id != '') { $phase = new projektphase(); - $timestamp = time(); + $timestamp = time(); $timestamp = date('Y-m-d'); - + if(!$phase->load($projektphase_id)) die('Fehler beim Laden der Phase'); $ergebnis = $phase->getFortschritt($projektphase_id); @@ -47,7 +47,7 @@ if($projektphase_id != '') // hat phase schon begonnen if($timestamp <= $phase->start || $phase->start == '') $ergebnis = "-"; - + $oRdf->obj[$i]->setAttribut('projektphase_id',$phase->projektphase_id); $oRdf->obj[$i]->setAttribut('projekt_kurzbz',$phase->projekt_kurzbz); $oRdf->obj[$i]->setAttribut('projektphase_fk',$phase->projektphase_fk); @@ -69,49 +69,50 @@ if($projektphase_id != '') $oRdf->addSequence($phase->projektphase_id, $phase->projektphase_fk); else $oRdf->addSequence($phase->projektphase_id); - -}else if($projekt_kurzbz != '') + +} +else if($projekt_kurzbz != '') { $projektphase = new projektphase(); - + // gesetzt wenn abfrage für fk ansonsten lade alle phasen zur projekt_kurzbz if(isset($_GET['phase_id'])) $projektphase->getProjektphasenForFk($projekt_kurzbz, $_GET['phase_id']); - else - $projektphase->getProjektphasen($projekt_kurzbz); - + else + $projektphase->getProjektphasen($projekt_kurzbz); + if(isset($_GET['optional'])) { $idx=$oRdf->newObjekt('opt'); - - $oRdf->obj[$idx]->setAttribut('projektphase_id',''); - $oRdf->obj[$idx]->setAttribut('projekt_kurzbz', ''); + + $oRdf->obj[$idx]->setAttribut('projektphase_id',''); + $oRdf->obj[$idx]->setAttribut('projekt_kurzbz', ''); $oRdf->obj[$idx]->setAttribut('projektphase_fk', ''); - $oRdf->obj[$idx]->setAttribut('bezeichnung','< Auswahl >'); - $oRdf->obj[$idx]->setAttribut('beschreibung', ''); + $oRdf->obj[$idx]->setAttribut('bezeichnung','< Auswahl >'); + $oRdf->obj[$idx]->setAttribut('beschreibung', ''); $oRdf->obj[$idx]->setAttribut('start', ''); $oRdf->obj[$idx]->setAttribut('ende', ''); - $oRdf->obj[$idx]->setAttribut('budget', ''); - $oRdf->obj[$idx]->setAttribut('personentage', ''); + $oRdf->obj[$idx]->setAttribut('budget', ''); + $oRdf->obj[$idx]->setAttribut('personentage', ''); $oRdf->obj[$idx]->setAttribut('farbe', ''); $oRdf->obj[$idx]->setAttribut('typ', ''); $oRdf->obj[$idx]->setAttribut('zeitaufzeichnung',''); $oRdf->addSequence('opt'); } - + foreach($projektphase->result as $phase) { $idx=$oRdf->newObjekt($phase->projektphase_id); - - $oRdf->obj[$idx]->setAttribut('projektphase_id',$phase->projektphase_id); - $oRdf->obj[$idx]->setAttribut('projekt_kurzbz', $phase->projekt_kurzbz); + + $oRdf->obj[$idx]->setAttribut('projektphase_id',$phase->projektphase_id); + $oRdf->obj[$idx]->setAttribut('projekt_kurzbz', $phase->projekt_kurzbz); $oRdf->obj[$idx]->setAttribut('projektphase_fk', $phase->projektphase_fk); - $oRdf->obj[$idx]->setAttribut('bezeichnung',$phase->bezeichnung); - $oRdf->obj[$idx]->setAttribut('beschreibung', $phase->beschreibung); + $oRdf->obj[$idx]->setAttribut('bezeichnung',$phase->bezeichnung); + $oRdf->obj[$idx]->setAttribut('beschreibung', $phase->beschreibung); $oRdf->obj[$idx]->setAttribut('start', $phase->start); $oRdf->obj[$idx]->setAttribut('ende', $phase->ende); - $oRdf->obj[$idx]->setAttribut('budget', $phase->budget); + $oRdf->obj[$idx]->setAttribut('budget', $phase->budget); $oRdf->obj[$idx]->setAttribut('personentage', $phase->personentage); $oRdf->obj[$idx]->setAttribut('farbe', $phase->farbe); $oRdf->obj[$idx]->setAttribut('typ', $phase->typ); @@ -119,25 +120,36 @@ if($projektphase_id != '') $oRdf->addSequence($phase->projektphase_id); } - + } else { $projekt_obj = new projekt(); - - if(!isset($_REQUEST['filter'])) - $projekt_obj->getProjekte(); - else - { - if($_REQUEST['filter']=='aktuell') - $projekt_obj->getProjekteAktuell(); - else if($_REQUEST['filter']=='kommende') - $projekt_obj->getProjekteAktuell(true); - } - + + if(isset($_REQUEST['filterprj'])) + { + $projekt_obj2 = new projekt(); + if($projekt_obj2->load($_REQUEST['filterprj'])) + { + $projekt_obj->result[] = $projekt_obj2; + } + } + else + { + if(!isset($_REQUEST['filter'])) + $projekt_obj->getProjekte(); + else + { + if($_REQUEST['filter']=='aktuell') + $projekt_obj->getProjekteAktuell(); + else if($_REQUEST['filter']=='kommende') + $projekt_obj->getProjekteAktuell(true); + } + } + $projektphase_obj = new projektphase(); $sequenzProjektphase = array(); - + $descr=''; $sequenz=''; $lastOE=null; @@ -152,7 +164,7 @@ else if ($lastOE!=$currentOE || $i==0) { $idx=$oRdf->newObjekt($projekt->oe_kurzbz); - + $oRdf->obj[$idx]->setAttribut('bezeichnung',$projekt->oe_kurzbz); $oRdf->obj[$idx]->setAttribut('oe_kurzbz',$projekt->oe_kurzbz); $oRdf->obj[$idx]->setAttribut('projekt_kurzbz',''); @@ -169,12 +181,12 @@ else $oRdf->obj[$idx]->setAttribut('zeitaufzeichnung',''); $oRdf->addSequence($projekt->oe_kurzbz); - + $lastOE=$currentOE; } - + $idx=$oRdf->newObjekt($projekt->oe_kurzbz.'/'.$projekt->projekt_kurzbz); - + $oRdf->obj[$idx]->setAttribut('bezeichnung',$projekt->titel); $oRdf->obj[$idx]->setAttribut('oe_kurzbz',$projekt->oe_kurzbz); $oRdf->obj[$idx]->setAttribut('projekt_kurzbz',$projekt->projekt_kurzbz); @@ -190,26 +202,26 @@ else $oRdf->obj[$idx]->setAttribut('typ','projekt'); $oRdf->obj[$idx]->setAttribut('zeitaufzeichnung',$projekt->zeitaufzeichnung); - + $oRdf->addSequence($projekt->oe_kurzbz.'/'.$projekt->projekt_kurzbz, $projekt->oe_kurzbz); - + $projektphase_obj->getProjektphasen($projekt->projekt_kurzbz); $tmpStr=''; for ($j=0;$j';
require_once('filtersupdate.php');
echo ' ';
+// ******** fehlerupdate ************/
+echo 'Issues time!'; + +echo '';
+echo 'fehlerupdate.php wird aufgerufen...';
+echo ' ';
+echo '';
+require_once('fehlerupdate.php');
+echo ' ';
+
// ******** Berechtigungen Prüfen ************/
echo 'Berechtigungen pruefen'; diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index e87473246..c329f5ece 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -5955,6 +5955,16 @@ if ($result = $db->db_query("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABL } } +// Add column parameterFuerBehebung to system.tbl_issue +if(!$result = @$db->db_query("SELECT behebung_parameter FROM system.tbl_issue LIMIT 1")) +{ + $qry = 'ALTER TABLE system.tbl_issue ADD COLUMN behebung_parameter JSONB;'; + if(!$db->db_query($qry)) + echo 'system.tbl_issue: '.$db->db_last_error().''; + else + echo ' Added column behebung_parameter to table system.tbl_issue'; +} + // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo ' Pruefe Tabellen und Attribute!'; @@ -6223,7 +6233,7 @@ $tabellen=array( "system.tbl_fehler" => array("fehlercode","fehler_kurzbz","fehlercode_extern","fehlertext","fehlertyp_kurzbz","app"), "system.tbl_fehlertyp" => array("fehlertyp_kurzbz","bezeichnung_mehrsprachig"), "system.tbl_fehler_zustaendigkeiten" => array("fehlerzustaendigkeiten_id","fehlercode","person_id","oe_kurzbz","funktion_kurzbz"), - "system.tbl_issue" => array("issue_id","fehlercode","fehlercode_extern","inhalt","inhalt_extern","person_id","oe_kurzbz","datum","verarbeitetvon","verarbeitetamum","status_kurzbz","insertvon","insertamum","updatevon","updateamum"), + "system.tbl_issue" => array("issue_id","fehlercode","fehlercode_extern","inhalt","inhalt_extern","person_id","oe_kurzbz","datum","verarbeitetvon","verarbeitetamum","status_kurzbz","behebung_parameter","insertvon","insertamum","updatevon","updateamum"), "system.tbl_issue_status" => array("status_kurzbz","bezeichnung_mehrsprachig"), "system.tbl_log" => array("log_id","person_id","zeitpunkt","app","oe_kurzbz","logtype_kurzbz","logdata","insertvon","taetigkeit_kurzbz"), "system.tbl_logtype" => array("logtype_kurzbz", "data_schema"), diff --git a/system/fehlerupdate.php b/system/fehlerupdate.php new file mode 100644 index 000000000..1a8b705e6 --- /dev/null +++ b/system/fehlerupdate.php @@ -0,0 +1,173 @@ + 'CORE_ZGV_0001', + 'fehler_kurzbz' => 'zgvDatumInZukunft', + 'fehlercode_extern' => null, + 'fehlertext' => 'ZGV Datum in Zukunft', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_ZGV_0002', + 'fehler_kurzbz' => 'zgvDatumVorGeburtsdatum', + 'fehlercode_extern' => null, + 'fehlertext' => 'ZGV Datum vor Geburtsdatum', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_ZGV_0003', + 'fehler_kurzbz' => 'zgvMasterDatumInZukunft', + 'fehlercode_extern' => null, + 'fehlertext' => 'ZGV Masterdatum in Zukunft', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_ZGV_0004', + 'fehler_kurzbz' => 'zgvMasterDatumVorZgvdatum', + 'fehlercode_extern' => null, + 'fehlertext' => 'ZGV Masterdatum vor Zgvdatum', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_ZGV_0005', + 'fehler_kurzbz' => 'zgvMasterDatumVorGeburtsdatum', + 'fehlercode_extern' => null, + 'fehlertext' => 'ZGV Masterdatum vor Geburtsdatum', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_INOUT_0001', + 'fehler_kurzbz' => 'keinAufenthaltszweckPlausi', + 'fehlercode_extern' => null, + 'fehlertext' => 'Kein Aufenthaltszweck gefunden', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_INOUT_0002', + 'fehler_kurzbz' => 'zuVieleZweckeIncomingPlausi', + 'fehlercode_extern' => null, + 'fehlertext' => 'Es sind %s Aufenthaltszwecke eingetragen (max. 1 Zweck für Incomings)', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_INOUT_0003', + 'fehler_kurzbz' => 'falscherIncomingZweckPlausi', + 'fehlercode_extern' => null, + 'fehlertext' => 'Aufenthaltszweckcode ist %s (für Incomings ist nur Zweck 1, 2, 3 erlaubt)', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_INOUT_0004', + 'fehler_kurzbz' => 'outgoingAufenthaltfoerderungfehltPlausi', + 'fehlercode_extern' => null, + 'fehlertext' => 'Keine Aufenthaltsfoerderung angegeben (bei Outgoings >= 29 Tage Monat im Ausland muss mind. 1 gemeldet werden)', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_INOUT_0005', + 'fehler_kurzbz' => 'outgoingAngerechneteEctsFehlenPlausi', + 'fehlercode_extern' => null, + 'fehlertext' => 'Angerechnete ECTS fehlen (Meldepflicht bei Outgoings >= 29 Tage Monat im Ausland)', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_INOUT_0006', + 'fehler_kurzbz' => 'outgoingErworbeneEctsFehlenPlausi', + 'fehlercode_extern' => null, + 'fehlertext' => 'Erworbene ECTS fehlen (Meldepflicht bei Outgoings >= 29 Tage Monat im Ausland)', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ) +); + +// Loop through the filters array +for ($fehlerCounter = 0; $fehlerCounter < count($fehlerArr); $fehlerCounter++) +{ + $fehler = $fehlerArr[$fehlerCounter]; // single fehler definition + + // add optional fields + $optional_fields = array('fehlercode_extern'); + + foreach ($optional_fields as $optional_field) + { + if (!array_key_exists($optional_field, $fehler)) + $fehler[$optional_field] = null; + } + + // If it's an array and contains the required fields + if (is_array($fehler) + && isset($fehler['fehlercode']) && isset($fehler['fehler_kurzbz']) + && isset($fehler['fehlertext']) && isset($fehler['fehlertyp_kurzbz']) + && isset($fehler['app'])) + { + $selectFehlerQuery = 'SELECT 1 + FROM system.tbl_fehler + WHERE fehlercode = '.$db->db_add_param($fehler['fehlercode']); + + // If no error occurred while loading a fehler from the DB + if ($dbFehlerDefinition = @$db->db_query($selectFehlerQuery)) + { + // If NO filters were loaded: insert + if ($db->db_num_rows($dbFehlerDefinition) == 0) + { + $insertFehlerQuery = 'INSERT INTO system.tbl_fehler ( + fehlercode, + fehler_kurzbz, + fehlercode_extern, + fehlertext, + fehlertyp_kurzbz, + app + ) VALUES ( + '.$db->db_add_param($fehler['fehlercode']).', + '.$db->db_add_param($fehler['fehler_kurzbz']).', + '.$db->db_add_param($fehler['fehlercode_extern']).', + '.$db->db_add_param($fehler['fehlertext']).', + '.$db->db_add_param($fehler['fehlertyp_kurzbz']).', + '.$db->db_add_param($fehler['app']).' + )'; + + if (!@$db->db_query($insertFehlerQuery)) // checks query execution + { + echo 'An error occurred while inserting fehler: '.$db->db_last_error().''; + } + else + { + echo 'Fehler added: '.$fehler['fehlercode'].' - '.$fehler['fehler_kurzbz'].' '; + } + } + } + else // otherwise if errors occurred + { + echo 'An error occurred while inserting fehler: '.$db->db_last_error().' '; + } + } +} diff --git a/system/filtersupdate.php b/system/filtersupdate.php index 1a1717339..a1536ca67 100644 --- a/system/filtersupdate.php +++ b/system/filtersupdate.php @@ -35,12 +35,12 @@ $filters = array( {"name": "ZGVNation"}, {"name": "ZGVMNation"}, {"name": "StgAbgeschickt"}, - {"name": "Studiensemester"}, {"name": "LastAction"}, {"name": "LastActionType"}, {"name": "User/Operator"}, {"name": "InfoCenterMitarbeiter"}, - {"name": "LockUser"} + {"name": "LockUser"}, + {"name": "OnholdDate"} ], "filters": [ { @@ -311,6 +311,7 @@ $filters = array( "columns": [ {"name": "Vorname"}, {"name": "Nachname"}, + {"name": "AktenId"}, {"name": "StgAbgeschickt"}, {"name": "LastAction"}, {"name": "LastActionType"}, @@ -902,9 +903,9 @@ $filters = array( ], "filters": [ { - "name": "Fehlerstatus", + "name": "Statuscode", "operation": "ncontains", - "condition": "behoben" + "condition": "resolved" }, { "name": "Hauptzuständig", @@ -963,7 +964,8 @@ $filters = array( {"name": "Nachname"}, {"name": "PersonId"}, {"name": "Fehlerstatus"}, - {"name": "Verarbeitet von"} + {"name": "Verarbeitet von"}, + {"name": "Verarbeitet am"} ], "filters": [ { @@ -973,14 +975,59 @@ $filters = array( "option": "days" }, { - "name": "Fehlerstatus", + "name": "Statuscode", "operation": "contains", - "condition": "behoben" + "condition": "resolved" } ] } ', 'oe_kurzbz' => null, + ), + array( + 'app' => 'dvuh', + 'dataset_name' => 'storno', + 'filter_kurzbz' => 'DVUHStorno', + 'description' => '{DVUH Storno Übersicht}', + 'sort' => 1, + 'default_filter' => true, + 'filter' => ' + { + "name": "DVUHStorno", + "columns": [ + {"name": "vorname"}, + {"name": "nachname"}, + {"name": "matrikelnummer"}, + {"name": "studiengang"}, + {"name": "studiensemester"} + ], + "filters": [] + } + ', + 'oe_kurzbz' => null, + ), + array( + 'app' => 'dvuh', + 'dataset_name' => 'overview', + 'filter_kurzbz' => 'BPKWartungDVUH', + 'description' => '{bPK Uebersicht}', + 'sort' => 1, + 'default_filter' => true, + 'filter' => ' + { + "name": "Fehlende bPK", + "columns": [ + {"name": "person_id"}, + {"name": "vorname"}, + {"name": "nachname"}, + {"name": "svnr"}, + {"name": "ersatzkennzeichen"}, + {"name": "mitarbeiter"} + ], + "filters": [] + } + ', + 'oe_kurzbz' => null, ) ); diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 1baffa93b..3b43a1ac0 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -896,13 +896,13 @@ $phrases = array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => 'BewerberIn bereits vorhanden', + 'text' => 'BewerberIn möglicherweise vorhanden', 'description' => '', 'insertvon' => 'system' ), array( 'sprache' => 'English', - 'text' => 'Applicant already available', + 'text' => 'Applicant maybe available', 'description' => '', 'insertvon' => 'system' ) @@ -2705,6 +2705,26 @@ $phrases = array( ) ) ), + array( + 'app' => 'core', + 'category' => 'lehre', + 'phrase' => 'studiengangskennzahlLehre', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Studiengangskennzahl', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Study program number', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), //********************** INFOCENTER/infocenter array( 'app' => 'infocenter', @@ -13694,7 +13714,27 @@ array( 'insertvon' => 'system' ) ) - ) + ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'nurLeseberechtigung', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Nur Leseberechtigung", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Read-Only Access", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ) ); diff --git a/vilesci/personen/import/mitarbeiterimport.php b/vilesci/personen/import/mitarbeiterimport.php index a96706cb9..14081986c 100644 --- a/vilesci/personen/import/mitarbeiterimport.php +++ b/vilesci/personen/import/mitarbeiterimport.php @@ -675,12 +675,12 @@ if(isset($_POST['save'])) $nachname_clean = str_replace(' ','_', $nachname_clean); $vorname_clean = str_replace(' ','_', $vorname_clean); - if (!preg_match('/^[a-z0-9-_]{3,32}$/i', $vorname_clean)) + if (!preg_match('/^[a-z0-9-_]{2,32}$/i', $vorname_clean)) { $error = true; $errormsg = 'Im Vornamen dürfen keine Trennzeichen außer - enthalten sein!'; } - if (!preg_match('/^[a-z0-9-_]{4,32}$/i', $nachname_clean)) + if (!preg_match('/^[a-z0-9-_]{2,32}$/i', $nachname_clean)) { $error = true; $errormsg = 'Im Nachnamen dürfen keine Trennzeichen außer - enthalten sein!'; diff --git a/vilesci/personen/lektorzuteilung_edit.php b/vilesci/personen/lektorzuteilung_edit.php deleted file mode 100644 index c0707c0b5..000000000 --- a/vilesci/personen/lektorzuteilung_edit.php +++ /dev/null @@ -1,189 +0,0 @@ - - * Andreas Oesterreicher < andreas.oesterreicher@technikum-wien.at > - * Rudolf Hangl < rudolf.hangl@technikum-wien.at > - * Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at > - */ - - require_once('../../config/vilesci.config.inc.php'); - require_once('../../include/basis_db.class.php'); - if (!$db = new basis_db()) - die('Es konnte keine Verbindung zum Server aufgebaut werden.'); - - include('../../include/functions.inc.php'); - - foreach ($_REQUEST as $key => $value) - { - $key=$value; - } - - $type=(isset($_REQUEST['type'])?$_REQUEST['type']:''); - - if ($type=='new') - { - $sql_query="INSERT INTO lektorzuteilung (lektor_id, lehrfach_id, stg_id, semester) VALUES ($lektorid,$lehrfachid,$stgid,$semester)"; - //echo $sql_query; - if(!($result=$db->db_query($sql_query))) - die($db->db_last_error()); - } - - if ($type=='del') - { - $sql_query="DELETE FROM lektorzuteilung WHERE id=$id"; - //echo $sql_query; - if(!($result=$db->db_query($sql_query))) - die($db->db_last_error()); - } - - // Daten für Lektorenauswahl - $sql_query="SELECT id, nachname, vornamen, uid FROM lektor ORDER BY upper(nachname), vornamen, uid"; - if(!($result_lektor=$db->db_query($sql_query))) - die($db->db_last_error()); - - - // Daten für Lehrfachauswahl - $sql_query="SELECT id, kurzbz, bezeichnung FROM lehrfach ORDER BY kurzbz"; - if(!($result_lehrfach=$db->db_query($sql_query))) - die($db->db_last_error()); - - - // Daten für Studiengang - $sql_query="SELECT id, kurzbz, bezeichnung FROM studiengang ORDER BY kurzbz"; - if(!($result_stg=$db->db_query($sql_query))) - die($db->db_last_error()); - - // Daten für die Zuteilungen - if (!isset($order)) - $order='upper(nachname), vornamen, uid'; - $sql_query="SELECT lektorzuteilung.id, nachname, nachname, vornamen, uid, lehrfach.kurzbz AS lfkurzbz, studiengang.kurzbz AS stgkurzbz, semester"; - $sql_query.=" FROM lektorzuteilung, lektor, lehrfach, studiengang WHERE lektorzuteilung.lektor_id=lektor.id"; - $sql_query.=" AND lektorzuteilung.lehrfach_id=lehrfach.id AND lektorzuteilung.stg_id=studiengang.id ORDER BY $order"; - //echo $sql_query; - if(!($erg=$db->db_query($sql_query))) - die($db->db_last_error()); - $num_rows=$db->db_num_rows($erg); - - - -$cfgBorder=1; -$cfgThBgcolor='#CCCCCC'; - -$cfgBgcolorOne='#F4F4F4'; -$cfgBgcolorTwo='#FEFFE6'; - -?> - - - - Lektoren - Lehrfach Zuteilung-Anzahl: - -- -
Zeitwünsche von - - sind aktualisiert!-<< -Zurück- - - - diff --git a/vilesci/stammdaten/benutzerberechtigung_uebersicht.php b/vilesci/stammdaten/benutzerberechtigung_uebersicht.php index 8ab988963..655ce058e 100644 --- a/vilesci/stammdaten/benutzerberechtigung_uebersicht.php +++ b/vilesci/stammdaten/benutzerberechtigung_uebersicht.php @@ -86,9 +86,22 @@ $(document).ready(function() $("#t3").tablesorter( { sortList: [[1,0],[2,0],[3,0]], - widgets: ["zebra"], + widgets: ["zebra", "filter", "stickyHeaders"], headers: {8:{sorter:false}}, - emptyTo: "emptyMax" + emptyTo: "emptyMax", + widgetOptions : { filter_functions: + { + // Add select menu to this column + 6 : { + "Ja" : function(e, n, f, i, $r, c, data) { return /Ja/.test(e); }, + "Nein" : function(e, n, f, i, $r, c, data) { return /Nein/.test(e); } + }, + 7 : { + "Aktiv" : function(e, n, f, i, $r, c, data) { return $r.find("div").hasClass( "buttonGreen" ); }, + "Inaktiv" : function(e, n, f, i, $r, c, data) { return $r.find("div").hasClass( "buttonRed" ) || $r.find("div").hasClass( "buttonYellow" ); } + } + } + } }); $("#t4").tablesorter( { @@ -528,8 +541,22 @@ if($rolle_kurzbz != '') if(isset($rollen->result) && count($rollen->result) != 0) { + // Anzahl uniquer UIDs ermitteln + $berechtigungen_array_uids = sizeof(array_column($rollen->result, null, 'uid')); + + $htmlstr .= " ".$berechtigung_kurzbz."\n"; + $htmlstr .= "".count($rollen->result)." Einträge ";
+ $htmlstr .= "".$berechtigungen_array_uids." UIDs ";
$htmlstr .= "
|