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;
}
// $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);
$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);
$data->notification = 0;
}
- if (! $DB->update_record('data', $data)) {
- return false;
- }
+ $DB->update_record('data', $data);
data_grade_item_update($data);
$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);
}
}
$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);
}
}
} 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);
}
}
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
// 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);
}
}
}
$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);
}
}
}
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
// 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);
}
}
}
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
// 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