Commit 78d40104 authored by Jesse Vincent's avatar Jesse Vincent Committed by Alex Vandiver
Browse files

Merge of data from the old generated lib classes

parent 24d4e4e4
......@@ -63,6 +63,10 @@
package RT::ACE;
use base 'RT::Record';
sub Table {'ACL'}
use strict;
no warnings qw(redefine);
......@@ -578,4 +582,169 @@ sub _ParseObjectArg {
}
# }}}
=head2 id
Returns the current value of id.
(In the database, id is stored as int(11).)
=cut
=head2 PrincipalType
Returns the current value of PrincipalType.
(In the database, PrincipalType is stored as varchar(25).)
=head2 SetPrincipalType VALUE
Set PrincipalType to VALUE.
Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
(In the database, PrincipalType will be stored as a varchar(25).)
=cut
=head2 PrincipalId
Returns the current value of PrincipalId.
(In the database, PrincipalId is stored as int(11).)
=head2 SetPrincipalId VALUE
Set PrincipalId to VALUE.
Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
(In the database, PrincipalId will be stored as a int(11).)
=cut
=head2 RightName
Returns the current value of RightName.
(In the database, RightName is stored as varchar(25).)
=head2 SetRightName VALUE
Set RightName to VALUE.
Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
(In the database, RightName will be stored as a varchar(25).)
=cut
=head2 ObjectType
Returns the current value of ObjectType.
(In the database, ObjectType is stored as varchar(25).)
=head2 SetObjectType VALUE
Set ObjectType to VALUE.
Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
(In the database, ObjectType will be stored as a varchar(25).)
=cut
=head2 ObjectId
Returns the current value of ObjectId.
(In the database, ObjectId is stored as int(11).)
=head2 SetObjectId VALUE
Set ObjectId to VALUE.
Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
(In the database, ObjectId will be stored as a int(11).)
=cut
=head2 DelegatedBy
Returns the current value of DelegatedBy.
(In the database, DelegatedBy is stored as int(11).)
=head2 SetDelegatedBy VALUE
Set DelegatedBy to VALUE.
Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
(In the database, DelegatedBy will be stored as a int(11).)
=cut
=head2 DelegatedFrom
Returns the current value of DelegatedFrom.
(In the database, DelegatedFrom is stored as int(11).)
=head2 SetDelegatedFrom VALUE
Set DelegatedFrom to VALUE.
Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
(In the database, DelegatedFrom will be stored as a int(11).)
=cut
sub _CoreAccessible {
{
id =>
{read => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => ''},
PrincipalType =>
{read => 1, write => 1, sql_type => 12, length => 25, is_blob => 0, is_numeric => 0, type => 'varchar(25)', default => ''},
PrincipalId =>
{read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'},
RightName =>
{read => 1, write => 1, sql_type => 12, length => 25, is_blob => 0, is_numeric => 0, type => 'varchar(25)', default => ''},
ObjectType =>
{read => 1, write => 1, sql_type => 12, length => 25, is_blob => 0, is_numeric => 0, type => 'varchar(25)', default => ''},
ObjectId =>
{read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'},
DelegatedBy =>
{read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'},
DelegatedFrom =>
{read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'},
}
};
RT::Base->_ImportOverlays();
1;
......@@ -65,6 +65,11 @@ my $ACL = RT::ACL->new($CurrentUser);
package RT::ACL;
use RT::ACE;
use base 'RT::SearchBuilder';
sub Table { 'ACL'}
use strict;
no warnings qw(redefine);
......@@ -310,4 +315,19 @@ sub HasEntry {
}
}
# }}}
=head2 NewItem
Returns an empty new RT::ACE item
=cut
sub NewItem {
my $self = shift;
return(RT::ACE->new($self->CurrentUser));
}
RT::Base->_ImportOverlays();
1;
......@@ -45,11 +45,13 @@
# those contributions and any derivatives thereof.
#
# END BPS TAGGED BLOCK }}}
package RT::Article;
use strict;
use warnings;
package RT::Article;
no warnings qw/redefine/;
use base 'RT::Record';
use RT::Articles;
use RT::ObjectTopics;
......@@ -59,6 +61,9 @@ use RT::CustomFields;
use RT::URI::fsck_com_article;
use RT::Transactions;
sub Table {'Articles'}
# This object takes custom fields
use RT::CustomField;
......@@ -659,4 +664,207 @@ sub LoadByInclude {
}
=head2 id
Returns the current value of id.
(In the database, id is stored as int(11).)
=cut
=head2 Name
Returns the current value of Name.
(In the database, Name is stored as varchar(255).)
=head2 SetName VALUE
Set Name to VALUE.
Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
(In the database, Name will be stored as a varchar(255).)
=cut
=head2 Summary
Returns the current value of Summary.
(In the database, Summary is stored as varchar(255).)
=head2 SetSummary VALUE
Set Summary to VALUE.
Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
(In the database, Summary will be stored as a varchar(255).)
=cut
=head2 SortOrder
Returns the current value of SortOrder.
(In the database, SortOrder is stored as int(11).)
=head2 SetSortOrder VALUE
Set SortOrder to VALUE.
Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
(In the database, SortOrder will be stored as a int(11).)
=cut
=head2 Class
Returns the current value of Class.
(In the database, Class is stored as int(11).)
=head2 SetClass VALUE
Set Class to VALUE.
Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
(In the database, Class will be stored as a int(11).)
=cut
=head2 ClassObj
Returns the Class Object which has the id returned by Class
=cut
sub ClassObj {
my $self = shift;
my $Class = RT::Class->new($self->CurrentUser);
$Class->Load($self->Class());
return($Class);
}
=head2 Parent
Returns the current value of Parent.
(In the database, Parent is stored as int(11).)
=head2 SetParent VALUE
Set Parent to VALUE.
Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
(In the database, Parent will be stored as a int(11).)
=cut
=head2 URI
Returns the current value of URI.
(In the database, URI is stored as varchar(255).)
=head2 SetURI VALUE
Set URI to VALUE.
Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
(In the database, URI will be stored as a varchar(255).)
=cut
=head2 Creator
Returns the current value of Creator.
(In the database, Creator is stored as int(11).)
=cut
=head2 Created
Returns the current value of Created.
(In the database, Created is stored as datetime.)
=cut
=head2 LastUpdatedBy
Returns the current value of LastUpdatedBy.
(In the database, LastUpdatedBy is stored as int(11).)
=cut
=head2 LastUpdated
Returns the current value of LastUpdated.
(In the database, LastUpdated is stored as datetime.)
=cut
sub _CoreAccessible {
{
id =>
{read => 1, type => 'int(11)', default => ''},
Name =>
{read => 1, write => 1, type => 'varchar(255)', default => ''},
Summary =>
{read => 1, write => 1, type => 'varchar(255)', default => ''},
SortOrder =>
{read => 1, write => 1, type => 'int(11)', default => '0'},
Class =>
{read => 1, write => 1, type => 'int(11)', default => '0'},
Parent =>
{read => 1, write => 1, type => 'int(11)', default => '0'},
URI =>
{read => 1, write => 1, type => 'varchar(255)', default => ''},
Creator =>
{read => 1, auto => 1, type => 'int(11)', default => '0'},
Created =>
{read => 1, auto => 1, type => 'datetime', default => ''},
LastUpdatedBy =>
{read => 1, auto => 1, type => 'int(11)', default => '0'},
LastUpdated =>
{read => 1, auto => 1, type => 'datetime', default => ''},
}
};
RT::Base->_ImportOverlays();
1;
1;
......@@ -46,10 +46,13 @@
#
# END BPS TAGGED BLOCK }}}
use strict;
use warnings;
package RT::Articles;
no warnings qw/redefine/;
use base 'RT::SearchBuilder';
sub Table {'Articles'}
=head2 Next
......@@ -542,5 +545,363 @@ sub LimitAppliedClasses {
}
sub Search {
my $self = shift;
my %args = @_;
my $customfields = $args{CustomFields}
|| RT::CustomFields->new( $self->CurrentUser );
my $dates = $args{Dates} || {};
my $order_by = $args{OrderBy};
my $order = $args{Order};
if ( $args{'q'} ) {
$self->Limit(
FIELD => 'Name',
SUBCLAUSE => 'NameOrSummary',
OPERATOR => 'LIKE',
ENTRYAGGREGATOR => 'OR',
CASESENSITIVE => 0,
VALUE => $args{'q'}
);
$self->Limit(
FIELD => 'Summary',
SUBCLAUSE => 'NameOrSummary',
OPERATOR => 'LIKE',
ENTRYAGGREGATOR => 'OR',
CASESENSITIVE => 0,
VALUE => $args{'q'}
);
}
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 $date_obj = RT::Date->new( $self->CurrentUser );
$date_obj->Set( Format => 'unix', Value => $seconds );
$dates->{$date} = $date_obj;
if ( $date =~ /^(.*?)<$/i ) {
$self->Limit(
FIELD => $1,
OPERATOR => "<=",
ENTRYAGGREGATOR => "AND",
VALUE => $date_obj->ISO
);
}
if ( $date =~ /^(.*?)>$/i ) {
$self->Limit(
FIELD => $1,
OPERATOR => ">=",
ENTRYAGGREGATOR => "AND",
VALUE => $date_obj->ISO
);
}
}
if ($args{'RefersTo'}) {
foreach my $link ( split( /\s+/, $args{'RefersTo'} ) ) {
next unless ($link);
$self->LimitRefersTo($link);
}
}
if ($args{'ReferredToBy'}) {
foreach my $link ( split( /\s+/, $args{'ReferredToBy'} ) ) {
next unless ($link);
$self->LimitReferredToBy($link);
}
}
if ( $args{'Topics'} ) {
my @Topics =
( ref $args{'Topics'} eq 'ARRAY' )
? @{ $args{'Topics'} }
: ( $args{'Topics'} );
@Topics = map { split } @Topics;
if ( $args{'ExpandTopics'} ) {
my %topics;
while (@Topics) {
my $id = shift @Topics;
next if $topics{$id};
my $Topics =
RT::Topics->new( $self->CurrentUser );
$Topics->Limit( FIELD => 'Parent', VALUE => $id );
push @Topics, $_->Id while $_ = $Topics->Next;
$topics{$id}++;
}
@Topics = keys %topics;
$args{'Topics'} = \@Topics;
}
$self->LimitTopics(@Topics);
}
my %cfs;
$customfields->LimitToLookupType(
RT::Article->new( $self->CurrentUser )
->CustomFieldLookupType );
if ( $args{'Class'} ) {
my @Classes =
( ref $args{'Class'} eq 'ARRAY' )
? @{ $args{'Class'} }
: ( $args{'Class'} );
foreach my $class (@Classes) {
$customfields->LimitToGlobalOrObjectId($class);
}
}
else {
$customfields->LimitToGlobalOrObjectId();
}
while ( my $cf = $customfields->Next ) {
$cfs{ $cf->Name } = $cf->Id;
}
# reset the iterator because we use this to build the UI
$customfields->GotoFirstItem;
foreach my $field ( keys %cfs ) {
my @MatchLike =
( ref $args{ $field . "~" } eq 'ARRAY' )
? @{ $args{ $field . "~" } }
: ( $args{ $field . "~" } );
my @NoMatchLike =
( ref $args{ $field . "!~" } eq 'ARRAY' )
? @{ $args{ $field . "!~" } }
: ( $args{ $field . "!~" } );
my @Match =
( ref $args{$field} eq 'ARRAY' )
? @{ $args{$field} }
: ( $args{$field} );
my @NoMatch =
( ref $args{ $field . "!" } eq 'ARRAY' )
? @{ $args{ $field . "!" } }
: ( $args{ $field . "!" } );
foreach my $val (@MatchLike) {
next unless $val;
push @Match, "~" . $val;
}
foreach my $val (@NoMatchLike) {
next unless $val;
push @NoMatch, "~" . $val;
}
foreach my $value (@Match) {
next unless $value;
my $op;
if ( $value =~ /^~(.*)$/ ) {
$value = "%$1%";
$op = 'LIKE';
}
else {
$op = '=';
}
$self->LimitCustomField(
FIELD => $cfs{$field},
VALUE => $value,
CASESENSITIVE => 0,
ENTRYAGGREGATOR => 'OR',
OPERATOR => $op
);
}
foreach my $value (@NoMatch) {
next unless $value;
my $op;
if ( $value =~ /^~(.*)$/ ) {
$value = "%$1%";
$op = 'NOT LIKE';
}
else {