]> git.mjollnir.org Git - moodle.git/commitdiff
portfolio MDL-20905 fixing errors that affected box.net plugin
authorPenny Leach <penny@liip.ch>
Thu, 19 Nov 2009 07:03:53 +0000 (07:03 +0000)
committerPenny Leach <penny@liip.ch>
Thu, 19 Nov 2009 07:03:53 +0000 (07:03 +0000)
lib/portfoliolib.php
portfolio/add.php

index 7afb72a7ba32a54036b9698def4b1ec9adad8607..6e5aa6821d22e4fddba950f2ee9a7d059c712c5e 100644 (file)
@@ -1017,3 +1017,9 @@ function portfolio_export_pagesetup($PAGE, $caller) {
     }
     $PAGE->navbar->add(get_string('exporting', 'portfolio'));
 }
+
+function portfolio_export_type_to_id($type, $userid) {
+    global $DB;
+    $sql = 'SELECT t.id FROM {portfolio_tempdata} t JOIN {portfolio_instance} i ON t.instance = i.id WHERE t.userid = ? AND i.plugin = ?';
+    return $DB->get_field_sql($sql, array($userid, $type));
+}
index 7cae4a23962f324d51b139cde0bcd7622c27a912..905e9e575e571a0c977bfd4e0bc0d157db5e502c 100644 (file)
@@ -59,7 +59,7 @@ if ($postcontrol && $type && !$dataid) {
         throw new portfolio_exception('multiplesingleresume', 'portfolio');
     }
 
-    if (!$dataid = $DB->get_field('portfolio_tempdata', 'id', array('type' => $type, 'userid' => $USER->id))) {
+    if (!$dataid = portfolio_export_type_to_id($type, $USER->id)) {
         throw new portfolio_exception('invalidtempid', 'portfolio');
     }
 } else {