mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 10:22:18 +00:00
Merge branch 'master' into feature-5491/UDFWidget_add_new_features
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
/**
|
||||
* This job takes care of sending messages to a pool of users,
|
||||
* should not be a scheduled job, or maybe just for a short time,
|
||||
* but it is called manually every time it is needed.
|
||||
* Each method takes care to send a different message to a different pool of users,
|
||||
* so they are very specialize, diffucult to be reused.
|
||||
*/
|
||||
class OneTimeMessages extends JOB_Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Loads CLMessagesModel
|
||||
$this->load->model('CL/Messages_model', 'CLMessagesModel');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the same message to all the applicants whith:
|
||||
* - Status set as "Wartender"
|
||||
* - The given study course type (b = bachelor, m = master)
|
||||
* - The given semester (ex WS2020)
|
||||
* - How long since applicant (months)
|
||||
* - The given template id to be used as message subject and body (vorlage_kurzbz)
|
||||
* The sender of all the messages is specified by the parameter senderId (sender person_id)
|
||||
*/
|
||||
public function sendMessageToApplicantsStillWaiting($senderId, $studyCourseType, $semester, $months, $messageTemplate)
|
||||
{
|
||||
$this->logInfo('Send message to applicants still waiting start');
|
||||
|
||||
$queryParams = array(
|
||||
$semester,
|
||||
$studyCourseType,
|
||||
$semester,
|
||||
$studyCourseType,
|
||||
$semester,
|
||||
$studyCourseType
|
||||
);
|
||||
|
||||
$dbModel = new DB_Model();
|
||||
|
||||
$dbPrestudents = $dbModel->execReadOnlyQuery(
|
||||
'SELECT p.prestudent_id
|
||||
FROM public.tbl_prestudent p
|
||||
JOIN public.tbl_prestudentstatus ps USING (prestudent_id)
|
||||
JOIN public.tbl_studiengang s USING (studiengang_kz)
|
||||
WHERE ps.status_kurzbz = \'Wartender\'
|
||||
AND ps.studiensemester_kurzbz = ?
|
||||
AND ps.datum <= NOW() - \''.$months.' months\'::interval
|
||||
AND s.typ = ?
|
||||
AND NOT EXISTS (
|
||||
SELECT pp.person_id
|
||||
FROM public.tbl_prestudent pp
|
||||
JOIN public.tbl_prestudentstatus pss USING (prestudent_id)
|
||||
JOIN public.tbl_studiengang ss USING (studiengang_kz)
|
||||
WHERE pss.status_kurzbz = \'Aufgenommener\'
|
||||
AND pss.studiensemester_kurzbz = ?
|
||||
AND ss.typ = ?
|
||||
AND pp.person_id = p.person_id
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT pp.person_id
|
||||
FROM public.tbl_prestudent pp
|
||||
JOIN public.tbl_prestudentstatus pss USING (prestudent_id)
|
||||
JOIN public.tbl_studiengang ss USING (studiengang_kz)
|
||||
WHERE pss.status_kurzbz = \'Student\'
|
||||
AND pss.studiensemester_kurzbz = ?
|
||||
AND ss.typ = ?
|
||||
AND pp.person_id = p.person_id
|
||||
)',
|
||||
$queryParams
|
||||
);
|
||||
|
||||
if (isError($dbPrestudents))
|
||||
{
|
||||
$this->logError(getError($dbPrestudents), $queryParams);
|
||||
}
|
||||
elseif (!hasData($dbPrestudents))
|
||||
{
|
||||
$this->logInfo('There were no users to send message');
|
||||
}
|
||||
else
|
||||
{
|
||||
$prestudentIdsArray = array();
|
||||
|
||||
foreach (getData($dbPrestudents) as $dbPrestudent)
|
||||
{
|
||||
$prestudentIdsArray[] = $dbPrestudent->prestudent_id;
|
||||
}
|
||||
|
||||
$sendMessage = $this->CLMessagesModel->sendExplicitTemplateSenderId(
|
||||
$senderId, // sender person id
|
||||
$prestudentIdsArray, // prestudents id
|
||||
null, // organization unit
|
||||
$messageTemplate, // template id
|
||||
null // extra variables
|
||||
);
|
||||
|
||||
if (isError($sendMessage))
|
||||
{
|
||||
$this->logError(
|
||||
getError($sendMessage),
|
||||
array(
|
||||
'prestudents' => $prestudentIdsArray,
|
||||
'template' => $messageTemplate
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$this->logInfo('Total amount of prestudents: '.count($prestudentIdsArray));
|
||||
}
|
||||
|
||||
$this->logInfo('Send message to applicants still waiting end');
|
||||
}
|
||||
}
|
||||
@@ -1378,7 +1378,7 @@ class InfoCenter extends Auth_Controller
|
||||
{
|
||||
if (isset($prestudentstatus->bestaetigtam))
|
||||
{
|
||||
//if statusgrund set - RTfreigabe, otherwise Stgfreigabe
|
||||
//if statusgrund set - freigegeben for Studiengang, otherwise freigegeben for RT
|
||||
if (isset($prestudentstatus->statusgrund_id))
|
||||
{
|
||||
if (isset($prestudentstatus->bezeichnung_statusgrund[0])
|
||||
@@ -1392,23 +1392,37 @@ class InfoCenter extends Auth_Controller
|
||||
$zgvpruefung->isRtFreigegeben = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//application priority change possible?
|
||||
$zgvpruefung->changeup = false;
|
||||
$zgvpruefung->changedown = false;
|
||||
//application priority change possible?
|
||||
$zgvpruefung->changeup = false;
|
||||
$zgvpruefung->changedown = false;
|
||||
$zgvpruefung->hasBewerber = false;
|
||||
|
||||
if (isset($zgvpruefung->prestudentstatus->status_kurzbz) && $zgvpruefung->prestudentstatus->status_kurzbz == self::INTERESSENTSTATUS)
|
||||
{
|
||||
if (isset($zgvpruefung->prestudentstatus->studiensemester_kurzbz))
|
||||
{
|
||||
$studiensemester = $zgvpruefung->prestudentstatus->studiensemester_kurzbz;
|
||||
$zgvpruefung->changeup = $this->PrestudentModel->checkPrioChange($zgvpruefung->prestudent_id, $studiensemester, -1);
|
||||
$zgvpruefung->changedown = $this->PrestudentModel->checkPrioChange($zgvpruefung->prestudent_id, $studiensemester, 1);
|
||||
}
|
||||
}
|
||||
if (isset($zgvpruefung->prestudentstatus->status_kurzbz) && $zgvpruefung->prestudentstatus->status_kurzbz == self::INTERESSENTSTATUS)
|
||||
{
|
||||
if (isset($zgvpruefung->prestudentstatus->studiensemester_kurzbz))
|
||||
{
|
||||
$studiensemester = $zgvpruefung->prestudentstatus->studiensemester_kurzbz;
|
||||
//show warning if there is already another bewerber (RT result already exists)
|
||||
$bewerber = $this->PersonModel->hasBewerber($person_id, $studiensemester, 'b');
|
||||
|
||||
$zgvpruefungen[] = $zgvpruefung;
|
||||
if (hasData($bewerber))
|
||||
{
|
||||
$bewerbercnt = getData($bewerber);
|
||||
|
||||
if (is_numeric($bewerbercnt[0]->anzahl_bewerber) && $bewerbercnt[0]->anzahl_bewerber > 0)
|
||||
{
|
||||
$zgvpruefung->hasBewerber = true;
|
||||
}
|
||||
}
|
||||
|
||||
$zgvpruefung->changeup = $this->PrestudentModel->checkPrioChange($zgvpruefung->prestudent_id, $studiensemester, -1);
|
||||
$zgvpruefung->changedown = $this->PrestudentModel->checkPrioChange($zgvpruefung->prestudent_id, $studiensemester, 1);
|
||||
}
|
||||
}
|
||||
|
||||
$zgvpruefungen[] = $zgvpruefung;
|
||||
}
|
||||
|
||||
$this->_sortPrestudents($zgvpruefungen);
|
||||
|
||||
@@ -34,7 +34,7 @@ class MessageClient extends FHC_Controller
|
||||
public function read()
|
||||
{
|
||||
// Loads the view to read messages
|
||||
$this->load->view('system/messages/ajaxRead');
|
||||
$this->load->view('system/messages/ajaxRead', $this->CLMessagesModel->prepareAjaxRead());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user