mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
FIxed logic problem when checking has_default variable in the database
when inserting new data
This commit is contained in:
parent
7af6281f22
commit
1c418003d7
@ -489,13 +489,13 @@ function insert_record($table, $dataobject, $returnid=true) {
|
||||
foreach ($columns as $column) {
|
||||
if ($column->name <> "id") {
|
||||
if (isset($data[$column->name])) {
|
||||
if ($data[$column->name] == "" and isset($column->has_default)) {
|
||||
if ($data[$column->name] == "" and !empty($column->has_default)) {
|
||||
$ddd[$column->name] = $column->default_value;
|
||||
} else {
|
||||
$ddd[$column->name] = $data[$column->name];
|
||||
}
|
||||
} else {
|
||||
if (isset($column->has_default)) {
|
||||
if (!empty($column->has_default)) {
|
||||
$ddd[$column->name] = $column->default_value;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user