diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index d027e559e..548b071d3 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -142,12 +142,6 @@ class InfoCenter extends Auth_Controller 'reloadNotizen' => array('infocenter:r', 'lehre/zgvpruefung:r'), 'reloadLogs' => 'infocenter:r', 'outputAkteContent' => array('infocenter:r', 'lehre/zgvpruefung:r'), - 'getPostponeDate' => array('infocenter:r', 'lehre/zgvpruefung:r'), - 'park' => 'infocenter:rw', - 'unpark' => 'infocenter:rw', - 'setOnHold' => 'infocenter:rw', - 'removeOnHold' => array('infocenter:rw', 'lehre/zgvpruefung:rw'), - 'getStudienjahrEnd' => array('infocenter:r', 'lehre/zgvpruefung:r'), 'setNavigationMenuArrayJson' => 'infocenter:r', 'getAbsageData' => 'infocenter:r', 'saveAbsageForAll' => 'infocenter:rw', @@ -164,6 +158,7 @@ class InfoCenter extends Auth_Controller $this->load->model('crm/Statusgrund_model', 'StatusgrundModel'); $this->load->model('crm/ZGVPruefung_model', 'ZGVPruefungModel'); $this->load->model('crm/ZGVPruefungStatus_model', 'ZGVPruefungStatusModel'); + $this->load->model('crm/Rueckstellung_model', 'RueckstellungModel'); $this->load->model('person/Notiz_model', 'NotizModel'); $this->load->model('person/Person_model', 'PersonModel'); $this->load->model('system/Message_model', 'MessageModel'); @@ -606,7 +601,7 @@ class InfoCenter extends Auth_Controller } /** - * Sendet bei einer neuen ZGV Prüfung die Mail raus an den Studiengang + * Sendet bei einer neuen ZGV Prüfung eine Mail an den Studiengang */ private function sendZgvMail($mail, $typ, $person){ $data = array( @@ -697,7 +692,7 @@ class InfoCenter extends Auth_Controller /** * Fügt einen neuen ZGV Status hinzu oder updated einen bestehenden - * Falls es erfolgreich war, sendet er die Mail raus + * Falls es erfolgreich war, wird eine Mail rausgeschickt */ public function zgvRueckfragen() { @@ -751,7 +746,8 @@ class InfoCenter extends Auth_Controller $this->sendZgvMail($mail, $typ, $person); elseif (isError($insert)) $this->terminateWithJsonError('Fehler beim Speichern'); - }else + } + else { $insert = $this->ZGVPruefungModel->insert( array( @@ -781,7 +777,7 @@ class InfoCenter extends Auth_Controller } $hold = false; - if ($this->personloglib->getOnHoldDate($person_id) !== null) + if (hasData($this->RueckstellungModel->getByPersonId($person_id, 'onhold_zgv'))) $hold = true; $this->outputJsonSuccess( @@ -1162,107 +1158,7 @@ class InfoCenter extends Auth_Controller ->set_output($aktecontent->retval) ->_display(); } - - /** - * Gets the date until which a person is parked - * @param $person_id - */ - public function getPostponeDate($person_id) - { - $result = array( - 'type' => null, - 'date' => null - ); - - $parkedDate = $this->personloglib->getParkedDate($person_id); - - if (isset($parkedDate)) - { - $result['type'] = 'parked'; - $result['date'] = $parkedDate; - } - else - { - $onholdDate = $this->personloglib->getOnHoldDate($person_id); - - if (isset($onholdDate)) - { - $result['type'] = 'onhold'; - $result['date'] = $onholdDate; - } - } - - $this->outputJsonSuccess($result); - } - - /** - * Initializes parking of a person, i.e. a person is not expected to do any actions while parked - */ - public function park() - { - $person_id = $this->input->post('person_id'); - $date = $this->input->post('parkdate'); - - $result = $this->personloglib->park($person_id, date_format(date_create($date), 'Y-m-d'), self::TAETIGKEIT, self::APP, null, $this->_uid); - - $this->outputJson($result); - } - - /** - * Removes parking of a person - */ - public function unPark() - { - $person_id = $this->input->post('person_id'); - - $result = $this->personloglib->unPark($person_id); - - $this->outputJson($result); - } - - /** - * Sets a person on hold ("zurückstellen") - */ - public function setOnHold() - { - $person_id = $this->input->post('person_id'); - $date = $this->input->post('onholddate'); - - $result = $this->personloglib->setOnHold($person_id, date_format(date_create($date), 'Y-m-d'), self::TAETIGKEIT, self::APP, null, $this->_uid); - - $this->outputJson($result); - } - - /** - * Removed on hold status of a person - */ - public function removeOnHold() - { - $person_id = $this->input->post('person_id'); - - $result = $this->personloglib->removeOnHold($person_id); - - $this->outputJson($result); - } - - /** - * Gets the End date of the current Studienjahr - */ - public function getStudienjahrEnd() - { - $this->load->model('organisation/studienjahr_model', 'StudienjahrModel'); - - $result = $this->StudienjahrModel->getCurrStudienjahr(); - - $json = null; - - if (hasData($result)) - { - $json = $result->retval[0]->ende; - } - - $this->outputJsonSuccess(array($json)); - } + /** * Wrapper for setNavigationMenu, returns JSON message @@ -1484,7 +1380,6 @@ class InfoCenter extends Auth_Controller if($nachreichungAm < $today) $this->terminateWithJsonError($this->p->t('infocenter', 'nachreichDatumNichtVergangenheit')); - $akte = $this->AkteModel->loadWhere(array('person_id' => $person_id, 'dokument_kurzbz' => $allowedTypes[$typ])); if (hasData($akte)) { diff --git a/application/controllers/system/infocenter/Rueckstellung.php b/application/controllers/system/infocenter/Rueckstellung.php new file mode 100644 index 000000000..4d5bdbb81 --- /dev/null +++ b/application/controllers/system/infocenter/Rueckstellung.php @@ -0,0 +1,116 @@ + array('infocenter:r', 'lehre/zgvpruefung:r'), + 'set' => array('infocenter:r', 'lehre/zgvpruefung:r'), + 'delete' => array('infocenter:r', 'lehre/zgvpruefung:r'), + 'getStatus' => array('infocenter:rw', 'lehre/zgvpruefung:rw'), + 'getStudienjahrEnd' => array('infocenter:r', 'lehre/zgvpruefung:r'), + ) + ); + + $this->load->model('crm/Rueckstellung_model', 'RueckstellungModel'); + $this->load->model('crm/RueckstellungStatus_model', 'RueckstellungStatusModel'); + + $this->_setAuthUID(); // sets property uid + + $this->_ci =& get_instance(); // get code igniter instance + } + + public function get($person_id) + { + $result = null; + $rueckstellung = $this->_ci->RueckstellungModel->getByPersonId($person_id); + + if (isError($rueckstellung)) + $this->terminateWithJsonError($this->_ci->p->t('ui', 'fehlerBeimLesen')); + + if (hasData($rueckstellung)) + $result = getData($rueckstellung)[0]; + + $this->outputJsonSuccess($result); + } + + public function set() + { + $person_id = $this->input->post('person_id'); + $datum_bis = $this->input->post('datum_bis'); + $status_kurzbz = $this->input->post('status_kurzbz'); + + $result = $this->_ci->RueckstellungModel->set($person_id, date_format(date_create($datum_bis), 'Y-m-d'), $status_kurzbz, $this->_uid); + + $this->outputJson($result); + } + + public function delete() + { + $person_id = $this->input->post('person_id'); + $status = $this->input->post('status'); + + $rueckstellungd = $this->_ci->RueckstellungModel->getByPersonId($person_id, $status); + + if (isError($rueckstellungd)) + $this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimLesen')); + + + if (hasData($rueckstellungd)) + { + $rueckstellungd = getData($rueckstellungd)[0]; + $result = $this->_ci->RueckstellungModel->delete($rueckstellungd->rueckstellung_id); + + if (isError($result)) + $this->terminateWithJsonError($this->_ci->p->t('ui', 'fehlerBeimSpeichern')); + + $this->outputJson($result); + } + } + + public function getStatus($aktiv = true) + { + $result = $this->_ci->RueckstellungStatusModel->loadWhere(array('aktiv' => $aktiv)); + + if (isError($result)) + $this->terminateWithJsonError($this->_ci->p->t('ui', 'fehlerBeimLesen')); + + $this->outputJsonSuccess(getData($result)); + } + + /** + * Gets the End date of the current Studienjahr + */ + public function getStudienjahrEnd() + { + $this->load->model('organisation/studienjahr_model', 'StudienjahrModel'); + + $result = $this->_ci->StudienjahrModel->getCurrStudienjahr(); + + $json = null; + + if (hasData($result)) + { + $json = $result->retval[0]->ende; + } + + $this->outputJsonSuccess(array($json)); + } + + /** + * Retrieve the UID of the logged user and checks if it is valid + */ + private function _setAuthUID() + { + $this->_uid = getAuthUID(); + + if (!$this->_uid) show_error('User authentification failed'); + } +} \ No newline at end of file diff --git a/application/libraries/PersonLogLib.php b/application/libraries/PersonLogLib.php index fe9a82504..f4f434fad 100644 --- a/application/libraries/PersonLogLib.php +++ b/application/libraries/PersonLogLib.php @@ -7,9 +7,6 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); */ class PersonLogLib { - const PARKED_LOGNAME = 'Parked'; - const ONHOLD_LOGNAME = 'Onhold'; - /** * Constructor */ @@ -78,168 +75,6 @@ class PersonLogLib else show_error(getError($result)); } - - /** - * Parks a person, i.e. marks a person so no actions are expected for the person (e.g. as a prestudent) - * Done by adding a logentry in the future - * @param $person_id - * @param $date - * @param $taetigkeit_kurzbz - * @param string $app - * @param null $oe_kurzbz - * @param null $user - * @return insert object - */ - public function park($person_id, $date, $taetigkeit_kurzbz, $app = 'core', $oe_kurzbz = null, $user = null) - { - $onhold = $this->getOnHoldDate($person_id); - - if (hasData($onhold)) - return error("Person already on hold"); - - $logjson = array( - 'name' => self::PARKED_LOGNAME - ); - - return $this->_savePsLog($person_id, $date, $taetigkeit_kurzbz, $logjson, $app, $oe_kurzbz, $user); - } - - /** - * Unparks a person, i.e. removes all log entries in the future with logname for parking - * @param $person_id - * @return array with deleted logids - */ - public function unPark($person_id) - { - $deleted = array(); - - $result = $this->ci->PersonLogModel->getLogsInFuture($person_id); - if (hasData($result)) - { - foreach ($result->retval as $log) - { - $logdata = json_decode($log->logdata); - if (isset($logdata->name) && $logdata->name === self::PARKED_LOGNAME) - { - $delresult = $this->ci->PersonLogModel->deleteLog($log->log_id); - if (isSuccess($delresult)) - { - $deleted[] = $log->log_id; - } - } - } - } - - return success($deleted); - } - - /** - * Gets date until which a person is parked - * @param $person_id - * @return the date if person is parked, null otherwise - */ - public function getParkedDate($person_id) - { - $result = $this->ci->PersonLogModel->getLogsInFuture($person_id); - - $parkeddate = null; - - if (hasData($result)) - { - foreach ($result->retval as $log) - { - $logdata = json_decode($log->logdata); - if (isset($logdata->name) && $logdata->name === self::PARKED_LOGNAME) - { - $parkeddate = $log->zeitpunkt; - break; - } - } - } - - return $parkeddate; - } - - /** - * Sets person on hold, i.e. marks a person so no actions are expected for the person (e.g. as a prestudent). - * Done by adding a logentry with a special name. can be undone only manually by clicking button. - * @param $person_id - * @param $date - * @param $taetigkeit_kurzbz - * @param string $app - * @param null $oe_kurzbz - * @param null $user - * @return array - */ - public function setOnHold($person_id, $date, $taetigkeit_kurzbz, $app = 'core', $oe_kurzbz = null, $user = null) - { - $parked = $this->getParkedDate($person_id); - - if (hasData($parked)) - return error("Person already parked"); - - $logjson = array( - 'name' => self::ONHOLD_LOGNAME - ); - - return $this->_savePsLog($person_id, $date, $taetigkeit_kurzbz, $logjson, $app, $oe_kurzbz, $user); - } - - /** - * Removes on hold status, i.e. removes all log entries with logname for on hold - * @param $person_id - * @return array - */ - public function removeOnHold($person_id) - { - $deleted = array(); - - $result = $this->ci->PersonLogModel->filterLog($person_id); - if (hasData($result)) - { - foreach ($result->retval as $log) - { - $logdata = json_decode($log->logdata); - if (isset($logdata->name) && $logdata->name === self::ONHOLD_LOGNAME) - { - $delresult = $this->ci->PersonLogModel->deleteLog($log->log_id); - if (isSuccess($delresult)) - { - $deleted[] = $log->log_id; - } - } - } - } - return success($deleted); - } - - /** - * Gets date until which a person is on hold - * @param $person_id - * @return the date if person is on hold, null otherwise - */ - public function getOnHoldDate($person_id) - { - $result = $this->ci->PersonLogModel->filterLog($person_id); - - $onholddate = null; - - if (hasData($result)) - { - foreach ($result->retval as $log) - { - $logdata = json_decode($log->logdata); - if (isset($logdata->name) && $logdata->name === self::ONHOLD_LOGNAME) - { - $onholddate = $log->zeitpunkt; - break; - } - } - } - - return $onholddate; - } - /** * Saves a processstate log with specified parameters, including a specified log date. * @param $person_id diff --git a/application/models/crm/RueckstellungStatus_model.php b/application/models/crm/RueckstellungStatus_model.php new file mode 100644 index 000000000..a4cb391f1 --- /dev/null +++ b/application/models/crm/RueckstellungStatus_model.php @@ -0,0 +1,14 @@ +dbTable = 'public.tbl_rueckstellung_status'; + $this->pk = 'status_kurzbz'; + } +} \ No newline at end of file diff --git a/application/models/crm/Rueckstellung_model.php b/application/models/crm/Rueckstellung_model.php new file mode 100644 index 000000000..4d4821132 --- /dev/null +++ b/application/models/crm/Rueckstellung_model.php @@ -0,0 +1,43 @@ +dbTable = 'public.tbl_rueckstellung'; + $this->pk = 'rueckstellung_id'; + $this->hasSequence = true; + } + + public function getByPersonId($person_id, $status = null) + { + $language_index = getUserLanguage() == 'German' ? 0 : 1; + + $this->addLimit(1); + $this->addJoin('tbl_rueckstellung_status', 'status_kurzbz'); + $this->addSelect('*, + array_to_json(bezeichnung_mehrsprachig::varchar[])->>'.$language_index . 'as bezeichnung'); + $this->addOrder('datum_bis', 'DESC'); + + $where['person_id'] = $person_id; + + if (!isEmptyString($status)) + $where['status_kurzbz'] = $status; + + return $this->loadWhere($where); + } + + public function set($person_id, $datum_bis, $status_kurzbz, $uid) + { + $exists = $this->getByPersonId($person_id, $status_kurzbz); + + if (hasData($exists)) + return error("Rueckstellung entry already exists"); + + return $this->insert(array('person_id' => $person_id, 'status_kurzbz' => $status_kurzbz, 'datum_bis' => $datum_bis, 'insertvon' => $uid)); + } +} \ No newline at end of file diff --git a/application/views/system/infocenter/infocenterData.php b/application/views/system/infocenter/infocenterData.php index de2bd1bca..de4d19bcb 100644 --- a/application/views/system/infocenter/infocenterData.php +++ b/application/views/system/infocenter/infocenterData.php @@ -7,9 +7,7 @@ $STUDIENGANG_TYP = '\''.$this->variablelib->getVar('infocenter_studiensgangtyp').'\''; $TAETIGKEIT_KURZBZ = '\'bewerbung\', \'kommunikation\''; $LOGDATA_NAME = '\'Login with code\', \'Login with user\', \'Interessent rejected\', \'Attempt to register with existing mailadress\', \'Access code sent\', \'Personal data saved\''; - $LOGDATA_NAME_PARKED = '\'Parked\''; - $LOGDATA_NAME_ONHOLD = '\'Onhold\''; - $LOGTYPE_KURZBZ = '\'Processstate\''; + $POSTPONE_STATUS_PARKED = '\'parked\''; $STATUS_KURZBZ = '\'Wartender\', \'Bewerber\', \'Aufgenommener\', \'Student\''; $ADDITIONAL_STG = $this->config->item('infocenter_studiengang_kz'); $AKTE_TYP = '\'identity\', \'zgv_bakk\''; @@ -27,8 +25,6 @@ p.staatsbuergerschaft AS "Nation", pl.zeitpunkt AS "LockDate", pl.lockuser AS "LockUser", - pd.parkdate AS "ParkDate", - ohd.onholddate AS "OnholdDate", ( SELECT l.zeitpunkt FROM system.tbl_log l @@ -291,7 +287,25 @@ LIMIT 1 ) LIMIT 1 - ) AS "InfoCenterMitarbeiter" + ) AS "InfoCenterMitarbeiter", + ( + SELECT datum_bis + FROM public.tbl_rueckstellung + WHERE datum_bis >= NOW() + AND status_kurzbz = '. $POSTPONE_STATUS_PARKED .' + AND person_id = p.person_id + ORDER BY datum_bis DESC + LIMIT 1 + ) AS "ParkDate", + ( + SELECT datum_bis + FROM public.tbl_rueckstellung + WHERE datum_bis >= NOW() + AND status_kurzbz != '. $POSTPONE_STATUS_PARKED .' + AND person_id = p.person_id + ORDER BY datum_bis DESC + LIMIT 1 + ) AS "OnholdDate" FROM public.tbl_person p LEFT JOIN ( SELECT tpl.person_id, @@ -302,22 +316,6 @@ JOIN public.tbl_person sp ON sb.person_id = sp.person_id WHERE tpl.app = '.$APP.' ) pl USING(person_id) - LEFT JOIN ( - SELECT l.person_id, - l.zeitpunkt AS parkdate - FROM system.tbl_log l - WHERE l.logtype_kurzbz = '.$LOGTYPE_KURZBZ.' - AND l.logdata->>\'name\' = '.$LOGDATA_NAME_PARKED.' - AND l.zeitpunkt >= NOW() - ) pd USING(person_id) - LEFT JOIN ( - SELECT l.person_id, - l.zeitpunkt AS onholddate - FROM system.tbl_log l - WHERE l.logtype_kurzbz = '.$LOGTYPE_KURZBZ.' - AND l.logdata->>\'name\' = '.$LOGDATA_NAME_ONHOLD.' - AND l.zeitpunkt >= NOW() - ) ohd USING(person_id) WHERE EXISTS ( SELECT 1 @@ -344,7 +342,7 @@ AND spss.studiensemester_kurzbz = '.$STUDIENSEMESTER.' ) ) - ORDER BY "LastAction" ASC'; + ORDER BY "OnholdDate" DESC NULLS FIRST, "ParkDate" DESC NULLS FIRST, "LastAction" ASC'; $filterWidgetArray = array( 'query' => $query, @@ -366,8 +364,6 @@ ucfirst($this->p->t('person', 'nation')), ucfirst($this->p->t('global', 'sperrdatum')), ucfirst($this->p->t('global', 'gesperrtVon')), - ucfirst($this->p->t('global', 'parkdatum')), - ucfirst($this->p->t('global', 'rueckstelldatum')), ucfirst($this->p->t('global', 'letzteAktion')), 'Aktionstyp', 'AnzahlAktePflicht', @@ -383,7 +379,9 @@ 'ZGV Nation MA', 'ZGV Gruppe BA', 'ZGV Gruppe MA', - 'InfoCenter Mitarbeiter' + 'InfoCenter Mitarbeiter', + ucfirst($this->p->t('global', 'parkdatum')), + ucfirst($this->p->t('global', 'rueckstelldatum')) ), 'formatRow' => function($datasetRaw) { @@ -434,6 +432,10 @@ { $datasetRaw->{'ParkDate'} = '-'; } + else + { + $datasetRaw->{'ParkDate'} = date_format(date_create($datasetRaw->{'ParkDate'}), 'Y-m-d H:i'); + } if ($datasetRaw->{'OnholdDate'} == null) { diff --git a/application/views/system/infocenter/infocenterDetails.php b/application/views/system/infocenter/infocenterDetails.php index 066e5cff6..401e34099 100644 --- a/application/views/system/infocenter/infocenterDetails.php +++ b/application/views/system/infocenter/infocenterDetails.php @@ -24,42 +24,15 @@ 'public/js/tablesort/tablesort.js', 'public/js/infocenter/messageList.js', 'public/js/infocenter/infocenterDetails.js', + 'public/js/infocenter/rueckstellung.js', 'public/js/infocenter/zgvUeberpruefung.js', 'public/js/infocenter/docUeberpruefung.js', 'public/js/infocenter/stammdaten.js' ), 'phrases' => array( - 'infocenter' => array( - 'notizHinzufuegen', - 'notizAendern', - 'bewerberParken', - 'bewerberAusparken', - 'nichtsZumAusparken', - 'fehlerBeimAusparken', - 'fehlerBeimParken', - 'bewerberGeparktBis', - 'bewerberOnHold', - 'bewerberOnHoldEntfernen', - 'bewerberOnHoldBis', - 'nichtsZumEntfernen', - 'fehlerBeimEntfernen', - 'rueckstelldatumUeberschritten', - 'parkenZurueckstellenInfo', - 'zgvInPruefung', - 'zgvErfuellt', - 'zgvNichtErfuellt', - 'zgvErfuelltPruefung', - 'datumUngueltig', - 'nachreichDatumNichtVergangenheit' - ), - 'ui' => array( - 'gespeichert', - 'fehlerBeimSpeichern' - ), - 'global' => array( - 'bis', - 'zeilen' - ) + 'infocenter', + 'ui', + 'global' ) ); diff --git a/application/views/system/infocenter/infocenterZgvDetails.php b/application/views/system/infocenter/infocenterZgvDetails.php index cf3ffad8b..7636647ab 100644 --- a/application/views/system/infocenter/infocenterZgvDetails.php +++ b/application/views/system/infocenter/infocenterZgvDetails.php @@ -26,6 +26,7 @@ 'public/js/tablesort/tablesort.js', 'public/js/infocenter/messageList.js', 'public/js/infocenter/infocenterDetails.js', + 'public/js/infocenter/rueckstellung.js', 'public/js/infocenter/zgvUeberpruefung.js' ), 'phrases' => array( diff --git a/include/rueckstellung.class.php b/include/rueckstellung.class.php new file mode 100644 index 000000000..82662f8bf --- /dev/null +++ b/include/rueckstellung.class.php @@ -0,0 +1,38 @@ +db_add_param($person_id)." + AND status_kurzbz = 'parked' + AND datum_bis >= now();"; + + if($this->db_query($qry)) + { + return true; + } + else + { + $this->errormsg = 'Fehler beim Löschen des geparkten Eintrages'; + return false; + } + } +} +?> diff --git a/public/js/infocenter/infocenterDetails.js b/public/js/infocenter/infocenterDetails.js index 7e6742fda..186479a8f 100644 --- a/public/js/infocenter/infocenterDetails.js +++ b/public/js/infocenter/infocenterDetails.js @@ -15,15 +15,11 @@ const STGFREIGABE_MESSAGE_VORLAGE_ANDERES_SEMESTER = "InfocenterSTGfreigegebenSe //Statusgründe for which no Studiengang Freigabe Message should be sent const FIT_PROGRAMM_STUDIENGAENGE = [10021, 10027]; -const PARKEDNAME = 'parked'; -const ONHOLDNAME = 'onhold'; - /** * javascript file for infocenterDetails page */ $(document).ready(function () { - InfocenterDetails._formatMessageTable(); InfocenterDetails._formatNotizTable(); InfocenterDetails._formatLogTable(); @@ -88,7 +84,7 @@ $(document).ready(function () ); //check if person is postponed (parked, on hold...) and display it - InfocenterDetails.getPostponeDate(personid); + Rueckstellung.get(personid); if ($(document).scrollTop() > 20) $("#scrollToTop").show(); @@ -374,155 +370,6 @@ var InfocenterDetails = { } ); }, - getStudienjahrEnd: function() - { - FHC_AjaxClient.ajaxCallGet( - CALLED_PATH + "/getStudienjahrEnd", - null, - { - successCallback: function(data, textStatus, jqXHR) { - if (FHC_AjaxClient.hasData(data)) - { - var engdate = $.datepicker.parseDate("yy-mm-dd", FHC_AjaxClient.getData(data)[0]); - - if (engdate.getDate() === 31) - engdate.setDate(engdate.getDate() - 1); - engdate.setMonth(engdate.getMonth() + 3); - - var gerdate = $.datepicker.formatDate("dd.mm.yy", engdate); - $("#postponedate").val(gerdate); - } - }, - errorCallback: function() - { - FHC_DialogLib.alertError("error when getting Studienjahr end"); - }, - veilTimeout: 0 - } - ); - }, - getPostponeDate: function(personid) - { - FHC_AjaxClient.ajaxCallGet( - CALLED_PATH + "/getPostponeDate/"+encodeURIComponent(personid), - null, - { - successCallback: function(data, textStatus, jqXHR) { - if (FHC_AjaxClient.hasData(data)) - { - var postponeobj = FHC_AjaxClient.getData(data); - InfocenterDetails._refreshPostpone(postponeobj); - InfocenterDetails._refreshLog(); - if (postponeobj === null || postponeobj.type === null) - InfocenterDetails.getStudienjahrEnd(); - } - }, - errorCallback: function() - { - FHC_DialogLib.alertError("error when getting parked status"); - }, - veilTimeout: 0 - } - ); - }, - parkPerson: function(personid, date) - { - var parkError = function(){ - $("#postponemsg").text(" Fehler beim Parken!"); - }; - - FHC_AjaxClient.ajaxCallPost( - CALLED_PATH + '/park', - { - "person_id": personid, - "parkdate": date - }, - { - successCallback: function(data, textStatus, jqXHR) { - if (FHC_AjaxClient.hasData(data)) - InfocenterDetails.getPostponeDate(personid); - else - { - parkError(); - } - }, - errorCallback: parkError, - veilTimeout: 0 - } - ); - }, - unparkPerson: function(personid) - { - FHC_AjaxClient.ajaxCallPost( - CALLED_PATH + '/unpark', - { - "person_id": personid - }, - { - successCallback: function(data, textStatus, jqXHR) { - if (FHC_AjaxClient.hasData(data)) - { - InfocenterDetails.getPostponeDate(personid); - } - else - $("#unpostponemsg").removeClass().addClass("text-warning").text(FHC_PhrasesLib.t('infocenter', 'nichtsZumAusparken')); - }, - errorCallback: function(){ - $("#unpostponemsg").removeClass().addClass("text-danger").text(FHC_PhrasesLib.t('infocenter', 'fehlerBeimAusparken')); - }, - veilTimeout: 0 - } - ); - }, - setPersonOnHold: function(personid, date) - { - var onHoldError = function(){ - $("#postponemsg").text(" Fehler beim Setzen auf On Hold!"); - }; - - FHC_AjaxClient.ajaxCallPost( - CALLED_PATH + '/setOnHold', - { - "person_id": personid, - "onholddate": date - }, - { - successCallback: function(data, textStatus, jqXHR) { - if (FHC_AjaxClient.hasData(data)) - InfocenterDetails.getPostponeDate(personid); - else - { - onHoldError(); - } - }, - errorCallback: onHoldError, - veilTimeout: 0 - } - ); - }, - removePersonOnHold: function(personid) - { - FHC_AjaxClient.ajaxCallPost( - CALLED_PATH + '/removeOnHold', - { - "person_id": personid - }, - { - successCallback: function(data, textStatus, jqXHR) { - if (FHC_AjaxClient.hasData(data)) - { - InfocenterDetails.getPostponeDate(personid); - } - else - $("#unpostponemsg").removeClass().addClass("text-warning").text(FHC_PhrasesLib.t('infocenter', 'nichtsZumEntfernen')); - }, - errorCallback: function(){ - $("#unpostponemsg").removeClass().addClass("text-danger").text(FHC_PhrasesLib.t('infocenter', 'fehlerBeimEntfernen')); - }, - veilTimeout: 0 - } - ); - }, getPrestudentData: function(personid, callback) { FHC_AjaxClient.ajaxCallGet( @@ -943,97 +790,6 @@ var InfocenterDetails = { } ); }, - _refreshPostpone: function(postponeobj) - { - var personid = $("#hiddenpersonid").val(); - if (postponeobj === null || postponeobj.date === null || postponeobj.type === null) - { - //show both park and on hold buttons if not parked and not on hold - $("#postponing").html( - '