Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.9.4, 1.9.12
    • Fix Version/s: None
    • Component/s: Gradebook
    • Labels:
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_19_STABLE
    • Rank:
      5087

      Description

      Attempting to import a outcomes file into the latest 1.9.4+ fails, with the message:

      "An error occurred, this script wasn't called with the right parameters."

      The file previously imported into 1.9.2 without any problem. Has the file format changed for 1.9.4?

      Importing outcomes discussion with attached sample file http://moodle.org/mod/forum/discuss.php?d=104141

      1. outcomes.fix.txt
        0.8 kB
        Akin Delamarre
      1. Picture 10.png
        93 kB

        Issue Links

          Activity

          Hide
          Larry M Elchuck, Ph.D. added a comment -

          Don't know if this helps, but here are the changes regarding ootcome files since Oct 2008.

          Show
          Larry M Elchuck, Ph.D. added a comment - Don't know if this helps, but here are the changes regarding ootcome files since Oct 2008.
          Hide
          Larry M Elchuck, Ph.D. added a comment -

          In Moodle 1.9.2, lines 181-183 of import.php read:
          $outcome = get_records_select('grade_outcomes', 'shortname = "'. $csv_data[$imported_headers['outcome_shortname']] .'" and courseid = '. $courseid );
          } else

          { $outcome = get_records_select('grade_outcomes', 'shortname = "'. $csv_data[$imported_headers['outcome_shortname']] .'" and courseid is null'); and in Moodle 1.9.4, they read as: $outcome = get_records_select('grade_outcomes', 'shortname = \''. $csv_data[$imported_headers['outcome_shortname']] .'\' and courseid = '. $courseid ); }

          else {
          $outcome = get_records_select('grade_outcomes', 'shortname = \''. $csv_data[$imported_headers['outcome_shortname']] .'\' and courseid is null');

          When the latter is replaced with the former, Helen's outcomes.cvs file will import as standard outcomes but an error still occurs importing them for the course only option.

          Show
          Larry M Elchuck, Ph.D. added a comment - In Moodle 1.9.2, lines 181-183 of import.php read: $outcome = get_records_select('grade_outcomes', 'shortname = "'. $csv_data[$imported_headers ['outcome_shortname'] ] .'" and courseid = '. $courseid ); } else { $outcome = get_records_select('grade_outcomes', 'shortname = "'. $csv_data[$imported_headers['outcome_shortname']] .'" and courseid is null'); and in Moodle 1.9.4, they read as: $outcome = get_records_select('grade_outcomes', 'shortname = \''. $csv_data[$imported_headers['outcome_shortname']] .'\' and courseid = '. $courseid ); } else { $outcome = get_records_select('grade_outcomes', 'shortname = \''. $csv_data[$imported_headers ['outcome_shortname'] ] .'\' and courseid is null'); When the latter is replaced with the former, Helen's outcomes.cvs file will import as standard outcomes but an error still occurs importing them for the course only option.
          Hide
          Red Morris added a comment -

          To add into this and help track down what had happened, I'm getting this too on 1.9.2 (Build: 20080820). If I export the outcomes from a course to a csv, go to another course and try to import the outcomes it will work for standard, but not for custome. I get the same "An error occurred, this script wasn't called with the right parameters." error

          Show
          Red Morris added a comment - To add into this and help track down what had happened, I'm getting this too on 1.9.2 (Build: 20080820). If I export the outcomes from a course to a csv, go to another course and try to import the outcomes it will work for standard, but not for custome. I get the same "An error occurred, this script wasn't called with the right parameters." error
          Hide
          Julien Boulen added a comment -

          Hello,

          We have this issue too in Moodle 1.9.5 (build 20090826).

          Admins can import csv, but teachers have this message "An error occurred, this script wasn't called with the right parameters".

          I guess I have found something, but I'm not sure about it.

          On this file (http://xref.moodle.org/nav.html?grade/edit/outcome/import.php.source.html) line 107, I changed "get_context_instance(CONTEXT_SYSTEM)" by "get_context_instance(CONTEXT_COURSE, $courseid)"

          Also, I changed import_out_comes_form.php to prevent global import. On condition line 17, I added "else" key-word and this statement " $mform->addElement('hidden', 'scope', 'custom');"

          Without this line, teachers import by default (without choice) global outcomes. With, they have no choice too, but they import just custom outcomes. It's what we want for our moodle. If you want choices like admins, you have just to change "CONTEXT_SYSTEM" by "CONTEXT_COURSE, $COURSE->id" line 17.

          Now, it seems work great, but I'm not sure to change CONTEXT_SYSTEM by CONTEXT_COURSE is safe... is it ?

          Show
          Julien Boulen added a comment - Hello, We have this issue too in Moodle 1.9.5 (build 20090826). Admins can import csv, but teachers have this message "An error occurred, this script wasn't called with the right parameters". I guess I have found something, but I'm not sure about it. On this file ( http://xref.moodle.org/nav.html?grade/edit/outcome/import.php.source.html ) line 107, I changed "get_context_instance(CONTEXT_SYSTEM)" by "get_context_instance(CONTEXT_COURSE, $courseid)" Also, I changed import_out_comes_form.php to prevent global import. On condition line 17, I added "else" key-word and this statement " $mform->addElement('hidden', 'scope', 'custom');" Without this line, teachers import by default (without choice) global outcomes. With, they have no choice too, but they import just custom outcomes. It's what we want for our moodle. If you want choices like admins, you have just to change "CONTEXT_SYSTEM" by "CONTEXT_COURSE, $COURSE->id" line 17. Now, it seems work great, but I'm not sure to change CONTEXT_SYSTEM by CONTEXT_COURSE is safe... is it ?
          Hide
          Jean FRUITET added a comment -

          I think all you need to do is
          1) replace import.php line 107
          "get_context_instance(CONTEXT_SYSTEM)"
          by
          "get_context_instance(CONTEXT_COURSE, $courseid)"

          2) import_out_comes_form.php to prevent global import as you suggest.

          But I think you dont have to replace "CONTEXT_SYSTEM" by "CONTEXT_COURSE, $COURSE->id" .

          This is the new code
          if (($COURSE->id > 1)){
          // MODIF JF : http://tracker.moodle.org/browse/MDL-18506
          $mform->setDefault('scope', 'custom');

          if (has_capability('moodle/grade:manage', get_context_instance(CONTEXT_SYSTEM)))

          { $mform->addElement('radio', 'scope', get_string('importcustom', 'grades'), null, 'custom'); $mform->addElement('radio', 'scope', get_string('importstandard', 'grades'), null, 'global'); }

          else

          { $mform->addElement('hidden', 'scope', 'custom'); }

          }

          Then everything works fine

          Show
          Jean FRUITET added a comment - I think all you need to do is 1) replace import.php line 107 "get_context_instance(CONTEXT_SYSTEM)" by "get_context_instance(CONTEXT_COURSE, $courseid)" 2) import_out_comes_form.php to prevent global import as you suggest. But I think you dont have to replace "CONTEXT_SYSTEM" by "CONTEXT_COURSE, $COURSE->id" . This is the new code if (($COURSE->id > 1)){ // MODIF JF : http://tracker.moodle.org/browse/MDL-18506 $mform->setDefault('scope', 'custom'); if (has_capability('moodle/grade:manage', get_context_instance(CONTEXT_SYSTEM))) { $mform->addElement('radio', 'scope', get_string('importcustom', 'grades'), null, 'custom'); $mform->addElement('radio', 'scope', get_string('importstandard', 'grades'), null, 'global'); } else { $mform->addElement('hidden', 'scope', 'custom'); } } Then everything works fine
          Hide
          Akin Delamarre added a comment -

          Attaching Patch to fix this issue

          Show
          Akin Delamarre added a comment - Attaching Patch to fix this issue
          Hide
          Akin Delamarre added a comment -

          Can we get this fix into Moodle core?

          Show
          Akin Delamarre added a comment - Can we get this fix into Moodle core?
          Hide
          Helen Foster added a comment -

          Akin, thanks for your patch. Please could you let us know whether this issue affects Moodle 1.9.12 and/or 2.0.3.

          Show
          Helen Foster added a comment - Akin, thanks for your patch. Please could you let us know whether this issue affects Moodle 1.9.12 and/or 2.0.3.
          Hide
          Akin Delamarre added a comment -

          Akin, thanks for your patch. Please could you let us know whether this issue affects Moodle 1.9.12 and/or 2.0.3.

          Hello Helen,

          This issue affects Moodle 1.9.12,

          The patch was created from Moodle 1.9.12+ (20110511)

          I have not checked to see if this is an issue in Moodle 2.0 yet.

          Show
          Akin Delamarre added a comment - Akin, thanks for your patch. Please could you let us know whether this issue affects Moodle 1.9.12 and/or 2.0.3. Hello Helen, This issue affects Moodle 1.9.12, The patch was created from Moodle 1.9.12+ (20110511) I have not checked to see if this is an issue in Moodle 2.0 yet.
          Hide
          Helen Foster added a comment -

          Akin, thanks for your feedback.

          Increasing priority and hoping this issue can be looked at soon after the 2.1 release.

          Show
          Helen Foster added a comment - Akin, thanks for your feedback. Increasing priority and hoping this issue can be looked at soon after the 2.1 release.
          Hide
          Dan Poltawski added a comment -

          Hi,

          I have tested if this is still an issue on 2.x and it appears to work OK there so I am closing this issue as cannot reproduce.

          Please note that we are no longer supporting non-security bug fixes in 1.9.x

          Show
          Dan Poltawski added a comment - Hi, I have tested if this is still an issue on 2.x and it appears to work OK there so I am closing this issue as cannot reproduce. Please note that we are no longer supporting non-security bug fixes in 1.9.x

            People

            • Votes:
              4 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: