summaryrefslogtreecommitdiff
path: root/rt/lib
diff options
context:
space:
mode:
Diffstat (limited to 'rt/lib')
-rw-r--r--rt/lib/RT/Config.pm16
-rw-r--r--rt/lib/RT/CustomField_Overlay.pm16
-rw-r--r--rt/lib/RT/Interface/Web.pm3
-rwxr-xr-xrt/lib/RT/Record.pm31
-rw-r--r--rt/lib/RT/Ticket_Overlay.pm137
-rw-r--r--rt/lib/RT/Tickets_Overlay.pm157
-rw-r--r--rt/lib/RT/URI/freeside.pm2
7 files changed, 76 insertions, 286 deletions
diff --git a/rt/lib/RT/Config.pm b/rt/lib/RT/Config.pm
index ce66bb6cc..3f8581cc5 100644
--- a/rt/lib/RT/Config.pm
+++ b/rt/lib/RT/Config.pm
@@ -340,15 +340,13 @@ our %META = (
my $value = $self->Get('RTAddressRegexp');
return if $value;
- #XXX freeside - should fix this at some point, but it is being WAY
- #too noisy in the logs
- #$RT::Logger->error(
- # 'The RTAddressRegexp option is not set in the config.'
- # .' Not setting this option results in additional SQL queries to'
- # .' check whether each address belongs to RT or not.'
- # .' It is especially important to set this option if RT recieves'
- # .' emails on addresses that are not in the database or config.'
- #);
+ $RT::Logger->error(
+ 'The RTAddressRegexp option is not set in the config.'
+ .' Not setting this option results in additional SQL queries to'
+ .' check whether each address belongs to RT or not.'
+ .' It is especially important to set this option if RT recieves'
+ .' emails on addresses that are not in the database or config.'
+ );
},
},
# User overridable mail options
diff --git a/rt/lib/RT/CustomField_Overlay.pm b/rt/lib/RT/CustomField_Overlay.pm
index c91f12037..355dd203c 100644
--- a/rt/lib/RT/CustomField_Overlay.pm
+++ b/rt/lib/RT/CustomField_Overlay.pm
@@ -97,11 +97,6 @@ our %FieldTypes = (
'Enter one value with autocompletion', # loc
'Enter up to [_1] values with autocompletion', # loc
],
- Date => [
- 'Select multiple dates', # loc
- 'Select date', # loc
- 'Select up to [_1] dates', # loc
- ],
);
@@ -834,7 +829,7 @@ Returns an array of all possible composite values for custom fields.
sub TypeComposites {
my $self = shift;
- return grep !/(?:[Tt]ext|Combobox|Date)-0/, map { ("$_-1", "$_-0") } $self->Types;
+ return grep !/(?:[Tt]ext|Combobox)-0/, map { ("$_-1", "$_-0") } $self->Types;
}
=head2 SetLookupType
@@ -1165,15 +1160,6 @@ sub AddValueForObject {
$extra_values--;
}
}
- # For date, we need to store Content as ISO date
- if ($self->Type eq 'Date') {
- my $DateObj = new RT::Date( $self->CurrentUser );
- $DateObj->Set(
- Format => 'unknown',
- Value => $args{'Content'},
- );
- $args{'Content'} = $DateObj->ISO;
- }
my $newval = RT::ObjectCustomFieldValue->new( $self->CurrentUser );
my $val = $newval->Create(
ObjectType => ref($obj),
diff --git a/rt/lib/RT/Interface/Web.pm b/rt/lib/RT/Interface/Web.pm
index edb719df5..d6b854f4e 100644
--- a/rt/lib/RT/Interface/Web.pm
+++ b/rt/lib/RT/Interface/Web.pm
@@ -1714,9 +1714,6 @@ sub _ProcessObjectCustomFieldUpdates {
$values_hash{$val} = 1 if $val;
}
- # For Date Cfs, @values is empty when there is no changes (no datas in form input)
- return @results if ( $cf->Type eq 'Date' && ! @values );
-
$cf_values->RedoSearch;
while ( my $cf_value = $cf_values->Next ) {
next if $values_hash{ $cf_value->id };
diff --git a/rt/lib/RT/Record.pm b/rt/lib/RT/Record.pm
index 78bbe915d..bee94420d 100755
--- a/rt/lib/RT/Record.pm
+++ b/rt/lib/RT/Record.pm
@@ -1744,25 +1744,6 @@ sub _AddCustomFieldValue {
}
my $new_content = $new_value->Content;
-
- # For date, we need to display them in "human" format in result message
- if ($cf->Type eq 'Date') {
- my $DateObj = new RT::Date( $self->CurrentUser );
- $DateObj->Set(
- Format => 'ISO',
- Value => $new_content,
- );
- $new_content = $DateObj->AsString;
-
- if ( defined $old_content && length $old_content ) {
- $DateObj->Set(
- Format => 'ISO',
- Value => $old_content,
- );
- $old_content = $DateObj->AsString;
- }
- }
-
unless ( defined $old_content && length $old_content ) {
return ( $new_value_id, $self->loc( "[_1] [_2] added", $cf->Name, $new_content ));
}
@@ -1851,21 +1832,11 @@ sub DeleteCustomFieldValue {
return ( 0, $self->loc( "Couldn't create a transaction: [_1]", $Msg ) );
}
- my $old_value = $TransactionObj->OldValue;
- # For date, we need to display them in "human" format in result message
- if ( $cf->Type eq 'Date' ) {
- my $DateObj = new RT::Date( $self->CurrentUser );
- $DateObj->Set(
- Format => 'ISO',
- Value => $old_value,
- );
- $old_value = $DateObj->AsString;
- }
return (
$TransactionId,
$self->loc(
"[_1] is no longer a value for custom field [_2]",
- $old_value, $cf->Name
+ $TransactionObj->OldValue, $cf->Name
)
);
}
diff --git a/rt/lib/RT/Ticket_Overlay.pm b/rt/lib/RT/Ticket_Overlay.pm
index b60ae38bd..83737c168 100644
--- a/rt/lib/RT/Ticket_Overlay.pm
+++ b/rt/lib/RT/Ticket_Overlay.pm
@@ -560,6 +560,68 @@ sub Create {
# }}}
+ # {{{ Deal with auto-customer association
+
+ #unless we already have (a) customer(s)...
+ unless ( $self->Customers->Count ) {
+
+ #first find any requestors with emails but *without* customer targets
+ my @NoCust_Requestors =
+ grep { $_->EmailAddress && ! $_->Customers->Count }
+ @{ $self->_Requestors->UserMembersObj->ItemsArrayRef };
+
+ for my $Requestor (@NoCust_Requestors) {
+
+ #perhaps the stuff in here should be in a User method??
+ my @Customers =
+ &RT::URI::freeside::email_search( email=>$Requestor->EmailAddress );
+
+ foreach my $custnum ( map $_->{'custnum'}, @Customers ) {
+
+ ## false laziness w/RT/Interface/Web_Vendor.pm
+ my @link = ( 'Type' => 'MemberOf',
+ 'Target' => "freeside://freeside/cust_main/$custnum",
+ );
+
+ my( $val, $msg ) = $Requestor->_AddLink(@link);
+ #XXX should do something with $msg# push @non_fatal_errors, $msg;
+
+ }
+
+ }
+
+ #find any requestors with customer targets
+
+ my %cust_target = ();
+
+ my @Requestors =
+ grep { $_->Customers->Count }
+ @{ $self->_Requestors->UserMembersObj->ItemsArrayRef };
+
+ foreach my $Requestor ( @Requestors ) {
+ foreach my $cust_link ( @{ $Requestor->Customers->ItemsArrayRef } ) {
+ $cust_target{ $cust_link->Target } = 1;
+ }
+ }
+
+ #and then auto-associate this ticket with those customers
+
+ foreach my $cust_target ( keys %cust_target ) {
+
+ my @link = ( 'Type' => 'MemberOf',
+ #'Target' => "freeside://freeside/cust_main/$custnum",
+ 'Target' => $cust_target,
+ );
+
+ my( $val, $msg ) = $self->_AddLink(@link);
+ push @non_fatal_errors, $msg;
+
+ }
+
+ }
+
+ # }}}
+
# {{{ Add all the custom fields
foreach my $arg ( keys %args ) {
@@ -617,16 +679,11 @@ sub Create {
next;
}
}
-
- #don't show transactions for reminders
- my $silent = ( !$args{'_RecordTransaction'}
- || $self->Type eq 'reminder'
- );
-
+
my ( $wval, $wmsg ) = $self->_AddLink(
Type => $LINKTYPEMAP{$type}->{'Type'},
$LINKTYPEMAP{$type}->{'Mode'} => $link,
- Silent => $silent,
+ Silent => !$args{'_RecordTransaction'},
'Silent'. ( $LINKTYPEMAP{$type}->{'Mode'} eq 'Base'? 'Target': 'Base' )
=> 1,
);
@@ -636,69 +693,6 @@ sub Create {
}
# }}}
-
- # {{{ Deal with auto-customer association
-
- #unless we already have (a) customer(s)...
- unless ( $self->Customers->Count ) {
-
- #first find any requestors with emails but *without* customer targets
- my @NoCust_Requestors =
- grep { $_->EmailAddress && ! $_->Customers->Count }
- @{ $self->_Requestors->UserMembersObj->ItemsArrayRef };
-
- for my $Requestor (@NoCust_Requestors) {
-
- #perhaps the stuff in here should be in a User method??
- my @Customers =
- &RT::URI::freeside::email_search( email=>$Requestor->EmailAddress );
-
- foreach my $custnum ( map $_->{'custnum'}, @Customers ) {
-
- ## false laziness w/RT/Interface/Web_Vendor.pm
- my @link = ( 'Type' => 'MemberOf',
- 'Target' => "freeside://freeside/cust_main/$custnum",
- );
-
- my( $val, $msg ) = $Requestor->_AddLink(@link);
- #XXX should do something with $msg# push @non_fatal_errors, $msg;
-
- }
-
- }
-
- #find any requestors with customer targets
-
- my %cust_target = ();
-
- my @Requestors =
- grep { $_->Customers->Count }
- @{ $self->_Requestors->UserMembersObj->ItemsArrayRef };
-
- foreach my $Requestor ( @Requestors ) {
- foreach my $cust_link ( @{ $Requestor->Customers->ItemsArrayRef } ) {
- $cust_target{ $cust_link->Target } = 1;
- }
- }
-
- #and then auto-associate this ticket with those customers
-
- foreach my $cust_target ( keys %cust_target ) {
-
- my @link = ( 'Type' => 'MemberOf',
- #'Target' => "freeside://freeside/cust_main/$custnum",
- 'Target' => $cust_target,
- );
-
- my( $val, $msg ) = $self->_AddLink(@link);
- push @non_fatal_errors, $msg;
-
- }
-
- }
-
- # }}}
-
# Now that we've created the ticket and set up its metadata, we can actually go and check OwnTicket on the ticket itself.
# This might be different than before in cases where extensions like RTIR are doing clever things with RT's ACL system
if ( $DeferOwner ) {
@@ -721,8 +715,7 @@ sub Create {
);
}
- #don't make a transaction or fire off any scrips for reminders either
- if ( $args{'_RecordTransaction'} && $self->Type ne 'reminder' ) {
+ if ( $args{'_RecordTransaction'} ) {
# {{{ Add a transaction for the create
my ( $Trans, $Msg, $TransObj ) = $self->_NewTransaction(
diff --git a/rt/lib/RT/Tickets_Overlay.pm b/rt/lib/RT/Tickets_Overlay.pm
index f2949ed7a..e8d350dea 100644
--- a/rt/lib/RT/Tickets_Overlay.pm
+++ b/rt/lib/RT/Tickets_Overlay.pm
@@ -136,7 +136,6 @@ our %FIELD_METADATA = (
QueueAdminCc => [ 'WATCHERFIELD' => 'AdminCc' => 'Queue', ], #loc_left_pair
QueueWatcher => [ 'WATCHERFIELD' => undef => 'Queue', ], #loc_left_pair
CustomFieldValue => [ 'CUSTOMFIELD', ], #loc_left_pair
- DateCustomFieldValue => [ 'DATECUSTOMFIELD', ],
CustomField => [ 'CUSTOMFIELD', ], #loc_left_pair
CF => [ 'CUSTOMFIELD', ], #loc_left_pair
Updated => [ 'TRANSDATE', ], #loc_left_pair
@@ -161,7 +160,6 @@ our %dispatch = (
WATCHERFIELD => \&_WatcherLimit,
MEMBERSHIPFIELD => \&_WatcherMembershipLimit,
CUSTOMFIELD => \&_CustomFieldLimit,
- DATECUSTOMFIELD => \&_DateCustomFieldLimit,
HASATTRIBUTE => \&_HasAttributeLimit,
);
our %can_bundle = ();# WATCHERFIELD => "yes", );
@@ -1342,101 +1340,6 @@ sub _CustomFieldJoin {
return ($TicketCFs, $CFs);
}
-=head2 _DateCustomFieldLimit
-
-Limit based on CustomFields of type Date
-
-Meta Data:
- none
-
-=cut
-
-sub _DateCustomFieldLimit {
- my ( $self, $_field, $op, $value, %rest ) = @_;
-
- my $field = $rest{'SUBKEY'} || die "No field specified";
-
- # For our sanity, we can only limit on one queue at a time
-
- my ($queue, $cfid, $column);
- ($queue, $field, $cfid, $column) = $self->_CustomFieldDecipher( $field );
-
-# If we're trying to find custom fields that don't match something, we
-# want tickets where the custom field has no value at all. Note that
-# we explicitly don't include the "IS NULL" case, since we would
-# otherwise end up with a redundant clause.
-
- my $null_columns_ok;
- if ( ( $op =~ /^NOT LIKE$/i ) or ( $op eq '!=' ) ) {
- $null_columns_ok = 1;
- }
-
- my $cfkey = $cfid ? $cfid : "$queue.$field";
- my ($TicketCFs, $CFs) = $self->_CustomFieldJoin( $cfkey, $cfid, $field );
-
- $self->_OpenParen;
-
- if ( $CFs && !$cfid ) {
- $self->SUPER::Limit(
- ALIAS => $CFs,
- FIELD => 'Name',
- VALUE => $field,
- ENTRYAGGREGATOR => 'AND',
- );
- }
-
- $self->_OpenParen if $null_columns_ok;
-
- my $date = RT::Date->new( $self->CurrentUser );
- $date->Set( Format => 'unknown', Value => $value );
-
- if ( $op eq "=" ) {
-
- # if we're specifying =, that means we want everything on a
- # particular single day. in the database, we need to check for >
- # and < the edges of that day.
-
- $date->SetToMidnight( Timezone => 'server' );
- my $daystart = $date->ISO;
- $date->AddDay;
- my $dayend = $date->ISO;
-
- $self->_OpenParen;
-
- $self->_SQLLimit(
- ALIAS => $TicketCFs,
- FIELD => 'Content',
- OPERATOR => ">=",
- VALUE => $daystart,
- %rest,
- );
-
- $self->_SQLLimit(
- ALIAS => $TicketCFs,
- FIELD => 'Content',
- OPERATOR => "<=",
- VALUE => $dayend,
- %rest,
- ENTRYAGGREGATOR => 'AND',
- );
-
- $self->_CloseParen;
-
- }
- else {
- $self->_SQLLimit(
- ALIAS => $TicketCFs,
- FIELD => 'Content',
- OPERATOR => $op,
- VALUE => $date->ISO,
- %rest,
- );
- }
-
- $self->_CloseParen;
-
-}
-
=head2 _CustomFieldLimit
Limit based on CustomFields
@@ -1830,60 +1733,7 @@ sub OrderByCols {
}
push @res, { %$row, FIELD => "Priority", ORDER => $order } ;
-
- } elsif ( $field eq 'Customer' ) { #Freeside
-
- my $linkalias = $self->Join(
- TYPE => 'LEFT',
- ALIAS1 => 'main',
- FIELD1 => 'id',
- TABLE2 => 'Links',
- FIELD2 => 'LocalBase'
- );
-
- $self->SUPER::Limit(
- LEFTJOIN => $linkalias,
- FIELD => 'Type',
- OPERATOR => '=',
- VALUE => 'MemberOf',
- );
- $self->SUPER::Limit(
- LEFTJOIN => $linkalias,
- FIELD => 'Target',
- OPERATOR => 'STARTSWITH',
- VALUE => 'freeside://freeside/cust_main/',
- );
-
- #if there was a Links.RemoteTarget int, this bs wouldn't be necessary
- my $custnum_sql = "CAST(SUBSTR($linkalias.Target,31) AS INTEGER)";
-
- if ( $subkey eq 'Number' ) {
-
- push @res, { %$row,
- ALIAS => '',
- FIELD => $custnum_sql,
- };
-
- } elsif ( $subkey eq 'Name' ) {
-
- my $custalias = $self->Join(
- TYPE => 'LEFT',
- EXPRESSION => $custnum_sql,
- TABLE2 => 'cust_main',
- FIELD2 => 'custnum',
-
- );
-
- my $field = "COALESCE( $custalias.company,
- $custalias.last || ', ' || $custalias.first
- )";
-
- push @res, { %$row, ALIAS => '', FIELD => $field };
-
- }
-
- } #Freeside
-
+ }
else {
push @res, $row;
}
@@ -2817,11 +2667,6 @@ sub LimitCustomField {
$args{CUSTOMFIELD} = $CF->Id;
}
- # Handle special customfields types
- if ($CF->Type eq 'Date') {
- $args{FIELD} = 'DateCustomFieldValue';
- }
-
#If we are looking to compare with a null value.
if ( $args{'OPERATOR'} =~ /^is$/i ) {
$args{'DESCRIPTION'}
diff --git a/rt/lib/RT/URI/freeside.pm b/rt/lib/RT/URI/freeside.pm
index 1bd2f534a..6194fd0cb 100644
--- a/rt/lib/RT/URI/freeside.pm
+++ b/rt/lib/RT/URI/freeside.pm
@@ -202,7 +202,7 @@ sub ParseURI {
$pkey = $2;
unless ( $pkey ) {
- #way too noisy, using this prefix is normal usage# cluck "bad URL $uri";
+ cluck "bad URL $uri";
return(undef);
}