From 12c7f02be391691fc5ade1887df8a55c1b15ecb4 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 14 Oct 2009 19:01:36 +0000 Subject: [PATCH] "fixed only first row got loged, as array_diff keys the index --> renumbering with array_values" --- etemplate/inc/class.bo_tracking.inc.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/etemplate/inc/class.bo_tracking.inc.php b/etemplate/inc/class.bo_tracking.inc.php index a92e9c8be8..cf8700e8ab 100644 --- a/etemplate/inc/class.bo_tracking.inc.php +++ b/etemplate/inc/class.bo_tracking.inc.php @@ -266,11 +266,12 @@ abstract class bo_tracking { self::compact_1_N_relation($data[$name],$status); self::compact_1_N_relation($old[$name],$status); - $added = array_diff($data[$name],$old[$name]); - $removed = array_diff($old[$name],$data[$name]); + $added = array_values(array_diff($data[$name],$old[$name])); + $removed = array_values(array_diff($old[$name],$data[$name])); $n = max(array(count($added),count($removed))); for($i = 0; $i < $n; ++$i) { + //error_log(__METHOD__."() $i: historylog->add('$name',data['$this->id_field']={$data[$this->id_field]},".array2string($added[$i]).','.array2string($removed[$i])); $this->historylog->add($name,$data[$this->id_field],$added[$i],$removed[$i]); } } @@ -322,6 +323,7 @@ abstract class bo_tracking $changed_fields[] = $name; } } + //error_log(__METHOD__."() changed_fields=".array2string($changed_fields)); return $changed_fields; }