X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=opac%2Fopac-suggestions.pl;h=388e04aa7e26f485f844d646a1f9ec5adbd1b2dc;hb=ab9a082b5f418c17063def1b0fa678b59f247fe2;hp=52c0775c26a3b99cb9581f4e20e003de1d7c231a;hpb=7cde3e216bc4ca120ed1cfe983b690a4f3f6944c;p=koha.git diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl index 52c0775c26..388e04aa7e 100755 --- a/opac/opac-suggestions.pl +++ b/opac/opac-suggestions.pl @@ -22,7 +22,6 @@ use CGI qw ( -utf8 ); use Encode qw( encode ); use C4::Auth; # get_template_and_user use C4::Members; -use C4::Branch; use C4::Koha; use C4::Output; use C4::Suggestions; @@ -148,14 +147,17 @@ if ( $op eq "add_confirm" ) { $suggestion->{branchcode} = $input->param('branchcode') || C4::Context->userenv->{"branch"}; &NewSuggestion($suggestion); + $patrons_pending_suggestions_count++; + + # delete empty fields, to avoid filter in "SearchSuggestion" + foreach my $field ( qw( title author publishercode copyrightdate place collectiontitle isbn STATUS ) ) { + delete $suggestion->{$field}; #clear search filters (except borrower related) to show all suggestions after placing a new one + } + $suggestions_loop = &SearchSuggestion($suggestion); + push @messages, { type => 'info', code => 'success_on_inserted' }; } - # delete empty fields, to avoid filter in "SearchSuggestion" and load all suggestions for display - foreach my $field ( qw( title author publishercode copyrightdate place collectiontitle isbn STATUS ) ) { - delete $suggestion->{$field}; #clear search filters (except borrower related) to show all suggestions after placing a new one - } - $suggestions_loop = &SearchSuggestion($suggestion); $op = 'else'; } @@ -199,9 +201,14 @@ if ( C4::Context->preference("AllowPurchaseSuggestionBranchChoice") ) { } my $branchcode = $input->param('branchcode') || $borr->{'branchcode'} || $userbranch || '' ; -# make branch selection options... - my $branchloop = GetBranchesLoop($branchcode); - $template->param( branchloop => $branchloop ); + $template->param( branchcode => $branchcode ); +} + +my $mandatoryfields = ''; +{ + last unless ($op eq 'add'); + my $fldsreq_sp = C4::Context->preference("OPACSuggestionMandatoryFields") || 'title'; + $mandatoryfields = join(', ', (map { '"'.$_.'"'; } sort split(/\s*\,\s*/, $fldsreq_sp))); } $template->param( @@ -213,6 +220,7 @@ $template->param( messages => \@messages, suggestionsview => 1, suggested_by_anyone => $suggested_by_anyone, + mandatoryfields => $mandatoryfields, patrons_pending_suggestions_count => $patrons_pending_suggestions_count, );