[freeside-commits] branch FREESIDE_4_BRANCH updated. d11b7a6d930140a7487546727e5a1e9423fc83f4
Mark Wells
mark at 420.am
Wed Jul 15 13:29:05 PDT 2015
The branch, FREESIDE_4_BRANCH has been updated
via d11b7a6d930140a7487546727e5a1e9423fc83f4 (commit)
from 02ca2b327abd13fb7a05422a936792d20b1f3eaf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d11b7a6d930140a7487546727e5a1e9423fc83f4
Author: Mark Wells <mark at freeside.biz>
Date: Wed Jul 15 13:13:44 2015 -0700
let selfservice users view tickets linked to their services, #33241
diff --git a/FS/FS/TicketSystem/RT_Internal.pm b/FS/FS/TicketSystem/RT_Internal.pm
index d0913d8..6fb2c18 100644
--- a/FS/FS/TicketSystem/RT_Internal.pm
+++ b/FS/FS/TicketSystem/RT_Internal.pm
@@ -454,23 +454,21 @@ sub get_ticket_object {
my $self = shift;
my ($session, %opt) = @_;
$session = $self->session(shift);
- my $Ticket = RT::Ticket->new($session->{CurrentUser});
- $Ticket->Load($opt{'ticket_id'});
- return if ( !$Ticket->id );
- my $custnum = $opt{'custnum'};
- if ( defined($custnum) && $custnum =~ /^\d+$/ ) {
- # probably the most efficient way to check ticket ownership
- my $Link = RT::Link->new($session->{CurrentUser});
- $Link->LoadByCols( LocalBase => $opt{'ticket_id'},
- Type => 'MemberOf',
- Target => "freeside://freeside/cust_main/$custnum",
- );
- return if ( !$Link->id );
+ # use a small search here so we can check ticket ownership
+ my $query;
+ if ( $opt{'ticket_id'} =~ /^(\d+)$/ ) {
+ $query = "id = $1";
+ } else {
+ return;
+ }
+ if ( $opt{'custnum'} =~ /^(\d+)$/ ) {
+ $query .= " AND Customer.number = $1"; # also checks ownership via services
}
- return $Ticket;
+ my $Tickets = RT::Tickets->new($session->{CurrentUser});
+ $Tickets->FromSQL($query);
+ return $Tickets->First;
}
-
=item correspond_ticket SESSION_HASHREF, OPTION => VALUE ...
Class method. Correspond on a ticket. If there is an error, returns the scalar
-----------------------------------------------------------------------
Summary of changes:
FS/FS/TicketSystem/RT_Internal.pm | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
More information about the freeside-commits
mailing list