mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-21 00:42:15 +00:00
- added issue resolution job and libraries for defining how to resolve issues
- added issue inserts (fehlerupdate.php), included them in checksystem - added getAufenthaltsdauer method to Bisio_model.php - Add column parameterFuerBehebung to system.tbl_issue
This commit is contained in:
@@ -11,4 +11,37 @@ class Bisio_model extends DB_Model
|
||||
$this->dbTable = 'bis.tbl_bisio';
|
||||
$this->pk = 'bisio_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets duration of stay in days by bisio_id.
|
||||
* @param int $bisio_id
|
||||
* @return object success with number of days or error
|
||||
*/
|
||||
public function getAufenthaltsdauer($bisio_id)
|
||||
{
|
||||
// get from and to date
|
||||
$this->addSelect('von, bis');
|
||||
$bisioRes = $this->load($bisio_id);
|
||||
|
||||
if (isError($bisioRes))
|
||||
return $bisioRes;
|
||||
|
||||
if (hasData($bisioRes))
|
||||
{
|
||||
$bisioData = getData($bisioRes)[0];
|
||||
|
||||
$avon = $bisioData->von;
|
||||
$abis = $bisioData->bis;
|
||||
|
||||
if (is_null($avon) || is_null($abis))
|
||||
return success("Von or bis date not set");
|
||||
|
||||
$vonDate = new DateTime($avon);
|
||||
$bisDate = new DateTime($abis);
|
||||
$interval = $vonDate->diff($bisDate);
|
||||
return success($interval->days);
|
||||
}
|
||||
else
|
||||
return success("Bisio not found");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user