mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 02:12:17 +00:00
Added feature to withdraw approvals/rejections for STGL
Signed-off-by: cris-technikum <hainberg@technikum-wien.at>
This commit is contained in:
@@ -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).
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
</div>
|
||||
|
||||
<div class="pull-right">
|
||||
<button id="approveAnrechnungDetail-withdraw-anrechnung-approvement"
|
||||
class="btn btn-default btn-w200 <?php echo ($anrechnungData->status_kurzbz == 'approved' ||
|
||||
$anrechnungData->status_kurzbz == 'rejected') ? '' : 'hidden' ?>">
|
||||
<?php echo ucfirst($this->p->t('global', 'zuruecknehmen')); ?>
|
||||
</button>
|
||||
<button id="approveAnrechnungDetail-reject-anrechnung-ask" class="btn btn-danger btn-w200"
|
||||
<?php echo $anrechnungData->status_kurzbz == 'inProgressDP' ? '' : 'disabled' ?>>
|
||||
<?php echo ucfirst($this->p->t('global', 'ablehnen')); ?>
|
||||
|
||||
Reference in New Issue
Block a user