[freeside-commits] freeside/FS/FS/part_event Condition.pm,1.4,1.5
Ivan,,,
ivan at wavetail.420.am
Sat Nov 22 14:17:29 PST 2008
- Previous message: [freeside-commits] freeside/FS/FS Schema.pm, 1.114, 1.115 cust_credit.pm, 1.35, 1.36 Conf.pm, 1.252, 1.253 cust_pkg.pm, 1.102, 1.103 part_event.pm, 1.2, 1.3 cust_main.pm, 1.386, 1.387
- Next message: [freeside-commits] freeside/FS/FS/part_event/Action addpost.pm, 1.1, 1.2 apply.pm, 1.1, 1.2 bill.pm, 1.1, 1.2 cancel.pm, 1.1, 1.2 collect.pm, 1.1, 1.2 cust_bill_batch.pm, 1.1, 1.2 cust_bill_comp.pm, 1.1, 1.2 cust_bill_fee_percent.pm, 1.1, 1.2 cust_bill_realtime_card.pm, 1.1, 1.2 cust_bill_realtime_check.pm, 1.1, 1.2 cust_bill_realtime_lec.pm, 1.1, 1.2 cust_bill_send_agent.pm, 1.1, 1.2 cust_bill_send_alternate.pm, 1.1, 1.2 cust_bill_send_csv_ftp.pm, 1.1, 1.2 cust_bill_send_if_newest.pm, 1.1, 1.2 cust_bill_send.pm, 1.1, 1.2 cust_bill_spool_csv.pm, 1.1, 1.2 cust_bill_suspend_if_balance.pm, 1.1, 1.2 fee.pm, 1.1, 1.2 pkg_referral_credit_pkg.pm, NONE, 1.1 pkg_referral_credit.pm, NONE, 1.1 suspend_if_pkgpart.pm, 1.1, 1.2 suspend.pm, 1.1, 1.2 suspend_unless_pkgpart.pm, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS/part_event
In directory wavetail.420.am:/tmp/cvs-serv30261/FS/FS/part_event
Modified Files:
Condition.pm
Log Message:
referral credits overhaul, use billing events, agents can self-configure, limit to once-per-customer, depend on any time from referred package, referred customer payment, specific packages, partial staged credits, RT#3983
Index: Condition.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Condition.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Condition.pm 29 Oct 2007 10:31:31 -0000 1.4
+++ Condition.pm 22 Nov 2008 22:17:27 -0000 1.5
@@ -2,7 +2,7 @@
use strict;
use base qw( FS::part_event_condition );
-
+use Time::Local qw(timelocal_nocheck);
use FS::UID qw( driver_name );
=head1 NAME
@@ -251,6 +251,40 @@
=back
+=item option_age_from OPTION FROM_TIMESTAMP
+
+Retreives a condition option, parses it from a frequency (such as "1d", "1w" or
+"12m"), and subtracts that interval from the supplied timestamp. It is
+primarily intended for use in B<condition>.
+
+=cut
+
+sub option_age_from {
+ my( $self, $option, $time ) = @_;
+ my $age = $self->option($option);
+ $age = '0m' unless length($age);
+
+ my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($time) )[0,1,2,3,4,5];
+
+ if ( $age =~ /^(\d+)m$/i ) {
+ $mon -= $1;
+ until ( $mon >= 0 ) { $mon += 12; $year--; }
+ } elsif ( $age =~ /^(\d+)y$/i ) {
+ $year -= $1;
+ } elsif ( $age =~ /^(\d+)w$/i ) {
+ $mday -= $1 * 7;
+ } elsif ( $age =~ /^(\d+)d$/i ) {
+ $mday -= $1;
+ } elsif ( $age =~ /^(\d+)h$/i ) {
+ $hour -= $hour;
+ } else {
+ die "unparsable age: $age";
+ }
+
+ timelocal_nocheck($sec,$min,$hour,$mday,$mon,$year);
+
+}
+
=item condition_sql_option OPTION
This is a class method that returns an SQL fragment for retreiving a condition
- Previous message: [freeside-commits] freeside/FS/FS Schema.pm, 1.114, 1.115 cust_credit.pm, 1.35, 1.36 Conf.pm, 1.252, 1.253 cust_pkg.pm, 1.102, 1.103 part_event.pm, 1.2, 1.3 cust_main.pm, 1.386, 1.387
- Next message: [freeside-commits] freeside/FS/FS/part_event/Action addpost.pm, 1.1, 1.2 apply.pm, 1.1, 1.2 bill.pm, 1.1, 1.2 cancel.pm, 1.1, 1.2 collect.pm, 1.1, 1.2 cust_bill_batch.pm, 1.1, 1.2 cust_bill_comp.pm, 1.1, 1.2 cust_bill_fee_percent.pm, 1.1, 1.2 cust_bill_realtime_card.pm, 1.1, 1.2 cust_bill_realtime_check.pm, 1.1, 1.2 cust_bill_realtime_lec.pm, 1.1, 1.2 cust_bill_send_agent.pm, 1.1, 1.2 cust_bill_send_alternate.pm, 1.1, 1.2 cust_bill_send_csv_ftp.pm, 1.1, 1.2 cust_bill_send_if_newest.pm, 1.1, 1.2 cust_bill_send.pm, 1.1, 1.2 cust_bill_spool_csv.pm, 1.1, 1.2 cust_bill_suspend_if_balance.pm, 1.1, 1.2 fee.pm, 1.1, 1.2 pkg_referral_credit_pkg.pm, NONE, 1.1 pkg_referral_credit.pm, NONE, 1.1 suspend_if_pkgpart.pm, 1.1, 1.2 suspend.pm, 1.1, 1.2 suspend_unless_pkgpart.pm, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list