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/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/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/config/global.config-default.inc.php b/config/global.config-default.inc.php
index d12b23828..b945a15d2 100644
--- a/config/global.config-default.inc.php
+++ b/config/global.config-default.inc.php
@@ -332,4 +332,6 @@ define('DOCSBOX_ENABLED', false);
// (true | false)
define('DIENSTVERHAELTNIS_SUPPORT', false);
+// Falls Studstatus (Abmeldung, AbmeldungStg, Unterbrechung, Wiederholung) verwendet wird zeige Hinweistext bei Eingabe einer kommissionellen oder zusaetzlichen kommissionellen Pruefung
+define('FAS_STUDSTATUS_SHOW_KOMM_PRFG_HINT', false);
?>
diff --git a/content/student/studentoverlay.js.php b/content/student/studentoverlay.js.php
index 8be20d32d..d2030f493 100644
--- a/content/student/studentoverlay.js.php
+++ b/content/student/studentoverlay.js.php
@@ -5139,6 +5139,7 @@ function StudentPruefungNeu()
document.getElementById('student-pruefung-menulist-note').value='9';
document.getElementById('student-pruefung-textbox-datum').value='';
document.getElementById('student-pruefung-textbox-anmerkung').value='';
+ StudentPruefungTypChange();
}
// ****
@@ -5190,6 +5191,17 @@ function StudentPruefungLVAChange()
LEDropDown.selectedIndex=-1;
}
+// ****
+// * Wenn der Typ der Pruefung geaendert wird, dann wird ein Hinweistext angezeigt.
+// ****
+function StudentPruefungTypChange()
+{
+ var typ = document.getElementById('student-pruefung-menulist-typ').value;
+ var hinweisid = document.getElementById('student-pruefung-textbox-datum-hinweis');
+ if(hinweisid === null) return;
+ hinweisid.hidden = (typ != 'kommPruef' && typ != 'zusKommPruef');
+}
+
// ****
// * Speichert die Pruefung
// ****
@@ -5424,6 +5436,7 @@ function StudentPruefungAuswahl()
document.getElementById('student-pruefung-checkbox-neu').checked=false;
document.getElementById('student-pruefung-textbox-pruefung_id').value=pruefung_id;
document.getElementById('student-pruefung-textbox-punkte').value=punkte;
+ StudentPruefungTypChange();
}
function StudentPruefungFilterStsem()
diff --git a/content/student/studentpruefungoverlay.xul.php b/content/student/studentpruefungoverlay.xul.php
index 2c2a3970a..b1fa4c325 100644
--- a/content/student/studentpruefungoverlay.xul.php
+++ b/content/student/studentpruefungoverlay.xul.php
@@ -34,6 +34,11 @@ if(defined('CIS_GESAMTNOTE_PUNKTE') && CIS_GESAMTNOTE_PUNKTE)
else
$punktehidden = 'true';
+if(defined('FAS_STUDSTATUS_SHOW_KOMM_PRFG_HINT') && FAS_STUDSTATUS_SHOW_KOMM_PRFG_HINT)
+ $show_komm_prfg_hint = true;
+else
+ $show_komm_prfg_hint = false;
+
echo '';
?>
@@ -203,7 +208,8 @@ echo '';