mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
de60770e74
- removed comments - automatically added issue_id to params, output the id in error messages
55 lines
1.5 KiB
PHP
55 lines
1.5 KiB
PHP
<?php
|
|
|
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
/**
|
|
* ECTS erworben must exist for outgoing if longer stay
|
|
*/
|
|
class CORE_INOUT_0006 implements IIssueResolvedChecker
|
|
{
|
|
public function checkIfIssueIsResolved($params)
|
|
{
|
|
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
|
|
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
|
|
|
|
$this->_ci =& get_instance(); // get code igniter instance
|
|
|
|
$this->_ci->load->model('codex/Bisio_model', 'BisioModel');
|
|
//$this->_ci->load->model('codex/Aufenthaltfoerderung_model', 'AufenthaltfoerderungModel');
|
|
|
|
// get all Zwecke
|
|
$this->_ci->BisioModel->addSelect('ects_erworben');
|
|
$bisioRes = $this->_ci->BisioModel->loadWhere(array('bisio_id' => $params['bisio_id']));
|
|
|
|
if (isError($bisioRes))
|
|
return $bisioRes;
|
|
|
|
if (hasData($bisioRes) && !isEmptyString(getData($bisioRes)[0]->ects_erworben))
|
|
{
|
|
// resolved if ects exists
|
|
return success(true);
|
|
}
|
|
else
|
|
{
|
|
// get Bisio Aufenthaltsdauer
|
|
$aufenthaltsdauerRes = $this->_ci->BisioModel->getAufenthaltsdauer($params['bisio_id']);
|
|
|
|
if (isError($aufenthaltsdauerRes))
|
|
return $aufenthaltsdauerRes;
|
|
|
|
if (hasData($aufenthaltsdauerRes))
|
|
{
|
|
$aufenthaltsdauer = getData($aufenthaltsdauerRes);
|
|
|
|
// check if stay >= 29 days. If yes and no ects - not resolved
|
|
if ($aufenthaltsdauer >= 29)
|
|
return success(false);
|
|
else
|
|
return success(true);
|
|
}
|
|
else // no Aufenthaltsdauer - not resolved
|
|
return success(false);
|
|
}
|
|
}
|
|
}
|