fix(addressbook): autocomplete correctly return two contacts from two ldap with same id

This commit is contained in:
Hivert Quentin
2023-10-03 14:28:57 +02:00
parent b1d8475520
commit 1d3da92bab
2 changed files with 10 additions and 2 deletions
@@ -239,6 +239,9 @@
[newRecord setObject: [oldRecord objectForKey: @"c_uid"]
forKey: @"c_uid"];
//source id
[newRecord setObject: [source sourceID] forKey: @"sourceID"];
// c_name => id
[newRecord setObject: [oldRecord objectForKey: @"c_name"]
forKey: @"c_name"];
@@ -103,7 +103,12 @@
return AddressBook.$$resource.fetch(null, 'allContactSearch', params).then(function(response) {
var results, card, index,
compareIds = function(data) {
return this.id == data.id;
if(this.sourceID === undefined || data.sourceid === undefined) {
return this.id == data.id;
}
else {
return this.id == data.id && this.sourceID == data.sourceid;
}
};
if (excludedCards) {
// Remove excluded cards from results
@@ -130,7 +135,7 @@
cards.splice(index, 0, card);
}
});
AddressBook.$log.debug(cards);
// AddressBook.$log.debug(cards);
return cards;
});
};