# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: moodle/admin/environment.xml
--- moodle/admin/environment.xml Base (1.24.2.11)
+++ moodle/admin/environment.xml Locally Modified (Based On 1.24.2.11)
@@ -205,8 +205,6 @@
           <ON_CHECK message="globalswarning" />
         </FEEDBACK>
       </CUSTOM_CHECK>
-      <CUSTOM_CHECK file="mod/data/lib.php" function="check_required_entries_fields" level="optional">
-      </CUSTOM_CHECK>
     </CUSTOM_CHECKS>
   </MOODLE>
   <MOODLE version="2.0" requires="1.9">
Index: moodle/install/stringnames.txt
--- moodle/install/stringnames.txt Base (1.3.2.11)
+++ moodle/install/stringnames.txt Locally Modified (Based On 1.3.2.11)
@@ -136,7 +136,6 @@
 remotedownloaderror
 remotedownloadnotallowed
 report
-requiredentrieschanged
 restricted
 safemode
 safemodeerror
Index: moodle/lang/en_utf8/admin.php
--- moodle/lang/en_utf8/admin.php Base (1.154.2.66)
+++ moodle/lang/en_utf8/admin.php Locally Modified (Based On 1.154.2.66)
@@ -620,8 +620,6 @@
 $string['remotelangnotavailable'] = 'Because Moodle can not connect to download.moodle.org, we are unable to do language pack installation automatically. Please download the appropriate zip file(s) from the list below, copy them to your $a directory and unzip them manually.';
 $string['renameerrors'] = 'Rename errors';
 $string['requiredtemplate'] = 'Required. You may use template syntax here (%%l = lastname, %%f = firstname, %%u = username). See help for details and examples.';
-$string['requiredentrieschanged'] = '<strong>IMPORTANT - PLEASE READ<br/>(This warning message will only be displayed during this upgrade)</strong><br/>Due to a bug fix, the behaviour of database activities using the \'Required entries\' and \'Required entries before viewing settings\' settings will change. A more detailed explaination of the changes can be read on <a href=\"http://moodle.org/mod/forum/discuss.php?d=110928\" target=\"_blank\">the database module forum</a>. The expected behavior of these settings can also be read on <a href=\"http://docs.moodle.org/en/Adding/editing_a_database#Required_entries\" target=\"_blank\">Moodle Docs</a>.
-<br/><br/>This change affects the following databases in your system: (Please save this list now, and after the upgrade, check that these activities still work the way that the teacher intends.)<br/><strong style=\"color:red\">$a->text</strong><br/>';
 $string['restrictbydefault'] = 'Restrict modules by default';
 $string['restrictmodulesfor'] = 'Restrict modules for';
 $string['reverseproxy'] = 'Reverse proxy';
Index: moodle/lang/en_utf8/data.php
--- moodle/lang/en_utf8/data.php Base (1.53.4.17)
+++ moodle/lang/en_utf8/data.php Locally Modified (Based On 1.53.4.17)
@@ -209,6 +209,8 @@
 $string['recordssaved'] = 'entries saved';
 $string['requireapproval'] = 'Require approval?';
 $string['requiredentries'] = 'Required entries';
+$string['requiredentrieschanged'] = '<p><strong>IMPORTANT - PLEASE READ </strong></p><p>Due to a bug fix, the behaviour of database activities using the \'Required entries\' and \'Required entries before viewing settings\' settings will change. A more detailed explaination of the changes can be read on <a href=\"http://moodle.org/mod/forum/discuss.php?d=110928\" target=\"_blank\">the database module forum</a>. The expected behavior of these settings can also be read on <a href=\"http://docs.moodle.org/en/Adding/editing_a_database#Required_entries\" target=\"_blank\">Moodle Docs</a>.
+</p><p>This change affects the following databases in your system: (Please save this list now, and after the upgrade, check that these activities still work the way that the teacher intends.)</p><strong style=\"color:red\">$a->text</strong><br/>';
 $string['requiredentriestoview'] = 'Entries required before viewing';
 $string['resettemplate'] = 'Reset template';
 $string['resetsettings'] = 'Reset filters';
