[Koha-cvs] koha/acqui suggestion-select.pl [dev_week]

Joshua Ferraro jmf at kados.org
Tue Jul 11 15:45:09 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Joshua Ferraro <kados>	06/07/11 13:45:09

Modified files:
	acqui          : suggestion-select.pl 

Log message:
	sync with rel_2_2

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/acqui/suggestion-select.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.3.2.5&r2=1.3.2.5.2.1

Patches:
Index: suggestion-select.pl
===================================================================
RCS file: /sources/koha/koha/acqui/suggestion-select.pl,v
retrieving revision 1.3.2.5
retrieving revision 1.3.2.5.2.1
diff -u -b -r1.3.2.5 -r1.3.2.5.2.1
--- suggestion-select.pl	5 Feb 2006 21:59:21 -0000	1.3.2.5
+++ suggestion-select.pl	11 Jul 2006 13:45:09 -0000	1.3.2.5.2.1
@@ -7,6 +7,8 @@
 use C4::Auth;       # get_template_and_user
 use C4::Interface::CGI::Output;
 use C4::Suggestions;
+use C4::Biblio;
+use C4::SearchMarc;
 
 my $input = new CGI;
 
@@ -22,6 +24,9 @@
 my $publicationyear = $input->param('publicationyear');
 my $place = $input->param('place');
 my $isbn = $input->param('isbn');
+my $duplicateNumber = $input->param('duplicateNumber');
+my $suggestionid = $input->param('suggestionid');
+
 my $status = 'ACCEPTED';
 my $suggestedbyme = -1; # search ALL suggestors
 my $op = $input->param('op');
@@ -36,7 +41,58 @@
 			     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 (@tags, @and_or, @excluding, @operator, @value, $offset,$length);
+		# search on biblio.title
+		if ($_->{title}) {
+			my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblio.title","");
+			push @tags, "'".$tag.$subfield."'";
+			push @and_or, "and";
+			push @excluding, "";
+			push @operator, "contains";
+			push @value, $_->{title};
+		}
+		if ($_->{author}) {
+			my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblio.author","");
+			push @tags, "'".$tag.$subfield."'";
+			push @and_or, "and";
+			push @excluding, "";
+			push @operator, "contains";
+			push @value, $_->{author};
+		}
+		# ... and on publicationyear.
+		if ($_->{publicationyear}) {
+			my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblioitems.publicationyear","");
+			push @tags, "'".$tag.$subfield."'";
+			push @and_or, "and";
+			push @excluding, "";
+			push @operator, "=";
+			push @value, $_->{publicationyear};
+		}
+		# ... and on publisher.
+		if ($_->{publishercode}) {
+			my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblioitems.publishercode","");
+			push @tags, "'".$tag.$subfield."'";
+			push @and_or, "and";
+			push @excluding, "";
+			push @operator, "=";
+			push @value, $_->{publishercode};
+		}
+	
+		my ($finalresult,$nbresult) = C4::SearchMarc::catalogsearch($dbh,\@tags,\@and_or,\@excluding,\@operator,\@value,0,10);
+		# there is at least 1 result => return the 1st one
+		if ($nbresult) {
+	# 		warn "$nbresult => ".@$finalresult[0]->{biblionumber},@$finalresult[0]->{bibid},@$finalresult[0]->{title};
+# 			warn "DUPLICATE ==>".@$finalresult[0]->{biblionumber},@$finalresult[0]->{bibid},@$finalresult[0]->{title};
+			$_->{duplicateBiblionumber} = @$finalresult[0]->{biblionumber};
+		}
+	}
+}
 $template->param(suggestions_loop => $suggestions_loop,
 				title => $title,
 				author => $author,





More information about the Koha-cvs mailing list