diff --git a/application/controllers/api/frontend/v1/stv/Konto.php b/application/controllers/api/frontend/v1/stv/Konto.php
index 7c242b2e2..12892d2f7 100644
--- a/application/controllers/api/frontend/v1/stv/Konto.php
+++ b/application/controllers/api/frontend/v1/stv/Konto.php
@@ -16,7 +16,9 @@
* along with this program. If not, see .
*/
-if (! defined('BASEPATH')) exit('No direct script access allowed');
+if (!defined('BASEPATH')) exit('No direct script access allowed');
+
+use CI3_Events as Events;
/**
* This controller operates between (interface) the JS (GUI) and the back-end
@@ -33,7 +35,11 @@ class Konto extends FHCAPI_Controller
{
// TODO(chris): permissions
parent::__construct([
- 'get' => 'student/stammdaten:r'
+ 'get' => 'student/stammdaten:r',
+ 'getBuchungstypen' => 'student/stammdaten:r', // alle?
+ 'checkDoubles' => ['admin:r', 'assistenz:r'],
+ 'insert' => ['admin:w', 'assistenz:w'],
+ 'update' => ['admin:w', 'assistenz:w']
]);
// Load models
@@ -51,15 +57,21 @@ class Konto extends FHCAPI_Controller
/**
* Get details for a prestudent
*
- * @param string $type
- * @param string (optional) $studiengang_kz
* @return void
*/
- public function get($type, $studiengang_kz = '')
+ public function get()
{
- // TODO(chris): validation
+ $this->load->library('form_validation');
$person_id = $this->input->post('person_id');
+ if (!$person_id || !is_array($person_id))
+ $this->form_validation->set_rules('person_id', 'Person ID', 'required');
+
+ if (!$this->form_validation->run())
+ $this->terminateWithValidationErrors($this->form_validation->error_array());
+
+
+ $studiengang_kz = $this->input->post('studiengang_kz');
if ($this->input->post('only_open')) {
$result = $this->KontoModel->getOffeneBuchungen($person_id, $studiengang_kz);
@@ -95,4 +107,224 @@ class Konto extends FHCAPI_Controller
$this->terminateWithSuccess(array_values($data));
}
+
+ /**
+ * Get list of Buchungstypen
+ *
+ * @return void
+ */
+ public function getBuchungstypen()
+ {
+ $this->load->model('crm/Buchungstyp_model', 'BuchungstypModel');
+
+ $result = $this->BuchungstypModel->load();
+
+ #$data = $this->getDataOrTerminateWithError($result);
+ if (isError($result))
+ $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
+ $data = $result->retval;
+
+ $this->terminateWithSuccess($data);
+ }
+
+ /**
+ * Check double Buchungen
+ *
+ * @return void
+ */
+ public function checkDoubles()
+ {
+ if (!defined('FAS_DOPPELTE_BUCHUNGSTYPEN_CHECK') || !FAS_DOPPELTE_BUCHUNGSTYPEN_CHECK)
+ $this->terminateWithSuccess(false);
+
+ $this->load->library('form_validation');
+
+ $person_ids = $this->input->post('person_id');
+
+ if (!$person_ids || !is_array($person_ids)) {
+ $person_ids = [$person_ids];
+ $this->form_validation->set_rules('person_id', 'Person ID', 'required');
+ }
+ $this->form_validation->set_rules('studiensemester_kurzbz', 'Studiensemester', 'required');
+ $this->form_validation->set_rules('buchungstyp_kurzbz', 'Buchungstyp', 'required');
+
+ if (!$this->form_validation->run())
+ $this->terminateWithValidationErrors($this->form_validation->error_array());
+
+
+ $buchungstypen = unserialize(FAS_DOPPELTE_BUCHUNGSTYPEN_CHECK);
+ $buchung = $this->input->post('buchungstyp_kurzbz');
+
+ if (!isset($buchungstypen[$buchung]))
+ $this->terminateWithSuccess(false);
+
+ $result = $this->KontoModel->checkDoubleBuchung($person_ids, $this->input->post('studiensemester_kurzbz'), $buchungstypen[$buchung]);
+
+ #$result = $this->getDataOrTerminateWithError($result);
+ if (isError($result))
+ $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
+ $result = $result->retval;
+
+ if (!$result)
+ $this->terminateWithSuccess(false);
+
+ $persons = array_map(function ($row) {
+ return $row->nachname . ' ' . $row->vorname;
+ }, $result);
+
+ // TODO(chris): Phrases
+ $result = $this->p->t('konto', 'buchung_vorhanden') . "\n";
+ if (count($persons) > 10) {
+ $result .= "-" . implode("\n-", array_slice($persons, 0, 10)) . "\n";
+
+ if (count($persons) == 11) {
+ $result .= "\n" . $this->p->t('konto', 'and_1_additional_person');
+ } else {
+ $result .= "\n" . $this->p->t('konto', 'and_x_additional_person', [
+ 'x' => count($persons) - 10
+ ]);
+ }
+ } else {
+ $result .= "-" . implode("\n-", $persons) . "\n";
+ }
+ $result .= $this->p->t('konto', 'proceed');
+
+ $this->addError($result, 'confirm');
+
+ $this->terminateWithSuccess(true);
+ }
+
+
+ /**
+ * Save Buchung
+ *
+ * @return void
+ */
+ public function insert()
+ {
+ $this->load->library('form_validation');
+
+ $person_ids = $this->input->post('person_id');
+
+ if (!$person_ids || !is_array($person_ids)) {
+ $person_ids = [$person_ids];
+ $this->form_validation->set_rules('person_id', 'Person ID', 'required');
+ }
+ $this->form_validation->set_rules('betrag', 'Betrag', 'numeric');
+ $this->form_validation->set_rules('buchungsdatum', 'Buchungsdatum', 'is_valid_date');
+ $this->form_validation->set_rules('buchungstext', 'Buchungstext', 'max_length[256]');
+ $this->form_validation->set_rules('mahnspanne', 'Mahnspanne', 'integer');
+ $this->form_validation->set_rules('buchungstyp_kurzbz', 'Buchungstyp', 'required|max_length[32]');
+ $this->form_validation->set_rules('studiensemester_kurzbz', 'Studiensemester', 'required|max_length[16]');
+ $this->form_validation->set_rules('studiengang_kz', 'Studiengang', 'required|has_permissions_for_stg[admin:rw,assistenz:rw]');
+ $this->form_validation->set_rules('credit_points', 'Credit Points', 'numeric');
+
+ Events::trigger('konto_insert_validation', $this->form_validation);
+
+ if (!$this->form_validation->run())
+ $this->terminateWithValidationErrors($this->form_validation->error_array());
+
+
+ $allowed = [
+ 'betrag',
+ 'buchungsdatum',
+ 'buchungstext',
+ 'mahnspanne',
+ 'buchungstyp_kurzbz',
+ 'studiensemester_kurzbz',
+ 'studiengang_kz',
+ 'credit_points',
+ 'anmerkung'
+ ];
+ $data = [
+ 'updateamum' => date('c'),
+ 'updatevon' => getAuthUID()
+ ];
+ foreach ($allowed as $field)
+ if ($this->input->post($field) !== null)
+ $data[$field] = $this->input->post($field);
+
+ if (defined('FAS_BUCHUNGSTYP_FIXE_KOSTENSTELLE') && isset(unserialize(FAS_BUCHUNGSTYP_FIXE_KOSTENSTELLE)[$data['buchungstyp_kurzbz']])) {
+ $data['kostenstelle'] = unserialize(FAS_BUCHUNGSTYP_FIXE_KOSTENSTELLE)[$data['buchungstyp_kurzbz']];
+ }
+
+ $result = [];
+ foreach ($person_ids as $person_id) {
+ $id = $this->KontoModel->insert(array_merge($data, ['person_id' => $person_id]));
+ if (isError($id))
+ $this->addError(getError($id), self::ERROR_TYPE_GENERAL);
+ else {
+ $data = $this->KontoModel->withAdditionalInfo()->load(getData($id));
+ if (isError($data))
+ $this->addError(getError($data), self::ERROR_TYPE_GENERAL);
+ else
+ $result[] = getData($data);
+ }
+ }
+
+ if ($result)
+ $this->terminateWithSuccess($result);
+ // NOTE(chris): else there should already be error in the return object
+ }
+
+ /**
+ * Save Buchung
+ *
+ * @return void
+ */
+ public function update()
+ {
+ $this->load->library('form_validation');
+
+ $this->form_validation->set_rules('buchungsnr', 'Buchungsnr', 'required');
+ $this->form_validation->set_rules('betrag', 'Betrag', 'numeric');
+ $this->form_validation->set_rules('buchungsdatum', 'Buchungsdatum', 'is_valid_date');
+ $this->form_validation->set_rules('buchungstext', 'Buchungstext', 'max_length[256]');
+ $this->form_validation->set_rules('mahnspanne', 'Mahnspanne', 'integer');
+ $this->form_validation->set_rules('buchungstyp_kurzbz', 'Buchungstyp', 'required|max_length[32]');
+ $this->form_validation->set_rules('studiensemester_kurzbz', 'Studiensemester', 'required|max_length[16]');
+ $this->form_validation->set_rules('studiengang_kz', 'Studiengang', 'required|has_permissions_for_stg[admin:rw,assistenz:rw]');
+ $this->form_validation->set_rules('credit_points', 'Credit Points', 'numeric');
+
+ Events::trigger('konto_update_validation', $this->form_validation);
+
+ if (!$this->form_validation->run())
+ $this->terminateWithValidationErrors($this->form_validation->error_array());
+
+
+ $id = $this->input->post('buchungsnr');
+ $allowed = [
+ 'betrag',
+ 'buchungsdatum',
+ 'buchungstext',
+ 'mahnspanne',
+ 'buchungstyp_kurzbz',
+ 'studiensemester_kurzbz',
+ 'studiengang_kz',
+ 'credit_points',
+ 'anmerkung'
+ ];
+ $data = [
+ 'updateamum' => date('c'),
+ 'updatevon' => getAuthUID()
+ ];
+ foreach ($allowed as $field)
+ if ($this->input->post($field) !== null)
+ $data[$field] = $this->input->post($field);
+
+ $result = $this->KontoModel->update($id, $data);
+
+ #$this->getDataOrTerminateWithError($result);
+ if (isError($result))
+ $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
+
+ $result = $this->KontoModel->withAdditionalInfo()->load($id);
+
+ #$result = $this->getDataOrTerminateWithError($result);
+ if (isError($result))
+ $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
+ $result = $result->retval;
+
+ $this->terminateWithSuccess($result);
+ }
}
diff --git a/application/controllers/api/frontend/v1/stv/Lists.php b/application/controllers/api/frontend/v1/stv/Lists.php
new file mode 100644
index 000000000..2a8335b7e
--- /dev/null
+++ b/application/controllers/api/frontend/v1/stv/Lists.php
@@ -0,0 +1,72 @@
+.
+ */
+
+if (! defined('BASEPATH')) exit('No direct script access allowed');
+
+/**
+ * This controller operates between (interface) the JS (GUI) and the back-end
+ * Provides data to the ajax get calls about generally used lists
+ * This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
+ */
+class Lists extends FHCAPI_Controller
+{
+ public function __construct()
+ {
+ // TODO(chris): permissions
+ parent::__construct([
+ 'getStudiensemester' => ['admin:r', 'assistenz:r', 'student/stammdaten:r'], // alle?
+ 'getStgs' => ['admin:r', 'assistenz:r', 'student/stammdaten:r'] // alle?
+ ]);
+ }
+
+ public function getStudiensemester()
+ {
+ $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
+
+ $this->StudiensemesterModel->addOrder('ende');
+
+ $result = $this->StudiensemesterModel->load();
+
+ #$data = $this->getDataOrTerminateWithError($result);
+ if (isError($result))
+ $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
+ $data = $result->retval;
+
+ $this->terminateWithSuccess($data);
+ }
+
+ public function getStgs()
+ {
+ $this->load->model('organisation/Studiengang_model', 'StudiengangModel');
+
+ $this->StudiengangModel->addSelect('*');
+ $this->StudiengangModel->addSelect('UPPER(typ || kurzbz) AS kuerzel');
+
+ $this->StudiengangModel->addOrder('typ');
+ $this->StudiengangModel->addOrder('kurzbz');
+
+ $result = $this->StudiengangModel->load();
+
+ #$data = $this->getDataOrTerminateWithError($result);
+ if (isError($result))
+ $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
+ $data = $result->retval;
+
+ $this->terminateWithSuccess($data);
+ }
+}
diff --git a/application/controllers/components/stv/Config.php b/application/controllers/components/stv/Config.php
index e9ed7ec44..78089d519 100644
--- a/application/controllers/components/stv/Config.php
+++ b/application/controllers/components/stv/Config.php
@@ -6,10 +6,15 @@ use CI3_Events as Events;
class Config extends FHC_Controller
{
+
+
public function __construct()
{
// TODO(chris): access!
parent::__construct();
+
+ $this->load->library('AuthLib');
+ $this->load->library('PermissionLib');
}
public function student()
@@ -39,7 +44,13 @@ class Config extends FHC_Controller
$result['konto'] = [
'title' => 'Konto',
'component' => './Stv/Studentenverwaltung/Details/Konto.js',
- 'config' => ['ZAHLUNGSBESTAETIGUNG_ANZEIGEN' => (defined('ZAHLUNGSBESTAETIGUNG_ANZEIGEN') && ZAHLUNGSBESTAETIGUNG_ANZEIGEN)]
+ 'config' => [
+ 'showZahlungsbestaetigung' => (defined('ZAHLUNGSBESTAETIGUNG_ANZEIGEN') && ZAHLUNGSBESTAETIGUNG_ANZEIGEN),
+ 'showBuchungsnr' => $this->permissionlib->isBerechtigt('admin'),
+ 'showMahnspanne' => (!defined('FAS_KONTO_SHOW_MAHNSPANNE') || FAS_KONTO_SHOW_MAHNSPANNE===true),
+ 'showCreditpoints' => (defined('FAS_KONTO_SHOW_CREDIT_POINTS') && FAS_KONTO_SHOW_CREDIT_POINTS == 'true'),
+ 'additionalCols' => []
+ ]
];
$result['betriebsmittel'] = [
'title' => 'Betriebsmittel',
@@ -64,7 +75,13 @@ class Config extends FHC_Controller
$result['konto'] = [
'title' => 'Konto',
'component' => './Stv/Studentenverwaltung/Details/Konto.js',
- 'config' => ['ZAHLUNGSBESTAETIGUNG_ANZEIGEN' => (defined('ZAHLUNGSBESTAETIGUNG_ANZEIGEN') && ZAHLUNGSBESTAETIGUNG_ANZEIGEN)]
+ 'config' => [
+ 'showZahlungsbestaetigung' => (defined('ZAHLUNGSBESTAETIGUNG_ANZEIGEN') && ZAHLUNGSBESTAETIGUNG_ANZEIGEN),
+ 'showBuchungsnr' => $this->permissionlib->isBerechtigt('admin'),
+ 'showMahnspanne' => (!defined('FAS_KONTO_SHOW_MAHNSPANNE') || FAS_KONTO_SHOW_MAHNSPANNE===true),
+ 'showCreditpoints' => (defined('FAS_KONTO_SHOW_CREDIT_POINTS') && FAS_KONTO_SHOW_CREDIT_POINTS == 'true'),
+ 'additionalCols' => []
+ ]
];
Events::trigger('stv_conf_students', function & () use (&$result) {
diff --git a/application/controllers/components/stv/Students.php b/application/controllers/components/stv/Students.php
index 3d22075cc..9bd2df73f 100644
--- a/application/controllers/components/stv/Students.php
+++ b/application/controllers/components/stv/Students.php
@@ -38,7 +38,8 @@ class Students extends FHC_Controller
* /(studiengang_kz)/(org_form)/(semester)/(verband)/(gruppe)
* => getStudents
* /uid/(student_uid) => getStudent
- * /prestudent/(prestudent_id) => getPrestudent
+ * /prestudent/(prestudent_id) => getPrestudent
+ * /person/(person_id) => getPerson
*
* @param string $method
* @param array $params (optional)
@@ -75,6 +76,9 @@ class Students extends FHC_Controller
if ($method == 'prestudent' && $count == 1)
return $this->getPrestudent($params[0]);
+ if ($method == 'person' && $count == 1)
+ return $this->getPerson($params[0]);
+
if (is_numeric($params[0])) {
$sem = $params[0];
if ($count == 3 && $params[1] == 'grp') {
@@ -577,4 +581,77 @@ class Students extends FHC_Controller
$this->outputJson(getData($result) ?: []);
}
}
+
+ /**
+ * @param integer $person_id
+ *
+ * @return void
+ */
+ protected function getPerson($person_id)
+ {
+ $studiensemester_kurzbz = $this->variablelib->getVar('semester_aktuell');
+
+ $this->load->model('crm/Prestudent_model', 'PrestudentModel');
+
+ $this->PrestudentModel->addJoin('public.tbl_person p', 'person_id');
+ $this->PrestudentModel->addJoin('public.tbl_student s', 'prestudent_id');
+ $this->PrestudentModel->addJoin('public.tbl_benutzer b', 's.student_uid=b.uid');
+ $this->PrestudentModel->addJoin(
+ 'public.tbl_studentlehrverband v',
+ 'v.student_uid=s.student_uid AND v.studiensemester_kurzbz=' . $this->PrestudentModel->escape($studiensemester_kurzbz),
+ 'LEFT'
+ );
+
+ $this->PrestudentModel->addSelect('p.person_id');
+ $this->PrestudentModel->addSelect('s.prestudent_id');
+ $this->PrestudentModel->addSelect('b.uid');
+ $this->PrestudentModel->addSelect('titelpre');
+ $this->PrestudentModel->addSelect('titelpost');
+ $this->PrestudentModel->addSelect('vorname');
+ $this->PrestudentModel->addSelect('wahlname');
+ $this->PrestudentModel->addSelect('vornamen');
+ $this->PrestudentModel->addSelect('geschlecht');
+ $this->PrestudentModel->addSelect('nachname');
+ $this->PrestudentModel->addSelect('gebdatum');
+ $this->PrestudentModel->addSelect('tbl_prestudent.anmerkung');
+ $this->PrestudentModel->addSelect('ersatzkennzeichen');
+ $this->PrestudentModel->addSelect('svnr');
+ $this->PrestudentModel->addSelect('s.matrikelnr');
+ $this->PrestudentModel->addSelect('p.anmerkung AS anmerkungen');
+ $this->PrestudentModel->addSelect('v.semester');
+ $this->PrestudentModel->addSelect('v.verband');
+ $this->PrestudentModel->addSelect('v.gruppe');
+ $this->PrestudentModel->addSelect('tbl_prestudent.studiengang_kz');
+ $this->PrestudentModel->addSelect('aufmerksamdurch_kurzbz');
+ $this->PrestudentModel->addSelect('mentor');
+ $this->PrestudentModel->addSelect('b.aktiv AS bnaktiv');
+ $this->PrestudentModel->addSelect(
+ "(SELECT kontakt FROM public.tbl_kontakt WHERE kontakttyp='email' AND person_id=p.person_id AND zustellung LIMIT 1) AS email_privat",
+ false
+ );
+ $this->PrestudentModel->addSelect(
+ "(SELECT rt_gesamtpunkte AS punkte FROM public.tbl_prestudent WHERE prestudent_id=s.prestudent_id) AS punkte",
+ false
+ );
+ $this->PrestudentModel->addSelect('tbl_prestudent.dual');
+ $this->PrestudentModel->addSelect('tbl_prestudent.reihungstest_id');
+ $this->PrestudentModel->addSelect('tbl_prestudent.anmeldungreihungstest');
+ $this->PrestudentModel->addSelect('p.matr_nr');
+ $this->PrestudentModel->addSelect('tbl_prestudent.gsstudientyp_kurzbz');
+ $this->PrestudentModel->addSelect('tbl_prestudent.aufnahmegruppe_kurzbz');
+ $this->PrestudentModel->addSelect('tbl_prestudent.priorisierung');
+ $this->PrestudentModel->addSelect('p.zugangscode');
+ $this->PrestudentModel->addSelect('p.bpk');
+
+ $result = $this->PrestudentModel->loadWhere([
+ 'p.person_id' => $person_id
+ ]);
+
+ if (isError($result)) {
+ $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
+ $this->outputJson(getError($result));
+ } else {
+ $this->outputJson(getData($result) ?: []);
+ }
+ }
}
diff --git a/application/helpers/hlp_common_helper.php b/application/helpers/hlp_common_helper.php
index 688fae965..40aed007c 100644
--- a/application/helpers/hlp_common_helper.php
+++ b/application/helpers/hlp_common_helper.php
@@ -449,14 +449,52 @@ function is_valid_date($dateString)
function has_write_permissions($value, $permissions = '')
{
if (!$permissions)
- $permissions = $value; // TODO(chris): ??
+ $permissions = $value;
$permissions = explode(',', $permissions);
$CI =& get_instance();
+ $CI->load->library('AuthLib');
$CI->load->library('PermissionLib');
+
return $CI->permissionlib->hasAtLeastOne(
$permissions,
'sometable',
- 'w'
+ 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
index 9e942f8e5..b8918a721 100644
--- a/application/language/english/form_validation_lang.php
+++ b/application/language/english/form_validation_lang.php
@@ -36,7 +36,8 @@
* @since Version 1.0.0
* @filesource
*/
-defined('BASEPATH') OR exit('No direct script access allowed');
+if (!defined('BASEPATH')) exit('No direct script access allowed');
$lang['form_validation_has_write_permissions'] = 'You have no rights to edit {field} field.';
-$lang['form_validation_is_valid_date'] = 'The date format is invalid or out of range.';
\ No newline at end of file
+$lang['form_validation_is_valid_date'] = 'The date format is invalid or out of range.';
+$lang['form_validation_has_permissions_for_stg'] = 'You have no rights for stg {field}.';
diff --git a/application/models/crm/Konto_model.php b/application/models/crm/Konto_model.php
index 00a621d0e..77ae04990 100644
--- a/application/models/crm/Konto_model.php
+++ b/application/models/crm/Konto_model.php
@@ -1,4 +1,7 @@
addSelect($this->dbTable . '.*');
$this->addSelect('UPPER(typ::varchar(1) || kurzbz) AS kuerzel');
@@ -35,6 +35,23 @@ class Konto_model extends DB_Model
$this->addJoin('public.tbl_studiengang stg', 'studiengang_kz', 'LEFT');
$this->addJoin('public.tbl_person person', 'person_id', 'LEFT');
+ Events::trigger('konto_query');
+
+ return $this;
+ }
+
+ /**
+ * Get all accounting entries for a person optionally filtered by Studiengang
+ *
+ * @param integer|array $person_id
+ * @param string (optional) $studiengang_kz
+ *
+ * @return stdClass
+ */
+ public function getAlleBuchungen($person_id, $studiengang_kz = '')
+ {
+ $this->withAdditionalInfo();
+
$this->addOrder('buchungsdatum');
if (is_array($person_id))
@@ -79,6 +96,34 @@ class Konto_model extends DB_Model
return $this->getAlleBuchungen($person_id, $studiengang_kz);
}
+ /**
+ * Check double Buchungen
+ *
+ * @param array $person_ids
+ * @param string $studiensemester_kurzbz
+ * @param array $buchungstyp_kurzbzs
+ *
+ * @return stdClass
+ */
+ public function checkDoubleBuchung($person_ids, $studiensemester_kurzbz, $buchungstyp_kurzbzs)
+ {
+ $this->addSelect('vorname');
+ $this->addSelect('nachname');
+
+ $this->addJoin('public.tbl_person', 'person_id');
+
+ $this->db->where_in('person_id', $person_ids);
+ $this->db->where_in('buchungstyp_kurzbz', $buchungstyp_kurzbzs);
+
+ $this->addGroupBy('vorname, nachname');
+ $this->addOrder('nachname');
+ $this->addOrder('vorname');
+
+ return $this->loadWhere([
+ 'studiensemester_kurzbz' => $studiensemester_kurzbz
+ ]);
+ }
+
/**
* Sets a Payment as paid
*/
diff --git a/public/css/Studentenverwaltung.css b/public/css/Studentenverwaltung.css
index f77988451..d29455097 100644
--- a/public/css/Studentenverwaltung.css
+++ b/public/css/Studentenverwaltung.css
@@ -24,15 +24,15 @@ html {
border-radius: 0!important;
}
-#main {
+.stv {
display: flex;
flex-direction: column;
height: 100vh;
}
-#main > header {
+.stv > header {
flex: 0 0 auto;
}
-#main > div {
+.stv > div {
flex: 1 1 auto;
}
diff --git a/public/js/api/stv.js b/public/js/api/stv.js
new file mode 100644
index 000000000..2a84ab0b7
--- /dev/null
+++ b/public/js/api/stv.js
@@ -0,0 +1,5 @@
+import konto from './stv/konto.js';
+
+export default {
+ konto
+};
\ No newline at end of file
diff --git a/public/js/api/stv/konto.js b/public/js/api/stv/konto.js
new file mode 100644
index 000000000..0e4069f2c
--- /dev/null
+++ b/public/js/api/stv/konto.js
@@ -0,0 +1,31 @@
+export default {
+ tabulatorConfig(config, self) {
+ config.ajaxURL = 'api/frontend/v1/stv/konto/get';
+ config.ajaxParams = () => {
+ const params = {
+ person_id: self.modelValue.person_id || self.modelValue.map(e => e.person_id),
+ only_open: self.filter,
+ studiengang_kz: self.studiengang_kz_intern ? self.stg_kz : ''
+ };
+ return params;
+ };
+ config.ajaxRequestFunc = (url, config, params) => this.$fhcApi.post(url, params, config);
+ config.ajaxResponse = (url, params, response) => response.data;
+
+ return config;
+ },
+ checkDoubles(data) {
+ return this.$fhcApi.post('api/frontend/v1/stv/konto/checkDoubles', data, {
+ confirmErrorHandler: error => true
+ });
+ },
+ insert(data) {
+ return this.$fhcApi.post('api/frontend/v1/stv/konto/insert', data);
+ },
+ edit(data) {
+ return this.$fhcApi.post('api/frontend/v1/stv/konto/update', data);
+ },
+ getBuchungstypen() {
+ return this.$fhcApi.get('api/frontend/v1/stv/konto/getBuchungstypen');
+ }
+};
\ No newline at end of file
diff --git a/public/js/apps/Studentenverwaltung.js b/public/js/apps/Studentenverwaltung.js
index dc3e7522b..a282a45e3 100644
--- a/public/js/apps/Studentenverwaltung.js
+++ b/public/js/apps/Studentenverwaltung.js
@@ -34,7 +34,8 @@ import(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_route
{ path: `/${ciPath}/studentenverwaltung`, component: FhcStudentenverwaltung },
{ path: `/${ciPath}/studentenverwaltung/prestudent/:prestudent_id`, component: FhcStudentenverwaltung },
{ path: `/${ciPath}/studentenverwaltung/prestudent/:prestudent_id/:tab`, component: FhcStudentenverwaltung },
- { path: `/${ciPath}/studentenverwaltung/student/:id`, component: FhcStudentenverwaltung }
+ { path: `/${ciPath}/studentenverwaltung/student/:id`, component: FhcStudentenverwaltung },
+ { path: `/${ciPath}/studentenverwaltung/person/:person_id`, component: FhcStudentenverwaltung }
]
});
diff --git a/public/js/components/Bootstrap/Modal.js b/public/js/components/Bootstrap/Modal.js
index 453cc0b48..831a8929c 100644
--- a/public/js/components/Bootstrap/Modal.js
+++ b/public/js/components/Bootstrap/Modal.js
@@ -93,7 +93,7 @@ export default {
document.body.appendChild(wrapper);
});
},
- template: `