'type' => 'textarea',
},
+ {
+ 'key' => 'payment_history-years',
+ 'section' => 'UI',
+ 'description' => 'Number of years of payment history to show by default. Currently defaults to 2.',
+ 'type' => 'text',
+ },
+
+ {
+ 'key' => 'cust_main-ticket_statuses',
+ 'section' => 'UI',
+ 'description' => 'Show tickets with these statuses on the customer view page.',
+ 'type' => 'selectmultiple',
+ 'select_enum' => [qw( new open stalled resolved rejected deleted )],
+ },
+
+ {
+ 'key' => 'cust_main-max_tickets',
+ 'section' => 'UI',
+ 'description' => 'Maximum number of tickets to show on the customer view page.',
+ 'type' => 'text',
+ },
+
);
1;
use FS::cust_main;
FS::UID->install_callback( sub {
- my $conf = new FS::Conf;
+ $conf = new FS::Conf;
$default_queueid = $conf->config('ticket_system-default_queueid');
$priority_field =
$conf->config('ticket_system-custom_priority_field');
my( $from_sql, @param) = $self->_from_customer( $custnum, $priority );
my $sql = "SELECT tickets.*, queues.name".
( length($priority) ? ", objectcustomfieldvalues.content" : '' ).
- " $from_sql ORDER BY priority DESC LIMIT $limit";
+ " $from_sql ORDER BY priority, id DESC LIMIT $limit";
my $sth = $dbh->prepare($sql) or die $dbh->errstr. "preparing $sql";
$sth->execute(@param) or die $sth->errstr. "executing $sql";
JOIN queues ON ( tickets.queue = queues.id )
JOIN links ON ( tickets.id = links.localbase )
$join
- WHERE ( status = 'new' OR status = 'open' OR status = 'stalled' )
+ WHERE ( ". join(' OR ', map "status = '$_'", $self->statuses ). " )
AND target = 'freeside://freeside/cust_main/$custnum'
$where
";
}
+sub statuses {
+ #my $self = shift;
+ my @statuses = grep { ! /^\s*$/ } $conf->config('cust_main-ticket_statuses');
+ @statuses = (qw( new open stalled )) unless scalar(@statuses);
+ @statuses;
+}
+
sub href_customer_tickets {
my( $self, $custnum, $priority ) = @_;
- my $href = $self->baseurl;
+ #my $href = $self->baseurl;
- #i snarfed this from an RT bookmarked search, it could be unescaped in the
- #source for readability and run through uri_escape
- $href .=
- 'Search/Results.html?Order=ASC&Query=%20MemberOf%20%3D%20%27freeside%3A%2F%2Ffreeside%2Fcust_main%2F'.
- $custnum.
- '%27%20%20AND%20%28%20Status%20%3D%20%27open%27%20%20OR%20Status%20%3D%20%27new%27%20%20OR%20Status%20%3D%20%27stalled%27%20%29%20'
+ #i snarfed this from an RT bookmarked search, then unescaped (some of) it with
+ #perl -npe 's/%([0-9A-F]{2})/pack('C', hex($1))/eg;'
+
+ my $href .=
+ "Search/Results.html?Order=ASC&".
+ "Query= MemberOf = 'freeside://freeside/cust_main/$custnum' ".
+ #" AND ( Status = 'open' OR Status = 'new' OR Status = 'stalled' )"
+ " AND ( ". join(' OR ', map "Status = '$_'", $self->statuses ). " ) "
;
if ( defined($priority) && $field && $priority_field_queue ) {
- $href .= 'AND%20Queue%20%3D%20%27'. $priority_field_queue. '%27%20';
+ $href .= " AND Queue = '$priority_field_queue' ";
}
if ( defined($priority) && $field ) {
- $href .= '%20AND%20%27CF.'. $field. '%27%20';
+ $href .= " AND 'CF.$field' ";
if ( $priority ) {
- $href .= '%3D%20%27'. $priority. '%27%20';
+ $href .= "= '$priority' ";
} else {
- $href .= 'IS%20%27NULL%27%20';
+ $href .= "IS 'NULL' "; #this is "RTQL", not SQL
}
}
+ #$href =
+ uri_escape($href);
+ #eventually should unescape all of it...
+
$href .= '&Rows=100'.
'&OrderBy=id&Page=1'.
'&Format=%27%20%20%20%3Cb%3E%3Ca%20href%3D%22'.
$href .= '%20%0A%27%3Csmall%3E__ToldRelative__%3C%2Fsmall%3E%27%2C%20%0A%27%3Csmall%3E__LastUpdatedRelative__%3C%2Fsmall%3E%27%2C%20%0A%27%3Csmall%3E__TimeLeft__%3C%2Fsmall%3E%27';
- $href;
+ #$href =
+ #uri_escape($href);
+
+ $self->baseurl. $href;
}
'MCRD' => 'Manual credit card',
);
-my($link, $linknum, $paid, $payby, $payinfo, $quickpay, $_date);
+my($link, $linknum, $paid, $payby, $payinfo, $_date);
if ( $cgi->param('error') ) {
$link = $cgi->param('link');
$linknum = $cgi->param('linknum');
$paid = $cgi->param('paid');
$payby = $cgi->param('payby');
$payinfo = $cgi->param('payinfo');
- $quickpay = $cgi->param('quickpay');
$_date = $cgi->param('_date') ? str2time($cgi->param('_date')) : time;
} elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
- $link = 'custnum';
+ $link = $cgi->param('popup') ? 'popup' : 'custnum';
$linknum = $1;
$paid = '';
$payby = $cgi->param('payby') || 'BILL';
$payinfo = '';
- $quickpay = $cgi->param('quickpay');
$_date = time;
} elsif ( $cgi->param('invnum') =~ /^(\d+)$/ ) {
$link = 'invnum';
$paid = '';
$payby = $cgi->param('payby') || 'BILL';
$payinfo = "";
- $quickpay = '';
$_date = time;
} else {
die "illegal query ". $cgi->keywords;
my $title = 'Post '. $payby{$payby}. ' payment';
$title .= " against Invoice #$linknum" if $link eq 'invnum';
-%>
+if ( $link eq 'popup' ) {
+
+%><%= include('/elements/header-popup.html', $title ) %>
+
+<% } else { %>
-<%= include("/elements/header.html",$title, '') %>
+<%= include("/elements/header.html", $title, '') %>
+
+<% } %>
<% if ( $cgi->param('error') ) { %>
<FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT>
<FORM ACTION="<%= popurl(1) %>process/cust_pay.cgi" METHOD=POST>
<INPUT TYPE="hidden" NAME="link" VALUE="<%= $link %>">
<INPUT TYPE="hidden" NAME="linknum" VALUE="<%= $linknum %>">
-<INPUT TYPE="hidden" NAME="quickpay" VALUE="<%= $quickpay %>">
<%
my $money_char = $conf->config('money_char') || '$';
}
%>
+<% unless ( $link eq 'popup' ) { %>
<%= small_custview($custnum, $conf->config('countrydefault')) %>
+<% } %>
<INPUT TYPE="hidden" NAME="payby" VALUE="<%= $payby %>">
or die "Illegal linknum: ". $cgi->param('linknum');
my $linknum = $1;
-$cgi->param('link') =~ /^(custnum|invnum)$/
+$cgi->param('link') =~ /^(custnum|invnum|popup)$/
or die "Illegal link: ". $cgi->param('link');
-my $link = $1;
+my $field = my $link = $1;
+$field = 'custnum' if $field eq 'popup';
my $_date = str2time($cgi->param('_date'));
my $new = new FS::cust_pay ( {
- $link => $linknum,
- _date => $_date,
+ $field => $linknum,
+ _date => $_date,
map {
$_, scalar($cgi->param($_));
} qw(paid payby payinfo paybatch)
if ($error) {
$cgi->param('error', $error);
print $cgi->redirect(popurl(2). 'cust_pay.cgi?'. $cgi->query_string );
-} elsif ( $link eq 'invnum' ) {
+} elsif ( $field eq 'invnum' ) {
print $cgi->redirect(popurl(3). "view/cust_bill.cgi?$linknum");
-} elsif ( $link eq 'custnum' ) {
+} elsif ( $field eq 'custnum' ) {
if ( $cgi->param('apply') eq 'yes' ) {
my $cust_main = qsearchs('cust_main', { 'custnum' => $linknum })
or die "unknown custnum $linknum";
$cust_main->apply_payments;
}
- if ( $cgi->param('quickpay') eq 'yes' ) {
- print $cgi->redirect(popurl(3). "search/cust_main-quickpay.html");
- } else {
+ if ( $link eq 'popup' ) {
+
+ %><%= header('Payment entered') %>
+ <SCRIPT TYPE="text/javascript">
+ window.top.location.reload();
+ </SCRIPT>
+
+ </BODY></HTML>
+ <%
+
+ } elsif ( $link eq 'custnum' ) {
print $cgi->redirect(popurl(3). "view/cust_main.cgi?$linknum");
+ } else {
+ die "unknown link $link";
}
+
}
%>
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;
%>
+<%= 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> |
<%
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 type</TD>
<TD BGCOLOR="#ffffff">
<%= 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 CDRs</TD>
<TD BGCOLOR="#ffffff"><%= $cust_main->spool_cdr ? 'yes' : 'no' %></TD>
%>
<%= ntable("#cccccc") %><TR><TD><%= &ntable("#cccccc",2) %>
+
<TR>
<TD ALIGN="right">Customer 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;
<% } %>
<TR>
- <TD ALIGN="right">Order taker</TD>
- <TD BGCOLOR="#ffffff"><%= $cust_main->otaker %></TD>
-</TR>
-<TR>
<TD ALIGN="right">Referring Customer</TD>
<TD BGCOLOR="#ffffff">
</TD>
</TR>
+<TR>
+ <TD ALIGN="right">Order taker</TD>
+ <TD BGCOLOR="#ffffff"><%= $cust_main->otaker %></TD>
+</TR>
+
</TABLE></TD></TR></TABLE>
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>
<% if ( $curuser->access_right('Order customer package') ) { %>
<% 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>
<FONT SIZE=-1>
<% } %>
</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 {
</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)%>
- <% if ( $curuser->access_right('Unprovision customer service') ) { %>
- <BR>( <%=svc_unprovision_link($service)%> )
+ <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">( <%=svc_unprovision_link($service)%> )</FONT></TD>
+ </TR>
+ <% } %>
+
<% } %>
- </TD>
-</TR>
-<%
- $cnt++;
- }
- if ( $svcpart->{count} < $svcpart->{quantity} ) {
- print '<TR>' if ($cnt > 0);
- if ( $curuser->access_right('Provision customer service') ) {
- print '<TD COLSPAN=2>'.
- svc_provision_link($pkg, $svcpart, $conf, $curuser).
- '</TD></TR>';
- } else {
- #print '<TD COLSPAN=2> </TD></TR>';
- print '<TD COLSPAN=2></TD></TR>';
- }
- }
- }
-}
-#end display packages
+ <% 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>
<% } %>
<% 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'} && $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'} && $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{'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>
<% } %>
<% if ( $curuser->access_right('Post credit') ) { %>
- <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 ); return false;">Post credit</A>
+ <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>
<%
#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/^\$\-/- \$/;
+ %>
+
+ <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 {
}
my $charge = exists($item->{'charge'})
- ? sprintf('$%.2f', $item->{'charge'})
+ ? sprintf("$money_char\%.2f", $item->{'charge'})
: '';
+
my $payment = exists($item->{'payment'})
- ? sprintf('- $%.2f', $item->{'payment'})
+ ? sprintf("- $money_char\%.2f", $item->{'payment'})
: '';
- $payment ||= sprintf('<DEL>- $%.2f</DEL>', $item->{'void_payment'})
+
+ $payment ||= sprintf( "<DEL>- $money_char\%.2f</DEL>",
+ $item->{'void_payment'}
+ )
if exists($item->{'void_payment'});
+
my $credit = exists($item->{'credit'})
- ? sprintf('- $%.2f', $item->{'credit'})
+ ? sprintf("- $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'} : '';
$balance += $item->{'refund'} if exists $item->{'refund'};
$balance = sprintf("%.2f", $balance);
$balance =~ s/^\-0\.00$/0.00/; #yay ieee fp
- ( my $showbalance = '$'. $balance ) =~ s/^\$\-/- \$/;
+ ( my $showbalance = $money_char. $balance ) =~ s/^\$\-/- \$/;
%>
- <TR>
+ <TR <%= $display ? $display.' ID="old_history'.$old_history++.'"' : ''%>>
<TD CLASS="grid" BGCOLOR="<%= $bgcolor %>">
<% unless ( !$target || $target{$target}++ ) { %>
<A NAME="<%= $target %>">
</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>
+
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') ) {
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>