summaryrefslogtreecommitdiff
path: root/httemplate/view/cust_bill.cgi
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2013-09-27 17:19:36 -0700
committerMark Wells <mark@freeside.biz>2013-09-27 17:19:36 -0700
commiteb3bd392a89b8b666dc512951e78913c05b98810 (patch)
tree22670bdf99b0a473abb708f6f5c55cbfa2f0c249 /httemplate/view/cust_bill.cgi
parente3012c0751dad6710ea35b6d074b551bffdad09b (diff)
invoice configurations, #24723
Diffstat (limited to 'httemplate/view/cust_bill.cgi')
-rwxr-xr-xhttemplate/view/cust_bill.cgi35
1 files changed, 31 insertions, 4 deletions
diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi
index 95ce60b1d..4822ab718 100755
--- a/httemplate/view/cust_bill.cgi
+++ b/httemplate/view/cust_bill.cgi
@@ -104,12 +104,35 @@
% my $br = 0;
% if ( $cust_bill->num_cust_event ) { $br++;
<A HREF="<%$p%>search/cust_event.html?invnum=<% $cust_bill->invnum %>">( <% mt('View invoice events') |h %> )</A>
-% }
+% }
% if ( $cust_bill->num_cust_bill_event ) { $br++;
<A HREF="<%$p%>search/cust_bill_event.cgi?invnum=<% $cust_bill->invnum %>">( <% mt('View deprecated, old-style invoice events') |h %> )</A>
% }
+% my @modes = grep {! $_->disabled}
+% $cust_bill->cust_main->agent->invoice_modes;
+% if ( @modes ) {
+( <% mt('View as:') %>
+<FORM STYLE="display:inline" ACTION="<% $cgi->url %>" METHOD="GET">
+<INPUT NAME="invnum" VALUE="<% $invnum %>" TYPE="hidden">
+<& /elements/select-table.html,
+ table => 'invoice_mode',
+ field => 'mode',
+ curr_value => scalar($cgi->param('mode')),
+ records => \@modes,
+ name_col => 'modename',
+ onchange => 'change_invoice_mode',
+ empty_label => '(default)',
+&> )
+<SCRIPT TYPE="text/javascript">
+function change_invoice_mode(obj) {
+ obj.form.submit();
+}
+</SCRIPT>
+% $br++;
+% }
+
<% $br ? '<BR><BR>' : '' %>
% if ( $conf->exists('invoice_html') ) {
@@ -126,7 +149,9 @@ my $curuser = $FS::CurrentUser::CurrentUser;
die "access denied"
unless $curuser->access_right('View invoices');
-my( $invnum, $template, $notice_name );
+my $conf = FS::Conf->new;
+
+my( $invnum, $mode, $template, $notice_name );
my($query) = $cgi->keywords;
if ( $query =~ /^((.+)-)?(\d+)$/ ) {
$template = $2;
@@ -136,10 +161,9 @@ if ( $query =~ /^((.+)-)?(\d+)$/ ) {
$invnum = $cgi->param('invnum');
$template = $cgi->param('template');
$notice_name = $cgi->param('notice_name');
+ $mode = $cgi->param('mode');
}
-my $conf = new FS::Conf;
-
my %opt = (
'unsquelch_cdr' => $conf->exists('voip-cdr_email'),
'template' => $template,
@@ -163,10 +187,13 @@ my $cust_bill = qsearchs({
});
die "Invoice #$invnum not found!" unless $cust_bill;
+$cust_bill->set('mode' => $mode);
+
my $custnum = $cust_bill->custnum;
my $display_custnum = $cust_bill->cust_main->display_custnum;
my $link = "invnum=$invnum";
+$link .= ';mode=' . $mode if $mode;
$link .= ';template='. uri_escape($template) if $template;
$link .= ';notice_name='. $notice_name if $notice_name;