summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorivan <ivan>2011-06-10 03:33:44 +0000
committerivan <ivan>2011-06-10 03:33:44 +0000
commitc7bf005860b761a55ca075df987fb3b5ade8c242 (patch)
tree59fdf9039e264c654380528ffdf511b9b69d30a2 /httemplate
parent6b4fe3354a905755f9e6f1810cf94bbc269ce81d (diff)
add package def option to show $0 recurring on invoices, RT#9777
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/browse/part_pkg.cgi10
-rwxr-xr-xhttemplate/edit/part_pkg.cgi35
-rw-r--r--httemplate/elements/checkbox.html6
-rw-r--r--httemplate/elements/input-text.html4
-rw-r--r--httemplate/elements/tr-select-agent.html6
5 files changed, 56 insertions, 5 deletions
diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi
index dd20f8d31..ae869dda6 100755
--- a/httemplate/browse/part_pkg.cgi
+++ b/httemplate/browse/part_pkg.cgi
@@ -226,7 +226,7 @@ push @fields, sub {
],
[
{ data=>( $is_recur
- ? $money_char.sprintf('%.2f ', $part_pkg->option('recur_fee') )
+ ? $money_char.sprintf('%.2f ', $part_pkg->option('recur_fee'))
: $part_pkg->freq_pretty
),
align=> ( $is_recur ? 'right' : 'center' ),
@@ -239,6 +239,14 @@ push @fields, sub {
: ()
),
],
+ [ { data =>
+ ( $part_pkg->option('recur_fee') == 0 && $part_pkg->recur_show_zero )
+ ? ' (printed on invoices)'
+ : '',
+ align => 'center', #?
+ colspan => 2,
+ },
+ ],
( map {
my $dst_pkg = $_->dst_pkg;
[
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index be8b0f68f..93a3b24c3 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -45,6 +45,7 @@
'agentnum' => 'Agent',
'setup_fee' => 'Setup fee',
'recur_fee' => 'Recurring fee',
+ 'recur_show_zero' => 'Show zero recurring',
'discountnum' => 'Offer discounts for longer terms',
'bill_dst_pkgpart' => 'Include line item(s) from package',
'svc_dst_pkgpart' => 'Include services of package',
@@ -107,8 +108,15 @@
{ field => 'recur_fee',
type => 'money',
disabled => sub { $recur_disabled },
+ onchange => 'recur_changed',
},
-
+
+ { field => 'recur_show_zero',
+ type => 'checkbox',
+ value => 'Y',
+ disabled => sub { $recur_show_zero_disabled },
+ },
+
#price plan
#setup fee
#recurring frequency
@@ -324,6 +332,7 @@ my @taxproductnums = ( qw( setup recur ), sort (keys %taxproductnums) );
my %options = ();
my $recur_disabled = 1;
+my $recur_show_zero_disabled = 1;
my $pkgpart = '';
@@ -335,6 +344,10 @@ my $error_callback = sub {
$opt->{action} = 'Custom' if $cgi->param('pkgnum');
$recur_disabled = $cgi->param('freq') ? 0 : 1;
+ $recur_show_zero_disabled =
+ $cgi->param('freq')
+ ? $cgi->param('recur_fee') ? 0 : 1
+ : 1;
foreach ($cgi->param) {
/^usage_taxproductnum_(\d+)$/ && ($taxproductnums{$1} = 1);
@@ -512,16 +525,34 @@ my $javascript = <<'END';
if ( freq == '0' ) {
what.form.recur_fee.disabled = true;
what.form.recur_fee.style.backgroundColor = '#dddddd';
+ what.form.recur_show_zero.disabled = true;
+ //what.form.recur_show_zero.style.backgroundColor= '#dddddd';
} else {
what.form.recur_fee.disabled = false;
what.form.recur_fee.style.backgroundColor = '#ffffff';
+ what.form.recur_show_zero.disabled = false;
+ //what.form.recur_show_zero.style.backgroundColor= '#ffffff';
}
}
+ function recur_changed(what) {
+ var recur = what.value;
+ if ( recur == 0 ) {
+ what.form.recur_show_zero.disabled = false;
+ } else {
+ what.form.recur_show_zero.disabled = true;
+ }
+ }
+
function agent_changed(what) {
- var agentnum = what.options[what.selectedIndex].value;
+ var agentnum;
+ if ( what.type == 'select-one' ) {
+ agentnum = what.options[what.selectedIndex].value;
+ } else {
+ agentnum = what.value;
+ }
if ( agentnum == 0 ) {
what.form.agent_type.disabled = false;
diff --git a/httemplate/elements/checkbox.html b/httemplate/elements/checkbox.html
index 51760701e..91efe8578 100644
--- a/httemplate/elements/checkbox.html
+++ b/httemplate/elements/checkbox.html
@@ -6,6 +6,7 @@
? ' CHECKED'
: ''
%>
+ <% $opt{disabled} %>
<% $onchange %>
><% $opt{'postfix'} %>
<%init>
@@ -16,4 +17,9 @@ my $onchange = $opt{'onchange'}
? 'onChange="'. $opt{'onchange'}. '(this)"'
: '';
+$opt{'disabled'} = &{ $opt{'disabled'} }( \%opt )
+ if ref($opt{'disabled'}) eq 'CODE';
+$opt{'disabled'} = 'DISABLED'
+ if $opt{'disabled'} && $opt{'disabled'} !~ /disabled/i; # uuh... yeah?
+
</%init>
diff --git a/httemplate/elements/input-text.html b/httemplate/elements/input-text.html
index fb50a5070..827941501 100644
--- a/httemplate/elements/input-text.html
+++ b/httemplate/elements/input-text.html
@@ -15,7 +15,9 @@ my %opt = @_;
my $value = length($opt{curr_value}) ? $opt{curr_value} : $opt{value};
my $onchange = $opt{'onchange'}
- ? 'onChange="'. $opt{'onchange'}. '(this)"'
+ ? join(' ', map $_.'="'. $opt{'onchange'}. '(this)"',
+ qw( onChange onKeyDown onKeyUp onKeyPress )
+ )
: '';
my $size = $opt{'size'}
diff --git a/httemplate/elements/tr-select-agent.html b/httemplate/elements/tr-select-agent.html
index 0985d1aa7..ce03c40f5 100644
--- a/httemplate/elements/tr-select-agent.html
+++ b/httemplate/elements/tr-select-agent.html
@@ -24,7 +24,11 @@ Example:
</%doc>
% if ( scalar(@agents) == 1 ) {
- <INPUT TYPE="hidden" NAME="<% $opt{'field'} || 'agentnum' %>" VALUE="<% $agents[0]->agentnum %>">
+ <INPUT TYPE = "hidden"
+ NAME = "<% $opt{'field'} || 'agentnum' %>"
+ ID = "<% $opt{'field'} || 'agentnum' %>"
+ VALUE = "<% $agents[0]->agentnum %>"
+ >
%# YUCK. empty row so we don't throw g_row in edit.html off :/
<TR>