From b65b8096089410001dfbcd35f9a56f9405b9f5f1 Mon Sep 17 00:00:00 2001 From: mark Date: Fri, 1 Apr 2011 02:52:24 +0000 Subject: svc_hardware and svc_dish, #11454 --- httemplate/view/cust_main/packages/services.html | 83 +++++------------------- httemplate/view/elements/svc_Common.html | 5 +- httemplate/view/elements/svc_edit_link.html | 24 +++++++ httemplate/view/svc_acct.cgi | 6 +- httemplate/view/svc_broadband.cgi | 2 +- httemplate/view/svc_dish.cgi | 16 +++++ httemplate/view/svc_hardware.cgi | 24 +++++++ httemplate/view/svc_phone.cgi | 2 +- 8 files changed, 88 insertions(+), 74 deletions(-) create mode 100644 httemplate/view/elements/svc_edit_link.html create mode 100644 httemplate/view/svc_dish.cgi create mode 100644 httemplate/view/svc_hardware.cgi (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/packages/services.html b/httemplate/view/cust_main/packages/services.html index 512efccc4..1e636ad4e 100644 --- a/httemplate/view/cust_main/packages/services.html +++ b/httemplate/view/cust_main/packages/services.html @@ -10,7 +10,6 @@ function clearhint_search_cust_svc(obj, str) { } -% #foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) { % foreach my $part_svc ( $cust_pkg->part_svc ) { % if ( $opt{'cust_pkg-large_pkg_size'} > 0 and @@ -36,66 +35,26 @@ function clearhint_search_cust_svc(obj, str) { % } -% else { +% else { # don't summarize % foreach my $cust_svc ( @{ $part_svc->cust_pkg_svc } ) { - - - <% FS::UI::Web::svc_link($m, $part_svc, $cust_svc) %> - <% FS::UI::Web::svc_label_link($m, $part_svc, $cust_svc) %> - <% FS::UI::Web::svc_export_links($m, $part_svc, $cust_svc) %> - - - - - - <% $cust_svc->overlimit ? "Overlimit: ". time2str('%b %o %Y' . ($opt{'cust_pkg-display_times'} ? ' %l:%M %P' : ''), $cust_svc->overlimit) : '' %> - - - - - - -% if ( $curuser->access_right('Recharge customer service') -% && $part_svc->svcdb eq 'svc_acct' -% && ( $cust_svc->svc_x->seconds ne '' -% || $cust_svc->svc_x->upbytes ne '' -% || $cust_svc->svc_x->downbytes ne '' -% || $cust_svc->svc_x->totalbytes ne '' -% ) -% ) { - ( <%svc_recharge_link($cust_svc)%> ) -% } - - - - -% my $ip_addr = $cust_svc->svc_x->ip_addr; - -% if ( $part_svc->svcdb eq 'svc_broadband' ) { - ( <% include('/elements/popup_link-ping.html', 'ip'=> $ip_addr ) %> ) - -% } - -% my $manage_link = $opt{'svc_broadband-manage_link'}; -% if ( $manage_link && $part_svc->svcdb eq 'svc_broadband' ) { -% my $svc_manage_link = eval(qq("$manage_link")); - Manage Device ) - -% } - -% if ( $curuser->access_right('Unprovision customer service') ) { - ( <%svc_unprovision_link($cust_svc)%> ) -% } - -% if ( $part_svc->svcdb eq 'svc_pbx' && $opt{'maestro-status_test'} ){ - Test maestro status ) -% } - - - +% if ( $cust_pkg->getfield('cancel') > 0 ) { + <% include('/elements/tr-cust_svc_cancel.html', + %opt, + 'part_svc' => $part_svc, + 'cust_svc' => $cust_svc, + 'cust_pkg' => $cust_pkg, + ) %> +% } +% else { + <% include('/elements/tr-cust_svc.html', + %opt, + 'part_svc' => $part_svc, + 'cust_svc' => $cust_svc, + 'cust_pkg' => $cust_pkg, + ) %> +% } #if cancel > 0 % } #foreach $cust_svc -% } - +% } #if summarizing % if ( ! $cust_pkg->get('cancel') % && $curuser->access_right('Provision customer service') % && $part_svc->num_avail @@ -160,12 +119,6 @@ sub svc_provision_link { $link; } -sub svc_unprovision_link { - my $cust_svc = shift or return ''; - qq!Unprovision!; -} - my %hints = ( svc_acct => '(user or email)', svc_domain => '(domain)', diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html index de49b50d2..7a7539da2 100644 --- a/httemplate/view/elements/svc_Common.html +++ b/httemplate/view/elements/svc_Common.html @@ -51,10 +51,7 @@ function areyousure(href) { Service #<% $svcnum %> % my $url = $opt{'edit_url'} || $p. 'edit/'. $opt{'table'}. '.cgi?'; -| Edit this <% $label %> - -| -Unprovision this Service +| <% include('/view/elements/svc_edit_link.html', 'svc' => $svc_x) %>
<% ntable("#cccccc") %><% ntable("#cccccc",2) %> diff --git a/httemplate/view/elements/svc_edit_link.html b/httemplate/view/elements/svc_edit_link.html new file mode 100644 index 000000000..a85d38077 --- /dev/null +++ b/httemplate/view/elements/svc_edit_link.html @@ -0,0 +1,24 @@ +% if ( $cancel_date ) { +Canceled <% time2str('%b %o %Y', $cancel_date) %> +% } else { + +Edit this <% $label %> | + +Unprovision this Service +% } +<%init> +my %opt = @_; +my $svc_x = $opt{'svc'} or die "'svc' required"; +my $svcdb = $opt{'table'} || $svc_x->table; +my $edit_url = $opt{'edit_url'} || + $p . 'edit/' . $svcdb . '.cgi?' . $svc_x->svcnum; +my $cancel_url = $p . 'misc/unprovision.cgi?' . $svc_x->svcnum; +my $cust_svc = $svc_x->cust_svc; # always exists +my $cancel_date = $cust_svc->pkg_cancel_date; +my ($label) = $cust_svc->label; + diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 4e82569fc..291298d1e 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -38,8 +38,8 @@ %> Service #<% $svcnum %> -| Edit this service - +| +<% include('/view/elements/svc_edit_link.html', 'svc' => $svc_acct) %> <% include( 'svc_acct/change_svc.html', 'part_svc' => \@part_svc, %gopt, @@ -105,7 +105,7 @@ my $svc_acct = qsearchs({ die "Unknown svcnum" unless $svc_acct; #false laziness w/all svc_*.cgi -my $cust_svc = qsearchs( 'cust_svc' , { 'svcnum' => $svcnum } ); +my $cust_svc = $svc_acct->cust_svc; my $pkgnum = $cust_svc->getfield('pkgnum'); my($cust_pkg, $custnum); if ($pkgnum) { diff --git a/httemplate/view/svc_broadband.cgi b/httemplate/view/svc_broadband.cgi index 12e5f0f5d..2c44293ec 100644 --- a/httemplate/view/svc_broadband.cgi +++ b/httemplate/view/svc_broadband.cgi @@ -10,7 +10,7 @@ <% include('/elements/init_overlib.html') %> -Edit this information +<% include('/view/elements/svc_edit_link.html', $svc_acct) %>
<%ntable("#cccccc")%> diff --git a/httemplate/view/svc_dish.cgi b/httemplate/view/svc_dish.cgi new file mode 100644 index 000000000..d4aa8bfdf --- /dev/null +++ b/httemplate/view/svc_dish.cgi @@ -0,0 +1,16 @@ +<% include('elements/svc_Common.html', + 'table' => 'svc_dish', + 'labels' => \%labels, + 'fields' => \@fields, + ) +%> +<%init> + +my $fields = FS::svc_dish->table_info->{'fields'}; +my %labels = map { $_ => ( ref($fields->{$_}) + ? $fields->{$_}{'label'} + : $fields->{$_} + ); + } keys %$fields; +my @fields = qw( acctnum note ); + diff --git a/httemplate/view/svc_hardware.cgi b/httemplate/view/svc_hardware.cgi new file mode 100644 index 000000000..9cea341d7 --- /dev/null +++ b/httemplate/view/svc_hardware.cgi @@ -0,0 +1,24 @@ +<% include('elements/svc_Common.html', + 'table' => 'svc_hardware', + 'labels' => \%labels, + 'fields' => \@fields, + ) +%> +<%init> + +my $fields = FS::svc_hardware->table_info->{'fields'}; +my %labels = map { $_ => ( ref($fields->{$_}) + ? $fields->{$_}{'label'} + : $fields->{$_} + ); + } keys %$fields; +my $model = { field => 'typenum', + type => 'text', + value => sub { $_[0]->hardware_type->model } + }; +my $status = { field => 'statusnum', + type => 'text', + value => sub { $_[0]->status_label } + }; +my @fields = ($model, qw( serial hw_addr ip_addr ), $status, 'note' ); + diff --git a/httemplate/view/svc_phone.cgi b/httemplate/view/svc_phone.cgi index e4dc335ca..4a850c21c 100644 --- a/httemplate/view/svc_phone.cgi +++ b/httemplate/view/svc_phone.cgi @@ -137,7 +137,7 @@ my $html_foot = sub { #src & charged party as per voip_cdr.pm my $search; my $cust_pkg = $svc_phone->cust_svc->cust_pkg; - if ( $cust_pkg && $cust_pkg->part_pkg->option('disable_src') ) { + if ( $cust_pkg && $cust_pkg->part_pkg->option('disable_src',1) ) { $search = "charged_party=$number"; } else { $search = "charged_party_or_src=$number"; -- cgit v1.2.1