(bug #2040) This prevent users to post empty suggestions, and post the same suggestio...
[koha.git] / opac / opac-suggestions.pl
index 4001694..bef3e9f 100755 (executable)
 # Suite 330, Boston, MA  02111-1307 USA
 
 use strict;
+use warnings;
 
 use CGI;
 use C4::Auth;    # get_template_and_user
+use C4::Branch;
 use C4::Output;
 use C4::Suggestions;
 
@@ -33,7 +35,7 @@ my $publicationyear = $input->param('publicationyear');
 my $place           = $input->param('place');
 my $isbn            = $input->param('isbn');
 my $status          = $input->param('status');
-my $suggestedbyme   = (defined $input->param('suggestedbyme')? $input->param('suggestedbyme'):1);
+my $suggestedbyme   = (defined $input->param('suggestedby')? $input->param('suggestedby'):1);
 my $op              = $input->param('op');
 $op = 'else' unless $op;
 
@@ -82,6 +84,8 @@ if ( $op eq "add_confirm" ) {
     $place           = '';
     $isbn            = '';
     $op              = 'else';
+    
+    print $input->redirect('/cgi-bin/koha/opac-suggestions.pl');
 }
 
 if ( $op eq "delete_confirm" ) {
@@ -95,6 +99,7 @@ if ( $op eq "delete_confirm" ) {
 my $suggestions_loop =
   &SearchSuggestion( $borrowernumber, $author, $title, $publishercode, $status,
     $suggestedbyme );
+map{ $_->{'branchcodesuggestedby'}=GetBranchInfo($_->{'branchcodesuggestedby'})->[0]->{'branchname'}} @$suggestions_loop;  
 $template->param(
     suggestions_loop => $suggestions_loop,
     title            => $title,