diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php
index c5e4b94d8..0b79c3b89 100644
--- a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php
+++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php
@@ -25,7 +25,8 @@ class approveAnrechnungDetail extends Auth_Controller
'download' => 'lehre/anrechnung_genehmigen:rw',
'approve' => 'lehre/anrechnung_genehmigen:rw',
'reject' => 'lehre/anrechnung_genehmigen:rw',
- 'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw'
+ 'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw',
+ 'withdraw' => 'lehre/anrechnung_genehmigen:rw'
)
);
@@ -275,6 +276,47 @@ class approveAnrechnungDetail extends Auth_Controller
return $this->outputJsonError('Es wurden keine Empfehlungen angefordert');
}
}
+
+ /**
+ * Withdraw approved / rejected Anrechnung and reset to 'inProgressDP'.
+ */
+ public function withdraw()
+ {
+ $anrechnung_id = $this->input->post('anrechnung_id');
+
+ if (!is_numeric($anrechnung_id))
+ {
+ show_error('Wrong parameter.');
+ }
+
+ // Get last Anrechnungstatus
+ if (!$result = getData($this->AnrechnungModel->getLastAnrechnungstatus($anrechnung_id))[0])
+ {
+ show_error('Failed loading Anrechnung');
+ }
+
+ $last_status = $result->status_kurzbz;
+ $anrechnungstatus_id = $result->anrechnungstatus_id;
+
+ // Return if last status is not approved / rejected
+ if ($last_status != self::ANRECHNUNGSTATUS_APPROVED && $last_status != self::ANRECHNUNGSTATUS_REJECTED)
+ {
+ return $this->outputJsonError('Nothing to withdraw. Application is still in progress.');
+ }
+
+ // Withdraw status approved / rejected
+ $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/helpers/hlp_authentication_helper.php b/application/helpers/hlp_authentication_helper.php
index 459c7fb80..710f15c24 100644
--- a/application/helpers/hlp_authentication_helper.php
+++ b/application/helpers/hlp_authentication_helper.php
@@ -30,7 +30,7 @@ function getAuthPersonId()
function getAuthUID()
{
$ci =& get_instance(); // get CI instance
-
+return 'martinek';
return isLogged() ? ($ci->authlib->getAuthObj())->{AuthLib::AO_USERNAME} : null;
}
diff --git a/application/models/education/Anrechnung_model.php b/application/models/education/Anrechnung_model.php
index b4c7de835..ce0cfe8d8 100644
--- a/application/models/education/Anrechnung_model.php
+++ b/application/models/education/Anrechnung_model.php
@@ -83,4 +83,19 @@ class Anrechnung_model extends DB_Model
return $this->execQuery($qry, array($anrechnung_id));
}
+
+ /**
+ * Delete Anrechnungstatus.
+ *
+ * @param $anrechnungstatus_id
+ */
+ public function deleteAnrechnungstatus($anrechnungstatus_id){
+
+ $qry = '
+ DELETE FROM lehre.tbl_anrechnung_anrechnungstatus
+ WHERE anrechnungstatus_id = ?
+ ';
+
+ return $this->execQuery($qry, array($anrechnungstatus_id));
+ }
}
diff --git a/application/views/lehre/anrechnung/approveAnrechnungDetail.php b/application/views/lehre/anrechnung/approveAnrechnungDetail.php
index 75059ec69..e30fb8da5 100644
--- a/application/views/lehre/anrechnung/approveAnrechnungDetail.php
+++ b/application/views/lehre/anrechnung/approveAnrechnungDetail.php
@@ -36,7 +36,11 @@ $this->load->view(
'lehrveranstaltung',
'ects',
'lektor',
- )
+ ),
+ 'anrechnung' => array(
+ 'genehmigungAblehnungWirklichZuruecknehmen',
+ 'erfolgreichZurueckgenommen'
+ )
),
'customCSSs' => array(
'public/css/Tabulator.css'
@@ -327,6 +331,11 @@ $this->load->view(
+