diff options
author | Ivan Kohler <ivan@freeside.biz> | 2013-07-24 01:18:35 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2013-07-24 01:18:35 -0700 |
commit | 116ae6107240a49c854de2662678abb4fbb8acab (patch) | |
tree | fc436621822ee698f6da6b040a79761c4dc69e2a /httemplate | |
parent | 288a1a44dd09ebed51e0a5800624b4ed49ecdf9f (diff) |
omit charging for some services in bulk price plans, RT#24053
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/edit/process/part_pkg.cgi | 14 | ||||
-rw-r--r-- | httemplate/elements/tr-pkg_svc.html | 50 |
2 files changed, 45 insertions, 19 deletions
diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index 3b6562f13..db4fcb921 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -132,10 +132,16 @@ my $args_callback = sub { ### my @svcparts = map { $_->svcpart } qsearch('part_svc', {}); - my %pkg_svc = map { $_ => scalar($cgi->param("pkg_svc$_")) } @svcparts; - my %hidden_svc = map { $_ => scalar($cgi->param("hidden$_")) } @svcparts; - - push @args, 'pkg_svc' => \%pkg_svc, 'hidden_svc' => \%hidden_svc; + my %pkg_svc = map { $_ => scalar($cgi->param("pkg_svc$_" )) } @svcparts; + my %hidden_svc = map { $_ => scalar($cgi->param("hidden$_" )) } @svcparts; + my %bulk_skip = map { $_ => ( $cgi->param("no_bulk_skip$_") eq 'Y' + ? '' : 'Y' + ) + } @svcparts; + + push @args, 'pkg_svc' => \%pkg_svc, + 'hidden_svc' => \%hidden_svc, + 'bulk_skip' => \%bulk_skip; ### # cust_pkg and custnum_ref (inserts only) diff --git a/httemplate/elements/tr-pkg_svc.html b/httemplate/elements/tr-pkg_svc.html index 6d17a376d..1923f12c2 100644 --- a/httemplate/elements/tr-pkg_svc.html +++ b/httemplate/elements/tr-pkg_svc.html @@ -7,12 +7,15 @@ %foreach my $part_svc ( @part_svc ) { % my $svcpart = $part_svc->svcpart; % my $pkg_svc = $pkg_svc{$svcpart} -% || new FS::pkg_svc ( { -% 'pkgpart' => $pkgpart, -% 'svcpart' => $svcpart, -% 'quantity' => 0, -% 'primary_svc' => '', -% 'hidden' => '', +% ||= qsearchs('pkg_svc', { 'pkgpart' => $pkgpart, +% 'svcpart' => $svcpart } ) +% || new FS::pkg_svc ( { +% 'pkgpart' => $pkgpart, +% 'svcpart' => $svcpart, +% 'quantity' => 0, +% 'primary_svc' => '', +% 'hidden' => '', +% 'bulk_skip' => '', % } ); % if ( $cgi->param('error') ) { % my $primary_svc = ( $pkg_svc->primary_svc =~ /^Y/i ); @@ -23,8 +26,6 @@ % if ! $primary_svc && $pkg_svc_primary == $svcpart; % } % -% push @fixups, "pkg_svc$svcpart"; -% % my $quan = 0; % if ( $cgi->param("pkg_svc$svcpart") =~ /^\s*(\d+)\s*$/ ) { % $quan = $1; @@ -32,6 +33,19 @@ % $quan = $pkg_svc->quantity; % } % +% my $hidden = ''; +% if ( grep { $_ eq "hidden_svc$svcpart" } $cgi->param ) { +% $hidden = $cgi->param("hidden_svc$svcpart"); +% } else { +% $hidden = $pkg_svc->hidden; +% } +% my $bulk_skip = ''; +% if ( grep { $_ eq "no_bulk_skip$svcpart" } $cgi->param ) { +% $bulk_skip = $cgi->param("no_bulk_skip$svcpart") eq 'Y' ? '' : 'Y'; +% } else { +% $bulk_skip = $pkg_svc->bulk_skip; +% } +% % my @exports = $pkg_svc->part_svc->part_export; % foreach my $export ( @exports ) { % push @possible_exports, $export if $export->can('external_pkg_map'); @@ -39,7 +53,7 @@ <TR> <TD> - <INPUT TYPE="text" NAME="pkg_svc<% $svcpart %>" SIZE=7 MAXLENGTH=6 VALUE="<% $quan %>"> + <INPUT TYPE="text" NAME="pkg_svc<% $svcpart %>" SIZE=4 MAXLENGTH=6 VALUE="<% $quan %>"> </TD> <TD ALIGN="center"> @@ -50,9 +64,14 @@ <A HREF="part_svc.cgi?<% $part_svc->svcpart %>"><% $part_svc->svc %></A> <% $part_svc->disabled =~ /^Y/i ? ' (DISABLED' : '' %> </TD> - <TD> - <INPUT TYPE="checkbox" NAME="hidden<% $svcpart %>" VALUE="Y"<% $pkg_svc->hidden =~ /^Y/i ? ' CHECKED' : ''%>> + <TD ALIGN="center"> + <INPUT TYPE="checkbox" NAME="hidden<% $svcpart %>" VALUE="Y"<% $hidden =~ /^Y/i ? ' CHECKED' : ''%>> </TD> + + <TD ALIGN="center"> + <INPUT TYPE="checkbox" NAME="no_bulk_skip<% $svcpart %>" VALUE="Y"<% $bulk_skip =~ /^Y/i ? '' : ' CHECKED' %>> + </TD> + </TR> % foreach ( 1 .. $columns-1 ) { % if ( $count == int( $_ * scalar(@part_svc) / $columns ) ) { @@ -102,10 +121,12 @@ my %opt = @_; my $cgi = $opt{'cgi'}; my $thead = "\n\n". ntable('#cccccc', 2). - '<TR><TH BGCOLOR="#dcdcdc"><FONT SIZE=-1>Quan.</FONT></TH>'. - '<TH BGCOLOR="#dcdcdc"><FONT SIZE=-2>Primary</FONT></TH>'. + '<TR>'. + '<TH BGCOLOR="#dcdcdc"><FONT SIZE=-1>Quan.</FONT></TH>'. + '<TH BGCOLOR="#dcdcdc"><FONT SIZE=-1>Primary</FONT></TH>'. '<TH BGCOLOR="#dcdcdc">Service</TH>'. - '<TH BGCOLOR="#dcdcdc"><FONT SIZE=-1>Hide</FONT></TH>'. + '<TH BGCOLOR="#dcdcdc"><FONT SIZE=-1>Hide<BR>from<BR>Invoices</FONT></TH>'. + '<TH BGCOLOR="#dcdcdc"><FONT SIZE=-1>Bulk<BR>Charge</FONT></TH>'. '</TR>'; my $part_pkg = $opt{'object'}; @@ -124,7 +145,6 @@ my @part_svc = qsearch('part_svc', {}, '', $where); #my %pkg_svc = map { $_->svcpart => $_ } $q_part_pkg->pkg_svc; my %pkg_svc = map { $_->svcpart => $_ } $part_pkg->pkg_svc('disable_linked'=>1); -my @fixups = (); my $count = 0; my $columns = 3; |