Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-52079

Error when editing a competency at sub-levels

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: None
    • Component/s: Competencies
    • Labels:
      None

      Description

      There's the following error when editing a competency at sub-level (Parent is not root)

      Debug info: path: Data submitted is invalid
      Error code: invalidpersistent
      Stack trace:

      line 412 of /admin/tool/lp/classes/persistent.php: tool_lp\invalid_persistent_exception thrown
      line 227 of /admin/tool/lp/classes/api.php: call to tool_lp\persistent->update()
      line 98 of /admin/tool/lp/editcompetency.php: call to tool_lp\api::update_competency()

      To reproduce :

      • Create a framework (system context)
      • Add a competency in it
      • Add a second competency that is under the first one.
      • Edit this same competency.
      • You should see an error after saving changes

      Problem is that the path of the competency is not set in api::update_competency. simple fix :

      diff --git a/admin/tool/lp/classes/api.php b/admin/tool/lp/classes/api.php
      index d1e9f55..1c7724d 100644
      --- a/admin/tool/lp/classes/api.php
      +++ b/admin/tool/lp/classes/api.php
      @@ -217,6 +217,7 @@ class api {
               // Some things should not be changed in an update - they should use a more specific method.
               $record->sortorder = $current->get_sortorder();
               $record->parentid = $current->get_parentid();
      +        $record->path = $current->get_path();
               $record->competencyframeworkid = $current->get_competencyframeworkid();
       
               $competency = new competency(0, $record);
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              gaudreaj Jean-Philippe Gaudreau
              Participants:
              Component watchers:
              Damyon Wiese, Jean-Philippe Gaudreau, Steve Massicotte, Serge Gauthier, Issam Taboubi, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: