diff --git a/application/config/stv.php b/application/config/stv.php
index a95bdca75..2b11224d5 100644
--- a/application/config/stv.php
+++ b/application/config/stv.php
@@ -142,14 +142,14 @@ $config['stv_prestudent_tags'] = [
'finished_stg' => ['readonly' => false],
'finished_kf' => ['readonly' => false],
'inwork_kf' => ['readonly' => false],
- 'dd_auto' => ['readonly' => true],
+ 'dd_auto' => ['readonly' => false],
'wh_auto' => ['readonly' => true],
'prewh_auto' => ['readonly' => true],
- 'out_auto' => ['readonly' => true],
+ 'out_auto' => ['readonly' => false],
'zgv_auto' => ['readonly' => true],
'wiedereinstieg_auto' => ['readonly' => true],
'stbtr_erh_auto' => ['readonly' => true],
'beitr_befr_auto' => ['readonly' => true],
- 'jgv_auto' => ['readonly' => true],
+ 'jgv_auto' => ['readonly' => false],
'nachteilausgl_auto' => ['readonly' => true],
];
diff --git a/application/controllers/jobs/TagJob.php b/application/controllers/jobs/TagJob.php
index 9ff43def4..52c0326c9 100644
--- a/application/controllers/jobs/TagJob.php
+++ b/application/controllers/jobs/TagJob.php
@@ -37,56 +37,6 @@ class TagJob extends JOB_Controller
]);
}
- public function pocTagLibs()
- {
- $automatedTagsRes = $this->NotiztypModel->loadWhere(array('automatisiert' => true, 'taglib IS NOT NULL' => null));
- //echo $this->NotiztypModel->db->last_query();
- $automatedTags = hasData($automatedTagsRes) ? getData($automatedTagsRes) : [];
- print_r($automatedTags);
-
- foreach($automatedTags as $autoTag)
- {
- $taglib = strtolower(basename($autoTag->taglib));
- $this->load->library($autoTag->taglib);
-
- $ids = $this->$taglib->getZuordnungIds(array('studiensemester_kurzbz' => self::SEMESTER));
- print_r($ids);
- }
- }
-
- public function loadTagLibs()
- {
- $automatedTagsRes = $this->NotiztypModel->loadWhere(array('automatisiert' => true, 'taglib IS NOT NULL' => null));
- //echo $this->NotiztypModel->db->last_query();
- $automatedTags = hasData($automatedTagsRes) ? getData($automatedTagsRes) : [];
- print_r($automatedTags);
-
- foreach($automatedTags as $autoTag)
- {
- // getPath: must not be lost
- $filePath = APPPATH . 'libraries/' . $autoTag->taglib . '.php'; // APPPATH = application/
-
- if(file_exists($filePath)) {
- require_once($filePath);
- } else {
- echo "File not found: " . $filePath;
- continue;
- }
-
- // className without PATH (basename)
- $className = basename($autoTag->taglib);
-
- $obj = new $className();
- $ids = $obj->getZuordnungIds(['studiensemester_kurzbz' => self::SEMESTER]);
-
- $kurz_bz = $autoTag->typ_kurzbz;
-
- echo PHP_EOL . $className . ": ";
- echo PHP_EOL . $kurz_bz . ": ";
- print_r($ids);
- }
- }
-
public function rebuildAutomatedTags()
{
print_r( PHP_EOL . "Start Job rebuild" . PHP_EOL);
@@ -112,11 +62,12 @@ class TagJob extends JOB_Controller
$className = basename($autoTag->taglib);
$obj = new $className();
- $ids = $obj->getZuordnungIds(['studiensemester_kurzbz' => self::SEMESTER]);
- $idsArray = $ids->prestudent_id;
+ $outputArray = $obj->getZuordnungIds(['studiensemester_kurzbz' => self::SEMESTER]);
+ $data = $outputArray->data;
+
+ $result = $this->taglib->updateAutomatedTags($kurz_bz, $data);
- $result = $this->taglib->updateAutomatedTags($kurz_bz, $idsArray);
$data = $result->retval;
if (isError($result))
return error ('Error occurred during updateAutomatedTags');
@@ -132,70 +83,4 @@ class TagJob extends JOB_Controller
print_r( PHP_EOL . "End Job rebuild" . PHP_EOL);
}
-
- public function rebuildAutomatedTags_DEPR()
- {
- print_r( PHP_EOL . "Start Job rebuild" . PHP_EOL);
- $automaticTags = $this->config->item('stv_automatic_tags');
- print_r( implode( ", ", $automaticTags) . PHP_EOL);
-
- //TODO(Manu) use a loop in library?
- if(in_array('wh_auto', $automaticTags))
- {
- $result = $this->PrestudentstatusModel-> loadWhere(array(
- 'statusgrund_id' => 16,
- 'studiensemester_kurzbz' => self::SEMESTER
- ));
- $data = $result->retval;
- $ids = array_map(function($item) {
- return $item->prestudent_id;
- }, $data);
-
-
- $result = $this->taglib->updateAutomatedTags('wh_auto', $ids);
- $data = $result->retval;
- if (isError($result))
- return error ('Error occurred during updateAutomatedTags');
-
- print_r(PHP_EOL ."ALL TAGS 'wh_auto' " . count($data[0]) . " TO ADD " . count($data[1]) . " TO RECYLE: " . count($data[2]) . " TO DELETE: " . count($data[3]));
-
-
- print_r( PHP_EOL . "Count Recycled: ");
- print_r($data[4]);
- print_r( PHP_EOL . "Count Added: ");
- print_r($data[6]);
- print_r( PHP_EOL . "Count Deleted: ");
- print_r($data[8] . PHP_EOL);
- }
-
- if(in_array('prewh_auto', $automaticTags))
- {
- $result = $this->PrestudentstatusModel->loadWhere(array(
- 'statusgrund_id' => 15,
- 'studiensemester_kurzbz' => self::SEMESTER
- ));
- $data = $result->retval;
- $ids = array_map(function ($item) {
- return $item->prestudent_id;
- }, $data);
-
- $result = $this->taglib->updateAutomatedTags('prewh_auto', $ids);
- if (isError($result))
- return error('Error occurred during updateAutomatedTags');
-
- $data = $result->retval;
-
- print_r(PHP_EOL . "ALL TAGS 'prewh_auto' " . count($data[0]) . " TO ADD " . count($data[1]) . " TO RECYLE: " . count($data[2]) . " TO DELETE: " . count($data[3]));
-
- print_r(PHP_EOL . "Count Recycled: ");
- print_r($data[4]);
- print_r(PHP_EOL . "Count Added: ");
- print_r($data[6]);
- print_r(PHP_EOL . "Count Deleted: ");
- print_r($data[8] . PHP_EOL);
- }
-
- print_r( PHP_EOL . "End Job rebuild" . PHP_EOL);
-
- }
}
diff --git a/application/core/Tag_Controller.php b/application/core/Tag_Controller.php
index a5a3e2a62..b3726ceed 100644
--- a/application/core/Tag_Controller.php
+++ b/application/core/Tag_Controller.php
@@ -76,7 +76,9 @@ class Tag_Controller extends FHCAPI_Controller
tbl_notiz.insertamum,
tbl_notiz.updateamum,
(verfasserperson.vorname || ' ' || verfasserperson.nachname || ' ' || '(' || verfasserbenutzer.uid || ')') as verfasser,
- (bearbeiterperson.vorname || ' ' || bearbeiterperson.nachname || ' ' || '(' || bearbeiterbenutzer.uid || ')') as bearbeiter
+ (bearbeiterperson.vorname || ' ' || bearbeiterperson.nachname || ' ' || '(' || bearbeiterbenutzer.uid || ')') as bearbeiter,
+ tbl_notiz.start,
+ tbl_notiz.ende
"
);
$this->NotizModel->addJoin('public.tbl_notiz_typ', 'public.tbl_notiz.typ = public.tbl_notiz_typ.typ_kurzbz');
@@ -315,7 +317,9 @@ class Tag_Controller extends FHCAPI_Controller
tbl_notiz.insertamum,
tbl_notiz.updateamum,
(verfasserperson.vorname || ' ' || verfasserperson.nachname || ' ' || '(' || verfasserbenutzer.uid || ')') as verfasser,
- (bearbeiterperson.vorname || ' ' || bearbeiterperson.nachname || ' ' || '(' || bearbeiterbenutzer.uid || ')') as bearbeiter
+ (bearbeiterperson.vorname || ' ' || bearbeiterperson.nachname || ' ' || '(' || bearbeiterbenutzer.uid || ')') as bearbeiter,
+ tbl_notiz.start,
+ tbl_notiz.ende
"
);
$this->NotizModel->addJoin('public.tbl_notiz_typ', 'public.tbl_notiz.typ = public.tbl_notiz_typ.typ_kurzbz');
diff --git a/application/libraries/TagLib.php b/application/libraries/TagLib.php
index c84cd19f8..353c8eb56 100644
--- a/application/libraries/TagLib.php
+++ b/application/libraries/TagLib.php
@@ -48,18 +48,49 @@ class TagLib
}
- public function updateAutomatedTags($tag, $prestudentIds)
+ public function updateAutomatedTags($tag, $inputData)
{
+ /*
+ $inputData expected pattern
+
+ [
+ [
+ 'prestudent_id' => 123456,
+ 'von' => '2026-04-01',
+ 'bis' => '2026-06-30'
+ ],
+ ...
+ ]
+ */
+
+ // ---------------------------------
+ // prepare input
+ // ---------------------------------
+ $zeitraum = [];
+ $prestudentIds = [];
+
+ foreach ($inputData as $row) {
+ $pid = $row['prestudent_id'];
+
+ $prestudentIds[] = $pid;
+
+ $zeitraum[$pid] = [
+ 'von' => $row['von'] ?? null,
+ 'bis' => $row['bis'] ?? null
+ ];
+ }
+
$prestudentIds = array_unique($prestudentIds);
- $toRecycle = [];
- $toAdd = [];
- $toDelete = [];
+ // ---------------------------------
+ // load existing tags
+ // ---------------------------------
$allTags = [];
$this->_ci->NotizModel->addSelect('nz.notiz_id');
$this->_ci->NotizModel->addSelect('prestudent_id');
$this->_ci->NotizModel->addJoin('public.tbl_notizzuordnung nz', 'notiz_id');
+
$resultAllTags = $this->_ci->NotizModel->loadWhere([
'typ' => $tag
]);
@@ -72,117 +103,143 @@ class TagLib
}
}
+ // ---------------------------------
+ // map the data
+ // ---------------------------------
+ $toRecycle = [];
+ $toAdd = [];
+ $toDelete = [];
- foreach ($prestudentIds as $value)
- {
- if (isset($allTags[$value])) {
- // if already existing: recyceln: nothing to do
- $toRecycle[$value] = $allTags[$value] ;
+ foreach ($prestudentIds as $pid) {
+ if (isset($allTags[$pid])) {
+ $toRecycle[$pid] = $allTags[$pid];
} else {
- $toAdd[] = $value;
+ $toAdd[] = $pid;
}
}
- foreach ($allTags as $prestudent_id => $notiz_id) {
- if (!in_array($prestudent_id, $prestudentIds)) {
- $toDelete[$prestudent_id] = $notiz_id;
+ foreach ($allTags as $pid => $notizId) {
+ if (!in_array($pid, $prestudentIds)) {
+ $toDelete[$pid] = $notizId;
}
}
- //RECYCLE: Just insert new update Date
- $countRecyled = 0;
+ // ---------------------------------
+ // recycle (update existing)
+ // ---------------------------------
+ $countRecycled = 0;
$retagged = [];
- foreach ($toRecycle as $value)
- {
- //TODO(Manu) refactor for recycle, add
- $resultUpdateNotiz = $this->_ci->NotizModel->update(
+
+ foreach ($toRecycle as $pid => $notizId) {
+
+ $result = $this->_ci->NotizModel->update(
+ ['notiz_id' => $notizId],
[
- 'notiz_id' => $value
- ],
- array(
- 'updateamum' => date('Y-m-d H:i:s'),
- 'updatevon' => 'BatchJobTagUpdate',
- ));
+ 'updateamum' => date('Y-m-d H:i:s'),
+ 'updatevon' => 'BatchJobTagUpdate',
+ 'start' => $zeitraum[$pid]['von'],
+ 'ende' => $zeitraum[$pid]['bis']
+ ]
+ );
- if (isError($resultUpdateNotiz))
- return error ('Error occurred update Result ' . $value);
+ if (isError($result)) {
+ return error('Error updating tag ' . $notizId);
+ }
- $countRecyled++;
- $retagged[] = $resultUpdateNotiz->retval;
+ $countRecycled++;
+ $retagged[] = $notizId;
}
- //ADD: Create new Tags
+ // ---------------------------------
+ // ADD
+ // ---------------------------------
$countAdded = 0;
$tagged = [];
- foreach ($toAdd as $value)
- {
- //TODO(Manu) refactor for recycle, add
- $resultInsertNotiz = $this->_ci->NotizModel->insert(array(
+
+ foreach ($toAdd as $pid) {
+
+ $resultInsert = $this->_ci->NotizModel->insert([
'titel' => 'TAG',
'text' => 'AUTOMATED TAG',
- 'verfasser_uid' => self::BATCHUSER, //has to be an uid
+ 'verfasser_uid' => self::BATCHUSER,
'erledigt' => false,
'insertamum' => date('Y-m-d H:i:s'),
'insertvon' => 'BatchJobTagAdd',
- 'typ' => $tag
- ));
+ 'typ' => $tag,
+ 'start' => $zeitraum[$pid]['von'],
+ 'ende' => $zeitraum[$pid]['bis']
+ ]);
- if (isError($resultInsertNotiz))
- return error ('Error occurred insert Result ' . $value);
+ if (isError($resultInsert)) {
+ return error('Error inserting tag for prestudent ' . $pid);
+ }
- $resultInsertZuordnung = $this->_ci->NotizzuordnungModel->insert(array(
- 'notiz_id' => $resultInsertNotiz->retval,
- self::TYP_ZUORDNUNG => $value
- ));
+ $notizId = $resultInsert->retval;
- if (isError($resultInsertZuordnung))
- return error ('Error occurred insert Zuordnung' . $value);
+ $resultZuordnung = $this->_ci->NotizzuordnungModel->insert([
+ 'notiz_id' => $notizId,
+ self::TYP_ZUORDNUNG => $pid
+ ]);
+
+ if (isError($resultZuordnung)) {
+ return error('Error inserting relation for prestudent ' . $pid);
+ }
$countAdded++;
- $tagged[$resultInsertNotiz->retval] = $value;
+ $tagged[$notizId] = $pid;
}
- //DELETE OLD Tags, no more valid
+ // ---------------------------------
+ // delete
+ // ---------------------------------
$countDeleted = 0;
$deleted = [];
- foreach ($toDelete as $value)
- {
+
+ foreach ($toDelete as $pid => $notizId) {
+
$result = $this->_ci->NotizzuordnungModel->delete([
- 'notiz_id' => $value
+ 'notiz_id' => $notizId
]);
- if (isError($result))
- return error ('Error occurred delete Notizzuordnung' . $notiz_id);
+
+ if (isError($result)) {
+ return error('Error deleting relation ' . $notizId);
+ }
$result = $this->_ci->NotizModel->delete([
- 'notiz_id' => $notiz_id
+ 'notiz_id' => $notizId
]);
- if (isError($result))
- return error ('Error occurred delete Notiz' . $notiz_id);
+
+ if (isError($result)) {
+ return error('Error deleting note ' . $notizId);
+ }
$countDeleted++;
- $deleted[] = $value;
+ $deleted[] = $notizId;
}
+ // ---------------------------------
+ // return
+ // ---------------------------------
return success([
'input' => [
'tag' => $tag,
- 'prestudentIds' => $prestudentIds,
+ 'prestudentIds' => $prestudentIds
],
'summary' => [
- 'recycled' => $countRecyled,
+ 'recycled' => $countRecycled,
'added' => $countAdded,
- 'deleted' => $countDeleted,
+ 'deleted' => $countDeleted
],
'details' => [
'existingTags' => $allTags,
'toAdd' => $toAdd,
'toRecycle' => $toRecycle,
- 'toDelete' => $toDelete,
+ 'toDelete' => $toDelete
],
'results' => [
'retaggedNotizIds' => $retagged,
'newTags' => $tagged,
- 'deletedNotizIds' => $deleted,
+ 'deletedNotizIds' => $deleted
]
]);
}
@@ -248,14 +305,11 @@ class TagLib
$return = ['added' => $resultInsertNotiz->retval];
}
-
return success($return);
-
}
/*
* main function for rebuild Tags for single prestudent
- * manually triggered
* */
public function rebuildTagsForPrestudent($prestudent_id)
{
@@ -285,11 +339,11 @@ class TagLib
$criteriaIsSet = $obj->isCriteriaSetFor([
'prestudent_id' => $prestudent_id,
'studiensemester_kurzbz' => self::SEMESTER
- ]);
+ ]);
//$return = $this->_ci->PrestudentstatusModel->db->last_query();
$kurz_bz = $autoTag->typ_kurzbz;
- // $return[$kurz_bz] = $criteriaIsSet;
+ // $return[$kurz_bz] = $criteriaIsSet;
if($criteriaIsSet)
{
@@ -313,32 +367,6 @@ class TagLib
}
- public function rebuildTagsForPrestudentDEPR($prestudent_id)
- {
- $automaticTags = $this->_ci->config->item('stv_automatic_tags');
- $return = [];
-
- foreach ($automaticTags as $tag)
- {
- if($this->isCriteriaSetFor($tag, $prestudent_id))
- {
- $result = $this->updateAutomatedTagsForPrestudent($tag, $prestudent_id);
- if (isError($result))
- return error ('Error occurred during updateAutomatedTags' . $tag);
-
- else
- $return[$tag] = $result;
- }
- else {
- $result = $this->checkForDelete($tag, $prestudent_id);
- if($result != null)
- $return[$tag] = $result;
- }
- }
- return success($return);
-
- }
-
public function checkForDelete($tag, $prestudent_id)
{
$return = null;
@@ -378,40 +406,4 @@ class TagLib
return $return;
}
- public function isCriteriaSetFor_DEPR($tag, $prestudent_id)
- {
- //TODO(finish list)
- if($tag == 'wh_auto')
- {
- $result = $this->_ci->PrestudentstatusModel->loadWhere(array(
- 'statusgrund_id' => 16,
- 'studiensemester_kurzbz' => self::SEMESTER,
- 'prestudent_id' => $prestudent_id
- ));
- if(hasData($result))
- {
- return true;
- }
- else
- return false;
- }
-
- if($tag == 'prewh_auto')
- {
- $result = $this->_ci->PrestudentstatusModel->loadWhere(array(
- 'statusgrund_id' => 15,
- 'studiensemester_kurzbz' => self::SEMESTER,
- 'prestudent_id' => $prestudent_id
- ));
- if(hasData($result))
- {
- return true;
- }
- else
- return false;
- }
-
- return false;
-
- }
}
diff --git a/application/libraries/tags/CoreDoubleDegreeTagLib.php b/application/libraries/tags/CoreDoubleDegreeTagLib.php
index eed489fae..038d29ae1 100644
--- a/application/libraries/tags/CoreDoubleDegreeTagLib.php
+++ b/application/libraries/tags/CoreDoubleDegreeTagLib.php
@@ -26,17 +26,24 @@ class CoreDoubleDegreeTagLib
$semester = $params['studiensemester_kurzbz'];
$this->ci->MobilitaetModel->addJoin('bis.tbl_gsprogramm', 'gsprogramm_id');
+ $this->ci->MobilitaetModel->addJoin('public.tbl_studiensemester', 'studiensemester_kurzbz');
+
$result = $this->ci->MobilitaetModel-> loadWhere(array(
'gsprogrammtyp_kurzbz' => 'Double',
'studiensemester_kurzbz' => $semester
));
$data = $result->retval;
- $ids = array_map(function($item) {
- return $item->prestudent_id;
+
+ $doubledegree_data = array_map(function($item) {
+ return [
+ 'prestudent_id' => $item->prestudent_id,
+ 'von' => $item->start,
+ 'bis' => $item->ende
+ ];
}, $data);
return (object) array(
- 'prestudent_id' => $ids
+ 'data' => $doubledegree_data
);
}
diff --git a/application/libraries/tags/CoreJgvTagLib.php b/application/libraries/tags/CoreJgvTagLib.php
index 1117e997b..028c172a2 100644
--- a/application/libraries/tags/CoreJgvTagLib.php
+++ b/application/libraries/tags/CoreJgvTagLib.php
@@ -28,12 +28,17 @@ class CoreJgvTagLib
$result = $this->ci->BenutzerfunktionModel->getPrestudentsOfJgv($semester);
$data = $result->retval;
- $ids = array_map(function($item) {
- return $item->prestudent_id;
+
+ $jgv_data = array_map(function($item) {
+ return [
+ 'prestudent_id' => $item->prestudent_id,
+ 'von' => $item->datum_von,
+ 'bis' => $item->datum_bis
+ ];
}, $data);
return (object) array(
- 'prestudent_id' => $ids
+ 'data' => $jgv_data
);
}
diff --git a/application/libraries/tags/CoreMissingZgvTagLib.php b/application/libraries/tags/CoreMissingZgvTagLib.php
index acf71c4d2..f108adb78 100644
--- a/application/libraries/tags/CoreMissingZgvTagLib.php
+++ b/application/libraries/tags/CoreMissingZgvTagLib.php
@@ -36,13 +36,19 @@ class CoreMissingZgvTagLib
));
$data = $result->retval;
- $ids = array_map(function($item) {
- return $item->prestudent_id;
+
+ $zgvmissing_data = array_map(function($item) {
+ return [
+ 'prestudent_id' => $item->prestudent_id,
+ 'von' => null,
+ 'bis' => null
+ ];
}, $data);
return (object) array(
- 'prestudent_id' => $ids
+ 'data' => $zgvmissing_data
);
+
}
public function isCriteriaSetFor(array $params)
diff --git a/application/libraries/tags/CoreOutgoingTagLib.php b/application/libraries/tags/CoreOutgoingTagLib.php
index f1764611a..185c3a92b 100644
--- a/application/libraries/tags/CoreOutgoingTagLib.php
+++ b/application/libraries/tags/CoreOutgoingTagLib.php
@@ -28,19 +28,25 @@ class CoreOutgoingTagLib
$result = $this->ci->BisioModel->getOutgoingsOfSemester($semester);
$data = $result->retval;
- $ids = array_map(function($item) {
- return $item->prestudent_id;
+
+ $outgoing_data = array_map(function($item) {
+ return [
+ 'prestudent_id' => $item->prestudent_id,
+ 'von' => $item->von,
+ 'bis' => $item->bis
+ ];
}, $data);
return (object) array(
- 'prestudent_id' => $ids
+ 'data' => $outgoing_data
);
+
+
}
public function isCriteriaSetFor(array $params)
{
- if(!isset($params['prestudent_id']) || !isset($params['studiensemester_kurzbz']))
- {
+ if (!isset($params['prestudent_id']) || !isset($params['studiensemester_kurzbz'])) {
return false;
}
@@ -48,12 +54,68 @@ class CoreOutgoingTagLib
$prestudent_id = $params['prestudent_id'];
$result = $this->ci->BisioModel->isPrestudentOutgoing($semester, $prestudent_id);
- if(hasData($result))
- {
+
+ if (hasData($result)) {
return true;
+ } else
+ return false;
+ }
+
+/* if(hasData($result))
+ {
+ return array(
+ $result
+ );
+
+ var_dump($result);
+ die();
+
+ $row = $result->data->retval[0] ?? null;
+ return [
+ 'prestudent_id' => $row->prestudent_id, //trying to get property of non-object
+ 'von' => $row->von, //trying to get property of non-object
+ 'bis' => $row->bis //trying to get property of non-object
+ ];
+
+
+ return current($result);//-> warum retvall = []
+ return getData($result); //-> warum retvall = []
+
+ $row = $result->data->retval[0] ?? null;
+ $row = $result->data->retval[0] ?? null;
+ return [
+ 'prestudent_id' => $row->prestudent_id,
+ 'von' => $row->von,
+ 'bis' => $row->bis
+ ];
}
else
- return false;
- }
+ return false;*/
+
+ //return $result;
+/* if(hasData($result))
+ {
+ $data = $result->retval;
+ return $result;
+ return [
+ 'prestudent_id' => $data->prestudent_id,
+ 'von' => $data->von,
+ 'bis' => $data->bis
+ ];
+ }
+ else
+ return [
+ 'prestudent_id' => $prestudent_id,
+ 'von' => null,
+ 'bis' => null
+ ];*/
+
+/* return (object) array(
+ 'data' => $data
+ );*/
+
+ // return $data;
+
+ //}
}
diff --git a/application/libraries/tags/CorePrewiederholerTagLib.php b/application/libraries/tags/CorePrewiederholerTagLib.php
index cf15bd938..a968fa9a7 100644
--- a/application/libraries/tags/CorePrewiederholerTagLib.php
+++ b/application/libraries/tags/CorePrewiederholerTagLib.php
@@ -24,17 +24,24 @@ class CorePrewiederholerTagLib
}
$semester = $params['studiensemester_kurzbz'];
+
+ $this->ci->PrestudentstatusModel->addJoin('public.tbl_studiensemester', 'studiensemester_kurzbz');
$result = $this->ci->PrestudentstatusModel-> loadWhere(array(
'statusgrund_id' => 15,
'studiensemester_kurzbz' => $semester
));
$data = $result->retval;
- $ids = array_map(function($item) {
- return $item->prestudent_id;
+
+ $prewiederholer_data = array_map(function($item) {
+ return [
+ 'prestudent_id' => $item->prestudent_id,
+ 'von' => $item->start,
+ 'bis' => $item->ende
+ ];
}, $data);
return (object) array(
- 'prestudent_id' => $ids
+ 'data' => $prewiederholer_data
);
}
diff --git a/application/libraries/tags/CoreStudienbeitragErhoehtTagLib.php b/application/libraries/tags/CoreStudienbeitragErhoehtTagLib.php
index 3e0eaaa26..82dcee3b8 100644
--- a/application/libraries/tags/CoreStudienbeitragErhoehtTagLib.php
+++ b/application/libraries/tags/CoreStudienbeitragErhoehtTagLib.php
@@ -26,17 +26,24 @@ class CoreStudienbeitragErhoehtTagLib
$semester = $params['studiensemester_kurzbz'];
$this->ci->KontoModel->addJoin('public.tbl_prestudent', 'person_id');
+ $this->ci->KontoModel->addJoin('public.tbl_studiensemester', 'studiensemester_kurzbz');
+
$result = $this->ci->KontoModel-> loadWhere(array(
'buchungstyp_kurzbz' => 'StudiengebuehrErhoeht',
'studiensemester_kurzbz' => $semester
));
$data = $result->retval;
- $ids = array_map(function($item) {
- return $item->prestudent_id;
+
+ $konto_data = array_map(function($item) {
+ return [
+ 'prestudent_id' => $item->prestudent_id,
+ 'von' => $item->start,
+ 'bis' => $item->ende
+ ];
}, $data);
return (object) array(
- 'prestudent_id' => $ids
+ 'data' => $konto_data
);
}
diff --git a/application/libraries/tags/CoreUnterbrecherTagLib.php b/application/libraries/tags/CoreUnterbrecherTagLib.php
index 8ea16e378..160881d48 100644
--- a/application/libraries/tags/CoreUnterbrecherTagLib.php
+++ b/application/libraries/tags/CoreUnterbrecherTagLib.php
@@ -24,17 +24,24 @@ class CoreUnterbrecherTagLib
}
$semester = $params['studiensemester_kurzbz'];
+ $this->ci->PrestudentstatusModel->addJoin('public.tbl_studiensemester', 'studiensemester_kurzbz');
+
$result = $this->ci->PrestudentstatusModel-> loadWhere(array(
'status_kurzbz' => 'Unterbrecher',
'studiensemester_kurzbz' => $semester
));
$data = $result->retval;
- $ids = array_map(function($item) {
- return $item->prestudent_id;
+
+ $unterbrecher_data = array_map(function($item) {
+ return [
+ 'prestudent_id' => $item->prestudent_id,
+ 'von' => $item->start,
+ 'bis' => $item->ende
+ ];
}, $data);
return (object) array(
- 'prestudent_id' => $ids
+ 'data' => $unterbrecher_data
);
}
diff --git a/application/libraries/tags/CoreWiederholerTagLib.php b/application/libraries/tags/CoreWiederholerTagLib.php
index 43fa6fce3..c02fca608 100644
--- a/application/libraries/tags/CoreWiederholerTagLib.php
+++ b/application/libraries/tags/CoreWiederholerTagLib.php
@@ -24,17 +24,24 @@ class CoreWiederholerTagLib
}
$semester = $params['studiensemester_kurzbz'];
+
+ $this->ci->PrestudentstatusModel->addJoin('public.tbl_studiensemester', 'studiensemester_kurzbz');
$result = $this->ci->PrestudentstatusModel-> loadWhere(array(
'statusgrund_id' => 16,
'studiensemester_kurzbz' => $semester
));
$data = $result->retval;
- $ids = array_map(function($item) {
- return $item->prestudent_id;
+
+ $wiederholer_data = array_map(function($item) {
+ return [
+ 'prestudent_id' => $item->prestudent_id,
+ 'von' => $item->start,
+ 'bis' => $item->ende
+ ];
}, $data);
return (object) array(
- 'prestudent_id' => $ids
+ 'data' => $wiederholer_data
);
}
diff --git a/application/models/codex/Bisio_model.php b/application/models/codex/Bisio_model.php
index 765f01b84..055b8e4ea 100644
--- a/application/models/codex/Bisio_model.php
+++ b/application/models/codex/Bisio_model.php
@@ -53,7 +53,7 @@ class Bisio_model extends DB_Model
public function getOutgoingsOfSemester($studiensemester_kurzbz)
{
$query = "
- SELECT DISTINCT ps.prestudent_id
+ SELECT DISTINCT ps.prestudent_id, tbl_bisio.von, tbl_bisio.bis
FROM bis.tbl_bisio
JOIN public.tbl_student USING (student_uid)
JOIN public.tbl_prestudent ps USING (prestudent_id)
@@ -76,14 +76,14 @@ class Bisio_model extends DB_Model
{
$query = "
SELECT
- *
+ ps.prestudent_id, tbl_bisio.von, tbl_bisio.bis
FROM bis.tbl_bisio
JOIN public.tbl_student USING (student_uid)
JOIN public.tbl_prestudent ps USING (prestudent_id)
JOIN public.tbl_prestudentstatus pss ON (ps.prestudent_id = pss.prestudent_id)
JOIN public.tbl_studiensemester ss ON (pss.studiensemester_kurzbz = ss.studiensemester_kurzbz)
WHERE ss.studiensemester_kurzbz = ?
- AND pss.status_kurzbz = 'Student'
+ --AND pss.status_kurzbz = 'Student'
AND (
tbl_bisio.von <= ss.ende
AND (
diff --git a/application/models/person/Benutzerfunktion_model.php b/application/models/person/Benutzerfunktion_model.php
index f5a453bd0..2ce83d181 100644
--- a/application/models/person/Benutzerfunktion_model.php
+++ b/application/models/person/Benutzerfunktion_model.php
@@ -323,7 +323,7 @@ class Benutzerfunktion_model extends DB_Model
public function getPrestudentsOfJgv($semester)
{
$query = "
- SELECT DISTINCT ps.prestudent_id
+ SELECT DISTINCT ps.prestudent_id, bf.datum_von, bf.datum_bis
FROM public.tbl_benutzerfunktion bf
JOIN public.tbl_benutzer bn USING (uid)
JOIN public.tbl_prestudent ps USING (person_id)
diff --git a/public/js/components/Tag/Tag.js b/public/js/components/Tag/Tag.js
index d29097491..894da343e 100644
--- a/public/js/components/Tag/Tag.js
+++ b/public/js/components/Tag/Tag.js
@@ -45,7 +45,9 @@ export default {
insertvon: "",
updateamum: "",
updatevon: "",
- response: ""
+ response: "",
+ start: "",
+ ende: ""
},
mode: "create"
};
@@ -88,6 +90,10 @@ export default {
this.tagData.bearbeiter = item.bearbeiter;
this.tagData.verfasser = item.verfasser;
this.tagData.readonly = item.readonly;
+ //add for automated tags
+ this.tagData.automatisiert = item.automatisiert;
+ this.tagData.start = this.formatDateTimeDay(item.start);
+ this.tagData.ende = this.formatDateTimeDay(item.ende);
if (item && item.notiz_id)
{
@@ -202,6 +208,14 @@ export default {
second: "2-digit"
});
},
+ formatDateTimeDay: (dateString) => {
+ if (!dateString) return null;
+ return new Date(dateString).toLocaleString('de-AT', {
+ year: "numeric",
+ month: "2-digit",
+ day: "2-digit",
+ });
+ },
async copy (){
await navigator.clipboard.writeText(this.tagData.notiz);
}
@@ -259,6 +273,15 @@ export default {
{{ $p.t('notiz', 'tag_bearbeiter', { 0: tagData.bearbeiter, 1: tagData.updateamum }) }}
+
+ gültig
+
+
+ von {{tagData.start}}
+
+
+ bis {{tagData.ende}}
+
diff --git a/public/js/tabulator/formatter/tags.js b/public/js/tabulator/formatter/tags.js
index 906f2fc6c..0af1953fd 100644
--- a/public/js/tabulator/formatter/tags.js
+++ b/public/js/tabulator/formatter/tags.js
@@ -46,6 +46,7 @@ export function tagFormatter(cell, tagComponent)
const tagDef = mappedData.find(t => t.typ_kurzbz === tag.typ_kurzbz);
+ //todo: check trigger manually after creation of manual automatic tag
if (!tagDef && tag.typ_kurzbz.includes("_auto") || tagDef?.automatisiert) {
tagElement.className += " tag_auto";
tagElement.innerHTML = " " + tag.beschreibung;