X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_event.pm;h=c98c3f87a4a5cf53be022c44f355061042a42489;hb=f9a181e4c2e505df84de16190ee3b75011326f3f;hp=d0ab65e3f0f42315d05a33544143b6d49b01e14c;hpb=5e05724a635a22776f1b973f5d7e77989da4e048;p=freeside.git diff --git a/FS/FS/part_event.pm b/FS/FS/part_event.pm index d0ab65e3f..c98c3f87a 100644 --- a/FS/FS/part_event.pm +++ b/FS/FS/part_event.pm @@ -52,7 +52,7 @@ following fields are currently supported: =item event - event name -=item eventtable - table name against which this event is triggered; currently "cust_bill" (the traditional invoice events), "cust_main" (customer events) or "cust_pkg (package events) +=item eventtable - table name against which this event is triggered; currently "cust_bill" (the traditional invoice events), "cust_main" (customer events) or "cust_pkg (package events) (or "cust_statement") =item check_freq - how often events of this type are checked; currently "1d" (daily) and "1m" (monthly) are recognized. Note that the apprioriate freeside-daily and/or freeside-monthly cron job needs to be in place. @@ -133,7 +133,7 @@ sub check { my $error = $self->ut_numbern('eventpart') || $self->ut_text('event') - || $self->ut_enum('eventtable', [ 'cust_bill', 'cust_main', 'cust_pkg' ] ) + || $self->ut_enum('eventtable', [ $self->eventtables ] ) || $self->ut_enum('check_freq', [ '1d', '1m' ]) || $self->ut_number('weight') || $self->ut_alpha('action') @@ -273,6 +273,7 @@ sub eventtable_labels { 'cust_bill' => 'Invoice', 'cust_main' => 'Customer', 'cust_pay_batch' => 'Batch payment', + 'cust_statement' => 'Statement', #too general a name here? "Invoice group"? ; \%hash @@ -286,18 +287,33 @@ i.e. 'cust_main'=>'cust_main.custnum' =cut sub eventtable_pkey_sql { - #my $class = shift; + my $class = shift; - my %hash = ( - 'cust_main' => 'cust_main.custnum', - 'cust_bill' => 'cust_bill.invnum', - 'cust_pkg' => 'cust_pkg.pkgnum', - 'cust_pay_batch' => 'cust_pay_batch.paybatchnum', - ); + my $hashref = $class->eventtable_pkey; + + my %hash = map { $_ => "$_.". $hashref->{$_} } keys %$hashref; \%hash; } +=item eventtable_pkey + +Returns a hash reference of full SQL primary key names for eventtable values, +i.e. 'cust_main'=>'custnum' + +=cut + +sub eventtable_pkey { + #my $class = shift; + + { + 'cust_main' => 'custnum', + 'cust_bill' => 'invnum', + 'cust_pkg' => 'pkgnum', + 'cust_pay_batch' => 'paybatchnum', + 'cust_statement' => 'statementnum', + }; +} =item eventtables