mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Added 'Zurücknehmen'-button for recommendation in STGL Detail View
Requested recommendations can now be withdrawn. Now a button 'Zurücknehmen' is displayed as long as the Anrechnung is processed by the lector and only as long the lector has not provided a recommendation. Signed-off-by: cris-technikum <hainberg@technikum-wien.at>
This commit is contained in:
@@ -26,7 +26,8 @@ class approveAnrechnungDetail extends Auth_Controller
|
||||
'approve' => 'lehre/anrechnung_genehmigen:rw',
|
||||
'reject' => 'lehre/anrechnung_genehmigen:rw',
|
||||
'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw',
|
||||
'withdraw' => 'lehre/anrechnung_genehmigen:rw'
|
||||
'withdraw' => 'lehre/anrechnung_genehmigen:rw',
|
||||
'withdrawRequestRecommendation' => 'lehre/anrechnung_genehmigen:rw'
|
||||
)
|
||||
);
|
||||
|
||||
@@ -317,6 +318,56 @@ class approveAnrechnungDetail extends Auth_Controller
|
||||
'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.
|
||||
*/
|
||||
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))
|
||||
{
|
||||
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))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download and open uploaded document (Nachweisdokument).
|
||||
|
||||
@@ -39,6 +39,7 @@ $this->load->view(
|
||||
),
|
||||
'anrechnung' => array(
|
||||
'genehmigungAblehnungWirklichZuruecknehmen',
|
||||
'empfehlungsanforderungWirklichZuruecknehmen',
|
||||
'erfolgreichZurueckgenommen'
|
||||
)
|
||||
),
|
||||
@@ -199,6 +200,12 @@ $this->load->view(
|
||||
</div>
|
||||
</form>
|
||||
<div class="pull-right">
|
||||
<button id="approveAnrechnungDetail-withdraw-request-recommedation"
|
||||
class="btn btn-default btn-w200 <?php echo (is_null($empfehlungData->empfehlung) &&
|
||||
$anrechnungData->status_kurzbz == 'inProgressLektor') ? '' : 'hidden' ?>"
|
||||
type="button">
|
||||
<?php echo ucfirst($this->p->t('global', 'zuruecknehmen')); ?>
|
||||
</button>
|
||||
<button id="approveAnrechnungDetail-request-recommendation" class="btn btn-primary btn-w200"
|
||||
<?php echo is_null($empfehlungData->empfehlung) && $anrechnungData->status_kurzbz == 'inProgressDP' ? '' : 'disabled' ?>>
|
||||
<?php echo ucfirst($this->p->t('anrechnung', 'empfehlungAnfordern')); ?>
|
||||
|
||||
Reference in New Issue
Block a user