diff --git a/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php b/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php index 8bad59d38..ba1b81b17 100644 --- a/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php +++ b/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php @@ -159,7 +159,8 @@ class reviewAnrechnungUebersicht extends Auth_Controller foreach ($data as $item) { // Approve Anrechnung - if(getData($this->anrechnunglib->dontRecommendAnrechnung($item['anrechnung_id']))) + if(getData($this->anrechnunglib + ->dontRecommendAnrechnung($item['anrechnung_id'], $item['begruendung']))) { $json[]= array( 'anrechnung_id' => $item['anrechnung_id'], diff --git a/application/libraries/AnrechnungLib.php b/application/libraries/AnrechnungLib.php index d86dbbef0..0f6e2d5ae 100644 --- a/application/libraries/AnrechnungLib.php +++ b/application/libraries/AnrechnungLib.php @@ -10,6 +10,9 @@ class AnrechnungLib const ANRECHNUNGSTATUS_APPROVED = 'approved'; const ANRECHNUNGSTATUS_REJECTED = 'rejected'; + const ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_LEKTOR = 'AnrechnungNotizLektor'; + const ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_STGL = 'AnrechnungNotizSTGL'; + public function __construct() { $this->ci =& get_instance(); @@ -442,7 +445,7 @@ class AnrechnungLib * @return array * @throws Exception */ - public function dontRecommendAnrechnung($anrechnung_id) + public function dontRecommendAnrechnung($anrechnung_id, $begruendung) { // Check last Anrechnungstatus if (!$result = getData($this->ci->AnrechnungModel->getLastAnrechnungstatus($anrechnung_id))[0]) @@ -476,6 +479,15 @@ class AnrechnungLib ) ); + // Add begruendung as notiz + $this->ci->load->model('person/Notiz_model', 'NotizModel'); + $this->ci->NotizModel->addNotizForAnrechnung( + $anrechnung_id, + self::ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_LEKTOR, + $begruendung, + $lektor_uid + ); + // Transaction complete $this->ci->db->trans_complete(); diff --git a/application/models/person/Notiz_model.php b/application/models/person/Notiz_model.php index a5453aaa1..6c67f60a5 100644 --- a/application/models/person/Notiz_model.php +++ b/application/models/person/Notiz_model.php @@ -158,6 +158,65 @@ class Notiz_model extends DB_Model return $this->loadWhere(array('person_id' => $person_id, 'titel LIKE' => $titel)); } + + /** + * Add a Notiz for a given Anrechnung + * @param $anrechnung_id + * @param $titel + * @param $text + * @param $verfasser_uid + * @return array + */ + public function addNotizForAnrechnung($anrechnung_id, $titel, $text, $verfasser_uid) + { + // Loads model Notizzuordnung_model + $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); + + // Start DB transaction + $this->db->trans_start(false); + + $result = $this->insert(array( + 'titel' => $titel, + 'text' => $text, + 'erledigt' => true, + 'verfasser_uid' => $verfasser_uid, + "insertvon" => $verfasser_uid + )); + + if (isSuccess($result)) + { + $notiz_id = $result->retval; + $result = $this->NotizzuordnungModel->insert(array('notiz_id' => $notiz_id, 'anrechnung_id' => $anrechnung_id)); + } + + // Transaction complete! + $this->db->trans_complete(); + + // Check if everything went ok during the transaction + if ($this->db->trans_status() === false || isError($result)) + { + $this->db->trans_rollback(); + $result = error($result->msg, EXIT_ERROR); + } + else + { + $this->db->trans_commit(); + $result = success($notiz_id); + } + + return $result; + } + + /** + * gets all Notizen for a person + * @param $person_id + */ + public function getNotizByAnrechnung($anrechnung_id) + { + $this->addJoin('public.tbl_notizzuordnung', 'notiz_id'); + + return $this->loadWhere(array('anrechnung' => $anrechnung_id)); + } // ------------------------------------------------------------------------------------------------------ } diff --git a/application/views/lehre/anrechnung/reviewAnrechnungUebersicht.php b/application/views/lehre/anrechnung/reviewAnrechnungUebersicht.php index c52fa75ea..0da952f5f 100644 --- a/application/views/lehre/anrechnung/reviewAnrechnungUebersicht.php +++ b/application/views/lehre/anrechnung/reviewAnrechnungUebersicht.php @@ -12,14 +12,14 @@ $this->load->view( 'dialoglib' => true, 'tablewidget' => true, 'phrases' => array( - 'global' => array( - 'begruendung' - ), - 'anrechnung' => array( - 'nachweisdokumente', - 'empfehlung', - 'herkunft' - ), + 'global' => array( + 'begruendung' + ), + 'anrechnung' => array( + 'nachweisdokumente', + 'empfehlung', + 'herkunft' + ), 'ui' => array( 'anzeigen', 'alleAnzeigen', @@ -34,15 +34,15 @@ $this->load->view( 'tabelleneinstellungen', 'keineDatenVorhanden', 'spaltenEinstellen', - 'ja', - 'nein', - 'nichtSelektierbarAufgrundVon' + 'ja', + 'nein', + 'nichtSelektierbarAufgrundVon' ), 'person' => array( 'student', 'personenkennzeichen', - 'vorname', - 'nachname' + 'vorname', + 'nachname' ), 'lehre' => array( 'studiensemester', @@ -64,7 +64,7 @@ $this->load->view( 'zeilenAuswaehlenEinzeln', 'zeilenAuswaehlenBereich', 'zeilenAuswaehlenAlle' - ) + ) ), 'customJSs' => array( 'public/js/bootstrapper.js', @@ -76,16 +76,16 @@ $this->load->view(
-
- -
- +
@@ -104,14 +104,54 @@ $this->load->view( ); ?>
- +
- load->view('lehre/anrechnung/reviewAnrechnungUebersichtData.php'); ?> + load->view('lehre/anrechnung/reviewAnrechnungUebersichtData.php'); ?> +
+
+ + +
+
@@ -123,37 +163,44 @@ $this->load->view(
- +
- - + +
- + diff --git a/public/js/lehre/anrechnung/reviewAnrechnung.js b/public/js/lehre/anrechnung/reviewAnrechnung.js index 90865ade5..7bf34ef81 100644 --- a/public/js/lehre/anrechnung/reviewAnrechnung.js +++ b/public/js/lehre/anrechnung/reviewAnrechnung.js @@ -230,14 +230,36 @@ $(function(){ ); }); - // Dont recommend Anrechnungen + // Dont recommend Anrechnungen (Overview GUI) $("#dont-recommend-anrechnungen").click(function(){ - // Get selected rows data + + let begruendung_panel = $('#reviewAnrechnungUebersicht-begruendung-panel'); + let begruendung = $('#reviewAnrechnungUebersicht-begruendung').val(); + + + if (begruendung_panel.is(":hidden")) + { + // Show begruendung panel if is hidden + begruendung_panel.slideDown('slow'); + return; + } + else + { + // Check if begruendung is given + if (!begruendung.trim()) // empty or white spaces only + { + FHC_DialogLib.alertInfo('Bitte tragen Sie eine Begründung ein.'); + return; + } + } + + // Get selected rows data and add begruendung let selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData') .map(function(data){ // reduce to necessary fields return { 'anrechnung_id' : data.anrechnung_id, + 'begruendung' : begruendung } }); @@ -259,6 +281,9 @@ $(function(){ 'data': selected_data }; + // Hide begruendung panel again + $(begruendung_panel).slideUp('slow'); + FHC_AjaxClient.ajaxCallPost( FHC_JS_DATA_STORAGE_OBJECT.called_path + "/dontRecommend", data, @@ -288,6 +313,17 @@ $(function(){ ); }); + // Break Begruendung abgeben + $('#reviewAnrechnungUebersicht-begruendung-abbrechen').click(function(){ + $('#reviewAnrechnungUebersicht-begruendung').val(''); + $('#reviewAnrechnungUebersicht-begruendung-panel').slideUp('slow'); + + }) + + // Copy Begruendung into textarea + $(".btn-copyIntoTextarea").click(function(){ + reviewAnrechnung.copyIntoTextarea(this); + }) }); var reviewAnrechnung = { @@ -307,5 +343,13 @@ var reviewAnrechnung = { default: $('#reviewAnrechnung-status_kurzbz').closest('div').addClass('alert-warning'); } + }, + copyIntoTextarea: function(elem){ + + // Find closest textarea + let textarea = $(elem).closest('div').find('textarea'); + + // Copy begruendung into textarea + textarea.val($.trim($(elem).parent().text())); } } \ No newline at end of file diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 72a5bbb3e..32d22b789 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -8788,6 +8788,186 @@ Any unusual occurrences 'insertvon' => 'system' ) ) + ), + array( + 'app' => 'core', + 'category' => 'anrechnung', + 'phrase' => 'empfehlungPositiv', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Anrechnung wird empfohlen, weil die Kenntnisse inhaltlich und umfangmäßig gleichwertig sind.', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Recommendation date', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'anrechnung', + 'phrase' => 'empfehlungNegativPruefungNichtMoeglich', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Anrechnung wird nicht empfohlen, weil die Prüfung der Gleichwertigkeit aus formalen Gründen (z.B. mangelhafte Unterlagen) nicht möglich war.', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => '', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'anrechnung', + 'phrase' => 'empfehlungNegativKenntnisseNichtGleichwertig', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Anrechnung wird nicht empfohlen, weil die Kenntnisse inhaltlich und umfangmäßig nicht gleichwertig sind.', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => '', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'anrechnung', + 'phrase' => 'empfehlungdatum', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Empfehlungsdatum', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => '', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'textUebernehmen', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Text übernehmen', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Use this text', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'anrechnung', + 'phrase' => 'bitteBegruendungAngeben', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Bitte geben Sie eine Begründung für die Ablehnung an', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Please give a reason why you do not recommend to approve this applications', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'anrechnung', + 'phrase' => 'moeglicheBegruendungen', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Mögliche Begründungen', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Possible reasons', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'anrechnung', + 'phrase' => 'andereBegruendung', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Andere Begründung', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Other reason', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'anrechnung', + 'phrase' => 'begruendungWirdFuerAlleUebernommen', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Die Begründung wird für alle gewählten Anträge übernommen.', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'This reason will be used for all of the selected applications.', + 'description' => '', + 'insertvon' => 'system' + ) + ) ) );