X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Flib%2FRT%2FArticles.pm;h=6800232969925b8864facd8bb39073ea541f4770;hp=8dd661d2e4c79d88b95b408be31471c9eda5cf1a;hb=919e930aa9279b3c5cd12b593889cd6de79d67bf;hpb=f3c4966ed1f6ec3db7accd6dcdd3a5a3821d72a7 diff --git a/rt/lib/RT/Articles.pm b/rt/lib/RT/Articles.pm index 8dd661d2e..680023296 100644 --- a/rt/lib/RT/Articles.pm +++ b/rt/lib/RT/Articles.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -64,33 +64,19 @@ sub _Init { return $self->SUPER::_Init( @_ ); } -=head2 Next +=head2 AddRecord -Returns the next article that this user can see. +Overrides the collection to ensure that only Articles the user can see +are returned. =cut -sub Next { +sub AddRecord { my $self = shift; + my ($record) = @_; - my $Object = $self->SUPER::Next(); - if ( ( defined($Object) ) and ( ref($Object) ) ) { - - if ( $Object->CurrentUserHasRight('ShowArticle') ) { - return ($Object); - } - - #If the user doesn't have the right to show this Object - else { - return ( $self->Next() ); - } - } - - #if there never was any queue - else { - return (undef); - } - + return unless $record->CurrentUserHasRight('ShowArticle'); + return $self->SUPER::AddRecord( $record ); } =head2 Limit { FIELD => undef, OPERATOR => '=', VALUE => 'undef'} @@ -360,6 +346,7 @@ sub LimitCustomField { QUOTEVALUE => $args{'QUOTEVALUE'}, ENTRYAGGREGATOR => 'AND', #$args{'ENTRYAGGREGATOR'}, SUBCLAUSE => $clause, + CASESENSITIVE => 0, ); $self->SUPER::Limit( ALIAS => $ObjectValuesAlias, @@ -380,6 +367,7 @@ sub LimitCustomField { QUOTEVALUE => $args{'QUOTEVALUE'}, ENTRYAGGREGATOR => $args{'ENTRYAGGREGATOR'}, SUBCLAUSE => $clause, + CASESENSITIVE => 0, ); $self->SUPER::Limit( ALIAS => $ObjectValuesAlias, @@ -389,6 +377,7 @@ sub LimitCustomField { QUOTEVALUE => $args{'QUOTEVALUE'}, ENTRYAGGREGATOR => $args{'ENTRYAGGREGATOR'}, SUBCLAUSE => $clause, + CASESENSITIVE => 0, ); } } @@ -594,7 +583,11 @@ sub Search { require Time::ParseDate; foreach my $date (qw(Created< Created> LastUpdated< LastUpdated>)) { next unless ( $args{$date} ); - my $seconds = Time::ParseDate::parsedate( $args{$date}, FUZZY => 1, PREFER_PAST => 1 ); + my ($seconds, $error) = Time::ParseDate::parsedate( $args{$date}, FUZZY => 1, PREFER_PAST => 1 ); + unless ( defined $seconds ) { + $RT::Logger->warning( + "Couldn't parse date '$args{$date}' by Time::ParseDate" ); + } my $date_obj = RT::Date->new( $self->CurrentUser ); $date_obj->Set( Format => 'unix', Value => $seconds ); $dates->{$date} = $date_obj;