Bug 895169 - B2G RIL: Check contact attributes values when export to SIM. r=vicamo

This commit is contained in:
Yoshi Huang 2013-08-09 16:00:38 +08:00
parent 7c511e8959
commit bd04de3d30
2 changed files with 14 additions and 9 deletions

View File

@ -41,7 +41,8 @@ function testAddContact(type, pin2) {
contact.init({
name: "add",
tel: [{value: "0912345678"}]
tel: [{value: "0912345678"}],
email:[]
});
let updateRequest = icc.updateContact(type, contact, pin2);

View File

@ -922,22 +922,26 @@ RILContentHelper.prototype = {
// Parsing nsDOMContact to Icc Contact format
let iccContact = {};
if (contact.name) {
if (Array.isArray(contact.name) && contact.name[0]) {
iccContact.alphaId = contact.name[0];
}
if (contact.tel) {
iccContact.number = contact.tel[0].value;
if (Array.isArray(contact.tel)) {
iccContact.number = contact.tel[0] && contact.tel[0].value;
let telArray = contact.tel.slice(1);
let length = telArray.length;
if (length > 0) {
iccContact.anr = [];
}
for (let i = 0; i < telArray.length; i++) {
iccContact.anr.push(telArray[i].value);
}
}
if (contact.email) {
if (Array.isArray(contact.email) && contact.email[0]) {
iccContact.email = contact.email[0].value;
}
if (contact.tel.length > 1) {
iccContact.anr = contact.tel.slice(1);
}
cpmm.sendAsyncMessage("RIL:UpdateIccContact", {
clientId: 0,
data: {