X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_svc.pm;h=2066a05ac2ffd973cbdca45a0a9d1412118bbab2;hb=9b61510dcd5a7e30c0c1664df619bcff0aa50f08;hp=627410729f625e6d6a3fea934ca13a3fba7ea656;hpb=0dfdc3e5dc012c1a2640ac2af22b1488cdfbd083;p=freeside.git diff --git a/FS/FS/cust_svc.pm b/FS/FS/cust_svc.pm index 627410729..2066a05ac 100644 --- a/FS/FS/cust_svc.pm +++ b/FS/FS/cust_svc.pm @@ -295,6 +295,17 @@ sub replace { # } # } + #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 ) { @@ -794,14 +805,17 @@ sub get_session_history { } -=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; @@ -810,7 +824,12 @@ sub tickets { 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 { @@ -820,10 +839,11 @@ sub tickets { last if scalar(@tickets) >= $num; push @tickets, @{ FS::TicketSystem->service_tickets( $self->svcnum, - $num - scalar(@tickets), - $priority, - ) - }; + $num - scalar(@tickets), + $priority, + $status, + ) + }; } } } @@ -890,7 +910,8 @@ sub smart_search_param { ( 'table' => 'cust_svc', 'select' => 'svc_all.svcnum AS svcnum, '. - 'COALESCE(svc_all.svcdb, part_svc.svcdb) AS svcdb', + 'COALESCE(svc_all.svcdb, part_svc.svcdb) AS svcdb, '. + 'cust_svc.*', 'addl_from' => $addl_from, 'hashref' => {}, 'extra_sql' => $extra_sql,