X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fsvc_acct.cgi;h=858ccbe6788640935fdf9173929e3592a35e3767;hb=35e5b12fb55f229edd16bed66e21c5806b8d3b7e;hp=31327a6250100330457d4bc97ad74b1a59955092;hpb=22a35047ecdffff80110e06cc08fc84f9ddba9b0;p=freeside.git
diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi
index 31327a625..858ccbe67 100755
--- a/httemplate/view/svc_acct.cgi
+++ b/httemplate/view/svc_acct.cgi
@@ -1,16 +1,120 @@
-<%
+% if ( $custnum ) {
-my $conf = new FS::Conf;
-my $mydomain = $conf->config('domain');
+ <& /elements/header.html, mt("View [_1] account",$svc) &>
+ <& /elements/small_custview.html, $custnum, '', 1,
+ "${p}view/cust_main.cgi" &>
+
-my($query) = $cgi->keywords;
+% } else {
+% my $delmsg = emt('Permanently delete this account?');
+
+
+
+ <& /elements/header.html, mt('View account'), menubar(
+ emt("Cancel this (unaudited) account") =>
+ "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')",
+ ) &>
+
+% }
+
+
+<& svc_acct/radius_usage.html,
+ 'svc_acct' => $svc_acct,
+ 'part_svc' => $part_svc,
+ 'cust_pkg' => $cust_pkg,
+ %gopt,
+&>
+
+
+<& svc_acct/change_svc_form.html,
+ 'part_svc' => \@part_svc,
+ 'svcnum' => $svcnum,
+ 'pkgnum' => $pkgnum,
+ %gopt,
+&>
+
+<% mt('Service #') |h %><% $svcnum %>
+<& /view/elements/svc_edit_link.html, 'svc' => $svc_acct &>
+<& svc_acct/change_svc.html,
+ 'part_svc' => \@part_svc,
+ %gopt,
+&>
+
+
+
+
+<& svc_acct/basics.html,
+ 'svc_acct' => $svc_acct,
+ 'part_svc' => $part_svc,
+ 'cust_svc' => $cust_svc,
+ %gopt,
+&>
+
+
+
+
+<& svc_acct/cardfortress.html,
+ 'svc_acct' => $svc_acct,
+ %gopt,
+&>
+
+<& 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') ) %>
+
+% }
+
+<& elements/svc_export_status.html, $svc_acct &>
+
+<& elements/svc_export_settings.html, $svc_acct &>
+
+<& /elements/table-tickets.html, object => $cust_svc &>
+
+
+<% joblisting({'svcnum'=>$svcnum}, 1) %>
+
+<& /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;
+if ( $cgi->keywords ) {
+ ($query) = $cgi->keywords;
+} else {
+ $query = $cgi->param('svcnum');
+}
$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
-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) {
@@ -24,110 +128,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 {
- unless ( $mydomain ) {
- die "No legacy domain config file and no svc_domain.svcnum record ".
- "for svc_acct.domsvc: ". $cust_svc->domsvc;
+my @part_svc = ();
+if ($FS::CurrentUser::CurrentUser->access_right('Change customer service')) {
+
+ if ( $pkgnum ) {
+ @part_svc = grep { $_->svcdb eq 'svc_acct'
+ && $_->svcpart != $part_svc->svcpart }
+ $cust_pkg->available_part_svc;
+ } else {
+ @part_svc = qsearch('part_svc', {
+ svcdb => 'svc_acct',
+ disabled => '',
+ svcpart => { op=>'!=', value=>$part_svc->svcpart },
+ } );
}
- $domain = $mydomain;
-}
-print 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" =>
- "${p}misc/cancel-unaudited.cgi?$svcnum" )
- ),
- "Main menu" => $p,
-));
-
-#print qq!
Send account information!;
-
-print qq!Edit this information
!.
- &ntable("#cccccc"). '