X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fsvc_acct.cgi;h=9135e67e956727bb805d173c3bfda60c72622d03;hb=874ad675da1321638b374d0b574231d7fa577196;hp=c79f71f5da13e5cd2a5b6bf573bfb25c0b03109d;hpb=2f91e1d377e1e03f567ea1ec6bcd9fab0bedff5e;p=freeside.git
diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi
index c79f71f5d..9135e67e9 100755
--- a/httemplate/view/svc_acct.cgi
+++ b/httemplate/view/svc_acct.cgi
@@ -1,12 +1,101 @@
-
-<%
+% if ( $custnum ) {
-my $conf = new FS::Conf;
+ <% include("/elements/header.html","View $svc account") %>
+ <% include( '/elements/small_custview.html', $custnum, '', 1,
+ "${p}view/cust_main.cgi") %>
+
+
+% } else {
+
+
+
+ <% include("/elements/header.html",'View account', menubar(
+ "Cancel this (unaudited) account" =>
+ "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')",
+ )) %>
+
+% }
+
+<% include( 'svc_acct/radius_usage.html',
+ 'svc_acct' => $svc_acct,
+ 'part_svc' => $part_svc,
+ 'cust_pkg' => $cust_pkg,
+ %gopt,
+ )
+%>
+
+<% include( 'svc_acct/change_svc_form.html',
+ 'part_svc' => \@part_svc,
+ 'svcnum' => $svcnum,
+ 'pkgnum' => $pkgnum,
+ %gopt,
+ )
+%>
+
+Service #<% $svcnum %>
+| Edit this service
+
+<% include( 'svc_acct/change_svc.html',
+ 'part_svc' => \@part_svc,
+ %gopt,
+ )
+%>
+
+<% include( 'svc_acct/basics.html',
+ 'svc_acct' => $svc_acct,
+ 'part_svc' => $part_svc,
+ %gopt,
+ )
+%>
+
+
+
+
+<% include( 'svc_acct/hosting.html',
+ %gopt,
+ )
+%>
+
+%#remove this? does anybody even use it? it was a misunderstood customer
+%#request IIRC?
+% my $conf = new FS::Conf;
+% if ( $conf->exists('svc_acct-notes') ) {
+% warn 'WARNING: svc_acct-notes deprecated\n';
+<% join("
", $conf->config('svc_acct-notes') ) %>
+
+% }
+
+<% include('elements/svc_export_settings.html', $svc_acct) %>
+
+<% joblisting({'svcnum'=>$svcnum}, 1) %>
+
+<% include('/elements/footer.html') %>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('View customer services');
+
+my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '.
+ ' LEFT JOIN cust_pkg USING ( pkgnum ) '.
+ ' LEFT JOIN cust_main USING ( custnum ) ';
my($query) = $cgi->keywords;
$query =~ /^(\d+)$/;
my $svcnum = $1;
-my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum});
+my $svc_acct = qsearchs({
+ 'select' => 'svc_acct.*',
+ 'table' => 'svc_acct',
+ 'addl_from' => $addl_from,
+ 'hashref' => { 'svcnum' => $svcnum },
+ 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql(
+ 'null_right' => 'View/link unlinked services'
+ ),
+});
die "Unknown svcnum" unless $svc_acct;
#false laziness w/all svc_*.cgi
@@ -24,164 +113,29 @@ if ($pkgnum) {
my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } );
die "Unknown svcpart" unless $part_svc;
+my $svc = $part_svc->svc;
-my $domain;
-if ( $svc_acct->domsvc ) {
- my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } );
- die "Unknown domain" unless $svc_domain;
- $domain = $svc_domain->domain;
-} else {
- die "No svc_domain.svcnum record for svc_acct.domsvc: ". $cust_svc->domsvc;
-}
-
-%>
-
-
-
-<%= header('Account View', menubar(
- ( ( $pkgnum || $custnum )
- ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum",
- "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
- )
- : ( "Cancel this (unaudited) account" =>
- "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')" )
- ),
- "Main menu" => $p,
-)) %>
-
-<%
-
-#if ( $cust_pkg && $cust_pkg->part_pkg->plan eq 'sqlradacct_hour' ) {
-if ( $part_svc->part_export('sqlradius') ) {
-
- my $last_bill;
- if ( $cust_pkg ) {
- #false laziness w/httemplate/edit/part_pkg... this stuff doesn't really
- #belong in plan data
- my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); }
- split("\n", $cust_pkg->part_pkg->plandata );
-
- $last_bill = $cust_pkg->last_bill;
- } else {
- $last_bill = 0;
- }
-
- my $seconds = $svc_acct->seconds_since_sqlradacct( $last_bill, time );
- my $h = int($seconds/3600);
- my $m = int( ($seconds%3600) / 60 );
- my $s = $seconds%60;
-
- if ( $seconds ) {
- print "Online $hh $mm $ss";
- } else {
- print 'Has not logged on';
- }
+my @part_svc = ();
+if ($FS::CurrentUser::CurrentUser->access_right('Change customer service')) {
- if ( $cust_pkg ) {
- print ' this billing cycle (since '. time2str(%C, $last_bill). ') - '.
- $plandata{recur_included_hours}. ' total hours in plan
';
+ if ( $pkgnum ) {
+ @part_svc = grep { $_->svcdb eq 'svc_acct'
+ && $_->svcpart != $part_svc->svcpart }
+ $cust_pkg->available_part_svc;
} else {
- print ' (no billing cycle available for unaudited package)
';
+ @part_svc = qsearch('part_svc', {
+ svcdb => 'svc_acct',
+ disabled => '',
+ svcpart => { op=>'!=', value=>$part_svc->svcpart },
+ } );
}
}
-#print qq!
Send account information!;
-
-print qq!Edit this information
!.
- &ntable("#cccccc"). '
'. encode_entities($password). ''; -} else { - print "(hidden)"; -} -print "