1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Support changing primary vendor contact

This commit is contained in:
Hillel Coren 2017-03-20 11:59:29 +02:00
parent f20a096dbb
commit 43c04415ef

View File

@ -95,6 +95,15 @@ class VendorRepository extends BaseRepository
$vendorcontactIds = [];
// If the primary is set ensure it's listed first
usort($vendorcontacts, function ($left, $right) {
if (isset($right['is_primary']) && isset($left['is_primary'])) {
return $right['is_primary'] - $left['is_primary'];
} else {
return 0;
}
});
foreach ($vendorcontacts as $vendorcontact) {
$vendorcontact = $vendor->addVendorContact($vendorcontact, $first);
$vendorcontactIds[] = $vendorcontact->public_id;