diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index f6e41d2e6..57aca0876 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -2375,16 +2375,50 @@ 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') { - $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); + + foreach ($prestudentenData as $prestudent) + { + $this->saveAbsage($prestudent->prestudent_id, $statusgrund); + } + } + } + else + { + $this->load->model('organisation/Studienplan_model', 'StudienplanModel'); + + $this->StudienplanModel->addSelect('1'); + $this->StudienplanModel->addJoin('lehre.tbl_studienordnung so', 'studienordnung_id'); + $escaped = $this->StudienplanModel->db->escape(strtoupper($studiengang)); + $this->StudienplanModel->db->where("UPPER(so.studiengangkurzbzlang || ':' || tbl_studienplan.orgform_kurzbz) = $escaped"); + $this->StudienplanModel->addLimit(1); + $studiengangResult = $this->StudienplanModel->load(); + + if (hasData($studiengangResult)) + { + foreach($personen as $person) + { + $prestudent = $this->PrestudentModel->getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester, $abgeschickt, $abgeschickt === 'all'); + + if (!hasData($prestudent)) + continue; + + $prestudentData = getData($prestudent); + $this->saveAbsage($prestudentData[0]->prestudent_id, $statusgrund); + } + } + else + $this->terminateWithJsonError("Falschen Studiengang übergeben!"); - $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..ff56c3268 100644 --- a/application/models/crm/Prestudent_model.php +++ b/application/models/crm/Prestudent_model.php @@ -677,7 +677,7 @@ class Prestudent_model extends DB_Model )); } - public function getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester, $abgeschickt) + public function getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester, $abgeschickt, $ignoreAbgeschickt = false) { $query = "SELECT ps.prestudent_id FROM public.tbl_prestudentstatus pss @@ -687,22 +687,42 @@ class Prestudent_model extends DB_Model JOIN lehre.tbl_studienordnung so USING(studienordnung_id) WHERE ps.person_id = ? AND UPPER(so.studiengangkurzbzlang || ':' || sp.orgform_kurzbz) = ? - AND pss.studiensemester_kurzbz = ? - AND"; + AND pss.studiensemester_kurzbz = ?"; - if ($abgeschickt === 'true') - $query .= " EXISTS"; - else - $query .= " NOT EXISTS"; + if (!$ignoreAbgeschickt) + { + $query .= "AND"; - $query .= " (SELECT 1 FROM public.tbl_prestudentstatus spss + if ($abgeschickt === 'true') + $query .= " EXISTS"; + else + $query .= " NOT EXISTS"; + + $query .= " (SELECT 1 FROM public.tbl_prestudentstatus spss JOIN public.tbl_prestudent sps USING(prestudent_id) WHERE sps.prestudent_id = ps.prestudent_id AND spss.bewerbung_abgeschicktamum IS NOT NULL)"; + } 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 = '