projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0f2d107
)
per-customer prorate day, RT#17891
author
Ivan Kohler
<ivan@freeside.biz>
Fri, 3 Aug 2012 02:39:20 +0000
(19:39 -0700)
committer
Ivan Kohler
<ivan@freeside.biz>
Fri, 3 Aug 2012 02:39:20 +0000
(19:39 -0700)
FS/FS/Conf.pm
patch
|
blob
|
history
FS/FS/Schema.pm
patch
|
blob
|
history
FS/FS/cust_main.pm
patch
|
blob
|
history
FS/FS/part_pkg/prorate.pm
patch
|
blob
|
history
FS/FS/part_pkg/recur_Common.pm
patch
|
blob
|
history
httemplate/edit/cust_main/billing.html
patch
|
blob
|
history
httemplate/view/cust_main/billing.html
patch
|
blob
|
history
diff --git
a/FS/FS/Conf.pm
b/FS/FS/Conf.pm
index
37bbf6e
..
8069fb4
100644
(file)
--- a/
FS/FS/Conf.pm
+++ b/
FS/FS/Conf.pm
@@
-839,6
+839,13
@@
sub reason_type_options {
},
{
},
{
+ 'key' => 'cust_main-select-prorate_day',
+ 'section' => 'billing',
+ 'description' => 'When used with prorate or anniversary packages, allows the selection of the prorate day of month, on a per-customer basis',
+ 'type' => 'checkbox',
+ },
+
+ {
'key' => 'encryption',
'section' => 'billing',
'description' => 'Enable encryption of credit cards and echeck numbers',
'key' => 'encryption',
'section' => 'billing',
'description' => 'Enable encryption of credit cards and echeck numbers',
diff --git
a/FS/FS/Schema.pm
b/FS/FS/Schema.pm
index
cff0afd
..
a55e0f9
100644
(file)
--- a/
FS/FS/Schema.pm
+++ b/
FS/FS/Schema.pm
@@
-1050,6
+1050,7
@@
sub tables_hashref {
'email_csv_cdr', 'char', 'NULL', 1, '', '',
'accountcode_cdr', 'char', 'NULL', 1, '', '',
'billday', 'int', 'NULL', '', '', '',
'email_csv_cdr', 'char', 'NULL', 1, '', '',
'accountcode_cdr', 'char', 'NULL', 1, '', '',
'billday', 'int', 'NULL', '', '', '',
+ 'prorate_day', 'int', 'NULL', '', '', '',
'edit_subject', 'char', 'NULL', 1, '', '',
'locale', 'varchar', 'NULL', 16, '', '',
'calling_list_exempt', 'char', 'NULL', 1, '', '',
'edit_subject', 'char', 'NULL', 1, '', '',
'locale', 'varchar', 'NULL', 16, '', '',
'calling_list_exempt', 'char', 'NULL', 1, '', '',
diff --git
a/FS/FS/cust_main.pm
b/FS/FS/cust_main.pm
index
36c6280
..
1da1f0f
100644
(file)
--- a/
FS/FS/cust_main.pm
+++ b/
FS/FS/cust_main.pm
@@
-1794,6
+1794,7
@@
sub check {
|| $self->ut_floatn('cdr_termination_percentage')
|| $self->ut_floatn('credit_limit')
|| $self->ut_numbern('billday')
|| $self->ut_floatn('cdr_termination_percentage')
|| $self->ut_floatn('credit_limit')
|| $self->ut_numbern('billday')
+ || $self->ut_numbern('prorate_day')
|| $self->ut_enum('edit_subject', [ '', 'Y' ] )
|| $self->ut_enum('calling_list_exempt', [ '', 'Y' ] )
|| $self->ut_enum('invoice_noemail', [ '', 'Y' ] )
|| $self->ut_enum('edit_subject', [ '', 'Y' ] )
|| $self->ut_enum('calling_list_exempt', [ '', 'Y' ] )
|| $self->ut_enum('invoice_noemail', [ '', 'Y' ] )
diff --git
a/FS/FS/part_pkg/prorate.pm
b/FS/FS/part_pkg/prorate.pm
index
f8d03dc
..
ac86f39
100644
(file)
--- a/
FS/FS/part_pkg/prorate.pm
+++ b/
FS/FS/part_pkg/prorate.pm
@@
-44,12
+44,16
@@
use FS::part_pkg::flat;
sub calc_recur {
my $self = shift;
sub calc_recur {
my $self = shift;
- return $self->calc_prorate(@_, $self->cutoff_day) - $self->calc_discount(@_);
+ my $cust_pkg = $_[0];
+ $self->calc_prorate(@_, $self->cutoff_day($cust_pkg))
+ - $self->calc_discount(@_);
}
sub cutoff_day {
}
sub cutoff_day {
- my $self = shift;
- split(/\s*,\s*/, $self->option('cutoff_day', 1) || '1');
+ my( $self, $cust_pkg ) = @_;
+ my $prorate_day = $cust_pkg->cust_main->prorate_day;
+ $prorate_day ? ( $prorate_day )
+ : split(/\s*,\s*/, $self->option('cutoff_day', 1) || '1');
}
1;
}
1;
diff --git
a/FS/FS/part_pkg/recur_Common.pm
b/FS/FS/part_pkg/recur_Common.pm
index
9d7341b
..
03d5c2c
100644
(file)
--- a/
FS/FS/part_pkg/recur_Common.pm
+++ b/
FS/FS/part_pkg/recur_Common.pm
@@
-39,14
+39,15
@@
sub calc_setup {
sub cutoff_day {
# prorate/subscription only; we don't support sync_bill_date here
sub cutoff_day {
# prorate/subscription only; we don't support sync_bill_date here
- my $self = shift;
- my $cust_pkg = shift;
+ my( $self, $cust_pkg ) = @_;
my $recur_method = $self->option('recur_method',1) || 'anniversary';
my $recur_method = $self->option('recur_method',1) || 'anniversary';
- if ( $recur_method eq 'prorate' or $recur_method eq 'subscription' ) {
- return $self->option('cutoff_day',1) || 1;
- } else {
- return ();
- }
+ return () unless $recur_method eq 'prorate'
+ || $recur_method eq 'subscription';
+
+ #false laziness w/prorate.pm::cutoff_day
+ my $prorate_day = $cust_pkg->cust_main->prorate_day;
+ $prorate_day ? ( $prorate_day )
+ : split(/\s*,\s*/, $self->option('cutoff_day', 1) || '1');
}
sub calc_recur_Common {
}
sub calc_recur_Common {
diff --git
a/httemplate/edit/cust_main/billing.html
b/httemplate/edit/cust_main/billing.html
index
d7082f2
..
2925ca8
100644
(file)
--- a/
httemplate/edit/cust_main/billing.html
+++ b/
httemplate/edit/cust_main/billing.html
@@
-522,6
+522,17
@@
</TR>
% }
</TR>
% }
+% if ( $conf->exists('cust_main-select-prorate_day') ) {
+ <TR>
+ <TD ALIGN="right" WIDTH="200"><% mt('Prorate day (1-28)') |h %> </TD>
+ <TD>
+ <INPUT TYPE="text" NAME="prorate_day" VALUE="<% $cust_main->prorate_day %>" SIZE=3 MAXLENGTH=2>
+ </TD>
+ </TR>
+% } else {
+ <INPUT TYPE="hidden" NAME="prorate_day" VALUE="<% $cust_main->prorate_day %>">
+% }
+
<TR>
<TD ALIGN="right" WIDTH="200"><% mt('Invoice terms') |h %> </TD>
<TD WIDTH="408">
<TR>
<TD ALIGN="right" WIDTH="200"><% mt('Invoice terms') |h %> </TD>
<TD WIDTH="408">
diff --git
a/httemplate/view/cust_main/billing.html
b/httemplate/view/cust_main/billing.html
index
b2a0efd
..
5c46803
100644
(file)
--- a/
httemplate/view/cust_main/billing.html
+++ b/
httemplate/view/cust_main/billing.html
@@
-23,6
+23,14
@@
<TD BGCOLOR="#ffffff"><B><% $balance %></B></TD>
</TR>
<TD BGCOLOR="#ffffff"><B><% $balance %></B></TD>
</TR>
+% if ( $conf->exists('cust_main-select-prorate_day') ) {
+<TR>
+ <TD ALIGN="right"><% mt('Prorate day of month') |h %></TD>
+ <TD BGCOLOR="#ffffff"><% $cust_main->prorate_day %>
+ </TD>
+</TR>
+% }
+
% if ( $conf->exists('cust_main-select-billday')
% && ($cust_main->payby eq 'CARD' || $cust_main->payby eq 'CHEK') ) {
<TR>
% if ( $conf->exists('cust_main-select-billday')
% && ($cust_main->payby eq 'CARD' || $cust_main->payby eq 'CHEK') ) {
<TR>