From 4a4c95aa088acd3f6127670bd284d7eade990d6f Mon Sep 17 00:00:00 2001 From: ma0048 Date: Mon, 4 Oct 2021 12:37:50 +0200 Subject: [PATCH] auswahl fuer bewerbung abgeschickt ja/nein hinzugefuegt --- .../controllers/system/infocenter/InfoCenter.php | 11 ++++++----- application/models/crm/Prestudent_model.php | 14 ++++++++++++-- public/js/infocenter/infocenterPersonDataset.js | 9 ++++++++- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index cd88f814a..59da573b9 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -734,7 +734,7 @@ class InfoCenter extends Auth_Controller if (hasData($lastStatus) && hasData($statusgrresult)) { - //check if still Interessent + //check if still Interessent, Bewerber or Wartender if ($lastStatus->retval[0]->status_kurzbz === self::INTERESSENTSTATUS || $lastStatus->retval[0]->status_kurzbz === self::BEWERBERSTATUS || $lastStatus->retval[0]->status_kurzbz === self::WARTENDER) @@ -2134,17 +2134,18 @@ class InfoCenter extends Auth_Controller { $statusgrund = $this->input->post('statusgrund'); $studiengang = $this->input->post('studiengang'); + $abgeschickt = $this->input->post('abgeschickt'); $personen = $this->input->post('personen'); $studienSemester = $this->variablelib->getVar('infocenter_studiensemester'); - if ($statusgrund === 'null' || $studiengang === 'null' || empty($personen)) - $this->terminateWithJsonError("Bitte Statusgrund, Studiengang und Personen auswählen."); + if ($statusgrund === 'null' || $studiengang === 'null' || $abgeschickt === 'null' || empty($personen)) + $this->terminateWithJsonError("Bitte füllen Sie alle Felder aus"); foreach($personen as $person) { - $prestudent = $this->PrestudentModel->getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester); + $prestudent = $this->PrestudentModel->getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester, $abgeschickt); - if(!hasData($prestudent)) + if (!hasData($prestudent)) continue; $prestudentData = getData($prestudent); diff --git a/application/models/crm/Prestudent_model.php b/application/models/crm/Prestudent_model.php index 2553fd5fa..0ccba60b3 100644 --- a/application/models/crm/Prestudent_model.php +++ b/application/models/crm/Prestudent_model.php @@ -611,7 +611,7 @@ class Prestudent_model extends DB_Model )); } - public function getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester) + public function getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester, $abgeschickt) { $query = "SELECT ps.prestudent_id FROM public.tbl_prestudentstatus pss @@ -621,7 +621,17 @@ class Prestudent_model extends DB_Model WHERE ps.person_id = ? AND UPPER((sg.typ || sg.kurzbz) || ':' || sp.orgform_kurzbz) = ? AND pss.studiensemester_kurzbz = ? - "; + AND"; + + 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)); } diff --git a/public/js/infocenter/infocenterPersonDataset.js b/public/js/infocenter/infocenterPersonDataset.js index 252f6ac1f..bdeed1770 100644 --- a/public/js/infocenter/infocenterPersonDataset.js +++ b/public/js/infocenter/infocenterPersonDataset.js @@ -49,6 +49,11 @@ var InfocenterPersonDataset = { '' + + '' + ''; InfocenterPersonDataset.getAbsageData(); @@ -327,6 +332,7 @@ var InfocenterPersonDataset = { var statusgrund = $('.absgstatusgrund').val(); var studiengang = $('.auswahlAbsageStg').val(); + var abgeschickt = $('.auswahlAbsageAbgeschickt').val(); var personen = []; @@ -340,7 +346,8 @@ var InfocenterPersonDataset = { { 'statusgrund': statusgrund, 'studiengang': studiengang, - 'personen' : personen + 'personen' : personen, + 'abgeschickt' : abgeschickt }, { successCallback: function(data, textStatus, jqXHR) {