diff --git a/application/controllers/api/v1/codex/Zgv.php b/application/controllers/api/v1/codex/Zgv.php index 3d1b64029..670ffc190 100644 --- a/application/controllers/api/v1/codex/Zgv.php +++ b/application/controllers/api/v1/codex/Zgv.php @@ -45,14 +45,6 @@ class Zgv extends API_Controller } } - /** - * @return zgv - */ - public function getAllZgv() - { - $this->response($this->Zgv_model->getAllZgv(), REST_Controller::HTTP_OK); - } - /** * @return void */ diff --git a/application/controllers/api/v1/codex/Zgvmaster.php b/application/controllers/api/v1/codex/Zgvmaster.php index 7775724c2..ff737dd7f 100644 --- a/application/controllers/api/v1/codex/Zgvmaster.php +++ b/application/controllers/api/v1/codex/Zgvmaster.php @@ -45,14 +45,6 @@ class Zgvmaster extends API_Controller } } - /** - * @return zgvmaster - */ - public function getAllZgvmaster() - { - $this->response($this->Zgvmaster_model->getAllZgvmaster(), REST_Controller::HTTP_OK); - } - /** * @return void */ diff --git a/application/controllers/organisation/Studiensemester.php b/application/controllers/organisation/Studiensemester.php index 10fa5b3ad..685c8cd7c 100644 --- a/application/controllers/organisation/Studiensemester.php +++ b/application/controllers/organisation/Studiensemester.php @@ -138,7 +138,7 @@ class Studiensemester extends Auth_Controller $start = $this->input->post("semstart"); $ende = $this->input->post("semende"); $studienjahr_kurzbz = $this->input->post("studienjahrkurzbz"); - $beschreibung = $this->input->post("beschreibung"); + $beschreibung = isEmptyString($this->input->post("beschreibung")) ? null : $this->input->post("beschreibung"); $onlinebewerbung = $this->input->post("onlinebewerbung"); $onlinebewerbung = isset($onlinebewerbung); diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index 42b9c3cfa..48c50bb4a 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -423,7 +423,7 @@ class InfoCenter extends Auth_Controller if (hasData($akte)) { $akte = getData($akte); - if ($akte->person_id === $person_id) + if ($akte->person_id === (int)$person_id) { $result = $this->aktelib->remove($akte_id); @@ -1987,11 +1987,23 @@ class InfoCenter extends Auth_Controller $studienArtBerechtigung = array_column($this->getStudienArtBerechtigung(), 'typ'); + $this->ZgvModel->addOrder('zgv_bez'); + $allZGVs = getData($this->ZgvModel->load()); + + $this->ZgvModel->addOrder('zgvmas_bez'); + $allZGVsMaster = getData($this->ZgvmasterModel->load()); + + $this->NationModel->addOrder('langtext'); + $allNations = getData($this->NationModel->load()); + $data = array ( 'zgvpruefungen' => $zgvpruefungen, 'abwstatusgruende' => $abwstatusgruende, 'intstatusgruende' => $intstatusgruende, - 'studienArtBerechtigung' => $studienArtBerechtigung + 'studienArtBerechtigung' => $studienArtBerechtigung, + 'all_zgvs' => $allZGVs, + 'all_zgvs_master' => $allZGVsMaster, + 'all_nations' => $allNations, ); return $data; diff --git a/application/libraries/FilterWidgetLib.php b/application/libraries/FilterWidgetLib.php index d9a3428a0..19cdec848 100644 --- a/application/libraries/FilterWidgetLib.php +++ b/application/libraries/FilterWidgetLib.php @@ -340,20 +340,25 @@ class FilterWidgetLib { $filterDefinition = $filters[$filtersCounter]; // definition of one filter - if ($filtersCounter > 0) - $where .= ' AND '; // if it's NOT the last one - - if (!isEmptyString($filterDefinition->name)) // if the name of the applied filter is valid + // If the name of the applied filter is valid + if (!isEmptyString($filterDefinition->name)) { - // ...build the condition - $where .= '"'.$filterDefinition->name.'"'.$this->_getDatasetQueryCondition($filterDefinition); + // Build the query conditions + $datasetQueryCondition = $this->_getDatasetQueryCondition($filterDefinition); + + // If the built condition is valid then add it to the query clause + if (!isEmptyString($datasetQueryCondition)) + { + // // If this is NOT the first one + if ($filtersCounter > 0) $where .= ' AND '; + + $where .= '"'.$filterDefinition->name.'"'.$datasetQueryCondition; + } } } - if ($where != '') // if the SQL where clause was built - { - $datasetQuery .= ' WHERE '.$where; - } + // If the SQL where clause was built + if ($where != '') $datasetQuery .= ' WHERE '.$where; } return $datasetQuery; diff --git a/application/models/CL/Messages_model.php b/application/models/CL/Messages_model.php index 4975af382..b987102dd 100644 --- a/application/models/CL/Messages_model.php +++ b/application/models/CL/Messages_model.php @@ -528,6 +528,13 @@ class Messages_model extends CI_Model */ public function sendReply($receiver_id, $subject, $body, $relationmessage_id, $token) { + // Checks that the receiver_id, relationmessage_id and token belongs to the same message + $crossedDataResult = $this->MessageTokenModel->crossClientData($token, $relationmessage_id, $receiver_id); + if (isError($crossedDataResult)) show_error(getError($crossedDataResult)); + if (!hasData($crossedDataResult)) show_error( + 'The parameters token, relationmessage_id and receiver_id do not belong to the same message' + ); + // Retrieves message sender information $senderResult = $this->MessageTokenModel->getSenderData($receiver_id); if (isError($senderResult)) show_error(getError($senderResult)); diff --git a/application/models/codex/Nation_model.php b/application/models/codex/Nation_model.php index a66b77edb..ee38c9051 100644 --- a/application/models/codex/Nation_model.php +++ b/application/models/codex/Nation_model.php @@ -11,14 +11,4 @@ class Nation_model extends DB_Model $this->dbTable = 'bis.tbl_nation'; $this->pk = 'nation_code'; } - - /** - * getAllForStyled Dropdown - */ - public function getAll() - { - $allNations = 'SELECT * FROM bis.tbl_nation ORDER BY bis.tbl_nation.langtext ASC;'; - - return $this->execQuery($allNations); - } } diff --git a/application/models/codex/Zgv_model.php b/application/models/codex/Zgv_model.php index 0206d1292..1e1ba99ad 100644 --- a/application/models/codex/Zgv_model.php +++ b/application/models/codex/Zgv_model.php @@ -11,16 +11,4 @@ class Zgv_model extends DB_Model $this->dbTable = 'bis.tbl_zgv'; $this->pk = 'zgv_code'; } - - /** - * getAllForStyled Dropdown - */ - public function getAllZgv() - { - $allZgv = 'SELECT * FROM bis.tbl_zgv ORDER BY zgv_bez ASC;'; - - return $this->execQuery($allZgv); - } - - } diff --git a/application/models/codex/Zgvmaster_model.php b/application/models/codex/Zgvmaster_model.php index 0f6305532..38f8a0dcb 100644 --- a/application/models/codex/Zgvmaster_model.php +++ b/application/models/codex/Zgvmaster_model.php @@ -11,14 +11,4 @@ class Zgvmaster_model extends DB_Model $this->dbTable = 'bis.tbl_zgvmaster'; $this->pk = 'zgvmas_code'; } - - /** - * getAllForStyled Dropdown - */ - public function getAllZgvmaster() - { - $allZgvMaster = 'SELECT * FROM bis.tbl_zgvmaster ORDER BY zgvmas_bez ASC;'; - - return $this->execQuery($allZgvMaster); - } } diff --git a/application/models/system/MessageToken_model.php b/application/models/system/MessageToken_model.php index cd3d8f7d9..af7794fdb 100644 --- a/application/models/system/MessageToken_model.php +++ b/application/models/system/MessageToken_model.php @@ -176,4 +176,20 @@ class MessageToken_model extends DB_Model return $this->execQuery($sql, array($oe_kurzbz)); } + + /** + * + */ + public function crossClientData($token, $relationmessage_id, $receiver_id) + { + $sql = 'SELECT mm.message_id + FROM public.tbl_msg_message mm + JOIN public.tbl_msg_recipient mr USING(message_id) + WHERE mr.token = ? + AND mm.message_id = ? + AND mm.person_id = ?'; + + return $this->execQuery($sql, array($token, $relationmessage_id, $receiver_id)); + } } + diff --git a/application/views/system/infocenter/zgvpruefungen.php b/application/views/system/infocenter/zgvpruefungen.php index f6e8a845b..2e6ea90d2 100644 --- a/application/views/system/infocenter/zgvpruefungen.php +++ b/application/views/system/infocenter/zgvpruefungen.php @@ -222,12 +222,25 @@ p->t('infocenter', 'zgv') ?> - widgetlib->widget( - 'Zgv_widget', - array(DropdownWidget::SELECTED_ELEMENT => $zgvpruefung->zgv_code), - array('name' => 'zgv', 'id' => 'zgv_'.$zgvpruefung->prestudent_id) - ); ?> + prestudent_id . "' name='zgv' class='form-control'>"; + $selectedDefault = (is_null($zgvpruefung->zgv_code) ? 'selected' : ''); + echo ""; + foreach ($all_zgvs as $zgv) + { + $selected = ($zgvpruefung->zgv_code === $zgv->zgv_code) ? 'selected' : ''; + $aktiv = ''; + $class = ''; + if (!$zgv->aktiv) + { + $aktiv = '(inaktiv)'; + $class = 'gesperrtoption'; + } + + echo ""; + } + echo ""; + endif;?>