diff --git a/application/config/anrechnung.php b/application/config/anrechnung.php index 768ec3197..2466d2bb1 100644 --- a/application/config/anrechnung.php +++ b/application/config/anrechnung.php @@ -21,3 +21,6 @@ $config['grades_blocking_application'] = array( $config['fbl'] = FALSE; //Enables Info Mails $config['send_mail'] = TRUE; + +// Display fields to explain equivalence of ECTS and LV-Inhalte +$config['explain_equivalence'] = TRUE; diff --git a/application/config/migratecontract.php b/application/config/migratecontract.php new file mode 100644 index 000000000..75ba2f505 --- /dev/null +++ b/application/config/migratecontract.php @@ -0,0 +1,36 @@ +. + */ + +if (!defined('BASEPATH')) exit('No direct script access allowed'); + +$config['migratecontract_oe_default'] = 'TODO_OE_DEFAULT'; + +$config['migratecontract_matching_ba1_vertragsart'] = array( + '101'=>'dvbund', + '102'=>'dvanderengk', + '103'=>'echterdv', + '104'=>'studentischehilfskr', + '105'=>'externerlehrender', + '106'=>'dvanderenbet', + '107'=>'werkvertrag', + '108'=>'studentischehilfskr', + '109'=>'ueberlassungsvertrag', + '110'=>'echterfreier', + '111'=>'echterdv' //All-In +); \ No newline at end of file diff --git a/application/controllers/api/frontend/fas/studstatus/Wiederholung.php b/application/controllers/api/frontend/fas/studstatus/Wiederholung.php index c6e5a4fa9..19ace3d0d 100644 --- a/application/controllers/api/frontend/fas/studstatus/Wiederholung.php +++ b/application/controllers/api/frontend/fas/studstatus/Wiederholung.php @@ -63,7 +63,9 @@ class Wiederholung extends Auth_Controller $result = $this->antraglib->getLvsForPrestudent($prestudent_id, $sem_akt); - $lvs = $this->getDataOrTerminateWithError($result) ?: []; + if (isError($result)) + return $result; + $lvs = $result->retval; $rdf_url = 'http://www.technikum-wien.at/antragnote'; diff --git a/application/controllers/api/frontend/v1/betriebsmittel/BetriebsmittelP.php b/application/controllers/api/frontend/v1/betriebsmittel/BetriebsmittelP.php new file mode 100644 index 000000000..8e44b2326 --- /dev/null +++ b/application/controllers/api/frontend/v1/betriebsmittel/BetriebsmittelP.php @@ -0,0 +1,387 @@ + ['admin:r', 'assistenz:r'], + 'addNewBetriebsmittel' => self::PERM_LOGGED, + 'updateBetriebsmittel' => self::PERM_LOGGED, + 'loadBetriebsmittel' => ['admin:r', 'assistenz:r'], + 'deleteBetriebsmittel' => self::PERM_LOGGED, + 'getTypenBetriebsmittel' => ['admin:r', 'assistenz:r'], + 'loadInventarliste' => ['admin:r', 'assistenz:r'] + ]); + + //Load Models + $this->load->model('ressource/Betriebsmittel_model', 'BetriebsmittelModel'); + $this->load->model('ressource/Betriebsmittelperson_model', 'BetriebsmittelpersonModel'); + + // Additional Permission Checks + if ($this->router->method == 'addNewBetriebsmittel') { + $this->person_id = current(array_slice($this->uri->rsegments, 2)); + + $this->checkPermissionsForPerson( + $this->person_id, + ['admin:rw', 'mitarbeiter:rw', 'basis/betriebsmittel:rw'], + ['admin:rw', 'assistenz:rw', 'basis/betriebsmittel:rw'] + ); + } elseif ($this->router->method == 'updateBetriebsmittel' || $this->router->method == 'deleteBetriebsmittel') { + $betriebsmittelperson_id = current(array_slice($this->uri->rsegments, 2)); + $result = $this->BetriebsmittelpersonModel->load($betriebsmittelperson_id); + if (!hasData($result)) + show_404(); + $this->person_id = current(getData($result))->person_id; + + $this->checkPermissionsForPerson( + $this->person_id, + ['admin:rw', 'mitarbeiter:rw', 'basis/betriebsmittel:rw'], + ['admin:rw', 'assistenz:rw', 'basis/betriebsmittel:rw'] + ); + } + + // Load Libraries + $this->load->library('VariableLib', ['uid' => getAuthUID()]); + $this->load->library('form_validation'); + + // Load language phrases + $this->loadPhrases([ + 'ui', + 'wawi' + ]); + } + + public function getAllBetriebsmittel($type_id, $id) + { + $result = $this->BetriebsmittelpersonModel->getBetriebsmittelData($id, $type_id); + + if (isError($result)) { + $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); + } + + $this->terminateWithSuccess((getData($result) ?: [])); + } + + protected function validateNewOrUpdate() + { + $this->form_validation->set_rules('betriebsmitteltyp', 'Typ', 'required', [ + 'required' => $this->p->t('ui', 'error_fieldRequired') + ]); + + $this->form_validation->set_rules('kaution', 'Kaution', 'numeric|less_than_equal_to[9999.99]', [ + 'numeric' => $this->p->t('ui', 'error_fieldNotNumeric') + ]); + + $this->form_validation->set_rules('ausgegebenam', 'Ausgegeben am', 'required|is_valid_date', [ + 'required' => $this->p->t('ui', 'error_fieldRequired') + ]); + + if ($this->input->post('ausgegebenam') && $this->input->post('retouram')) { + $this->form_validation->set_rules('retouram', 'Retour am', [ + 'is_valid_date', + ['is_not_before_ausgegebenam', function ($value) { + return (new DateTime($value) >= new DateTime($this->input->post('ausgegebenam'))); + }] + ], [ + 'is_not_before_ausgegebenam' => $this->p->t('wawi', 'error_retourdatumVorAusgabe') + ]); + } else { + $this->form_validation->set_rules('retouram', 'Retour am', 'is_valid_date'); + } + + $this->form_validation->set_rules('anmerkung', 'Anmerkung', 'max_length[256]'); + + if ($this->input->post('betriebsmitteltyp') == 'Inventar') { + // Inventar + $this->form_validation->set_rules('betriebsmittel_id', 'Inventarnummer', 'required'); + } elseif ($this->input->post('betriebsmitteltyp') == 'Zutrittskarte') { + // Zutrittskarte + if ($this->input->post('nummer') === null && $this->input->post('nummer') === null) { + $this->form_validation->set_rules('nummer', 'Nummer', 'required', [ + 'required' => $this->p->t('wawi', 'error_zutrittskarteOhneNummer') + ]); + $this->form_validation->set_rules('nummer2', 'Nummer2', 'required', [ + 'required' => $this->p->t('wawi', 'error_zutrittskarteOhneNummer') + ]); + } else { + if ($this->input->post('nummer') === null) { + $result = $this->BetriebsmittelpersonModel->loadViewWhere([ + 'betriebsmitteltyp' => $this->input->post('betriebsmitteltyp'), + 'nummer2' => $this->input->post('nummer2'), + 'person_id !=' => $this->person_id, + 'retouram IS NULL' => null + ]); + if (hasData($result)) + $this->form_validation->set_rules('nummer2', 'Nummer2', 'is_array', [ + 'is_array' => $this->p->t('wawi', 'error_bmZutrittskarteOccupied', (array)current(getData($result))) + ]); + } else { + $result = $this->BetriebsmittelpersonModel->loadViewWhere([ + 'betriebsmitteltyp' => $this->input->post('betriebsmitteltyp'), + 'nummer' => $this->input->post('nummer'), + 'person_id !=' => $this->person_id, + 'retouram IS NULL' => null + ]); + if (hasData($result)) + $this->form_validation->set_rules('nummer', 'Nummer', 'is_array', [ + 'is_array' => $this->p->t('wawi', 'error_bmZutrittskarteOccupied', (array)current(getData($result))) + ]); + } + } + } + + if (!$this->form_validation->run()) + $this->terminateWithValidationErrors($this->form_validation->error_array()); + } + + public function addNewBetriebsmittel($person_id) + { + $this->form_validation->set_rules('uid', 'UID', [ + ['uid_in_person', function ($value) use ($person_id) { + if ($value === null) + return true; + $this->load->model('person/Benutzer_model', 'BenutzerModel'); + $result = $this->BenutzerModel->loadWhere([ + 'uid' => $value, + 'person_id' => $person_id + ]); + + return hasData($result); + }] + ], [ + 'uid_in_person' => $this->p->t('person', 'error_uidNotInPerson') + ]); + $this->validateNewOrUpdate(); + + $betriebsmitteltyp = $this->input->post('betriebsmitteltyp'); + $nummer = $this->input->post('nummer'); + $nummer2 = $this->input->post('nummer2'); + $beschreibung = $this->input->post('beschreibung'); + $betriebsmittel_id = $this->input->post('betriebsmittel_id'); + $anmerkung = $this->input->post('anmerkung'); + $kaution = $this->input->post('kaution'); + $ausgegebenam = $this->input->post('ausgegebenam'); + $retouram = $this->input->post('retouram'); + $uid = $this->input->post('uid'); + + // NOTE(chris): transform_kartennummer + if ($betriebsmitteltyp == 'Zutrittskarte' && $nummer) + $nummer = is_numeric($nummer) ? ltrim($nummer, "0") : hexdec(implode("", array_reverse(str_split(trim($nummer))))); + + $this->db->trans_start(); + + if ($betriebsmitteltyp != 'Inventar') { + $this->BetriebsmittelModel->addOrder('updateamum', 'DESC'); + if ($betriebsmitteltyp == 'Zutrittskarte' && $nummer === null) { + $result = $this->BetriebsmittelModel->loadWhere([ + 'betriebsmitteltyp' => $betriebsmitteltyp, + 'nummer2' => $nummer2 + ]); + } else { + $result = $this->BetriebsmittelModel->loadWhere([ + 'betriebsmitteltyp' => $betriebsmitteltyp, + 'nummer' => $nummer + ]); + } + $data = $this->getDataOrTerminateWithError($result); + + if ($data) { + $data = current($data); + if ($data->nummer !== $nummer || $data->nummer2 !== $nummer2 || $data->beschreibung !== $beschreibung) { + $result = $this->BetriebsmittelModel->update($data->betriebsmittel_id, [ + 'nummer' => $nummer, + 'nummer2' => $nummer2, + 'beschreibung' => $beschreibung, + 'updateamum' => date('c'), + 'updatevon' => getAuthUID() + ]); + $this->getDataOrTerminateWithError($result); + } + $betriebsmittel_id = $data->betriebsmittel_id; + } else { + $result = $this->BetriebsmittelModel->insert([ + 'betriebsmitteltyp' => $betriebsmitteltyp, + 'nummer' => $nummer, + 'nummer2' => $nummer2, + 'beschreibung' => $beschreibung, + 'reservieren' => false, + 'ort_kurzbz' => null, + 'insertamum' => date('c'), + 'insertvon' => getAuthUID(), + ]); + $betriebsmittel_id = $this->getDataOrTerminateWithError($result); + } + } + + $result = $this->BetriebsmittelpersonModel->insert([ + 'person_id' => $person_id, + 'betriebsmittel_id' => $betriebsmittel_id, + 'anmerkung' => $anmerkung, + 'kaution' => $kaution, + 'ausgegebenam' => $ausgegebenam, + 'retouram' => $retouram, + 'uid' => $uid, + 'insertamum' => date('c'), + 'insertvon' => getAuthUID() + ]); + + $data = $this->getDataOrTerminateWithError($result); + + $this->db->trans_complete(); + + $this->terminateWithSuccess(true); + } + + public function updateBetriebsmittel($betriebsmittelperson_id) + { + $this->validateNewOrUpdate(); + + $betriebsmitteltyp = $this->input->post('betriebsmitteltyp'); + $nummer = $this->input->post('nummer'); + $nummer2 = $this->input->post('nummer2'); + $beschreibung = $this->input->post('beschreibung'); + $betriebsmittel_id = $this->input->post('betriebsmittel_id'); + $anmerkung = $this->input->post('anmerkung'); + $kaution = $this->input->post('kaution'); + $ausgegebenam = $this->input->post('ausgegebenam'); + $retouram = $this->input->post('retouram'); + + // NOTE(chris): transform_kartennummer + if ($betriebsmitteltyp == 'Zutrittskarte' && $nummer) + $nummer = is_numeric($nummer) ? ltrim($nummer, "0") : hexdec(implode("", array_reverse(str_split(trim($nummer))))); + + $this->db->trans_start(); + + if ($betriebsmitteltyp != 'Inventar') { + $found = false; + if ($nummer !== null && $betriebsmittel_id !== null) { + $result = $this->BetriebsmittelModel->load($betriebsmittel_id); + $data = $this->getDataOrTerminateWithError($result); + if ($data && current($data)->nummer == $nummer) { + $found = true; + } + } + + if (!$found) { + $this->BetriebsmittelModel->addOrder('updateamum', 'DESC'); + if ($betriebsmitteltyp == 'Zutrittskarte' && $nummer === null) { + $result = $this->BetriebsmittelModel->loadWhere([ + 'betriebsmitteltyp' => $betriebsmitteltyp, + 'nummer2' => $nummer2 + ]); + } else { + $result = $this->BetriebsmittelModel->loadWhere([ + 'betriebsmitteltyp' => $betriebsmitteltyp, + 'nummer' => $nummer + ]); + } + $data = $this->getDataOrTerminateWithError($result); + } + + if ($data) { + $data = current($data); + if ($data->nummer !== $nummer || $data->nummer2 !== $nummer2 || $data->beschreibung !== $beschreibung) { + $result = $this->BetriebsmittelModel->update($data->betriebsmittel_id, [ + 'nummer' => $nummer, + 'nummer2' => $nummer2, + 'beschreibung' => $beschreibung, + 'updateamum' => date('c'), + 'updatevon' => getAuthUID() + ]); + $this->getDataOrTerminateWithError($result); + } + $betriebsmittel_id = $data->betriebsmittel_id; + } else { + $result = $this->BetriebsmittelModel->insert([ + 'betriebsmitteltyp' => $betriebsmitteltyp, + 'nummer' => $nummer, + 'nummer2' => $nummer2, + 'beschreibung' => $beschreibung, + 'reservieren' => false, + 'ort_kurzbz' => null, + 'insertamum' => date('c'), + 'insertvon' => getAuthUID(), + ]); + $betriebsmittel_id = $this->getDataOrTerminateWithError($result); + } + } + + $result = $this->BetriebsmittelpersonModel->update($betriebsmittelperson_id, [ + 'betriebsmittel_id' => $betriebsmittel_id, + 'anmerkung' => $anmerkung, + 'kaution' => $kaution, + 'ausgegebenam' => $ausgegebenam, + 'retouram' => $retouram, + 'updateamum' => date('c'), + 'updatevon' => getAuthUID() + ]); + + $data = $this->getDataOrTerminateWithError($result); + + $this->db->trans_complete(); + + $this->terminateWithSuccess(true); + } + + public function loadBetriebsmittel($betriebsmittelperson_id) + { + $result = $this->BetriebsmittelpersonModel->getBetriebsmittelData($betriebsmittelperson_id, 'betriebsmittelperson_id'); + + if (isError($result)) { + $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); + } + + if (!hasData($result)) { + $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id' => 'Betriebsmittelperson_id']), self::ERROR_TYPE_GENERAL); + } + + $this->terminateWithSuccess(current(getData($result))); + } + + public function deleteBetriebsmittel($betriebsmittelperson_id) + { + $result = $this->BetriebsmittelpersonModel->delete( + array('betriebsmittelperson_id' => $betriebsmittelperson_id, + ) + ); + + if (isError($result)) { + return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); + } + if (!hasData($result)) { + return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id' => 'Betriebsmittelperson_id']), self::ERROR_TYPE_GENERAL); + } + return $this->outputJsonSuccess(current(getData($result))); + } + + public function getTypenBetriebsmittel() + { + $this->load->model('ressource/Betriebsmitteltyp_model', 'BetriebsmitteltypModel'); + + $this->BetriebsmitteltypModel->addOrder('beschreibung', 'ASC'); + $result = $this->BetriebsmitteltypModel->load(); // load All + + if (isError($result)) { + $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); + } + return $this->terminateWithSuccess(getData($result) ?: []); + } + + public function loadInventarliste($searchString) + { + $result = $this->BetriebsmittelModel->loadInventarliste($searchString); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } +} + + diff --git a/application/controllers/jobs/AntragJob.php b/application/controllers/jobs/AntragJob.php index 717561589..0bac8794f 100644 --- a/application/controllers/jobs/AntragJob.php +++ b/application/controllers/jobs/AntragJob.php @@ -412,6 +412,8 @@ class AntragJob extends JOB_Controller $this->StudierendenantragModel->addSelect('studiensemester_kurzbz'); $this->StudierendenantragModel->addSelect('s.insertamum'); $this->StudierendenantragModel->addSelect('s.insertvon'); + $this->StudierendenantragModel->addJoin('public.tbl_student pts', 'prestudent_id'); + $this->StudierendenantragModel->addSelect('pts.student_uid'); $this->StudierendenantragModel->db->where_in( 'public.get_rolle_prestudent(prestudent_id, studiensemester_kurzbz)', @@ -484,7 +486,7 @@ class AntragJob extends JOB_Controller $person = current(getData($result)); $email = $studiengang->email; $dataMail = array( - 'prestudent' => $antrag->prestudent_id, + 'prestudent' => 'UID: ' . $antrag->student_uid . ', PreStudentId: ' . $antrag->prestudent_id, 'studiensemester' => $antrag->studiensemester_kurzbz, 'name' => trim($person->vorname . ' '. $person->nachname), ); diff --git a/application/controllers/jobs/IssueResolver.php b/application/controllers/jobs/IssueResolver.php index cf97b7f68..be66a6b23 100755 --- a/application/controllers/jobs/IssueResolver.php +++ b/application/controllers/jobs/IssueResolver.php @@ -45,6 +45,7 @@ class IssueResolver extends IssueResolver_Controller 'CORE_STUDENTSTATUS_0013' => 'CORE_STUDENTSTATUS_0013', 'CORE_STUDENTSTATUS_0014' => 'CORE_STUDENTSTATUS_0014', 'CORE_STUDENTSTATUS_0015' => 'CORE_STUDENTSTATUS_0015', + 'CORE_STUDENTSTATUS_0016' => 'CORE_STUDENTSTATUS_0016', 'CORE_PERSON_0001' => 'CORE_PERSON_0001', 'CORE_PERSON_0002' => 'CORE_PERSON_0002', 'CORE_PERSON_0003' => 'CORE_PERSON_0003', diff --git a/application/controllers/lehre/anrechnung/RequestAnrechnung.php b/application/controllers/lehre/anrechnung/RequestAnrechnung.php index 3cba756cf..ebc272e3e 100644 --- a/application/controllers/lehre/anrechnung/RequestAnrechnung.php +++ b/application/controllers/lehre/anrechnung/RequestAnrechnung.php @@ -111,8 +111,13 @@ class requestAnrechnung extends Auth_Controller $lehrveranstaltung_id = $this->input->post('lv_id'); $studiensemester_kurzbz = $this->input->post('studiensemester'); $bestaetigung = $this->input->post('bestaetigung'); - $begruendung_ects = $this->input->post('begruendung_ects'); - $begruendung_lvinhalt = $this->input->post('begruendung_lvinhalt'); + $begruendung_ects = $this->config->item('explain_equivalence') === TRUE + ? $this->input->post('begruendung_ects') + : NULL; + $begruendung_lvinhalt = $this->config->item('explain_equivalence') === TRUE + ? $this->input->post('begruendung_lvinhalt') + : NULL; + // Validate data if (empty($_FILES['uploadfile']['name'])) @@ -124,8 +129,8 @@ class requestAnrechnung extends Auth_Controller isEmptyString($anmerkung) || isEmptyString($lehrveranstaltung_id) || isEmptyString($studiensemester_kurzbz) || - isEmptyString($begruendung_ects) || - isEmptyString($begruendung_lvinhalt)) + ($this->config->item('explain_equivalence') === TRUE && isEmptyString($begruendung_ects)) || + ($this->config->item('explain_equivalence') === TRUE && isEmptyString($begruendung_lvinhalt))) { return $this->outputJsonError($this->p->t('ui', 'errorFelderFehlen')); } @@ -168,7 +173,7 @@ class requestAnrechnung extends Auth_Controller // Hold just inserted DMS ID $lastInsert_dms_id = $result->retval['dms_id']; - + // Save Anrechnung and Anrechnungstatus $result = $this->AnrechnungModel->createAnrechnungsantrag( $prestudent_id, diff --git a/application/controllers/system/MigrateContract.php b/application/controllers/system/MigrateContract.php index f011be356..817eaa4f0 100644 --- a/application/controllers/system/MigrateContract.php +++ b/application/controllers/system/MigrateContract.php @@ -16,7 +16,9 @@ class MigrateContract extends CLI_Controller { private $matching_ba1_vertragsart; - private $OE_DEFAULT = 'gst'; + private $OE_DEFAULT; + + protected $configerrors; /** * Constructor @@ -28,29 +30,70 @@ class MigrateContract extends CLI_Controller $this->load->model('codex/bisverwendung_model', 'BisVerwendungModel'); $this->load->model('person/benutzerfunktion_model', 'BenutzerfunktionModel'); - $this->matching_ba1_vertragsart = array( - '101'=>'externerlehrender', - '102'=>'DV anderen Gebietskörperschaft', - '103'=>'echterdv', - '104'=>'studentischehilfskr', - '105'=>'externerlehrender', - '106'=>'Andere Bildungseinrichtung', - '107'=>'werkvertrag', - '108'=>'studentischehilfskr', - '109'=>'ueberlassungsvertrag', - '110'=>'echterfreier', - '111'=>'echterdv', //All-In - ); + $this->load->config('migratecontract'); + + $this->OE_DEFAULT = $this->config->item('migratecontract_oe_default'); + $this->matching_ba1_vertragsart = $this->config->item('migratecontract_matching_ba1_vertragsart'); + $this->configerrors = array(); } // ----------------------------------------------------------------------------------------------------------------- // Public methods + public function checkConfig() + { + echo "OE_DEFAULT: " . $this->OE_DEFAULT . "\n"; + echo "matching_ba1_vertragsart: " . print_r($this->matching_ba1_vertragsart, true); + + $this->checkOE_DEFAULT(); + $this->checkMatching_ba1_vertragsart(); + + if( count($this->configerrors) > 0 ) + { + foreach($this->configerrors AS $configerror) + { + echo $configerror . "\n"; + } + die("Fehler in der Konfiguration. Abbruch!\n"); + } + else + { + echo "Konfiguration OK.\n"; + } + } + + protected function checkOE_DEFAULT() + { + $db = new DB_Model(); + $oesql = 'SELECT * FROM public.tbl_organisationseinheit WHERE oe_kurzbz = ?'; + $oeres = $db->execReadOnlyQuery($oesql, array($this->OE_DEFAULT)); + if( !hasData($oeres) ) + { + $this->configerrors[] = 'Default Organisationseinheit: "' + . $this->OE_DEFAULT . '" nicht gefunden.'; + } + } + + protected function checkMatching_ba1_vertragsart() { + $db = new DB_Model(); + foreach( $this->matching_ba1_vertragsart AS $vertragsart_kurzbz ) + { + $vasql = 'SELECT * FROM hr.tbl_vertragsart WHERE vertragsart_kurzbz = ?'; + $vares = $db->execReadOnlyQuery($vasql, array($vertragsart_kurzbz)); + if( !hasData($vares) ) + { + $this->configerrors[] = 'Vertragsart "' . $vertragsart_kurzbz + . '" nicht gefunden.'; + } + } + } /** * Everything has a beginning */ public function index($user = null) { + $this->checkConfig(); + if (!is_null($user)) { $contracts = $this->_transformUser($user); @@ -400,6 +443,11 @@ class MigrateContract extends CLI_Controller */ private function _addVertragsbestandteilZeitaufzeichnung(&$contracts, $dv, $row_verwendung) { + if( is_null($row_verwendung->zeitaufzeichnungspflichtig) || is_null($row_verwendung->azgrelevant) ) + { + return; + } + if (isset($contracts['dv'][$dv]['vbs'])) { foreach ($contracts['dv'][$dv]['vbs'] as $index_vbs=>$row_vbs) diff --git a/application/controllers/system/MigrateHourlyRate.php b/application/controllers/system/MigrateHourlyRate.php index 4fed2f585..dbc8f1416 100644 --- a/application/controllers/system/MigrateHourlyRate.php +++ b/application/controllers/system/MigrateHourlyRate.php @@ -4,14 +4,15 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); class MigrateHourlyRate extends CLI_Controller { - - CONST DEFAULT_OE = 'gst'; CONST DEFAULT_DATE = '1970-01-01'; CONST STUNDENSTAZTYP_LEHRE = 'lehre'; CONST STUNDENSTAZTYP_KALKULATORISCH = 'kalkulatorisch'; + private $OE_DEFAULT; private $_ci; + protected $configerrors; + public function __construct() { parent::__construct(); @@ -21,10 +22,38 @@ class MigrateHourlyRate extends CLI_Controller $this->load->model('codex/Bisverwendung_model', 'BisVerwendungModel'); $this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel'); $this->load->model('ressource/Stundensatz_model', 'StundensatzModel'); + + $this->load->config('migratecontract'); + + $this->OE_DEFAULT = $this->config->item('migratecontract_oe_default'); + $this->configerrors = array(); + } + + public function checkConfig() + { + echo "OE_DEFAULT: " . $this->OE_DEFAULT . "\n"; + + $this->checkOE_DEFAULT(); + + if( count($this->configerrors) > 0 ) + { + foreach($this->configerrors AS $configerror) + { + echo $configerror . "\n"; + } + die("Fehler in der Konfiguration. Abbruch!\n"); + } + else + { + echo "Konfiguration OK.\n"; + } } public function index($user = null) { + $this->checkConfig(); + + echo "Lehre Stundensaetze werden migriert.\n"; $mitarbeiterResult = $this->_getMitarbeiterStunden($user); if (isError($mitarbeiterResult)) return $mitarbeiterResult; if (!hasData($mitarbeiterResult)) return error('Keine Mitarbeiterstunden gefunden'); @@ -38,20 +67,71 @@ class MigrateHourlyRate extends CLI_Controller if (isError($insertResult)) return $insertResult; } - $sapResult = $this->_getSapStunden($user); - if (isError($sapResult)) return $sapResult; - if (!hasData($sapResult)) return error('Keinen kalkulatorischen Stundensaetze gefunden'); - - $mitarbeiterArray = getData($sapResult); - - foreach ($mitarbeiterArray as $mitarbeiter) + if( $this->checkIfSAPSyncTableExists() ) { - $this->_getUnternehmen($mitarbeiter); - $insertResult = $this->_addStundensatz($mitarbeiter, self::STUNDENSTAZTYP_KALKULATORISCH, date_format(date_create($mitarbeiter->beginn), 'Y-m-d')); - if (isError($insertResult)) return $insertResult; + echo "SAP Sync Tabelle gefunden. SAP Stundensaetze werden migriert.\n"; + $sapResult = $this->_getSapStunden($user); + if (isError($sapResult)) return $sapResult; + if (!hasData($sapResult)) return error('Keinen kalkulatorischen Stundensaetze gefunden'); + + $mitarbeiterArray = getData($sapResult); + + foreach ($mitarbeiterArray as $mitarbeiter) + { + $this->_getUnternehmen($mitarbeiter); + $insertResult = $this->_addStundensatz($mitarbeiter, self::STUNDENSTAZTYP_KALKULATORISCH, date_format(date_create($mitarbeiter->beginn), 'Y-m-d')); + if (isError($insertResult)) return $insertResult; + } + } + else + { + echo "SAP Sync Tabelle nicht gefunden. Ignoriere SAP Stundensaetze.\n"; } } + protected function checkOE_DEFAULT() + { + $db = new DB_Model(); + $oesql = 'SELECT * FROM public.tbl_organisationseinheit WHERE oe_kurzbz = ?'; + $oeres = $db->execReadOnlyQuery($oesql, array($this->OE_DEFAULT)); + if( !hasData($oeres) ) + { + $this->configerrors[] = 'Default Organisationseinheit: "' + . $this->OE_DEFAULT . '" nicht gefunden.'; + } + } + + protected function checkIfSAPSyncTableExists() + { + $dbModel = new DB_Model(); + $params = array( + DB_NAME, + 'sync', + 'tbl_sap_stundensatz' + ); + + $sql = "SELECT + 1 AS exists + FROM + information_schema.tables + WHERE + table_catalog = ? AND + table_schema = ? AND + table_name = ?"; + + $res = $dbModel->execReadOnlyQuery($sql, $params); + + if( hasData($res) ) + { + return true; + } + else + { + return false; + } + } + + private function _getSapStunden($user = null) { $dbModel = new DB_Model(); @@ -127,7 +207,7 @@ class MigrateHourlyRate extends CLI_Controller $unternehmenResult = $this->_findUnternehmen($mitarbeiter->uid, "'kstzuordnung', 'oezuordnung'"); } - $unternehmen = self::DEFAULT_OE; + $unternehmen = $this->OE_DEFAULT; if (hasData($unternehmenResult)) $unternehmen = getData($unternehmenResult)[0]->oe_kurzbz; diff --git a/application/core/Auth_Controller.php b/application/core/Auth_Controller.php index d170a7eca..e9621332f 100644 --- a/application/core/Auth_Controller.php +++ b/application/core/Auth_Controller.php @@ -67,6 +67,68 @@ abstract class Auth_Controller extends FHC_Controller } } + /** + * Checks for Permissions depending if the given person is a + * Mitarbeiter and/or Student + * and exits/outputs an error if they are not met. + * + * @param integer $person_id + * @param array $permMa Perms if the person is a Mitarbeiter + * @param array $permStud Perms if the person is a Student + * + * @return void + */ + protected function checkPermissionsForPerson($person_id, $permMa, $permStud) + { + $res = $this->hasPermissionsForPerson($person_id, $permMa, $permStud); + + if ($res) { + $perm = array_keys(array_flip(array_merge($res|1 ? $permMa : [], $res|2 ? $permStud : []))); + $this->_outputAuthError([$this->router->method => $perm]); + } + } + + /** + * Checks for Permissions depending if the given person is a + * Mitarbeiter and/or Student + * and returns the result. + * + * @param integer $person_id + * @param array $permMa Perms if the person is a Mitarbeiter + * @param array $permStud Perms if the person is a Student + * + * @return boolean + */ + protected function hasPermissionsForPerson($person_id, $permMa, $permStud) + { + $res = 0; + $this->load->model('person/Person_model', 'PersonModel'); + $this->PersonModel->addJoin('public.tbl_benutzer', 'person_id'); + $this->PersonModel->addJoin('public.tbl_mitarbeiter', 'uid = mitarbeiter_uid'); + $result = $this->PersonModel->load($person_id); + if (hasData($result)) { + if ($this->permissionlib->isEntitled(['a' => $permMa], 'a')) + return 0; + $res = 1; + } + $this->PersonModel->addJoin('public.tbl_prestudent', 'person_id'); + $result = $this->PersonModel->load($person_id); + if (hasData($result)) { + $permStudConverted = []; + foreach (getData($result) as $row) { + foreach ($permStud as $k => $v) { + if (!isset($permStudConverted[$k])) { + $permStudConverted[$k] = $this->permissionlib->convertAccessType($v); + } + if ($this->permissionlib->isBerechtigt($permStudConverted[$k][0], $permStudConverted[$k][1], $row->studiengang_kz)) + return 0; + } + } + $res += 2; + } + return $res; + } + /** * Outputs an error message and sets the HTTP Header. * This function is protected so that it can be overwritten. diff --git a/application/helpers/hlp_common_helper.php b/application/helpers/hlp_common_helper.php index 3e682e56c..40aed007c 100644 --- a/application/helpers/hlp_common_helper.php +++ b/application/helpers/hlp_common_helper.php @@ -422,3 +422,79 @@ function isValidDate($dateString) return false; } } + + +// ------------------------------------------------------------------------ +// Collection of utility functions for form validation purposes +// ------------------------------------------------------------------------ + +/** + * check if string can be converted to a date + */ +function is_valid_date($dateString) +{ + try + { + return (new DateTime($dateString)) !== false; + } + catch(Exception $e) + { + return false; + } +} + +/** + * check if given permissions are met + */ +function has_write_permissions($value, $permissions = '') +{ + if (!$permissions) + $permissions = $value; + $permissions = explode(',', $permissions); + + $CI =& get_instance(); + $CI->load->library('AuthLib'); + $CI->load->library('PermissionLib'); + + return $CI->permissionlib->hasAtLeastOne( + $permissions, + 'sometable', + PermissionLib::WRITE_RIGHT + ); +} + +/** + * check if has permissions for a studiengang_kz + */ +function has_permissions_for_stg($studiengang_kz, $permissions = '') +{ + if (!$permissions) + return false; + $permissions = explode(',', $permissions); + + $CI =& get_instance(); + $CI->load->library('AuthLib'); + $CI->load->library('PermissionLib'); + + foreach ($permissions as $perm) { + if (strpos($perm, PermissionLib::PERMISSION_SEPARATOR) === false) { + $CI->addError( + 'The given permission does not use the correct format', + FHCAPI_Controller::ERROR_TYPE_GENERAL + ); + return false; + } + + list($perm, $accesstype) = explode(PermissionLib::PERMISSION_SEPARATOR, $perm); + $at = ''; + if (strpos($accesstype, PermissionLib::READ_RIGHT) !== false) + $at = PermissionLib::SELECT_RIGHT; // S + if (strpos($accesstype, PermissionLib::WRITE_RIGHT) !== false) + $at .= PermissionLib::REPLACE_RIGHT.PermissionLib::DELETE_RIGHT; // UID + + if ($CI->permissionlib->isBerechtigt($perm, $at, $studiengang_kz)) + return true; + } + + return false; +} diff --git a/application/language/english/form_validation_lang.php b/application/language/english/form_validation_lang.php new file mode 100644 index 000000000..b8918a721 --- /dev/null +++ b/application/language/english/form_validation_lang.php @@ -0,0 +1,43 @@ +convertAccessType($permissions[$pCounter]); if (!isEmptyString($accessType)) // if compliant { @@ -209,6 +197,24 @@ class PermissionLib return $checkPermissions; } + /** + * Retrieves permission and required access type from the newly formatted permission string + * + * @param string $permission + * + * @return array + */ + public function convertAccessType($permission) + { + list($permission, $reqAccessType) = explode(PermissionLib::PERMISSION_SEPARATOR, $permission); + $accessType = ''; + if (strpos($reqAccessType, PermissionLib::READ_RIGHT) !== false) + $accessType = PermissionLib::SELECT_RIGHT; + if (strpos($reqAccessType, PermissionLib::WRITE_RIGHT) !== false) + $accessType = PermissionLib::REPLACE_RIGHT.PermissionLib::DELETE_RIGHT; + return [$permission, $accessType]; + } + /** * Checks if at least one of the permissions given as parameter (requiredPermissions) belongs to the authenticated user * It checks the given permissions against a given method (controller method name) and a given permission type (R and/or W) diff --git a/application/libraries/issues/PlausicheckDefinitionLib.php b/application/libraries/issues/PlausicheckDefinitionLib.php index cef28a736..b44a5ce19 100644 --- a/application/libraries/issues/PlausicheckDefinitionLib.php +++ b/application/libraries/issues/PlausicheckDefinitionLib.php @@ -33,7 +33,8 @@ class PlausicheckDefinitionLib 'PrestudentMischformOhneOrgform' => 'PrestudentMischformOhneOrgform', 'StgPrestudentUngleichStgStudienplan' => 'StgPrestudentUngleichStgStudienplan', 'StgPrestudentUngleichStgStudent' => 'StgPrestudentUngleichStgStudent', - 'StudentstatusNachAbbrecher' => 'StudentstatusNachAbbrecher' + 'StudentstatusNachAbbrecher' => 'StudentstatusNachAbbrecher', + 'DualesStudiumOhneMarkierung' => 'DualesStudiumOhneMarkierung' //'StudienplanUngueltig' => 'StudienplanUngueltig' ); diff --git a/application/libraries/issues/PlausicheckProducerLib.php b/application/libraries/issues/PlausicheckProducerLib.php index c32f1f863..3a51e2b1e 100644 --- a/application/libraries/issues/PlausicheckProducerLib.php +++ b/application/libraries/issues/PlausicheckProducerLib.php @@ -12,8 +12,7 @@ class PlausicheckProducerLib private $_ci; // ci instance private $_extensionName; // name of extension - private $_app; // name of application - private $_konfiguration = array(); // konfigratio parameters + private $_konfiguration = array(); // configuration parameters public function __construct($params = null) { diff --git a/application/libraries/issues/plausichecks/DualesStudiumOhneMarkierung.php b/application/libraries/issues/plausichecks/DualesStudiumOhneMarkierung.php new file mode 100644 index 000000000..3951f6d76 --- /dev/null +++ b/application/libraries/issues/plausichecks/DualesStudiumOhneMarkierung.php @@ -0,0 +1,143 @@ +_config['exkludierteStudiengaenge']) ? $this->_config['exkludierteStudiengaenge'] : null; + + // pass parameters needed for plausicheck + $studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null; + $studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null; + + // get all students failing the plausicheck + $prestudentRes = $this->getDualesStudiumOhneMarkierung( + $studiensemester_kurzbz, + $studiengang_kz, + null, + $exkludierte_studiengang_kz + ); + + if (isError($prestudentRes)) return $prestudentRes; + + if (hasData($prestudentRes)) + { + $prestudents = getData($prestudentRes); + + // populate results with data necessary for writing issues + foreach ($prestudents as $prestudent) + { + $results[] = array( + 'person_id' => $prestudent->person_id, + 'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz, + 'fehlertext_params' => array( + 'prestudent_id' => $prestudent->prestudent_id, + 'studienplan' => $prestudent->studienplan + ), + 'resolution_params' => array( + 'prestudent_id' => $prestudent->prestudent_id, + 'studiensemester_kurzbz' => $prestudent->studiensemester_kurzbz + ) + ); + } + } + + // return the results + return success($results); + } + + /** + * All prestudents in dual Studiengang should have set the dual flag to true. + * @param studiensemester_kurzbz string check is to be executed for certain Studiensemester + * @param studiengang_kz int if check is to be executed for certain Studiengang + * @param prestudent_id int if check is to be executed only for one prestudent + * @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check + * @return success with prestudents or error + */ + public function getDualesStudiumOhneMarkierung( + $studiensemester_kurzbz, + $studiengang_kz = null, + $prestudent_id = null, + $exkludierte_studiengang_kz = null + ) { + $params = array($studiensemester_kurzbz); + + $qry = " + SELECT + DISTINCT pre.person_id, pre.prestudent_id, + stpl.bezeichnung AS studienplan, + status.studiensemester_kurzbz, + status.ausbildungssemester, + stg.oe_kurzbz AS prestudent_stg_oe_kurzbz + FROM + public.tbl_prestudent pre + JOIN public.tbl_prestudentstatus status USING(prestudent_id) + JOIN public.tbl_person USING(person_id) + JOIN lehre.tbl_studienplan stpl USING(studienplan_id) + JOIN public.tbl_studiengang stg ON pre.studiengang_kz = stg.studiengang_kz + JOIN public.tbl_studiensemester sem USING(studiensemester_kurzbz) + WHERE + (stpl.orgform_kurzbz = 'DUA' OR status.orgform_kurzbz = 'DUA') + AND pre.dual = FALSE + AND status.studiensemester_kurzbz=? + AND pre.bismelden + AND stg.melderelevant + AND NOT EXISTS ( + SELECT 1 + FROM + public.tbl_prestudentstatus + JOIN lehre.tbl_studienplan USING(studienplan_id) + JOIN public.tbl_studiensemester USING(studiensemester_kurzbz) + WHERE + prestudent_id = pre.prestudent_id + AND + ( + -- if there is a newer non-dual status, dual has not to be set + ( + ( + tbl_studienplan.orgform_kurzbz <> stpl.orgform_kurzbz + OR status.orgform_kurzbz <> tbl_prestudentstatus.orgform_kurzbz + ) + AND + ( + tbl_studiensemester.ende::date > sem.ende::date + OR (tbl_studiensemester.ende::date = sem.ende::date AND tbl_prestudentstatus.datum::date > status.datum::date) + ) + ) + OR + -- exclude Abgewiesene - they are not reported + tbl_prestudentstatus.status_kurzbz = 'Abgewiesener' + ) + )"; + + if (isset($studiengang_kz)) + { + $qry .= " AND stg.studiengang_kz = ?"; + $params[] = $studiengang_kz; + } + + if (isset($prestudent_id)) + { + $qry .= " AND pre.prestudent_id = ?"; + $params[] = $prestudent_id; + } + + if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz)) + { + $qry .= " AND stg.studiengang_kz NOT IN ?"; + $params[] = $exkludierte_studiengang_kz; + } + + return $this->_db->execReadOnlyQuery($qry, $params); + } +} diff --git a/application/libraries/issues/plausichecks/InaktiverStudentAktiverStatus.php b/application/libraries/issues/plausichecks/InaktiverStudentAktiverStatus.php index dead2b1e7..59965e238 100644 --- a/application/libraries/issues/plausichecks/InaktiverStudentAktiverStatus.php +++ b/application/libraries/issues/plausichecks/InaktiverStudentAktiverStatus.php @@ -67,6 +67,7 @@ class InaktiverStudentAktiverStatus extends PlausiChecker $prestudent_id = null, $exkludierte_studiengang_kz = null ) { + $this->_ci->load->model('organisation/studiensemester_model', 'StudiensemesterModel'); $aktStudiensemesterRes = $this->_ci->StudiensemesterModel->getAkt(); if (isError($aktStudiensemesterRes)) return $aktStudiensemesterRes; diff --git a/application/libraries/issues/resolvers/CORE_STUDENTSTATUS_0016.php b/application/libraries/issues/resolvers/CORE_STUDENTSTATUS_0016.php new file mode 100644 index 000000000..0bba1ddff --- /dev/null +++ b/application/libraries/issues/resolvers/CORE_STUDENTSTATUS_0016.php @@ -0,0 +1,36 @@ +_ci =& get_instance(); // get code igniter instance + + $this->_ci->load->library('issues/plausichecks/DualesStudiumOhneMarkierung'); + + // check if issue persists + $checkRes = $this->_ci->dualesstudiumohnemarkierung->getDualesStudiumOhneMarkierung( + $params['studiensemester_kurzbz'], + null, + $params['prestudent_id'] + ); + + if (isError($checkRes)) return $checkRes; + + if (hasData($checkRes)) + return success(false); // not resolved if issue is still present + else + return success(true); // resolved otherwise + } +} diff --git a/application/libraries/vertragsbestandteil/Dienstverhaeltnis.php b/application/libraries/vertragsbestandteil/Dienstverhaeltnis.php index 309d3dfdc..07c417077 100644 --- a/application/libraries/vertragsbestandteil/Dienstverhaeltnis.php +++ b/application/libraries/vertragsbestandteil/Dienstverhaeltnis.php @@ -29,6 +29,9 @@ class Dienstverhaeltnis extends AbstractBestandteil { protected $updateamum; protected $updatevon; + protected $dvendegrund_kurzbz; + protected $dvendegrund_anmerkung; + public function __construct() { parent::__construct(); @@ -49,6 +52,8 @@ class Dienstverhaeltnis extends AbstractBestandteil { isset($data->insertvon) && $this->setInsertvon($data->insertvon); isset($data->updateamum) && $this->setUpdateamum($data->updateamum); isset($data->updatevon) && $this->setUpdatevon($data->updatevon); + isset($data->dvendegrund_kurzbz) && $this->setDvendegrund_kurzbz($data->dvendegrund_kurzbz); + isset($data->dvendegrund_anmerkung) && $this->setDvendegrund_anmerkung($data->dvendegrund_anmerkung); $this->fromdb = false; } @@ -64,7 +69,9 @@ class Dienstverhaeltnis extends AbstractBestandteil { 'insertamum' => $this->getInsertamum(), 'insertvon' => $this->getInsertvon(), 'updateamum' => $this->getUpdateamum(), - 'updatevon' => $this->getUpdatevon() + 'updatevon' => $this->getUpdatevon(), + 'dvendegrund_kurzbz' => $this->getDvendegrund_kurzbz(), + 'dvendegrund_anmerkung' => $this->getDvendegrund_anmerkung() ); $tmp = array_filter($tmp, function($k) { @@ -139,6 +146,16 @@ EOTXT; return $this->updatevon; } + public function getDvendegrund_kurzbz() + { + return $this->dvendegrund_kurzbz; + } + + public function getDvendegrund_anmerkung() + { + return $this->dvendegrund_anmerkung; + } + public function setDienstverhaeltnis_id($dienstverhaeltnis_id) { $this->markDirty('dienstverhaeltnis_id', $this->dienstverhaeltnis_id, $dienstverhaeltnis_id); @@ -214,6 +231,20 @@ EOTXT; return $this; } + public function setDvendegrund_kurzbz($dvendegrund_kurzbz) + { + $this->markDirty('dvendegrund_kurzbz', $this->dvendegrund_kurzbz, $dvendegrund_kurzbz); + $this->dvendegrund_kurzbz = $dvendegrund_kurzbz; + return $this; + } + + public function setDvendegrund_anmerkung($dvendegrund_anmerkung) + { + $this->markDirty('dvendegrund_anmerkung', $this->dvendegrund_anmerkung, $dvendegrund_anmerkung); + $this->dvendegrund_anmerkung = $dvendegrund_anmerkung; + return $this; + } + public function validate() { //do Validation here $ci = get_instance(); diff --git a/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php b/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php index 297896a02..b58c514e1 100644 --- a/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php +++ b/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php @@ -435,7 +435,7 @@ class VertragsbestandteilLib return $result; } - public function endDienstverhaeltnis(Dienstverhaeltnis $dv, $enddate) + public function endDienstverhaeltnis(Dienstverhaeltnis $dv, $enddate, $dvendegrund_kurzbz=null, $dvendegrund_anmerkung=null) { if( $dv->getBis() !== null && $dv->getBis() < $enddate ) { @@ -460,6 +460,14 @@ class VertragsbestandteilLib $this->endVertragsbestandteil($vb, $enddate); } + if( $dvendegrund_kurzbz !== null ) + { + $dv->setDvendegrund_kurzbz($dvendegrund_kurzbz); + } + if( $dvendegrund_anmerkung !== null ) + { + $dv->setDvendegrund_anmerkung($dvendegrund_anmerkung); + } $dv->setBis($enddate); $this->updateDienstverhaeltnis($dv); diff --git a/application/models/organisation/Organisationseinheit_model.php b/application/models/organisation/Organisationseinheit_model.php index bec4aee47..4a64ee055 100644 --- a/application/models/organisation/Organisationseinheit_model.php +++ b/application/models/organisation/Organisationseinheit_model.php @@ -188,4 +188,20 @@ class Organisationseinheit_model extends DB_Model } return $this->loadWhere($condition); } + + /** + * Get OEs by eventQuery string. Use with autocomplete event queries. + * @param $eventQuery String + * @return array + */ + public function getAutocompleteSuggestions($eventQuery) + { + $this->addSelect('oe_kurzbz'); + $this->addSelect('organisationseinheittyp_kurzbz, oe_kurzbz, bezeichnung, aktiv, lehre'); + $this->addOrder('organisationseinheittyp_kurzbz, bezeichnung'); + + return $this->loadWhere(" + oe_kurzbz ILIKE '%". $this->escapeLike($eventQuery). "%' + "); + } } diff --git a/application/models/ressource/Betriebsmittel_model.php b/application/models/ressource/Betriebsmittel_model.php index 849a9199f..290c3491d 100644 --- a/application/models/ressource/Betriebsmittel_model.php +++ b/application/models/ressource/Betriebsmittel_model.php @@ -11,4 +11,24 @@ class Betriebsmittel_model extends DB_Model $this->dbTable = 'wawi.tbl_betriebsmittel'; $this->pk = 'betriebsmittel_id'; } + + /** + * load Liste Inventarnummern + */ + public function loadInventarliste($filter) + { + $filter = urldecode(strtoLower($filter)); + + $qry = " + SELECT + bm.inventarnummer, bm.betriebsmitteltyp, bm.betriebsmittel_id, CONCAT(bm.inventarnummer, ' ', bm.beschreibung) as dropdowntext + FROM + wawi.tbl_betriebsmittel bm + WHERE + upper(bm.inventarnummer) LIKE '%" .$this->db->escape_like_str($filter)."%' + OR + lower(bm.inventarnummer) LIKE '%" .$this->db->escape_like_str($filter)."%'"; + + return $this->execQuery($qry); + } } diff --git a/application/models/ressource/Betriebsmittelperson_model.php b/application/models/ressource/Betriebsmittelperson_model.php index 04878a9ad..39f08b5cd 100644 --- a/application/models/ressource/Betriebsmittelperson_model.php +++ b/application/models/ressource/Betriebsmittelperson_model.php @@ -96,4 +96,49 @@ class Betriebsmittelperson_model extends DB_Model return $this->loadWhere($condition); } + + public function getBetriebsmittelData($id, $type_id) + { + switch ($type_id) { + case 'person_id': + $cond = 'bmp.person_id'; + break; + case 'uid': + $cond = 'bmp.uid'; + break; + case 'betriebsmittelperson_id': + $cond = 'bmp.betriebsmittelperson_id'; + break; + default: + return error("ID nicht gültig"); + } + + $query = " + SELECT + bm.nummer, bmp.person_id, bm.betriebsmitteltyp, bmp.anmerkung as anmerkung, bmp.retouram, TO_CHAR(bmp.retouram::timestamp, 'DD.MM.YYYY') AS format_retour, bmp.ausgegebenam, TO_CHAR(bmp.ausgegebenam::timestamp, 'DD.MM.YYYY') AS format_ausgabe, bm.beschreibung, bmp.uid, bmp.kaution, bm.betriebsmittel_id, bmp.betriebsmittelperson_id, bm.inventarnummer, bm.nummer2 + FROM + wawi.tbl_betriebsmittelperson bmp + JOIN + wawi.tbl_betriebsmittel bm ON (bmp.betriebsmittel_id = bm.betriebsmittel_id) + WHERE + " . $cond . " = ? "; + + return $this->execQuery($query, array($id)); + } + + /** + * Perform a loadWhere on the vw_betriebsmittelperson DB View + * + * @param array $where + * + * @return stdClass + */ + public function loadViewWhere($where) + { + $table = $this->dbTable; + $this->dbTable = 'public.vw_betriebsmittelperson'; + $result = $this->loadWhere($where); + $this->dbTable = $table; + return $result; + } } diff --git a/application/models/vertragsbestandteil/Dienstverhaeltnis_model.php b/application/models/vertragsbestandteil/Dienstverhaeltnis_model.php index 2fdfcffe2..6827beaa4 100644 --- a/application/models/vertragsbestandteil/Dienstverhaeltnis_model.php +++ b/application/models/vertragsbestandteil/Dienstverhaeltnis_model.php @@ -31,9 +31,13 @@ class Dienstverhaeltnis_model extends DB_Model org.bezeichnung oe_bezeichnung, dv.von, dv.bis, + dv.dvendegrund_kurzbz, + dv.dvendegrund_anmerkung, dv.vertragsart_kurzbz, dv.updateamum, - dv.updatevon + dv.updatevon, + dv.dvendegrund_kurzbz, + dv.dvendegrund_anmerkung FROM tbl_mitarbeiter JOIN tbl_benutzer ON tbl_mitarbeiter.mitarbeiter_uid::text = tbl_benutzer.uid::text JOIN tbl_person USING (person_id) diff --git a/application/views/lehre/Antrag/Student/List.php b/application/views/lehre/Antrag/Student/List.php index 614af5d79..4a4b4f064 100644 --- a/application/views/lehre/Antrag/Student/List.php +++ b/application/views/lehre/Antrag/Student/List.php @@ -150,8 +150,6 @@ $this->load->view( break; case Studierendenantrag_model::TYP_ABMELDUNG_STGL: $allowed = [ - Studierendenantragstatus_model::STATUS_APPROVED, - Studierendenantragstatus_model::STATUS_OBJECTED, Studierendenantragstatus_model::STATUS_OBJECTION_DENIED, Studierendenantragstatus_model::STATUS_DEREGISTERED ]; diff --git a/application/views/lehre/anrechnung/approveAnrechnungDetail.php b/application/views/lehre/anrechnung/approveAnrechnungDetail.php index 0970b6edd..c96631781 100644 --- a/application/views/lehre/anrechnung/approveAnrechnungDetail.php +++ b/application/views/lehre/anrechnung/approveAnrechnungDetail.php @@ -1,4 +1,5 @@ load->config('anrechnung'); $this->load->view( 'templates/FHC-Header', array( @@ -172,14 +173,16 @@ $this->load->view(