X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fsesmon_hour.pm;h=8d019c306c3710e320fa1940c1ad483c8a3830de;hb=2a54fd15d357ce97c8becef00d19ed1f711c1c6a;hp=9843edbec3e2de6d7c6e4724a070034b6c819a95;hpb=c8cccb4a92adceb943c635fe62dad0d034462ce0;p=freeside.git diff --git a/FS/FS/part_pkg/sesmon_hour.pm b/FS/FS/part_pkg/sesmon_hour.pm index 9843edbec..8d019c306 100644 --- a/FS/FS/part_pkg/sesmon_hour.pm +++ b/FS/FS/part_pkg/sesmon_hour.pm @@ -8,18 +8,11 @@ use FS::part_pkg::flat; @ISA = qw(FS::part_pkg::flat); %info = ( + 'disabled' => 1, #internal session db deprecated (or at least on hold) 'name' => 'Base charge plus charge per-hour from the session monitor', + 'shortname' => 'Session monitor (per-hour)', + 'inherit_fields' => [ 'global_Mixin' ], 'fields' => { - 'setup_fee' => { 'name' => 'Setup fee for this package', - 'default' => 0, - }, - 'recur_flat' => { 'name' => 'Base recurring fee for this package', - 'default' => 0, - }, - 'unused_credit' => { 'name' => 'Credit the customer for the unused portion'. - ' of service at cancellation', - 'type' => 'checkbox', - }, 'recur_included_hours' => { 'name' => 'Hours included', 'default' => 0, }, @@ -27,12 +20,19 @@ use FS::part_pkg::flat; 'default' => 0, }, }, - 'fieldorder' => [ 'setup_fee', 'recur_flat', 'unused_credit', 'recur_included_hours', 'recur_hourly_charge' ], + 'fieldorder' => [ 'recur_included_hours', 'recur_hourly_charge' ], #'setup' => 'what.setup_fee.value', - #'recur' => '\'my $hours = $cust_pkg->seconds_since($cust_pkg->bill || 0) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours;\'', + #'recur' => '\'my $hours = $cust_pkg->seconds_since($cust_pkg->bill || 0) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; \' + what.recur_fee.value + \' + \' + what.recur_hourly_charge.value + \' * $hours;\'', 'weight' => 80, ); +sub price_info { + my $self = shift; + my $str = $self->SUPER::price_info; + $str .= " plus usage" if $str; + $str; +} + sub calc_recur { my($self, $cust_pkg ) = @_; @@ -40,17 +40,19 @@ sub calc_recur { $hours -= $self->option('recur_included_hours'); $hours = 0 if $hours < 0; - $self->option('recur_flat') + $hours * $self->option('recur_hourly_charge'); + $self->option('recur_fee') + $hours * $self->option('recur_hourly_charge'); } +sub can_discount { 0; } + sub is_free_options { qw( setup_fee recur_fee recur_hourly_charge ); } sub base_recur { my($self, $cust_pkg) = @_; - $self->option('recur_flat'); + $self->option('recur_fee'); } 1;