multi-currency, RT#21565
[freeside.git] / FS / FS / part_pkg / currency_fixed.pm
1 package FS::part_pkg::currency_fixed;
2 #can't discount yet
3 #use base qw( FS::part_pkg::discount_Mixin FS::part_pkg::recur_Common );
4 use base qw( FS::part_pkg::recur_Common );
5
6 use strict;
7 use vars qw( %info );
8 #use FS::Record qw(qsearch qsearchs);
9
10 %info = (
11   'name' => 'Per-currency pricing from package definitions',
12   'shortname' => 'Per-currency pricing',
13   'inherit_fields' => [ 'prorate_Mixin', 'global_Mixin' ],
14   'fields' => {
15     'cutoff_day'    => { 'name' => 'Billing Day (1 - 28) for prorating or '.
16                                    'subscription',
17                          'default' => '1',
18                        },
19
20     'recur_method'  => { 'name' => 'Recurring fee method',
21                          #'type' => 'radio',
22                          #'options' => \%recur_method,
23                          'type' => 'select',
24                          'select_options' => \%FS::part_pkg::recur_Common::recur_method,
25                        },
26   },
27   'fieldorder' => [qw( recur_method cutoff_day ),
28                    FS::part_pkg::prorate_Mixin::fieldorder,
29                   )],
30   'weight' => '59',
31 );
32
33 sub price_info {
34     my $self = shift;
35     my $str = $self->SUPER::price_info;
36     $str .= " (or local currency pricing)" if $str;
37     $str;
38 }
39
40 #some false laziness w/recur_Common, could have been better about it.. pry when
41 # we do discounting
42 sub calc_setup {
43   my($self, $cust_pkg, $sdate, $details, $param) = @_;
44
45   return 0 if $self->prorate_setup($cust_pkg, $sdate);
46
47   sprintf('%.2f', $cust_pkg->part_pkg_currency_option('setup_fee') );
48 }
49
50 sub base_recur {
51   my( $self, $cust_pkg ) = @_;
52   sprintf('%.2f', $cust_pkg->part_pkg_currency_option('recur_fee') );
53 }
54
55 sub can_discount { 0; } #can't discount yet (percentage would work, but amount?)
56 sub calc_recur {
57   my $self = shift;
58   #my($cust_pkg, $sdate, $details, $param ) = @_;
59   #$self->calc_recur_Common($cust_pkg,$sdate,$details,$param);
60   $self->calc_recur_Common(@_);
61 }
62
63 sub is_free { 0; }
64
65 sub can_currency_exchange { 1; }
66
67 1;