Commit 2c262cdf authored by Aaron Wells's avatar Aaron Wells
Browse files

Bug 1606094: Stop sending quota notifications to everyone

This patch changes that bad left (outer) join to an inner
join, so that we only check for notifications for users
who are in the affected institution.

As a further safeguard, it also removes the line that
compared each user's file usage to the institution's
new quota. Now, we'll instead compare each user's
file usage to that user's current quota (which, for
members of the institution, will be the institution's
new quota.)

Change-Id: I4db6068221d1238c8a755434e78e6cc006a84aa8
behatnotneeded: Test to come later
parent cd9247b4
......@@ -796,13 +796,12 @@ function institution_submit(Pieform $form, $values) {
// get all the users from the institution and make sure that they are still below
// their quota threshold
if ($users = get_records_sql_array('SELECT * FROM {usr} u LEFT JOIN {usr_institution} ui ON = ui.usr AND ui.institution = ?', array($institution))) {
if ($users = get_records_sql_array('SELECT * FROM {usr} u INNER JOIN {usr_institution} ui ON = ui.usr AND ui.institution = ?', array($institution))) {
$quotanotifylimit = get_config_plugin('artefact', 'file', 'quotanotifylimit');
if ($quotanotifylimit <= 0 || $quotanotifylimit >= 100) {
$quotanotifylimit = 100;
foreach ($users as $user) {
$user->quota = $values['defaultquota'];
// check if the user has gone over the quota notify limit
$user->quotausedpercent = $user->quotaused / $user->quota * 100;
$overlimit = false;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment