projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9d662c9
)
prorate option to round to full day, RT#7353
author
mark
<mark>
Fri, 29 Oct 2010 08:51:51 +0000
(08:51 +0000)
committer
mark
<mark>
Fri, 29 Oct 2010 08:51:51 +0000
(08:51 +0000)
FS/FS/part_pkg/prorate.pm
patch
|
blob
|
history
FS/FS/part_pkg/prorate_Mixin.pm
patch
|
blob
|
history
diff --git
a/FS/FS/part_pkg/prorate.pm
b/FS/FS/part_pkg/prorate.pm
index
22bb809
..
218f80f
100644
(file)
--- a/
FS/FS/part_pkg/prorate.pm
+++ b/
FS/FS/part_pkg/prorate.pm
@@
-83,7
+83,11
@@
use FS::part_pkg::flat;
'for one full period after that',
'type' => 'checkbox',
},
'for one full period after that',
'type' => 'checkbox',
},
-
+ 'prorate_round_day'=> {
+ 'name' => 'When prorating first month, round to '.
+ 'the nearest full day',
+ 'type' => 'checkbox',
+ },
#it would be better if this had to be turned on, its confusing
'externalid' => { 'name' => 'Optional External ID',
#it would be better if this had to be turned on, its confusing
'externalid' => { 'name' => 'Optional External ID',
@@
-95,7
+99,7
@@
use FS::part_pkg::flat;
'recharge_amount', 'recharge_seconds', 'recharge_upbytes',
'recharge_downbytes', 'recharge_totalbytes',
'usage_rollover', 'recharge_reset', 'add_full_period',
'recharge_amount', 'recharge_seconds', 'recharge_upbytes',
'recharge_downbytes', 'recharge_totalbytes',
'usage_rollover', 'recharge_reset', 'add_full_period',
- 'externalid', ],
+ '
prorate_round_day', '
externalid', ],
'freq' => 'm',
'weight' => 20,
);
'freq' => 'm',
'weight' => 20,
);
diff --git
a/FS/FS/part_pkg/prorate_Mixin.pm
b/FS/FS/part_pkg/prorate_Mixin.pm
index
ed532ee
..
b77d898
100644
(file)
--- a/
FS/FS/part_pkg/prorate_Mixin.pm
+++ b/
FS/FS/part_pkg/prorate_Mixin.pm
@@
-66,6
+66,10
@@
sub calc_prorate {
# only works for freq >= 1 month; probably can't be fixed
my $mnow = $$sdate;
my ($sec, $min, $hour, $mday, $mon, $year) = (localtime($mnow))[0..5];
# only works for freq >= 1 month; probably can't be fixed
my $mnow = $$sdate;
my ($sec, $min, $hour, $mday, $mon, $year) = (localtime($mnow))[0..5];
+ if ( $self->option('prorate_round_day',1) ) {
+ $mday++ if $hour >= 12;
+ $mnow = timelocal(0,0,0,$mday,$mon,$year);
+ }
my $mend;
my $mstart;
if ( $mday >= $cutoff_day ) {
my $mend;
my $mstart;
if ( $mday >= $cutoff_day ) {