From ee3196e7a3c314413baa15dcddb4a5f9961630d7 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Mon, 9 May 2016 15:52:33 +0000 Subject: Bug 1271172 - When copying a flag that has a period in the version, the description is not incremented properly --- extensions/TrackingFlags/lib/Admin.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'extensions/TrackingFlags') diff --git a/extensions/TrackingFlags/lib/Admin.pm b/extensions/TrackingFlags/lib/Admin.pm index 542e990d5..1adcad241 100644 --- a/extensions/TrackingFlags/lib/Admin.pm +++ b/extensions/TrackingFlags/lib/Admin.pm @@ -113,8 +113,18 @@ sub admin_edit { if ($flag->name =~ /^(\D+)(\d+)$/) { $flag->set_name("$1" . ($2 + 1)); } - if ($flag->description =~ /^(\D+)(\d+)$/) { - $flag->set_description("$1" . ($2 + 1)); + if ($flag->description =~ /^(\D+)([\d\.]+)$/) { + my $description = $1; + my $version = $2; + if ($version =~ /\./) { + my ($major, $minor) = split(/\./, $version); + $minor++; + $version = "$major.$minor"; + } + else { + $version++; + } + $flag->set_description($description . $version); } $flag->set_sortkey(_next_unique_sortkey($flag->sortkey)); $flag->set_type($flag->flag_type); -- cgit v1.2.3-24-g4f1b