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>
<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">
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