From 21a0d919380dd56d0c051cfb8570f3e181c34a18 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 11 Apr 2012 06:31:57 -0400
Subject: [PATCH] - Fix contact information update in case when contact photo exists (#1488420)
---
program/include/rcube_ldap.php | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php
index f42abf1..130eada 100644
--- a/program/include/rcube_ldap.php
+++ b/program/include/rcube_ldap.php
@@ -1109,6 +1109,14 @@
$ldap_data = $this->_map_data($save_cols);
$old_data = $record['_raw_attrib'];
+ // special handling of photo col
+ if ($photo_fld = $this->fieldmap['photo']) {
+ // undefined means keep old photo
+ if (!array_key_exists('photo', $save_cols)) {
+ $ldap_data[$photo_fld] = $record['photo'];
+ }
+ }
+
foreach ($this->fieldmap as $col => $fld) {
if ($fld) {
$val = $ldap_data[$fld];
@@ -1120,6 +1128,9 @@
// make sure comparing array with one element with a string works as expected
if (is_array($old) && count($old) == 1 && !is_array($val)) {
$old = array_pop($old);
+ }
+ if (is_array($val) && count($val) == 1 && !is_array($old)) {
+ $val = array_pop($val);
}
// Subentries must be handled separately
if (!empty($this->prop['sub_fields']) && isset($this->prop['sub_fields'][$fld])) {
@@ -1136,6 +1147,7 @@
}
continue;
}
+
// The field does exist compare it to the ldap record.
if ($old != $val) {
// Changed, but find out how.
--
Gitblit v1.9.1