summaryrefslogtreecommitdiff
path: root/rt/etc/upgrade/4.1.17/content
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-07-26 15:41:26 -0700
committerIvan Kohler <ivan@freeside.biz>2015-07-26 15:41:26 -0700
commit9aee669886202be7035e6c6049fc71bc99dd3013 (patch)
tree2fd5bf6de74f3d99270587ffb1833e4188a6373d /rt/etc/upgrade/4.1.17/content
parentac20214d38d9af00430423f147b5a0e50751b050 (diff)
parent1add633372bdca3cc7163c2ce48363fed3984437 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'rt/etc/upgrade/4.1.17/content')
-rw-r--r--rt/etc/upgrade/4.1.17/content26
1 files changed, 26 insertions, 0 deletions
diff --git a/rt/etc/upgrade/4.1.17/content b/rt/etc/upgrade/4.1.17/content
new file mode 100644
index 000000000..2e6a78cda
--- /dev/null
+++ b/rt/etc/upgrade/4.1.17/content
@@ -0,0 +1,26 @@
+use strict;
+use warnings;
+
+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';
+ next unless ($content->{SearchType} || '') eq 'Chart';
+
+ # Switch from PrimaryGroupBy to GroupBy name
+ # Switch from "CreatedMonthly" to "Created.Monthly"
+ $content->{GroupBy} ||= [delete $content->{PrimaryGroupBy}];
+ for (@{$content->{GroupBy}}) {
+ next if !defined || /\./;
+ s/(?<=[a-z])(?=[A-Z])/./;
+ }
+
+ my ($ok, $msg) = $search->SetContent($content);
+ RT->Logger->error("Unable to upgrade saved chart #@{[$search->id]}: $msg")
+ unless $ok;
+ }
+});