]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18293 removed obsoleted checking of return values from insert and update_record...
authorskodak <skodak>
Sat, 13 Jun 2009 17:55:51 +0000 (17:55 +0000)
committerskodak <skodak>
Sat, 13 Jun 2009 17:55:51 +0000 (17:55 +0000)
enrol/authorize/authorizenet.class.php
mod/assignment/lib.php
mod/assignment/type/offline/assignment.class.php
mod/data/lib.php
mod/data/rate.php
mod/forum/rate.php
mod/glossary/rate.php
question/type/calculated/questiontype.php
question/type/calculatedsimple/questiontype.php
question/type/numerical/questiontype.php

index a1c3bf8dfd5bf37ff1d4bdcf4e2b61da847d1a32..9ee6b6f4bf7701814a7c51da52c7a8317db5088b 100644 (file)
@@ -323,9 +323,7 @@ class AuthorizeNet
                             unset($order->paymentmethod);
                         }
                         $order->status = AN_STATUS_VOID;
-                        if (! $DB->update_record($tableupdate, $order)) {
-                            message_to_admin("Error while trying to update data in table $tableupdate. Please edit manually this record: ID=$order->id.", $order);
-                        }
+                        $DB->update_record($tableupdate, $order);
                     }
                     break;
             }
index 6b7a70d1978536a9aeb0c0320e3d4ab8950833bb..73bc7543c67b0b7c54420b802c7a13efebe4128f 100644 (file)
@@ -1497,9 +1497,7 @@ class assignment_base {
                 // $submission->timemodified = time();
             }
 
-            if (! $DB->update_record('assignment_submissions', $submission)) {
-                return false;
-            }
+            $DB->update_record('assignment_submissions', $submission);
 
             // triger grade event
             $this->update_grade($submission);
index aeaf3e9b1d2929f2acd566195679ed03b0f44cab..671ace428723f934d776e09c9c74651bafef91ea 100644 (file)
@@ -85,9 +85,7 @@ class assignment_offline extends assignment_base {
                 $submission->timemodified = time();
             }
 
-            if (! $DB->update_record('assignment_submissions', $submission)) {
-                return false;
-            }
+            $DB->update_record('assignment_submissions', $submission);
 
             // triger grade event
             $this->update_grade($submission);
index 47085a817f9f1082de126606f99d53fc8f7070f4..1359d528746a76e2b1bc0f2f1b8ba0b886041720 100755 (executable)
@@ -873,9 +873,7 @@ function data_update_instance($data) {
         $data->notification = 0;
     }
 
-    if (! $DB->update_record('data', $data)) {
-        return false;
-    }
+    $DB->update_record('data', $data);
 
     data_grade_item_update($data);
 
index 599a804f2c3e4a698762c568b6f54ce91c2170f0..939ec26a1487e4bceceee0b2ffd109886dbaf235 100755 (executable)
@@ -81,9 +81,7 @@
             $newrating->userid   = $USER->id;
             $newrating->recordid = $record->id;
             $newrating->rating   = $rating;
-            if (! $DB->insert_record('data_ratings', $newrating)) {
-                print_error('cannotinsertrate', 'error', '', (object)array('id'=>$record->id, 'rating'=>$rating));
-            }
+            $DB->insert_record('data_ratings', $newrating);
             data_update_grades($data, $record->userid);
         }
     }
index 84f5e5dce4bbd5e907bebae950d6f626e6619914..3db0a72356487d7093137cf01546da9d59329571 100644 (file)
@@ -90,9 +90,7 @@
                 $newrating->post   = $post->id;
                 $newrating->rating = $rating;
 
-                if (! $DB->insert_record('forum_ratings', $newrating)) {
-                    print_error('cannotinsertrate', 'error', '', (object)array('id'=>$postid, 'rating'=>$rating));
-                }
+                $DB->insert_record('forum_ratings', $newrating);
                 forum_update_grades($forum, $post->userid);
             }
         }
index 2523422b4072513067ec110d23387d10392e9170..83d892e2b46bd05de7430e4e3b21284137ea75a9 100644 (file)
@@ -88,9 +88,7 @@
                 } else if ($rating != $oldrating->rating) {
                     $oldrating->rating = $rating;
                     $oldrating->time = time();
-                    if (! $DB->update_record("glossary_ratings", $oldrating)) {
-                        print_error('cannotinsertrate', 'error', '', (object)array('id'=>$entry->id, 'rating'=>$rating));
-                    }
+                    $DB->update_record("glossary_ratings", $oldrating);
                     glossary_update_grades($glossary, $entry->userid);
                 }
 
                 $newrating->entryid = $entry->id;
                 $newrating->rating  = $rating;
 
-                if (! $DB->insert_record("glossary_ratings", $newrating)) {
-                    print_error('cannotinsertrate', 'error', '', (object)array('id'=>$entry->id, 'rating'=>$rating));
-                }
+                $DB->insert_record("glossary_ratings", $newrating);
                 glossary_update_grades($glossary, $entry->userid);
             }
         }
