Skip to content

Commit 1a48752

Browse files
authored
When importing report an attribute value changing from null. (#845)
1 parent af850ff commit 1a48752

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

public_html/lists/admin/actions/import2.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@
284284
if ($new || (!$new && $_SESSION['overwrite'] == 'yes')) {
285285
$query = '';
286286
++$count['dataupdate'];
287-
$old_data = Sql_Fetch_Array_Query(sprintf('select * from %s where id = %d', $tables['user'],
287+
$old_data = Sql_Fetch_Assoc_Query(sprintf('select * from %s where id = %d', $tables['user'],
288288
$userid));
289289
$old_data = array_merge($old_data, getUserAttributeValues('', $userid));
290290
foreach ($user['systemvalues'] as $column => $value) {
@@ -397,16 +397,20 @@
397397
}
398398
}
399399
}
400-
$current_data = Sql_Fetch_Array_Query(sprintf('select * from %s where id = %d', $tables['user'],
400+
$current_data = Sql_Fetch_Assoc_Query(sprintf('select * from %s where id = %d', $tables['user'],
401401
$userid));
402402
$current_data = array_merge($current_data, getUserAttributeValues('', $userid));
403403
$information_changed = 0;
404+
404405
foreach ($current_data as $key => $val) {
405-
if (!is_numeric($key)) {
406-
if (isset($old_data[$key]) && $old_data[$key] != $val && $old_data[$key] && $key != 'password' && $key != 'modified') {
407-
$information_changed = 1;
408-
$history_entry .= "$key = $val\n*changed* from $old_data[$key]\n";
409-
}
406+
if ($key == 'password' || $key == 'modified') {
407+
continue;
408+
}
409+
$old_value = isset($old_data[$key]) ? $old_data[$key] : '';
410+
411+
if ($old_value != $val) {
412+
$information_changed = 1;
413+
$history_entry .= "$key = $val\n*changed* from $old_value\n";
410414
}
411415
}
412416
if (!$information_changed) {

0 commit comments

Comments
 (0)