X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_pkg.cgi;h=a4123e1377c76e5b57ce032b215ab33544491709;hp=b7707f3e8cbc3bcfe5ff75e3297ef320e183ddfb;hb=a6d3e4dc73803cffad96fd4b6270b2fb5f4b0568;hpb=87b5424ee8f16f824865cd7dbf1efde8da3bd429 diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index b7707f3e8..a4123e137 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -1,23 +1,7 @@ - - -<% my $plan = 'flat'; %> - - + <% -$cgi = new CGI; - -&cgisuidsetup($cgi); - if ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) { $cgi->param('clone', $1); } else { @@ -44,16 +28,36 @@ if ( $cgi->param('clone') ) { $part_pkg ||= $old_part_pkg->clone; } elsif ( $query && $query =~ /^(\d+)$/ ) { $part_pkg ||= qsearchs('part_pkg',{'pkgpart'=>$1}); + unless ( $part_pkg->plan ) { + $part_pkg->plan('flat'); + $part_pkg->plandata("setup=". $part_pkg->setup. "\n". + "recur=". $part_pkg->recur. "\n"); + } } else { $part_pkg ||= new FS::part_pkg {}; + $part_pkg->plan('flat'); } $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'), "" @@ -136,8 +140,12 @@ my %plans = ( 'flat' => { 'name' => 'Flat rate', 'fields' => { - 'setup_fee' => { 'name' => 'Setup fee for this package' }, - 'recur_fee' => { 'name' => 'Recurring fee for this package' }, + 'setup_fee' => { 'name' => 'Setup fee for this package', + 'default' => 0, + }, + 'recur_fee' => { 'name' => 'Recurring fee for this package', + 'default' => 0, + }, }, 'setup' => 'what.setup_fee.value', 'recur' => 'what.recur_fee.value', @@ -146,13 +154,21 @@ my %plans = ( '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_fee' => { 'name' => 'Setup fee for this package', + 'default' => 0, + }, + 'recur_fee' => { 'name' => 'Recurring fee for this package', + 'default' => 0, + }, + 'comission_amount' => { 'name' => 'Comission amount', + 'default' => 0, + }, + 'comission_depth' => { 'name' => 'Number of layers', + 'default' => 1, + }, }, '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 + \';\'', + 'recur' => '\'my $error = $cust_pkg->cust_main->credit( \' + what.comission_amount.value + \' * scalar($cust_pkg->cust_main->referral_cust_pkg(\' + what.comission_depth.value+ \')), "commission" ); die $error if $error; \' + what.recur_fee.value + \';\'', }, ); @@ -160,8 +176,7 @@ my %plans = ( %>
-Price plan +