-my ($template, $borrowernumber, $cookie)
- = get_template_and_user({template_name => "acqui/newordersuggestion.tmpl",
- type => "intranet",
- query => $input,
- authnotrequired => 1,
- flagsrequired => {acquisition => 1},
- });
-
-if ($op eq 'connectDuplicate') {
- ConnectSuggestionAndBiblio($suggestionid,$duplicateNumber);
-}
-my $suggestions_loop= &SearchSuggestion($borrowernumber,$author,$title,$publishercode,$status,$suggestedbyme);
-foreach (@$suggestions_loop) {
- unless ($_->{biblionumber}) {
- my (@kohafields, @and_or, @value, @relation, $offset,$length);
- # search on biblio.title
- if ($_->{title}) {
- push @kohafields, "title";
- push @and_or, "\@and";
- push @relation, "\@attr 5=1";
- push @value, $_->{title};
- }
- if ($_->{author}) {
- push @kohafields, "author";
- push @and_or, "\@and";
- push @relation, "";
- push @value, $_->{author};
- }
- # ... and on publicationyear.
- if ($_->{publicationyear}) {
- push @kohafields, "copyrightdate";
- push @and_or, "\@and";
- push @relation, "";
- push @value, $_->{publicationyear};
- }
- # ... and on publisher.
- if ($_->{publishercode}) {
- push @kohafields, "publishercode";
- push @and_or, "\@and";
- push @relation, "";
- push @value, $_->{publishercode};
- }
-
- my ($nbresult,@finalresult) = ZEBRAsearch_kohafields(\@kohafields,\@value,\@relation,"",\@and_or,0,"",0,1);
-
- # there is at least 1 result => return the 1st one
- if ($nbresult) {
- $_->{duplicateBiblionumber} = $finalresult[0]->{biblionumber};
- }
- }
+my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
+ {
+ template_name => "acqui/newordersuggestion.tmpl",
+ type => "intranet",
+ query => $input,
+ authnotrequired => 1,
+ flagsrequired => { acquisition => 'order_manage' },
+ }
+);
+
+if ( $op eq 'connectDuplicate' ) {
+ ConnectSuggestionAndBiblio( $suggestionid, $duplicateNumber );