diff --git a/application/controllers/api/frontend/v1/stv/Dokumente.php b/application/controllers/api/frontend/v1/stv/Dokumente.php index b8c7830bd..913a57dc4 100644 --- a/application/controllers/api/frontend/v1/stv/Dokumente.php +++ b/application/controllers/api/frontend/v1/stv/Dokumente.php @@ -78,52 +78,32 @@ class Dokumente extends FHCAPI_Controller $this->terminateWithError($this->p->t('ui', 'errorMissingValue', ['value' => 'Studiengang_kz']), self::ERROR_TYPE_GENERAL); $resultPreDoc = $this->_getPrestudentDokumente($prestudent_id); - - $arrayAccepted = []; $person_id = $this->_getPersonId($prestudent_id); - $docNames = array_map(function ($item) { - return $item->dokument_kurzbz; - }, $resultPreDoc); + $mergedArray = []; - foreach($docNames as $doc) + foreach ($resultPreDoc as $pre) { - $result = $this->AkteModel->getAktenFAS($person_id, $doc, $studiengang_kz, $prestudent_id, true); + $result = $this->AkteModel->getAktenFAS($person_id, $pre->dokument_kurzbz, $studiengang_kz, $prestudent_id, true); if (isError($result)) - { return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); - } + if (hasData($result)) { - $data = getData($result); - foreach ($data as $value) + foreach (getData($result) as $doc) { - array_push($arrayAccepted, $value); + $merged = clone $doc; + $merged->docdatum = $pre->docdatum; + $merged->insertvonma = $pre->insertvonma; + $merged->bezeichnung = $pre->bezeichnung; + $mergedArray[] = $merged; } } - } - - //Mapping with document_kurzbz - $preDocMap = []; - foreach ($resultPreDoc as $pre) { - $preDocMap[$pre->dokument_kurzbz] = $pre; - } - - $mergedArray = []; - foreach ($arrayAccepted as $doc) { - $merged = clone $doc; - - if (isset($preDocMap[$doc->dokument_kurzbz])) { - $merged->docdatum = $preDocMap[$doc->dokument_kurzbz]->docdatum; - $merged->insertvonma = $preDocMap[$doc->dokument_kurzbz]->insertvonma; - $merged->bezeichnung = $preDocMap[$doc->dokument_kurzbz]->bezeichnung; - } else { - $merged->akzeptiertdatum = null; - $merged->akzeptiertvon = null; + else + { + $mergedArray[] = $pre; } - - $mergedArray[] = $merged; } $this->terminateWithSuccess($mergedArray); diff --git a/application/controllers/api/frontend/v1/stv/Konto.php b/application/controllers/api/frontend/v1/stv/Konto.php index ecd58671a..d59bc76b0 100644 --- a/application/controllers/api/frontend/v1/stv/Konto.php +++ b/application/controllers/api/frontend/v1/stv/Konto.php @@ -48,7 +48,8 @@ class Konto extends FHCAPI_Controller // Load language phrases $this->loadPhrases([ - 'konto' + 'konto', + 'lehre' ]); } @@ -112,7 +113,7 @@ class Konto extends FHCAPI_Controller * * @return void */ - public function getBuchungstypen() + public function getBuchungstypen($studiensemester_kurzbz = null) { $this->load->model('crm/Buchungstyp_model', 'BuchungstypModel'); @@ -122,6 +123,7 @@ class Konto extends FHCAPI_Controller $data = $this->getDataOrTerminateWithError($result); + $this->_getOEHBeitrag($data, $studiensemester_kurzbz); $this->terminateWithSuccess($data); } @@ -494,4 +496,43 @@ class Konto extends FHCAPI_Controller $this->terminateWithSuccess(); } + + private function _getOEHBeitrag(&$data, $studiensemester_kurzbz = null) + { + if (is_null($studiensemester_kurzbz)) + { + $this->load->library('VariableLib', ['uid' => getAuthUID()]); + $studiensemester_akt = $this->variablelib->getVar('semester_aktuell'); + } + else + { + $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel'); + if ($this->StudiensemesterModel->isValidStudiensemester($studiensemester_kurzbz)) + $studiensemester_akt = $studiensemester_kurzbz; + else + $this->terminateWithError($this->p->t('lehre', 'error_noStudiensemester')); + } + + $this->load->model('codex/Oehbeitrag_model', 'OehbeitragModel'); + $oehBeitrag = $this->OehbeitragModel->getByStudiensemester($studiensemester_akt); + + $oehStandardbetrag = null; + if (hasData($oehBeitrag)) + { + $oeh = getData($oehBeitrag)[0]; + $summe = ($oeh->studierendenbeitrag + $oeh->versicherung) * -1; + $oehStandardbetrag = number_format((float)$summe, 2, '.', ''); + } + + if ($oehStandardbetrag !== null) + { + $data = array_map(function ($buchungstyp) use ($oehStandardbetrag) { + if (isset($buchungstyp->buchungstyp_kurzbz) && (strtolower($buchungstyp->buchungstyp_kurzbz) === 'oeh')) + { + $buchungstyp->standardbetrag = $oehStandardbetrag; + } + return $buchungstyp; + }, $data); + } + } } diff --git a/application/core/Notiz_Controller.php b/application/core/Notiz_Controller.php index 923970923..7269c3b09 100644 --- a/application/core/Notiz_Controller.php +++ b/application/core/Notiz_Controller.php @@ -417,6 +417,7 @@ abstract class Notiz_Controller extends FHCAPI_Controller $notiz_id = $this->input->post('notiz_id'); $this->NotizModel->addSelect('campus.tbl_dms_version.*'); + $this->NotizModel->addSelect($this->NotizModel->escape(base_url('content/notizdokdownload.php?id=')) . ' || public.tbl_notiz_dokument.dms_id AS preview'); $this->NotizModel->addJoin('public.tbl_notiz_dokument', 'ON (public.tbl_notiz_dokument.notiz_id = public.tbl_notiz.notiz_id)'); $this->NotizModel->addJoin('campus.tbl_dms_version', 'ON (public.tbl_notiz_dokument.dms_id = campus.tbl_dms_version.dms_id)'); diff --git a/application/libraries/vertragsbestandteil/AbstractBestandteil.php b/application/libraries/vertragsbestandteil/AbstractBestandteil.php index ccd05f5e2..4e1e8b9d0 100644 --- a/application/libraries/vertragsbestandteil/AbstractBestandteil.php +++ b/application/libraries/vertragsbestandteil/AbstractBestandteil.php @@ -40,7 +40,9 @@ abstract class AbstractBestandteil implements IValidation if( is_bool($new_value) && ($old_value !== $new_value) ) { $this->modifiedcolumns[$columnname] = $columnname; - } else if($old_value != $new_value) { + } else if(is_null($old_value) xor is_null($new_value)) { + $this->modifiedcolumns[$columnname] = $columnname; + } else if($old_value != $new_value) { $this->modifiedcolumns[$columnname] = $columnname; } } diff --git a/application/libraries/vertragsbestandteil/VertragsbestandteilLohnguide.php b/application/libraries/vertragsbestandteil/VertragsbestandteilLohnguide.php index 0e071f36b..71104fa91 100644 --- a/application/libraries/vertragsbestandteil/VertragsbestandteilLohnguide.php +++ b/application/libraries/vertragsbestandteil/VertragsbestandteilLohnguide.php @@ -137,19 +137,25 @@ EOTXT; return parent::__toString() . $txt; } - /* public function validate() + public function validate() { - if( !(filter_var($this->tage, FILTER_VALIDATE_INT, - array( - 'options' => array( - 'min_range' => 1, - 'max_range' => 50 - ) - ) - )) ) { - $this->validationerrors[] = 'Urlaubsanspruch muss eine Tagesanzahl im Bereich 1 bis 50 sein.'; + $value = $this->vordienstzeit; + + if ($value === null || $value === '') { + $result = null; // allow null value + } else { + $result = filter_var($value, FILTER_VALIDATE_INT, [ + 'options' => [ + 'min_range' => 0, + 'max_range' => 100 + ] + ]); + + if ($result === false) { + $this->validationerrors[] = 'Vordienstjahre muss eine ganze Zahl (0 bis 100) enthalten oder leer sein.'; + } } return parent::validate(); - } */ + } } diff --git a/application/views/system/infocenter/infocenterData.php b/application/views/system/infocenter/infocenterData.php index ebfd1db37..d1ce87422 100644 --- a/application/views/system/infocenter/infocenterData.php +++ b/application/views/system/infocenter/infocenterData.php @@ -315,22 +315,15 @@ WHERE tpl.app = '.$APP.' ) pl USING(person_id) LEFT JOIN ( - SELECT + SELECT DISTINCT ON (tbl_rueckstellung.person_id) tbl_rueckstellung.person_id, tbl_rueckstellung.datum_bis, tbl_rueckstellung.status_kurzbz, array_to_json(bezeichnung_mehrsprachig::varchar[])->>0 as bezeichnung FROM public.tbl_rueckstellung JOIN public.tbl_rueckstellung_status USING(status_kurzbz) - JOIN public.tbl_person sp ON tbl_rueckstellung.person_id = sp.person_id - WHERE tbl_rueckstellung.rueckstellung_id = - ( - SELECT srueck.rueckstellung_id - FROM public.tbl_rueckstellung srueck - WHERE srueck.person_id = tbl_rueckstellung.person_id - AND datum_bis >= NOW() - ORDER BY srueck.datum_bis DESC LIMIT 1 - ) + WHERE tbl_rueckstellung.datum_bis >= NOW() + ORDER BY tbl_rueckstellung.person_id, tbl_rueckstellung.datum_bis DESC ) rueck ON rueck.person_id = p.person_id WHERE EXISTS ( diff --git a/application/views/system/infocenter/onboardingData.php b/application/views/system/infocenter/onboardingData.php index 5ee66fdde..bf126f283 100644 --- a/application/views/system/infocenter/onboardingData.php +++ b/application/views/system/infocenter/onboardingData.php @@ -24,22 +24,15 @@ $query = ' WHERE tpl.app = '.$APP.' ) pl ON p.person_id = pl.person_id LEFT JOIN ( - SELECT + SELECT DISTINCT ON (tbl_rueckstellung.person_id) tbl_rueckstellung.person_id, tbl_rueckstellung.datum_bis, tbl_rueckstellung.status_kurzbz, array_to_json(bezeichnung_mehrsprachig::varchar[])->>0 as bezeichnung FROM public.tbl_rueckstellung - JOIN public.tbl_rueckstellung_status USING(status_kurzbz) - JOIN public.tbl_person sp ON tbl_rueckstellung.person_id = sp.person_id - WHERE tbl_rueckstellung.rueckstellung_id = - ( - SELECT srueck.rueckstellung_id - FROM public.tbl_rueckstellung srueck - WHERE srueck.person_id = tbl_rueckstellung.person_id - AND datum_bis >= NOW() - ORDER BY srueck.datum_bis DESC LIMIT 1 - ) + JOIN public.tbl_rueckstellung_status USING(status_kurzbz) + WHERE tbl_rueckstellung.datum_bis >= NOW() + ORDER BY tbl_rueckstellung.person_id, tbl_rueckstellung.datum_bis DESC ) rueck ON rueck.person_id = p.person_id WHERE p.person_id NOT IN (SELECT person_id FROM public.tbl_prestudent)'; diff --git a/cis/testtool/frage.php b/cis/testtool/frage.php index a5f4100c9..5a5aaaa18 100644 --- a/cis/testtool/frage.php +++ b/cis/testtool/frage.php @@ -80,9 +80,17 @@ echo ' + + +