>From 0957846b61f34f883c858f8b17d08dadca80609b Mon Sep 17 00:00:00 2001
From: Paul Poulain <paul.poulain@biblibre.com>
Date: Mon, 18 Mar 2013 12:01:11 +0100
Subject: [PATCH] Adding "new feature" paragraph

The "New feature" severity has been added a few months ago.
This patch separate "new features" and "enhancements" in 2 different paragraphs, for a better readability.

It deals with both html & txt formats
---
 get_bugs.pl                |   36 +++++++++++++++++++++++++++---------
 release_notes_tmpl.tt      |   14 ++++++++++++--
 release_notes_tmpl_html.tt |   14 ++++++++++++--
 3 files changed, 51 insertions(+), 13 deletions(-)

diff --git a/get_bugs.pl b/get_bugs.pl
index 8d432f2..0d9be2c 100755
--- a/get_bugs.pl
+++ b/get_bugs.pl
@@ -197,14 +197,16 @@ if (scalar @bug_list) {
     my @columns = $csv->fields;
 
     # the current component for the 3 cases (highlights, bugfixes, enhancements)
-    my ($current_highlight,$current_bugfix,$current_enhancement) = ('','','');
+    my ($current_highlight,$current_bugfix,$current_enhancement,$current_newfeature) = ('','','','');
     #The lists of highlights, bugfixes and enhancement
     # the component_xxx contains an array of hash reset for each component
     # the xxx contains an array of hash with component & component_xxx array of hash
     my (@component_highlights,@highlights);
     my (@component_bugfixes,@bugfixes);
     my (@component_enhancements,@enhancements);
+    my (@component_newfeatures,@newfeatures);
     my $nb_enhancements = 0;
+    my $nb_newfeatures  = 0;
     my $nb_bugfixes     = 0;
     while (scalar @csv_file) {
         $csv->parse(shift @csv_file);
@@ -229,7 +231,7 @@ if (scalar @bug_list) {
             $current_bugfix=$fields[3];
             push @component_bugfixes, { number=> $fields[0],severity=> $fields[1], short_desc=> $fields[2] };
             $nb_bugfixes++;
-        } else { # enhancements
+        } else { # enhancements & new feature
             #
             # if bugzilla login and password have been provided, retrieve the description of the bug
             #
@@ -273,25 +275,41 @@ if (scalar @bug_list) {
                     $description =~ s/\n/<br\/>/g;
                 }
             }
-            if ($current_enhancement && $fields[3] ne $current_enhancement) {
-                my @t=@component_enhancements;
-                push @enhancements, { component => $current_enhancement, list => \@t };
-                @component_enhancements=();
+            if ($fields[1] =~ m/enhancement/) {
+                if ($current_enhancement && $fields[3] ne $current_enhancement) {
+                    my @t=@component_enhancements;
+                    push @enhancements, { component => $current_enhancement, list => \@t };
+                    @component_enhancements=();
+                }
+                $current_enhancement=$fields[3];
+                push @component_enhancements, { number=> $fields[0],severity=> $fields[1], short_desc=> $fields[2], description => $description };
+                $nb_enhancements++;
+            } else { # new feature
+                if ($current_newfeature && $fields[3] ne $current_newfeature) {
+                    my @t=@component_newfeatures;
+                    push @newfeatures, { component => $current_newfeature, list => \@t };
+                    @component_newfeatures=();
+                }
+                $current_newfeature=$fields[3];
+                push @component_newfeatures, { number=> $fields[0],severity=> $fields[1], short_desc=> $fields[2], description => $description };
+                $nb_newfeatures++;
+
             }
-            $current_enhancement=$fields[3];
-            push @component_enhancements, { number=> $fields[0],severity=> $fields[1], short_desc=> $fields[2], description => $description };
-            $nb_enhancements++;
         }
     }
     # push the last components
     push @highlights, { component => $current_highlight, list => \@component_highlights };
     push @bugfixes, { component => $current_bugfix, list => \@component_bugfixes };
     push @enhancements, { component => $current_enhancement, list => \@component_enhancements };
+    push @newfeatures, { component => $current_newfeature, list => \@component_newfeatures };
+
     $arguments{highlights}      = \@highlights;
     $arguments{bugfixes}        = \@bugfixes;
     $arguments{enhancements}    = \@enhancements;
+    $arguments{newfeatures}     = \@newfeatures;
     $arguments{nb_bugfixes}     = $nb_bugfixes;
     $arguments{nb_enhancements} = $nb_enhancements;
+    $arguments{nb_newfeatures}  = $nb_newfeatures;
 }
 
 open (SYSPREFS, "git diff $tag installer/data/mysql/sysprefs.sql | grep '^+[^+]' | sed -e 's/^\+//' |");
diff --git a/release_notes_tmpl.tt b/release_notes_tmpl.tt
index 6dc5c35..8bc8a1c 100644
--- a/release_notes_tmpl.tt
+++ b/release_notes_tmpl.tt
@@ -25,10 +25,20 @@ Koha [% shortversion %] is a major release, that comes with many new features.
 Koha [% shortversion %] is a bugfix/maintenance release.
 [% END %]
 
-It includes [% nb_enhancements %] enhancement and [% nb_bugfixes %] bugfixes.
+It includes [% nb_newfeatures %] features, [% nb_enhancements %] enhancements and [% nb_bugfixes %] bugfixes.
+
+[% IF newfeatures %]
+New features in [% shortversion %]
+======================
+[% FOREACH newfeature IN newfeatures %]
+[% newfeature.component %]
+----------
+[% FOREACH line IN newfeature.list %]	[% line.number %]	[% line.short_desc %][% IF line.description %]
+[% line.description %][% END %]
+[% END %][% END %][% END -%]
 
 [% IF enhancements %]
-Enhancements and new features in [% shortversion %]
+Enhancements in [% shortversion %]
 ======================
 [% FOREACH enhancement IN enhancements %]
 [% enhancement.component %]
diff --git a/release_notes_tmpl_html.tt b/release_notes_tmpl_html.tt
index 0f85a41..67c46b6 100644
--- a/release_notes_tmpl_html.tt
+++ b/release_notes_tmpl_html.tt
@@ -12,11 +12,21 @@
 Koha [% shortversion %] is a bugfix/maintenance release.
 [% END %]
 
-<p>It includes [% nb_enhancements %] enhancement and [% nb_bugfixes %] bugfixes.</p>
+<p>It includes [% nb_newfeatures %] new features, [% nb_enhancements %] enhancement and [% nb_bugfixes %] bugfixes.</p>
 
+[% IF newfeatures %]
+<h3>New features in Koha [% shortversion %]</h3>
+[% FOREACH newfeature IN newfeatures %]
+<h4>[% newfeature.component %]</h4>
+<ul>
+[% FOREACH line IN newfeature.list %]<li>[% line.short_desc %] <i>(bug #[% line.number %])</i></li>
+<ul><p>[% line.description %]</p></ul>
+[% END %]
+</ul>
+[% END %][% END %]
 
 [% IF enhancements %]
-<h3>Enhancements and new features in Koha [% shortversion %]</h3>
+<h3>Enhancements in Koha [% shortversion %]</h3>
 [% FOREACH enhancement IN enhancements %]
 <h4>[% enhancement.component %]</h4>
 <ul>
-- 
1.7.9.5

