diff options
author | ivan <ivan> | 2008-12-03 21:15:39 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-12-03 21:15:39 +0000 |
commit | ff873782e78715891b9d5d2eb5b38c735d372556 (patch) | |
tree | 078350a30b03a064e44244f4ccd141cbe460613a /httemplate/view/svc_www.cgi | |
parent | e3c53b20ac5a7e120562bbd259a19707e9c11cb5 (diff) |
fix real customer numbers showing on view pages, RT#4099/4379
Diffstat (limited to 'httemplate/view/svc_www.cgi')
-rw-r--r-- | httemplate/view/svc_www.cgi | 170 |
1 files changed, 93 insertions, 77 deletions
diff --git a/httemplate/view/svc_www.cgi b/httemplate/view/svc_www.cgi index d6d458ca5..c0f331619 100644 --- a/httemplate/view/svc_www.cgi +++ b/httemplate/view/svc_www.cgi @@ -1,52 +1,6 @@ -% die "access denied" -% unless $FS::CurrentUser::CurrentUser->access_right('View customer services'); -% -%my($query) = $cgi->keywords; -%$query =~ /^(\d+)$/; -%my $svcnum = $1; -%my $svc_www = qsearchs({ -% 'select' => 'svc_www.*', -% 'table' => 'svc_www', -% 'addl_from' => ' LEFT JOIN cust_svc USING ( svcnum ) '. -% ' LEFT JOIN cust_pkg USING ( pkgnum ) '. -% ' LEFT JOIN cust_main USING ( custnum ) ', -% 'hashref' => { 'svcnum' => $svcnum }, -% 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, -%}) or die "svc_www: Unknown svcnum $svcnum"; -% -%#false laziness w/all svc_*.cgi -%my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } ); -%my $pkgnum = $cust_svc->getfield('pkgnum'); -%my($cust_pkg, $custnum); -%if ($pkgnum) { -% $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); -% $custnum = $cust_pkg->custnum; -%} else { -% $cust_pkg = ''; -% $custnum = ''; -%} -%#eofalse -% -%my $part_svc=qsearchs('part_svc',{'svcpart'=>$cust_svc->svcpart}) -% or die "svc_www: Unknown svcpart" . $cust_svc->svcpart; - -%my $usersvc = $svc_www->usersvc; -%my $svc_acct = ''; -%my $email = ''; -%if ( $usersvc ) { -% $svc_acct = qsearchs('svc_acct', { 'svcnum' => $usersvc } ) -% or die "svc_www: Unknown usersvc $usersvc"; -% $email = $svc_acct->email; -%} -% -%my $domain_record = qsearchs('domain_record', { 'recnum' => $svc_www->recnum } ) -% or die "svc_www: Unknown recnum ". $svc_www->recnum; -% -%my $www = $domain_record->zone; - <% include("/elements/header.html", "Website View", menubar( ( ( $custnum ) - ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + ? ( "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum", ) : ( "Cancel this (unaudited) website" => "${p}misc/cancel-unaudited.cgi?$svcnum" ) @@ -54,35 +8,97 @@ )) %> -%print qq!<A HREF="${p}edit/svc_www.cgi?$svcnum">Edit this information</A><BR>!. -% ntable("#cccccc"). '<TR><TD>'. ntable("#cccccc",2). -% qq!<TR><TD ALIGN="right">Service number</TD>!. -% qq!<TD BGCOLOR="#ffffff">$svcnum</TD></TR>!. -% qq!<TR><TD ALIGN="right">Website name</TD>!. -% qq!<TD BGCOLOR="#ffffff"><A HREF="http://$www">$www<A></TD></TR>!; -%if ( $part_svc->part_svc_column('usersvc')->columnflag ne 'F' -% || $part_svc->part_svc_column('usersvc')->columnvalue !~ /^\s*$/) { -% print qq!<TR><TD ALIGN="right">Account</TD>!. -% qq!<TD BGCOLOR="#ffffff">!; -% -% if ( $usersvc ) { -% print qq!<A HREF="${p}view/svc_acct.cgi?$usersvc">$email</A>!; -% } else { -% print '</i>(none)</i>'; -% } -% -% print '</TD></TR>'; -%} - <% qq!<TR><TD ALIGN="right">Config lines</TD>! %> - <% qq!<TD BGCOLOR="#ffffff"><pre>!.$cgi->escapeHTML(join("\n",$svc_www->config))."</pre></TD></TR>" %> -% -%foreach (sort { $a cmp $b } $svc_www->virtual_fields) { -% print $svc_www->pvf($_)->widget('HTML', 'view', $svc_www->getfield($_)), -% "\n"; -%} -% -% -%print '</TABLE></TD></TR></TABLE>'. -% '<BR>'. joblisting({'svcnum'=>$svcnum}, 1); +<A HREF="<% $p %>edit/svc_www.cgi?<% $svcnum %>">Edit this information</A><BR> + +<% ntable("#cccccc", 2) %> + + <TR> + <TD ALIGN="right">Service number</TD> + <TD BGCOLOR="#ffffff"><% $svcnum %></TD> + </TR> + <TR> + <TD ALIGN="right">Website name</TD> + <TD BGCOLOR="#ffffff"><A HREF="http://<% $www %>"><% $www %></A></TD> + </TR> + +% if ( $part_svc->part_svc_column('usersvc')->columnflag ne 'F' +% || $part_svc->part_svc_column('usersvc')->columnvalue !~ /^\s*$/) { + + <TR> + <TD ALIGN="right">Account</TD> + <TD BGCOLOR="#ffffff"> +% if ( $usersvc ) { + <A HREF="<% $p %>view/svc_acct.cgi?<% $usersvc %>"><% $email %></A> +% } else { + </i>(none)</i> +% } + </TD> + </TR> + +% } + + <TR> + <TD ALIGN="right">Config lines</TD> + <TD BGCOLOR="#ffffff"><PRE><% join("\n", $svc_www->config) |h %>"</PRE></TD> + </TR> + +% foreach (sort { $a cmp $b } $svc_www->virtual_fields) { + <% $svc_www->pvf($_)->widget('HTML', 'view', $svc_www->getfield($_)) %> +% } + +</TABLE> + +<BR> +<% joblisting({'svcnum'=>$svcnum}, 1) %> <% include('/elements/footer.html') %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('View customer services'); + +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +my $svcnum = $1; +my $svc_www = qsearchs({ + 'select' => 'svc_www.*', + 'table' => 'svc_www', + 'addl_from' => ' LEFT JOIN cust_svc USING ( svcnum ) '. + ' LEFT JOIN cust_pkg USING ( pkgnum ) '. + ' LEFT JOIN cust_main USING ( custnum ) ', + 'hashref' => { 'svcnum' => $svcnum }, + 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +}) or die "svc_www: Unknown svcnum $svcnum"; + +#false laziness w/all svc_*.cgi +my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } ); +my $pkgnum = $cust_svc->getfield('pkgnum'); +my($cust_pkg, $custnum, $display_custnum); +if ($pkgnum) { + $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); + $custnum = $cust_pkg->custnum; + $display_custnum = $cust_pkg->cust_main->display_custnum; +} else { + $cust_pkg = ''; + $custnum = ''; +} +#eofalse + +my $part_svc=qsearchs('part_svc',{'svcpart'=>$cust_svc->svcpart}) + or die "svc_www: Unknown svcpart" . $cust_svc->svcpart; + +my $usersvc = $svc_www->usersvc; +my $svc_acct = ''; +my $email = ''; +if ( $usersvc ) { + $svc_acct = qsearchs('svc_acct', { 'svcnum' => $usersvc } ) + or die "svc_www: Unknown usersvc $usersvc"; + $email = $svc_acct->email; +} + +my $domain_record = qsearchs('domain_record', { 'recnum' => $svc_www->recnum } ) + or die "svc_www: Unknown recnum ". $svc_www->recnum; + +my $www = $domain_record->zone; + +</%init> |