sub MARCfind_marc_from_kohafield {
my ( $dbh, $kohafield,$frameworkcode ) = @_;
return 0, 0 unless $kohafield;
- my $sth =
- $dbh->prepare(
-"select tagfield,tagsubfield from marc_subfield_structure where frameworkcode=? and kohafield=?"
- );
- $sth->execute($frameworkcode,$kohafield);
- my ( $tagfield, $tagsubfield ) = $sth->fetchrow;
- return ( $tagfield, $tagsubfield );
+ my $relations = C4::Context->marcfromkohafield;
+ return ($relations->{$frameworkcode}->{$kohafield}->[0],$relations->{$frameworkcode}->{$kohafield}->[1]);
+# my $sth =
+# $dbh->prepare(
+# "select tagfield,tagsubfield from marc_subfield_structure where frameworkcode=? and kohafield=?"
+# );
+# $sth->execute($frameworkcode,$kohafield);
+# my ( $tagfield, $tagsubfield ) = $sth->fetchrow;
+# return ( $tagfield, $tagsubfield );
}
sub MARCfind_oldbiblionumber_from_MARCbibid {
sub FindDuplicate {
my ($record)=@_;
my $dbh = C4::Context->dbh;
- # FIXME re-activate FindDuplicate
- return;
my $result = MARCmarc2koha($dbh,$record,'');
# search duplicate on ISBN, easy and fast...
my $sth = $dbh->prepare("select biblio.biblionumber,bibid,title from biblio,biblioitems,marc_biblio where biblio.biblionumber=biblioitems.biblionumber and marc_biblio.biblionumber=biblioitems.biblionumber and isbn=?");
# $Id$
# $Log$
+# Revision 1.113 2004/12/10 16:27:53 tipaul
+# limiting the number of search term to 8. There was no limit before, but 8 words seems to be the upper limit mySQL can deal with (in less than a second. tested on a DB with 13 000 items)
+# In 2.4, a new DB structure will highly speed things and this limit will be removed.
+# FindDuplicate is activated again, the perf problems were due to this problem.
+#
# Revision 1.112 2004/12/08 10:14:42 tipaul
# * desactivate FindDuplicate
# * fix from Genji
my $nb_active=0; # will contain the number of "active" entries. an entry is active if a value is provided.
my $nb_table=1; # will contain the number of table. ++ on each entry EXCEPT when an OR is provided.
- for(my $i=0; $i<=@$value;$i++) {
+ my $maxloop=8; # the maximum number of words to avoid a too complex search.
+ $maxloop = @$value if @$value<$maxloop;
+
+ for(my $i=0; $i<=$maxloop;$i++) {
if (@$value[$i]) {
$nb_active++;
if ($nb_active==1) {