Bug 13329: Fix create a suggestion at the OPAC

The suggestion table does not contain a 'branch' column name.
The script should pass 'branchcode' to C4::Suggestion::NewSuggestion.

Test plan:
0/ Enable the AllowPurchaseSuggestionBranchChoice pref
1/ Create a suggestion at the OPAC should not raise a DBIx::Class error.

I could reproduce the bug.
With patch bug is gone.

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, thx for the quick fix.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Jonathan Druart 2014-11-24 09:54:16 +01:00 committed by Tomas Cohen Arazi
parent 08482a70f8
commit 33f53e4dfd
2 changed files with 4 additions and 4 deletions

View file

@ -57,7 +57,7 @@
</li>
[% IF ( branchloop ) %]
<li><label for="branch">Library:</label>
<select name="branch" id="branch">
<select name="branchcode" id="branch">
[% FOREACH branchloo IN branchloop %]
[% IF ( branchloo.selected ) %]
<option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>

View file

@ -94,7 +94,7 @@ if ( $op eq "add_confirm" ) {
$suggestion->{$suggest} = $scrubber->scrub($suggestion->{$suggest});
}
$suggestion->{suggesteddate} = dt_from_string;
$$suggestion{'branchcode'}= $input->param('branch') || C4::Context->userenv->{"branch"};
$suggestion->{branchcode} = $input->param('branchcode') || C4::Context->userenv->{"branch"};
&NewSuggestion($suggestion);
# empty fields, to avoid filter in "SearchSuggestion"
@ -149,10 +149,10 @@ if ( C4::Context->preference("AllowPurchaseSuggestionBranchChoice") ) {
if (C4::Context->userenv && C4::Context->userenv->{'branch'}) {
$userbranch = C4::Context->userenv->{'branch'};
}
my $branch = $input->param('branch') || $borr->{'branchcode'} || $userbranch || '' ;
my $branchcode = $input->param('branchcode') || $borr->{'branchcode'} || $userbranch || '' ;
# make branch selection options...
my $branchloop = GetBranchesLoop($branch);
my $branchloop = GetBranchesLoop($branchcode);
$template->param( branchloop => $branchloop );
}