[Rt-commit] rt branch, 4.0/oracle-fixes, created. rt-3.9.7-1132-gd506f08

Ruslan Zakirov ruz at bestpractical.com
Tue Dec 28 18:31:44 EST 2010


The branch, 4.0/oracle-fixes has been created
        at  d506f086a6de318dc33a7236d269179e1f40389f (commit)

- Log -----------------------------------------------------------------
commit f1b848e60367b83faa9f3b2b3242a5c0bac28a04
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Dec 28 03:02:05 2010 +0300

    return asap unless txn subject is set

diff --git a/lib/RT/Action/ExtractSubjectTag.pm b/lib/RT/Action/ExtractSubjectTag.pm
index 3a758ee..a190098 100644
--- a/lib/RT/Action/ExtractSubjectTag.pm
+++ b/lib/RT/Action/ExtractSubjectTag.pm
@@ -63,13 +63,15 @@ sub Commit {
     my $self            = shift;
     my $Transaction     = $self->TransactionObj;
     my $FirstAttachment = $Transaction->Attachments->First;
-    return 1 unless ($FirstAttachment);
+    return 1 unless $FirstAttachment;
+
+    my $TransactionSubject = $FirstAttachment->Subject;
+    return 1 unless $TransactionSubject;
 
     my $Ticket = $self->TicketObj;
 
     my $TicketSubject      = $self->TicketObj->Subject;
     my $origTicketSubject  = $TicketSubject;
-    my $TransactionSubject = $FirstAttachment->Subject;
 
     my $match   = RT->Config->Get('ExtractSubjectTagMatch');
     my $nomatch = RT->Config->Get('ExtractSubjectTagNoMatch');

commit ec0ef6c832497ad76da972e4f499fcd7eb371799
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Dec 28 03:02:42 2010 +0300

    Oracle needs TO_NUMBER to store clob in number column

diff --git a/etc/upgrade/3.9.7/content b/etc/upgrade/3.9.7/content
index 9dfb114..f8073ed 100644
--- a/etc/upgrade/3.9.7/content
+++ b/etc/upgrade/3.9.7/content
@@ -1,7 +1,16 @@
+my %number_column = (
+    BasedOn => 1,
+);
 my $move_attributes = sub {
     my ($table, $type, $column) = @_;
-    my $query = "UPDATE $table SET $column = (SELECT Content FROM Attributes WHERE"
-        ." Name = ? AND ObjectType = ? AND $table.id = Attributes.ObjectId)";
+    my $query;
+    if ( $number_column{ $column } && RT->Config->Get('DatabaseType') eq 'Oracle' ) {
+        $query = "UPDATE $table SET $column = (SELECT TO_NUMBER(Content) FROM Attributes WHERE"
+            ." Name = ? AND ObjectType = ? AND $table.id = Attributes.ObjectId)";
+    } else {
+        $query = "UPDATE $table SET $column = (SELECT Content FROM Attributes WHERE"
+            ." Name = ? AND ObjectType = ? AND $table.id = Attributes.ObjectId)";
+    }
 
     my $res = $RT::Handle->SimpleQuery( $query, $column, $type );
     unless ( $res ) {

commit 91394a367cc52280aed17ed4f577a43b8e6e2e7a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Dec 28 03:03:20 2010 +0300

    Oracle treats empty string as NULL, get rid of uninit warning

diff --git a/lib/RT/Attribute.pm b/lib/RT/Attribute.pm
index 82fcf78..6b290b0 100644
--- a/lib/RT/Attribute.pm
+++ b/lib/RT/Attribute.pm
@@ -254,7 +254,7 @@ sub Content {
     my $self = shift;
     # Here we call _Value to get the ACL check.
     my $content = $self->_Value('Content');
-    if ($self->__Value('ContentType') eq 'storable') {
+    if ( ($self->__Value('ContentType') || '') eq 'storable') {
         eval {$content = $self->_DeserializeContent($content); };
         if ($@) {
             $RT::Logger->error("Deserialization of content for attribute ".$self->Id. " failed. Attribute was: ".$content);

commit e837a4bb7d90c6b5fecd0748318ad73260dfa1b5
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Dec 28 03:04:00 2010 +0300

    get rid of uninit warnings on oracle

diff --git a/share/html/Admin/Queues/Modify.html b/share/html/Admin/Queues/Modify.html
index 187f70c..85a29a5 100755
--- a/share/html/Admin/Queues/Modify.html
+++ b/share/html/Admin/Queues/Modify.html
@@ -78,10 +78,10 @@
 </tr>
 
 <tr><td align="right"><&|/l&>Reply Address</&>:</td>
-<td><input name="CorrespondAddress" value="<% ($Create) ? "" : $QueueObj->CorrespondAddress %>" />
+<td><input name="CorrespondAddress" value="<% $Create ? "" : $QueueObj->CorrespondAddress || '' %>" />
 <br /><span><em><&|/l , RT->Config->Get('CorrespondAddress')&>(If left blank, will default to [_1])</&></em></span></td>
 <td align="right"><&|/l&>Comment Address</&>:</td>
-<td><input name="CommentAddress" value="<% ($Create) ? "" : $QueueObj->CommentAddress %>" />
+<td><input name="CommentAddress" value="<% $Create ? "" : $QueueObj->CommentAddress || '' %>" />
 <br /><span><em><&|/l , RT->Config->Get('CommentAddress')&>(If left blank, will default to [_1])</&></em></span></td>
 </tr>
 

commit e9be1389db4e652062dd6bd2ada83a9a0860a5e7
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Dec 28 06:50:59 2010 +0300

    get rid of uninit warning on Oracle

diff --git a/lib/RT/Attribute.pm b/lib/RT/Attribute.pm
index 6b290b0..26589b6 100644
--- a/lib/RT/Attribute.pm
+++ b/lib/RT/Attribute.pm
@@ -277,7 +277,7 @@ sub SetContent {
     my $content = shift;
 
     # Call __Value to avoid ACL check.
-    if ( $self->__Value('ContentType') eq 'storable' ) {
+    if ( ($self->__Value('ContentType')||'') eq 'storable' ) {
         # We eval the serialization because it will lose on a coderef.
         $content = eval { $self->_SerializeContent($content) };
         if ($@) {

commit d506f086a6de318dc33a7236d269179e1f40389f
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Dec 29 02:04:30 2010 +0300

    get rid of uninit warnings (Oracle specific)

diff --git a/share/html/Admin/Articles/Classes/Modify.html b/share/html/Admin/Articles/Classes/Modify.html
index fc653be..801145d 100644
--- a/share/html/Admin/Articles/Classes/Modify.html
+++ b/share/html/Admin/Articles/Classes/Modify.html
@@ -63,7 +63,7 @@
 </tr>
 <tr>
 <td align="right"><&|/l&>Description</&>:</td>
-<td><input name="Description" value="<% $Create ? '' : $ClassObj->Description %>" size=60 /></td>
+<td><input name="Description" value="<% $Create ? '' : $ClassObj->Description || '' %>" size=60 /></td>
 </tr>
 <tr>
 <td>&nbsp;</td>
diff --git a/share/html/Articles/Article/Elements/Preformatted b/share/html/Articles/Article/Elements/Preformatted
index c82dc61..c21e7ce 100644
--- a/share/html/Articles/Article/Elements/Preformatted
+++ b/share/html/Articles/Article/Elements/Preformatted
@@ -48,7 +48,7 @@
 #<%$Article->Id%>: <%$Article->Name || loc('(no name)')%>
 <%'-' x length("#".$Article->Id.": ".($Article->Name || loc('(no name)'))) %>
 % }
-% if ($Article->Summary =~ /\S/ and $include{Summary}) {
+% if ( $include{Summary} && ($Article->Summary||'') =~ /\S/ ) {
 <% $Article->Summary %>
 % }
 % while (my $cf = $cfs->Next) {
diff --git a/share/html/Articles/Article/Elements/SearchByCustomField b/share/html/Articles/Article/Elements/SearchByCustomField
index 91b84f6..dd25163 100644
--- a/share/html/Articles/Article/Elements/SearchByCustomField
+++ b/share/html/Articles/Article/Elements/SearchByCustomField
@@ -49,7 +49,8 @@
 % my $CustomFieldValues = $Field->ValuesObj();
 <select name="<%$Name%>" size="5" multiple>
 % while (my $value = $CustomFieldValues->Next) {
-<option value="<%$value->Name%>" <% grep (/^@{[$value->Name]}$/, @Values) && 'SELECTED'%>><% $value->Name%></option>
+% my $name = $value->Name || '';
+<option value="<% $name %>" <% grep($_ eq $name, @Values)? 'SELECTED' : ''%>><% $name %></option>
 % }
 <option value="" <% $#Values < 0 && 'SELECTED'%>><&|/l&>(no value)</&></option>
 </select>
diff --git a/share/html/Articles/Elements/BeforeMessageBox b/share/html/Articles/Elements/BeforeMessageBox
index 93c463c..2bb50b4 100644
--- a/share/html/Articles/Elements/BeforeMessageBox
+++ b/share/html/Articles/Elements/BeforeMessageBox
@@ -66,7 +66,7 @@
 <td><select name="<% $name_prefix %>Articles-Include-Article-Named-Hotlist" onchange="this.form.submit()">
 <option value="" selected><&|/l&>-</&></option>
 % while (my $article = $hotlist->Next) {
-<option value="<% $article->Id %>"><%$article->Name|| loc('(no name)')%>: <%$article->Summary%></option>
+<option value="<% $article->Id %>"><%$article->Name|| loc('(no name)')%>: <%$article->Summary || ''%></option>
 % }
 </select>
 </td>
@@ -86,7 +86,7 @@
 %   next if $dedupe_articles{$article->Id};
 <tr>
 <td>&nbsp;</td>
-<td><%$article->Name || loc('(no name)')%>: <%$article->Summary%></td>
+<td><%$article->Name || loc('(no name)')%>: <%$article->Summary || ''%></td>
 <td><input type="submit" name="<% $name_prefix %>Articles-Include-Article-<%$article->Id%>" value="Go" /></td>
 </tr>
 % }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list