koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/z3950/encodingfix Biblio.pm,NONE,1.1.2.1 README-eng


From: Benedict P. Barszcz
Subject: [Koha-cvs] CVS: koha/z3950/encodingfix Biblio.pm,NONE,1.1.2.1 README-english,NONE,1.1.2.1 README-polish,NONE,1.1.2.1 search.pl,NONE,1.1.2.1
Date: Mon, 03 May 2004 08:02:08 -0700

Update of /cvsroot/koha/koha/z3950/encodingfix
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13851/z3950/encodingfix

Added Files:
      Tag: rel_2_0
        Biblio.pm README-english README-polish search.pl 
Log Message:
interim z39.50 charset encoding fix. See README  for more.

--- NEW FILE ---
package C4::Biblio;
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA  02111-1307 USA

use strict;
[...2509 lines suppressed...]
# Revision 1.5  2002/07/24 16:11:37  tipaul
# Now, the API...
# Database.pm and Output.pm are almost not modified (var test...)
#
# Biblio.pm is almost completly rewritten.
#
# WHAT DOES IT ??? ==> END of Hitchcock suspens
#
# 1st, it does... nothing...
# Every old API should be there. So if MARC-stuff is not done, the behaviour is 
EXACTLY the same (if there is no added bug, of course). So, if you use normal 
acquisition, you won't find anything new neither on screen or old-DB tables ...
#
# All old-API functions have been cloned. for example, the "newbiblio" sub, now 
has become :
# * a "newbiblio" sub, with the same parameters. It just call a sub named 
OLDnewbiblio
# * a "OLDnewbiblio" sub, which is a copy/paste of the previous newbiblio sub. 
Then, when you want to add the MARC-DB stuff, you can modify the newbiblio sub 
without modifying the OLDnewbiblio one. If we correct a bug in 1.2 in 
newbiblio, we can do the same in main branch by correcting OLDnewbiblio.
# * The MARC stuff is usually done through a sub named MARCxxx where xxx is the 
same as OLDxxx. For example, newbiblio calls MARCnewbiblio. the MARCxxx subs 
use a MARC::Record as parameter.
# The last thing to solve was to manage biblios through real MARC import : they 
must populate the old-db, but must populate the MARC-DB too, without loosing 
information (if we go from MARC::Record to old-data then back to MARC::Record, 
we loose A LOT OF ROWS). To do this, there are subs beginning by "NEWxxx" : 
they manage datas with MARC::Record datas. they call OLDxxx sub too (to 
populate old-DB), but MARCxxx subs too, with a complete MARC::Record ;-)
#
# In Biblio.pm, there are some subs that permits to build a old-style record 
from a MARC::Record, and the opposite. There is also a sub finding a MARC-bibid 
from a old-biblionumber and the opposite too.
# Note we have decided with steve that a old-biblio <=> a MARC-Biblio.
#

--- NEW FILE ---
IMPORTING FROM Z39.50 SERVER WITH Character Set: win1250 (ISO 6937/2) into 
KOHA-2.0 WITH UTF-8 

Files from this directory are here as a fix only and are of temporary nature. 
The fix was delivered to me by Zbigniew Bomart.
It will probably work for the Polish Language only. The issue needs to be 
addressed by Koha developers for the general audience.
There's a general problem with z39.50 import feature for koha instalations 
whose default charset IS NOT iso-8859-1.
When importing from z39.50 servers that keep their records in windows-1250 
charset encoding and koha installation with UTF-8 one may use the replacement 
files in this directory. 
Copy them to the following location:
/usr/local/koha/intranet/modules/C4/Biblio.pm
/usr/local/koha/intranet/cgi-bin/z3950/search.pl

and enjoy importing records in UTF-8 from Character Set: win1250 (ISO 6937/2) 
servers.
I tested it and the files seem to work on Fedora Core 1 and Koha-2.0

Remember to set the appropriate permissions on the files once you copy them. On 
my machine it is:
-rwxr-xr-x    1 apache   apache      91813 May  2 18:34 Biblio.pm
-rwxr-xr-x    1 apache   apache       3263 May  2 18:39 search.pl

Benedict P. Barszcz

--- NEW FILE ---
IMPORTOWANIE DANYCH BIBLIOGRAFICZNYCH Z SERWERA BIBLIOTEKI NARODOWEJ W 
KODOWANIU  win1250 (ISO 6937/2) DO KOHA-2.0 Z KODOWANIEM UTF-8.

