mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Merge branch 'ent-12156-usuario-agregado-con-grupo-agregado-a-categoria-de-notificaciones-no-puede-habilitar-su-envio' into 'develop'
Ent 12156 usuario agregado con grupo agregado a categoria de notificaciones no puede habilitar su envio See merge request artica/pandorafms!6797
This commit is contained in:
commit
4a0d8058c5
@ -636,13 +636,15 @@ function notifications_get_user_label_status($source, $user, $label)
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Clean default common groups error for mesagges.
|
// Clean default common groups error for mesagges.
|
||||||
|
$group_enable = true;
|
||||||
if ($common_groups[0] === 0) {
|
if ($common_groups[0] === 0) {
|
||||||
unset($common_groups[0]);
|
unset($common_groups[0]);
|
||||||
|
$group_enable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No group found, return no permissions.
|
// No group found, return no permissions.
|
||||||
$value = empty($common_groups) ? false : $source[$label];
|
$value = empty($common_groups) ? false : $source[$label];
|
||||||
return notifications_build_user_enable_return($value, false);
|
return notifications_build_user_enable_return($value, $group_enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -674,14 +676,34 @@ function notifications_set_user_label_status($source, $user, $label, $value)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (bool) db_process_sql_update(
|
$exists = db_process_sql(sprintf('SELECT * FROM tnotification_source_user WHERE id_user = "%s" AND id_source = "%s"', $user, $source));
|
||||||
'tnotification_source_user',
|
if (empty($exists['enabled']) && empty($exists['also_mail'])) {
|
||||||
[$label => $value],
|
$sql = sprintf('DELETE FROM tnotification_source_user WHERE id_user = "%s" AND id_source = "%s"', $user, $source);
|
||||||
[
|
db_process_sql($sql);
|
||||||
'id_user' => $user,
|
$exists = false;
|
||||||
'id_source' => $source,
|
}
|
||||||
]
|
|
||||||
);
|
if ($exists === false) {
|
||||||
|
db_process_sql_insert(
|
||||||
|
'tnotification_source_user',
|
||||||
|
[
|
||||||
|
'id_user' => $user,
|
||||||
|
'id_source' => $source,
|
||||||
|
'enabled' => '1',
|
||||||
|
'also_mail' => '1',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return (bool) db_process_sql_update(
|
||||||
|
'tnotification_source_user',
|
||||||
|
[$label => $value],
|
||||||
|
[
|
||||||
|
'id_user' => $user,
|
||||||
|
'id_source' => $source,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user