From d34c216f5205b020458dd1c46aedd9ab6d5f72a7 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 20 Feb 2012 11:21:45 +0000 Subject: [PATCH] fixed sql error when updating lists --- addressbook/inc/class.addressbook_sql.inc.php | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/addressbook/inc/class.addressbook_sql.inc.php b/addressbook/inc/class.addressbook_sql.inc.php index 3dc751fc57..0153eb853e 100644 --- a/addressbook/inc/class.addressbook_sql.inc.php +++ b/addressbook/inc/class.addressbook_sql.inc.php @@ -548,7 +548,17 @@ class addressbook_sql extends so_sql_cf } if (isset($keys['list_carddav_name'])) { - $keys = false; // cant PUT a name in 11.1 + if (isset($data['list_id'])) // use id if given + { + $keys = array( + 'list_id' => $data['list_id'], + ); + unset($data['list_id']); + } + else + { + $keys = false; // cant PUT a name in 11.1 + } } if (!$keys || !($list_id = $this->db->select($this->lists_table,'list_id',$keys,__LINE__,__FILE__)->fetchColumn())) { @@ -673,8 +683,13 @@ class addressbook_sql extends so_sql_cf { $modified = 0; } - //error_log(__METHOD__.'('.array2string($owner).') returning '.array2string($modified)); - return $modified; + if (!($created = $this->db->select($this->lists_table,'MAX(list_created)',array('list_owner'=>$owner), + __LINE__,__FILE__)->fetchColumn())) + { + $created = 0; + } + //error_log(__METHOD__.'('.array2string($owner).") MAX(list_added)=$modified, MAX(list_created)=$created returning ".array2string(max($modified,$created))); + return max($modified,$created); } /**