X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_pkg.cgi;h=b085d226021a7430381e2ccd0203f61dcc1cce7b;hp=2c3808fe1a05d11d1204827969a7cbcabcffd88a;hb=c738a3c4923774b64960aa87fa58bd0751487edb;hpb=d1a885c65ac10e19bed0333a380dafeb42c2cef1 diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 2c3808fe1..b085d2260 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -28,7 +28,7 @@ if ( $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'); + $part_pkg->disabled('Y'); #isn't sticky on errors } elsif ( $query && $query =~ /^(\d+)$/ ) { $part_pkg ||= qsearchs('part_pkg',{'pkgpart'=>$1}); $pkgpart = $part_pkg->pkgpart; @@ -48,7 +48,7 @@ my $hashref = $part_pkg->hashref; %> -<%= header("$action Package Definition", menubar( +<%= include("/elements/header.html","$action Package Definition", menubar( 'Main Menu' => popurl(2), 'View all packages' => popurl(2). 'browse/part_pkg.cgi', )) %> @@ -59,21 +59,8 @@ my $hashref = $part_pkg->hashref; Error: <%= $cgi->param('error') %> <% } %> -<% #print '
'; %> - -<% -#if ( $cgi->param('clone') ) { -# print qq!!; -#} -#if ( $cgi->param('pkgnum') ) { -# print qq!!; -#} -# -#print qq!!, -%> - <%= itable('',8,1) %> Package information @@ -97,6 +84,7 @@ Package information + <%= include( '/elements/tr-select-pkg_class.html', $part_pkg->classnum ) %> Promotional code @@ -157,15 +145,13 @@ $thead .= 'Primary' if dbdef->table('pkg_svc')->column('primary_svc'); $thead .= 'Service'; -#unless ( $cgi->param('clone') ) { -#dunno why... -unless ( 0 ) { - #print <', $thead; +%> +

Services included -END -} +<%= itable('', 4, 1) %> +<%= $thead %> +<% my $where = "WHERE disabled IS NULL OR disabled = ''"; if ( $pkgpart ) { @@ -175,7 +161,8 @@ if ( $pkgpart ) { )"; } my @part_svc = qsearch('part_svc', {}, '', $where); -my %pkg_svc = map { $_->svcpart => $_ } $part_pkg->pkg_svc; +my $q_part_pkg = $clone_part_pkg || $part_pkg; +my %pkg_svc = map { $_->svcpart => $_ } $q_part_pkg->pkg_svc; my @fixups = (); my $count = 0; @@ -192,45 +179,42 @@ foreach my $part_svc ( @part_svc ) { push @fixups, "pkg_svc$svcpart"; - #unless ( defined ($cgi->param('clone')) && $cgi->param('clone') ) { - #dunno why... - unless ( 0 ) { - print ''; # if $count == 0 ; - print qq!quantity || 0, - qq!">!; - if ( dbdef->table('pkg_svc')->column('primary_svc') ) { - print qq!primary_svc =~ /^Y/i; - print '>'; - } - print qq!!, $part_svc->getfield('svc'), ''; - print ' (DISABLED)' if $part_svc->disabled =~ /^Y/i; - print ''; -# print "$thead" if ++$count == int(scalar(@part_svc) / 2); - $count+=1; - foreach ( 1 .. $columns-1 ) { - print "$thead" - if $count == int( $_ * scalar(@part_svc) / $columns ); - } - } else { - print qq!quantity || 0, qq!">\n!; - } -} +%> -#unless ( $cgi->param('clone') ) { -#dunno why... -unless ( 0 ) { - print ""; - #print ""; -} + + + quantity || 0 %>"> + + + + primary_svc =~ /^Y/i ? ' CHECKED' : '' %>> + -foreach my $f ( qw( clone pkgnum ) ) { - print qq!'; -} -print ''; + + <%= $part_svc->svc %> <%= $part_svc->disabled =~ /^Y/i ? ' (DISABLED' : '' %> + + + + <% foreach ( 1 .. $columns-1 ) { + if ( $count == int( $_ * scalar(@part_svc) / $columns ) ) { + %> + <%= $thead %> + + <% } + } + $count++; + %> + +<% } %> + + + +<% foreach my $f ( qw( clone pkgnum ) ) { %> + +<% } %> + + +<% # prolly should be in database tie my %plans, 'Tie::IxHash', %{ FS::part_pkg::plan_info() }; @@ -241,7 +225,7 @@ my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } tie my %options, 'Tie::IxHash', map { $_=>$plans{$_}->{'name'} } keys %plans; -my @form_select = (); +my @form_select = ('classnum'); if ( $conf->exists('enable_taxclasses') ) { push @form_select, 'taxclass'; } else { @@ -253,7 +237,7 @@ if ( dbdef->table('pkg_svc')->column('primary_svc') ) { push @form_radio, 'pkg_svc_primary'; } -tie my %freq, 'Tie::IxHash', %FS::part_pkg::freq; +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; } @@ -314,16 +298,35 @@ my $widget = new HTML::Widgets::SelectLayers( $html .= ' MULTIPLE' if $href->{$field}{'type'} eq 'select_multiple'; $html .= qq! NAME="$field" onChange="fchanged(this)">!; - foreach my $record ( - qsearch( $href->{$field}{'select_table'}, - $href->{$field}{'select_hash'} ) - ) { - my $value = $record->getfield($href->{$field}{'select_key'}); - $html .= qq!