active angels: Bugfix and prevent errors when searching double spaces
This commit is contained in:
parent
491ee37651
commit
540efef63e
|
@ -168,7 +168,7 @@ function admin_active()
|
||||||
->leftJoin('Shifts', function ($join) use ($show_all_shifts) {
|
->leftJoin('Shifts', function ($join) use ($show_all_shifts) {
|
||||||
/** @var JoinClause $join */
|
/** @var JoinClause $join */
|
||||||
$join->on('ShiftEntry.SID', '=', 'Shifts.SID');
|
$join->on('ShiftEntry.SID', '=', 'Shifts.SID');
|
||||||
if ($show_all_shifts) {
|
if (!$show_all_shifts) {
|
||||||
$join->where(function ($query) {
|
$join->where(function ($query) {
|
||||||
/** @var Builder $query */
|
/** @var Builder $query */
|
||||||
$query->where('Shifts.end', '<', time())
|
$query->where('Shifts.end', '<', time())
|
||||||
|
@ -187,6 +187,7 @@ function admin_active()
|
||||||
$query->limit($count);
|
$query->limit($count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var User[] $users */
|
||||||
$users = $query->get();
|
$users = $query->get();
|
||||||
$matched_users = [];
|
$matched_users = [];
|
||||||
if ($search == '') {
|
if ($search == '') {
|
||||||
|
@ -198,7 +199,8 @@ function admin_active()
|
||||||
if (count($tokens) > 0) {
|
if (count($tokens) > 0) {
|
||||||
$match = false;
|
$match = false;
|
||||||
foreach ($tokens as $t) {
|
foreach ($tokens as $t) {
|
||||||
if (stristr($usr->name, trim($t))) {
|
$t = trim($t);
|
||||||
|
if (!empty($t) && stristr($usr->name, $t)) {
|
||||||
$match = true;
|
$match = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,8 @@ function admin_free()
|
||||||
$match = false;
|
$match = false;
|
||||||
$index = join('', $usr->toArray());
|
$index = join('', $usr->toArray());
|
||||||
foreach ($tokens as $t) {
|
foreach ($tokens as $t) {
|
||||||
if (stristr($index, trim($t))) {
|
$t = trim($t);
|
||||||
|
if (!empty($t) && stristr($index, $t)) {
|
||||||
$match = true;
|
$match = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue