diff --git a/lib/NGCP/Panel/Controller/Subscriber.pm b/lib/NGCP/Panel/Controller/Subscriber.pm index 2e742ee03d..606f67514b 100644 --- a/lib/NGCP/Panel/Controller/Subscriber.pm +++ b/lib/NGCP/Panel/Controller/Subscriber.pm @@ -1144,7 +1144,7 @@ sub preferences_callforward_advanced :Chained('base') :PathPart('preferences/cal my @maps = (); foreach my $map($cf_mapping->all) { push @maps, { - destination_set => $map->destination_set->id, + destination_set => $map->destination_set ? $map->destination_set->id : undef, time_set => $map->time_set ? $map->time_set->id : undef, }; } @@ -1155,6 +1155,7 @@ sub preferences_callforward_advanced :Chained('base') :PathPart('preferences/cal $cf_form->process( params => $posted ? $c->request->params : $params, + posted => $posted, ); diff --git a/lib/NGCP/Panel/Form/SubscriberCFAdvanced.pm b/lib/NGCP/Panel/Form/SubscriberCFAdvanced.pm index 3d2f729808..d260b75cde 100644 --- a/lib/NGCP/Panel/Form/SubscriberCFAdvanced.pm +++ b/lib/NGCP/Panel/Form/SubscriberCFAdvanced.pm @@ -103,7 +103,25 @@ has_block 'actions' => ( class => [qw(modal-footer)], render_list => [qw(cf_actions)], ); - +sub validate_active_callforward{ + my ( $self, $field ) = @_; + my $value = $field->value || []; + my $result = 1; + if( $#$value < 0 ){ + $result = 0; + }else{ + foreach my $map (@$value){ + if(! defined $map->{destination_set}){ + $result = 0; + last; + } + } + } + if(!$result){ + $field->add_error($field->label . " is invalid"); + } + return $result; +} 1; # vim: set tabstop=4 expandtab: