File bnc-435599-junk-contacts-created.patch of Package evolution-data-server

Index: addressbook/backends/groupwise/e-book-backend-groupwise.c
===================================================================
--- addressbook/backends/groupwise/e-book-backend-groupwise.c	(revision 9761)
+++ addressbook/backends/groupwise/e-book-backend-groupwise.c	(working copy)
@@ -1168,7 +1168,9 @@
 	int element_type;
 	int i;
 	gboolean is_contact_list;
+	gboolean is_organization;
 
+	is_organization = e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_ORGANISATION ? TRUE: FALSE;
 	is_contact_list = e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_GROUP ? TRUE: FALSE;
 	e_contact_set (contact, E_CONTACT_IS_LIST, GINT_TO_POINTER (is_contact_list));
 	if (is_contact_list)
@@ -1179,9 +1181,11 @@
 
 		if(element_type == ELEMENT_TYPE_SIMPLE) {
 			if (mappings[i].field_id != E_CONTACT_BOOK_URI) {
-				value = e_gw_item_get_field_value (item, mappings[i].element_name);
-				if(value != NULL)
-					e_contact_set (contact, mappings[i].field_id, value);
+				if (!is_organization) {
+					value = e_gw_item_get_field_value (item, mappings[i].element_name);
+					if(value != NULL)
+						e_contact_set (contact, mappings[i].field_id, value);
+				}
 			}
 		} else if (element_type == ELEMENT_TYPE_COMPLEX) {
 			if (mappings[i].field_id == E_CONTACT_CATEGORIES) {
@@ -1251,10 +1255,6 @@
 			element_type = mappings[i].element_type;
 			if (element_type == ELEMENT_TYPE_SIMPLE)  {
 				value =  e_contact_get(contact, mappings[i].field_id);
-				if (mappings[i].field_id == E_CONTACT_ORG) {
-					set_organization_in_gw_item (item, contact, egwb);
-					continue;
-				}
 				if (value != NULL)
 					e_gw_item_set_field_value (item, mappings[i].element_name, value);
 			} else if (element_type == ELEMENT_TYPE_COMPLEX) {
@@ -1453,14 +1453,7 @@
 
 		if (e_contact_get (contact, E_CONTACT_IS_LIST))
 			set_member_changes (new_item, old_item, egwb);
-		new_org = e_gw_item_get_field_value (new_item, "organization");
-		old_org = e_gw_item_get_field_value (old_item, "organization");
-		if (new_org && *new_org) {
 
-			if ((old_org == NULL) || (old_org && strcmp (new_org, old_org)) != 0)
-				set_organization_in_gw_item (new_item, contact, egwb);
-		}
-
 		set_changes_in_gw_item (new_item, old_item);
 
 		e_gw_item_set_item_type (new_item, e_gw_item_get_item_type (old_item));
openSUSE Build Service is sponsored by