From efcef48f89495172093bccee2a4940b967022f58 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 9 May 2022 11:14:01 +0200 Subject: [PATCH 001/335] Changed Sanchomail 'From' to noreply --- application/helpers/hlp_sancho_helper.php | 2 +- include/sancho.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/helpers/hlp_sancho_helper.php b/application/helpers/hlp_sancho_helper.php index d599e40bc..e57802432 100644 --- a/application/helpers/hlp_sancho_helper.php +++ b/application/helpers/hlp_sancho_helper.php @@ -49,7 +49,7 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm if ($from == '') { - $from = 'sancho@'.DOMAIN; + $from = 'noreply@'.DOMAIN; } // Embed sancho header and footer image diff --git a/include/sancho.inc.php b/include/sancho.inc.php index 5fc6fcdab..0d5c8e8a4 100644 --- a/include/sancho.inc.php +++ b/include/sancho.inc.php @@ -40,7 +40,7 @@ const DEFAULT_SANCHO_FOOTER_IMG = 'sancho_footer_DEFAULT.jpg'; */ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerImg = DEFAULT_SANCHO_HEADER_IMG, $footerImg = DEFAULT_SANCHO_FOOTER_IMG, $replyTo = '', $cc = '') { - $from = 'sancho@'. DOMAIN; + $from = 'noreply@'. DOMAIN; $sanchoHeader_img = dirname(__FILE__). '/../skin/images/sancho/'. $headerImg; $sanchoFooter_img = dirname(__FILE__). '/../skin/images/sancho/'. $footerImg; From c39174980cd78bb6e44a273696dc886c141ac14e Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 9 May 2022 15:34:22 +0200 Subject: [PATCH 002/335] Fixed function _getSTGLMailAddress to return same array structure Different structure was causing errors in handling. --- application/controllers/jobs/AnrechnungJob.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/application/controllers/jobs/AnrechnungJob.php b/application/controllers/jobs/AnrechnungJob.php index f32a8268a..4c341af50 100644 --- a/application/controllers/jobs/AnrechnungJob.php +++ b/application/controllers/jobs/AnrechnungJob.php @@ -358,8 +358,6 @@ html; 'vorname' => $stgl->vorname ); } - - return $stglMailAdress_arr; } // If not available, get assistance mail address else @@ -368,12 +366,13 @@ html; if (hasData($result)) { - return array( - $result->retval[0]->email, - '' + $stglMailAdress_arr[]= array( + 'to' => $result->retval[0]->email, + 'vorname' => '' ); } } + return $stglMailAdress_arr; } // Build HTML table with yesterdays new Anrechnungen of the given STG From 06179ee7148e6c4830c60be654221486d7987c94 Mon Sep 17 00:00:00 2001 From: Paolo Date: Thu, 23 Mar 2023 14:38:42 +0100 Subject: [PATCH 003/335] Code quality check fixes --- application/helpers/hlp_sancho_helper.php | 25 +++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/application/helpers/hlp_sancho_helper.php b/application/helpers/hlp_sancho_helper.php index e57802432..f101ce89d 100644 --- a/application/helpers/hlp_sancho_helper.php +++ b/application/helpers/hlp_sancho_helper.php @@ -38,7 +38,17 @@ const DEFAULT_SANCHO_FOOTER_IMG = 'sancho_footer_DEFAULT.jpg'; * @param string $bcc Sets BCC of mail. * @return void */ -function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerImg = DEFAULT_SANCHO_HEADER_IMG, $footerImg = DEFAULT_SANCHO_FOOTER_IMG, $from = null, $cc = null, $bcc = null) +function sendSanchoMail( + $vorlage_kurzbz, + $vorlage_data, + $to, + $subject, + $headerImg = DEFAULT_SANCHO_HEADER_IMG, + $footerImg = DEFAULT_SANCHO_FOOTER_IMG, + $from = null, + $cc = null, + $bcc = null +) { $ci =& get_instance(); $ci->load->library('email'); @@ -74,7 +84,18 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm $body = _parseMailContent('Sancho_Mail_Template', $layout); // Send mail - return $ci->maillib->send($from, $to, $subject, $body, $alias = '', $cc, $bcc, $altMessage = '', $bulk = true, $autogenerated = true); + return $ci->maillib->send( + $from, + $to, + $subject, + $body, + '', // alias + $cc, + $bcc, + '', // altMessage + true, // bulk + true // autogenerated + ); } /** From c94f185308864352534642913dce69680a870f1d Mon Sep 17 00:00:00 2001 From: ma0048 Date: Wed, 10 Jul 2024 15:13:46 +0200 Subject: [PATCH 004/335] =?UTF-8?q?-=20faktor=20f=C3=BCr=20lvs=20hinzugefu?= =?UTF-8?q?egt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/lehrveranstaltung_faktor.class.php | 258 ++++++++++++++++ soap/lehrveranstaltung_faktor.json.php | 123 ++++++++ system/dbupdate_3.4.php | 2 + system/dbupdate_3.4/40717_lv_faktor.php | 65 ++++ vilesci/lehre/lehrveranstaltung.php | 19 +- vilesci/lehre/lehrveranstaltung_details.php | 27 ++ vilesci/lehre/lehrveranstaltung_faktor.php | 309 ++++++++++++++++++++ 7 files changed, 801 insertions(+), 2 deletions(-) create mode 100644 include/lehrveranstaltung_faktor.class.php create mode 100644 soap/lehrveranstaltung_faktor.json.php create mode 100644 system/dbupdate_3.4/40717_lv_faktor.php create mode 100644 vilesci/lehre/lehrveranstaltung_faktor.php diff --git a/include/lehrveranstaltung_faktor.class.php b/include/lehrveranstaltung_faktor.class.php new file mode 100644 index 000000000..49459321b --- /dev/null +++ b/include/lehrveranstaltung_faktor.class.php @@ -0,0 +1,258 @@ +load($lehrveranstaltung_faktor_id); + } + + + public function load($lehrveranstaltung_faktor_id) + { + if (!is_numeric($lehrveranstaltung_faktor_id)) + { + $this->errormsg = 'Lehrveranstaltung_faktor_id muss eine gueltige Zahl sein'; + return false; + } + + $qry = "SELECT * FROM lehre.tbl_lehrveranstaltung_faktor + WHERE lehrveranstaltung_faktor_id=".$this->db_add_param($lehrveranstaltung_faktor_id, FHC_INTEGER); + + if (!$this->db_query($qry)) { + $this->errormsg = 'Datensatz konnte nicht geladen werden'; + return false; + } + + if ($row = $this->db_fetch_object()) + { + $this->lehrveranstaltung_faktor_id = $row->lehrveranstaltung_faktor_id; + $this->lehrveranstaltung_id = $row->lehrveranstaltung_id; + $this->faktor = $row->faktor; + $this->studiensemester_kurzbz_von = $row->studiensemester_kurzbz_von; + $this->studiensemester_kurzbz_bis = $row->studiensemester_kurzbz_bis; + } + + return true; + } + + public function loadByLV($lv_id, $von = null, $bis = null, $id = null) + { + + if (!is_numeric($lv_id)) + { + $this->errormsg = 'Lehrveranstaltung_faktor_id muss eine gueltige Zahl sein'; + return false; + } + $qry = "SELECT * + FROM lehre.tbl_lehrveranstaltung_faktor + LEFT JOIN public.tbl_studiensemester vonstsem + ON tbl_lehrveranstaltung_faktor.studiensemester_kurzbz_von = vonstsem.studiensemester_kurzbz + LEFT JOIN public.tbl_studiensemester bisstem + ON tbl_lehrveranstaltung_faktor.studiensemester_kurzbz_bis = bisstem.studiensemester_kurzbz + WHERE lehrveranstaltung_id = ".$this->db_add_param($lv_id, FHC_INTEGER); + + if(!empty($von)) + { + $qry .= " + AND (bisstem.ende >= ( + SELECT start + FROM public.tbl_studiensemester + WHERE studiensemester_kurzbz = " . $this->db_add_param($von, FHC_STRING) . " + ) + OR bisstem.ende IS NULL + )"; + } + + if(!empty($bis) && $bis !== "") + { + $qry .= " + AND + (vonstsem.start <= ( + SELECT ende + FROM public.tbl_studiensemester + WHERE studiensemester_kurzbz = " . $this->db_add_param($bis, FHC_STRING) . " + )) + "; + } + + if (!empty($id) && $id !== "") + { + $qry .= " + AND + lehrveranstaltung_faktor_id != ". $this->db_add_param($id, FHC_INTEGER); + } + + if (!$result = $this->db_query($qry)) { + $this->errormsg = 'Datensatz konnte nicht geladen werden'; + return false; + } + + while ($row = $this->db_fetch_object($result)) + { + $lv_faktor_objekt = new lehrveranstaltung_faktor(); + + $lv_faktor_objekt->lehrveranstaltung_faktor_id = $row->lehrveranstaltung_faktor_id; + $lv_faktor_objekt->lehrveranstaltung_id = $row->lehrveranstaltung_id; + $lv_faktor_objekt->faktor = $row->faktor; + $lv_faktor_objekt->studiensemester_kurzbz_von = $row->studiensemester_kurzbz_von; + $lv_faktor_objekt->studiensemester_kurzbz_bis = $row->studiensemester_kurzbz_bis; + + $this->lv_faktoren[] = $lv_faktor_objekt; + } + + return true; + } + + public function addFaktor($lv_id, $faktor, $von, $bis = NULL) + { + $qry = 'INSERT INTO lehre.tbl_lehrveranstaltung_faktor (lehrveranstaltung_id, faktor, studiensemester_kurzbz_von, studiensemester_kurzbz_bis) + VALUES ('. $this->db_add_param($lv_id, FHC_INTEGER) . ', '. + $this->db_add_param($faktor, FHC_INTEGER) . ', '. + $this->db_add_param($von, FHC_STRING) . ', '. + $this->db_add_param($bis, FHC_STRING) . ');'; + + if ($this->db_query($qry)) + { + $qry_id = "SELECT currval('lehre.lehrveranstaltung_faktor_id_seq') as id;"; + if($this->db_query($qry_id)) + { + if($row = $this->db_fetch_object()) + { + $this->db_query('COMMIT'); + return [ + 'id' => $row->id, + 'lv_id' => $lv_id, + 'faktor' => $faktor, + 'von' => $von, + 'bis' => $bis + ]; + } + else + { + $this->db_query('ROLLBACK'); + return [ + 'status' => 'error', + 'message' => 'Fehler beim Einfügen in die Datenbank:' + ]; + } + } + else + { + $this->db_query('ROLLBACK'); + return [ + 'status' => 'error', + 'message' => 'Fehler beim Einfügen in die Datenbank:' + ]; + } + } + else + { + return [ + 'status' => 'error', + 'message' => 'Fehler beim Einfügen in die Datenbank:' + ]; + } + } + + public function updateFaktor($id, $faktor, $von, $bis) + { + $qry = "UPDATE lehre.tbl_lehrveranstaltung_faktor + SET faktor = ". $this->db_add_param($faktor) ." , + studiensemester_kurzbz_von = ". $this->db_add_param($von) .", + studiensemester_kurzbz_bis = ". $this->db_add_param($bis) ." + WHERE lehrveranstaltung_faktor_id = ". $this->db_add_param($id, FHC_INTEGER); + + if ($this->db_query($qry)) + { + return true; + } + else + { + return [ + 'status' => 'error', + 'message' => 'Fehler beim Einfügen in die Datenbank:' + ]; + } + } + + public function getAkt($lv_id) + { + if (!is_numeric($lv_id)) + { + $this->errormsg = 'Lehrveranstaltung_id muss eine gueltige Zahl sein'; + return false; + } + + $qry = "SELECT * + FROM lehre.tbl_lehrveranstaltung_faktor + LEFT JOIN public.tbl_studiensemester vonstsem + ON tbl_lehrveranstaltung_faktor.studiensemester_kurzbz_von = vonstsem.studiensemester_kurzbz + LEFT JOIN public.tbl_studiensemester bisstem + ON tbl_lehrveranstaltung_faktor.studiensemester_kurzbz_bis = bisstem.studiensemester_kurzbz + WHERE lehrveranstaltung_id = ".$this->db_add_param($lv_id, FHC_INTEGER) . " + AND (vonstsem.start <= now() OR vonstsem.start IS NULL) + AND (bisstem.ende >= now() OR bisstem.ende IS NULL) + ORDER BY vonstsem.start DESC LIMIT 1 + "; + + + if (!$this->db_query($qry)) { + $this->errormsg = 'Datensatz konnte nicht geladen werden'; + return false; + } + + if ($row = $this->db_fetch_object()) + { + $this->lehrveranstaltung_faktor_id = $row->lehrveranstaltung_faktor_id; + $this->lehrveranstaltung_id = $row->lehrveranstaltung_id; + $this->faktor = $row->faktor; + $this->studiensemester_kurzbz_von = $row->studiensemester_kurzbz_von; + $this->studiensemester_kurzbz_bis = $row->studiensemester_kurzbz_bis; + } + + return true; + } + + + public function deleteFaktor($id) + { + $qry = "DELETE FROM lehre.tbl_lehrveranstaltung_faktor + WHERE lehrveranstaltung_faktor_id = ". $this->db_add_param($id, FHC_INTEGER); + + if ($this->db_query($qry)) + { + return true; + } + else + { + return [ + 'status' => 'error', + 'message' => 'Fehler beim Löschen aus der Datenbank:' + ]; + } + } +} +?> diff --git a/soap/lehrveranstaltung_faktor.json.php b/soap/lehrveranstaltung_faktor.json.php new file mode 100644 index 000000000..49f13ac47 --- /dev/null +++ b/soap/lehrveranstaltung_faktor.json.php @@ -0,0 +1,123 @@ +getBerechtigungen($uid); + +if(!$rechte->isBerechtigt('basis/person', null, 'suid')) +{ + exit('Sie haben keine Berechtigung für die Seite'); +} + +$method = isset($_REQUEST['method']) ? $_REQUEST['method']: '' ; +$lv_faktor = new lehrveranstaltung_faktor(); + +switch($method) +{ + case 'addFaktor': + $faktor = isset($_REQUEST['faktor']) ? $_REQUEST['faktor']: '' ; + if ($faktor !== '') + { + if (!isRightType($faktor['lv_id'])) + { + echo json_encode([ + 'status' => 'error', + 'message' => 'Nur LVs und Templates möglich' + ]); + break; + } + if (vonHigherThanBis($faktor['von'], $faktor['bis'])) + { + echo json_encode([ + 'status' => 'error', + 'message' => 'Von nach Bis' + ]); + break; + } + if (exists($faktor['lv_id'], $faktor['von'], $faktor['bis'])) + { + echo json_encode([ + 'status' => 'error', + 'message' => 'Für den Zeitraum bereits vorhanden' + ]); + break; + } + + $result = $lv_faktor->addFaktor($faktor['lv_id'], $faktor['faktor'], $faktor['von'], $faktor['bis']); + echo json_encode($result); + } + break; + case 'updateFaktor': + $faktor = isset($_REQUEST['faktor']) ? $_REQUEST['faktor']: '' ; + if ($faktor !== '') + { + if (vonHigherThanBis($faktor['von'], $faktor['bis'])) + { + echo json_encode([ + 'status' => 'error', + 'message' => 'Von nach Bis' + ]); + break; + } + if (exists($faktor['lv_id'], $faktor['von'], $faktor['bis'], $faktor['id'])) + { + echo json_encode([ + 'status' => 'error', + 'message' => 'Für den Zeitraum bereits vorhanden' + ]); + break; + } + + $result = $lv_faktor->updateFaktor($faktor['id'], $faktor['faktor'], $faktor['von'], $faktor['bis']); + echo json_encode($result); + } + break; + case 'deleteFaktor': + $faktor = isset($_REQUEST['faktor']) ? $_REQUEST['faktor']: '' ; + if ($faktor !== '') + { + $result = $lv_faktor->deleteFaktor($faktor['id']); + echo json_encode($result); + } + break; + default: + break; +} + +function isRightType($lv_id) +{ + $lv = new lehrveranstaltung($lv_id); + if (in_array($lv->lehrtyp_kurzbz, array('lv', 'tpl'))) + return true; + + return false; +} + +function exists($lv_id, $von, $bis, $id = null) +{ + $lv_faktor = new lehrveranstaltung_faktor(); + $lv_faktor->loadByLV($lv_id, $von, $bis, $id); + return !empty($lv_faktor->lv_faktoren); +} + +function vonHigherThanBis($von, $bis) +{ + $vonStsem = new studiensemester($von); + $bisStsem = new studiensemester($bis); + + if (is_null($bis) || $bis === "") + return false; + if ($vonStsem->start > $bisStsem->start) + return true; + else + return false; + +} + +?> diff --git a/system/dbupdate_3.4.php b/system/dbupdate_3.4.php index 9fb7f0ee9..06b1e0cb4 100644 --- a/system/dbupdate_3.4.php +++ b/system/dbupdate_3.4.php @@ -56,6 +56,7 @@ require_once('dbupdate_3.4/36530_bis_internationsalisierung_codextabelle_neuerun require_once('dbupdate_3.4/34543_ux_template.php'); require_once('dbupdate_3.4/17513_Entwicklungsteam.php'); require_once('dbupdate_3.4/28575_softwarebereitstellung.php'); +require_once('dbupdate_3.4/40717_lv_faktor.php'); // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; @@ -246,6 +247,7 @@ $tabellen=array( "lehre.tbl_zeitfenster" => array("wochentag","stunde","ort_kurzbz","studiengang_kz","gewicht"), "lehre.tbl_zeugnis" => array("zeugnis_id","student_uid","zeugnis","erstelltam","gedruckt","titel","bezeichnung","updateamum","updatevon","insertamum","insertvon","ext_id"), "lehre.tbl_zeugnisnote" => array("lehrveranstaltung_id","student_uid","studiensemester_kurzbz","note","uebernahmedatum","benotungsdatum","bemerkung","updateamum","updatevon","insertamum","insertvon","ext_id","punkte"), + "lehre.tbl_lehrveranstaltung_faktor" => array("lehrveranstaltung_faktor_id", "lehrveranstaltung_id","faktor","studiensemester_kurzbz_von","studiensemester_kurzbz_bis","insertamum","insertvon","updateamum","updatevon"), "public.ci_apikey" => array("apikey_id","key","level","ignore_limits","date_created"), "public.tbl_adresse" => array("adresse_id","person_id","name","strasse","plz","ort","gemeinde","nation","typ","heimatadresse","zustelladresse","firma_id","updateamum","updatevon","insertamum","insertvon","ext_id","rechnungsadresse","anmerkung", "co_name"), "public.tbl_adressentyp" => array("adressentyp_kurzbz", "bezeichnung", "bezeichnung_mehrsprachig", "sort"), diff --git a/system/dbupdate_3.4/40717_lv_faktor.php b/system/dbupdate_3.4/40717_lv_faktor.php new file mode 100644 index 000000000..932d6fd40 --- /dev/null +++ b/system/dbupdate_3.4/40717_lv_faktor.php @@ -0,0 +1,65 @@ +db_query("SELECT 1 FROM lehre.tbl_lehrveranstaltung_faktor LIMIT 1")) +{ + $qry = " + + CREATE TABLE lehre.tbl_lehrveranstaltung_faktor + ( + lehrveranstaltung_faktor_id integer NOT NULL, + lehrveranstaltung_id integer NOT NULL, + faktor numeric NOT NULL, + studiensemester_kurzbz_von varchar(16) NOT NULL, + studiensemester_kurzbz_bis varchar(16), + insertamum timestamp DEFAULT NOW(), + insertvon varchar(32), + updateamum timestamp, + updatevon varchar(32), + CONSTRAINT tbl_lehrveranstaltung_faktor_pk PRIMARY KEY (lehrveranstaltung_faktor_id) + ); + + CREATE SEQUENCE lehre.lehrveranstaltung_faktor_id_seq + START WITH 1 + INCREMENT BY 1 + NO MAXVALUE + NO MINVALUE + CACHE 1; + + ALTER TABLE lehre.tbl_lehrveranstaltung_faktor ALTER COLUMN lehrveranstaltung_faktor_id SET DEFAULT nextval('lehre.lehrveranstaltung_faktor_id_seq'); + ALTER TABLE lehre.tbl_lehrveranstaltung_faktor ADD CONSTRAINT fk_lehrveranstaltung_faktor_lehrveranstaltung_id FOREIGN KEY (lehrveranstaltung_id) REFERENCES lehre.tbl_lehrveranstaltung (lehrveranstaltung_id) ON DELETE RESTRICT ON UPDATE CASCADE; + ALTER TABLE lehre.tbl_lehrveranstaltung_faktor ADD CONSTRAINT fk_lehrveranstaltung_faktor_studiensemester_von FOREIGN KEY (studiensemester_kurzbz_von) REFERENCES public.tbl_studiensemester(studiensemester_kurzbz) ON UPDATE CASCADE ON DELETE RESTRICT; + ALTER TABLE lehre.tbl_lehrveranstaltung_faktor ADD CONSTRAINT fk_lehrveranstaltung_faktor_studiensemester_bis FOREIGN KEY (studiensemester_kurzbz_bis) REFERENCES public.tbl_studiensemester(studiensemester_kurzbz) ON UPDATE CASCADE ON DELETE RESTRICT; + + GRANT SELECT ON lehre.tbl_lehrveranstaltung_faktor TO web; + GRANT SELECT, UPDATE, INSERT, DELETE ON lehre.tbl_lehrveranstaltung_faktor TO vilesci; + GRANT SELECT ON lehre.lehrveranstaltung_faktor_id_seq TO web; + GRANT SELECT, UPDATE, INSERT, DELETE ON lehre.lehrveranstaltung_faktor_id_seq TO vilesci; + "; + + if (!$db->db_query($qry)) + echo 'lehre.tbl_lehrveranstaltung_faktor: ' . $db->db_last_error() . '
'; + else + echo 'Tabelle: lehre.tbl_lehrveranstaltung_faktor erstellt!'; + + //TODO ggf default wert in eine config + $qry = " + INSERT INTO lehre.tbl_lehrveranstaltung_faktor + (lehrveranstaltung_id, faktor, studiensemester_kurzbz_von, insertvon) + ( + SELECT lehrveranstaltung_id, + 2, + ( + SELECT public.tbl_studiensemester.studiensemester_kurzbz + FROM public.tbl_studiensemester + ORDER BY start LIMIT 1 + ), + 'checksystem' + FROM lehre.tbl_lehrveranstaltung + WHERE lehrtyp_kurzbz IN ('lv', 'tpl') + ); + "; + if (!$db->db_query($qry)) + echo 'lehre.tbl_lehrveranstaltung_faktor: ' . $db->db_last_error() . '
'; + else + echo 'Tabelle: lehre.tbl_lehrveranstaltung_faktor befüllt!'; +} diff --git a/vilesci/lehre/lehrveranstaltung.php b/vilesci/lehre/lehrveranstaltung.php index ab7abd9cd..2b3346d02 100644 --- a/vilesci/lehre/lehrveranstaltung.php +++ b/vilesci/lehre/lehrveranstaltung.php @@ -32,6 +32,7 @@ require_once('../../include/organisationsform.class.php'); require_once('../../include/addon.class.php'); require_once('../../include/sprache.class.php'); require_once('../../include/lehrmodus.class.php'); +require_once('../../include/lehrveranstaltung_faktor.class.php'); if (!$db = new basis_db()) die('Es konnte keine Verbindung zum Server aufgebaut werden.'); @@ -1108,7 +1109,8 @@ if ($result_lv!=0) { echo "LV-Angebot kompatible LV - Aktion"; + Aktion + Faktor"; } echo ""; @@ -1326,7 +1328,20 @@ if ($result_lv!=0) '; echo 'Kompatible LV'; - echo 'löschen'; + echo ' + löschen + '; + + if (in_array($row->lehrtyp_kurzbz, array("tpl", "lv"))) + echo '
Faktor'; + echo ''; + echo ' + '; + + $lv_faktor = new lehrveranstaltung_faktor(); + $lv_faktor->getAkt($row->lehrveranstaltung_id); + + echo $lv_faktor->faktor.''; echo "\n"; } } diff --git a/vilesci/lehre/lehrveranstaltung_details.php b/vilesci/lehre/lehrveranstaltung_details.php index bad2a7d93..60f2fc3c9 100644 --- a/vilesci/lehre/lehrveranstaltung_details.php +++ b/vilesci/lehre/lehrveranstaltung_details.php @@ -30,6 +30,8 @@ require_once('../../include/lehrmodus.class.php'); require_once('../../include/benutzerberechtigung.class.php'); require_once('../../include/studienplan.class.php'); + require_once('../../include/lehrveranstaltung_faktor.class.php'); + require_once('../../include/studiensemester.class.php'); if (!$db = new basis_db()) die('Es konnte keine Verbindung zum Server aufgebaut werden.'); @@ -139,6 +141,31 @@ $reloadstr .= " window.location.href='".$_SERVER['PHP_SELF']."?stg_kz=$lv->studiengang_kz&semester=$lv->semester&neu=true';"; } $reloadstr .= "\n"; + + if (in_array($lv->lehrtyp_kurzbz, array('tpl', 'lv')) && $lv->new === true) + { + $lv_faktor = new lehrveranstaltung_faktor(); + $studiensemester = new studiensemester(); + $studiensemester_von = $studiensemester->getLastOrAktSemester(); + if ($lv->lehrtyp_kurzbz === 'lv' && $_POST['lehrveranstaltung_template_id'] !== '') + { + + $lv_faktor->getAkt($_POST['lehrveranstaltung_template_id']); + //TODO Faktor in eine Config + if (is_null($lv_faktor->faktor)) + $lv_faktor->addFaktor($lv->lehrveranstaltung_id, 2, $studiensemester_von); + else + $lv_faktor->addFaktor($lv->lehrveranstaltung_id, $lv_faktor->faktor, $studiensemester_von); + } + else + { + $lv_faktor->loadByLV($lv->lehrveranstaltung_id); + if (empty($lv_faktor->lv_faktoren)) + { + $lv_faktor->addFaktor($lv->lehrveranstaltung_id, 2, $studiensemester_von); + } + } + } } } diff --git a/vilesci/lehre/lehrveranstaltung_faktor.php b/vilesci/lehre/lehrveranstaltung_faktor.php new file mode 100644 index 000000000..d2b39427f --- /dev/null +++ b/vilesci/lehre/lehrveranstaltung_faktor.php @@ -0,0 +1,309 @@ +getBerechtigungen($uid); + +$sprache = getSprache(); +$p = new phrasen($sprache); + +if(!$rechte->isBerechtigt('basis/person', 'suid')) + die('Sie haben keine Berechtigung für diese Seite'); + +echo ' + + + + + + + + + + + +'; +?> + +load($lehrveranstaltung_id); + +$faktor = new lehrveranstaltung_faktor(); +$faktor->loadByLV($lv->lehrveranstaltung_id); + +$studiensemester = new studiensemester(); +$studiensemester->getAll('desc'); + + +echo ' + + +

