[freeside-commits] freeside/FS/FS/Misc DateTime.pm,1.1,1.2
Ivan,,,
ivan at wavetail.420.am
Fri Aug 5 16:20:05 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/FS/Misc
In directory wavetail.420.am:/tmp/cvs-serv14596/FS/FS/Misc
Modified Files:
DateTime.pm
Log Message:
honor next-bill-ignore-time when searching for customers to bill also, RT#12570
Index: DateTime.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Misc/DateTime.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- DateTime.pm 9 Apr 2010 08:18:24 -0000 1.1
+++ DateTime.pm 5 Aug 2011 23:20:03 -0000 1.2
@@ -2,12 +2,13 @@
use base qw( Exporter );
use vars qw( @EXPORT_OK );
+use POSIX;
use Carp;
use Date::Parse;
use DateTime::Format::Natural;
use FS::Conf;
- at EXPORT_OK = qw( parse_datetime );
+ at EXPORT_OK = qw( parse_datetime day_end );
=head1 NAME
@@ -55,6 +56,28 @@
}
+=item day_end TIME
+
+If the next-bill-ignore-time configuration setting is turned off, just
+returns the passed-in value.
+
+If the next-bill-ignore-time configuration setting is turned on, parses TIME
+as an integer UNIX timestamp and returns a new timestamp with the same date but
+23:59:59 for the time.
+
+=cut
+
+sub day_end {
+ my $time = shift;
+
+ my $conf = new FS::Conf;
+ return $time unless $conf->exists('next-bill-ignore-time');
+
+ my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
+ localtime($time);
+ mktime(59,59,23,$mday,$mon,$year,$wday,$yday,$isdst);
+}
+
=back
=head1 BUGS
More information about the freeside-commits
mailing list