[Rt-commit] r14453 - in rt/3.8/trunk: . etc etc/upgrade/3.8.1

ruz at bestpractical.com ruz at bestpractical.com
Wed Jul 23 23:09:17 EDT 2008


Author: ruz
Date: Wed Jul 23 23:09:17 2008
New Revision: 14453

Added:
   rt/3.8/trunk/etc/upgrade/3.8.1/
   rt/3.8/trunk/etc/upgrade/3.8.1/content
Modified:
   rt/3.8/trunk/UPGRADING
   rt/3.8/trunk/etc/initialdata
   rt/3.8/trunk/share/html/Elements/ShowSearch

Log:
* switch to new way to search bookmarks
* update initialdata and add etc/upgrade/3.8.1/content
* update UPGRADING

Modified: rt/3.8/trunk/UPGRADING
==============================================================================
--- rt/3.8/trunk/UPGRADING	(original)
+++ rt/3.8/trunk/UPGRADING	Wed Jul 23 23:09:17 2008
@@ -16,6 +16,17 @@
 
 *******
 
+UPGRADING FROM 3.8.0 and earlier - Changes:
+
+Searches for bookmarked tickets have been reimplemented and syntax has
+been changed a little. Database upgrade script handles global 'Bookmarked Tickets'
+search only. New Ticket SQL "id = '__Bookmarked__'" is more flexible than
+old "__Bookmarks__". Old version is not valid Ticket SQL query, so people
+can not use it in the query builder and as well admins couldn't not edit
+format and other properties of the global saved search. Old verion's been
+left for backwards compatibility.
+
+
 UPGRADING FROM 3.7.85 and earlier - Changes:
 
 We've proved that it's possible to delete pretty big set of records

Modified: rt/3.8/trunk/etc/initialdata
==============================================================================
--- rt/3.8/trunk/etc/initialdata	(original)
+++ rt/3.8/trunk/etc/initialdata	Wed Jul 23 23:09:17 2008
@@ -703,7 +703,7 @@
       { Format => q{'<a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a>/TITLE:#',}
                 . q{'<a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a>/TITLE:Subject',}
                 . q{Priority, QueueName, ExtendedStatus, Bookmark},
-        Query   => "__Bookmarks__",
+        Query   => "id = '__Bookmarked__'",
         OrderBy => 'LastUpdated',
         Order   => 'DESC' },
     },

Added: rt/3.8/trunk/etc/upgrade/3.8.1/content
==============================================================================
--- (empty file)
+++ rt/3.8/trunk/etc/upgrade/3.8.1/content	Wed Jul 23 23:09:17 2008
@@ -0,0 +1,24 @@
+ at Final = (
+    sub {
+        $RT::Logger->debug("Going to adjust 'Bookmarked Tickets'");
+        my $sys = RT::System->new($RT::SystemUser);
+
+        my $attrs = RT::Attributes->new( $RT::SystemUser );
+        $attrs->LimitToObject( $sys );
+        my ($attr) = $attrs->Named( 'Search - Bookmarked Tickets' );
+        unless ($attr) {
+            $RT::Logger->debug("You have no global search 'Bookmarked Tickets'. Skipped.");
+            return 1;
+        }
+        my $props = $attr->Content;
+        $props->{'Query'} =~ s/__Bookmarks__/id = '__Bookmarked__'/g;
+
+        my ($status, $msg) = $attr->SetContent( $props );
+        $RT::Logger->error($msg) and return undef unless $status;
+
+        $RT::Logger->debug("Fixed.");
+        return 1;
+    },
+);
+
+

Modified: rt/3.8/trunk/share/html/Elements/ShowSearch
==============================================================================
--- rt/3.8/trunk/share/html/Elements/ShowSearch	(original)
+++ rt/3.8/trunk/share/html/Elements/ShowSearch	Wed Jul 23 23:09:17 2008
@@ -118,9 +118,13 @@
 foreach ( $SearchArg, $ProcessedSearchArg ) {
     $_->{'Format'} =~ s/__(Web(?:Path|Base|BaseURL))__/scalar RT->Config->Get($1)/ge;
     $_->{'Format'} =~ s/__loc\(["']?(\w+)["']?\)__/loc("$1")/ge;
-    if ( $_->{'Query'} =~ /__Bookmarks__/ ) {
+    if ( $_->{'Query'} =~ /__Bookmarked__/ ) {
+        $_->{'Rows'} = 999;
+    }
+    elsif ( $_->{'Query'} =~ /__Bookmarks__/ ) {
         $_->{'Rows'} = 999;
 
+        # DEPRECATED: will be here for a while up to 3.10/4.0
         my $bookmarks = $session{'CurrentUser'}->UserObj->FirstAttribute('Bookmarks');
         $bookmarks = $bookmarks->Content if $bookmarks;
         $bookmarks ||= {};


More information about the Rt-commit mailing list