diff options
author | sunnavy <sunnavy@bestpractical.com> | 2021-06-21 21:20:11 +0300 |
---|---|---|
committer | sunnavy <sunnavy@bestpractical.com> | 2021-06-21 23:32:54 +0300 |
commit | d321afd294bd87c45f3ace1870732a3a25be9011 (patch) | |
tree | e17e85099a8b68181dfdb800acdd1657f31f627c /etc | |
parent | 129495bae0f90a74b7c9c31f0440eac9a2d8a252 (diff) | |
parent | e5d0991b91872e3bb397e88d6cb3c0875ba05520 (diff) |
Merge branch '4.4-trunk' into 5.0-trunk
Diffstat (limited to 'etc')
-rw-r--r-- | etc/initialdata | 5 | ||||
-rw-r--r-- | etc/upgrade/4.4.5/content | 34 | ||||
-rw-r--r-- | etc/upgrade/5.0.2/content | 28 |
3 files changed, 67 insertions, 0 deletions
diff --git a/etc/initialdata b/etc/initialdata index 1ebe6d7fba..61522db700 100644 --- a/etc/initialdata +++ b/etc/initialdata @@ -959,6 +959,11 @@ Hour: { $SubscriptionObj->SubValue('Hour') } path => '/Reports/ResolvedByDates.html', }, { + id => 'user_time', + title => 'User time worked', + path => '/Reports/TimeWorkedReport.html', # loc + }, + { id => 'createdindaterange', title => 'Created in a date range', # loc path => '/Reports/CreatedByDates.html', diff --git a/etc/upgrade/4.4.5/content b/etc/upgrade/4.4.5/content index 45b13c1eee..68e0a73997 100644 --- a/etc/upgrade/4.4.5/content +++ b/etc/upgrade/4.4.5/content @@ -1,6 +1,40 @@ use warnings; use strict; +our @Initial = ( + sub { + my $searches = RT::Attributes->new( RT->SystemUser ); + $searches->Limit( FIELD => 'Name', VALUE => 'SavedSearch' ); + $searches->OrderBy( FIELD => 'id' ); + + while ( my $search = $searches->Next ) { + my $content = $search->Content; + next unless ref $content eq 'HASH'; + + if ( $content->{OrderBy} ) { + my @order_by = split /\|/, $content->{OrderBy}; + my @new_order_by; + my $changed; + for my $order_by (@order_by) { + if ( $order_by eq 'Owner' ) { + push @new_order_by, 'Owner.Name'; + $changed = 1; + } + else { + push @new_order_by, $order_by; + } + } + if ($changed) { + $content->{OrderBy} = join '|', @new_order_by; + my ( $ok, $msg ) = $search->SetContent($content); + RT->Logger->error("Unable to upgrade saved chart #@{[$search->id]}: $msg") + unless $ok; + } + } + } + } +); + our @ScripConditions = ( { Name => 'On Create Via Email', diff --git a/etc/upgrade/5.0.2/content b/etc/upgrade/5.0.2/content new file mode 100644 index 0000000000..ad6f07edda --- /dev/null +++ b/etc/upgrade/5.0.2/content @@ -0,0 +1,28 @@ +use strict; +use warnings; + +our @Initial = ( + + # add default reports + sub { + my $reports_in_menu = 'ReportsInMenu'; + my $attr = RT::Attribute->new( RT->SystemUser ); + $attr->LoadByNameAndObject( Object => RT->System, Name => $reports_in_menu ); + + # Update menu if it's not touched by anyone else + if ( $attr->Id && $attr->Created eq $attr->LastUpdated ) { + RT->Logger->debug("Adding time worked report in menu"); + my $content = $attr->Content or return; + splice @$content, 2, 0, + { id => 'user_time', + title => 'User time worked', + path => '/Reports/TimeWorkedReport.html', + }; + + my ( $ret, $msg ) = $attr->SetContent($content); + if ( !$ret ) { + RT->Logger->error("Couldn't update ReportsInMenu: $msg"); + } + } + } +); |