diff --git a/lib/NGCP/Panel/Controller/API/SoundSets.pm b/lib/NGCP/Panel/Controller/API/SoundSets.pm index 21a6a78129..66b7ff05a4 100644 --- a/lib/NGCP/Panel/Controller/API/SoundSets.pm +++ b/lib/NGCP/Panel/Controller/API/SoundSets.pm @@ -126,8 +126,8 @@ sub POST :Allow { media_type => 'application/json', ); last unless $resource; - - $resource->{contract_id} = delete $resource->{customer_id}; + my $customer_id = delete $resource->{customer_id}; + $resource->{contract_id} //= $customer_id; my $form = $self->get_form($c); last unless $self->validate_form( c => $c, diff --git a/lib/NGCP/Panel/Role/API/SoundSets.pm b/lib/NGCP/Panel/Role/API/SoundSets.pm index 39f80af067..10feb2679d 100644 --- a/lib/NGCP/Panel/Role/API/SoundSets.pm +++ b/lib/NGCP/Panel/Role/API/SoundSets.pm @@ -100,7 +100,8 @@ sub item_by_id { sub update_item { my ($self, $c, $item, $old_resource, $resource, $form) = @_; - $resource->{contract_id} = delete $resource->{customer_id}; + my $customer_id = delete $resource->{customer_id}; + $resource->{contract_id} //= $customer_id; $form //= $self->get_form($c); return unless $self->validate_form( c => $c,