mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
voriges studienjahr in kontobuchungsbezeichnung
This commit is contained in:
Regular → Executable
+53
@@ -163,5 +163,58 @@ class studienjahr extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Springt von Studienjahr $studienjahr_kurzbz um $wert Studienjahre vor/zurueck
|
||||
*
|
||||
* @param string $studienjahr_kurzbz.
|
||||
* @param int $wert.
|
||||
* @return string studienjahr_kurzbz
|
||||
*/
|
||||
public function jump($studienjahr_kurzbz, $wert)
|
||||
{
|
||||
if($wert>0)
|
||||
{
|
||||
$op='>=';
|
||||
$sort='ASC';
|
||||
}
|
||||
elseif($wert<0)
|
||||
{
|
||||
$op='<=';
|
||||
$sort='DESC';
|
||||
}
|
||||
else
|
||||
{
|
||||
$op='=';
|
||||
$sort='';
|
||||
}
|
||||
|
||||
$qry = "select distinct(studienjahr_kurzbz)
|
||||
FROM tbl_studiensemester
|
||||
Where start $op
|
||||
(
|
||||
SELECT start
|
||||
FROM tbl_studiensemester
|
||||
WHERE studienjahr_kurzbz = ".$this->db_add_param($studienjahr_kurzbz)."
|
||||
ORDER BY start LIMIT 1
|
||||
)
|
||||
ORDER BY studienjahr_kurzbz $sort
|
||||
offset ".abs($wert)." LIMIT 1";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object())
|
||||
{
|
||||
return $row->studienjahr_kurzbz;
|
||||
}
|
||||
else
|
||||
return $studienjahr_kurzbz;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler bei einer Abfrage';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -26,6 +26,7 @@ require_once("../../include/datum.class.php");
|
||||
|
||||
require_once("../../include/studiengang.class.php");
|
||||
require_once("../../include/studiensemester.class.php");
|
||||
require_once("../../include/studienjahr.class.php");
|
||||
require_once("../../include/student.class.php");
|
||||
require_once("../../include/konto.class.php");
|
||||
|
||||
@@ -100,7 +101,7 @@ function lChkStudiengang($studiengang, $postStudiengang, $rowStudiengang, $stude
|
||||
/**
|
||||
* Create an object of type konto and fill it with data
|
||||
*/
|
||||
function lCredit($student, $postStudiensemester, $rowAmount, $rowDate)
|
||||
function lCredit($student, $postStudiensemester, $rowAmount, $rowDate, $Studienjahr)
|
||||
{
|
||||
$user = get_uid();
|
||||
// To format a date
|
||||
@@ -115,7 +116,7 @@ function lCredit($student, $postStudiensemester, $rowAmount, $rowDate)
|
||||
$konto->buchungstyp_kurzbz = "Leistungsstipendium";
|
||||
$konto->mahnspanne = 0;
|
||||
$konto->buchungsdatum = $datum->formatDatum($rowDate);
|
||||
$konto->buchungstext = "Leistungsstipendium STG ".$postStudiensemester;
|
||||
$konto->buchungstext = "Leistungsstipendium für Studienjahr ".$Studienjahr;
|
||||
$konto->insertamum = date('Y-m-d H:i:s');
|
||||
$konto->insertvon = $user;
|
||||
|
||||
@@ -223,7 +224,7 @@ if (!$errorOccurred && $dataPosted)
|
||||
$student = new student(); // Object that represents a student
|
||||
$fileRow = false; // Contains a single file row
|
||||
$lineNumber = 0; // lines number counter
|
||||
|
||||
|
||||
// Gets the previous studiensemester to the posted one
|
||||
if (($previousStudiensemester = $studiensemester->getPreviousFrom($postStudiensemester)) === false)
|
||||
{
|
||||
@@ -282,8 +283,13 @@ if (!$errorOccurred && $dataPosted)
|
||||
}
|
||||
else
|
||||
{
|
||||
$stsem = new studiensemester($postStudiensemester);
|
||||
$stjahr = new studienjahr();
|
||||
if (!$vorjahr = $stjahr->jump($stsem->studienjahr_kurzbz, -1))
|
||||
$vorjahr = 'Vorjahr';
|
||||
|
||||
// Create an object of type konto and fill it with data
|
||||
$konto = lCredit($student, $postStudiensemester, $rowAmount, $rowDate);
|
||||
$konto = lCredit($student, $postStudiensemester, $rowAmount, $rowDate, $vorjahr);
|
||||
// Inserting positive amount
|
||||
if ($konto->save(true) === true)
|
||||
{
|
||||
@@ -406,7 +412,7 @@ if (!$errorOccurred && $dataPosted)
|
||||
{
|
||||
$selected = "";
|
||||
}
|
||||
|
||||
|
||||
echo sprintf("<option value=\"%s\" %s>%s</option>", $val->studiensemester_kurzbz, $selected, $val->studiensemester_kurzbz);
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user