Pliki w tym katalogu są czasowym rozwiązaniem problemu, który istnieje 
podczas importowania danych bibliograficznych przez sieć z biblioteki 
Narodowej w Warszawie. Rozwiązanie działa prawdopodobnie tylko dla języka 
polskiego dlatego deweloperzy Koha będą musieli coś zrobić z tym problemem 
w przyszłości.
Pliki z tego katalogu należy przekopiować do ich właściwego katalogu na 
zainstalowanym serwerze Koha-2.0:
/usr/local/koha/intranet/modules/C4/Biblio.pm
/usr/local/koha/intranet/cgi-bin/z3950/search.pl

Po skopiowaniu należy upewnić się, że przywileje plików są właściwe. U 
mnie to jest:
-rwxr-xr-x    1 apache   apache      91813 May  2 18:34 Biblio.pm
-rwxr-xr-x    1 apache   apache       3263 May  2 18:39 search.pl

Po tym zabiegu można spokojnie korzystać z serwera ( 
http://www.bn.org.pl/Z3950_eng.htm) INNOPAC biblioteki Narodowej w Warszawie do 
importu rekordów, które jakimś cudem nadal trzymają w  win1250 (ISO 6937/2).

Autorem przedstawionego rozwiązania jest Zbigniew Bomart.

Benedykt P. Barszcz



--- NEW FILE ---
#!/usr/bin/perl

# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA  02111-1307 USA

use strict;
use CGI;
use C4::Auth;
use C4::Output;
use C4::Interface::CGI::Output;
use C4::Biblio;
use C4::Context;
use C4::Koha; # XXX subfield_is_koha_internal_p
use C4::Z3950;
use C4::Search;
use HTML::Template;
use MARC::File::USMARC;

use vars qw( $tagslib );
use vars qw( $is_a_modif );


my $input = new CGI;
my $dbh = C4::Context->dbh;
my $error = $input->param('error');
my $bibid=$input->param('bibid');
my $title = $input->param('title');
my $author = $input->param('author');
my $isbn = $input->param('isbn');
my $issn = $input->param('issn');
my $random = $input->param('random');
my @results;
my $count;
my $toggle;

my $record;
my $oldbiblio;
if ($bibid > 0) {
        $record = MARCgetbiblio($dbh,$bibid);
        $oldbiblio = MARCmarc2koha($dbh,$record);
}
my $errmsg;
unless ($random) { # if random is a parameter => we're just waiting for the 
search to end, it's a refresh.
        if ($isbn) {
                $random =rand(1000000000);
                $errmsg = addz3950queue($isbn, "isbn", $random, 'CHECKED');
        } elsif ($author) {
                $random =rand(1000000000);
                $errmsg = addz3950queue($author, "author", $random, 'CHECKED');
        } elsif ($title) {
                $random =rand(1000000000);
                $errmsg = addz3950queue($title, "title", $random, 'CHECKED');
        }
}
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "z3950/searchresult.tmpl",
                                query => $input,
                                type => "intranet",
                                authnotrequired => 0,
                                flagsrequired => {catalogue => 1},
                                debug => 1,
                                });

# fill with books in breeding farm
($count, @results) = breedingsearch($title,$isbn,$random);
my $numberpending= &checkz3950searchdone($random);
my @breeding_loop = ();
for (my $i=0; $i <= $#results; $i++) {
        my %row_data;
        if ($i % 2) {
                $toggle="#ffffcc";
        } else {
                $toggle="white";
        }
        $row_data{toggle} = $toggle;
        $row_data{id} = $results[$i]->{'id'};
        $row_data{isbn} = $results[$i]->{'isbn'};
        $row_data{file} = $results[$i]->{'file'};
        $row_data{title} = char_decode($results[$i]->{'title'}, "MARC21");
        $row_data{author} = char_decode($results[$i]->{'author'}, "MARC21");
        push (@breeding_loop, \%row_data);
}

$template->param(isbn => $isbn,
                                                title => $title,
                                                author => $author,
                                                breeding_loop => address@hidden,
                                                refresh => ($numberpending eq 0 
? 0 : "search.pl?bibid=$bibid&random=$random"),
                                                numberpending => $numberpending,
                                                oldbiblionumber => 
$oldbiblio->{'biblionumber'},
                                                );

print $input->header(
-type => guesstype($template->output),
-cookie => $cookie
),$template->output;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]