index caecba8c18b6b029724fbc537faf47f182147ef1..c31aec4fd4d6cd531ccdd4e3743c9eb5156f79d7 100644 (file)
@@ -163,15 +163,9 @@ class question_calculated_qtype extends default_questiontype {
 
                 if ($oldanswer = array_shift($oldanswers)) {  // Existing answer, so reuse it
                     $answer->id = $oldanswer->id;
-                    if (! $DB->update_record("question_answers", $answer)) {
-                        $result->error = get_string('errorupdatinganswer','question',$answer->id);
-                        return $result;
-                    }
+                    $DB->update_record("question_answers", $answer);
                 } else { // This is a completely new answer
-                    if (! $answer->id = $DB->insert_record("question_answers", $answer)) {
-                        $result->error = get_string('errorinsertinganswer','question');
-                        return $result;
-                    }
+                    $answer->id = $DB->insert_record("question_answers", $answer);
                 }
 
                 // Set up the options object
@@ -187,18 +181,9 @@ class question_calculated_qtype extends default_questiontype {
 
                 // Save options
                 if (isset($options->id)) { // reusing existing record
-                    if (! $DB->update_record('question_calculated', $options)) {
-                        $mess->name = $this->name();
-                        $mess->id = $options->id ;
-                        $result->error = get_string('errorupdatingoptions','question',$mess);
-                    //    $result->error = "Could not update question calculated options! (id=$options->id)";
-                        return $result;
-                    }
+                    $DB->update_record('question_calculated', $options);
                 } else { // new options
-                    if (! $DB->insert_record('question_calculated', $options)) {
-                        $result->error = "Could not insert question  calculated options!";
-                        return $result;
-                    }
+                    $DB->insert_record('question_calculated', $options);
                 }
             }
         }
@@ -870,11 +855,7 @@ class question_calculated_qtype extends default_questiontype {
                 $options->tolerancetype  = trim($fromform->tolerancetype[$key]);
                 $options->correctanswerlength  = trim($fromform->correctanswerlength[$key]);
                 $options->correctanswerformat  = trim($fromform->correctanswerformat[$key]);
-                if (! $DB->update_record('question_calculated', $options)) {
-                    $mess->name = $this->name();
-                    $mess->id = $options->id ;
-                    notify ( get_string('errorupdatingoptions','question',$mess));
-                }
+                $DB->update_record('question_calculated', $options);
             }
         }
     }
index 4fbe5dd08bb1112561856cc03d4f8d8e840f2c6f..08fd8438ff23dc53b63c7af91571454db888906d 100644 (file)
@@ -61,15 +61,9 @@ class question_calculatedsimple_qtype extends question_calculated_qtype {
 
                 if ($oldanswer = array_shift($oldanswers)) {  // Existing answer, so reuse it
                     $answer->id = $oldanswer->id;
-                    if (! $DB->update_record("question_answers", $answer)) {
-                        $result->error = get_string('errorupdatinganswer','question',$answer->id);
-                        return $result;
-                    }
+                    $DB->update_record("question_answers", $answer);
                 } else { // This is a completely new answer
-                    if (! $answer->id = $DB->insert_record("question_answers", $answer)) {
-                        $result->error = get_string('errorinsertinganswer','question');
-                        return $result;
-                    }
+                    $answer->id = $DB->insert_record("question_answers", $answer);
                 }
 
                 // Set up the options object
@@ -85,18 +79,9 @@ class question_calculatedsimple_qtype extends question_calculated_qtype {
 
                 // Save options
                 if (isset($options->id)) { // reusing existing record
-                    if (! $DB->update_record('question_calculated', $options)) {
-                        $mess->name = $this->name();
-                        $mess->id = $options->id ;
-                        $result->error = get_string('errorupdatingoptions','question',$mess);
-                    //    $result->error = "Could not update question calculated options! (id=$options->id)";
-                        return $result;
-                    }
+                    $DB->update_record('question_calculated', $options);
                 } else { // new options
-                    if (! $DB->insert_record('question_calculated', $options)) {
-                        $result->error = "Could not insert question  calculated options!";
-                        return $result;
-                    }
+                    $DB->insert_record('question_calculated', $options);
                 }
             }
         }
index a7cb3c92271e6b2a010d9992bbe82cd544f2250b..e08a90826b19550cca70a8055421c60f0da328cb 100644 (file)
@@ -137,15 +137,9 @@ class question_numerical_qtype extends question_shortanswer_qtype {
 
             if ($oldanswer = array_shift($oldanswers)) {  // Existing answer, so reuse it
                 $answer->id = $oldanswer->id;
-                if (! $DB->update_record("question_answers", $answer)) {
-                    $result->error = "Could not update quiz answer! (id=$answer->id)";
-                    return $result;
-                }
+                $DB->update_record("question_answers", $answer);
             } else { // This is a completely new answer
-                if (! $answer->id = $DB->insert_record("question_answers", $answer)) {
-                    $result->error = "Could not insert quiz answer!";
-                    return $result;
-                }
+                $answer->id = $DB->insert_record("question_answers", $answer);
             }
 
             // Set up the options object
@@ -165,15 +159,9 @@ class question_numerical_qtype extends question_shortanswer_qtype {
 
             // Save options
             if (isset($options->id)) { // reusing existing record
-                if (! $DB->update_record('question_numerical', $options)) {
-                    $result->error = "Could not update quiz numerical options! (id=$options->id)";
-                    return $result;
-                }
+                $DB->update_record('question_numerical', $options);
             } else { // new options
-                if (! $DB->insert_record('question_numerical', $options)) {
-                    $result->error = "Could not insert quiz numerical options!";
-                    return $result;
-                }
+                $DB->insert_record('question_numerical', $options);
             }
         }
         // delete old answer records