Invalid value for licensedefault

Bug #1251089 reported by Robert Lyon on 2013-11-14
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Low
Robert Lyon

Bug Description

If I have a site and enable the 'General' setting: License metadata and then masquerade as different user and then go to their account settings page I get the below error (see first error).

From what I can see in general_account_prefs_form_elements($prefs) there is a bit of code to set the institution's default as the default for the form.

But 'no institution' doesn't set the default license as it's edit form does not display this option and on save you get errors (shown below).

The 'no institution' institution needs to be able to handle this like any other institution - or be exempt from needing it.

[WAR] 99 (lib/pieforms/pieform.php:1236) Invalid value for select "licensedefault"
Call stack (most recent first):

    log_message("Invalid value for select "licensedefault"", 8, true, true, "/home/robertl/htdocs/mahara-testing/mahara/htdocs/...", 1236) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/errors.php:430
    error(1024, "Invalid value for select "licensedefault"", "/home/robertl/htdocs/mahara-testing/mahara/htdocs/...", 1236, array(size 2)) at Unknown:0
    trigger_error("Invalid value for select "licensedefault"", 1024) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:1236
    Pieform::info("Invalid value for select "licensedefault"") at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform/elements/select.php:102
    pieform_element_select(object(Pieform), array(size 12)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:1402
    Pieform->build_element_html(array(size 12)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:673
    Pieform->build() at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:171
    Pieform::process(array(size 8)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:71
    pieform(array(size 8)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/account/index.php:266

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[WAR] 11 (admin/users/institutions.php:585) Undefined index: licensemandatory
Call stack (most recent first):

    log_message("Undefined index: licensemandatory", 8, true, true, "/home/robertl/htdocs/mahara-testing/mahara/htdocs/...", 585) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/errors.php:430
    error(8, "Undefined index: licensemandatory", "/home/robertl/htdocs/mahara-testing/mahara/htdocs/...", 585, array(size 3)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/admin/users/institutions.php:585
    institution_validate(object(Pieform), array(size 34)) at Unknown:0
    call_user_func_array("institution_validate", array(size 2)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:1348
    Pieform->validate(array(size 34)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:506
    Pieform->__construct(array(size 5)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:170
    Pieform::process(array(size 5)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:71
    pieform(array(size 5)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/admin/users/institutions.php:517

[WAR] 11 (admin/users/institutions.php:677) Undefined index: licensemandatory
Call stack (most recent first):

    log_message("Undefined index: licensemandatory", 8, true, true, "/home/robertl/htdocs/mahara-testing/mahara/htdocs/...", 677) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/errors.php:430
    error(8, "Undefined index: licensemandatory", "/home/robertl/htdocs/mahara-testing/mahara/htdocs/...", 677, array(size 11)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/admin/users/institutions.php:677
    institution_submit(object(Pieform), array(size 34)) at Unknown:0
    call_user_func_array("institution_submit", array(size 2)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:528
    Pieform->__construct(array(size 5)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:170
    Pieform::process(array(size 5)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:71
    pieform(array(size 5)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/admin/users/institutions.php:517

[WAR] 11 (admin/users/institutions.php:678) Undefined index: licensedefault
Call stack (most recent first):

    log_message("Undefined index: licensedefault", 8, true, true, "/home/robertl/htdocs/mahara-testing/mahara/htdocs/...", 678) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/errors.php:430
    error(8, "Undefined index: licensedefault", "/home/robertl/htdocs/mahara-testing/mahara/htdocs/...", 678, array(size 11)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/admin/users/institutions.php:678
    institution_submit(object(Pieform), array(size 34)) at Unknown:0
    call_user_func_array("institution_submit", array(size 2)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:528
    Pieform->__construct(array(size 5)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:170
    Pieform::process(array(size 5)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:71
    pieform(array(size 5)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/admin/users/institutions.php:517

Robert Lyon (robertl-9) on 2013-11-14
Changed in mahara:
importance: Undecided → Low
Robert Lyon (robertl-9) on 2013-11-21
Changed in mahara:
status: New → Triaged
Robert Lyon (robertl-9) wrote :

The problem here is when one belongs to the 'no institution' the pieform element licensedefault has

[defaultvalue] => (institution default)

rather than

[defaultvalue] =>

like other institutions, so the select field fails because there is no option with that key.

We need to strip that from the element for it to work properly.

Robert Lyon (robertl-9) on 2014-01-08
Changed in mahara:
status: Triaged → In Progress
assignee: nobody → Robert Lyon (robertl-9)
milestone: none → 1.9.0
Steven (stevens-q) wrote :

==== Bug #1251089 Invalid value for license default ====

==== How to Test ====
1. Log in as an admin
2. Browse to Administration => Site options => General settings => make sure to tick the Licence metadata check box
3. Browse to settings link at the top right hand corner of the page
4. Confirm there are no errors on the user settings page.
5. Browse to Administration => Users => select a user to masquerade as
6. Browse to settings link at the top right hand corner of the page
7. Confirm there are no errors on the masqueraded user settings page.

==== Test Results ====
4. Confirmed there are no errors on the user settings page. ✔
7. Confirmed there are no errors on the masqueraded user settings page. ✔

Catalyst QA Approved ✔

Reviewed: https://reviews.mahara.org/2893
Committed: http://gitorious.org/mahara/mahara/commit/9d491d4afedf5385f14dc0b9bcbc98daa5e985f8
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit 9d491d4afedf5385f14dc0b9bcbc98daa5e985f8
Author: Robert Lyon <email address hidden>
Date: Thu Jan 9 12:44:24 2014 +1300

Correcting licensedefault's default value for 'no institution'

Bug #1251089

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

Son Nguyen (ngson2000) on 2014-03-12
Changed in mahara:
status: In Progress → Fix Committed
Aaron Wells (u-aaronw) wrote :

This patch also relates to this bug: https://reviews.mahara.org/#/c/3119/

Aaron Wells (u-aaronw) wrote :

And another patch that relates to this bug: https://reviews.mahara.org/#/c/3131/

Robert Lyon (robertl-9) on 2014-04-22
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