From: Michael J. Rubinsky Date: Wed, 12 Aug 2009 15:10:08 +0000 (-0400) Subject: Don't return the first history entry, make sure it's the most recent one. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=6179ac2e1fd3c1d07b7c3d8176e3aa9071c547ad;p=horde.git Don't return the first history entry, make sure it's the most recent one. Ticket: 8487 Submitted By: ryu (at) ryux (dot) org --- diff --git a/turba/lib/Api.php b/turba/lib/Api.php index ec6e00c7a..1802bbdbc 100644 --- a/turba/lib/Api.php +++ b/turba/lib/Api.php @@ -574,6 +574,7 @@ class Turba_Api extends Horde_Registry_Api return PEAR::raiseError(_("No address book specified"), 'horde.error'); } + $last = 0; foreach ($sources as $source) { if (empty($source) || !isset($cfgSources[$source])) { return PEAR::raiseError(sprintf(_("Invalid address book: %s"), $source), 'horde.error', null, null, $source); @@ -588,12 +589,12 @@ class Turba_Api extends Horde_Registry_Api $ts = $history->getActionTimestamp('turba:' . $driver->getName() . ':' . $uid, $action); - if (!empty($ts)) { - return $ts; + if (!empty($ts) && $ts > $last) { + $last = $ts; } } - return 0; + return $last; } /**