Bug fixed:
authorwillcast <willcast>
Fri, 31 Oct 2003 13:40:34 +0000 (13:40 +0000)
committerwillcast <willcast>
Fri, 31 Oct 2003 13:40:34 +0000 (13:40 +0000)
- Updating a Default Approval Status from NO to YES in a glossary, now approve automatically all entries waiting for approval.

mod/glossary/lib.php

index 1d4d25c5e0a25b00cb32a6e80dbea46a0b874f52..09f70b0f95295023ad22235fc4e9b04affd75c8f 100644 (file)
@@ -41,7 +41,7 @@ function glossary_update_instance($glossary) {
 /// Given an object containing all the necessary data,
 /// (defined by the form in mod.html) this function
 /// will update an existing instance with new data.
-
+global $CFG;
     if ( !isadmin() ) {
         unset($glossary->globalglossary);
     }
@@ -49,9 +49,12 @@ function glossary_update_instance($glossary) {
     $glossary->timemodified = time();
     $glossary->id = $glossary->instance;
 
-    # May have to add extra stuff in here #
+    $return = update_record("glossary", $glossary);
+       if ($return and $glossary->defaultapproval) {
+        execute_sql("update {$CFG->prefix}glossary_entries SET approved = 1 where approved != 1 and glossaryid = " . $glossary->id,false);
+    }
 
-    return update_record("glossary", $glossary);
+    return $return;
 }