X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_pkg.cgi;h=b1851a7bae57e83948b65ba9baad402783b6d1fe;hb=9464e3517fcae6a735c14b3fb15b91f3886a884a;hp=90e328d4bfa16dec0eef4ce5bf8810cf2a123b14;hpb=9509e5bfb7f9331303153cac24d7bfecbe2ea9f1;p=freeside.git diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 90e328d4b..b1851a7ba 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -1,68 +1,9 @@ -% -% -%if ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) { -% $cgi->param('clone', $1); -%} else { -% $cgi->param('clone', ''); -%} -%if ( $cgi->param('pkgnum') && $cgi->param('pkgnum') =~ /^(\d+)$/ ) { -% $cgi->param('pkgnum', $1); -%} else { -% $cgi->param('pkgnum', ''); -%} -% -%my ($query) = $cgi->keywords; -% -%my $part_pkg = ''; -%my @agent_type = (); -%if ( $cgi->param('error') ) { -% $part_pkg = new FS::part_pkg ( { -% map { $_, scalar($cgi->param($_)) } fields('part_pkg') -% } ); -% (@agent_type) = $cgi->param('agent_type'); -%} -% -%my $action = ''; -%my $clone_part_pkg = ''; -%my $pkgpart = ''; -%if ( $cgi->param('clone') ) { -% $pkgpart = $cgi->param('clone'); -% $action = 'Custom Pricing'; -% $clone_part_pkg= qsearchs('part_pkg', { 'pkgpart' => $cgi->param('clone') } ); -% $part_pkg ||= $clone_part_pkg->clone; -% $part_pkg->disabled('Y'); #isn't sticky on errors -%} elsif ( $query && $query =~ /^(\d+)$/ ) { -% (@agent_type) = map {$_->typenum} qsearch('type_pkgs',{'pkgpart'=>$1}) -% unless $part_pkg; -% $part_pkg ||= qsearchs('part_pkg',{'pkgpart'=>$1}); -% $pkgpart = $part_pkg->pkgpart; -%} else { -% unless ( $part_pkg ) { -% $part_pkg = new FS::part_pkg {}; -% $part_pkg->plan('flat'); -% } -%} -%unless ( $part_pkg->plan ) { #backwards-compat -% $part_pkg->plan('flat'); -% $part_pkg->plandata("setup_fee=". $part_pkg->setup. "\n". -% "recur_fee=". $part_pkg->recur. "\n"); -%} -%$action ||= $part_pkg->pkgpart ? 'Edit' : 'Add'; -%my $hashref = $part_pkg->hashref; -% -% - - -<% include("/elements/header.html","$action Package Definition", menubar( - 'Main Menu' => popurl(2), +<% include('/elements/header.html', "$action Package Definition", menubar( 'View all packages' => popurl(2). 'browse/part_pkg.cgi', )) %> % #), ' onLoad="visualize()"'); -% if ( $cgi->param('error') ) { - - Error: <% $cgi->param('error') %> -% } +<% include('/elements/error.html') %>
@@ -125,7 +66,6 @@ Tax information -% my $conf = new FS::Conf; % if ( $conf->exists('enable_taxclasses') ) { @@ -162,34 +102,42 @@ Line-item revenue recognition -Reseller information -<% ntable("#cccccc", 2) %> - - <% 'Agent Types' %> - - <% include( '/elements/select-table.html', - 'element_name' => 'agent_type', - 'table' => 'agent_type', - 'name_col' => 'atype', - 'value' => \@agent_type, - 'empty_label' => '(none)', - 'element_etc' => 'multiple size="10"', - ) - %> - - - +% if ( $cgi->param('clone') ) { + + + +% } elsif ( scalar(@all_agent_types) == 1) { + + + +% } else { + + Reseller information + <% ntable("#cccccc", 2) %> + + <% 'Agent Types' %> + + <% include( '/elements/select-table.html', + 'element_name' => 'agent_type', + 'table' => 'agent_type', + 'name_col' => 'atype', + 'value' => \@agent_type, + 'multiple' => '1', + 'element_etc' => 'size="10"', + ) + %> + + + + +% } + -% -% -%my $thead = "\n\n". ntable('#cccccc', 2). -% 'Quan.'; -%$thead .= 'Primary' -% if dbdef->table('pkg_svc')->column('primary_svc'); -%$thead .= 'Service'; -% -% +%my $thead = "\n\n". ntable('#cccccc', 2). +% 'Quan.'. +% 'Primary'. +% 'Service';

Services included <% itable('', 4, 1) %> @@ -219,15 +167,28 @@ Reseller information % 'quantity' => 0, % 'primary_svc' => '', % } ); +% if ( $cgi->param('error') ) { +% my $primary_svc = ( $pkg_svc->primary_svc =~ /^Y/i ); +% my $pkg_svc_primary = scalar($cgi->param('pkg_svc_primary')); +% $pkg_svc->primary_svc('') +% if $primary_svc && $pkg_svc_primary != $svcpart; +% $pkg_svc->primary_svc('Y') +% 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; +% } elsif ( $pkg_svc->quantity ) { +% $quan = $pkg_svc->quantity; +% } - quantity || 0 %>"> + @@ -251,10 +212,9 @@ Reseller information -% foreach my $f ( qw( clone pkgnum ) ) { - - -% } +% foreach my $f ( qw( clone pkgnum ) ) { #safe, these were untained in %init + +% } % @@ -276,16 +236,14 @@ Reseller information %#} %my @form_elements = ( 'classnum', 'taxclass', 'agent_type' ); % -%my @form_radio = (); -%if ( dbdef->table('pkg_svc')->column('primary_svc') ) { -% push @form_radio, 'pkg_svc_primary'; -%} +%my @form_radio = ( 'pkg_svc_primary' ); % %tie my %freq, 'Tie::IxHash', %{FS::part_pkg->freqs_href()}; %if ( $part_pkg->dbdef_table->column('freq')->type =~ /(int)/i ) { % delete $freq{$_} foreach grep { ! /^\d+$/ } keys %freq; %} % +%#this should be replaced by /elements/selectlayers.html %my $widget = new HTML::Widgets::SelectLayers( % 'selected_layer' => $part_pkg->plan, % 'options' => \%options, @@ -328,23 +286,29 @@ Reseller information % % my $format = sub { shift }; % $format = $href->{$field}{'format'} if exists($href->{$field}{'format'}); +% % if ( ! exists($href->{$field}{'type'}) ) { +% % $html .= qq!!; +% qq!" onChange="fchanged(this)">!; +% % } elsif ( $href->{$field}{'type'} eq 'checkbox' ) { +% % $html .= qq!'; +% % } elsif ( $href->{$field}{'type'} =~ /^select/ ) { +% % $html .= '{$field}{'type'} eq 'select_multiple'; -% $html .= qq! NAME="$field">!; +% $html .= qq! NAME="$field" onChange="fchanged(this)">!; % % if ( $href->{$field}{'select_table'} ) { % foreach my $record ( @@ -361,13 +325,13 @@ Reseller information % } % } elsif ( $href->{$field}{'select_options'} ) { % foreach my $key ( keys %{ $href->{$field}{'select_options'} } ) { -% my $value = $href->{$field}{'select_options'}{$key}; +% my $label = $href->{$field}{'select_options'}{$key}; % $html .= qq!