summaryrefslogtreecommitdiff
path: root/httemplate/view
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/view')
-rwxr-xr-xhttemplate/view/cust_main.cgi69
-rw-r--r--httemplate/view/cust_main/billing.html14
-rw-r--r--httemplate/view/cust_main/contacts.html2
-rw-r--r--httemplate/view/cust_main/misc.html30
-rwxr-xr-xhttemplate/view/cust_main/packages.html171
-rw-r--r--httemplate/view/cust_main/payment_history.html240
-rw-r--r--httemplate/view/cust_main/tickets.html46
-rw-r--r--httemplate/view/elements/svc_Common.html116
-rw-r--r--httemplate/view/svc_external.cgi1
-rw-r--r--httemplate/view/svc_phone.cgi10
10 files changed, 536 insertions, 163 deletions
diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
index 58f2925d5..8267fea51 100755
--- a/httemplate/view/cust_main.cgi
+++ b/httemplate/view/cust_main.cgi
@@ -1,23 +1,8 @@
-<!-- mason kludge -->
<%
my $conf = new FS::Conf;
-my %uiview = ();
-my %uiadd = ();
-foreach my $part_svc ( qsearch('part_svc',{}) ) {
- $uiview{$part_svc->svcpart} = $p. "view/". $part_svc->svcdb . ".cgi";
- $uiadd{$part_svc->svcpart}= $p. "edit/". $part_svc->svcdb . ".cgi";
-}
-
-%>
-
-<%= include("/elements/header.html","Customer View",
- include("/elements/menubar.html",
- 'Main Menu' => $p,
-)) %>
-
-<%
+my $curuser = $FS::CurrentUser::CurrentUser;
die "No customer specified (bad URL)!" unless $cgi->keywords;
my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
@@ -26,13 +11,19 @@ my $custnum = $1;
my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum});
die "Customer not found!" unless $cust_main;
-print qq!<A HREF="${p}edit/cust_main.cgi?$custnum">Edit this customer</A>!;
-
%>
+<%= include("/elements/header.html","Customer View: ". $cust_main->name ) %>
+
+<% if ( $curuser->access_right('Edit customer') ) { %>
+ <A HREF="<%= $p %>edit/cust_main.cgi?<%= $custnum %>">Edit this customer</A> |
+<% } %>
+
+
<SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_iframe.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_draggable.js"></SCRIPT>
+<SCRIPT TYPE="text/javascript" SRC="../elements/iframecontentmws.js"></SCRIPT>
<SCRIPT TYPE="text/javascript">
function areyousure(href, message) {
@@ -60,37 +51,36 @@ var confirm_cancel = '<FORM METHOD="POST" ACTION="<%= $p %>misc/cust_main-cancel
</SCRIPT>
-<% if ( $cust_main->ncancelled_pkgs ) { %>
+<% if ( $curuser->access_right('Cancel customer')
+ && $cust_main->ncancelled_pkgs
+ ) {
+%>
+ <A HREF="javascript:void(0);" onClick="overlib(confirm_cancel, CAPTION, 'Confirm cancellation', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, 128, TEXTSIZE, 3, BGCOLOR, '#ff0000', CGCOLOR, '#ff0000' ); return false; ">Cancel this customer</A> |
+<% } %>
- | <A HREF="javascript:void(0);" onClick="overlib(confirm_cancel, CAPTION, 'Confirm cancellation', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, 128, TEXTSIZE, 3, BGCOLOR, '#ff0000', CGCOLOR, '#ff0000' ); return false; ">Cancel this customer</A>
+<% if ( $conf->exists('deletecustomers')
+ && $curuser->access_right('Delete customer')
+ ) {
+%>
+ <A HREF="<%= $p %>misc/delete-customer.cgi?<%= $custnum%>">Delete this customer</A> |
<% } %>
-<%
-
-print qq! | <A HREF="${p}misc/delete-customer.cgi?$custnum">!.
- 'Delete this customer</A>'
- if $conf->exists('deletecustomers');
-unless ( $conf->exists('disable_customer_referrals') ) {
- print qq! | <A HREF="!, popurl(2),
- qq!edit/cust_main.cgi?referral_custnum=$custnum">!,
- qq!Refer a new customer</A>!;
+<% unless ( $conf->exists('disable_customer_referrals') ) { %>
+ <A HREF="<%= popurl(2) %>edit/cust_main.cgi?referral_custnum=<%= $custnum %>">Refer a new customer</A> |
+ <A HREF="<%= popurl(2) %>search/cust_main.cgi?referral_custnum=<%= $custnum %>">View this customer's referrals</A>
+<% } %>
- print qq! | <A HREF="!, popurl(2),
- qq!search/cust_main.cgi?referral_custnum=$custnum">!,
- qq!View this customer's referrals</A>!;
-}
-print '<BR><BR>';
+<BR><BR>
+<%
my $signupurl = $conf->config('signupurl');
if ( $signupurl ) {
-print "This customer's signup URL: ".
- "<a href=\"$signupurl?ref=$custnum\">$signupurl?ref=$custnum</a><BR><BR>";
-}
-
%>
+ This customer's signup URL: <A HREF="<%= $signupurl %>?ref=<%= $custnum %>"><%= $signupurl %>?ref=<%= $custnum %></A><BR><BR>
+<% } %>
<A NAME="cust_main"></A>
<TABLE BORDER=0>
@@ -135,5 +125,4 @@ Comments
<%= include('cust_main/payment_history.html', $cust_main ) %>
<% } %>
-</BODY></HTML>
-
+<%= include('/elements/footer.html') %>
diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html
index 895814cc2..191d3092f 100644
--- a/httemplate/view/cust_main/billing.html
+++ b/httemplate/view/cust_main/billing.html
@@ -1,12 +1,24 @@
<%
my( $cust_main ) = @_;
my @invoicing_list = $cust_main->invoicing_list;
+ my $conf = new FS::Conf;
+ my $money_char = $conf->config('money_char') || '$';
%>
Billing information
(<A HREF="<%= $p %>misc/bill.cgi?<%= $cust_main->custnum %>">Bill now</A>)
<%= ntable("#cccccc") %><TR><TD><%= ntable("#cccccc",2) %>
+<%
+( my $balance = $cust_main->balance )
+ =~ s/^(\-?)(.*)$/<FONT SIZE=+1>$1<\/FONT>$money_char$2/;
+%>
+
+<TR>
+ <TD ALIGN="right">Balance due</TD>
+ <TD BGCOLOR="#ffffff"><B><%= $balance %></B></TD>
+</TR>
+
<TR>
<TD ALIGN="right">Billing&nbsp;type</TD>
<TD BGCOLOR="#ffffff">
@@ -159,7 +171,7 @@ if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
<%= join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || 'no' %>
</TD>
</TR>
-<% my $conf = new FS::Conf; if ( $conf->exists('voip-cust_cdr_spools') ) { %>
+<% if ( $conf->exists('voip-cust_cdr_spools') ) { %>
<TR>
<TD ALIGN="right">Spool&nbsp;CDRs</TD>
<TD BGCOLOR="#ffffff"><%= $cust_main->spool_cdr ? 'yes' : 'no' %></TD>
diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html
index 7aba11813..48371550b 100644
--- a/httemplate/view/cust_main/contacts.html
+++ b/httemplate/view/cust_main/contacts.html
@@ -114,7 +114,7 @@ Service address
</TR>
<TR>
<TD ALIGN="right">Country</TD>
- <TD BGCOLOR="#ffffff"><%= $cust_main->get("${pre}country") %></TD>
+ <TD BGCOLOR="#ffffff"><%= code2country( $cust_main->get("${pre}country") ) %></TD>
</TR>
<TR>
<TD ALIGN="right"><%= $daytime_label %></TD>
diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html
index 69e120573..f06a4fbd2 100644
--- a/httemplate/view/cust_main/misc.html
+++ b/httemplate/view/cust_main/misc.html
@@ -1,13 +1,20 @@
<%
my( $cust_main ) = @_;
+ my $conf = new FS::Conf;
%>
<%= ntable("#cccccc") %><TR><TD><%= &ntable("#cccccc",2) %>
+
<TR>
<TD ALIGN="right">Customer&nbsp;number</TD>
<TD BGCOLOR="#ffffff"><%= $cust_main->custnum %></TD>
</TR>
+<TR>
+ <TD ALIGN="right">Status</TD>
+ <TD BGCOLOR="#ffffff"><FONT COLOR="#<%= $cust_main->statuscolor %>"><B><%= ucfirst($cust_main->status) %></B></FONT></TD>
+</TR>
+
<%
my @agents = qsearch( 'agent', {} );
my $agent;
@@ -25,8 +32,18 @@
$agent = $agents[0];
}
- my @referrals = qsearch( 'part_referral', {} );
- unless ( scalar(@referrals) == 1 ) {
+ if ( $cust_main->agent_custid ) {
+%>
+
+<TR>
+ <TD ALIGN="right">Agent customer ref#</TD>
+ <TD BGCOLOR="#ffffff"><%= $cust_main->agent_custid %></TD>
+</TR>
+
+<%
+ }
+
+ unless ( FS::part_referral->num_part_referral == 1 ) {
my $referral = qsearchs('part_referral', {
'refnum' => $cust_main->refnum
} );
@@ -40,10 +57,6 @@
<% } %>
<TR>
- <TD ALIGN="right">Order taker</TD>
- <TD BGCOLOR="#ffffff"><%= $cust_main->otaker %></TD>
-</TR>
-<TR>
<TD ALIGN="right">Referring&nbsp;Customer</TD>
<TD BGCOLOR="#ffffff">
@@ -71,5 +84,10 @@
</TD>
</TR>
+<TR>
+ <TD ALIGN="right">Order taker</TD>
+ <TD BGCOLOR="#ffffff"><%= $cust_main->otaker %></TD>
+</TR>
+
</TABLE></TD></TR></TABLE>
diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html
index 32e0ee1fc..9cd1e284f 100755
--- a/httemplate/view/cust_main/packages.html
+++ b/httemplate/view/cust_main/packages.html
@@ -2,22 +2,28 @@
my( $cust_main ) = @_;
my $conf = new FS::Conf;
+ my $curuser = $FS::CurrentUser::CurrentUser;
+
my $packages = get_packages($cust_main, $conf);
%>
-<STYLE TYPE="text/css">
-.package .provision { font-weight: bold }
-</STYLE>
-
<A NAME="cust_pkg"><FONT SIZE="+2">Packages</FONT></A>
-<%= include('order_pkg.html', $cust_main ) %>
+<% if ( $curuser->access_right('Order customer package') ) { %>
+ <%= include('order_pkg.html', $cust_main ) %>
+<% } %>
-<% if ( $conf->config('payby-default') ne 'HIDE' ) { %>
+<% if ( $curuser->access_right('One-time charge')
+ && $conf->config('payby-default') ne 'HIDE'
+ ) {
+%>
<%= include('quick-charge.html', $cust_main ) %>
<% } %>
-<A HREF="<%= $p %>edit/cust_pkg.cgi?<%= $cust_main->custnum %>">Bulk order and cancel packages</A> (preserves services)
+<% if ( $curuser->access_right('Bulk change customer packages') ) { %>
+ <A HREF="<%= $p %>edit/cust_pkg.cgi?<%= $cust_main->custnum %>">Bulk order and cancel packages</A> (preserves services)
+<% } %>
+
<BR><BR>
<% if ( @$packages ) { %>
@@ -44,39 +50,51 @@ Current packages
<% if ( @$packages ) { %>
-<TABLE CLASS="package" BORDER=1 CELLSPACING=0 CELLPADDING=2 BORDERCOLOR="#999999">
+<%= include('/elements/table-grid.html') %>
+
+<% my $bgcolor1 = '#eeeeee';
+ my $bgcolor2 = '#ffffff';
+ my $bgcolor = '';
+%>
+
<TR>
- <TH>Package</TH>
- <TH>Status</TH>
- <TH COLSPAN=2>Services</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Package</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Status</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Services</TH>
</TR>
<%
foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) {
- my $rowspan = 0;
- if ($pkg->{cancel}) {
- $rowspan = 0;
+ if ( $bgcolor eq $bgcolor1 ) {
+ $bgcolor = $bgcolor2;
} else {
- foreach my $svcpart (@{$pkg->{svcparts}}) {
- $rowspan += $svcpart->{count};
- $rowspan++ if ($svcpart->{count} < $svcpart->{quantity});
- }
- }
+ $bgcolor = $bgcolor1;
+ }
+
%>
<!--pkgnum: <%=$pkg->{pkgnum}%>-->
<TR>
- <TD ROWSPAN=<%= $rowspan || 1 %>>
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>">
<A NAME="cust_pkg<%=$pkg->{pkgnum}%>"><%=$pkg->{pkgnum}%></A>:
<%=$pkg->{pkg}%> - <%=$pkg->{comment}%><BR>
-<% unless ($pkg->{cancel}) { %>
- (&nbsp;<%=pkg_change_link($pkg)%>&nbsp;)
- (&nbsp;<%=pkg_dates_link($pkg)%>&nbsp;|&nbsp;<%=pkg_customize_link($pkg,$cust_main->custnum)%>&nbsp;)
-<% } %>
+ <FONT SIZE=-1>
+ <% unless ( $pkg->{cancel} ) { %>
+ <% if ( $curuser->access_right('Change customer package') ) { %>
+ (&nbsp;<%=pkg_change_link($pkg)%>&nbsp;)
+ <% } %>
+ <% if ( $curuser->access_right('Edit customer package dates') ) { %>
+ (&nbsp;<%=pkg_dates_link($pkg)%>&nbsp;)
+ <% } %>
+ <% if ( $curuser->access_right('Customize customer package') ) { %>
+ (&nbsp;<%=pkg_customize_link($pkg,$cust_main->custnum)%>&nbsp;)
+ <% } %>
+ <% } %>
+ </FONT>
</TD>
- <TD ROWSPAN=<%= $rowspan || 1 %>>
- <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
+ <TD CLASS="inv" BGCOLOR="<%= $bgcolor %>">
+ <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
<%
sub myfreq {
@@ -182,7 +200,16 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) {
<% } %>
<TR>
- <TD COLSPAN=<%=$colspan%>>(&nbsp;<%= pkg_unsuspend_link($pkg) %>&nbsp;|&nbsp;<%= pkg_cancel_link($pkg) %>&nbsp;)</TD>
+ <TD COLSPAN=<%=$colspan%>>
+ <FONT SIZE=-1>
+ <% if ( $curuser->access_right('Unsuspend customer package') ) { %>
+ (&nbsp;<%= pkg_unsuspend_link($pkg) %>&nbsp;)
+ <% } %>
+ <% if ( $curuser->access_right('Cancel customer package') ) { %>
+ (&nbsp;<%= pkg_cancel_link($pkg) %>&nbsp;)
+ <% } %>
+ </FONT>
+ </TD>
</TR>
<% } else { %> <!-- #status: active -->
@@ -196,7 +223,13 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) {
</TR>
<TR>
- <TD COLSPAN=<%=$colspan%>>(&nbsp;<%= pkg_cancel_link($pkg) %>&nbsp;)</TD>
+ <TD COLSPAN=<%=$colspan%>>
+ <FONT SIZE=-1>
+ <% if ( $curuser->access_right('Cancel customer package immediately') ) { %>
+ (&nbsp;<%= pkg_cancel_link($pkg) %>&nbsp;)
+ <% } %>
+ </FONT>
+ </TD>
</TR>
<% } else { %>
@@ -258,7 +291,19 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) {
<% if ( $pkg->{freq} ) { %>
<TR>
- <TD COLSPAN=<%=$colspan%>>(&nbsp;<%= pkg_suspend_link($pkg) %>&nbsp;|&nbsp;<%= pkg_cancel_link($pkg) %>&nbsp;)</TD>
+ <TD COLSPAN=<%=$colspan%>>
+ <FONT SIZE=-1>
+ <% if ( $curuser->access_right('Suspend customer package') ) { %>
+ (&nbsp;<%= pkg_suspend_link($pkg) %>&nbsp;)
+ <% } %>
+ <% if ( $curuser->access_right('Cancel customer package immediately') ) { %>
+ (&nbsp;<%= pkg_cancel_link($pkg) %>&nbsp;)
+ <% } %>
+ <% if ( $curuser->access_right('Cancel customer package later') ) { %>
+ (&nbsp;<%= pkg_expire_link($pkg) %>&nbsp;)
+ <% } %>
+ <FONT>
+ </TD>
</TR>
<% } %>
@@ -269,30 +314,51 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) {
</TABLE>
</TD>
-<%
- if ($rowspan == 0) { print qq!</TR>\n!; next; }
+<TD CLASS="inv" BGCOLOR="<%= $bgcolor %>">
+ <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
+
- my $cnt = 0;
+<%
foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) {
foreach my $service (@{$svcpart->{services}}) {
- print '<TR>' if ($cnt > 0);
%>
- <TD><%=svc_link($svcpart,$service)%></TD>
- <TD><%=svc_label_link($svcpart,$service)%><BR>(&nbsp;<%=svc_unprovision_link($service)%>&nbsp;)</TD>
-</TR>
-<%
- $cnt++;
- }
- if ($svcpart->{count} < $svcpart->{quantity}) {
- print qq!<TR>\n! if ($cnt > 0);
- print qq! <TD COLSPAN=2>!.svc_provision_link($pkg, $svcpart, $conf).qq!</TD>\n</TR>\n!;
- }
- }
-}
-#end display packages
+ <TR>
+ <TD ALIGN="right" VALIGN="top" ROWSPAN=2><%=svc_link($svcpart,$service)%></TD>
+ <TD STYLE="padding-bottom:0px"><B><%=svc_label_link($svcpart,$service)%></B></TD>
+ </TR>
+
+ <% if ( $curuser->access_right('Unprovision customer service') ) { %>
+ <TR>
+ <TD ALIGN="right" VALIGN="top" STYLE="padding-bottom:5px;padding-top:0px"><FONT SIZE="-2">(&nbsp;<%=svc_unprovision_link($service)%>&nbsp;)</FONT></TD>
+ </TR>
+ <% } %>
+
+ <% } %>
+
+ <% if ( $curuser->access_right('Provision customer service')
+ && $svcpart->{count} < $svcpart->{quantity}
+ )
+ {
+ %>
+
+ <TR>
+ <TD COLSPAN=2 ALIGN="center" STYLE="padding-bottom:4px;padding-top:0px">
+ <B><%= svc_provision_link($pkg, $svcpart, $conf, $curuser) %></B>
+ </TD>
+ </TR>
+
+ <% } %>
+
+<% } %>
+
+</TABLE>
+</TD>
+
+<% } #end display packages
%>
</TABLE>
+
<% } else { %>
<BR>
<% } %>
@@ -393,7 +459,7 @@ sub svc_label_link {
}
sub svc_provision_link {
- my ($pkg, $svcpart, $conf) = @_;
+ my ($pkg, $svcpart, $conf, $curuser) = @_;
( my $svc_nbsp = $svcpart->{svc} ) =~ s/\s+/&nbsp;/g;
my $num_left = $svcpart->{quantity} - $svcpart->{count};
my $pkgnum_svcpart = "pkgnum$pkg->{pkgnum}-svcpart$svcpart->{svcpart}";
@@ -411,7 +477,10 @@ sub svc_provision_link {
my $link = qq!<A CLASS="provision" HREF="$url">!.
"Provision&nbsp;$svc_nbsp&nbsp;($num_left)</A>";
- if ( $conf->exists('legacy_link') ) {
+ if ( $conf->exists('legacy_link')
+ && $curuser->access_right('View/link unlinked services')
+ )
+ {
$link .= '<BR>'.
qq!<A CLASS="provision" HREF="${p}misc/link.cgi?!.
qq!$pkgnum_svcpart">!.
@@ -475,7 +544,11 @@ sub pkg_cancel_link {
my $pkg = shift or return '';
qq!<A HREF="javascript:areyousure('${p}misc/cancel_pkg.cgi?$pkg->{pkgnum}', !.
qq!'Permanently delete included services and cancel this package?')">!.
- qq!Cancel now</A> | !.
+ qq!Cancel now</A>!;
+}
+
+sub pkg_expire_link {
+ my $pkg = shift or return '';
qq!<A HREF="${p}misc/expire_pkg.cgi?$pkg->{pkgnum}">Cancel later</A>!;
}
diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html
index f0cd993ff..aef5fb8f8 100644
--- a/httemplate/view/cust_main/payment_history.html
+++ b/httemplate/view/cust_main/payment_history.html
@@ -4,6 +4,8 @@
my $conf = new FS::Conf;
+ my $curuser = $FS::CurrentUser::CurrentUser;
+
my @payby = grep /\w/, $conf->config('payby');
#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP ))
@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP ))
@@ -16,53 +18,63 @@
<BR><BR><A NAME="history"><FONT SIZE="+2">Payment History</FONT></A><BR>
-<% if ( $payby{'BILL'} ) { %>
+<% if ( $payby{'BILL'} && $curuser->access_right('Post payment') ) { %>
<%= $s++ ? ' | ' : '' %>
- <A HREF="<%= $p %>edit/cust_pay.cgi?payby=BILL;custnum=<%= $custnum %>">Post check payment</A>
+ <A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('<%= $p %>edit/cust_pay.cgi?popup=1;payby=BILL;custnum=<%= $custnum %>', 392, 336, 'cust_pay_popup' ), CAPTION, 'Enter check payment', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">Enter check payment</A>
<% } %>
-<% if ( $payby{'CASH'} ) { %>
+<% if ( $payby{'CASH'} && $curuser->access_right('Post payment') ) { %>
<%= $s++ ? ' | ' : '' %>
- <A HREF="<%= $p %>edit/cust_pay.cgi?payby=CASH;custnum=<%= $custnum %>">Post cash payment</A>
+ <A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('<%= $p %>edit/cust_pay.cgi?popup=1;payby=CASH;custnum=<%= $custnum %>', 392, 336, 'cust_pay_popup' ), CAPTION, 'Enter cash payment', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">Enter cash payment</A>
<% } %>
-<% if ( $payby{'WEST'} ) { %>
+<% if ( $payby{'WEST'} && $curuser->access_right('Post payment') ) { %>
<%= $s++ ? ' | ' : '' %>
- <A HREF="<%= $p %>edit/cust_pay.cgi?payby=WEST;custnum=<%= $custnum %>">Post Western Union payment</A>
+ <A HREF="<%= $p %>edit/cust_pay.cgi?payby=WEST;custnum=<%= $custnum %>">Enter Western Union payment</A>
<% } %>
-<% if ( $payby{'CARD'} || $payby{'DCRD'} ) { %>
+<% if ( ( $payby{'CARD'} || $payby{'DCRD'} )
+ && $curuser->access_right('Process payment')
+ ) {
+%>
<%= $s++ ? ' | ' : '' %>
<A HREF="<%= $p %>misc/payment.cgi?payby=CARD;custnum=<%= $custnum %>">Process credit card payment</A>
<% } %>
-<% if ( $payby{'CHEK'} || $payby{'DCHK'} ) { %>
+<% if ( ( $payby{'CHEK'} || $payby{'DCHK'} )
+ && $curuser->access_right('Process payment')
+ ) {
+%>
<%= $s++ ? ' | ' : '' %>
<A HREF="<%= $p %>misc/payment.cgi?payby=CHEK;custnum=<%= $custnum %>">Process electronic check (ACH) payment</A>
<% } %>
-<% if ( $payby{'MCRD'} ) { %>
+<% if ( $payby{'MCRD'} && $curuser->access_right('Post payment') ) { %>
<%= $s++ ? ' | ' : '' %>
- <A HREF="<%= $p %>edit/cust_pay.cgi?payby=MCRD;custnum=<%= $custnum %>">Post manual credit card payment</A>
+ <A HREF="<%= $p %>edit/cust_pay.cgi?payby=MCRD;custnum=<%= $custnum %>">Post manual (offline) credit card payment</A>
<% } %>
<BR>
-<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('<%= $p %>edit/cust_credit.cgi?<%= $custnum %>', 392, 336, 'cust_credit_popup' ), CAPTION, 'Post credit', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK )">Post credit</A>
+<% if ( $curuser->access_right('Post credit') ) { %>
-<BR>
+ <A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('<%= $p %>edit/cust_credit.cgi?<%= $custnum %>', 392, 336, 'cust_credit_popup' ), CAPTION, 'Enter credit', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">Enter credit</A>
+
+ <BR>
+
+<% } %>
<%
#get payment history
@@ -75,11 +87,14 @@ foreach my $cust_bill ($cust_main->cust_bill) {
: '';
my $post = ( $cust_bill->owed > 0 ) ? '</FONT></B>' : '';
my $invnum = $cust_bill->invnum;
+ my $link = $curuser->access_right('View invoices')
+ ? qq!<A HREF="${p}view/cust_bill.cgi?$invnum">!
+ : '';
push @history, {
'date' => $cust_bill->_date,
- 'desc' => qq!<A HREF="${p}view/cust_bill.cgi?$invnum">!. $pre.
+ 'desc' => $link. $pre.
"Invoice #$invnum (Balance \$". $cust_bill->owed. ')'.
- $post. '</A>',
+ $post. ( $link ? '</A>' : '' ),
'charge' => $cust_bill->charged,
};
}
@@ -120,7 +135,7 @@ foreach my $cust_pay ($cust_main->cust_pay) {
$post = '</FONT></B>';
$apply = qq! (<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('${p}edit/cust_bill_pay.cgi?!.
$cust_pay->paynum.
- qq!', 392, 336, 'cust_credit_popup' ), CAPTION, 'Post credit', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK )">apply</A>)!;
+ qq!', 392, 336, 'cust_bill_pay_popup' ), CAPTION, 'Apply payment', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">apply</A>)!;
} elsif ( scalar(@cust_bill_pay) == 1
&& scalar(@cust_pay_refund) == 0
@@ -146,7 +161,7 @@ foreach my $cust_pay ($cust_main->cust_pay) {
} elsif ( $app->isa('FS::cust_pay_refund') ) {
$desc .= '&nbsp;&nbsp;'.
'$'. $app->amount.
- ' refunded on'. time2str("%D", $app->_date).
+ ' refunded on '. time2str("%D", $app->_date).
'<BR>';
} else {
die "$app is not a FS::cust_bill_pay or FS::cust_pay_refund";
@@ -158,7 +173,7 @@ foreach my $cust_pay ($cust_main->cust_pay) {
$cust_pay->unapplied. ' unapplied</FONT></B>'.
qq! (<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('${p}edit/cust_bill_pay.cgi?!.
$cust_pay->paynum.
- qq!', 392, 336, 'cust_credit_popup' ), CAPTION, 'Post credit', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK )">apply</A>)!.
+ qq!', 392, 336, 'cust_bill_pay_popup' ), CAPTION, 'Apply payment', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">apply</A>)!.
'<BR>';
}
}
@@ -169,6 +184,7 @@ foreach my $cust_pay ($cust_main->cust_pay) {
&& $cust_pay->payby =~ /^(CARD|CHEK)$/
&& time-$cust_pay->_date < $refund_days*86400
&& $cust_pay->unrefunded > 0
+ && $curuser->access_right('Refund payment')
) {
$refund = qq! (<A HREF="${p}edit/cust_refund.cgi?payby=$1;!.
qq!paynum=!. $cust_pay->paynum. '"'.
@@ -178,9 +194,18 @@ foreach my $cust_pay ($cust_main->cust_pay) {
my $void = '';
if ( $cust_pay->closed !~ /^Y/i
- && ( $cust_pay->payby ne 'CARD' || $conf->exists('cc-void') )
- && ( $cust_pay->payby ne 'CHEK' || $conf->exists('echeck-void') )
- ) {
+ && ( ( $cust_pay->payby eq 'CARD'
+ && $curuser->access_right('Credit card void')
+ )
+ || ( $cust_pay->payby eq 'CHEK'
+ && $curuser->access_right('Echeck void')
+ )
+ || ( $cust_pay->payby !~ /^(CARD|CHEK)$/
+ && $curuser->access_right('Regular void')
+ )
+ )
+ )
+ {
$void = qq! (<A HREF="javascript:areyousure('!.
qq!${p}misc/void-cust_pay.cgi?!. $cust_pay->paynum.
qq!', 'Are you sure you want to void this payment?')"!.
@@ -193,7 +218,11 @@ foreach my $cust_pay ($cust_main->cust_pay) {
}
my $delete = '';
- if ( $cust_pay->closed !~ /^Y/i && $conf->exists('deletepayments') ) {
+ if ( $cust_pay->closed !~ /^Y/i
+ && $conf->exists('deletepayments')
+ && $curuser->access_right('Delete payment')
+ )
+ {
$delete = qq! (<A HREF="javascript:areyousure('!.
qq!${p}misc/delete-cust_pay.cgi?!. $cust_pay->paynum.
qq!', 'Are you sure you want to delete this payment?')"!.
@@ -203,8 +232,10 @@ foreach my $cust_pay ($cust_main->cust_pay) {
my $unapply = '';
if ( $cust_pay->closed !~ /^Y/i
- && $conf->exists('unapplypayments')
- && scalar(@cust_bill_pay) ) {
+ && scalar(@cust_bill_pay)
+ && $curuser->access_right('Unapply payment')
+ )
+ {
$unapply = qq! (<A HREF="javascript:areyousure('!.
qq!${p}misc/unapply-cust_pay.cgi?!. $cust_pay->paynum.
qq!', 'Are you sure you want to unapply this payment?')"!.
@@ -236,7 +267,10 @@ foreach my $cust_pay_void ($cust_main->cust_pay_void) {
my $info = $payby ? " ($payby$payinfo)" : '';
my $unvoid = '';
- if ( $cust_pay_void->closed !~ /^Y/i && $conf->exists('unvoid') ) {
+ if ( $cust_pay_void->closed !~ /^Y/i
+ && $curuser->access_right('Unvoid')
+ )
+ {
$unvoid = qq! (<A HREF="javascript:areyousure('!.
qq!${p}misc/unvoid-cust_pay_void.cgi?!. $cust_pay_void->paynum.
qq!', 'Are you sure you want to unvoid this payment?')"!.
@@ -272,7 +306,7 @@ foreach my $cust_credit ($cust_main->cust_credit) {
$post = '</FONT></B>';
$apply = qq! (<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('${p}edit/cust_credit_bill.cgi?!.
$cust_credit->crednum.
- qq!', 392, 336, 'cust_credit_popup' ), CAPTION, 'Post credit', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK )">apply</A>)!;
+ qq!', 392, 336, 'cust_credit_bill_popup' ), CAPTION, 'Apply credit', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">apply</A>)!;
} elsif ( scalar(@cust_credit_bill) == 1
&& scalar(@cust_credit_refund) == 0
&& $cust_credit->credited == 0 ) {
@@ -297,7 +331,7 @@ foreach my $cust_credit ($cust_main->cust_credit) {
} elsif ( $app->isa('FS::cust_credit_refund') ) {
$desc .= '&nbsp;&nbsp;'.
'$'. $app->amount.
- ' refunded on'. time2str("%D", $app->_date).
+ ' refunded on '. time2str("%D", $app->_date).
'<BR>';
} else {
die "$app is not a FS::cust_credit_bill or a FS::cust_credit_refund";
@@ -308,13 +342,21 @@ foreach my $cust_credit ($cust_main->cust_credit) {
$cust_credit->credited. ' unapplied</FONT></B>'.
qq! (<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('${p}edit/cust_credit_bill.cgi?!.
$cust_credit->crednum.
- qq!', 392, 336, 'cust_credit_popup' ), CAPTION, 'Post credit', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK )">apply</A>)!.
+ qq!', 392, 336, 'cust_credit_bill_popup' ), CAPTION, 'Apply credit', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">apply</A>)!.
'<BR>';
}
}
#
my $delete = '';
- if ( $cust_credit->closed !~ /^Y/i && $conf->exists('deletecredits') ) {
+ if ( $cust_credit->closed !~ /^Y/i
+
+ #s'pose deleting a credit isn't bad like deleting a payment
+ # and this needs to be generally available until we have credit voiding..
+ #&& $conf->exists('deletecredits')
+
+ && $curuser->access_right('Delete credit')
+ )
+ {
$delete = qq! (<A HREF="javascript:areyousure('!.
qq!${p}misc/delete-cust_credit.cgi?!. $cust_credit->crednum.
qq!', 'Are you sure you want to delete this credit?')">!.
@@ -323,8 +365,10 @@ foreach my $cust_credit ($cust_main->cust_credit) {
my $unapply = '';
if ( $cust_credit->closed !~ /^Y/i
- && $conf->exists('unapplycredits')
- && scalar(@cust_credit_bill) ) {
+ && scalar(@cust_credit_bill)
+ && $curuser->access_right('Unapply credit')
+ )
+ {
$unapply = qq! (<A HREF="javascript:areyousure('!.
qq!${p}misc/unapply-cust_credit.cgi?!. $cust_credit->crednum.
qq!', 'Are you sure you want to unapply this credit?')">!.
@@ -366,37 +410,98 @@ foreach my $cust_refund ($cust_main->cust_refund) {
%>
-<%= include("/elements/table.html") %>
+<%= include("/elements/table-grid.html") %>
+
+<% my $bgcolor1 = '#eeeeee';
+ my $bgcolor2 = '#ffffff';
+ my $bgcolor = '';
+%>
+
<TR>
- <TH>Date</TH>
- <TH>Description</TH>
- <TH><FONT SIZE=-1>Charge</FONT></TH>
- <TH><FONT SIZE=-1>Payment</FONT></TH>
- <TH><FONT SIZE=-1>In-house<BR>Credit</FONT></TH>
- <TH><FONT SIZE=-1>Refund</FONT></TH>
- <TH><FONT SIZE=-1>Balance</FONT></TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Date</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Description</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Charge</FONT></TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Payment</FONT></TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>In-house<BR>Credit</FONT></TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Refund</FONT></TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Balance</FONT></TH>
</TR>
<%
#display payment history
-my %target;
my $balance = 0;
+my %target = ();
+my $money_char = $conf->config('money_char') || '$';
+
+my $years = $conf->config('payment_history-years') || 2;
+my $older_than = time - $years * 31556736; #60*60*24*365.24
+my $hidden = 0;
+my $seen = 0;
+my $old_history = 0;
+
foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) {
+ my $display;
+ if ( $item->{'date'} < $older_than ) {
+ $display = ' STYLE="display:none" ';
+ $hidden = 1;
+ } else {
+
+ $display = '';
+
+ if ( $hidden && ! $seen++ ) {
+ ( my $balance_forward = $money_char. $balance ) =~ s/^\$\-/-&nbsp;\$/;
+ %>
+
+ <TR ID="balance_forward_row">
+ <TD CLASS="grid" BGCOLOR="#dddddd">
+ <%= time2str("%D",$item->{'date'}) %>
+ </TD>
+
+ <TD CLASS="grid" BGCOLOR="#dddddd">
+ <I>Starting balance on <%= time2str("%D",$item->{'date'}) %></I>
+ (<A HREF="javascript:void(0);" onClick="show_history();">show prior history</A>)
+ </TD>
+
+ <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
+ <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
+ <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
+ <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
+ <TD CLASS="grid" BGCOLOR="#dddddd"><I><%= $balance_forward %></I></TD>
+
+ </TR>
+
+ <%
+ }
+
+ }
+
+ if ( $bgcolor eq $bgcolor1 ) {
+ $bgcolor = $bgcolor2;
+ } else {
+ $bgcolor = $bgcolor1;
+ }
+
my $charge = exists($item->{'charge'})
- ? sprintf('$%.2f', $item->{'charge'})
+ ? sprintf("$money_char\%.2f", $item->{'charge'})
: '';
+
my $payment = exists($item->{'payment'})
- ? sprintf('-&nbsp;$%.2f', $item->{'payment'})
+ ? sprintf("-&nbsp;$money_char\%.2f", $item->{'payment'})
: '';
- $payment ||= sprintf('<DEL>-&nbsp;$%.2f</DEL>', $item->{'void_payment'})
+
+ $payment ||= sprintf( "<DEL>-&nbsp;$money_char\%.2f</DEL>",
+ $item->{'void_payment'}
+ )
if exists($item->{'void_payment'});
+
my $credit = exists($item->{'credit'})
- ? sprintf('-&nbsp;$%.2f', $item->{'credit'})
+ ? sprintf("-&nbsp;$money_char\%.2f", $item->{'credit'})
: '';
+
my $refund = exists($item->{'refund'})
- ? sprintf('$%.2f', $item->{'refund'})
+ ? sprintf("$money_char\%.2f", $item->{'refund'})
: '';
my $target = exists($item->{'target'}) ? $item->{'target'} : '';
@@ -407,12 +512,12 @@ foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) {
$balance += $item->{'refund'} if exists $item->{'refund'};
$balance = sprintf("%.2f", $balance);
$balance =~ s/^\-0\.00$/0.00/; #yay ieee fp
- ( my $showbalance = '$'. $balance ) =~ s/^\$\-/-&nbsp;\$/;
+ ( my $showbalance = $money_char. $balance ) =~ s/^\$\-/-&nbsp;\$/;
%>
- <TR>
- <TD>
+ <TR <%= $display ? $display.' ID="old_history'.$old_history++.'"' : ''%>>
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>">
<% unless ( !$target || $target{$target}++ ) { %>
<A NAME="<%= $target %>">
<% } %>
@@ -422,15 +527,44 @@ foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) {
<% } %>
</FONT>
</TD>
- <TD><%= $item->{'desc'} %></TD>
- <TD ALIGN="right"><%= $charge %></TD>
- <TD ALIGN="right"><%= $payment %></TD>
- <TD ALIGN="right"><%= $credit %></TD>
- <TD ALIGN="right"><%= $refund %></TD>
- <TD ALIGN="right"><%= $showbalance %></TD>
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>">
+ <%= $item->{'desc'} %>
+ </TD>
+ <TD ALIGN="right" CLASS="grid" BGCOLOR="<%= $bgcolor %>">
+ <%= $charge %>
+ </TD>
+ <TD ALIGN="right" CLASS="grid" BGCOLOR="<%= $bgcolor %>">
+ <%= $payment %>
+ </TD>
+ <TD ALIGN="right" CLASS="grid" BGCOLOR="<%= $bgcolor %>">
+ <%= $credit %>
+ </TD>
+ <TD ALIGN="right" CLASS="grid" BGCOLOR="<%= $bgcolor %>">
+ <%= $refund %>
+ </TD>
+ <TD ALIGN="right" CLASS="grid" BGCOLOR="<%= $bgcolor %>">
+ <%= $showbalance %>
+ </TD>
</TR>
<% } %>
</TABLE>
+<SCRIPT TYPE="text/javascript">
+
+function show_history () {
+ //alert('showing history!');
+
+ var balance_forward_row = document.getElementById('balance_forward_row');
+
+ balance_forward_row.style.display = 'none';
+ for ( var i = 0; i < <%= $old_history %>; i++ ) {
+ var oldRow = document.getElementById('old_history'+i);
+ oldRow.style.display = '';
+ }
+
+}
+
+</SCRIPT>
+
diff --git a/httemplate/view/cust_main/tickets.html b/httemplate/view/cust_main/tickets.html
index 5c1d94ee1..93cb51f25 100644
--- a/httemplate/view/cust_main/tickets.html
+++ b/httemplate/view/cust_main/tickets.html
@@ -2,7 +2,7 @@
my( $cust_main ) = @_;
my $conf = new FS::Conf;
- my $num = 10;
+ my $num = $conf->config('cust_main-max_tickets') || 10;
my @tickets = ();
unless ( $conf->config('ticket_system-custom_priority_field') ) {
@@ -31,24 +31,46 @@
Highest priority tickets
(<A HREF="<%= FS::TicketSystem->href_customer_tickets($cust_main->custnum) %>">View all tickets for this customer</A>)
(<A HREF="<%= FS::TicketSystem->href_new_ticket($cust_main, join(', ', grep { $_ !~ /^(POST|FAX)$/ } $cust_main->invoicing_list ) ) %>">New ticket for this customer</A>)
-<%= include("/elements/table.html") %>
+
+<%= include("/elements/table-grid.html") %>
+
+<% my $bgcolor1 = '#eeeeee';
+ my $bgcolor2 = '#ffffff';
+ my $bgcolor = '';
+%>
+
<TR>
- <TH>#</TH>
- <TH>Subject</TH>
- <TH>Priority</TH>
- <TH>Queue</TH>
- <TH>Status</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">#</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Subject</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Priority</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Queue</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Status</TH>
</TR>
+
<% foreach my $ticket ( @tickets ) {
my $href = FS::TicketSystem->href_ticket($ticket->{id});
+ if ( $bgcolor eq $bgcolor1 ) {
+ $bgcolor = $bgcolor2;
+ } else {
+ $bgcolor = $bgcolor1;
+ }
%>
+
<TR>
- <TD><A HREF=<%=$href%>><%= $ticket->{id} %></A></TD>
- <TD><A HREF=<%=$href%>><%= $ticket->{subject} %></A></TD>
- <TD ALIGN="right"><%= $ticket->{content} || $ticket->{priority} %></TD>
- <TD><%= $ticket->{name} %></TD>
- <TD><%= $ticket->{status} %></TD>
+
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><A HREF=<%=$href%>><%= $ticket->{id} %></A></TD>
+
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><A HREF=<%=$href%>><%= $ticket->{subject} %></A></TD>
+
+ <TD ALIGN="right" CLASS="grid" BGCOLOR="<%= $bgcolor %>"><%= $ticket->{content} || $ticket->{priority} %></TD>
+
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><%= $ticket->{name} %></TD>
+
+ <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><%= $ticket->{status} %></TD>
+
</TR>
+
<% } %>
+
</TABLE>
diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html
new file mode 100644
index 000000000..0f103e3e0
--- /dev/null
+++ b/httemplate/view/elements/svc_Common.html
@@ -0,0 +1,116 @@
+<%
+
+ # options example...
+ #
+ # 'table' => 'svc_something'
+ #
+ # 'labels' => {
+ # 'column' => 'Label',
+ # },
+ #
+ # listref - each item is a literal column name (or method) or (notyet) coderef
+ # if not specified all columns (except for the primary key) will be viewable
+ # 'fields' => [
+ # ]
+
+ my(%opt) = @_;
+
+ my $table = $opt{'table'};
+
+ my $fields = $opt{'fields'}
+ #|| [ grep { $_ ne 'svcnum' } dbdef->table($table)->columns ];
+ || [ grep { $_ ne 'svcnum' } fields($table) ];
+
+ my($query) = $cgi->keywords;
+ $query =~ /^(\d+)$/;
+ my $svcnum = $1;
+ my $svc_x = qsearchs( $opt{'table'}, { 'svcnum' => $svcnum } )
+ or die "Unknown svcnum $svcnum in ". $opt{'table'}. " table\n";
+
+ my $cust_svc = $svc_x->cust_svc;
+ my($label, $value, $svcdb) = $cust_svc->label;
+
+ my $pkgnum = $cust_svc->pkgnum;
+
+ my($cust_pkg, $custnum);
+ if ($pkgnum) {
+ $cust_pkg = $cust_svc->cust_pkg;
+ $custnum = $cust_pkg->custnum;
+ } else {
+ $cust_pkg = '';
+ $custnum = '';
+ }
+
+%>
+
+<% if ( $custnum ) { %>
+
+ <%= include("/elements/header.html","View $label: $value", menubar(
+ "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
+ )) %>
+
+ <%= include( '/elements/small_custview.html', $custnum, '', 1 ) %>
+ <BR>
+
+<% } else { %>
+
+ <SCRIPT>
+ function areyousure(href) {
+ if (confirm("Permanently delete this <%= $label %>?") == true)
+ window.location.href = href;
+ }
+ </SCRIPT>
+
+ <%= include("/elements/header.html","View $label: $value", menubar(
+ "Cancel this (unaudited) $label" =>
+ "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')"
+ )) %>
+
+<% } %>
+
+Service #<B><%= $svcnum %></B>
+| <A HREF="<%=$p%>edit/<%= $opt{'table'} %>.cgi?<%=$svcnum%>">Edit this <%= $label %></A>
+<BR>
+
+<%= ntable("#cccccc") %><TR><TD><%= ntable("#cccccc",2) %>
+
+<% foreach my $f ( @$fields ) {
+
+ my( $field, $type);
+ if ( ref($f) ) {
+ $field = $f->{'field'},
+ $type = $f->{'type'} || 'text',
+ } else {
+ $field = $f;
+ $type = 'text';
+ }
+%>
+
+ <TR>
+ <TD ALIGN="right">
+ <%= ( $opt{labels} && exists $opt{labels}->{$field} )
+ ? $opt{labels}->{$field}
+ : $field
+ %>
+ </TD>
+
+ <%
+ #eventually more options for <SELECT>, etc. fields
+ %>
+
+ <TD BGCOLOR="#ffffff"><%= $svc_x->$field %><TD>
+
+ </TR>
+
+<% } %>
+
+<% foreach (sort { $a cmp $b } $svc_x->virtual_fields) { %>
+ <%= $svc_x->pvf($_)->widget('HTML', 'view', $svc_x->getfield($_)) %>
+<% } %>
+
+</TABLE></TD></TR></TABLE>
+
+<BR>
+<%= joblisting({'svcnum'=>$svcnum}, 1) %>
+
+<%= include('/elements/footer.html') %>
diff --git a/httemplate/view/svc_external.cgi b/httemplate/view/svc_external.cgi
index 2acc3f9cf..7816d88dc 100644
--- a/httemplate/view/svc_external.cgi
+++ b/httemplate/view/svc_external.cgi
@@ -1,4 +1,3 @@
-<!-- mason kludge -->
<%
my($query) = $cgi->keywords;
diff --git a/httemplate/view/svc_phone.cgi b/httemplate/view/svc_phone.cgi
new file mode 100644
index 000000000..8de7cc8e7
--- /dev/null
+++ b/httemplate/view/svc_phone.cgi
@@ -0,0 +1,10 @@
+<%= include('elements/svc_Common.html',
+ 'table' => 'svc_phone',
+ 'fields' => [qw( countrycode phonenum )], #pin
+ 'labels' => {
+ 'countrycode' => 'Country code',
+ 'phonenum' => 'Phone number',
+ 'pin' => 'PIN',
+ },
+ )
+%>