Closed Bug 815833 Opened 9 years ago Closed 9 years ago

[contacts] Add PhoneNumberJS to ContactsDB

Categories

(Core :: DOM: Device Interfaces, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20
blocking-basecamp +
Tracking Status
firefox18 --- fixed
firefox19 --- fixed
firefox20 --- fixed
b2g18 --- fixed

People

(Reporter: gwagner, Assigned: gwagner)

References

Details

Attachments

(1 file, 2 obsolete files)

No description provided.
Blocks: 811538
Attached patch patch (obsolete) — Splinter Review
Add the international number to the search field for contacts.
An API search with the international number finds now a contact that was entered with the local number.
We add the international number to the search field for telephone numbers of the contact.
Andrea, can you test this?
Please pull your contacts DB from the phone before you test this patch. Just in case the upgrade code is buggy and I have to rerun the upgrade code with your DB.
It's in data/local/indexedDB/chrome.
blocking-basecamp: --- → ?
Attached patch patch (obsolete) — Splinter Review
Attachment #685860 - Attachment is obsolete: true
Attachment #685867 - Flags: review?(bent.mozilla)
[:gwagner] Only one comment in your patch. Take care because there are phone numbers that could be not internationalized! For example, in Spain we have the following number of Movistar: 2236. If you go to the library and you ask for the 'parsed' version of it, you are gonna retrieve null! So in this case instead of the following line:

dump("Warning: No international number found for " + number + "\n");

You should add the request with the phone number that you receive directly, something as:
contact.search[field].push(number.toString());

For create a generic way of doing it (in SMS App we kept a DB with the same problems as this one, and we fix it! ;) ), method 'parse: function(aNumber)' should return or the 'internationalNumber' (if it's available), or 'aNumber' directly, in order to work properly with phone numbers with a length less than 8 characters (http://en.wikipedia.org/wiki/E.164). Thanks!!!
blocking-basecamp: ? → +
Comment on attachment 685867 [details] [diff] [review]
patch

Review of attachment 685867 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with one comment:

::: dom/contacts/fallback/ContactDB.jsm
@@ +171,5 @@
> +                    debug("InternationalFormat: " + parsedNumber.internationalFormat);
> +                    debug("InternationalNumber: " + parsedNumber.internationalNumber);
> +                    debug("NationalNumber: " + parsedNumber.nationalNumber);
> +                    debug("NationalFormat: " + parsedNumber.nationalFormat);
> +                    cursor.value.search.tel.push(parsedNumber.internationalNumber);

This could be avoided if parsed number == existing number.
Attachment #685867 - Flags: review?(bent.mozilla) → review+
Attached patch patchSplinter Review
upgrade code....
Attachment #685867 - Attachment is obsolete: true
Attachment #686798 - Flags: review?(bent.mozilla)
Attachment #686798 - Flags: review?(bent.mozilla) → review+
https://hg.mozilla.org/mozilla-central/rev/71ffd1a30c08
https://hg.mozilla.org/mozilla-central/rev/9f1365db9a35
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
https://bugzilla.mozilla.org/show_bug.cgi?id=813621#c11
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Duplicate of this bug: 813621
Copy & Paste the scenario:

- Store one Contact with 612123123
- Request to Contact API with the internationalized one:
      var options = {
        filterBy: ['tel'],
        filterOp: 'equals',
        filterValue: '+34612123123'
      };

- Call to API:
window.navigator.mozContacts.find(options);

EXPECTED: Retrieve the contact

CURRENTLY: No contact retrieved for the internationalized version of the phone number
Flags: needinfo?(anygregor)
(In reply to Borja Salguero [:borjasalguero] from comment #13)
> Copy & Paste the scenario:
> 
> - Store one Contact with 612123123
> - Request to Contact API with the internationalized one:
>       var options = {
>         filterBy: ['tel'],
>         filterOp: 'equals',

Equals currently only checks the number you entered. 'contains' should work.
Flags: needinfo?(anygregor)
Thanks! Closing again ;)
Status: REOPENED → RESOLVED
Closed: 9 years ago9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.