Merge branch 'master' into feature-10450/DVUH_requestMatrikelnummer

# Conflicts:
#	application/models/crm/Prestudent_model.php
#	system/dbupdate_3.3.php
This commit is contained in:
KarpAlex
2021-10-13 09:05:05 +02:00
56 changed files with 2872 additions and 1367 deletions
@@ -85,7 +85,7 @@ class approveAnrechnungDetail extends Auth_Controller
// Get Anrechung data
$anrechnungData = $this->anrechnunglib->getAnrechnungData($anrechnung_id);
// Get Antrag data
$antragData = $this->anrechnunglib->getAntragData(
$anrechnungData->prestudent_id,
@@ -98,7 +98,7 @@ class approveAnrechnungDetail extends Auth_Controller
// Get Genehmigung data
$genehmigungData = $this->anrechnunglib->getGenehmigungData($anrechnung_id);
$viewData = array(
'antragData' => $antragData,
'anrechnungData' => $anrechnungData,
@@ -121,13 +121,13 @@ class approveAnrechnungDetail extends Auth_Controller
{
return $this->outputJsonError('Fehler beim Übertragen der Daten.');
}
// Get STGLs person data
if (!$person = getData($this->PersonModel->getByUID($this->_uid))[0])
{
show_error('Failed retrieving person data');
}
// Approve Anrechnung
foreach ($data as $item)
{
@@ -166,13 +166,13 @@ class approveAnrechnungDetail extends Auth_Controller
{
return $this->outputJsonError('Fehler beim Übertragen der Daten.');
}
// Get STGLs person data
if (!$person = getData($this->PersonModel->getByUID($this->_uid))[0])
{
show_error('Failed retrieving person data');
}
// Reject Anrechnung
foreach ($data as $item)
{
@@ -210,10 +210,10 @@ class approveAnrechnungDetail extends Auth_Controller
{
return $this->outputJsonError('Fehler beim Übertragen der Daten.');
}
$retval = array();
$counter = 0;
foreach ($data as $item)
{
// Check if Anrechnungs-LV has lector
@@ -221,18 +221,18 @@ class approveAnrechnungDetail extends Auth_Controller
{
// Count up LV with no lector
$counter++;
// Break, if LV has no lector
break;
}
// Get full name of LV Leitung.
// If LV Leitung is not present, get full name of LV lectors.
$lector_arr = $this->anrechnunglib->getLectors($item['anrechnung_id']);
$empfehlungsanfrage_an = !isEmptyArray($lector_arr)
? implode(', ', array_column($lector_arr, 'fullname'))
: '';
// Request Recommendation
if($this->anrechnunglib->requestRecommendation($item['anrechnung_id']))
{
@@ -246,7 +246,7 @@ class approveAnrechnungDetail extends Auth_Controller
);
}
}
/**
* Send mails to lectors
* NOTE: mails are sent at the end to ensure sending only ONE mail to each LV-Leitung or lector
@@ -255,11 +255,11 @@ class approveAnrechnungDetail extends Auth_Controller
if (!isEmptyArray($retval))
{
self::_sendSanchoMailToLectors($retval);
// Output json to ajax
return $this->outputJsonSuccess($retval);
}
// Output json to ajax
if (isEmptyArray($retval) && $counter > 0)
{
@@ -267,22 +267,22 @@ class approveAnrechnungDetail extends Auth_Controller
"Empfehlung wurde nicht angefordert,\nDer LV sind keine LektorInnen zugeteilt."
);
}
return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt'));
}
/**
* Withdraw approved / rejected Anrechnung and reset to 'inProgressDP'.
*/
public function withdraw()
{
$anrechnung_id = $this->input->post('anrechnung_id');
if (!is_numeric($anrechnung_id))
{
$this->terminateWithJsonError($this->p->t('ui', 'errorFelderFehlen'));
}
// Delete last status approved / rejected.
// If last status is 'approved', Genehmigung is resetted.
$result = $this->AnrechnungModel->withdrawApprovement($anrechnung_id);
@@ -291,13 +291,13 @@ class approveAnrechnungDetail extends Auth_Controller
{
$this->terminateWithJsonError(getError($result));
}
// Success output to AJAX
$this->outputJsonSuccess(array(
'status_bezeichnung' => $this->anrechnunglib->getLastAnrechnungstatus($anrechnung_id))
);
}
/**
* Withdraw request for reommendation and reset to 'inProgressDP'.
* This is only possible if the lector has not provided a recommendation yet.
@@ -305,69 +305,69 @@ class approveAnrechnungDetail extends Auth_Controller
public function withdrawRequestRecommendation()
{
$anrechnung_id = $this->input->post('anrechnung_id');
if (!is_numeric($anrechnung_id))
{
show_error('Wrong parameter.');
}
// Get boolean empfehlung of given Anrechnung
if (!$result = getData($this->AnrechnungModel->load($anrechnung_id))[0])
{
show_error('Failed loading Anrechnung');
}
$empfehlung = $result->empfehlung_anrechnung;
// Get last Anrechnungstatus
if (!$result = getData($this->AnrechnungModel->getLastAnrechnungstatus($anrechnung_id))[0])
{
show_error('Failed loading last Anrechnungstatus');
}
$last_status = $result->status_kurzbz;
$anrechnungstatus_id = $result->anrechnungstatus_id;
// Return if Anrechnung was not waiting for recommendation or if Anrechnung has already been recommended
if ($last_status != self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR && !is_null($empfehlung))
if ($last_status != self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR || !is_null($empfehlung))
{
return $this->outputJsonError('No recommendation to withdraw.');
}
// Reset status to 'inProgressDP'
$result = $this->AnrechnungModel->deleteAnrechnungstatus($anrechnungstatus_id);
if (isError($result))
{
return $this->outputJsonError('Could not withdraw this application.');
}
// Success output to AJAX
return $this->outputJsonSuccess(array(
'status_bezeichnung' => $this->anrechnunglib->getLastAnrechnungstatus($anrechnung_id))
);
}
public function saveEmpfehlungsNotiz()
{
$anrechnung_id = $this->input->post('anrechnung_id');
$notiz_id = $this->input->post('notiz_id');
$empfehlungstext = $this->input->post('empfehlung_text');
// Validate data
if (isEmptyString($anrechnung_id))
{
$this->terminateWithJsonError($this->p->t('ui', 'systemFehler'));
}
// Save Empfehlungstext
$result = self::_saveEmpfehlungsNotiz($anrechnung_id, $empfehlungstext, $notiz_id);
if (isError($result))
{
$this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern'));
}
// Output success message
$this->outputJsonSuccess($this->p->t('ui', 'gespeichert'));
}
@@ -386,10 +386,10 @@ class approveAnrechnungDetail extends Auth_Controller
// Check if user is entitled to read dms doc
self::_checkIfEntitledToReadDMSDoc($dms_id);
// Set filename to be used on downlaod
$filename = $this->anrechnunglib->setFilenameOnDownload($dms_id);
// Download file
$this->dmslib->download($dms_id, $filename);
}
@@ -475,7 +475,7 @@ class approveAnrechnungDetail extends Auth_Controller
show_error('You are not entitled to read this document');
}
/**
* Send mail to lectors asking for recommendation. (first to LV-Leitung, if not present to all lectors of lv)
* @param $mail_params
@@ -503,8 +503,8 @@ class approveAnrechnungDetail extends Auth_Controller
* Anyway this function will receive a unique array to avoid sending more mails to one and the same lector.
* **/
$lector_arr = $this->_getLectors($anrechnung_arr);
// Send mail to lectors
foreach ($lector_arr as $lector)
@@ -594,11 +594,11 @@ class approveAnrechnungDetail extends Auth_Controller
return $lector_arr;
}
private function _saveEmpfehlungsNotiz($anrechnung_id, $empfehlungstext, $notiz_id)
{
$this->load->model('person/Notiz_model', 'NotizModel');
if (!isEmptyString($notiz_id))
{
return $this->NotizModel->update(
@@ -610,15 +610,15 @@ class approveAnrechnungDetail extends Auth_Controller
)
);
}
return $this->NotizModel->addNotizForAnrechnung(
$anrechnung_id,
self::ANRECHNUNG_NOTIZTITEL_EMPFEHLUNGSNOTIZ_BY_STGL,
trim($empfehlungstext),
$this->_uid
);
}
}
+2 -2
View File
@@ -31,7 +31,7 @@ class FAS_UDF extends Auth_Controller
if (isset($person_id) && is_numeric($person_id))
{
if ($this->PersonModel->hasUDF())
if ($this->PersonModel->udfsExistAndDefined())
{
$personUdfs = $this->PersonModel->getUDFs($person_id);
$data['person_id'] = $person_id;
@@ -41,7 +41,7 @@ class FAS_UDF extends Auth_Controller
if (isset($prestudent_id) && is_numeric($prestudent_id))
{
if ($this->PrestudentModel->hasUDF())
if ($this->PrestudentModel->udfsExistAndDefined())
{
$prestudentUdfs = $this->PrestudentModel->getUDFs($prestudent_id);
$data['prestudent_id'] = $prestudent_id;
+2 -16
View File
@@ -26,9 +26,6 @@ class UDF extends FHC_Controller
// Loads the UDFLib with HTTP GET/POST parameters
$this->_loadUDFLib();
// Checks if the caller is allow to use this UDF widget
$this->_isAllowed();
}
//------------------------------------------------------------------------------------------------------------------
@@ -39,7 +36,6 @@ class UDF extends FHC_Controller
*/
public function saveUDFs()
{
$udfUniqueId = $this->input->post(self::UDF_UNIQUE_ID);
$udfs = $this->input->post(UDFLib::UDFS_ARG_NAME);
if (!isEmptyString($udfs))
@@ -47,7 +43,7 @@ class UDF extends FHC_Controller
$jsonDecodedUDF = json_decode($udfs);
if ($jsonDecodedUDF != null)
{
$this->outputJson($this->udflib->saveUDFs($udfUniqueId, $jsonDecodedUDF));
$this->outputJson($this->udflib->saveUDFs($jsonDecodedUDF));
}
else
{
@@ -63,17 +59,6 @@ class UDF extends FHC_Controller
//------------------------------------------------------------------------------------------------------------------
// Private methods
/**
* Checks if the user is allowed to use this UDFWidget
*/
private function _isAllowed()
{
if (!$this->udflib->isAllowed())
{
$this->terminateWithJsonError('You are not allowed to access to this content');
}
}
/**
* Loads the UDFLib with the UDF_UNIQUE_ID parameter
* If the parameter UDF_UNIQUE_ID is not given then the execution of the controller is terminated and
@@ -105,3 +90,4 @@ class UDF extends FHC_Controller
}
}
}