From 293d534fca61e3636907c22273b644e94394452a Mon Sep 17 00:00:00 2001 From: Chris Nighswonger Date: Thu, 28 Jan 2010 10:42:17 -0500 Subject: [PATCH] 3.0.x Back-port: 4074 Bugfix: The 'Subject(s)' link(s) are malformed resulting in no search results NOTE: This patch ONLY applies to the current 3.0.x branch. These links are rendered with the wrong syntax. ie. 'q=su:foo' This results in a search for 'su:foo' rather than a search for 'foo' with an index of 'su.' This patch corrects the code so that the syntax conforms to current parsing methods. ie. 'idx=su&q=foo' NOTE: The change to the underlying C4::Biblio->GetMarcSubjects() does not need to be ported to any other calling code. Signed-off-by: Chris Nighswonger --- C4/Biblio.pm | 275 ++++++++++---------- .../opac-tmpl/prog/en/modules/opac-detail.tmpl | 50 ++-- 2 files changed, 165 insertions(+), 160 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 385f141..37bd559 100755 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -50,7 +50,7 @@ BEGIN { &GetRecordValue ); - push @EXPORT, qw( + push @EXPORT, qw( &AddBiblio ); @@ -63,12 +63,12 @@ BEGIN { &GetBiblioItemByBiblioNumber &GetBiblioFromItemNumber &GetBiblioSummary - + &GetRecordValue &GetFieldMapping &SetFieldMapping &DeleteFieldMapping - + &GetISBDView &GetMarcNotes @@ -87,7 +87,7 @@ BEGIN { &GetFrameworkCode &GetPublisherNameFromIsbn &TransformKohaToMarc - + &CountItemsIssued ); @@ -240,10 +240,10 @@ sub AddBiblio { # update MARC subfield that stores biblioitems.cn_sort _koha_marc_update_biblioitem_cn_sort($record, $olddata, $frameworkcode); - + # now add the record ModBiblioMarc( $record, $biblionumber, $frameworkcode ) unless $$options{defer_marc_save} ||= 0; - + logaction("CATALOGUING", "ADD", $biblionumber, "biblio") if C4::Context->preference("CataloguingLog"); return ( $biblionumber, $biblioitemnumber ); } @@ -278,9 +278,9 @@ sub ModBiblio { my $newrecord = GetMarcBiblio($biblionumber); logaction("CATALOGUING", "MODIFY", $biblionumber, "BEFORE=>".$newrecord->as_formatted); } - + my $dbh = C4::Context->dbh; - + $frameworkcode = "" unless $frameworkcode; # get the items before and append them to the biblio before updating the record, atm we just have the biblio @@ -293,10 +293,10 @@ sub ModBiblio { foreach my $field ($record->field($itemtag)) { $record->delete_field($field); } - + # once all the items fields are removed, copy the old ones, in order to keep synchronize $record->append_fields($oldRecord->field( $itemtag )); - + # update biblionumber and biblioitemnumber in MARC # FIXME - this is assuming a 1 to 1 relationship between # biblios and biblioitems @@ -314,7 +314,7 @@ sub ModBiblio { # update the MARC record (that now contains biblio and items) with the new record data &ModBiblioMarc( $record, $biblionumber, $frameworkcode ); - + # modify the other koha tables _koha_modify_biblio( $dbh, $oldbiblio, $frameworkcode ); _koha_modify_biblioitem_nonmarc( $dbh, $oldbiblio ); @@ -358,7 +358,7 @@ sub DelBiblio { my ( $biblionumber ) = @_; my $dbh = C4::Context->dbh; my $error; # for error handling - + # First make sure this biblio has no items attached my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE biblionumber=?"); $sth->execute($biblionumber); @@ -374,7 +374,7 @@ sub DelBiblio { foreach my $subscription (@$subscriptions){ &C4::Serials::DelSubscription($subscription->{subscriptionid}); } - + # Delete in Zebra. Be careful NOT to move this line after _koha_delete_biblio # for at least 2 reasons : # - we need to read the biblio if NoZebra is set (to remove it from the indexes @@ -423,10 +423,10 @@ Links bib headings to authority records by checking each authority-controlled field in the C object C<$marc>, looking for a matching authority record, and setting the linking subfield $9 to the ID of that -authority record. +authority record. If no matching authority exists, or if multiple -authorities match, no $9 will be added, and any +authorities match, no $9 will be added, and any existing one inthe field will be deleted. Returns the number of heading links changed in the @@ -439,7 +439,7 @@ sub LinkBibHeadingsToAuthorities { my $num_headings_changed = 0; foreach my $field ($bib->fields()) { - my $heading = C4::Heading->new_from_bib_field($field); + my $heading = C4::Heading->new_from_bib_field($field); next unless defined $heading; # check existing $9 @@ -483,25 +483,25 @@ Get MARC fields from a keyword defined in fieldmapping table. sub GetRecordValue { my ($field, $record, $frameworkcode) = @_; my $dbh = C4::Context->dbh; - + my $sth = $dbh->prepare('SELECT fieldcode, subfieldcode FROM fieldmapping WHERE frameworkcode = ? AND field = ?'); $sth->execute($frameworkcode, $field); - + my @result = (); - + while(my $row = $sth->fetchrow_hashref){ foreach my $field ($record->field($row->{fieldcode})){ if( ($row->{subfieldcode} ne "" && $field->subfield($row->{subfieldcode}))){ foreach my $subfield ($field->subfield($row->{subfieldcode})){ push @result, { 'subfield' => $subfield }; } - + }elsif($row->{subfieldcode} eq "") { push @result, {'subfield' => $field->as_string()}; } } } - + return \@result; } @@ -520,13 +520,13 @@ Set a Field to MARC mapping value, if it already exists we don't add a new one. sub SetFieldMapping { my ($framework, $field, $fieldcode, $subfieldcode) = @_; my $dbh = C4::Context->dbh; - + my $sth = $dbh->prepare('SELECT * FROM fieldmapping WHERE fieldcode = ? AND subfieldcode = ? AND frameworkcode = ? AND field = ?'); $sth->execute($fieldcode, $subfieldcode, $framework, $field); if(not $sth->fetchrow_hashref){ my @args; $sth = $dbh->prepare('INSERT INTO fieldmapping (fieldcode, subfieldcode, frameworkcode, field) VALUES(?,?,?,?)'); - + $sth->execute($fieldcode, $subfieldcode, $framework, $field); } } @@ -546,7 +546,7 @@ Delete a field mapping from an $id. sub DeleteFieldMapping{ my ($id) = @_; my $dbh = C4::Context->dbh; - + my $sth = $dbh->prepare('DELETE FROM fieldmapping WHERE id = ?'); $sth->execute($id); } @@ -566,10 +566,10 @@ Get all field mappings for a specified frameworkcode sub GetFieldMapping { my ($framework) = @_; my $dbh = C4::Context->dbh; - + my $sth = $dbh->prepare('SELECT * FROM fieldmapping where frameworkcode = ?'); $sth->execute($framework); - + my @return; while(my $row = $sth->fetchrow_hashref){ push @return, $row; @@ -599,21 +599,21 @@ sub GetBiblioData { my ( $bibnum ) = @_; my $dbh = C4::Context->dbh; - # my $query = C4::Context->preference('item-level_itypes') ? + # my $query = C4::Context->preference('item-level_itypes') ? # " SELECT * , biblioitems.notes AS bnotes, biblio.notes # FROM biblio # LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber # WHERE biblio.biblionumber = ? # AND biblioitems.biblionumber = biblio.biblionumber #"; - + my $query = " SELECT * , biblioitems.notes AS bnotes, itemtypes.notforloan as bi_notforloan, biblio.notes FROM biblio LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber LEFT JOIN itemtypes ON biblioitems.itemtype = itemtypes.itemtype WHERE biblio.biblionumber = ? AND biblioitems.biblionumber = biblio.biblionumber "; - + my $sth = $dbh->prepare($query); $sth->execute($bibnum); my $data; @@ -644,9 +644,9 @@ sub GetBiblioItemData { my $dbh = C4::Context->dbh; my $query = "SELECT *,biblioitems.notes AS bnotes FROM biblio LEFT JOIN biblioitems on biblio.biblionumber=biblioitems.biblionumber "; - unless(C4::Context->preference('item-level_itypes')) { + unless(C4::Context->preference('item-level_itypes')) { $query .= "LEFT JOIN itemtypes on biblioitems.itemtype=itemtypes.itemtype "; - } + } $query .= " WHERE biblioitemnumber = ? "; my $sth = $dbh->prepare($query); my $data; @@ -705,16 +705,16 @@ sub GetBiblioFromItemNumber { my $dbh = C4::Context->dbh; my $sth; if($itemnumber) { - $sth=$dbh->prepare( "SELECT * FROM items + $sth=$dbh->prepare( "SELECT * FROM items LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber - WHERE items.itemnumber = ?") ; + WHERE items.itemnumber = ?") ; $sth->execute($itemnumber); } else { - $sth=$dbh->prepare( "SELECT * FROM items + $sth=$dbh->prepare( "SELECT * FROM items LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber - WHERE items.barcode = ?") ; + WHERE items.barcode = ?") ; $sth->execute($barcode); } my $data = $sth->fetchrow_hashref; @@ -722,7 +722,7 @@ sub GetBiblioFromItemNumber { return ($data); } -=head2 GetISBDView +=head2 GetISBDView =over 4 @@ -740,16 +740,16 @@ sub GetISBDView { my $itemtype = &GetFrameworkCode($biblionumber); my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField("items.holdingbranch",$itemtype); my $tagslib = &GetMarcStructure( 1, $itemtype ); - + my $ISBD = C4::Context->preference('ISBD'); if($template eq "opac"){ $ISBD = C4::Context->preference('OPACISBD'); } - + my $bloc = $ISBD; my $res; my $blocres; - + foreach my $isbdfield ( split (/#/, $bloc) ) { # $isbdfield= /(.?.?.?)/; @@ -759,19 +759,19 @@ sub GetISBDView { my $textbefore = $3; my $analysestring = $4; my $textafter = $5; - + # warn "==> $1 / $2 / $3 / $4"; # my $fieldvalue=substr($isbdfield,0,3); if ( $fieldvalue > 0 ) { my $hasputtextbefore = 0; my @fieldslist = $record->field($fieldvalue); @fieldslist = sort {$a->subfield($holdingbrtagsubf) cmp $b->subfield($holdingbrtagsubf)} @fieldslist if ($fieldvalue eq $holdingbrtagf); - + # warn "ERROR IN ISBD DEFINITION at : $isbdfield" unless $fieldvalue; # warn "FV : $fieldvalue"; if ($subfvalue ne ""){ foreach my $field ( @fieldslist ) { - foreach my $subfield ($field->subfield($subfvalue)){ + foreach my $subfield ($field->subfield($subfvalue)){ my $calculated = $analysestring; my $tag = $field->tag(); if ( $tag < 10 ) { @@ -783,23 +783,23 @@ sub GetISBDView { my $tagsubf = $tag . $subfvalue; $calculated =~ s/\{(.?.?.?.?)$tagsubf(.*?)\}/$1$subfieldvalue$2\{$1$tagsubf$2\}/g; - + # field builded, store the result if ( $calculated && !$hasputtextbefore ) { # put textbefore if not done $blocres .= $textbefore; $hasputtextbefore = 1; } - + # remove punctuation at start $calculated =~ s/^( |;|:|\.|-)*//g; $blocres .= $calculated; - + } } } $blocres .= $textafter if $hasputtextbefore; - } else { + } else { foreach my $field ( @fieldslist ) { my $calculated = $analysestring; my $tag = $field->tag(); @@ -814,40 +814,40 @@ sub GetISBDView { GetAuthorisedValueDesc( $tag, $subf[$i][0], $subf[$i][1], '', $tagslib ); my $tagsubf = $tag . $subfieldcode; - + $calculated =~ s/\{\{$tagsubf\}\}/$valuecode/gx; $calculated =~ s/\{(.?.?.?.?)$tagsubf(.*?)\}/$1$subfieldvalue$2\{$1$tagsubf$2\}/g; } - + # field builded, store the result if ( $calculated && !$hasputtextbefore ) { # put textbefore if not done $blocres .= $textbefore; $hasputtextbefore = 1; } - + # remove punctuation at start $calculated =~ s/^( |;|:|\.|-)*//g; $blocres .= $calculated; } } $blocres .= $textafter if $hasputtextbefore; - } + } } else { $blocres .= $isbdfield; } } $res .= $blocres; - + $res =~ s/\{(.*?)\}//g; $res =~ s/\\n/\n/g; $res =~ s/\n//g; - + # remove empty () $res =~ s/\(\)//g; - + return $res; } @@ -934,9 +934,9 @@ sub GetMarcStructure { my ($total) = $sth->fetchrow; $frameworkcode = "" unless ( $total > 0 ); $sth = $dbh->prepare( - "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable - FROM marc_tag_structure - WHERE frameworkcode=? + "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable + FROM marc_tag_structure + WHERE frameworkcode=? ORDER BY tagfield" ); $sth->execute($frameworkcode); @@ -953,13 +953,13 @@ sub GetMarcStructure { } $sth = $dbh->prepare( - "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue - FROM marc_subfield_structure - WHERE frameworkcode=? + "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue + FROM marc_subfield_structure + WHERE frameworkcode=? ORDER BY tagfield,tagsubfield " ); - + $sth->execute($frameworkcode); my $subfield; @@ -1010,14 +1010,14 @@ sub GetMarcStructure { the same function as GetMarcStructure except it just takes field in tab 0-9. (used field) - + my $results = GetUsedMarcStructure($frameworkcode); - + L<$results> is a ref to an array which each case containts a ref to a hash which each keys is the columns from marc_subfield_structure - - L<$frameworkcode> is the framework code. - + + L<$frameworkcode> is the framework code. + =cut sub GetUsedMarcStructure($){ @@ -1025,7 +1025,7 @@ sub GetUsedMarcStructure($){ my $query = qq/ SELECT * FROM marc_subfield_structure - WHERE tab > -1 + WHERE tab > -1 AND frameworkcode = ? ORDER BY tagfield, tagsubfield /; @@ -1039,7 +1039,7 @@ sub GetUsedMarcStructure($){ =over 4 ($MARCfield,$MARCsubfield)=GetMarcFromKohaField($kohafield,$frameworkcode); -Returns the MARC fields & subfields mapped to the koha field +Returns the MARC fields & subfields mapped to the koha field for the given frameworkcode =back @@ -1250,26 +1250,26 @@ Return the summary of a record. sub GetBiblioSummary { my $recorddata =shift @_; - + return unless $recorddata; my $marcflavour = C4::Context->preference("marcflavour"); my $marc=MARC::Record::new_from_xml($recorddata,"utf-8",$marcflavour); return unless $marc; - + my $str; - + if($marcflavour eq "MARC21"){ $str="".$marc->subfield('245',"a")."" if $marc->subfield('245','a'); $str.= " ".$marc->subfield('245',"b")." " if $marc->subfield('245','b'); - + if ($marc->field('245')){ $str.=" / "; foreach ($marc->field('100')->subfield("a")) { $str.=$_." ; "; } - $str=~s/ ; $/. /; + $str=~s/ ; $/. /; } - + if ($marc->field('260')){ $str.=" - "; $str.=$marc->subfield('260',"a")." " if $marc->subfield('260','a'); @@ -1287,12 +1287,12 @@ sub GetBiblioSummary { $str.= " - "; foreach ($_->subfield("a")){ $str.=$_."; " - } + } } my $itemtypes=GetItemTypes(); $str.=" - ".$itemtypes->{$marc->subfield('942','c')}->{'description'}." "; $str.="
\n"; - + }else{ $str = "".$marc->subfield('200','a')."" if $marc->subfield('200','a'); $str.= " ".$marc->subfield('200','e')." " if $marc->subfield('200','e'); @@ -1301,17 +1301,17 @@ sub GetBiblioSummary { foreach ($marc->field('200')->subfield("f")) { $str.=$_." ; "; } - $str=~s/ ; $/. /; + $str=~s/ ; $/. /; } - + if ($marc->subfield('200','g')){ $str.=" ; "; foreach ($marc->field('200')->subfield("g")){ $str.=$_." ; "; - } - $str=~s/ ; $/. /; + } + $str=~s/ ; $/. /; } - + if ($marc->field('461')){ $str.="- In :"; $str.= $marc->subfield('461','t') if $marc->subfield('461','t'); @@ -1320,14 +1320,14 @@ sub GetBiblioSummary { $str.=", ".$marc->subfield('461','h') if $marc->subfield('461','h'); $str.=" ; ".$marc->subfield('461','x') if $marc->subfield('461','x'); } - + if ($marc->field('210')){ $str.=" - "; $str.=$marc->subfield('210',"a")." " if $marc->subfield('210','a'); $str.=" : ".$marc->subfield('210',"c")." " if $marc->subfield('210','c'); $str.=", ".$marc->subfield('210',"d")." " if $marc->subfield('210','d'); } - + if ($marc->field('215')){ $str.=" - "; $str.=$marc->subfield('215','a') if ($marc->subfield(215,'a')); @@ -1339,15 +1339,15 @@ sub GetBiblioSummary { $str.=" - "; foreach ($_->subfield("a")){ $str.=$_."; " - } + } } - + my $itemtypes=GetItemTypes; if($itemtypes->{$marc->subfield('200','b')}){ $str.=" - ".$itemtypes->{$marc->subfield('200','b')}->{'description'}." "; } - $str.="
\n"; - } + $str.="
\n"; + } return $str; } @@ -1472,7 +1472,7 @@ sub GetMarcSubjects { $mintag = "600"; $maxtag = "611"; } - + my @marcsubjects; my $subject = ""; my $subfield = ""; @@ -1485,6 +1485,7 @@ sub GetMarcSubjects { my $counter = 0; my @link_loop; # if there is an authority link, build the link with an= subfield9 + my $found9 = 0; my $subfield9 = $field->subfield('9'); for my $subject_subfield (@subfields ) { # don't load unimarc subfields 3,4,5 @@ -1494,22 +1495,26 @@ sub GetMarcSubjects { my $code = $subject_subfield->[0]; my $value = $subject_subfield->[1]; my $linkvalue = $value; + my $limit = ''; $linkvalue =~ s/(\(|\))//g; - my $operator = " and " unless $counter==0; - if ($subfield9) { - @link_loop = ({'limit' => 'an' ,link => "$subfield9" }); - } else { - push @link_loop, {'limit' => 'su', link => $linkvalue, operator => $operator }; + my $operator = " and " unless $counter == 0; + if ( $code eq 9 ) { + $found9 = 1; + $limit = 'an'; + @link_loop = ( {link => "$linkvalue" } ); + } + if ( not $found9 ) { + $limit = 'su'; + push @link_loop, {link => $linkvalue, operator => $operator }; } my $separator = C4::Context->preference("authoritysep") unless $counter==0; # ignore $9 my @this_link_loop = @link_loop; - push @subfields_loop, {code => $code, value => $value, link_loop => \@this_link_loop, separator => $separator} unless ($subject_subfield->[0] eq 9 ); + push @subfields_loop, { code => $code, value => $value, link_loop => \@this_link_loop, separator => $separator, limit => $limit} unless ( $subject_subfield->[0] eq 9 ); $counter++; } - push @marcsubjects, { MARCSUBJECT_SUBFIELDS_LOOP => \@subfields_loop }; - + } return \@marcsubjects; } #end getMARCsubjects @@ -1533,7 +1538,7 @@ sub GetMarcAuthors { my $tagslib = &GetMarcStructure( 1, '' ); # FIXME : we don't have the framework available, we take the default framework. May be buggy on some setups, will be usually correct. if ( $marcflavour eq "MARC21" ) { $mintag = "700"; - $maxtag = "720"; + $maxtag = "720"; } elsif ( $marcflavour eq "UNIMARC" ) { # assume unimarc if not marc21 $mintag = "700"; @@ -1588,7 +1593,7 @@ sub GetMarcAuthors { $marcurls = GetMarcUrls($record,$marcflavour); Returns arrayref of URLs from MARC data, suitable to pass to tmpl loop. -Assumes web resources (not uncommon in MARC21 to omit resource type ind) +Assumes web resources (not uncommon in MARC21 to omit resource type ind) =back @@ -1841,7 +1846,7 @@ sub TransformHtmlToXml { $auth_type = C4::Context->preference('marcflavour') unless $auth_type; MARC::File::XML->default_record_format($auth_type); # in UNIMARC, field 100 contains the encoding - # check that there is one, otherwise the + # check that there is one, otherwise the # MARC::Record->new_from_xml will fail (and Koha will die) my $unimarc_and_100_exist=0; $unimarc_and_100_exist=1 if $auth_type eq 'ITEM'; # if we rebuild an item, no need of a 100 field @@ -2011,11 +2016,11 @@ sub TransformHtmlToMarc { my $param_value = $cgi_params->{$param_name}; if (utf8::decode($param_value)) { $cgi_params->{$param_name} = $param_value; - } + } # FIXME - need to do something if string is not valid UTF-8 } } - + # creating a new record my $record = MARC::Record->new(); my $i=0; @@ -2041,15 +2046,15 @@ sub TransformHtmlToMarc { ); } push @fields,$newfield if($newfield); - } + } elsif ($param =~ /^tag_(\d*)_indicator1_/){ # new field start when having 'input name="..._indicator1_..." my $tag = $1; - + my $ind1 = _default_ind_to_space(substr($cgi->param($param), 0, 1)); my $ind2 = _default_ind_to_space(substr($cgi->param($params->[$i+1]), 0, 1)); $newfield=0; my $j=$i+2; - + if($tag < 10){ # no code for theses fields # in MARC editor, 000 contains the leader. if ($tag eq '000' ) { @@ -2088,7 +2093,7 @@ sub TransformHtmlToMarc { } $i++; } - + $record->append_fields(@fields); return $record; } @@ -2105,7 +2110,7 @@ our $inverted_field_map; =back Extract data from a MARC bib record into a hashref representing -Koha biblio, biblioitems, and items fields. +Koha biblio, biblioitems, and items fields. =cut sub TransformMarcToKoha { @@ -2114,7 +2119,7 @@ sub TransformMarcToKoha { my $result; $limit_table=$limit_table||0; $frameworkcode = '' unless defined $frameworkcode; - + unless (defined $inverted_field_map) { $inverted_field_map = _get_inverted_marc_field_map(); } @@ -2238,7 +2243,7 @@ name with the table name would require changing lots of code and templates, and exposing more of the DB structure than is good to the UI templates, particularly since biblio and bibloitems may well merge in a future -version. In the future, it would also be good to +version. In the future, it would also be good to separate DB access and UI presentation field names more. @@ -2280,7 +2285,7 @@ FIXME: this is meant to replace TransformMarcToKohaOneField after more testing. sub get_koha_field_from_marc { my ($koha_table,$koha_column,$record,$frameworkcode) = @_; - my ( $tagfield, $subfield ) = GetMarcFromKohaField( $koha_table.'.'.$koha_column, $frameworkcode ); + my ( $tagfield, $subfield ) = GetMarcFromKohaField( $koha_table.'.'.$koha_column, $frameworkcode ); my $kohafield; foreach my $field ( $record->field($tagfield) ) { if ( $field->tag() < 10 ) { @@ -2310,7 +2315,7 @@ sub get_koha_field_from_marc { } } return $kohafield; -} +} =head2 TransformMarcToKohaOneField @@ -2460,7 +2465,7 @@ sub PrepareItemrecordDisplay { if ( ($tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch' || $tagslib->{$tag}->{$subfield}->{kohafield} eq - 'items.homebranch') + 'items.homebranch') && $defaultvalues->{'branchcode'} ) { my $temp = $itemrecord->field($subfield) if ($itemrecord); @@ -2580,15 +2585,15 @@ sub PrepareItemrecordDisplay { # replaced by a zebraqueue table, that is filled with ModZebra to run. # the table is emptied by misc/cronjobs/zebraqueue_start.pl script # =head2 ModZebrafiles -# +# # &ModZebrafiles( $dbh, $biblionumber, $record, $folder, $server ); -# +# # =cut -# +# # sub ModZebrafiles { -# +# # my ( $dbh, $biblionumber, $record, $folder, $server ) = @_; -# +# # my $op; # my $zebradir = # C4::Context->zebraconfig($server)->{directory} . "/" . $folder . "/"; @@ -2598,7 +2603,7 @@ sub PrepareItemrecordDisplay { # } # closedir DIR; # my $filename = $zebradir . $biblionumber; -# +# # if ($record) { # open( OUTPUT, ">", $filename . ".xml" ); # print OUTPUT $record; @@ -2615,11 +2620,11 @@ ModZebra( $biblionumber, $op, $server, $oldRecord, $newRecord ); $biblionumber is the biblionumber we want to index $op is specialUpdate or delete, and is used to know what we want to do $server is the server that we want to update - $oldRecord is the MARC::Record containing the previous version of the record. This is used only when + $oldRecord is the MARC::Record containing the previous version of the record. This is used only when NoZebra=1, as NoZebra indexing needs to know the previous version of a record in order to do an update. $newRecord is the MARC::Record containing the new record. It is usefull only when NoZebra=1, and is used to know what to add to the nozebra database. (the record in mySQL being, if it exist, the previous record, the one just before the modif. We need both : the previous and the new one. - + =back =cut @@ -2643,7 +2648,7 @@ sub ModZebra { if ($op eq 'specialUpdate') { # OK, we have to add or update the record # 1st delete (virtually, in indexes), if record actually exists - if ($oldRecord) { + if ($oldRecord) { %result = _DelBiblioNoZebra($biblionumber,$oldRecord,$server); } # ... add the record @@ -2665,7 +2670,7 @@ sub ModZebra { # # we use zebra, just fill zebraqueue table # - my $check_sql = "SELECT COUNT(*) FROM zebraqueue + my $check_sql = "SELECT COUNT(*) FROM zebraqueue WHERE server = ? AND biblio_auth_number = ? AND operation = ? @@ -2685,7 +2690,7 @@ sub ModZebra { =head2 GetNoZebraIndexes %indexes = GetNoZebraIndexes; - + return the data from NoZebraIndexes syspref. =cut @@ -2721,7 +2726,7 @@ sub GetNoZebraIndexes { sub _DelBiblioNoZebra { my ($biblionumber, $record, $server)=@_; - + # Get the indexes my $dbh = C4::Context->dbh; # Get the indexes @@ -2742,7 +2747,7 @@ sub _DelBiblioNoZebra { $index{'mainentry'} = $authref->{'auth_tag_to_report'}.'*'; $index{'auth_type'} = "${auth_type_tag}${auth_type_sf}"; } - + my %result; # remove blancks comma (that could cause problem when decoding the string for CQL retrieval) and regexp specific values $title =~ s/ |,|;|\[|\]|\(|\)|\*|-|'|=//g; @@ -3101,7 +3106,7 @@ sub _koha_add_biblio { my $serial = 0; if ( $biblio->{'seriestitle'} ) { $serial = 1 }; - my $query = + my $query = "INSERT INTO biblio SET frameworkcode = ?, author = ?, @@ -3169,7 +3174,7 @@ sub _koha_modify_biblio { " ; my $sth = $dbh->prepare($query); - + $sth->execute( $frameworkcode, $biblio->{'author'}, @@ -3210,8 +3215,8 @@ sub _koha_modify_biblioitem_nonmarc { # re-calculate the cn_sort, it may have changed my ($cn_sort) = GetClassSort($biblioitem->{'biblioitems.cn_source'}, $biblioitem->{'cn_class'}, $biblioitem->{'cn_item'} ); - my $query = - "UPDATE biblioitems + my $query = + "UPDATE biblioitems SET biblionumber = ?, volume = ?, number = ?, @@ -3306,12 +3311,12 @@ sub _koha_add_biblioitem { volume volumedate volumedesc /; - ($$biblioitem{cn_sort}) = GetClassSort( @$biblioitem{qw/ biblioitems.cn_source cn_class cn_item /} ); + ($$biblioitem{cn_sort}) = GetClassSort( @$biblioitem{qw/ biblioitems.cn_source cn_class cn_item /} ); my $query = 'INSERT INTO biblioitems SET ' . join ( ',', map { "$_ =?" } @fields ) . ';' - ; + ; my $sth = $dbh->prepare($query); $sth->execute( @$biblioitem{@fields} ); @@ -3433,15 +3438,15 @@ sub _koha_delete_biblioitems { =head2 ModBiblioMarc &ModBiblioMarc($newrec,$biblionumber,$frameworkcode); - - Add MARC data for a biblio to koha - + + Add MARC data for a biblio to koha + Function exported, but should NOT be used, unless you really know what you're doing =cut sub ModBiblioMarc { - + # pass the MARC::Record to this function, and it will create the records in the marc field my ( $record, $biblionumber, $frameworkcode ) = @_; my $dbh = C4::Context->dbh; @@ -3621,7 +3626,7 @@ sub set_service_options { sub get_biblio_authorised_values { my $biblionumber = shift; my $record = shift; - + my $forlibrarian = 1; # are we in staff or opac? my $frameworkcode = GetFrameworkCode( $biblionumber ); @@ -3638,7 +3643,7 @@ sub get_biblio_authorised_values { AND (kohafield like 'biblio%' OR kohafield like '') ); my $bibliolevel_authorised_values = C4::Context->dbh->selectall_hashref( $query, 'authorised_value' ); - + foreach my $tag ( keys( %$tagslib ) ) { foreach my $subfield ( keys( %{$tagslib->{ $tag }} ) ) { # warn "checking $subfield. type is: " . ref $tagslib->{ $tag }{ $subfield }; diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl index dae0bd5..6877e9e 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl @@ -3,7 +3,7 @@ - @@ -69,7 +69,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
- /gp/reader//ref=sib_dp_pt/002-7879865-0184864#reader-link" target="_blank">.01.MZZZZZZZ.jpg" alt="Cover Image" />/gp/reader//ref=sib_dp_pt/002-7879865-0184864#reader-link">.01.MZZZZZZZ.jpg" alt="Cover Image" /> + /gp/reader//ref=sib_dp_pt/002-7879865-0184864#reader-link" target="_blank">.01.MZZZZZZZ.jpg" alt="Cover Image" />/gp/reader//ref=sib_dp_pt/002-7879865-0184864#reader-link">.01.MZZZZZZZ.jpg" alt="Cover Image" /> /.GIF&client=&type=xw10&upc=&oclc=" alt="" class="thumbnail" />No cover image available
" class="" id="gbs-thumbnail">
" target="_blank">See Baker & Taylor" />">See Baker & Taylor" /> @@ -79,11 +79,11 @@ YAHOO.util.Event.onContentReady("furtherm", function () {

-
by ">
+
by ">
Normal View - + @@ -114,7 +114,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () { Authors: - :"> + :"> | @@ -136,11 +136,11 @@ YAHOO.util.Event.onContentReady("furtherm", function () { Published by : "> - + () , - + Physical details: @@ -159,7 +159,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () { , ISSN ; - + @@ -167,19 +167,19 @@ YAHOO.util.Event.onContentReady("furtherm", function () { ; - + - Subject(s): + Subject(s): - " href="/cgi-bin/koha/opac-search.pl?q=:"> + " href="/cgi-bin/koha/opac-search.pl?idx=&q="> | - Subject(s): "> | + Subject(s): "> | @@ -198,11 +198,11 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
Online Resources: @@ -226,7 +226,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () { No tags for this title. + No tags for this title. @@ -256,7 +256,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
-