mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Support changing primary vendor contact
This commit is contained in:
parent
f20a096dbb
commit
43c04415ef
@ -95,6 +95,15 @@ class VendorRepository extends BaseRepository
|
|||||||
|
|
||||||
$vendorcontactIds = [];
|
$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) {
|
foreach ($vendorcontacts as $vendorcontact) {
|
||||||
$vendorcontact = $vendor->addVendorContact($vendorcontact, $first);
|
$vendorcontact = $vendor->addVendorContact($vendorcontact, $first);
|
||||||
$vendorcontactIds[] = $vendorcontact->public_id;
|
$vendorcontactIds[] = $vendorcontact->public_id;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user