use FS::cust_main;
use FS::cust_pkg;
use FS::cust_bill;
+use FS::cust_pay;
use FS::svc_acct;
$DEBUG = 0;
sub table { 'cust_event'; }
-sub cust_linked { $_[0]->cust_main_custnum; }
+sub cust_linked { $_[0]->cust_main_custnum || $_[0]->custnum }
sub cust_unlinked_msg {
my $self = shift;
"WARNING: can't find cust_main.custnum ". $self->custnum;
JOIN part_event USING ( eventpart )
LEFT JOIN cust_bill ON ( eventtable = 'cust_bill' AND tablenum = invnum )
LEFT JOIN cust_pkg ON ( eventtable = 'cust_pkg' AND tablenum = pkgnum )
-
+ LEFT JOIN cust_pay ON ( eventtable = 'cust_pay' AND tablenum = paynum )
LEFT JOIN cust_svc ON ( eventtable = 'svc_acct' AND tablenum = svcnum )
LEFT JOIN cust_pkg AS cust_pkg_for_svc ON ( cust_svc.pkgnum = cust_pkg_for_svc.pkgnum )
- LEFT JOIN cust_main ON ( ( eventtable = 'cust_main' AND tablenum = cust_main.custnum )
- OR ( eventtable = 'cust_bill' AND cust_bill.custnum = cust_main.custnum )
- OR ( eventtable = 'cust_pkg' AND cust_pkg.custnum = cust_main.custnum )
- OR ( eventtable = 'svc_acct' AND cust_pkg_for_svc.custnum = cust_main.custnum )
- )
+ LEFT JOIN cust_main ON (
+ ( eventtable = 'cust_main' AND tablenum = cust_main.custnum )
+ OR ( eventtable = 'cust_bill' AND cust_bill.custnum = cust_main.custnum )
+ OR ( eventtable = 'cust_pkg' AND cust_pkg.custnum = cust_main.custnum )
+ OR ( eventtable = 'cust_pay' AND cust_pay.custnum = cust_main.custnum )
+ OR ( eventtable = 'svc_acct' AND cust_pkg_for_svc.custnum = cust_main.custnum )
+ )
";
}
=item ending
-=item payby
-
-=item
-
=back
=cut
"tablenum = '$1'";
}
+ if ( $param->{'paynum'} =~ /^(\d+)$/ ) {
+ push @search, "part_event.eventtable = 'cust_pay'",
+ "tablenum = '$1'";
+ }
+
if ( $param->{'svcnum'} =~ /^(\d+)$/ ) {
push @search, "part_event.eventtable = 'svc_acct'",
"tablenum = '$1'";
process_re_X('fax', @_);
}
-use Storable qw(thaw);
use Data::Dumper;
-use MIME::Base64;
sub process_re_X {
- my( $method, $job ) = ( shift, shift );
-
- my $param = thaw(decode_base64(shift));
+ my( $method, $job, $param ) = @_;
warn Dumper($param) if $DEBUG;
re_X(
my $cust_X = $cust_event->cust_X; # cust_bill
next unless $cust_X->can($method);
- $cust_X->$method( $cust_event->part_event->templatename
- || $cust_X->agent_template
- );
+ my $part_event = $cust_event->part_event;
+ my $template = $part_event->templatename
+ || $cust_X->agent_template;
+ my $modenum = $part_event->option('modenum') || '';
+ my $invoice_from = $part_event->option('agent_invoice_from') || '';
+ $cust_X->set('mode' => $modenum);
+ $cust_X->$method( { template => $template,
+ modenum => $modenum,
+ from => $invoice_from,
+ } );
if ( $job ) { #progressbar foo
$num++;