diff --git a/controllers/index.php b/controllers/index.php index 877bf0716c6479d205b4f63dcfbaf55c03fc6b4c..ac355a6905a1015df84b8199afe49719175f283b 100644 --- a/controllers/index.php +++ b/controllers/index.php @@ -97,7 +97,7 @@ class IndexController extends PluginController { } } //bereits ausgeschieden (nicht in Statusgruppe aber Vertrag vorhanden) - $old_stumi_contracts = StundenzettelContract::findByInst_id($institute->id); + $old_stumi_contracts = StundenzettelContract::get_inst_contracts($institute->id, $show_all); foreach ($old_stumi_contracts as $old_contract) { $former_stumi = User::find($old_contract->user_id); if (!in_array($old_contract->user_id, $user_ids) && (!$this->search || stripos($former_stumi->username . ' ' . $former_stumi->vorname . ' ' . $former_stumi->nachname, $this->search))) { @@ -107,7 +107,7 @@ class IndexController extends PluginController { } } if (isset($this->inst_data[$institute->id][0])) { - array_push($this->groups[$institute->id], 0); + array_push($this->groups[$institute->id], null); } } } diff --git a/models/StundenzettelContract.class.php b/models/StundenzettelContract.class.php index 8b2b6c08e6b4467b7408ab30f9a442c8b21497cb..72374888d8eabc417cc2da30bfb75d6c8fdd95d8 100644 --- a/models/StundenzettelContract.class.php +++ b/models/StundenzettelContract.class.php @@ -120,6 +120,12 @@ class StundenzettelContract extends \SimpleORMap return $contracts; } + static function get_inst_contracts($inst_id, $all = true) + { + $contract_end = $all ? 0 : strtotime('first day of last month midnight'); + return self::findBySQL('inst_id = ? AND contract_end >= ?', [$inst_id, $contract_end]); + } + static function get_user_inst_contracts($user_id, $inst_id, $all = true) { $contract_end = $all ? 0 : strtotime('first day of last month midnight'); diff --git a/views/index/index.php b/views/index/index.php index 371cd334e2d276e93c7f1e379b640010890ec70b..1f27fe4b828f321741d196a150cf89b642de83d3 100644 --- a/views/index/index.php +++ b/views/index/index.php @@ -7,12 +7,12 @@ <?= htmlReady($institute->name) ?> </h2> <? foreach ($groups[$institute->id] as $group) : ?> - <? if ($group->id) : ?> + <? if ($group) : ?> <? $group_id = $group->id; ?> <!-- echte Gruppe --> <? else : ?> <? $group_id = 0; ?> <!-- ausgeschiedene MA --> <? endif ?> - <h3><?= $group->name ? htmlReady($group->name) : $controller->_('Ausgeschiedene studentische/wisschenschaftliche MitarbeiterInnen') ?></h3> + <h3><?= $group ? htmlReady($group->name) : $controller->_('Ausgeschiedene studentische/wisschenschaftliche MitarbeiterInnen') ?></h3> <table id="stumi-contract-entries" class="sortable-table default" data-sortlist="[[0,0]]"> <thead> <tr>