fix wrong angel type alarm

This commit is contained in:
Philip Häusler 2014-12-06 18:55:24 +01:00
parent 481e52cf77
commit 10d7fce163
4 changed files with 296 additions and 297 deletions

View File

@ -5,14 +5,18 @@
*/ */
function user_angeltypes_unconfirmed_hint() { function user_angeltypes_unconfirmed_hint() {
global $user; global $user;
$unconfirmed_user_angeltypes = User_unconfirmed_AngelTypes($user); $unconfirmed_user_angeltypes = User_unconfirmed_AngelTypes($user);
if ($unconfirmed_user_angeltypes === false) if ($unconfirmed_user_angeltypes === false)
engelsystem_error("Unable to load user angeltypes."); engelsystem_error("Unable to load user angeltypes.");
if (count($unconfirmed_user_angeltypes) == 0) if (count($unconfirmed_user_angeltypes) == 0)
return ''; return '';
if ($_REQUEST['p'] == 'angeltypes' && $_REQUEST['action'] == 'view' && $_REQUEST['angeltype_id'] == $unconfirmed_user_angeltypes[0]['angeltype_id'])
return ''; $unconfirmed_links = [];
return error(sprintf(ngettext("There is %d unconfirmed angeltype.", "There are %d unconfirmed angeltypes.", count($unconfirmed_user_angeltypes)), count($unconfirmed_user_angeltypes)) . " " . sprintf(_("The first wants to join %s."), '<a href="' . page_link_to('angeltypes') . '&action=view&angeltype_id=' . $unconfirmed_user_angeltypes[0]['angeltype_id'] . '">' . $unconfirmed_user_angeltypes[0]['name'] . '</a>')); foreach ($unconfirmed_user_angeltypes as $user_angeltype)
$unconfirmed_links[] = '<a href="' . page_link_to('angeltypes') . '&action=view&angeltype_id=' . $user_angeltype['angeltype_id'] . '">' . $user_angeltype['name'] . '</a>';
return error(sprintf(ngettext("There is %d unconfirmed angeltype.", "There are %d unconfirmed angeltypes.", count($unconfirmed_user_angeltypes)), count($unconfirmed_user_angeltypes)) . " " . _('Angel types which need approvals:') . ' ' . join(', ', $unconfirmed_links));
} }
/** /**

View File

@ -23,6 +23,7 @@ function User_unconfirmed_AngelTypes($user) {
JOIN `AngelTypes` ON `UserAngelTypes`.`angeltype_id`=`AngelTypes`.`id` JOIN `AngelTypes` ON `UserAngelTypes`.`angeltype_id`=`AngelTypes`.`id`
JOIN `UserAngelTypes` as `UnconfirmedMembers` ON `UserAngelTypes`.`angeltype_id`=`UnconfirmedMembers`.`angeltype_id` JOIN `UserAngelTypes` as `UnconfirmedMembers` ON `UserAngelTypes`.`angeltype_id`=`UnconfirmedMembers`.`angeltype_id`
WHERE `UserAngelTypes`.`user_id`=" . sql_escape($user['UID']) . " WHERE `UserAngelTypes`.`user_id`=" . sql_escape($user['UID']) . "
AND `UserAngelTypes`.`coordinator`=TRUE
AND `AngelTypes`.`restricted`=TRUE AND `AngelTypes`.`restricted`=TRUE
AND `UnconfirmedMembers`.`confirm_user_id` IS NULL"); AND `UnconfirmedMembers`.`confirm_user_id` IS NULL");
} }

File diff suppressed because it is too large Load Diff