Index: moodle/mod/data/db/upgrade.php
--- moodle/mod/data/db/upgrade.php Base (1.8.2.3)
+++ moodle/mod/data/db/upgrade.php Locally Modified (Based On 1.8.2.3)
@@ -111,6 +111,27 @@
         }
     }
 
+ ///Display a warning message about "Required Entries" fix from MDL-16999
+    if ($result && $oldversion < 2007101514) {
+        if (!get_config('data', 'requiredentriesfixflag')) {
+            set_config('requiredentriesfixflag', true, 'data'); // remove old flag
+        
+            $databases = get_records_sql("SELECT d.*, c.fullname
+                                              FROM {$CFG->prefix}data d, {$CFG->prefix}course c
+                                              WHERE d.course = c.id
+                                              AND (d.requiredentries > 0 OR d.requiredentriestoview > 0)
+                                              ORDER BY c.fullname, d.name");
+            if (!empty($databases)) {
+                $a = new object();
+                $a->text = '';
+                foreach($databases as $database) {
+                    $a->text .= "<p>".$database->fullname." - " .$database->name. " (course id: ".$database->course." - database id: ".$database->id.")</p>";
+                }
+                notify(get_string('requiredentrieschanged', 'data', $a));
+            }
+        }
+    }
+
     return $result;
 }
 
Index: moodle/mod/data/lib.php
--- moodle/mod/data/lib.php Base (1.137.2.41)
+++ moodle/mod/data/lib.php Locally Modified (Based On 1.137.2.41)
@@ -2101,40 +2101,5 @@
     return array('moodle/site:accessallgroups', 'moodle/site:viewfullnames');
 }
 
-/**
- * This function is declared into environment.xml
- * Check if both of database required entries fields have been set for a version anterior to 2007101532
- * This check has been required by the bug MDL-16999
- * @global <type> $CFG
- * @param <type> $result
- * @return object status
- */
-function check_required_entries_fields($result) {
-    global $CFG;
-    if (!empty($CFG->version)                                             //we are not installing a new Moodle site
-        && $CFG->version < 2007101532                              //the version is anterior to the one when the fix has been applied
-        && !get_config("data","requiredentriesfixflag")) {      //do not show message when upgrading an anterior version when the patch has already been applied
-        set_config("requiredentriesfixflag",true, 'data'); //set a flag into database in order to let know a Moodle 2.0 upgrade that the message has already been displayed
-        $databases = get_records_sql("SELECT d.*, c.fullname
-                                    FROM {$CFG->prefix}data d,
-                                         {$CFG->prefix}course c
-                                    WHERE d.course = c.id
-                                    ORDER BY c.fullname, d.name");
-        if (!empty($databases)) {          
-            $a = new object();
-            foreach($databases as $database) {
-                if ($database->requiredentries != 0 || $database->requiredentriestoview != 0) {
-                    $a->text .= "".$database->fullname." - " .$database->name. " (course id: ".$database->course." - database id: ".$database->id.")<br/>";
-                    //set the feedback string here and not in xml file since we need something
-                    //more complex than just a string picked from admin.php lang file
-                    $result->setFeedbackStr(array('requiredentrieschanged', 'admin', $a));
-                    $result->setStatus(false);//fail test
-                }
-            }
-            return $result;
-        }
-    }
-    return null;
-}
 
 ?>
Index: moodle/mod/data/version.php
--- moodle/mod/data/version.php Base (1.29.2.7)
+++ moodle/mod/data/version.php Locally Modified (Based On 1.29.2.7)
@@ -5,7 +5,7 @@
 //  This fragment is called by /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2007101513;
+$module->version  = 2007101514;
 $module->requires = 2007101509;  // Requires this Moodle version
 $module->cron     = 60;
 
