X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=inline;f=httemplate%2Fedit%2Fpart_pkg.cgi;h=ddd86765ab6dcd71c1d88f5b2e77cbdfe0c77bbb;hb=b39b717a2e1118dc0a62748e525ac680feb87419;hp=770facb7e242f40c7e430229cacbf54a25b1fbac;hpb=0e8861ca6b3b04b99ea9477e8c1555561b21c929;p=freeside.git diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 770facb7e..ddd86765a 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -67,9 +67,9 @@ print '
'; print "Package Part #", $hashref->{pkgpart} ? $hashref->{pkgpart} : "(NEW)"; print ntable("#cccccc",2), <Package (customer-visable) +Package (customer-visible) Comment (customer-hidden) -Frequency (months) of recurring fee +Frequency (months) of recurring fee  0=no recurring fee, 1=monthly, 3=quarterly, 12=yearly Setup fee tax exempt END @@ -89,6 +89,7 @@ print '>'; print ''; my $conf = new FS::Conf; +#false laziness w/ view/cust_main.cgi quick order if ( $conf->exists('enable_taxclasses') ) { print 'Tax class!, - qq!!; -} -print qq!
\n!; - - foreach my $f ( qw( clone pkgnum ) ) { print qq!'; } @@ -253,7 +241,7 @@ tie my %plans, 'Tie::IxHash', }, 'flat_comission_cust' => { - 'name' => 'Flat rate with recurring comission per active customer', + 'name' => 'Flat rate with recurring commission per active customer', 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, @@ -261,7 +249,7 @@ tie my %plans, 'Tie::IxHash', 'recur_fee' => { 'name' => 'Recurring fee for this package', 'default' => 0, }, - 'comission_amount' => { 'name' => 'Comission amount per month (per active customer)', + 'comission_amount' => { 'name' => 'Commission amount per month (per active customer)', 'default' => 0, }, 'comission_depth' => { 'name' => 'Number of layers', @@ -274,7 +262,7 @@ tie my %plans, 'Tie::IxHash', }, 'flat_comission' => { - 'name' => 'Flat rate with recurring comission per (any) active package', + 'name' => 'Flat rate with recurring commission per (any) active package', 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, @@ -282,7 +270,7 @@ tie my %plans, 'Tie::IxHash', 'recur_fee' => { 'name' => 'Recurring fee for this package', 'default' => 0, }, - 'comission_amount' => { 'name' => 'Comission amount per month (per active package)', + 'comission_amount' => { 'name' => 'Commission amount per month (per active package)', 'default' => 0, }, 'comission_depth' => { 'name' => 'Number of layers', @@ -295,7 +283,7 @@ tie my %plans, 'Tie::IxHash', }, 'flat_comission_pkg' => { - 'name' => 'Flat rate with recurring comission per (selected) active package', + 'name' => 'Flat rate with recurring commission per (selected) active package', 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, @@ -303,7 +291,7 @@ tie my %plans, 'Tie::IxHash', 'recur_fee' => { 'name' => 'Recurring fee for this package', 'default' => 0, }, - 'comission_amount' => { 'name' => 'Comission amount per month (per uncancelled package)', + 'comission_amount' => { 'name' => 'Commission amount per month (per uncancelled package)', 'default' => 0, }, 'comission_depth' => { 'name' => 'Number of layers', @@ -367,6 +355,37 @@ tie my %plans, 'Tie::IxHash', }, + 'sqlradacct_hour' => { + 'name' => 'Base charge plus charge per-hour from an external SQL radacct table', + 'fields' => { + 'setup_fee' => { 'name' => 'Setup fee for this package', + 'default' => 0, + }, + 'recur_flat' => { 'name' => 'Base monthly charge for this package', + 'default' => 0, + }, + 'sql_datasrc' => { 'name' => 'DBI data source', + 'default' => 'DBI:mysql:host=radius.server.name;dbname=radius', + }, + 'sql_username' => { 'name' => 'Database username', + 'default' => 'radius', + }, + 'sql_password' => { 'name' => 'Database password', + 'default' => '', + }, + 'recur_included_hours' => { 'name' => 'Hours included', + 'default' => 0, + }, + 'recur_hourly_charge' => { 'name' => 'Additional charge per hour', + 'default' => 0, + }, + }, + 'fieldorder' => [ 'setup_fee', 'recur_flat', 'recur_included_hours', 'recur_hourly_charge' ], + 'setup' => 'what.setup_fee.value', + 'recur' => '\'my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($sdate))[0,1,2,3,4,5]; $mon+=$part_pkg->freq; until ($mon<12) { $mon-=12; $year++ }; $edate = timelocal($sec,$min,$hour,$mday,$mon,$year); my $hours = $cust_pkg->seconds_since_sqlradacct($sdate, $edate, \' + what.sql_datasrc + \', \' + what.sql_username + \', \' + what.sql_password + \' ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours;\'', + }, + + ; my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } @@ -389,7 +408,7 @@ my $widget = new HTML::Widgets::SelectLayers( 'form_action' => 'process/part_pkg.cgi', 'form_text' => [ qw(pkg comment freq clone pkgnum pkgpart), @fixups ], 'form_checkbox' => [ qw(setuptax recurtax disabled) ], - 'form_select' => [ qw(def_svcpart), @form_select ], + 'form_select' => [ @form_select ], 'fixup_callback' => sub { #my $ = @_; my $html = '';