funktion hinzugefuegt um mehrere bewerber abzuweisen und status wird nur angezeigt wenn aktiv

This commit is contained in:
ma0048
2021-05-12 12:48:29 +02:00
parent 0681049122
commit 2c6d8937f6
6 changed files with 197 additions and 6 deletions
@@ -108,7 +108,9 @@ class InfoCenter extends Auth_Controller
'setOnHold' => 'infocenter:rw',
'removeOnHold' => 'infocenter:rw',
'getStudienjahrEnd' => 'infocenter:r',
'setNavigationMenuArrayJson' => 'infocenter:r'
'setNavigationMenuArrayJson' => 'infocenter:r',
'getAbsageData' => 'infocenter:r',
'saveAbsageForAll' => 'infocenter:rw'
)
);
@@ -433,11 +435,14 @@ class InfoCenter extends Auth_Controller
* Saves Absage for Prestudent including the reason for the Absage (statusgrund).
* inserts Studiensemester and Ausbildungssemester for the new Absage of (chronologically) last status.
*/
public function saveAbsage()
public function saveAbsage($prestudent_id = null, $statusgrund = null)
{
$json = null;
$prestudent_id = $this->input->post('prestudent_id');
$statusgrund = $this->input->post('statusgrund');
if (is_null($prestudent_id))
$prestudent_id = $this->input->post('prestudent_id');
if (is_null($statusgrund))
$statusgrund = $this->input->post('statusgrund');
$lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id);
@@ -1427,8 +1432,8 @@ class InfoCenter extends Auth_Controller
$this->_sortPrestudents($zgvpruefungen);
$abwstatusgruende = $this->StatusgrundModel->loadWhere(array('status_kurzbz' => self::ABGEWIESENERSTATUS))->retval;
$intstatusgruende = $this->StatusgrundModel->loadWhere(array('status_kurzbz' => self::INTERESSENTSTATUS))->retval;
$abwstatusgruende = $this->StatusgrundModel->getStatus(self::ABGEWIESENERSTATUS, true)->retval;
$intstatusgruende = $this->StatusgrundModel->getStatus(self::INTERESSENTSTATUS)->retval;
$data = array (
'zgvpruefungen' => $zgvpruefungen,
@@ -1687,4 +1692,43 @@ class InfoCenter extends Auth_Controller
$this->loglib->logError('Studiengang has no mail for sending Freigabe mail');
}
}
public function getAbsageData()
{
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
$statusgruende = $this->StatusgrundModel->getStatus(self::ABGEWIESENERSTATUS, true)->retval;
$studiengaenge = $this->StudiengangModel->getStudiengaengeWithOrgForm(['b', 'm']);
$data = array (
'statusgruende' => $statusgruende,
'studiengaenge' => $studiengaenge->retval
);
$this->outputJsonSuccess($data);
}
public function saveAbsageForAll()
{
$statusgrund = $this->input->post('statusgrund');
$studiengang = $this->input->post('studiengang');
$personen = $this->input->post('personen');
if ($statusgrund === 'null' || $studiengang === 'null' || empty($personen))
$this->terminateWithJsonError("Bitte Statusgrund, Studiengang und Personen auswählen.");
foreach($personen as $person)
{
$prestudent = $this->PrestudentModel->getPrestudentByStudiengangAndPerson($studiengang, $person);
if(!hasData($prestudent))
continue;
$prestudentData = getData($prestudent);
$this->saveAbsage($prestudentData[0]->prestudent_id, $statusgrund);
}
$this->outputJsonSuccess("Success");
}
}
@@ -581,4 +581,17 @@ class Prestudent_model extends DB_Model
return $this->execQuery($query, array($person_id));
}
public function getPrestudentByStudiengangAndPerson($studiengang, $person)
{
$query = "SELECT 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)
WHERE ps.person_id = ?
AND UPPER((sg.typ || sg.kurzbz) || ':' || sp.orgform_kurzbz) = ?";
return $this->execQuery($query, array($person, $studiengang));
}
}
@@ -11,4 +11,17 @@ class Statusgrund_model extends DB_Model
$this->dbTable = "public.tbl_status_grund";
$this->pk = "statusgrund_id";
}
public function getStatus($status_kurzbz = null, $aktiv = null)
{
$where = array();
if (!is_null($status_kurzbz))
$where['status_kurzbz'] = $status_kurzbz;
if (!is_null($aktiv))
$where['aktiv'] = $aktiv;
$status = $this->loadWhere($where);
return success($status->retval);
}
}
@@ -481,4 +481,17 @@ class Studiengang_model extends DB_Model
return $this->loadWhere($condition);
}
public function getStudiengaengeWithOrgForm($typ)
{
$query = "SELECT DISTINCT (UPPER(sg.typ || sg.kurzbz || ':' || sp.orgform_kurzbz)) AS Studiengang
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)
WHERE sg.typ IN ?
ORDER BY Studiengang;";
return $this->execQuery($query, array($typ));
}
}
@@ -13,6 +13,7 @@
'ajaxlib' => true,
'filterwidget' => true,
'navigationwidget' => true,
'dialoglib' => true,
'phrases' => array(
'person' => array('vorname', 'nachname'),
'global' => array('mailAnXversandt'),