Faktor - '. $lv->bezeichnung . ' - ' . $lv->lehrveranstaltung_id . '

'; + +echo ' +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + +'; + +if(count($faktor->lv_faktoren) > 0) +{ + foreach($faktor->lv_faktoren as $lv_faktor) + { + echo " + + + + + + " + ; + } +} + + ' +
'.$p->t('lv/faktor').''.$p->t('global/von').''.$p->t('global/bis').''.$p->t('global/bearbeiten').''.$p->t('global/loeschen').'
".$lv_faktor->faktor."".$lv_faktor->studiensemester_kurzbz_von."".$lv_faktor->studiensemester_kurzbz_bis."
+'; + +?> + + From d254b9c10b7066ed481d28952e8d7c4747a568d6 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Fri, 23 Aug 2024 11:58:08 +0200 Subject: [PATCH 005/335] Start Tab Pruefung, Abfrage Pruefungen --- .../api/frontend/v1/stv/Config.php | 4 + .../api/frontend/v1/stv/Pruefung.php | 48 +++++++++ .../models/education/LePruefung_model.php | 41 +++++++ .../Studentenverwaltung/Details/Pruefung.js | 25 +++++ .../Details/Pruefung/Pruefunglist.js | 101 ++++++++++++++++++ system/phrasesupdate.php | 20 ++++ 6 files changed, 239 insertions(+) create mode 100644 application/controllers/api/frontend/v1/stv/Pruefung.php create mode 100644 public/js/components/Stv/Studentenverwaltung/Details/Pruefung.js create mode 100644 public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js diff --git a/application/controllers/api/frontend/v1/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php index c28c49485..bfff14580 100644 --- a/application/controllers/api/frontend/v1/stv/Config.php +++ b/application/controllers/api/frontend/v1/stv/Config.php @@ -97,6 +97,10 @@ class Config extends FHCAPI_Controller 'component' => './Stv/Studentenverwaltung/Details/Noten.js' ]; */ + $result['exam'] = [ + 'title' => $this->p->t('stv', 'tab_exam'), + 'component' => './Stv/Studentenverwaltung/Details/Pruefung.js' + ]; Events::trigger('stv_conf_student', function & () use (&$result) { return $result; diff --git a/application/controllers/api/frontend/v1/stv/Pruefung.php b/application/controllers/api/frontend/v1/stv/Pruefung.php new file mode 100644 index 000000000..60666c610 --- /dev/null +++ b/application/controllers/api/frontend/v1/stv/Pruefung.php @@ -0,0 +1,48 @@ +. + */ + +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 addresses + * This controller works with JSON calls on the HTTP GET or POST and the output is always JSON + */ +class Pruefung extends FHCAPI_Controller +{ + public function __construct() + { + //TODO(Manu) Berechtigungen + parent::__construct([ + 'getPruefungen' => self::PERM_LOGGED + ]); + + //Load Models + $this->load->model('education/LePruefung_model', 'PruefungModel'); + } + + public function getPruefungen($student_uid, $studiensemester_kurzbz = null) + { + $result = $this->PruefungModel->getPruefungenByStudentuid($student_uid); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + +} diff --git a/application/models/education/LePruefung_model.php b/application/models/education/LePruefung_model.php index ac6c7f9b2..5522a3998 100644 --- a/application/models/education/LePruefung_model.php +++ b/application/models/education/LePruefung_model.php @@ -11,4 +11,45 @@ class LePruefung_model extends DB_Model $this->dbTable = 'lehre.tbl_pruefung'; $this->pk = 'pruefung_id'; } + + /** + * CI_STYLE + * @param string $student_uid + * @param string $studiensemester_kurzbz + * + * @return stdClass + */ + public function getPruefungenByStudentuid($student_uid, $studiensemester_kurzbz = null) + { + $this->addSelect('tbl_pruefung.datum'); + $this->addSelect("TO_CHAR(tbl_pruefung.datum::timestamp, 'DD.MM.YYYY') AS format_datum"); + $this->addSelect('tbl_pruefung.anmerkung'); + $this->addSelect('tbl_pruefung.pruefungstyp_kurzbz'); + $this->addSelect('tbl_pruefung.pruefung_id'); + $this->addSelect('tbl_pruefung.lehreinheit_id'); + $this->addSelect('tbl_pruefung.student_uid'); + $this->addSelect('tbl_pruefung.mitarbeiter_uid'); + $this->addSelect('tbl_pruefung.punkte'); + + $this->addSelect('tbl_lehrveranstaltung.bezeichnung as lehrveranstaltung_bezeichnung'); + $this->addSelect('tbl_lehrveranstaltung.lehrveranstaltung_id'); + $this->addSelect('tbl_note.bezeichnung as note_bezeichnung'); + $this->addSelect('tbl_pruefungstyp.beschreibung as typ_beschreibung'); + $this->addSelect('tbl_lehreinheit.studiensemester_kurzbz as studiensemester_kurzbz'); + + $this->addJoin('lehre.tbl_lehreinheit', 'lehre.tbl_pruefung.lehreinheit_id=lehre.tbl_lehreinheit.lehreinheit_id'); + $this->addJoin('lehre.tbl_lehrveranstaltung', 'lehrveranstaltung_id'); + $this->addJoin('lehre.tbl_note', 'note'); + $this->addJoin('lehre.tbl_pruefungstyp', 'pruefungstyp_kurzbz'); + + if ($studiensemester_kurzbz) + $this->db->where("tbl_lehreinheit.studiensemester_kurzbz = ", $studiensemester_kurzbz); + + $this->addOrder('tbl_pruefung.datum', 'DESC'); + $this->addOrder('tbl_pruefung.pruefung_id', 'DESC'); + + return $this->loadWhere([ + 'student_uid' => $student_uid + ]); + } } diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung.js b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung.js new file mode 100644 index 000000000..eb43e36be --- /dev/null +++ b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung.js @@ -0,0 +1,25 @@ +import PruefungList from "./Pruefung/Pruefunglist.js"; + +export default { + components: { + PruefungList + }, + props: { + modelValue: Object, + config: Object + }, + data() { + return { + pruefungen: [] + } + }, + template: ` +
+ + {{modelValue}} +
+ + +
+
` +}; \ No newline at end of file diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js new file mode 100644 index 000000000..6f034e087 --- /dev/null +++ b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js @@ -0,0 +1,101 @@ +import {CoreFilterCmpt} from "../../../../filter/Filter.js"; +import FormInput from "../../../../Form/Input.js"; + +export default{ + components: { + CoreFilterCmpt, + FormInput + }, + inject: { + defaultSemester: { + from: 'defaultSemester', + }, + }, + props: { + uid: Number + }, + data(){ + return { + tabulatorOptions: { + ajaxURL: 'api/frontend/v1/stv/pruefung/getPruefungen/' + this.uid, + ajaxRequestFunc: this.$fhcApi.get, + ajaxResponse: (url, params, response) => response.data, + columns: [ + {title: "Datum", field: "format_datum"}, + {title: "Lehrveranstaltung", field: "lehrveranstaltung_bezeichnung"}, + {title: "Note", field: "note_bezeichnung"}, + {title: "Anmerkung", field: "anmerkung"}, + {title: "Typ", field: "pruefungstyp_kurzbz"}, + {title: "PruefungId", field: "pruefung_id", visible:false}, + {title: "LehreinheitId", field: "lehreinheit_id", visible:false}, + {title: "Student_uid", field: "student_uid", visible:false}, + {title: "Mitarbeiter_uid", field: "mitarbeiter_uid", visible:false}, + {title: "Punkte", field: "punkte", visible:false}, + ], + layout: 'fitDataFill', + layoutColumnsOnNewData: false, + height: 'auto', + }, + tabulatorEvents: [{}], + pruefungData: {}, + filter: false + } + }, + computed:{}, +/* watch: { + modelValue() { + this.$refs.table.reloadTable(); + } + },*/ + methods:{ }, + template: ` +
+ +
+ + + +
+ +
+ +
+ + +
+ +
+

