diff --git a/application/controllers/jobs/AnrechnungJob.php b/application/controllers/jobs/AnrechnungJob.php index 7aae80d54..b442c7e56 100644 --- a/application/controllers/jobs/AnrechnungJob.php +++ b/application/controllers/jobs/AnrechnungJob.php @@ -37,6 +37,9 @@ class AnrechnungJob extends JOB_Controller $this->load->helper('hlp_sancho_helper'); $this->load->library('AnrechnungLib'); + + // Load configs + $this->load->config('anrechnung'); } /** @@ -227,6 +230,82 @@ class AnrechnungJob extends JOB_Controller $this->logInfo('SUCCEDED: Sending emails to STGL about yesterdays new Anrechnungen succeded.'); } + // Send Sancho mail to LV-Leitung (fallback Lectors) that were requested for recommendation yesterday. + public function sendMailRecommendationRequests(){ + + $this->logInfo('Start AnrechnungJob sendMailRecommendationRequests to inform lecturers about yesterdays requests for recommendation.'); + + // Get Anrechnungen, für die gestern eine Empfehlung angefragt worden ist + $this->AnrechnungModel->addSelect('astat.anrechnung_id, astat.datum, astat.insertamum'); + $this->AnrechnungModel->addDistinct('astat.anrechnung_id'); + $this->AnrechnungModel->addJoin('lehre.tbl_anrechnung_anrechnungstatus astat', 'anrechnung_id'); + + $result = $this->AnrechnungModel->loadWhere(' + studiensemester_kurzbz = (SELECT studiensemester_kurzbz FROM tbl_studiensemester WHERE now()::date BETWEEN start AND ende) + AND genehmigt_von IS NULL + AND empfehlung_anrechnung IS NULL + AND status_kurzbz = '. $this->db->escape(self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR) .' -- in Bearbeitung durch Lektor + AND NOW()::date = (astat.datum + interval \'1 day\') -- nur gestrige Empfehlungsanfrage + ORDER BY astat.anrechnung_id, astat.datum DESC, astat.insertamum DESC -- nur letzten status dabei prüfen + '); + + // Exit, wenn es gestern keine Empfehlungsanfragen gab + if (!hasData($result)) + { + $this->logInfo('End AnrechnungJob sendMailRecommendationRequests, because no recommendations were requested yesterday.'); + exit; + } + + $anrechnung_id_arr = array_column(getData($result), 'anrechnung_id'); + + $arr_lvLector_arr = array(); + foreach ($anrechnung_id_arr as $anrechnung_id) + { + // Get full name of Fachbereichsleitung or LV Leitung. + if($this->config->item('fbl') === TRUE) + { + $arr_lvLector_arr[] = $this->anrechnunglib->getLeitungOfLvOe($anrechnung_id); + } + else + { + $arr_lvLector_arr[] = $this->anrechnunglib->getLectors($anrechnung_id); // Returns LV Leitung. If not present, then all lectors of LV. + } + } + + // Unique lector array to send only one mail per lector + $arr_lvLector_arr = array_unique($arr_lvLector_arr, SORT_REGULAR); + + // Link to 'Anrechnungen prüfen' dashboard + $url = + CIS_ROOT. 'cis/index.php?menu='. + CIS_ROOT. 'cis/menu.php?content_id=&content='. + CIS_ROOT. index_page(). self::REVIEW_ANRECHNUNG_URI; + + foreach ($arr_lvLector_arr as $lvLector_arr) + { + foreach ($lvLector_arr as $lector) + { + // Prepare mail content + $fields = array( + 'vorname' => $lector->vorname, + 'stgl_name' => 'Die Studiengangsleitung', + 'link' => anchor($url, 'Anrechnungsanträge Übersicht') + ); + + // Send mail + sendSanchoMail( + 'AnrechnungEmpfehlungAnfordern', + $fields, + $lector->uid. '@'. DOMAIN, + 'Deine Empfehlung wird benötigt zur Anerkennung nachgewiesener Kenntnisse' + ); + } + } + + $this->logInfo('SUCCEDED AnrechnungJob sendMailRecommendationRequests'); + + } + /** * Send Sancho mail to students, whose Anrechnungen were approved 24 hours ago. */ diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php index 8f71dc8d0..3a62ff7d9 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php @@ -242,7 +242,7 @@ class approveAnrechnungDetail extends Auth_Controller $empfehlungsanfrage_an = !isEmptyArray($result) ? implode(', ', array_column($result, 'fullname')) : ''; // Request Recommendation - if($this->anrechnunglib->requestRecommendation($anrechnung_id)) + if ($this->anrechnunglib->requestRecommendation($anrechnung_id)) { $retval[]= array( 'anrechnung_id' => $anrechnung_id, @@ -254,31 +254,23 @@ class approveAnrechnungDetail extends Auth_Controller ); } - /** - * Send mails to lectors - * NOTE: mails are sent at the end to ensure sending only ONE mail to each LV-Leitung or lector - * even if they are required for more recommendations - * */ - if (!isEmptyArray($retval)) - { - if ($this->config->item('send_mail') === TRUE) - { - $this->_sendSanchoMailToLectors($anrechnung_id); - } - - // Output json to ajax - return $this->outputJsonSuccess($retval); - } - // Output json to ajax + if ($empfehlungsanfrage_an == '') + { + $this->terminateWithJsonError( + "Empfehlung wurde nicht angefordert,\nDer LV sind keine LektorInnen zugeteilt." + ); + } + if (isEmptyArray($retval)) { - $this->terminateWithJsonError( - "Empfehlung wurde nicht angefordert,\nDer LV sind keine LektorInnen zugeteilt." - ); + $this->terminateWithJsonError("Empfehlung wurde nicht angefordert"); } - - $this->terminateWithJsonError($this->p->t('ui', 'errorNichtAusgefuehrt')); + else + { + // Output json to ajax + return $this->outputJsonSuccess($retval); + } } /** diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php index f13814e66..b5a44b8f6 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php @@ -249,19 +249,6 @@ class approveAnrechnungUebersicht extends Auth_Controller } } - /** - * Send mails - * NOTE: mails are sent at the end to ensure sending only ONE mail to each LV-Leitung or lector - * even if they are required for more recommendations - * */ - if (!isEmptyArray($retval)) - { - if ($this->config->item('send_mail') === TRUE) - { - $this->_sendSanchoMail($retval); - } - } - // Output json to ajax if (isEmptyArray($retval)) { @@ -273,7 +260,7 @@ class approveAnrechnungUebersicht extends Auth_Controller $this->terminateWithJsonError('Es wurden keine Empfehlungen angefordert'); } - return $this->outputJsonSuccess($retval); + $this->outputJsonSuccess($retval); } /** diff --git a/application/controllers/lehre/anrechnung/RequestAnrechnung.php b/application/controllers/lehre/anrechnung/RequestAnrechnung.php index e9059720b..1922bacda 100644 --- a/application/controllers/lehre/anrechnung/RequestAnrechnung.php +++ b/application/controllers/lehre/anrechnung/RequestAnrechnung.php @@ -111,6 +111,8 @@ class requestAnrechnung extends Auth_Controller $lehrveranstaltung_id = $this->input->post('lv_id'); $studiensemester_kurzbz = $this->input->post('studiensemester'); $bestaetigung = $this->input->post('bestaetigung'); + $begruendung_ects = $this->input->post('begruendung_ects'); + $begruendung_lvinhalt = $this->input->post('begruendung_lvinhalt'); // Validate data if (empty($_FILES['uploadfile']['name'])) @@ -121,7 +123,9 @@ class requestAnrechnung extends Auth_Controller if (isEmptyString($begruendung_id) || isEmptyString($anmerkung) || isEmptyString($lehrveranstaltung_id) || - isEmptyString($studiensemester_kurzbz)) + isEmptyString($studiensemester_kurzbz) || + isEmptyString($begruendung_ects) || + isEmptyString($begruendung_lvinhalt)) { return $this->outputJsonError($this->p->t('ui', 'errorFelderFehlen')); } @@ -172,7 +176,9 @@ class requestAnrechnung extends Auth_Controller $lehrveranstaltung_id, $begruendung_id, $lastInsert_dms_id, - $anmerkung + $anmerkung, + $begruendung_ects, + $begruendung_lvinhalt ); if (isError($result)) diff --git a/application/libraries/AnrechnungLib.php b/application/libraries/AnrechnungLib.php index d8c4b1fd3..8ee1891b5 100644 --- a/application/libraries/AnrechnungLib.php +++ b/application/libraries/AnrechnungLib.php @@ -174,6 +174,8 @@ class AnrechnungLib $anrechnung_data->insertvon = ''; $anrechnung_data->studiensemester_kurzbz = ''; $anrechnung_data->empfehlung = ''; + $anrechnung_data->begruendung_ects = ''; + $anrechnung_data->begruendung_lvinhalt = ''; $anrechnung_data->status_kurzbz = ''; $anrechnung_data->status = getUserLanguage() == 'German' ? 'neu' : 'new'; $anrechnung_data->dokumentname = ''; @@ -894,6 +896,8 @@ class AnrechnungLib $anrechnung_data->insertvon= $anrechnung->insertvon; $anrechnung_data->studiensemester_kurzbz= $anrechnung->studiensemester_kurzbz; $anrechnung_data->empfehlung= $anrechnung->empfehlung_anrechnung; + $anrechnung_data->begruendung_ects = $anrechnung->begruendung_ects; + $anrechnung_data->begruendung_lvinhalt = $anrechnung->begruendung_lvinhalt; // Get last status_kurzbz $result = $this->ci->AnrechnungModel->getLastAnrechnungstatus($anrechnung->anrechnung_id); diff --git a/application/models/education/Anrechnung_model.php b/application/models/education/Anrechnung_model.php index ebecf4118..cbfdb6607 100644 --- a/application/models/education/Anrechnung_model.php +++ b/application/models/education/Anrechnung_model.php @@ -30,7 +30,7 @@ class Anrechnung_model extends DB_Model */ public function createAnrechnungsantrag( $prestudent_id, $studiensemester_kurzbz, $lehrveranstaltung_id, - $begruendung_id, $dms_id, $anmerkung_student = null + $begruendung_id, $dms_id, $anmerkung_student = null, $begruendung_ects = null, $begruendung_lvinhalt = null ) { // Start DB transaction @@ -44,6 +44,8 @@ class Anrechnung_model extends DB_Model 'dms_id' => $dms_id, 'studiensemester_kurzbz' => $studiensemester_kurzbz, 'anmerkung_student' => $anmerkung_student, + 'begruendung_ects' => $begruendung_ects, + 'begruendung_lvinhalt' => $begruendung_lvinhalt, 'insertvon' => $this->_uid )); diff --git a/application/views/lehre/anrechnung/approveAnrechnungDetail.php b/application/views/lehre/anrechnung/approveAnrechnungDetail.php index 87b9d53cc..0970b6edd 100644 --- a/application/views/lehre/anrechnung/approveAnrechnungDetail.php +++ b/application/views/lehre/anrechnung/approveAnrechnungDetail.php @@ -92,85 +92,93 @@ $this->load->view(
-
+
- + - + - + - + - + - - -
p->t('person', 'studentIn')); ?>p->t('person', 'studentIn')); ?> vorname . ' ' . $antragData->nachname; ?>
p->t('person', 'personenkennzeichen'); ?>p->t('person', 'personenkennzeichen'); ?> matrikelnr ?>
p->t('lehre', 'studiensemester')); ?>p->t('lehre', 'studiensemester')); ?> studiensemester_kurzbz ?>
p->t('lehre', 'studiengang')); ?>p->t('lehre', 'studiengang')); ?> stg_bezeichnung ?>
p->t('lehre', 'lehrveranstaltung'); ?>p->t('lehre', 'lehrveranstaltung'); ?> lv_bezeichnung ?>
-
-
- - - - - - - - + + + + + + + + - + + +
p->t('lehre', 'ects'); ?>ects ?>
- p->t('anrechnung', 'bisherAngerechneteEcts'); ?> + p->t('lehre', 'lektorInnen'); ?> + lektoren) - 1 ?> + lektoren as $key => $lektor): ?> + vorname . ' ' . $lektor->nachname; + echo $key === $len ? '' : ', ' ?> + +
p->t('lehre', 'ects'); ?>ects ?>
+ p->t('anrechnung', 'bisherAngerechneteEcts'); ?> + Total: sumEctsSchulisch + $antragData->sumEctsBeruflich, 1) ?> [Schulisch: sumEctsSchulisch ?> / Beruflich: sumEctsBeruflich ?> ] - +
+
+
+ + + - - - - - - + + - + - - + + + + + + + + +
p->t('lehre', 'lektorInnen'); ?> - lektoren) - 1 ?> - lektoren as $key => $lektor): ?> - vorname . ' ' . $lektor->nachname; - echo $key === $len ? '' : ', ' ?> - -
p->t('global', 'zgv')); ?>zgv ?>p->t('global', 'zgv')); ?>zgv ?>
p->t('anrechnung', 'herkunftDerKenntnisse'); ?>anmerkung ?>anmerkung ?>
p->t('anrechnung', 'nachweisdokumente'); ?> + dokumentname) ?>
p->t('global', 'begruendung'); ?>begruendung ?>begruendung ?>
p->t('anrechnung', 'begruendungEctsLabel'); ?>begruendung_ects ?>
p->t('anrechnung', 'begruendungLvinhaltLabel'); ?>begruendung_lvinhalt ?>
diff --git a/application/views/lehre/anrechnung/requestAnrechnung.php b/application/views/lehre/anrechnung/requestAnrechnung.php index cfd9058f5..18fd66a67 100644 --- a/application/views/lehre/anrechnung/requestAnrechnung.php +++ b/application/views/lehre/anrechnung/requestAnrechnung.php @@ -1,5 +1,8 @@ load->view( 'templates/FHC-Header', @@ -197,6 +200,46 @@ $this->load->view(
+ +
+
+
+
+ p->t('anrechnung', 'begruendungEcts'); ?>  + + + +
+
+ + p->t('ui', 'maxZeichen'); ?> : +
+
+
+
+ +
+
+
+
+ p->t('anrechnung', 'begruendungLvinhalt'); ?>  + + + +
+
+ +  / p->t('ui', 'maxZeichen'); ?> : + p->t('ui', 'fehlendeMinZeichen'); ?> : +
+
+
+
@@ -242,8 +285,8 @@ $this->load->view(
- p->t('ui', 'maxZeichen'); ?> : + maxlength="" required>anmerkung; ?> + p->t('ui', 'maxZeichen'); ?> :
diff --git a/application/views/lehre/anrechnung/requestAnrechnungImportant.php b/application/views/lehre/anrechnung/requestAnrechnungImportant.php index d157b22c2..8cacb9c26 100644 --- a/application/views/lehre/anrechnung/requestAnrechnungImportant.php +++ b/application/views/lehre/anrechnung/requestAnrechnungImportant.php @@ -16,6 +16,23 @@ + +
+ +
+
+ p->t('anrechnung', 'requestAnrechnungInfoEctsBerechnungBody'); ?> +
+
+
-
+
- + - + - + - + - + - -
p->t('person', 'studentIn')); ?>p->t('person', 'studentIn')); ?> vorname . ' ' . $antragData->nachname; ?>
p->t('person', 'personenkennzeichen'); ?>p->t('person', 'personenkennzeichen'); ?> matrikelnr ?>
p->t('lehre', 'studiensemester')); ?>p->t('lehre', 'studiensemester')); ?> studiensemester_kurzbz ?>
p->t('lehre', 'studiengang')); ?>p->t('lehre', 'studiengang')); ?> stg_bezeichnung ?>
p->t('lehre', 'lehrveranstaltung'); ?>p->t('lehre', 'lehrveranstaltung'); ?> lv_bezeichnung ?>
-
-
- - - - - - - - - + + + + + + - + + + +
p->t('lehre', 'ects'); ?>ects ?>
p->t('lehre', 'lektorInnen'); ?> +
p->t('lehre', 'ects'); ?>ects ?>
p->t('lehre', 'lektorInnen'); ?> lektoren) - 1 ?> lektoren as $key => $lektor): ?> vorname . ' ' . $lektor->nachname; echo $key === $len ? '' : ', ' ?> -
+
+
+ + + @@ -142,6 +143,14 @@ $this->load->view( target="_blank">dokumentname) ?> + + + + + + + +
p->t('global', 'zgv')); ?> zgv ?>
p->t('anrechnung', 'begruendungEctsLabel'); ?>begruendung_ects ?>
p->t('anrechnung', 'begruendungLvinhaltLabel'); ?>begruendung_lvinhalt ?>
diff --git a/application/views/lehre/anrechnung/reviewAnrechnungInfo.php b/application/views/lehre/anrechnung/reviewAnrechnungInfo.php index 4b899d4dc..7e658ffcb 100644 --- a/application/views/lehre/anrechnung/reviewAnrechnungInfo.php +++ b/application/views/lehre/anrechnung/reviewAnrechnungInfo.php @@ -15,6 +15,22 @@
+
+ +
+
+ p->t('anrechnung', 'requestAnrechnungInfoEctsBerechnungBody'); ?> +
+
+