When requiring profile information for 'country' get error if site has also not set country value

Bug #1731333 reported by Robert Lyon on 2017-11-09
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

To test:

1) Go to Configure site and make sure that Site setting -> Country = No country selected
2) Go to Extensions -> Internal configuration screen and tick 'Country' under Mandatory fields and under Administration user search and save
3) Go to Admin -> Users and find a user that doesn't have a country set
4) Login as that user (can masquerade)

Before patch:
Should get [WAR] 84 (lib/pieforms/pieform.php:1343) Invalid value for select "country"

After patch:
No warning and field should default to 'New Zealand'

Niranjan (niranjan528) wrote :

Environment to be tested: Master
Browser to be tested: Any browser


1. A user 'Site admin' exists and has site administrator access.
2. Normal user ‘User one’ should exist and does not have a country set.
3. Make sure to have the following line in the config.php file so that
error messages are printed to the screen:

$cfg->productionmode = false;

Steps to reproduce:

1. Log in as ‘Site admin’.
2. Navigate to Administration menu > Configure site > Site options > Site settings.
3.Verify that 'Country' displays the value 'No country selected'. If it doesn't, change it to that value and click the 'Update site options' button.
4. Navigate to Administration menu > Extensions > Plugin administration.
5. Click the ‘Configuration for artefact internal’ settings icon.
6. Check the 'Country' check box for ‘Mandatory fields’.
7. Click the ‘Save’ button.
8. Navigate to Administration menu > Users > User search.
9. Click the user name ‘User one’.
10. Click the ‘Log in as this user’ link.

Expected result: No warning message should be displayed and the country field should be defaulted to 'New Zealand'.

11. Enter ‘New password’, ‘Confirm password’ and leave the country as ‘New Zealand’.
12. Click the ‘Submit button’
13. Navigate to Main menu > Content > Profile > Contact information.

Expected result: The field displays 'New Zealand'.

14. Log out and Log in back as ‘Site admin’.
15. Navigate to Administration menu > Configure site > Site options > Site settings.
16. Change the value ‘No country selected’ to ‘Australia’ and click the ‘Update site options’ button.
17. Navigate to Administration menu > Users > Add user.
18. Create a normal user with the user name ‘User two’ and click the ‘Create user’ button.
19. Click the ‘Log in as this user’ link.

Expected result: The 'Country' field should default to 'Australia'.

20. Click the ‘log in anyway’ link.

Expected result: Log in should be successful.

Reviewed: https://reviews.mahara.org/8271
Committed: https://git.mahara.org/mahara/mahara/commit/6b23cca1388b2db7eed9524720a1c7874a98375d
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 6b23cca1388b2db7eed9524720a1c7874a98375d
Author: Robert Lyon <email address hidden>
Date: Fri Nov 10 09:20:48 2017 +1300

Bug 1731333: Use NZ if no country defined for required country prompt


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

Robert Lyon (robertl-9) on 2017-11-22
Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9) on 2018-04-05
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers