mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 05:24:29 -04:00
Check if is_primary is set when sorting contacts
This commit is contained in:
parent
76f5ef92f7
commit
4248963d92
@ -100,8 +100,9 @@ class ClientRepository extends BaseRepository
|
|||||||
$contacts = isset($data['contact']) ? [$data['contact']] : $data['contacts'];
|
$contacts = isset($data['contact']) ? [$data['contact']] : $data['contacts'];
|
||||||
$contactIds = [];
|
$contactIds = [];
|
||||||
|
|
||||||
|
// If the primary is set ensure it's listed first
|
||||||
usort($contacts, function ($left, $right) {
|
usort($contacts, function ($left, $right) {
|
||||||
return $right['is_primary'] - $left['is_primary'];
|
return (isset($right['is_primary']) ? $right['is_primary'] : 0) - (isset($left['is_primary']) ? $left['is_primary'] : 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach ($contacts as $contact) {
|
foreach ($contacts as $contact) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user