mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-20 05:29:29 +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')); ?>
|
||||
|
||||
@@ -199,6 +199,52 @@ $(function(){
|
||||
);
|
||||
});
|
||||
|
||||
// Request Recommendation for Anrechnungen
|
||||
$("#approveAnrechnungDetail-withdraw-anrechnung-approvement").click(function(){
|
||||
|
||||
if(!confirm(FHC_PhrasesLib.t("anrechnung", "genehmigungAblehnungWirklichZuruecknehmen")))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get form data
|
||||
let form_data = $('form').serializeArray();
|
||||
|
||||
// Prepare data object for ajax call
|
||||
let data = {
|
||||
'anrechnung_id' : form_data[0].value
|
||||
};
|
||||
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
FHC_JS_DATA_STORAGE_OBJECT.called_path + "/withdraw",
|
||||
data,
|
||||
{
|
||||
successCallback: function (data, textStatus, jqXHR)
|
||||
{
|
||||
if (data.error && data.retval != null)
|
||||
{
|
||||
// Print error message
|
||||
FHC_DialogLib.alertWarning(data.retval);
|
||||
}
|
||||
|
||||
if (!data.error && data.retval != null)
|
||||
{
|
||||
approveAnrechnungDetail.formatGenehmigungIsWithdrawed(
|
||||
data.retval.status_bezeichnung
|
||||
);
|
||||
|
||||
FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t("anrechnung", "erfolgreichZurueckgenommen"));
|
||||
|
||||
}
|
||||
},
|
||||
errorCallback: function (jqXHR, textStatus, errorThrown)
|
||||
{
|
||||
FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// Copy Begruendung into textarea
|
||||
$(".btn-copyIntoTextarea").click(function(){
|
||||
approveAnrechnungDetail.copyIntoTextarea(this);
|
||||
@@ -272,6 +318,9 @@ var approveAnrechnungDetail = {
|
||||
$('#approveAnrechnungDetail-request-recommendation').prop('disabled', true);
|
||||
$('#approveAnrechnungDetail-approve-anrechnung-ask').prop('disabled', true);
|
||||
$('#approveAnrechnungDetail-reject-anrechnung-ask').prop('disabled', true);
|
||||
|
||||
// Show button to withdraw approval
|
||||
$('#approveAnrechnungDetail-withdraw-anrechnung-approvement').removeClass('hidden');
|
||||
},
|
||||
formatGenehmigungIsNegativ: function(abgeschlossenAm, abgeschlossenVon, statusBezeichnung, begruendung){
|
||||
$('#approveAnrechnungDetail-genehmigungDetail').children().addClass('hidden');
|
||||
@@ -284,5 +333,25 @@ var approveAnrechnungDetail = {
|
||||
$('#approveAnrechnungDetail-request-recommendation').prop('disabled', true);
|
||||
$('#approveAnrechnungDetail-approve-anrechnung-ask').prop('disabled', true);
|
||||
$('#approveAnrechnungDetail-reject-anrechnung-ask').prop('disabled', true);
|
||||
|
||||
// Show button to withdraw approval
|
||||
$('#approveAnrechnungDetail-withdraw-anrechnung-approvement').removeClass('hidden');
|
||||
},
|
||||
formatGenehmigungIsWithdrawed: function (statusBezeichnung){
|
||||
$('#approveAnrechnungDetail-status_kurzbz').text(statusBezeichnung);
|
||||
$('#approveAnrechnungDetail-status_kurzbz').closest('div').removeClass('alert-danger').removeClass('alert-success');
|
||||
$('#approveAnrechnungDetail-status_kurzbz').closest('div').addClass('alert-warning');
|
||||
|
||||
$('#approveAnrechnungDetail-genehmigungDetail-genehmigungIsNull').removeClass('hidden');
|
||||
$('#approveAnrechnungDetail-genehmigungDetail-genehmigungIsPositiv').addClass('hidden');
|
||||
$('#approveAnrechnungDetail-genehmigungDetail-genehmigungIsNegativ').addClass('hidden');
|
||||
|
||||
$('#approveAnrechnungDetail-abgeschlossenAm').text('-');
|
||||
$('#approveAnrechnungDetail-abgeschlossenVon').text('-');
|
||||
|
||||
$('#approveAnrechnungDetail-approve-anrechnung-ask').prop('disabled', false);
|
||||
$('#approveAnrechnungDetail-reject-anrechnung-ask').prop('disabled', false);
|
||||
// Hide button to withdraw approval
|
||||
$('#approveAnrechnungDetail-withdraw-anrechnung-approvement').addClass('hidden');
|
||||
}
|
||||
}
|
||||
@@ -10230,6 +10230,66 @@ array(
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'global',
|
||||
'phrase' => 'zuruecknehmen',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => "Zurücknehmen",
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => "Withdraw",
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'anrechnung',
|
||||
'phrase' => 'genehmigungAblehnungWirklichZuruecknehmen',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => "Ihre Genehmigung / Ablehnung wirklich zurücknehmen?",
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => "Do you really want to withdraw your approval / rejection?",
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'anrechnung',
|
||||
'phrase' => 'erfolgreichZurueckgenommen',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => "Erfolgreich zurückgenommen.",
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => "Successfully withdrawn.",
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user