From 23427c51b917d2c5bb903c1dea2270dad9798bc6 Mon Sep 17 00:00:00 2001 From: tipaul Date: Fri, 15 Jun 2007 13:44:44 +0000 Subject: [PATCH] some fixes (and only fixes) --- C4/Biblio.pm | 26 +++++++--- C4/Output.pm | 2 +- C4/Search.pm | 1 + catalogue/moredetail.pl | 8 +-- cataloguing/addbiblio.pl | 51 +++++++++---------- installer/install.pl | 1 + .../opac-tmpl/prog/en/includes/masthead.inc | 4 +- .../opac-tmpl/prog/en/includes/navigation.inc | 1 - koha-tmpl/opac-tmpl/prog/en/includes/opac.css | 46 +++++++++++------ .../opac-tmpl/prog/en/opac-advsearch.tmpl | 2 +- .../prog/en/opac-authorities-home.tmpl | 2 +- misc/cronjobs/build_browser_and_cloud.pl | 9 +++- misc/migration_tools/rebuild_nozebra.pl | 12 ++++- reserve/renewscript.pl | 2 +- 14 files changed, 104 insertions(+), 63 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 9964709e10..a9c3303e31 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1996,14 +1996,11 @@ sub TransformHtmlToXml { my $xml = MARC::File::XML::header('UTF-8'); if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { MARC::File::XML->default_record_format('UNIMARC'); - use POSIX qw(strftime); - my $string = strftime( "%Y%m%d", localtime(time) ); - $string = sprintf( "%-*s", 35, $string ); - substr( $string, 22, 6, "frey50" ); - $xml .= "\n"; - $xml .= "$string\n"; - $xml .= "\n"; - } + } + # in UNIMARC, field 100 contains the encoding + # check that there is one, otherwise the + # MARC::Record->new_from_xml will fail (and Koha will die) + my $unimarc_and_100_exist=0; my $prevvalue; my $prevtag = -1; my $first = 1; @@ -2017,6 +2014,7 @@ sub TransformHtmlToXml { if ( !utf8::is_utf8( @$values[$i] ) ) { utf8::decode( @$values[$i] ); } + $unimarc_and_100_exist=1 if C4::Context->preference('marcflavour') eq 'UNIMARC' and @$tags[$i] eq "100" and @$subfields[$i] eq "a"; if ( ( @$tags[$i] ne $prevtag ) ) { $j++ unless ( @$tags[$i] eq "" ); if ( !$first ) { @@ -2087,6 +2085,15 @@ sub TransformHtmlToXml { } $prevtag = @$tags[$i]; } + if (C4::Context->preference('marcflavour') and !$unimarc_and_100_exist) { + use POSIX qw(strftime); + my $string = strftime( "%Y%m%d", localtime(time) ); + $string = sprintf( "%-*s", 35, $string ); + substr( $string, 22, 6, "frey50" ); + $xml .= "\n"; + $xml .= "$string\n"; + $xml .= "\n"; + } $xml .= MARC::File::XML::footer(); return $xml; @@ -3936,6 +3943,9 @@ Joshua Ferraro jmf@liblime.com # $Id$ # $Log$ +# Revision 1.212 2007/06/15 13:44:44 tipaul +# some fixes (and only fixes) +# # Revision 1.211 2007/06/15 09:40:06 toins # do not get $3 $4 and $5 on GetMarcSubjects GetMarcAuthors on unimarc flavour. # diff --git a/C4/Output.pm b/C4/Output.pm index 46e48eeb98..b92d7126d9 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -326,7 +326,7 @@ corresponds to the HTML page $html. sub output_html_with_http_headers ($$$) { my($query, $cookie, $html) = @_; print $query->header( - -type => 'utf-8', + -type => 'text/html; charset=utf-8', -cookie => $cookie, ), $html; } diff --git a/C4/Search.pm b/C4/Search.pm index 64447e2d5e..91282ad484 100755 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1218,6 +1218,7 @@ sub NZanalyse { # automatic replace for short operators $left='title' if $left eq 'ti'; $left='author' if $left eq 'au'; + $left='publisher' if $left eq 'pb'; $left='koha-Auth-Number' if $left eq 'an'; if ($operator) { #do a specific search diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index 8d515258da..86e004855b 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -66,8 +66,8 @@ $data->{'dewey'}=$dewey; my @results; -my (@items)= itemissues($bi); -my $count=@items; +my $items= GetItemIssues($bi); +my $count=@$items; $data->{'count'}=$count; my $ordernum = GetOrderNumber($biblionumber,$bi); @@ -75,7 +75,7 @@ my $order = GetOrder($ordernum); $results[0]=$data; -foreach my $item (@items){ +foreach my $item (@$items){ $item->{'replacementprice'}=sprintf("%.2f", $item->{'replacementprice'}); $item->{'datelastborrowed'}= format_date($item->{'datelastborrowed'}); $item->{'dateaccessioned'} = format_date($item->{'dateaccessioned'}); @@ -94,7 +94,7 @@ foreach my $item (@items){ } $template->param(BIBITEM_DATA => \@results); -$template->param(ITEM_DATA => \@items); +$template->param(ITEM_DATA => \@$items); $template->param(loggedinuser => $loggedinuser); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 2482851d5b..20fec7b790 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -97,32 +97,31 @@ sub MARCfindbreeding { my ($file,$marc,$encoding) = $sth->fetchrow; if ($marc) { my $record = MARC::Record->new_from_usmarc($marc); - if ($record->field('010')){ - foreach my $field ($record->field('010')) - { - foreach my $subfield ($field->subfield('a')){ - my $newisbn = $field->subfield('a'); - $newisbn =~ s/-//g; - $field->update( 'a' => $newisbn ); - - - } -# $record->insert_fields_ordered($record->field('010')); - } - } - - if ($record->subfield(100,'a')){ - my $f100a=$record->subfield(100,'a'); - my $f100 = $record->field(100); - my $f100temp = $f100->as_string; - $record->delete_field($f100); - if (length($f100temp)>28){ - substr($f100temp,26,2,"50"); - $f100->update('a' => $f100temp); - my $f100 = MARC::Field->new('100','','','a' => $f100temp); - $record->insert_fields_ordered($f100); - } - } + if ($record->field('010')){ + foreach my $field ($record->field('010')) + { + foreach my $subfield ($field->subfield('a')){ + my $newisbn = $field->subfield('a'); + $newisbn =~ s/-//g; + $field->update( 'a' => $newisbn ); + } + # $record->insert_fields_ordered($record->field('010')); + } + } + warn "AVANT : ".$record->as_formatted; + if ($record->subfield(100,'a')) { + my $f100a=$record->subfield(100,'a'); + my $f100 = $record->field(100); + my $f100temp = $f100->as_string; + $record->delete_field($f100); + if (length($f100temp)>28) { + substr($f100temp,26,2,"50"); + $f100->update('a' => $f100temp); + my $f100 = MARC::Field->new('100','','','a' => $f100temp); + $record->insert_fields_ordered($f100); + } + } + warn "APRES: ".$record->as_formatted; if (ref($record) eq undef) { return -1; } else { diff --git a/installer/install.pl b/installer/install.pl index c65fff54ff..58796b4d2a 100755 --- a/installer/install.pl +++ b/installer/install.pl @@ -118,6 +118,7 @@ if ($step && $step==1){ unless (eval {require Digest::MD5}) { push @missing,{name=>"Digest::MD5"} }; unless (eval {require MARC::Record}) { push @missing,{name=>"MARC::Record"} }; unless (eval {require Mail::Sendmail}) { push @missing,{name=>"Mail::Sendmail",usagemail=>1} }; + unless (eval {require List::MoreUtils}) { push @missing,{name=>"List::MoreUtils"} }; # The following modules are not mandatory, depends on how the library want to use Koha unless (eval {require PDF::API2}) { if ($#missing>=0) { # only when $#missing >= 0 so this isn't fatal diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc index d64dfcf7d7..8ca01ab27e 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc @@ -10,10 +10,10 @@ \ No newline at end of file diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/navigation.inc b/koha-tmpl/opac-tmpl/prog/en/includes/navigation.inc index bef46cbce9..479a79ed66 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/navigation.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/navigation.inc @@ -31,7 +31,6 @@ -
diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/opac.css b/koha-tmpl/opac-tmpl/prog/en/includes/opac.css index a6a2896fd5..bed3eecef6 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/includes/opac.css @@ -47,7 +47,8 @@ label { display:block; float:left; margin-right:0.2em; - width:7em; + width:10em; + font-size:0.8em; } a:link, a:visited, a:active { @@ -149,16 +150,19 @@ tr.highlight td, tr.highlight th { text-align:left; font-size:150%; font-weight:bold; - margin-bottom:25px; + margin-bottom:5px; } /* The image on the top-left (the logo) */ #masthead-image { - position:fixed; - padding-left:0px; - padding-top:0px; + position:absolute; + left:10px; + top:10px; + background-color:white; } + #masthead-image img { + background-color:white; } /* the itemtype list in advanced search */ @@ -184,14 +188,18 @@ tr.highlight td, tr.highlight th { /* the content part of every page */ #main { - margin-left:20%; + margin-left:15%; margin-bottom:0px; } /* the main menu (home, adv search) */ + #menu { - position:fixed; - padding:0px; + position:absolute; + padding:10px; + left:0px; + top:100px; + width:12%; font-size:0.8em; font-weight:bold; color:#384b73; @@ -204,34 +212,42 @@ tr.highlight td, tr.highlight th { text-decoration:none; color:#384b73; white-space: nowrap; + margin:0px; + padding:0px; } #menu ul a:hover { display:block; - margin:5px 5px 0px 5px; - padding :5px 5px 0px 5px; + margin:0; + padding :0; text-decoration:none; color:#990033; white-space: nowrap; } #menu ul { padding-left:0px; - margin-bottom:0px; - margin-top:0px; + margin:0; + padding-bottom:0px; } #menu li { list-style-type:none; + margin:0px; + padding-bottom:10px; } + /***************/ /* login block */ /***************/ #login { - position:fixed; - bottom:0px; + position:absolute; + left:0px; + bottom:10px; font-size:0.8em; - background-color : #cccccc; + background-color : #dddddd; padding:10px; + margin-right:84%; + width:12%; } #login input { font-size:0.8em; diff --git a/koha-tmpl/opac-tmpl/prog/en/opac-advsearch.tmpl b/koha-tmpl/opac-tmpl/prog/en/opac-advsearch.tmpl index 7754ba159a..081087a025 100644 --- a/koha-tmpl/opac-tmpl/prog/en/opac-advsearch.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/opac-advsearch.tmpl @@ -442,7 +442,7 @@

- + [Fewer Options] diff --git a/koha-tmpl/opac-tmpl/prog/en/opac-authorities-home.tmpl b/koha-tmpl/opac-tmpl/prog/en/opac-authorities-home.tmpl index 45ba605557..04395ad8b9 100644 --- a/koha-tmpl/opac-tmpl/prog/en/opac-authorities-home.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/opac-authorities-home.tmpl @@ -60,7 +60,7 @@

(add % at the end of your word if you want to use right-truncation : theor% will find theory & theories)

- +

diff --git a/misc/cronjobs/build_browser_and_cloud.pl b/misc/cronjobs/build_browser_and_cloud.pl index c727d86174..490d542fb7 100755 --- a/misc/cronjobs/build_browser_and_cloud.pl +++ b/misc/cronjobs/build_browser_and_cloud.pl @@ -46,9 +46,11 @@ die; # ################################### +$max_digits=3 unless $max_digits; $field =~ /(\d\d\d)(.?)/; my $browser_tag = $1; my $browser_subfield = $2; +warn "browser : $browser_tag / $browser_subfield"; die "no cloud or browser field/subfield defined : nothing to do !" unless $browser_tag or $cloud_tag; my $dbh = C4::Context->dbh; @@ -107,13 +109,16 @@ while ((my ($biblionumber)= $sth->fetchrow)) { # fills the browser table if ($browser_tag) { + print "inserting datas in browser table\n"; # read existing classification table is possible my $classification; - if (C4::Context->preference('opaclanguages') eq 'en' && $browser_tag eq '676' & $browser_subfield eq 'a') { + if (C4::Context->preference('opaclanguages') eq 'fr' && $browser_tag eq '676' & $browser_subfield eq 'a') { $classification = dewey_french(); } - + $classification = dewey_french(); # calculate end node... + use Data::Dumper; + warn "==>".Dumper(%browser_result); foreach (keys %browser_result) { my $father = substr($_,0,-1); $browser_result{$father}->{notendnode}=1; diff --git a/misc/migration_tools/rebuild_nozebra.pl b/misc/migration_tools/rebuild_nozebra.pl index ae42c9ea72..ea6dc9c02e 100755 --- a/misc/migration_tools/rebuild_nozebra.pl +++ b/misc/migration_tools/rebuild_nozebra.pl @@ -55,7 +55,7 @@ unless (%index) { 'biblionumber' =>'0909', 'itemtype' => '200b', 'language' => '101a', - 'publisher' => '210x', + 'publisher' => '210c', 'date' => '210d', 'note' => '300a,301a,302a,303a,304a,305a,306az,307a,308a,309a,310a,311a,312a,313a,314a,315a,316a,317a,318a,319a,320a,321a,322a,323a,324a,325a,326a,327a,328a,330a,332a,333a,336a,337a,345a', 'Koha-Auth-Number' => '6009,6019,6029,6039,6049,6059,6069,6109,7009,7019,7029,7109,7119,7129', @@ -147,15 +147,20 @@ while (my ($biblionumber) = $sth->fetchrow) { } } } +print "\nInserting records...\n"; +$i=0; my $sth = $dbh->prepare("INSERT INTO nozebra (server,indexname,value,biblionumbers) VALUES ('biblioserver',?,?,?)"); foreach my $key (keys %result) { foreach my $index (keys %{$result{$key}}) { if (length($result{$key}->{$index}) > 1000000) { print "very long index (".length($result{$key}->{$index}).")for $key / $index. update mySQL config file if you have an error just after this warning (max_paquet_size parameter)\n"; } + print "\r$i"; + $i++; $sth->execute($key,$index,$result{$key}->{$index}); } } +print "\nbiblios done\n"; print "\n***********************************\n"; print "***** building AUTHORITIES indexes *****\n"; @@ -237,12 +242,17 @@ while (my ($authid) = $sth->fetchrow) { } } } +print "\nInserting...\n"; +$i=0; my $sth = $dbh->prepare("INSERT INTO nozebra (server,indexname,value,biblionumbers) VALUES ('authorityserver',?,?,?)"); foreach my $key (keys %result) { foreach my $index (keys %{$result{$key}}) { if (length($result{$key}->{$index}) > 1000000) { print "very long index (".length($result{$key}->{$index}).")for $key / $index. update mySQL config file if you have an error just after this warning (max_paquet_size parameter)\n"; } + print "\r$i"; + $i++; $sth->execute($key,$index,$result{$key}->{$index}); } } +print "\nauthorities done\n"; diff --git a/reserve/renewscript.pl b/reserve/renewscript.pl index 198139f911..c2c1af2088 100755 --- a/reserve/renewscript.pl +++ b/reserve/renewscript.pl @@ -55,7 +55,7 @@ foreach my $itemno (@data) { # warn "renewal added"; # }else { # warn "cannot renew"; -# } + } } # -- 2.39.5