From: ivan Date: Thu, 11 Oct 2001 17:44:33 +0000 (+0000) Subject: "price plans" UP support.CVS: --------------------------------------------------... X-Git-Tag: freeside_1_4_0pre11~286 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=5820f3d7ca493e3e6318efe6e8e677b71b01c1ad "price plans" UP support.CVS: ---------------------------------------------------------------------- --- diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 4813fdf8b..b7707f3e8 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -1,16 +1,18 @@ + + +<% my $plan = 'flat'; %> + + + <% -# - -use strict; -use vars qw( $cgi $part_pkg $action $query $hashref $part_svc $count ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs fields); -use FS::part_pkg; -use FS::part_svc; -use FS::pkg_svc; -use FS::CGI qw(header menubar popurl); $cgi = new CGI; @@ -27,9 +29,9 @@ if ( $cgi->param('pkgnum') && $cgi->param('pkgnum') =~ /^(\d+)$/ ) { $cgi->param('pkgnum', ''); } -($query) = $cgi->keywords; -$action = ''; -$part_pkg = ''; +my ($query) = $cgi->keywords; +my $action = ''; +my $part_pkg = ''; if ( $cgi->param('error') ) { $part_pkg = new FS::part_pkg ( { map { $_, scalar($cgi->param($_)) } fields('part_pkg') @@ -46,9 +48,9 @@ if ( $cgi->param('clone') ) { $part_pkg ||= new FS::part_pkg {}; } $action ||= $part_pkg->pkgpart ? 'Edit' : 'Add'; -$hashref = $part_pkg->hashref; +my $hashref = $part_pkg->hashref; -print $cgi->header( '-expires' => 'now' ), header("$action Package Definition", menubar( +print header("$action Package Definition", menubar( 'Main Menu' => popurl(2), 'View all packages' => popurl(2). 'browse/part_pkg.cgi', )); @@ -57,24 +59,24 @@ print qq!Error: !, $cgi->param('error'), "" if $cgi->param('error'); -print '
'; - -if ( $cgi->param('clone') ) { - print qq!!; -} -if ( $cgi->param('pkgnum') ) { - print qq!!; -} +#print ''; +print ''; -print qq!!, - "Package Part #", $hashref->{pkgpart} ? $hashref->{pkgpart} : "(NEW)"; +#if ( $cgi->param('clone') ) { +# print qq!!; +#} +#if ( $cgi->param('pkgnum') ) { +# print qq!!; +#} +# +#print qq!!, +print "Package Part #", $hashref->{pkgpart} ? $hashref->{pkgpart} : "(NEW)"; print < Package (customer-visable) Comment (customer-hidden) -Setup fee for this package -Recurring fee for this package + Frequency (months) of recurring fee @@ -89,8 +91,9 @@ Enter the quantity of each service this package includes.

END } -$count = 0; -foreach $part_svc ( ( qsearch( 'part_svc', {} ) ) ) { +my $count = 0; +my @fixups = (); +foreach my $part_svc ( ( qsearch( 'part_svc', {} ) ) ) { my $svcpart = $part_svc->svcpart; my $pkg_svc = qsearchs( 'pkg_svc', { 'pkgpart' => $cgi->param('clone') || $part_pkg->pkgpart, @@ -102,6 +105,8 @@ foreach $part_svc ( ( qsearch( 'part_svc', {} ) ) ) { }); #? #next unless $pkg_svc; + push @fixups, "pkg_svc$svcpart"; + unless ( defined ($cgi->param('clone')) && $cgi->param('clone') ) { print '' if $count == 0 ; print qq!"; } +# prolly should be in database +my %plans = ( + + 'flat' => { + 'name' => 'Flat rate', + 'fields' => { + 'setup_fee' => { 'name' => 'Setup fee for this package' }, + 'recur_fee' => { 'name' => 'Recurring fee for this package' }, + }, + 'setup' => 'what.setup_fee.value', + 'recur' => 'what.recur_fee.value', + }, + + 'flat_comission' => { + 'name' => 'Flat rate with recurring referral comission as credit', + 'fields' => { + 'setup_fee' => { 'name' => 'Setup fee for this package' }, + 'recur_fee' => { 'name' => 'Recurring fee for this package' }, + 'comission_amount' => { 'name' => 'Comission amount' }, + 'comission_depth' => { 'name' => 'Number of layers' }, + }, + 'setup' => 'what.setup_fee.value', + 'recur' => '\'$cust_pkg->cust_main->credit( \' + what.comission_amount.value + \' * scalar($cust_pkg->cust_main->referral_cust_pkg(\' + what.comission_depth.value+ \')), "commission" ) ; \' + what.recur_fee.value + \';\'', + }, + +); + +%> + + +
+Price plan + + + +<% #foreach my $layer ( 'konq_kludge', keys %plans ) { + foreach my $layer ( 'konq_kludge', keys %plans ) { + my $visibility = "hidden"; +%> + + +
+ + + + +<% foreach my $f ( @fixups ) { %> + +<% } %> + +<% +if ( $cgi->param('clone') ) { + print qq!!; +} +if ( $cgi->param('pkgnum') ) { + print qq!!; +} +print qq!!, +%> + +<% my $href = $plans{$layer}->{'fields'}; + foreach my $field ( keys %{ $href } ) { %> +<%= $href->{$field}{'name'} %>: +
+<% } %> + + +Setup expression
+Recurring espression
+
+ +<% print qq!
!; + qq!" onClick="fchanged(this)">!; +%> -print < + + + + +<% } %> + + -END - -%>