Bug 10752: Alert the librarian if the suggestion has not been added
authorJonathan Druart <jonathan.druart@biblibre.com>
Thu, 16 Apr 2015 14:57:03 +0000 (16:57 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Tue, 28 Apr 2015 18:11:42 +0000 (15:11 -0300)
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 <mtompset@hotmail.com>
NOTE: Love the simplicity and ability to expand. :)

Tested with all pateches applied. Wors as expected.
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt
suggestion/suggestion.pl

index 31d90cb..e56ed58 100644 (file)
@@ -457,6 +457,18 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o
 
 <h1>Suggestions management</h1>
 
+
+[% FOR m IN messages %]
+    <div class="dialog [% m.type %]">
+        [% SWITCH m.code %]
+        [% CASE 'already_exists' %]
+            The suggestion has not been inserted. The same suggestion already exists (<a href='/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% m.id %]&op=show'>see the suggestion</a>)
+        [% CASE %]
+            [% m.code %]
+        [% END %]
+    </div>
+[% END %]
+
 [% UNLESS ( notabs ) %]
     <div id="suggestiontabs" class="toptabs">
     <ul class="ui-tabs-nav">
index b329d27..43834f6 100755 (executable)
@@ -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