[Rt-commit] rt branch, 4.4/attachments-oracle, created. rt-4.4.0-228-gdf888f0
Shawn Moore
shawn at bestpractical.com
Mon May 23 18:44:26 EDT 2016
The branch, 4.4/attachments-oracle has been created
at df888f03c7ab964075789515264f9ce19e28ece5 (commit)
- Log -----------------------------------------------------------------
commit df888f03c7ab964075789515264f9ce19e28ece5
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu May 19 16:34:51 2016 +0000
Oracle needs to do _only_ a NULL check for attachment filename
This fixes t/web/attach-from-txn.t on Oracle
See RT::Attachments->LimitNotEmpty for prior art
diff --git a/lib/RT/Attachments.pm b/lib/RT/Attachments.pm
index 73da9bb..c536326 100644
--- a/lib/RT/Attachments.pm
+++ b/lib/RT/Attachments.pm
@@ -182,6 +182,35 @@ sub LimitNotEmpty {
return;
}
+=head2 LimitHasFilename
+
+Limit result set to attachments with not empty filename.
+
+=cut
+
+sub LimitHasFilename {
+ my $self = shift;
+
+ $self->Limit(
+ ENTRYAGGREGATOR => 'AND',
+ FIELD => 'Filename',
+ OPERATOR => 'IS NOT',
+ VALUE => 'NULL',
+ QUOTEVALUE => 0,
+ );
+
+ if ( RT->Config->Get('DatabaseType') ne 'Oracle' ) {
+ $self->Limit(
+ ENTRYAGGREGATOR => 'AND',
+ FIELD => 'Filename',
+ OPERATOR => '!=',
+ VALUE => '',
+ );
+ }
+
+ return;
+}
+
=head2 LimitByTicket $ticket_id
Limit result set to attachments of a ticket.
diff --git a/share/html/Ticket/Elements/AddAttachments b/share/html/Ticket/Elements/AddAttachments
index 32c2c5e..1173093 100644
--- a/share/html/Ticket/Elements/AddAttachments
+++ b/share/html/Ticket/Elements/AddAttachments
@@ -194,11 +194,7 @@ my $HasExisting = 0;
if ($TicketObj && $TicketObj->id) {
my $Existing = $TicketObj->Attachments;
- $Existing->Limit(
- FIELD => 'Filename',
- OPERATOR => '!=',
- VALUE => '',
- );
+ $Existing->LimitHasFilename;
$HasExisting = 1 if $Existing->Count;
}
</%INIT>
diff --git a/share/html/Ticket/Elements/ShowAttachments b/share/html/Ticket/Elements/ShowAttachments
index ac663a9..9ecfc0c 100644
--- a/share/html/Ticket/Elements/ShowAttachments
+++ b/share/html/Ticket/Elements/ShowAttachments
@@ -132,11 +132,7 @@ $Attachments = $Attachments->Clone;
# Remember, each message in a transaction is an attachment; we only
# want named attachments (real files)
-$Attachments->Limit(
- FIELD => 'Filename',
- OPERATOR => '!=',
- VALUE => '',
-);
+$Attachments->LimitHasFilename;
my $show_more = 0;
my %documents;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list