diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php
index a280d0da1..85fb2812f 100644
--- a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php
+++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php
@@ -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).
diff --git a/application/views/lehre/anrechnung/approveAnrechnungDetail.php b/application/views/lehre/anrechnung/approveAnrechnungDetail.php
index f5ab892f0..773cb290f 100644
--- a/application/views/lehre/anrechnung/approveAnrechnungDetail.php
+++ b/application/views/lehre/anrechnung/approveAnrechnungDetail.php
@@ -39,6 +39,7 @@ $this->load->view(
),
'anrechnung' => array(
'genehmigungAblehnungWirklichZuruecknehmen',
+ 'empfehlungsanforderungWirklichZuruecknehmen',
'erfolgreichZurueckgenommen'
)
),
@@ -199,6 +200,12 @@ $this->load->view(
+