From 81ab20e6bbf988b4f9613f63cd799a28e8296208 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 16 Apr 2015 16:57:03 +0200 Subject: [PATCH] Bug 10752: Alert the librarian if the suggestion has not been added MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Test plan: - Create a new suggestion, chose a short term as your title and copy it. - Leave all other fields of the suggestion form untouched. - Save your first suggestion. - Enter a second suggestion with the same title. Before this patch, the suggestion was not inserted without alert. With this patch, an alert is displayed on the interface. Signed-off-by: Mark Tompsett NOTE: Love the simplicity and ability to expand. :) Tested with all pateches applied. Wors as expected. Signed-off-by: Marc Véron Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../prog/en/modules/suggestion/suggestion.tt | 12 ++++++++++++ suggestion/suggestion.pl | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt index 31d90cb04d..e56ed58257 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -457,6 +457,18 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o

Suggestions management

+ +[% FOR m IN messages %] +
+ [% SWITCH m.code %] + [% CASE 'already_exists' %] + The suggestion has not been inserted. The same suggestion already exists (see the suggestion) + [% CASE %] + [% m.code %] + [% END %] +
+[% END %] + [% UNLESS ( notabs ) %]
    diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl index b329d27472..43834f6760 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -134,6 +134,11 @@ if ( $op =~ /save/i ) { SearchSuggestion( $suggestion_only ); if (@$suggestions_loop>=1){ #some suggestion are answering the request Donot Add + my @messages; + for my $suggestion ( @$suggestions_loop ) { + push @messages, { type => 'error', code => 'already_exists', id => $suggestion->{suggestionid} }; + } + $template->param( messages => \@messages ); } else { ## Adding some informations related to suggestion -- 2.39.5