Email info out of sync

Bug #1838908 reported by Cecilia Vela Gurovic
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Robert Lyon

Bug Description

When adding a non-primary email via:
 set_profile_field($userid, 'email', $email, TRUE);

we shouldn't set email field in usr table to this new email address
as the usr.email should be the primary address one

Revision history for this message
Cecilia Vela Gurovic (ceciliavg) wrote :
Changed in mahara:
milestone: none → 19.10.0
status: New → Confirmed
assignee: nobody → Robert Lyon (robertl-9)
importance: Undecided → High
status: Confirmed → In Progress
Revision history for this message
Steven (stevens-q) wrote :

Commit hash: c8895712d2053467508c0602421c9cf8b73953d9
Environment tested: Master
Browser tested: Chrome
Theme used: Raw

PRECONDITIONS:
------------------------
1) Mahara User19 exists (no roles) (db user ID=20)
2) The following lines of code were added to dummy.php in htdocs to generate emails
<?php
/**
 *
 * @package mahara
 * @subpackage core
 * @author Catalyst IT Ltd
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
 * @copyright For copyright information on Mahara, please see the README file distributed with this software.
 *
 */

define('INTERNAL', 1);
require('init.php');

if ($USER->is_logged_in()) {
    // we are returning from the SAMl check
    $dummy_username = 'steven' . rand(10000,99999);
    $dummy_email = $dummy_username . '@catalyst.net.nz';

    // set email as non-primary
    set_profile_field($USER->get('id'), 'email', $dummy_email, true);
    $fullname = display_name($USER, null, true);

    $SESSION->add_ok_msg('Add email for ' . $fullname . ' as ' . $dummy_email);
    redirect('/');
}
3) Main URL = http://mahara.stevens-lp.dynamic.wgtn.cat-it.co.nz

TEST STEPS:
------------------------
1) Log in as Mahara User19
2) Browse to /dummy.php
3) Verify that a success message is displayed "Add email for Steve User19 as <email address hidden>"
4) Browse to /artefact/internal/index.php
5) Verify that the new email address has been added to the users profile addresses
6) Set the new eamil to the default /primary email
7) Browse to the database table - artefact_internal_profile_email
8) Verify that user ID 20 displays the new email and that the principle column is set to 1
9) Verify that user ID 20 displays the old email and that the principle column is set to 0

Catalyst QA Approved ✔

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/10148
Committed: https://git.mahara.org/mahara/mahara/commit/0cd7ed99a5e73fdc9a648ceb2162dc055fce143e
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 0cd7ed99a5e73fdc9a648ceb2162dc055fce143e
Author: Robert Lyon <email address hidden>
Date: Mon Jul 8 09:01:32 2019 +1200

Bug 1838908: Email info out of sync

When adding a non-primary email via:
set_profile_field($userid, 'email', $email, TRUE);

we shouldn't set email field in usr table to this new email address
as the usr.email should be the primary address one

Change-Id: Id8e780f3d7efa3baaae6383932e825a9cceb5e46
Signed-off-by: Robert Lyon <email address hidden>

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Lisa Seeto (lisaseeto)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.