diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index f6e41d2e6..f8e46a8bf 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -2375,16 +2375,39 @@ class InfoCenter extends Auth_Controller if ($statusgrund === 'null' || $studiengang === 'null' || $abgeschickt === 'null' || empty($personen)) $this->terminateWithJsonError("Bitte füllen Sie alle Felder aus"); - foreach($personen as $person) + if ($studiengang === 'all' && $abgeschickt !== 'all' || + $abgeschickt === 'all' && $studiengang !== 'all') + $this->terminateWithJsonError("Absage für alle Studiengänge ist nur in Kombination mit abgeschickt 'Beide' möglich!"); + + if ($studiengang === 'all' && $abgeschickt === 'all') { - $prestudent = $this->PrestudentModel->getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester, $abgeschickt); + foreach($personen as $person) + { + $prestudenten = $this->PrestudentModel->getByPersonWithoutLehrgang($person, $studienSemester); - if (!hasData($prestudent)) - continue; + if (!hasData($prestudenten)) + continue; - $prestudentData = getData($prestudent); + $prestudentenData = getData($prestudenten); - $this->saveAbsage($prestudentData[0]->prestudent_id, $statusgrund); + foreach ($prestudentenData as $prestudent) + { + $this->saveAbsage($prestudent->prestudent_id, $statusgrund); + } + } + } + else + { + foreach($personen as $person) + { + $prestudent = $this->PrestudentModel->getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester, $abgeschickt); + + if (!hasData($prestudent)) + continue; + + $prestudentData = getData($prestudent); + $this->saveAbsage($prestudentData[0]->prestudent_id, $statusgrund); + } } $this->outputJsonSuccess("Success"); diff --git a/application/controllers/system/infocenter/Rueckstellung.php b/application/controllers/system/infocenter/Rueckstellung.php index 62af633ca..b1f2b60b7 100644 --- a/application/controllers/system/infocenter/Rueckstellung.php +++ b/application/controllers/system/infocenter/Rueckstellung.php @@ -14,7 +14,8 @@ class Rueckstellung extends Auth_Controller 'get' => array('infocenter:r', 'lehre/zgvpruefung:r'), 'set' => array('infocenter:r', 'lehre/zgvpruefung:r'), 'delete' => array('infocenter:r', 'lehre/zgvpruefung:r'), - 'getStatus' => array('infocenter:rw', 'lehre/zgvpruefung:rw') + 'getStatus' => array('infocenter:rw', 'lehre/zgvpruefung:rw'), + 'setForPersonen' => array('infocenter:rw', 'lehre/zgvpruefung:rw'), ) ); @@ -79,7 +80,34 @@ class Rueckstellung extends Auth_Controller $this->outputJson($result); } - + + public function setForPersonen() + { + $personen = $this->input->post('personen'); + $datum_bis = $this->input->post('datum_bis'); + $status_kurzbz = $this->input->post('status_kurzbz'); + + foreach ($personen as $person) + { + $rueckstellung = $this->_ci->RueckstellungModel->loadWhere(array('person_id' => $person)); + if (hasData($rueckstellung)) + continue; + + $result = $this->_ci->RueckstellungModel->insert( + array('person_id' => $person, + 'status_kurzbz' => $status_kurzbz, + 'datum_bis' => date_format(date_create($datum_bis), 'Y-m-d'), + 'insertvon' => $this->_uid + ) + ); + + if (isError($result)) + $this->terminateWithJsonError(getError($result)); + $this->_log($person, $status_kurzbz); + } + $this->outputJsonSuccess("Erfolgreich gespeichert!"); + } + public function delete() { $person_id = $this->input->post('person_id'); diff --git a/application/models/crm/Prestudent_model.php b/application/models/crm/Prestudent_model.php index 242c26518..188158b4e 100644 --- a/application/models/crm/Prestudent_model.php +++ b/application/models/crm/Prestudent_model.php @@ -703,6 +703,22 @@ class Prestudent_model extends DB_Model return $this->execQuery($query, array($person, $studiengang, $studienSemester)); } + public function getByPersonWithoutLehrgang($person, $studienSemester) + { + $query = "SELECT DISTINCT(ps.prestudent_id) + FROM public.tbl_prestudentstatus pss + JOIN public.tbl_prestudent ps USING(prestudent_id) + JOIN public.tbl_studiengang sg USING(studiengang_kz) + JOIN lehre.tbl_studienplan sp USING(studienplan_id) + JOIN lehre.tbl_studienordnung so USING(studienordnung_id) + WHERE ps.person_id = ? + AND (sg.typ = 'b' OR sg.typ = 'm') + AND pss.studiensemester_kurzbz = ?"; + + return $this->execQuery($query, array($person, $studienSemester)); + } + + /** * Gets förderrelevant flag for a prestudent, from prestudent, or, if not set on prestudent level, from studiengang * @param int $prestudent_id diff --git a/application/views/system/infocenter/infocenter.php b/application/views/system/infocenter/infocenter.php index 0b7a20c2c..157f98bf1 100644 --- a/application/views/system/infocenter/infocenter.php +++ b/application/views/system/infocenter/infocenter.php @@ -14,12 +14,13 @@ 'navigationwidget' => true, 'dialoglib' => true, 'phrases' => array( + 'infocenter' => array('statusAuswahl'), 'person' => array('vorname', 'nachname'), 'global' => array('mailAnXversandt'), 'ui' => array('bitteEintragWaehlen') ), 'customCSSs' => array('public/css/sbadmin2/tablesort_bootstrap.css', 'public/css/infocenter/infocenterPersonDataset.css'), - 'customJSs' => array('public/js/bootstrapper.js', 'public/js/infocenter/infocenterPersonDataset.js') + 'customJSs' => array('public/js/bootstrapper.js', 'public/js/infocenter/rueckstellung.js', 'public/js/infocenter/infocenterPersonDataset.js') ); $this->load->view('templates/FHC-Header', $includesArray); diff --git a/application/views/system/infocenter/infocenterAbgewiesen.php b/application/views/system/infocenter/infocenterAbgewiesen.php index 921d9f224..7129a3250 100644 --- a/application/views/system/infocenter/infocenterAbgewiesen.php +++ b/application/views/system/infocenter/infocenterAbgewiesen.php @@ -20,7 +20,7 @@ 'ui' => array('bitteEintragWaehlen') ), 'customCSSs' => array('public/css/sbadmin2/tablesort_bootstrap.css', 'public/css/infocenter/infocenterPersonDataset.css'), - 'customJSs' => array('public/js/bootstrapper.js', 'public/js/infocenter/infocenterPersonDataset.js') + 'customJSs' => array('public/js/bootstrapper.js', 'public/js/infocenter/rueckstellung.js', 'public/js/infocenter/infocenterPersonDataset.js') ) ); ?> diff --git a/application/views/system/infocenter/infocenterAufgenommen.php b/application/views/system/infocenter/infocenterAufgenommen.php index 680d66a8a..d57f31d6b 100644 --- a/application/views/system/infocenter/infocenterAufgenommen.php +++ b/application/views/system/infocenter/infocenterAufgenommen.php @@ -20,7 +20,7 @@ 'ui' => array('bitteEintragWaehlen') ), 'customCSSs' => array('public/css/sbadmin2/tablesort_bootstrap.css', 'public/css/infocenter/infocenterPersonDataset.css'), - 'customJSs' => array('public/js/bootstrapper.js', 'public/js/infocenter/infocenterPersonDataset.js') + 'customJSs' => array('public/js/bootstrapper.js', 'public/js/infocenter/rueckstellung.js', 'public/js/infocenter/infocenterPersonDataset.js') ) ); ?> diff --git a/application/views/system/infocenter/infocenterFreigegeben.php b/application/views/system/infocenter/infocenterFreigegeben.php index a240a0b5c..d843cc5c9 100644 --- a/application/views/system/infocenter/infocenterFreigegeben.php +++ b/application/views/system/infocenter/infocenterFreigegeben.php @@ -20,7 +20,7 @@ 'ui' => array('bitteEintragWaehlen') ), 'customCSSs' => array('public/css/sbadmin2/tablesort_bootstrap.css', 'public/css/infocenter/infocenterPersonDataset.css'), - 'customJSs' => array('public/js/bootstrapper.js', 'public/js/infocenter/infocenterPersonDataset.js') + 'customJSs' => array('public/js/bootstrapper.js', 'public/js/infocenter/rueckstellung.js', 'public/js/infocenter/infocenterPersonDataset.js') ) ); ?> diff --git a/application/views/system/infocenter/infocenterReihungstestAbsolviert.php b/application/views/system/infocenter/infocenterReihungstestAbsolviert.php index a86e0df97..eef2a214a 100644 --- a/application/views/system/infocenter/infocenterReihungstestAbsolviert.php +++ b/application/views/system/infocenter/infocenterReihungstestAbsolviert.php @@ -20,7 +20,7 @@ 'ui' => array('bitteEintragWaehlen') ), 'customCSSs' => array('public/css/sbadmin2/tablesort_bootstrap.css', 'public/css/infocenter/infocenterPersonDataset.css'), - 'customJSs' => array('public/js/bootstrapper.js', 'public/js/infocenter/infocenterPersonDataset.js') + 'customJSs' => array('public/js/bootstrapper.js', 'public/js/infocenter/rueckstellung.js', 'public/js/infocenter/infocenterPersonDataset.js') ) ); ?> diff --git a/public/js/infocenter/infocenterPersonDataset.js b/public/js/infocenter/infocenterPersonDataset.js index b7334d265..14fba0779 100644 --- a/public/js/infocenter/infocenterPersonDataset.js +++ b/public/js/infocenter/infocenterPersonDataset.js @@ -50,12 +50,21 @@ var InfocenterPersonDataset = { '' + '' + ''; + let rueckstellung = '
' + + '' + + '' + + ''; + InfocenterPersonDataset.getAbsageData(); + Rueckstellung.getStatus() var studienSemesterHtml = '