X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_pkg.cgi;h=f4ebd6770bf4436f3962c5b65c6836bde2b7610b;hb=46477667466732de54a034fae994e71f9ca62b50;hp=b7707f3e8cbc3bcfe5ff75e3297ef320e183ddfb;hpb=5820f3d7ca493e3e6318efe6e8e677b71b01c1ad;p=freeside.git diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index b7707f3e8..f4ebd6770 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -1,23 +1,6 @@ - - -<% my $plan = 'flat'; %> - - - + <% -$cgi = new CGI; - -&cgisuidsetup($cgi); - if ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) { $cgi->param('clone', $1); } else { @@ -42,18 +25,39 @@ if ( $cgi->param('clone') ) { my $old_part_pkg = qsearchs('part_pkg', { 'pkgpart' => $cgi->param('clone') } ); $part_pkg ||= $old_part_pkg->clone; + $part_pkg->disabled('Y'); } elsif ( $query && $query =~ /^(\d+)$/ ) { $part_pkg ||= qsearchs('part_pkg',{'pkgpart'=>$1}); } else { $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; +%> + + + +<% + print header("$action Package Definition", menubar( 'Main Menu' => popurl(2), 'View all packages' => popurl(2). 'browse/part_pkg.cgi', -)); +), ' onLoad="visualize()"'); print qq!Error: !, $cgi->param('error'), "" @@ -72,28 +76,50 @@ print '
@@ -199,6 +348,12 @@ function fchanged(what) { function fixup(what) { <% foreach my $f ( qw( pkg comment freq ), @fixups ) { %> what.<%= $f %>.value = document.dummy.<%= $f %>.value; +<% } %> +<% foreach my $f ( qw( setuptax recurtax disabled ) ) { %> + if (document.dummy.<%= $f %>.checked) + what.<%= $f %>.value = 'Y'; + else + what.<%= $f %>.value = ''; <% } %> what.plan.value = document.dummy.plan.options[document.dummy.plan.selectedIndex].value; <% foreach my $p ( keys %plans ) { %> @@ -210,7 +365,9 @@ function fixup(what) { } -<% #foreach my $layer ( 'konq_kludge', keys %plans ) { +<% my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } + split("\n", $part_pkg->plandata ); + #foreach my $layer ( 'konq_kludge', keys %plans ) { foreach my $layer ( 'konq_kludge', keys %plans ) { my $visibility = "hidden"; %> @@ -224,10 +381,13 @@ if (document.getElementById) {