diff --git a/lib/admin.pm b/lib/admin.pm index 628b702..5522732 100644 --- a/lib/admin.pm +++ b/lib/admin.pm @@ -16,7 +16,7 @@ use XML::Simple; use Catalyst::Log::Log4perl; -use Catalyst qw/-Debug ConfigLoader Static::Simple +use Catalyst qw/-Debug ConfigLoader Static::Simple Unicode Authentication Authentication::Store::Minimal Authentication::Credential::Password Session Session::Store::FastMmap Session::State::Cookie /; diff --git a/lib/admin/Controller/billing.pm b/lib/admin/Controller/billing.pm index 4fd65a8..b67f302 100644 --- a/lib/admin/Controller/billing.pm +++ b/lib/admin/Controller/billing.pm @@ -490,7 +490,8 @@ sub set_fees : Local { last; } @keyval{@elements} = @values; - $keyval{destination} = $self->_normalize_destination($c, $keyval{destination}); + $keyval{destination} = $self->_normalize_destination($c, $keyval{destination}) || $keyval{destination} + if length $keyval{destination}; unless(defined $keyval{destination}) { $messages{feeerr} = 'Web.Fees.InvalidDestination'; $c->session->{feeerr}{line} = $line; @@ -534,8 +535,8 @@ sub edit_fee : Local { my $destination = $c->stash->{destination} = $c->request->params->{destination}; $c->stash->{offset} = $c->request->params->{offset} || 0; - $destination = $self->_normalize_destination($c, $destination) - if defined $destination; + $destination = $self->_normalize_destination($c, $destination) || $destination + if length $destination; if(ref $c->session->{restore_fee_input} eq 'HASH') { $c->stash->{fee} = $c->session->{restore_fee_input}; @@ -580,10 +581,12 @@ sub do_edit_fee : Local { my $bilprof = $c->request->params->{bilprof}; my $offset = $c->request->params->{offset}; $settings{destination} = $c->request->params->{destination}; - $settings{destination} = $self->_normalize_destination($c, $settings{destination}) - if defined $settings{destination}; + $settings{destination} = $self->_normalize_destination($c, $settings{destination}) || $settings{destination} + if length $settings{destination}; if(defined $c->request->params->{new_destination}) { - $settings{destination} = $self->_normalize_destination($c, $c->request->params->{new_destination}); + $settings{destination} = $self->_normalize_destination($c, $c->request->params->{new_destination}) + || $c->request->params->{new_destination} + if length $c->request->params->{new_destination}; unless(defined $settings{destination}) { $messages{destination} = 'Web.Fees.InvalidDestination'; } @@ -638,7 +641,7 @@ sub do_delete_fee : Local { my $destination = $c->request->params->{destination}; my $offset = $c->request->params->{offset}; - $destination = $self->_normalize_destination($c, $destination); + $destination = $self->_normalize_destination($c, $destination) || $destination; if($c->model('Provisioning')->call_prov( $c, 'billing', 'set_billing_profile_fees', { handle => $bilprof, @@ -860,15 +863,18 @@ sub _normalize_destination : Private { my ($self, $c, $destination) = @_; if($destination =~ /^\d+$/) { + # E.164 number $destination = '^' . $destination . '.*$'; } elsif($destination =~ /^(?:[a-z0-9]+(?:-[a-z0-9]+)*\.)+[a-z]+$/i - or $destination =~ /^[\d.]+$/) + or $destination =~ /^[012]?[0-9]?[0-9](?:\.[012]?[0-9]?[0-9]){3}$/) { + # domain or IP address $destination =~ s/\./\\./g; $destination = '^.*@'. $destination .'$'; } elsif($destination =~ /^.+\@(?:[a-z0-9]+(?:-[a-z0-9]+)*\.)+[a-z]+$/i - or $destination =~ /^.+\@[\d.]+$/) + or $destination =~ /^.+\@[012]?[0-9]?[0-9](?:\.[012]?[0-9]?[0-9]){3}$/) { + # SIP URI $destination =~ s/\./\\./g; $destination = '^'. $destination .'$'; } else { @@ -881,13 +887,18 @@ sub _normalize_destination : Private { sub _denormalize_destination : Private { my ($self, $c, $destination) = @_; + my $backup = $destination; $destination =~ s/\\\././g; $destination =~ s/\$$//; $destination =~ s/^\^//; $destination =~ s/\.\*$//; $destination =~ s/^\.\*\@//; - return $destination; + if(defined $self->_normalize_destination($c, $destination)) { + return $destination; + } else { + return $backup; + } } diff --git a/lib/admin/Controller/domain.pm b/lib/admin/Controller/domain.pm index 7890a37..ca83a04 100644 --- a/lib/admin/Controller/domain.pm +++ b/lib/admin/Controller/domain.pm @@ -63,6 +63,8 @@ sub do_edit_domain : Local { my $domain = $c->request->params->{domain}; + $settings{local} = $c->request->params->{local} ? 1 : 0; + $settings{cc} = $c->request->params->{cc}; $messages{ecc} = 'Client.Voip.MalformedCc' unless $settings{cc} =~ /^\d+$/; @@ -108,6 +110,8 @@ sub do_create_domain : Local { my $domain = $c->request->params->{domain}; + $settings{local} = $c->request->params->{local} ? 1 : 0; + $settings{cc} = $c->request->params->{cc}; $messages{acc} = 'Client.Voip.MalformedCc' unless $settings{cc} =~ /^\d+$/; diff --git a/lib/admin/Controller/subscriber.pm b/lib/admin/Controller/subscriber.pm index bd5ffff..d6de21b 100644 --- a/lib/admin/Controller/subscriber.pm +++ b/lib/admin/Controller/subscriber.pm @@ -55,6 +55,7 @@ sub search : Local { $exact{$sf} = 1 if $c->request->params->{'exact_'.$sf}; } } + $filter{terminated} = 1 if $c->request->params->{terminated}; $c->session->{search_filter} = { %filter }; $c->session->{exact_filter} = { %exact }; } @@ -74,6 +75,7 @@ sub search : Local { $filter{$sf} =~ s/\%*$/\%/; } } + $c->stash->{terminated} = $filter{terminated}; my $offset = $c->request->params->{offset} || 0; $offset = 0 if $offset !~ /^\d+$/; @@ -355,7 +357,12 @@ sub update_subscriber : Local { $messages{number_sn} = 'Client.Voip.MalformedSn' unless $sn =~ /^[1-9][0-9]+$/; } + } else { + $settings{cc} = undef; + $settings{ac} = undef; + $settings{sn} = undef; } + my $timezone = $c->request->params->{timezone}; if(length $timezone) { $settings{timezone} = $timezone; diff --git a/lib/admin/View/Sipwise.pm b/lib/admin/View/Sipwise.pm index cb3e225..dc7d001 100644 --- a/lib/admin/View/Sipwise.pm +++ b/lib/admin/View/Sipwise.pm @@ -35,6 +35,7 @@ __PACKAGE__->config( }, }, }, + ENCODING => 'utf-8', ); =head1 BUGS AND LIMITATIONS diff --git a/root/css/admin.css b/root/css/admin.css index 3699f74..8e64396 100644 --- a/root/css/admin.css +++ b/root/css/admin.css @@ -252,11 +252,21 @@ h3 { width: 95px; } -/* decrease input text fields for cc/ac */ +/* decrease input text fields */ +.imedium { + width: 140px; +} + +/* decrease input text fields for ac */ .ishort { width: 50px; } +/* decrease input text fields for cc */ +.irealshort { + width: 30px; +} + /* increase spacing between password and show/hide href */ #contentplace .apass { vertical-align: middle; @@ -312,7 +322,8 @@ h3 { #contentplace .order_payments, #contentplace .registered_contacts, #contentplace .billing_fees, -#contentplace .billing_peaktimes +#contentplace .billing_peaktimes, +#contentplace .domains { width: 100%; border-spacing: 0px; @@ -356,3 +367,7 @@ h3 { #contentplace .padding6 { padding: 6px; } + +.topbottomspace { + margin: 5px 0; +} diff --git a/root/layout/footer b/root/layout/footer index 9315ddd..83798a2 100644 --- a/root/layout/footer +++ b/root/layout/footer @@ -1,6 +1,7 @@
diff --git a/root/static/images/sipwise_logo_96.png b/root/static/images/sipwise_logo_96.png index 24174ba..0199cfe 100644 Binary files a/root/static/images/sipwise_logo_96.png and b/root/static/images/sipwise_logo_96.png differ diff --git a/root/tt/billing_fees.tt b/root/tt/billing_fees.tt index 62d80df..afd4ae9 100644 --- a/root/tt/billing_fees.tt +++ b/root/tt/billing_fees.tt @@ -60,10 +60,10 @@| domain | -country code | -timezone | -- | + | local | +cc | +timezone | ++ |