}
}
- # FS::geocode_Mixin::after_insert or something?
- if ( $conf->config('tax_district_method') and !$import ) {
- # if anything non-empty, try to look it up
- my $queue = new FS::queue {
- 'job' => 'FS::geocode_Mixin::process_district_update',
- 'custnum' => $self->custnum,
- };
- my $error = $queue->insert( ref($self), $self->custnum );
- if ( $error ) {
- $dbh->rollback if $oldAutoCommit;
- return "queueing tax district update: $error";
- }
- }
-
# cust_main exports!
warn " exporting\n" if $DEBUG > 1;
sub unsuspend {
my $self = shift;
- grep { ($_->get('setup')) && $_->unsuspend } $self->suspended_pkgs;
+ grep { ($_->get('setup')) && $_->unsuspend } $self->suspended_pkgs(@_);
}
=item release_hold
classnum of 0 is given, contacts with a null classnum are also included.
Arguments may also contain the dest flag names 'invoice' or 'message'.
-If given, contacts who's invoice_dest and/or invoice_message flags are
+If given, contacts who's invoice_dest and/or message_dest flags are
not set to 'Y' will be excluded.
=cut
# WHERE ...
# AND (
- # ( cust_contact.classnum IN (1,2,3) )
- # OR
- # ( cust_contact.classnum IS NULL )
- #
+ # (
+ # cust_contact.classnum IN (1,2,3)
+ # OR
+ # cust_contact.classnum IS NULL
+ # )
# AND (
- # ( cust_contact.invoice_dest = 'Y' )
+ # cust_contact.invoice_dest = 'Y'
# OR
- # ( cust_contact.message_dest = 'Y' )
+ # cust_contact.message_dest = 'Y'
# )
# )
$search->{extra_sql} .= ' AND ( ';
if (@or_classnum) {
- $search->{extra_sql} .= join ' OR ', map {" ($_) "} @or_classnum;
+ $search->{extra_sql} .= ' ( ';
+ $search->{extra_sql} .= join ' OR ', map {" $_ "} @or_classnum;
+ $search->{extra_sql} .= ' ) ';
$search->{extra_sql} .= ' AND ( ' if @and_dest;
}
if (@and_dest) {
- $search->{extra_sql} .= join ' OR ', map {" ($_) "} @and_dest;
+ $search->{extra_sql} .= join ' OR ', map {" $_ "} @and_dest;
$search->{extra_sql} .= ' ) ' if @or_classnum;
}
$param->{'fatal'} = 1; # runs from job queue, will be caught
$param->{'retry'} = 1;
- $cust_main->bill_and_collect( %$param );
+ local $@;
+ eval { $cust_main->bill_and_collect( %$param) };
+ if ( $@ ) {
+ die $@ =~ /cancel_pkgs cannot be run inside a transaction/
+ ? "Bill Now unavailable for customer with pending package expiration\n"
+ : $@;
+ }
}
=item pending_invoice_count