Form

+ + aktuelles Sem: {{defaultSemester}} + +
+
+
` +}; + diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 56a7304d4..00ae67abc 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -29300,6 +29300,26 @@ array( ) ) ), + array( + 'app' => 'core', + 'category' => 'stv', + 'phrase' => 'tab_exam', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Prüfung', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Exam', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), // konto array( 'app' => 'core', From de0fbdb72c8bbb7d1eb1084d33e8283fb7dd364d Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 29 Aug 2024 09:53:34 +0200 Subject: [PATCH 006/335] Form, Table and Queries for new Tab Pruefung --- .../api/frontend/v1/stv/Pruefung.php | 273 +++++++++- .../models/education/LePruefung_model.php | 2 +- .../models/education/Lehreinheit_model.php | 53 ++ application/models/education/Note_model.php | 14 + .../models/ressource/Mitarbeiter_model.php | 24 + .../Studentenverwaltung/Details/Pruefung.js | 2 +- .../Details/Pruefung/Pruefunglist.js | 481 ++++++++++++++++-- 7 files changed, 811 insertions(+), 38 deletions(-) create mode 100644 application/models/education/Note_model.php diff --git a/application/controllers/api/frontend/v1/stv/Pruefung.php b/application/controllers/api/frontend/v1/stv/Pruefung.php index 60666c610..9ddd22897 100644 --- a/application/controllers/api/frontend/v1/stv/Pruefung.php +++ b/application/controllers/api/frontend/v1/stv/Pruefung.php @@ -29,7 +29,19 @@ class Pruefung extends FHCAPI_Controller { //TODO(Manu) Berechtigungen parent::__construct([ - 'getPruefungen' => self::PERM_LOGGED + 'getPruefungen' => ['admin:r', 'assistenz:r'], + 'loadPruefung' => ['admin:r', 'assistenz:r'], + 'getTypenPruefungen' => self::PERM_LOGGED, + 'getLehreinheiten' => self::PERM_LOGGED, + 'getAllLehreinheiten' => self::PERM_LOGGED, + 'getLvsByStudent' => self::PERM_LOGGED, + 'getLvsandLesByStudent' => self::PERM_LOGGED, + 'getLvsAndMas' => self::PERM_LOGGED, + 'getMitarbeiterLv' => self::PERM_LOGGED, + 'getNoten' => self::PERM_LOGGED, + 'insertPruefung' => ['admin:r', 'assistenz:r'], + 'updatePruefung' =>['admin:r', 'assistenz:r'], + 'deletePruefung' =>['admin:r', 'assistenz:r'], ]); //Load Models @@ -45,4 +57,263 @@ class Pruefung extends FHCAPI_Controller $this->terminateWithSuccess($data); } + public function loadPruefung($pruefung_id) + { + $this->PruefungModel->addSelect('tbl_pruefung.datum'); + $this->PruefungModel->addSelect("TO_CHAR(tbl_pruefung.datum::timestamp, 'DD.MM.YYYY') AS format_datum"); + $this->PruefungModel->addSelect('tbl_pruefung.anmerkung'); + $this->PruefungModel->addSelect('tbl_pruefung.pruefungstyp_kurzbz'); + $this->PruefungModel->addSelect('tbl_pruefung.pruefung_id'); + $this->PruefungModel->addSelect('tbl_pruefung.lehreinheit_id'); + $this->PruefungModel->addSelect('tbl_pruefung.student_uid'); + $this->PruefungModel->addSelect('tbl_pruefung.mitarbeiter_uid'); + $this->PruefungModel->addSelect('tbl_pruefung.punkte'); + $this->PruefungModel->addSelect('tbl_pruefung.note'); + + $this->PruefungModel->addSelect('tbl_lehrveranstaltung.bezeichnung as lehrveranstaltung_bezeichnung'); + $this->PruefungModel->addSelect('tbl_lehrveranstaltung.lehrveranstaltung_id'); + $this->PruefungModel->addSelect('tbl_lehrveranstaltung.semester'); + $this->PruefungModel->addSelect('tbl_lehrveranstaltung.lehrform_kurzbz'); + $this->PruefungModel->addSelect('tbl_note.bezeichnung as note_bezeichnung'); + $this->PruefungModel->addSelect('tbl_pruefungstyp.beschreibung as typ_beschreibung'); + $this->PruefungModel->addSelect('tbl_lehreinheit.studiensemester_kurzbz as studiensemester_kurzbz'); + + $this->PruefungModel->addJoin('lehre.tbl_lehreinheit', 'lehre.tbl_pruefung.lehreinheit_id=lehre.tbl_lehreinheit.lehreinheit_id'); + $this->PruefungModel->addJoin('lehre.tbl_lehrveranstaltung', 'lehrveranstaltung_id'); + $this->PruefungModel->addJoin('lehre.tbl_note', 'note'); + $this->PruefungModel->addJoin('lehre.tbl_pruefungstyp', 'pruefungstyp_kurzbz'); + + + $this->PruefungModel->addLimit(1); + + $result = $this->PruefungModel->loadWhere( + array('pruefung_id' => $pruefung_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'=> 'Pruefung_id']), self::ERROR_TYPE_GENERAL); + } + $this->terminateWithSuccess(current(getData($result)) ? : null); + } + + public function insertPruefung(){ + //TODO(Manu) validations + + $authUID = getAuthUID(); + $lehreinheit_id = $this->input->post('lehreinheit_id'); + $student_uid = $this->input->post('student_uid'); + $mitarbeiter_uid = $this->input->post('mitarbeiter_uid'); + $datum = $this->input->post('datum'); + $note = $this->input->post('note'); + $pruefungstyp_kurzbz = $this->input->post('pruefungstyp_kurzbz'); + $anmerkung = $this->input->post('anmerkung'); + + + $result = $this->PruefungModel->insert([ + 'lehreinheit_id' => $lehreinheit_id, + 'student_uid' => $student_uid, + 'mitarbeiter_uid' => $mitarbeiter_uid, + 'datum' => $datum, + 'pruefungstyp_kurzbz' => $pruefungstyp_kurzbz, + 'note' => $note, + 'anmerkung' => $anmerkung, + 'insertamum' => date('c'), + 'insertvon' => $authUID, + ]); + + $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess(true); + + } + + public function updatePruefung($pruefung_id){ + //TODO(Manu) validations + $result = $this->PruefungModel->load($pruefung_id); + + $oldpruefung = $this->getDataOrTerminateWithError($result); + if (!$oldpruefung) + show_404(); // Pruefung that should be updated does not exist + + $authUID = getAuthUID(); + + $lehreinheit_id = $this->input->post('lehreinheit_id'); + $student_uid = $this->input->post('student_uid'); + $mitarbeiter_uid = $this->input->post('mitarbeiter_uid'); + $datum = $this->input->post('datum'); + $note = $this->input->post('note'); + $pruefungstyp_kurzbz = $this->input->post('pruefungstyp_kurzbz'); + $anmerkung = $this->input->post('anmerkung'); + + $result = $this->PruefungModel->update( + [ + 'pruefung_id' => $pruefung_id + ], + [ 'lehreinheit_id' => $lehreinheit_id, + 'student_uid' => $student_uid, + 'mitarbeiter_uid' => $mitarbeiter_uid, + 'note' => $note, + 'pruefungstyp_kurzbz' => $pruefungstyp_kurzbz, + 'datum' => $datum, + 'anmerkung' => $anmerkung, + 'updatevon' => $authUID, + 'updateamum' => date('c'), + ] + ); + + $this->getDataOrTerminateWithError($result); + + return $this->outputJsonSuccess(true); + } + + public function deletePruefung($pruefung_id){ + $result = $this->PruefungModel->load($pruefung_id); + + $oldpruefung = $this->getDataOrTerminateWithError($result); + if (!$oldpruefung) + show_404(); // Pruefung that should be deleted does not exist + + $result = $this->PruefungModel->delete( + [ + 'pruefung_id' => $pruefung_id + ] + ); + + $this->getDataOrTerminateWithError($result); + + return $this->terminateWithSuccess(true); + } + + public function getTypenPruefungen() + { + $this->load->model('education/Pruefungstyp_model', 'PruefungtypModel'); + + //TODO(Manu) sort Termin3 + $this->PruefungtypModel->addOrder('sort', 'ASC'); + $result = $this->PruefungtypModel->loadWhere( + array('abschluss' => 'false') + ); + + if (isError($result)) { + $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); + } + return $this->terminateWithSuccess(getData($result) ?: []); + } + + public function getAllLehreinheiten(){ + + //TODO MANU (validations) + + $lv_id = $this->input->post('lv_id'); + $studiensemester_kurzbz = $this->input->post('studiensemester_kurzbz'); + + $this->load->model('education/Lehreinheit_model', 'LehreinheitModel'); + + $result = $this->LehreinheitModel->getLesFromLvIds($lv_id, $studiensemester_kurzbz); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + + public function getLvsandLesByStudent($student_uid) + { + $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); + + $result = $this->LehrveranstaltungModel->getLvsByStudent($student_uid); + + $data = $this->getDataOrTerminateWithError($result); + + $lv_ids = array(); + $allData = array(); + + foreach ($data as $lehrveranstaltung) { + $lv_ids[] = $lehrveranstaltung->lehrveranstaltung_id; + } + + $this->load->model('education/Lehreinheit_model', 'LehreinheitModel'); + + foreach ($lv_ids as $id) + { + $result = $this->LehreinheitModel->getLesFromLvIds($id); + $data = $this->getDataOrTerminateWithError($result); + + if (is_array($data)) { + $allData = array_merge($allData, $data); + } + } + + return $this->terminateWithSuccess($allData); + } + + public function getLvsAndMas($student_uid) + { + $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); + + $result = $this->LehrveranstaltungModel->getLvsByStudent($student_uid); + + $data = $this->getDataOrTerminateWithError($result); + + $lv_ids = array(); + $allDataMa = array(); + + foreach ($data as $lehrveranstaltung) { + $lv_ids[] = $lehrveranstaltung->lehrveranstaltung_id; + } + + $this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel'); + + foreach ($lv_ids as $id) { + + $resultMa = $this->MitarbeiterModel->getMitarbeiterFromLV($id); + $dataMa = $this->getDataOrTerminateWithError($resultMa); + + if (is_array($dataMa)) { + $allDataMa = array_merge($allDataMa, $dataMa); + } + } + + return $this->terminateWithSuccess($allDataMa); + } + + public function getLvsByStudent($student_uid) + { + $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); + + $result = $this->LehrveranstaltungModel->getLvsByStudent($student_uid); + + $data = $this->getDataOrTerminateWithError($result); + + return $this->terminateWithSuccess($data); + } + + public function getMitarbeiterLv($lv_id) + { + $this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel'); + + $result = $this->MitarbeiterModel->getMitarbeiterFromLV($lv_id); + + $data = $this->getDataOrTerminateWithError($result); + + return $this->terminateWithSuccess($data); + } + + public function getNoten() + { + $this->load->model('education/Note_model', 'NoteModel'); + + $this->NoteModel->addOrder('note', 'ASC'); + $result = $this->NoteModel->load(); + + if (isError($result)) { + $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); + } + return $this->terminateWithSuccess(getData($result) ?: []); + } + + } diff --git a/application/models/education/LePruefung_model.php b/application/models/education/LePruefung_model.php index 5522a3998..6e51f1975 100644 --- a/application/models/education/LePruefung_model.php +++ b/application/models/education/LePruefung_model.php @@ -13,7 +13,7 @@ class LePruefung_model extends DB_Model } /** - * CI_STYLE + * gets all Pruefungen for a student_uid * @param string $student_uid * @param string $studiensemester_kurzbz * diff --git a/application/models/education/Lehreinheit_model.php b/application/models/education/Lehreinheit_model.php index 10c122b94..3b7e8d330 100644 --- a/application/models/education/Lehreinheit_model.php +++ b/application/models/education/Lehreinheit_model.php @@ -113,4 +113,57 @@ class Lehreinheit_model extends DB_Model return $this->execQuery($query, array($lehreinheit_id)); } + + /** + * Gets Lehreinheiten for Lehrveranstaltungen in a Studiensemester. + * Without using tbl_lehrfach: bezeichnung and kurzbz ALWAYS from lehrveranstaltung + * @param $lehrveranstaltung_id + * @param $studiensemester + * @return array with Lehreinheiten and their Lehreinheitgruppen + */ + public function getLesFromLvIds($lehrveranstaltung_id, $studiensemester_kurzbz = null) + { + $params = array($lehrveranstaltung_id); + + $query = " + SELECT + lv.lehrveranstaltung_id, + le.lehreinheit_id, + le.lehrform_kurzbz, + lv.kurzbz, + lv.bezeichnung, + lv.semester, + ma.mitarbeiter_uid, + ( + SELECT + STRING_AGG(CONCAT(leg.semester, leg.verband, leg.gruppe), ' ') + FROM lehre.tbl_lehreinheitgruppe leg + WHERE leg.lehreinheit_id = le.lehreinheit_id + ) AS gruppe + FROM + lehre.tbl_lehreinheit le + JOIN + lehre.tbl_lehrveranstaltung lv ON lv.lehrveranstaltung_id = le.lehrveranstaltung_id + JOIN + lehre.tbl_lehreinheitmitarbeiter ma USING (lehreinheit_id) + WHERE + lv.lehrveranstaltung_id = ? + --AND le.studiensemester_kurzbz = 'WS2021' + "; + + if (isset($studiensemester_kurzbz)) + { + $query .= " AND le.studiensemester_kurzbz = ?"; + $params[] = $studiensemester_kurzbz; + } + + $query .=" + ORDER BY + le.lehreinheit_id; + "; + + return $this->execQuery($query, $params); + + } + } diff --git a/application/models/education/Note_model.php b/application/models/education/Note_model.php new file mode 100644 index 000000000..80b454398 --- /dev/null +++ b/application/models/education/Note_model.php @@ -0,0 +1,14 @@ +dbTable = 'lehre.tbl_note'; + $this->pk = 'note'; + } +} \ No newline at end of file diff --git a/application/models/ressource/Mitarbeiter_model.php b/application/models/ressource/Mitarbeiter_model.php index c38fcf054..52ed62be1 100644 --- a/application/models/ressource/Mitarbeiter_model.php +++ b/application/models/ressource/Mitarbeiter_model.php @@ -238,4 +238,28 @@ class Mitarbeiter_model extends DB_Model return $this->execQuery($qry); } + + /** + * Gets Mitarbeiter for a certain Lehrveranstaltung. + * + * @param $lehrveranstaltung_id + * @return array with Mitarbeiter and their Lehreinheiten + */ + public function getMitarbeiterFromLV($lehrveranstaltung_id){ + //TODO(manu) maybe filter that in pruefungslist.js ? + $qry = "SELECT DISTINCT + lehrveranstaltung_id, uid, vorname, wahlname, vornamen, nachname, titelpre, titelpost, kurzbz, mitarbeiter_uid + FROM + lehre.tbl_lehreinheitmitarbeiter, campus.vw_mitarbeiter, lehre.tbl_lehreinheit + WHERE + lehrveranstaltung_id= ? + AND + mitarbeiter_uid=uid + AND + tbl_lehreinheitmitarbeiter.lehreinheit_id=tbl_lehreinheit.lehreinheit_id;"; + + $parametersArray = array($lehrveranstaltung_id); + + return $this->execQuery($qry, $parametersArray); + } } diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung.js b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung.js index eb43e36be..e45f97240 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung.js @@ -16,7 +16,7 @@ export default { template: `
- {{modelValue}} +
diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js index 6f034e087..006cc6218 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js @@ -1,10 +1,12 @@ import {CoreFilterCmpt} from "../../../../filter/Filter.js"; import FormInput from "../../../../Form/Input.js"; +import BsModal from "../../../../Bootstrap/Modal.js"; export default{ components: { CoreFilterCmpt, - FormInput + FormInput, + BsModal }, inject: { defaultSemester: { @@ -26,40 +28,327 @@ export default{ {title: "Note", field: "note_bezeichnung"}, {title: "Anmerkung", field: "anmerkung"}, {title: "Typ", field: "pruefungstyp_kurzbz"}, - {title: "PruefungId", field: "pruefung_id", visible:false}, - {title: "LehreinheitId", field: "lehreinheit_id", visible:false}, - {title: "Student_uid", field: "student_uid", visible:false}, - {title: "Mitarbeiter_uid", field: "mitarbeiter_uid", visible:false}, - {title: "Punkte", field: "punkte", visible:false}, - ], + {title: "PruefungId", field: "pruefung_id", visible: false}, + {title: "LehreinheitId", field: "lehreinheit_id", visible: false}, + {title: "Student_uid", field: "student_uid", visible: false}, + {title: "LV_id", field: "lehrveranstaltung_id", visible: false}, //just for testing + {title: "Mitarbeiter_uid", field: "mitarbeiter_uid", visible: false}, + {title: "Punkte", field: "punkte", visible: false}, + { + title: 'Aktionen', field: 'actions', + minWidth: 150, + maxWidth: 150, + formatter: (cell, formatterParams, onRendered) => { + let container = document.createElement('div'); + container.className = "d-flex gap-2"; + + let button = document.createElement('button'); + button.className = 'btn btn-outline-secondary btn-action'; + button.innerHTML = ''; + button.title = 'neue Prüfung aus dieser LV erstellen'; + button.addEventListener( + 'click', + (event) => + this.actionNewFromOldPruefung(cell.getData().pruefung_id) + ); + container.append(button); + + button = document.createElement('button'); + button.className = 'btn btn-outline-secondary btn-action'; + button.innerHTML = ''; + button.title = 'Prüfung bearbeiten'; + button.addEventListener( + 'click', + (event) => + this.actionEditPruefung(cell.getData().pruefung_id) + ); + container.append(button); + + button = document.createElement('button'); + button.className = 'btn btn-outline-secondary btn-action'; + button.innerHTML = ''; + button.title = 'Prüfung löschen'; + button.addEventListener( + 'click', + () => + this.actionDeletePruefung(cell.getData().pruefung_id) + ); + container.append(button); + + return container; + }, + frozen: true + }], layout: 'fitDataFill', layoutColumnsOnNewData: false, height: 'auto', }, - tabulatorEvents: [{}], + tabulatorEvents: [ + { + event: 'tableBuilt', + handler: async () => { + await this.$p.loadCategory(['fristenmanagement', 'global', 'person', 'ui',]); + let cm = this.$refs.table.tabulator.columnManager; + + cm.getColumnByField('bezeichnung').component.updateDefinition({ + title: this.$p.t('global', 'typ') + }); + + cm.getColumnByField('anmerkung').component.updateDefinition({ + title: this.$p.t('global', 'anmerkung') + }); + } + } + ], pruefungData: {}, - filter: false + listTypesExam: [], + listLvsAndLes: [], + listLvsAndMas: [], + listLvs: [], //TODO(Manu) nachträglich sortieren + listLes: [], + listMas: [], //TODO(Manu) Filter statt SELECT DISTINCT + listMarks: [], + filter: false, + statusNew: true, + isStartDropDown: false + } + }, + computed:{ +/* lehrveranstaltungen(){ + return this.listLvsAndLes.filter((value, index, self) => { + return self.indexOf(value) === index; + }); + },*/ + lv_teile(){ + return this.listLvsAndLes.filter(lv => lv.lehrveranstaltung_id == this.pruefungData.lehrveranstaltung_id); + }, + lv_teile_ma(){ + return this.listLvsAndMas.filter(lv => lv.lehrveranstaltung_id == this.pruefungData.lehrveranstaltung_id); } }, - computed:{}, /* watch: { modelValue() { this.$refs.table.reloadTable(); } },*/ - methods:{ }, + methods:{ + loadPruefung(pruefung_id) { + return this.$fhcApi.get('api/frontend/v1/stv/pruefung/loadPruefung/' + pruefung_id) + .then(result => { + this.pruefungData = result.data; + return result; + }) + .catch(this.$fhcAlert.handleSystemError); + }, + actionNewPruefung(){ + this.statusNew = true; + this.isStartDropDown = true; + +/* this.getLvsByStudent(this.uid).then(() => { + this.$refs.pruefungModal.show(); + });*/ + + this.$refs.pruefungModal.show(); + // this.prepareDropdowns(); + // this.$refs.pruefungModal.show(); + + }, + actionNewFromOldPruefung(pruefung_id) { + this.statusNew = true; + this.isStartDropDown = false; + this.loadPruefung(pruefung_id).then(() => { + this.pruefungData.note_bezeichnung = 'Noch nicht eingetragen'; + this.pruefungData.datum = new Date(); + this.prepareDropdowns(); + + this.$refs.pruefungModal.show(); + }); + }, + actionEditPruefung(pruefung_id) { + this.statusNew = false; + this.isStartDropDown = false; + this.loadPruefung(pruefung_id).then(() => { + + this.prepareDropdowns(); + + this.$refs.pruefungModal.show(); + }); + }, + actionDeletePruefung(pruefung_id) { + console.log("action delete Prüfung" + pruefung_id); + this.loadPruefung(pruefung_id).then(() => { + if(this.pruefungData.pruefung_id) + + this.$fhcAlert + .confirmDelete() + .then(result => result + ? pruefung_id + : Promise.reject({handled: true})) + .then(this.deletePruefung) + .catch(this.$fhcAlert.handleSystemError); + + }); + }, + addPruefung(){ + this.$fhcApi.post('api/frontend/v1/stv/pruefung/insertPruefung/', + this.pruefungData + ).then(response => { + this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); + this.hideModal('pruefungModal'); + this.resetModal(); + }).catch(this.$fhcAlert.handleSystemError) + .finally(() => { + window.scrollTo(0, 0); + this.reload(); + }); + }, + updatePruefung(pruefung_id){ + console.log("update Prüfung" + pruefung_id); + this.$fhcApi.post('api/frontend/v1/stv/pruefung/updatePruefung/' + pruefung_id, + this.pruefungData + ).then(response => { + this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); + this.hideModal('pruefungModal'); + this.resetModal(); + }).catch(this.$fhcAlert.handleSystemError) + .finally(() => { + window.scrollTo(0, 0); + this.reload(); + }); + }, + deletePruefung(pruefung_id) { + this.$fhcApi.post('api/frontend/v1/stv/pruefung/deletePruefung/' + pruefung_id) + .then(response => { + this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); + }).catch(this.$fhcAlert.handleSystemError) + .finally(()=> { + window.scrollTo(0, 0); + this.reload(); + }); + }, + hideModal(modalRef) { + this.$refs[modalRef].hide(); + }, + resetModal() { + this.pruefungData = {}; + +/* this.pruefungData.strasse = null; + this.pruefungData.zustellpruefunge = true; + this.pruefungData.heimatpruefunge = true; + this.pruefungData.rechnungspruefunge = false; + this.pruefungData.co_name = null; + this.pruefungData.firma_id = null; + this.pruefungData.name = null; + this.pruefungData.anmerkung = null; + this.pruefungData.typ = 'h'; + this.pruefungData.nation = 'A'; + this.pruefungData.plz = null;*/ + + this.statusNew = true; + }, + reload() { + this.$refs.table.reloadTable(); + }, + getLvsByStudent(student_uid){ + return this.$fhcApi.get('api/frontend/v1/stv/pruefung/getLvsByStudent/' + student_uid) + .then(result => { + this.listLvs = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + }, + getMaFromLv(lv_id){ + return this.$fhcApi.get('api/frontend/v1/stv/pruefung/getMitarbeiterLv/' + lv_id) + .then(result => { + this.listMas = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + }, + getLehreinheiten(lv_id, studiensemester_kurzbz) { + const data = { + lv_id: lv_id, + studiensemester_kurzbz: studiensemester_kurzbz + }; + + return this.$fhcApi.post('api/frontend/v1/stv/pruefung/getAllLehreinheiten/', data) + .then(response => { + this.listLes = response.data; + }) + .catch(this.$fhcAlert.handleSystemError); + }, + prepareDropdowns(){ + + // Get Lvs from Student +/* this.getLvsByStudent(this.pruefungData.student_uid).then(() => { + + }).catch(error => { + console.error('Error loading Lvs:', error); + });*/ + + + // Get Ma from Lv + this.getMaFromLv(this.pruefungData.lehrveranstaltung_id).then(() => { + }).catch(error => { + console.error('Error loading Ma data:', error); + }); + + // Get Lehreinheiten + this.getLehreinheiten(this.pruefungData.lehrveranstaltung_id, this.pruefungData.studiensemester_kurzbz).then(() => { + + }).catch(error => { + console.error('Error loading Lehreinheiten multiple:', error); + }); + + + + this.$refs.pruefungModal.show(); + } + }, + created(){ + this.$fhcApi.get('api/frontend/v1/stv/pruefung/getLvsByStudent/' + this.uid) + .then(result => { + this.listLvs = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + + this.$fhcApi.get('api/frontend/v1/stv/pruefung/getLvsandLesByStudent/' + this.uid) + .then(result => { + this.listLvsAndLes = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + + this.$fhcApi.get('api/frontend/v1/stv/pruefung/getLvsAndMas/' + this.uid) + .then(result => { + this.listLvsAndMas = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + + this.$fhcApi.get('api/frontend/v1/stv/pruefung/getTypenPruefungen') + .then(result => { + this.listTypesExam = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + + this.$fhcApi.get('api/frontend/v1/stv/pruefung/getNoten') + .then(result => { + this.listMarks = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + }, template: `
- + + aktuelles Sem: {{defaultSemester}} +
+
- - +
-
- -
- - -
- -
-

Form

+ + + +

Form

+ + + + + +
+ Details - aktuelles Sem: {{defaultSemester}} - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
` }; From 4d5ea1f519c68569ed504c8388988084688778cc Mon Sep 17 00:00:00 2001 From: ma0068 Date: Tue, 17 Sep 2024 15:28:18 +0200 Subject: [PATCH 007/335] adapt addNewPruefung, pruefungModal, function getLvsByStudent --- .../api/frontend/v1/stv/Pruefung.php | 17 ++- .../education/Lehrveranstaltung_model.php | 7 +- .../Details/Pruefung/Pruefunglist.js | 128 +++++++++++++++--- 3 files changed, 125 insertions(+), 27 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Pruefung.php b/application/controllers/api/frontend/v1/stv/Pruefung.php index 9ddd22897..cdac93b4b 100644 --- a/application/controllers/api/frontend/v1/stv/Pruefung.php +++ b/application/controllers/api/frontend/v1/stv/Pruefung.php @@ -101,7 +101,7 @@ class Pruefung extends FHCAPI_Controller } public function insertPruefung(){ - //TODO(Manu) validations + //TODO(Manu) Berechtigungen $authUID = getAuthUID(); $lehreinheit_id = $this->input->post('lehreinheit_id'); @@ -112,6 +112,11 @@ class Pruefung extends FHCAPI_Controller $pruefungstyp_kurzbz = $this->input->post('pruefungstyp_kurzbz'); $anmerkung = $this->input->post('anmerkung'); + $this->load->library('form_validation'); + + $this->form_validation->set_rules( + 'datum', $this->p->t('global', 'datum'), ['is_valid_date'] + ); $result = $this->PruefungModel->insert([ 'lehreinheit_id' => $lehreinheit_id, @@ -132,7 +137,7 @@ class Pruefung extends FHCAPI_Controller } public function updatePruefung($pruefung_id){ - //TODO(Manu) validations + //TODO(Manu) validations and Berechtigungen $result = $this->PruefungModel->load($pruefung_id); $oldpruefung = $this->getDataOrTerminateWithError($result); @@ -280,11 +285,15 @@ class Pruefung extends FHCAPI_Controller return $this->terminateWithSuccess($allDataMa); } - public function getLvsByStudent($student_uid) + public function getLvsByStudent($student_uid, $studiensemester_kurzbz=null ) { + //bei post request +/* $student_uid = $this->input->post('student_uid'); + $studiensemester_kurzbz = $this->input->post('studiensemester_kurzbz');*/ + $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); - $result = $this->LehrveranstaltungModel->getLvsByStudent($student_uid); + $result = $this->LehrveranstaltungModel->getLvsByStudent($student_uid, $studiensemester_kurzbz); $data = $this->getDataOrTerminateWithError($result); diff --git a/application/models/education/Lehrveranstaltung_model.php b/application/models/education/Lehrveranstaltung_model.php index cefd147b9..f343f2583 100644 --- a/application/models/education/Lehrveranstaltung_model.php +++ b/application/models/education/Lehrveranstaltung_model.php @@ -226,7 +226,7 @@ class Lehrveranstaltung_model extends DB_Model /** * Gets Lehrveranstaltungen of a student * @param $student_uid - * @param null $studiensemester_kurzbz + * @param $studiensemester_kurzbz * @return array|null */ public function getLvsByStudent($student_uid, $studiensemester_kurzbz = null) @@ -236,6 +236,7 @@ class Lehrveranstaltung_model extends DB_Model $qry = "SELECT * FROM lehre.tbl_lehrveranstaltung WHERE lehrveranstaltung_id IN(SELECT lehrveranstaltung_id FROM campus.vw_student_lehrveranstaltung WHERE uid=?"; + if (isset($studiensemester_kurzbz)) { $qry .= " AND studiensemester_kurzbz=?"; @@ -243,11 +244,11 @@ class Lehrveranstaltung_model extends DB_Model } $qry .= ") OR lehrveranstaltung_id IN(SELECT lehrveranstaltung_id FROM lehre.tbl_zeugnisnote WHERE student_uid=?"; $params[] = $student_uid; - if (isset($studiensemester_kurzbz)) +/* if (isset($studiensemester_kurzbz)) { $qry .= " AND studiensemester_kurzbz=?"; $params[] = $studiensemester_kurzbz; - } + }*/ $qry .= ") ORDER BY semester, bezeichnung"; return $this->execQuery($qry, $params); diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js index 006cc6218..31f709e26 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js @@ -12,6 +12,10 @@ export default{ defaultSemester: { from: 'defaultSemester', }, +/* $reloadList: { + from: '$reloadList', + required: true + }*/ }, props: { uid: Number @@ -26,6 +30,7 @@ export default{ {title: "Datum", field: "format_datum"}, {title: "Lehrveranstaltung", field: "lehrveranstaltung_bezeichnung"}, {title: "Note", field: "note_bezeichnung"}, + {title: "StudSem", field: "studiensemester_kurzbz"}, //just testing {title: "Anmerkung", field: "anmerkung"}, {title: "Typ", field: "pruefungstyp_kurzbz"}, {title: "PruefungId", field: "pruefung_id", visible: false}, @@ -110,7 +115,10 @@ export default{ listMarks: [], filter: false, statusNew: true, - isStartDropDown: false + isStartDropDown: false, + currentSemester: false, + // componentKey: 0, + isFilterSet: false, } }, computed:{ @@ -124,13 +132,31 @@ export default{ }, lv_teile_ma(){ return this.listLvsAndMas.filter(lv => lv.lehrveranstaltung_id == this.pruefungData.lehrveranstaltung_id); - } + }, + semester_intern: { + get() { + if (this.currentSemester) + return this.currentSemester; + else + return false; + }, + set(value) { + this.currentSemester = value; + } + }, }, -/* watch: { + watch: { +/* defaultSemester(newVal, oldVal) { + if (newVal !== oldVal) { + console.log("variable did change"); + //this.reload(); // Methode aufrufen, um die Komponente neu zu laden + this.componentKey += 1; + } + }, modelValue() { this.$refs.table.reloadTable(); - } - },*/ + }*/ + }, methods:{ loadPruefung(pruefung_id) { return this.$fhcApi.get('api/frontend/v1/stv/pruefung/loadPruefung/' + pruefung_id) @@ -143,6 +169,7 @@ export default{ actionNewPruefung(){ this.statusNew = true; this.isStartDropDown = true; + this.resetModal(); /* this.getLvsByStudent(this.uid).then(() => { this.$refs.pruefungModal.show(); @@ -157,8 +184,9 @@ export default{ this.statusNew = true; this.isStartDropDown = false; this.loadPruefung(pruefung_id).then(() => { - this.pruefungData.note_bezeichnung = 'Noch nicht eingetragen'; + this.pruefungData.note = 9; this.pruefungData.datum = new Date(); + this.pruefungData.pruefungstyp_kurzbz = null; this.prepareDropdowns(); this.$refs.pruefungModal.show(); @@ -249,6 +277,16 @@ export default{ reload() { this.$refs.table.reloadTable(); }, +/* setFilter(semester) { + if (semester == 'open') + window.localStorage.setItem(LOCAL_STORAGE_ID_FILTER, this.filter ? 1 : 0); + else if( semester == 'default_semester') + this.$fhcApi.factory + .stv.filter.setSemester(this.defaultSemester) + .catch(this.$fhcAlert.handleSystemError); + + this.$nextTick(this.$refs.table.reloadTable); + },*/ getLvsByStudent(student_uid){ return this.$fhcApi.get('api/frontend/v1/stv/pruefung/getLvsByStudent/' + student_uid) .then(result => { @@ -256,6 +294,18 @@ export default{ }) .catch(this.$fhcAlert.handleSystemError); }, +/* //version post request +getLvsByStudent(student_uid, studiensemester_kurzbz){ + const data = { + student_uid: student_uid, + studiensemester_kurzbz: studiensemester_kurzbz + }; + return this.$fhcApi.post('api/frontend/v1/stv/pruefung/getLvsByStudent/', data) + .then(result => { + this.listLvs = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + },*/ getMaFromLv(lv_id){ return this.$fhcApi.get('api/frontend/v1/stv/pruefung/getMitarbeiterLv/' + lv_id) .then(result => { @@ -301,7 +351,17 @@ export default{ this.$refs.pruefungModal.show(); - } + }, + onSwitchChange() { + if (this.isFilterSet) { + console.log('filter gesetzt: ' + this.defaultSemester + ' uid ' + this.uid); + this.$refs.table.setFilter("studiensemester_kurzbz", "=", this.defaultSemester); + //TODO(Manu) TypeError: this.$refs.table.setFilter is not a function + + } else { + console.log('Alle anzeigen'); + } + }, }, created(){ this.$fhcApi.get('api/frontend/v1/stv/pruefung/getLvsByStudent/' + this.uid) @@ -337,19 +397,41 @@ export default{ template: `
- aktuelles Sem: {{defaultSemester}} + + + aktuelles Sem: {{defaultSemester}}
+ current Sem: {{currentSemester}}
+
+ + + +
- - - - +

From b9911e69c547cdba3ab7448d220d7df3bcb1eea5 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 2 Oct 2024 08:58:24 +0200 Subject: [PATCH 016/335] renaming id: Tab Contact --- .../Details/Kontakt/Address.js | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js index 7c3933f01..d9cdc75b2 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js @@ -196,9 +196,9 @@ export default{ this.resetModal(); this.$refs.adressModal.show(); }, - actionEditAdress(adress_id) { + actionEditAdress(adresse_id) { this.statusNew = false; - this.loadAdress(adress_id).then(() => { + this.loadAdress(adresse_id).then(() => { if(this.addressData.adresse_id) { this.loadPlaces(this.addressData.plz); @@ -207,8 +207,8 @@ export default{ } }); }, - actionDeleteAdress(adress_id) { - this.loadAdress(adress_id).then(() => { + actionDeleteAdress(adresse_id) { + this.loadAdress(adresse_id).then(() => { if(this.addressData.adresse_id) if(this.addressData.heimatadresse) this.$fhcAlert.alertError(this.$p.t('person', 'error_deleteHomeAdress')); @@ -216,7 +216,7 @@ export default{ this.$fhcAlert .confirmDelete() .then(result => result - ? adress_id + ? adresse_id : Promise.reject({handled: true})) .then(this.deleteAddress) .catch(this.$fhcAlert.handleSystemError); @@ -238,17 +238,17 @@ export default{ reload() { this.$refs.table.reloadTable(); }, - loadAdress(adress_id) { + loadAdress(adresse_id) { this.statusNew = false; - return this.$fhcApi.factory.stv.kontakt.loadAddress(adress_id) + return this.$fhcApi.factory.stv.kontakt.loadAddress(adresse_id) .then(result => { this.addressData = result.data; return result; }) .catch(this.$fhcAlert.handleSystemError); }, - updateAddress(adress_id) { - return this.$fhcApi.factory.stv.kontakt.updateAddress(adress_id, + updateAddress(adresse_id) { + return this.$fhcApi.factory.stv.kontakt.updateAddress(adresse_id, this.addressData ).then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); @@ -260,8 +260,8 @@ export default{ this.reload(); }); }, - deleteAddress(adress_id) { - return this.$fhcApi.factory.stv.kontakt.deleteAddress(adress_id) + deleteAddress(adresse_id) { + return this.$fhcApi.factory.stv.kontakt.deleteAddress(adresse_id) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); }).catch(this.$fhcAlert.handleSystemError) From 8787558fef91b6eb9a6d886f79b45d944d9d6a97 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Tue, 22 Oct 2024 15:58:02 +0200 Subject: [PATCH 017/335] cleanUp Tasks Tab PrestudentIn --- application/config/stv.php | 22 +++ .../api/frontend/v1/stv/Config.php | 8 +- .../api/frontend/v1/stv/Prestudent.php | 12 ++ .../models/codex/Bisstandort_model.php | 14 ++ application/views/Studentenverwaltung.php | 6 +- public/js/api/stv/prestudent.js | 38 ++++ .../Studentenverwaltung/Details/Prestudent.js | 174 ++++++++++-------- .../Details/Prestudent/MultiStatus.js | 1 + 8 files changed, 198 insertions(+), 77 deletions(-) create mode 100644 application/config/stv.php create mode 100644 application/models/codex/Bisstandort_model.php diff --git a/application/config/stv.php b/application/config/stv.php new file mode 100644 index 000000000..6296e8e6b --- /dev/null +++ b/application/config/stv.php @@ -0,0 +1,22 @@ + [ + + //all fields can be configured to be hidden, see class attribute stv-prestudent-prestudent-name for name + 'hiddenFields' => [ + + //corresponding to config-entry 'ZGV_DOKTOR_ANZEIGEN' in global.config + 'zgvdoktor_code', 'zgvdoktorort', 'zgvdoktordatum', 'zgvdoktornation', 'zgvdoktor_erfuellt', + + //corresponding to config-entry 'ZGV_ERFUELLT_ANZEIGEN' in global.config + 'zgv_erfuellt', 'zgvmas_erfuellt','zgvdoktor_erfuellt', + + //propably used by FH-Communities + 'aufnahmeschluessel', 'standort_code', 'facheinschlaegigBerufstaetig' + + ], + 'hideUDFs' => false + ] +]; \ No newline at end of file diff --git a/application/controllers/api/frontend/v1/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php index c28c49485..97477fca7 100644 --- a/application/controllers/api/frontend/v1/stv/Config.php +++ b/application/controllers/api/frontend/v1/stv/Config.php @@ -46,11 +46,16 @@ class Config extends FHCAPI_Controller 'stv', 'konto' ]); + + // Load Config + $this->load->config('stv'); } public function student() { $result = []; + $config = $this->config->item('tabs'); + $result['details'] = [ 'title' => $this->p->t('stv', 'tab_details'), 'component' => './Stv/Studentenverwaltung/Details/Details.js' @@ -69,7 +74,8 @@ class Config extends FHCAPI_Controller ]; $result['prestudent'] = [ 'title' => $this->p->t('stv', 'tab_prestudent'), - 'component' => './Stv/Studentenverwaltung/Details/Prestudent.js' + 'component' => './Stv/Studentenverwaltung/Details/Prestudent.js', + 'config' => $config['prestudent'] ]; $result['status'] = [ 'title' => 'Status', diff --git a/application/controllers/api/frontend/v1/stv/Prestudent.php b/application/controllers/api/frontend/v1/stv/Prestudent.php index ef9aeb111..0b06b9667 100644 --- a/application/controllers/api/frontend/v1/stv/Prestudent.php +++ b/application/controllers/api/frontend/v1/stv/Prestudent.php @@ -19,6 +19,7 @@ class Prestudent extends FHCAPI_Controller 'getAufmerksamdurch' => ['admin:r', 'assistenz:r'], 'getBerufstaetigkeit' => ['admin:r', 'assistenz:r'], 'getTypenStg' => ['admin:r', 'assistenz:r'], + 'getBisstandort' => ['admin:r', 'assistenz:r'], 'getStudienplaene' => ['admin:r', 'assistenz:r'], 'getStudiengang' => ['admin:r', 'assistenz:r'] ]); @@ -265,6 +266,17 @@ class Prestudent extends FHCAPI_Controller return $this->terminateWithSuccess(getData($result) ?: []); } + public function getBisstandort() + { + $this->load->model('codex/Bisstandort_model', 'BisstandortModel'); + + $result = $this->BisstandortModel->load(); + if (isError($result)) { + $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); + } + return $this->terminateWithSuccess(getData($result) ?: []); + } + public function getStudienplaene($prestudent_id) { $this->load->model('organisation/Studienplan_model', 'StudienplanModel'); diff --git a/application/models/codex/Bisstandort_model.php b/application/models/codex/Bisstandort_model.php new file mode 100644 index 000000000..9c7e9e45b --- /dev/null +++ b/application/models/codex/Bisstandort_model.php @@ -0,0 +1,14 @@ +dbTable = 'bis.tbl_bisstandort'; + $this->pk = 'standort_code'; + } +} diff --git a/application/views/Studentenverwaltung.php b/application/views/Studentenverwaltung.php index 2d0d22346..c8d9dc3f7 100644 --- a/application/views/Studentenverwaltung.php +++ b/application/views/Studentenverwaltung.php @@ -34,8 +34,10 @@ !defined('GENERATE_ALIAS_STUDENT') ? true : GENERATE_ALIAS_STUDENT, - 'showZgvDoktor' => !defined('ZGV_DOKTOR_ANZEIGEN') ? false : ZGV_DOKTOR_ANZEIGEN, - 'showZgvErfuellt' => !defined('ZGV_ERFUELLT_ANZEIGEN') ? false : ZGV_ERFUELLT_ANZEIGEN + + //replaced by possibility to hide each formular field via config stv.php + #'showZgvDoktor' => !defined('ZGV_DOKTOR_ANZEIGEN') ? false : ZGV_DOKTOR_ANZEIGEN, + #'showZgvErfuellt' => !defined('ZGV_ERFUELLT_ANZEIGEN') ? false : ZGV_ERFUELLT_ANZEIGEN ]; ?> diff --git a/public/js/api/stv/prestudent.js b/public/js/api/stv/prestudent.js index 4e97759f4..dd90880c5 100644 --- a/public/js/api/stv/prestudent.js +++ b/public/js/api/stv/prestudent.js @@ -1,5 +1,43 @@ export default { +//------------- Prestudent.js------------------------------------------------------ + + get(prestudent_id){ + return this.$fhcApi.post('api/frontend/v1/stv/prestudent/get/' + prestudent_id); + }, + updatePrestudent(prestudent_id, data){ + return this.$fhcApi.post('api/frontend/v1/stv/prestudent/updatePrestudent/' + prestudent_id, + data + ); + }, + getBezeichnungZGV() { + return this.$fhcApi.get('api/frontend/v1/stv/prestudent/getBezeichnungZGV/'); + }, + getBezeichnungMZgv() { + return this.$fhcApi.get('api/frontend/v1/stv/prestudent/getBezeichnungMZgv/'); + }, + getBezeichnungDZgv() { + return this.$fhcApi.get('api/frontend/v1/stv/prestudent/getBezeichnungDZgv/'); + }, + getStgs() { + return this.$fhcApi.get('api/frontend/v1/stv/lists/getStgs/'); + }, + getAusbildung() { + return this.$fhcApi.get('api/frontend/v1/stv/prestudent/getAusbildung/'); + }, + getAufmerksamdurch() { + return this.$fhcApi.get('api/frontend/v1/stv/prestudent/getAufmerksamdurch/'); + }, + getBerufstaetigkeit() { + return this.$fhcApi.get('api/frontend/v1/stv/prestudent/getBerufstaetigkeit/'); + }, + getTypenStg() { + return this.$fhcApi.get('api/frontend/v1/stv/prestudent/getTypenStg/'); + }, + getBisstandort() { + return this.$fhcApi.get('api/frontend/v1/stv/prestudent/getBisstandort/'); + }, + //------------- MultiStatus.js------------------------------------------------------ getHistoryPrestudent (url, config, params){ diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js index e6db926cc..46edeaaf9 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js @@ -15,14 +15,6 @@ export default { lists: { from: 'lists' }, - showZgvErfuellt: { - from: 'configShowZgvErfuellt', - default: false - }, - showZgvDoktor: { - from: 'configShowZgvDoktor', - default: false - }, hasPrestudentPermission: { from: 'hasPrestudentPermission', default: false @@ -41,6 +33,10 @@ export default { }, props: { modelValue: Object, + config: { + type: Object, + default: {} + } }, data() { return { @@ -58,6 +54,7 @@ export default { { text: 'Nein', value: false } ], listStgTyp: [], + listBisStandort: [], initialFormData: {}, deltaArray: {}, actionUpdate: false @@ -91,8 +88,7 @@ export default { methods: { loadPrestudent() { - this.$fhcApi - .get('api/frontend/v1/stv/prestudent/get/' + this.modelValue.prestudent_id) + return this.$fhcApi.factory.stv.prestudent.get(this.modelValue.prestudent_id) .then(result => result.data) .then(result => { this.data = result; @@ -105,8 +101,7 @@ export default { this.initialFormData = {...(this.initialFormData || {}), ...udfs}; }, updatePrestudent(){ - this.$refs.form - .post('api/frontend/v1/stv/prestudent/updatePrestudent/' + this.modelValue.prestudent_id, this.deltaArray) + return this.$fhcApi.factory.stv.prestudent.updatePrestudent(this.modelValue.prestudent_id, this.deltaArray) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.deltaArray = []; @@ -120,62 +115,60 @@ export default { }, created() { this.loadPrestudent(); - this.$fhcApi - .get('api/frontend/v1/stv/prestudent/getBezeichnungZGV') + this.$fhcApi.factory.stv.prestudent.getBezeichnungZGV() .then(result => result.data) .then(result => { this.listZgvs = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/prestudent/getBezeichnungMZgv') + this.$fhcApi.factory.stv.prestudent.getBezeichnungMZgv() .then(result => result.data) .then(result => { this.listZgvsmaster = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/prestudent/getBezeichnungDZgv') + this.$fhcApi.factory.stv.prestudent.getBezeichnungDZgv() .then(result => result.data) .then(result => { this.listZgvsdoktor = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/lists/getStgs') + this.$fhcApi.factory.stv.prestudent.getStgs() .then(result => result.data) .then(result => { this.listStgs = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/prestudent/getAusbildung') + this.$fhcApi.factory.stv.prestudent.getAusbildung() .then(result => result.data) .then(result => { this.listAusbildung = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/prestudent/getAufmerksamdurch') + this.$fhcApi.factory.stv.prestudent.getAufmerksamdurch() .then(result => result.data) .then(result => { this.listAufmerksamdurch = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/prestudent/getBerufstaetigkeit') + this.$fhcApi.factory.stv.prestudent.getBerufstaetigkeit() .then(result => result.data) .then(result => { this.listBerufe = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/prestudent/getTypenStg') + this.$fhcApi.factory.stv.prestudent.getTypenStg() .then(result => result.data) .then(result => { this.listStgTyp = result; }) .catch(this.$fhcAlert.handleSystemError); + this.$fhcApi.factory.stv.prestudent.getBisstandort() + .then(result => result.data) + .then(result => { + this.listBisStandort = result; + }) + .catch(this.$fhcAlert.handleSystemError); }, template: `

@@ -187,7 +180,8 @@ export default { {{$p.t('lehre', 'title_zgv')}} {{modelValue.nachname}} {{modelValue.vorname}}
{{zgv.zgv_bez}}
{{mzgv.zgvmas_bez}}
-
+
{{zgv.zgvdoktor_bez}}
-
+
-
+
PrestudentIn
{{adurch.beschreibung}} {{beruf.berufstaetigkeit_bez}}
- ` + /* TODO(chris): Ausgeblendet für Testing
- - - + +
- */` - +
- + - +
- ` + /* TODO(chris): Ausgeblendet für Testing + - */`
- + +
diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js index 6935810b1..1c2c37ec6 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js @@ -154,6 +154,7 @@ export default{ layoutColumnsOnNewData: false, height: 'auto', selectable: false, + //TODO(Manu) define Persistence Id to avoid empty result array if sort index not corresponding }, tabulatorEvents: [ { From e2839972939848fd888271dc9e43f8d93f28447a Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 23 Oct 2024 14:26:33 +0200 Subject: [PATCH 018/335] cleanUp Tasks Tab Details --- application/config/stv.php | 8 +- .../api/frontend/v1/stv/Config.php | 3 +- .../api/frontend/v1/stv/Student.php | 8 +- public/js/api/stv.js | 2 + public/js/api/stv/details.js | 10 + .../Studentenverwaltung/Details/Details.js | 176 ++++++++++------- system/phrasesupdate.php | 183 +++++++++++++++++- 7 files changed, 312 insertions(+), 78 deletions(-) create mode 100644 public/js/api/stv/details.js diff --git a/application/config/stv.php b/application/config/stv.php index 6296e8e6b..8b7792e83 100644 --- a/application/config/stv.php +++ b/application/config/stv.php @@ -2,9 +2,15 @@ $config['tabs'] = [ + 'details' => [ + //all fields can be configured to be hidden, see class attribute stv-details-details-name for name + 'hiddenFields' => [], + 'hideUDFs' => false + ], + 'prestudent' => [ - //all fields can be configured to be hidden, see class attribute stv-prestudent-prestudent-name for name + //all fields can be configured to be hidden, see class attribute stv-details-prestudent-name for name 'hiddenFields' => [ //corresponding to config-entry 'ZGV_DOKTOR_ANZEIGEN' in global.config diff --git a/application/controllers/api/frontend/v1/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php index 97477fca7..fd318a79f 100644 --- a/application/controllers/api/frontend/v1/stv/Config.php +++ b/application/controllers/api/frontend/v1/stv/Config.php @@ -58,7 +58,8 @@ class Config extends FHCAPI_Controller $result['details'] = [ 'title' => $this->p->t('stv', 'tab_details'), - 'component' => './Stv/Studentenverwaltung/Details/Details.js' + 'component' => './Stv/Studentenverwaltung/Details/Details.js', + 'config' => $config['details'] ]; $result['notes'] = [ 'title' => $this->p->t('stv', 'tab_notes'), diff --git a/application/controllers/api/frontend/v1/stv/Student.php b/application/controllers/api/frontend/v1/stv/Student.php index 89c317ae4..f805be88a 100644 --- a/application/controllers/api/frontend/v1/stv/Student.php +++ b/application/controllers/api/frontend/v1/stv/Student.php @@ -55,7 +55,7 @@ class Student extends FHCAPI_Controller // Load language phrases $this->loadPhrases([ - 'ui' + 'ui', 'lehre' ]); } @@ -223,12 +223,10 @@ class Student extends FHCAPI_Controller // Check PKs if (count($update_lehrverband) + count($update_student) && $uid === null) { - // TODO(chris): phrase - $this->terminateWithValidationErrors(['' => "Kein/e StudentIn vorhanden!"]); + $this->terminateWithValidationErrors(['' => $this->p->t('lehre', 'error_no_student')]); } if (count($update_person) && $person_id === null) { - // TODO(chris): phrase - $this->terminateWithValidationErrors(['' => "Keine Person vorhanden!"]); + $this->terminateWithValidationErrors(['' => $this->p->t('lehre', 'error_no_person')]); } // Do Updates diff --git a/public/js/api/stv.js b/public/js/api/stv.js index 5a8316916..b66ae401e 100644 --- a/public/js/api/stv.js +++ b/public/js/api/stv.js @@ -5,6 +5,7 @@ import konto from './stv/konto.js'; import kontakt from './stv/kontakt.js'; import prestudent from './stv/prestudent.js'; import status from './stv/status.js'; +import details from './stv/details.js'; export default { verband, @@ -14,6 +15,7 @@ export default { kontakt, prestudent, status, + details, configStudent() { return this.$fhcApi.get('api/frontend/v1/stv/config/student'); }, diff --git a/public/js/api/stv/details.js b/public/js/api/stv/details.js new file mode 100644 index 000000000..bdf26739b --- /dev/null +++ b/public/js/api/stv/details.js @@ -0,0 +1,10 @@ +export default { + get(prestudent_id) { + return this.$fhcApi.post('api/frontend/v1/stv/student/get/' + prestudent_id); + }, + save(prestudent_id, data) { + return this.$fhcApi.post('api/frontend/v1/stv/student/save/' + prestudent_id, + data + ); + }, +} diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Details.js b/public/js/components/Stv/Studentenverwaltung/Details/Details.js index ae4f92b20..34ab779ac 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Details.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Details.js @@ -37,7 +37,11 @@ export default { } }, props: { - modelValue: Object + modelValue: Object, + config: { + type: Object, + default: {} + } }, data() { return { @@ -95,8 +99,7 @@ export default { methods: { updateStudent(n) { // TODO(chris): move to fhcapi.factory - this.$fhcApi - .get('api/frontend/v1/stv/student/get/' + n.prestudent_id) + return this.$fhcApi.factory.stv.details.get(n.prestudent_id) .then(result => { this.data = result.data; if (!this.data.familienstand) @@ -110,14 +113,13 @@ export default { return; this.$refs.form.clearValidation(); - this.$refs.form - .post('api/frontend/v1/stv/student/save/' + this.modelValue.prestudent_id, this.changed) + return this.$fhcApi.factory.stv.details.save(this.modelValue.prestudent_id, this.changed) .then(result => { this.original = {...this.data}; this.changed = {}; this.$refs.form.setFeedback(true, result.data); }) - .catch(this.$fhcAlert.handleSystemError) + .catch(this.$fhcAlert.handleSystemError); }, udfsLoaded(udfs) { this.original = {...(this.original || {}), ...udfs}; @@ -141,16 +143,17 @@ export default {
- Loading... + {{$p.t('ui', 'dropdownLoading')}}...
- Loading... + {{$p.t('ui', 'dropdownLoading')}}...
` diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js index d9cdc75b2..7a24c03ff 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js @@ -62,7 +62,7 @@ export default{ {title:"Adresse_id", field:"adresse_id", visible:false}, {title:"Person_id", field:"person_id", visible:false}, {title:"Name", field:"name", visible:false}, - {title:"letzte Änderung", field:"updateamum", visible:false}, + {title:"letzte Änderung", field:"lastupdate", visible:false}, {title:"Rechnungsadresse", field:"rechnungsadresse", visible:false, formatter: (cell, formatterParams, onRendered) => { let output = cell.getValue() ? this.$p.t('ui','ja') : this.$p.t('ui','nein'); @@ -89,9 +89,14 @@ export default{ button.className = 'btn btn-outline-secondary btn-action'; button.innerHTML = ''; button.title = this.$p.t('person', 'adresse_delete'); - button.addEventListener('click', () => - this.actionDeleteAdress(cell.getData().adresse_id) - ); + + button.addEventListener('click', () => { + if (cell.getData().heimatadresse) + this.$fhcAlert.alertError(this.$p.t('person', 'error_deleteHomeAdress')); + else + this.actionDeleteAdress(cell.getData().adresse_id) + }); + container.append(button); return container; @@ -134,6 +139,9 @@ export default{ cm.getColumnByField('heimatadresse').component.updateDefinition({ title: this.$p.t('person', 'heimatadresse') }); + cm.getColumnByField('zustelladresse').component.updateDefinition({ + title: this.$p.t('person', 'zustelladresse') + }); cm.getColumnByField('co_name').component.updateDefinition({ title: this.$p.t('person', 'co_name') }); @@ -143,7 +151,7 @@ export default{ cm.getColumnByField('firmenname').component.updateDefinition({ title: this.$p.t('person', 'firma') }); - cm.getColumnByField('updateamum').component.updateDefinition({ + cm.getColumnByField('lastupdate').component.updateDefinition({ title: this.$p.t('notiz', 'letzte_aenderung') }); cm.getColumnByField('rechnungsadresse').component.updateDefinition({ @@ -152,6 +160,18 @@ export default{ cm.getColumnByField('anmerkung').component.updateDefinition({ title: this.$p.t('global', 'anmerkung') }); + cm.getColumnByField('firma_id').component.updateDefinition({ + title: this.$p.t('ui', 'firma_id') + }); + cm.getColumnByField('adresse_id').component.updateDefinition({ + title: this.$p.t('ui', 'adresse_id') + }); + cm.getColumnByField('person_id').component.updateDefinition({ + title: this.$p.t('person', 'person_id') + }); + cm.getColumnByField('actions').component.updateDefinition({ + title: this.$p.t('global', 'aktionen') + }); } } ], @@ -160,7 +180,9 @@ export default{ heimatadresse: true, rechnungsadresse: false, typ: 'h', - nation: 'A' + nation: 'A', + address: {plz: null}, + plz: null }, statusNew: true, places: [], @@ -201,37 +223,33 @@ export default{ this.loadAdress(adresse_id).then(() => { if(this.addressData.adresse_id) { - this.loadPlaces(this.addressData.plz); + this.addressData.address.plz = this.addressData.plz; + // delete this.addressData.plz; + this.loadPlaces(this.addressData.address.plz); this.$refs.adressModal.show(); } }); }, actionDeleteAdress(adresse_id) { - this.loadAdress(adresse_id).then(() => { - if(this.addressData.adresse_id) - if(this.addressData.heimatadresse) - this.$fhcAlert.alertError(this.$p.t('person', 'error_deleteHomeAdress')); - else { - this.$fhcAlert - .confirmDelete() - .then(result => result - ? adresse_id - : Promise.reject({handled: true})) - .then(this.deleteAddress) - .catch(this.$fhcAlert.handleSystemError); - } - }); + this.$fhcAlert + .confirmDelete() + .then(result => result + ? adresse_id + : Promise.reject({handled: true})) + .then(this.deleteAddress) + .catch(this.$fhcAlert.handleSystemError); }, addNewAddress(addressData) { - return this.$fhcApi.factory.stv.kontakt.addNewAddress(this.uid, this.addressData) + this.addressData.plz = this.addressData.address.plz; + return this.$refs.addressData.factory.stv.kontakt.addNewAddress(this.uid, this.addressData) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.hideModal('adressModal'); this.resetModal(); }).catch(this.$fhcAlert.handleSystemError) .finally(() => { - window.scrollTo(0, 0); + //window.scrollTo(0, 0); this.reload(); }); }, @@ -242,13 +260,18 @@ export default{ this.statusNew = false; return this.$fhcApi.factory.stv.kontakt.loadAddress(adresse_id) .then(result => { - this.addressData = result.data; - return result; + this.addressData = result.data; + this.addressData.address = {}; + this.addressData.address.plz = this.addressData.plz || null; + // delete this.addressData.plz; + return result; }) .catch(this.$fhcAlert.handleSystemError); }, updateAddress(adresse_id) { - return this.$fhcApi.factory.stv.kontakt.updateAddress(adresse_id, + //TODO(Manu) buggy with relad, warning/error: e.element.after is not a function + this.addressData.plz = this.addressData.address.plz; + return this.$refs.addressData.factory.stv.kontakt.updateAddress(adresse_id, this.addressData ).then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); @@ -256,7 +279,7 @@ export default{ this.resetModal(); }).catch(this.$fhcAlert.handleSystemError) .finally(() => { - window.scrollTo(0, 0); + //window.scrollTo(0, 0); this.reload(); }); }, @@ -271,23 +294,17 @@ export default{ }); }, loadPlaces() { - //TODO(Manu) check with chris if its okay without abortion controller -/* if (this.abortController.places) - this.abortController.places.abort();*/ - if (this.addressData.nation != 'A' || !this.addressData.plz) + if (this.abortController.places) + this.abortController.places.abort(); + if (this.addressData.nation != 'A' || !this.addressData.address.plz) return; - //this.abortController.places = new AbortController(); - return this.$fhcApi.factory.stv.kontakt.getPlaces(this.addressData.plz) + this.abortController.places = new AbortController(); + + return this.$refs.addressData.factory.stv.kontakt.getPlaces(this.addressData.address.plz) .then(result => { this.places = result.data; }); -/* .catch(error => { - if (error.code != "ERR_CANCELED") - window.setTimeout(this.loadPlaces, 100); - else - this.$fhcAlert.handleSystemError(error); - });*/ }, search(event) { return this.$fhcApi.factory.stv.kontakt.getFirmen(event.query) @@ -311,7 +328,7 @@ export default{ this.addressData.anmerkung = null; this.addressData.typ = 'h'; this.addressData.nation = 'A'; - this.addressData.plz = null; + this.addressData.address = {plz: null}; this.statusNew = true; }, @@ -388,9 +405,9 @@ export default{
@@ -418,6 +435,7 @@ export default{ v-else type="text" name="addressData.gemeinde" + :label="$p.t('person/gemeinde')" v-model="addressData.gemeinde" > @@ -444,6 +462,7 @@ export default{ v-else type="text" name="ort" + :label="$p.t('person/ort')" v-model="addressData.ort" > @@ -562,7 +581,7 @@ export default{ diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Bankaccount.js b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Bankaccount.js index fbb9b4a8b..140104038 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Bankaccount.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Bankaccount.js @@ -36,10 +36,10 @@ export default{ let output; switch(cell.getValue()){ case "p": - output = "Privatkonto"; + output = this.$p.t('person', 'privatkonto'); break; case "f": - output = "Firmenkonto"; + output = this.$p.t('person', 'firmenkonto'); break; default: output = cell.getValue(); @@ -110,7 +110,6 @@ export default{ cm.getColumnByField('typ').component.updateDefinition({ title: this.$p.t('global', 'typ') }); - cm.getColumnByField('anschrift').component.updateDefinition({ title: this.$p.t('person', 'anschrift') }); @@ -120,10 +119,18 @@ export default{ cm.getColumnByField('blz').component.updateDefinition({ title: this.$p.t('person', 'blz') }); - cm.getColumnByField('verrechnung').component.updateDefinition({ title: this.$p.t('person', 'verrechnung') }); + cm.getColumnByField('person_id').component.updateDefinition({ + title: this.$p.t('person', 'person_id') + }); + cm.getColumnByField('bankverbindung_id').component.updateDefinition({ + title: this.$p.t('ui', 'bankverbindung_id') + }); + cm.getColumnByField('actions').component.updateDefinition({ + title: this.$p.t('global', 'aktionen') + }); } } ], @@ -153,18 +160,16 @@ export default{ }); }, actionDeleteBankverbindung(bankverbindung_id){ - this.loadBankverbindung(bankverbindung_id).then(() => { - this.$fhcAlert - .confirmDelete() - .then(result => result - ? bankverbindung_id - : Promise.reject({handled: true})) - .then(this.deleteBankverbindung) - .catch(this.$fhcAlert.handleSystemError); - }); + this.$fhcAlert + .confirmDelete() + .then(result => result + ? bankverbindung_id + : Promise.reject({handled: true})) + .then(this.deleteBankverbindung) + .catch(this.$fhcAlert.handleSystemError); }, addNewBankverbindung(bankverbindungData) { - return this.$fhcApi.factory.stv.kontakt.addNewBankverbindung(this.uid, this.bankverbindungData) + return this.$refs.bankverbindungData.factory.stv.kontakt.addNewBankverbindung(this.uid, this.bankverbindungData) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.hideModal('bankverbindungModal'); @@ -186,7 +191,7 @@ export default{ .catch(this.$fhcAlert.handleSystemError); }, updateBankverbindung(bankverbindung_id){ - return this.$fhcApi.factory.stv.kontakt.updateBankverbindung(bankverbindung_id, + return this.$refs.bankverbindungData.factory.stv.kontakt.updateBankverbindung(bankverbindung_id, this.bankverbindungData) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); @@ -234,7 +239,7 @@ export default{
- +