1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Ensure contacts remain in the same order when saved

This commit is contained in:
Hillel Coren 2016-05-05 23:09:11 +03:00
parent 5bedba1474
commit 5322e16a4c

View File

@ -105,9 +105,9 @@ class ClientRepository extends BaseRepository
// If the primary is set ensure it's listed first
usort($contacts, function ($left, $right) {
return (isset($right['is_primary']) ? $right['is_primary'] : 0) - (isset($left['is_primary']) ? $left['is_primary'] : 0);
return (isset($right['is_primary']) ? $right['is_primary'] : 1) - (isset($left['is_primary']) ? $left['is_primary'] : 0);
});
foreach ($contacts as $contact) {
$contact = $client->addContact($contact, $first);
$contactIds[] = $contact->public_id;