# }
# }
+ #trigger a pkg_change export on pkgnum changes
+ if ( $new->pkgnum != $old->pkgnum ) {
+ my $error = $new->svc_x->export('pkg_change', $new->cust_pkg,
+ $old->cust_pkg,
+ );
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $error if $error;
+ }
+ }
+
#my $error = $new->SUPER::replace($old, @_);
my $error = $new->SUPER::replace($old);
if ( $error ) {
}
-=item tickets
+=item tickets [ STATUS ]
Returns an array of hashes representing the tickets linked to this service.
+An optional status (or arrayref or hashref of statuses) may be specified.
+
=cut
sub tickets {
my $self = shift;
+ my $status = ( @_ && $_[0] ) ? shift : '';
my $conf = FS::Conf->new;
my $num = $conf->config('cust_main-max_tickets') || 10;
if ( $conf->config('ticket_system') ) {
unless ( $conf->config('ticket_system-custom_priority_field') ) {
- @tickets = @{ FS::TicketSystem->service_tickets($self->svcnum, $num) };
+ @tickets = @{ FS::TicketSystem->service_tickets( $self->svcnum,
+ $num,
+ undef,
+ $status,
+ )
+ };
} else {
last if scalar(@tickets) >= $num;
push @tickets,
@{ FS::TicketSystem->service_tickets( $self->svcnum,
- $num - scalar(@tickets),
- $priority,
- )
- };
+ $num - scalar(@tickets),
+ $priority,
+ $status,
+ )
+ };
}
}
}