MT#55618 /api/subscribers fix default contract_sound_set assignment

* when a new subscriber is created via POST, if the associated customer
  has at least one default contract_sound_set, it is correctly assigned
  to the subscriber as the "contract_sound_set" preference.
  the logic is now inline with the UI behaviour

Change-Id: Ifeb86faf6718648b29e6391bd16752766358ed0f
(cherry picked from commit 826d3f1d9f)
mr10.5.4
Kirill Solomko 3 years ago
parent 59208410fe
commit 02dc26d4cd

@ -532,6 +532,16 @@ sub prepare_resource {
$preferences->{ext_contract_id} = $customer->external_id;
}
# find and assign default contract sound set (if exists)
if (!$item) {
my $default_contract_sound_set_row = $customer->voip_sound_sets->search(
{ contract_default => 1 })->first;
if ($default_contract_sound_set_row) {
$preferences->{contract_sound_set} = $default_contract_sound_set_row->id;
}
}
my $subscriber = $c->model('DB')->resultset('voip_subscribers')->find({
username => $resource->{username},
domain_id => $resource->{domain_id},

Loading…
Cancel
Save