koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha C4/Auth.pm C4/Biblio.pm cataloguing/addbib... [rel_3_0]


From: Henri-Damien LAURENT
Subject: [Koha-cvs] koha C4/Auth.pm C4/Biblio.pm cataloguing/addbib... [rel_3_0]
Date: Wed, 20 Sep 2006 13:44:14 +0000

CVSROOT:        /cvsroot/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     Henri-Damien LAURENT <hdl>      06/09/20 13:44:14

Modified files:
        C4             : Auth.pm Biblio.pm 
        cataloguing    : addbiblio.pl additem.pl 
        koha-tmpl/intranet-tmpl/prog/en/cataloguing: addbiblio.tmpl 

Log message:
        Bug Fixing : Cataloguing was broken for UNIMARC.
        Please test.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Auth.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.54.2.1&r2=1.54.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Biblio.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.178.2.6&r2=1.178.2.7
http://cvs.savannah.gnu.org/viewcvs/koha/cataloguing/addbiblio.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.14.2.2&r2=1.14.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/cataloguing/additem.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.7.2.2&r2=1.7.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/cataloguing/addbiblio.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.1&r2=1.1.2.2

Patches:
Index: C4/Auth.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Auth.pm,v
retrieving revision 1.54.2.1
retrieving revision 1.54.2.2
diff -u -b -r1.54.2.1 -r1.54.2.2
--- C4/Auth.pm  25 Aug 2006 14:19:19 -0000      1.54.2.1
+++ C4/Auth.pm  20 Sep 2006 13:44:14 -0000      1.54.2.2
@@ -129,7 +129,7 @@
           getpatroninformation( undef, $borrowernumber );
         my @bordat;
         $bordat[0] = $borr;
-        $template->param( USER_INFO => address@hidden, );
+        $template->param( "USER_INFO" => address@hidden );
 
         # We are going to use the $flags returned by checkauth
         # to create the template's parameters that will indicate
@@ -236,10 +236,10 @@
           # FIXME : can't understand why there is an internal servor error 
when the line bellow
           #         are uncommented.
           
-          #      TemplateEncoding => 
C4::Context->preference("TemplateEncoding"),
-          #      AmazonContent    => C4::Context->preference("AmazonContent"),
-          #      LibraryName      => C4::Context->preference("LibraryName"),
-          #      branchname       => C4::Context->userenv->{"branchname"}, 
+                TemplateEncoding => 
C4::Context->preference("TemplateEncoding"),
+                AmazonContent    => C4::Context->preference("AmazonContent"),
+                LibraryName      => C4::Context->preference("LibraryName"),
+                branchname       => C4::Context->userenv->{"branchname"}, 
             );
         }
     return ( $template, $borrowernumber, $cookie );
@@ -625,23 +625,23 @@
 
     # INTERNAL AUTH
     my $sth =
-      $dbh->prepare("select password,cardnumber from borrowers where 
userid=?");
+      $dbh->prepare("select password,cardnumber,bornum,userid, 
firstname,surname,branchcode,userflags from borrowers where userid=?");
     $sth->execute($userid);
     if ( $sth->rows ) {
-        my ( $md5password, $cardnumber ) = $sth->fetchrow;
+        my ( $md5password, 
$cardnumber,$bornum,$userid,$firstname,$surname,$branchcode,$userflags ) = 
$sth->fetchrow;
         if ( md5_base64($password) eq $md5password ) {
 
-#                      
C4::Context->set_userenv("$bornum",$userid,$cardnumber,$firstname,$surname,$branchcode,$userflags);
+                       
C4::Context->set_userenv("$bornum",$userid,$cardnumber,$firstname,$surname,$branchcode,$userflags);
             return 1, $cardnumber;
         }
     }
-    $sth = $dbh->prepare("select password from borrowers where cardnumber=?");
+    $sth = $dbh->prepare("select password,cardnumber,bornum,userid, 
firstname,surname,branchcode,userflags from borrowers where cardnumber=?");
     $sth->execute($userid);
     if ( $sth->rows ) {
-        my ($md5password) = $sth->fetchrow;
+        my ( $md5password, 
$cardnumber,$bornum,$userid,$firstname,$surname,$branchcode,$userflags ) = 
$sth->fetchrow;
         if ( md5_base64($password) eq $md5password ) {
 
-#                      
C4::Context->set_userenv($bornum,$userid,$cardnumber,$firstname,$surname,$branchcode,$userflags);
+                       
C4::Context->set_userenv($bornum,$userid,$cardnumber,$firstname,$surname,$branchcode,$userflags);
             return 1, $userid;
         }
     }

Index: C4/Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.178.2.6
retrieving revision 1.178.2.7
diff -u -b -r1.178.2.6 -r1.178.2.7
--- C4/Biblio.pm        18 Sep 2006 15:10:23 -0000      1.178.2.6
+++ C4/Biblio.pm        20 Sep 2006 13:44:14 -0000      1.178.2.7
@@ -345,8 +345,19 @@
     $sth->execute(  $frameworkcode,$biblionumber );
     $sth->finish;
        my $encoding = C4::Context->preference("marcflavour");
-    my $sth =$dbh->prepare("update biblioitems set marc=?  where 
biblionumber=?"   );
-    $sth->execute( $record->as_usmarc() , $biblionumber);     
+    if ($encoding eq "UNIMARC") {
+      unless ($record->field('100') or 
substr($record->subfield('100',"a"),26,2) ne 50){
+          use POSIX qw(strftime);
+          my $string=strftime("%Y%m%d",localtime(time));
+          $string=~s/\-//g;
+          $string = sprintf("%-*s",35, $string);
+          substr($string,22,6,"frey50");
+          
$record->insert_fields_ordered(MARC::Field->new(100,"","","a"=>$string));
+      }
+    }
+    my $sth =$dbh->prepare("update biblioitems set marc=?,marcxml=?  where 
biblionumber=?"   );
+    $sth->execute( $record->as_usmarc(),$record->as_xml_record() , 
$biblionumber);     
+    warn $record->as_xml_record();
     $sth->finish;
        &zebraop($dbh,$biblionumber,"specialUpdate","biblioserver");
     return $biblionumber;
@@ -408,14 +419,14 @@
     my ( $dbh, $biblionumber ) = @_;
        my $dbh = C4::Context->dbh;
 
-    my $sth = $dbh->prepare("select marc from biblioitems where biblionumber=? 
"  );
+    my $sth = $dbh->prepare("select marcxml from biblioitems where 
biblionumber=? "  );
     
     $sth->execute($biblionumber);
-       my ($marc)=$sth->fetchrow;
-       $marc=MARC::File::USMARC::decode($marc);
+       my ($marcxml)=$sth->fetchrow;
+#      $marc=MARC::File::USMARC::decode($marc);
        # print Dumper($marc);
-       my $marcxml=$marc->as_xml_record();
-       print Dumper($marcxml);
+#      my $marcxml=$marc->as_xml_record();
+#      print Dumper($marcxml);
        return $marcxml;
 }
 sub MARCgetbiblio2 {
@@ -972,13 +983,23 @@
     my $prevtag=-1;
     my $first=1;
        my $j = -1;
+#     $xml.="<leader>        a                </leader>";
+    use POSIX qw(strftime);
+    my $string=strftime ("%Y%m%d",localtime(time));
+    $string = sprintf("%-*s",35, $string);
+    substr($string,22,6,"frey50");
+    $xml.="<datafield tag=\"100\" ind1=\"\" ind2=\"\">\n";
+    $xml.="<subfield code=\"a\">$string</subfield>\n";
+    $xml.="</datafield>\n";
     for (my $i=0;$i<address@hidden;$i++){
                @$values[$i] =~ s/&/&amp;/g;
                @$values[$i] =~ s/</&lt;/g;
                @$values[$i] =~ s/>/&gt;/g;
                @$values[$i] =~ s/"/&quot;/g;
                @$values[$i] =~ s/'/&apos;/g;
-
+        if (! utf8::is_utf8(@$values[$i])) {
+          utf8::decode(@$values[$i]);
+        }
                if ((@$tags[$i] ne $prevtag)){
                        $j++ unless (@$tags[$i] eq "");
                        #warn 
"IND:".substr(@$indicator[$j],0,1).substr(@$indicator[$j],1,1)." 
"address@hidden;
@@ -1083,6 +1104,13 @@
        }
        # the last has not been included inside the loop... do it now !
        $record->add_fields($field) if $field;
+       use POSIX qw(strftime);
+    my $string=strftime ("%Y%m%d",localtime(time));
+    $string = sprintf("%-*s",35, $string);
+    substr($string,22,6,"frey50");
+    unless ($record->subfield(100,"a")){
+      $record->insert_fields_ordered(MARC::Field->new(100,"","","a"=>$string));
+    }
 #      warn "HTML2MARC=".$record->as_formatted;
        $record->encoding( 'UTF-8' );
 #      $record->MARC::File::USMARC::update_leader();
@@ -3047,6 +3075,7 @@
        $Zconnbiblio[0]=C4::Context->Zconnauth($server);
        if ($server eq "biblioserver"){
                $record =XMLgetbiblio($dbh,$biblionumber);
+#         warn "record: $record";
                $shadow="biblioservershadow";
        }elsif($server eq "authorityserver"){
                $record 
=C4::AuthoritiesMarc::XMLgetauthority($dbh,$biblionumber);
@@ -3092,7 +3121,6 @@
        }
        $Zpackage->destroy();
        $Zconnbiblio[0]->destroy();
-
 }
 
 
@@ -3195,8 +3223,12 @@
 
 =cut
 
-# $Id: Biblio.pm,v 1.178.2.6 2006/09/18 15:10:23 toins Exp $
+# $Id: Biblio.pm,v 1.178.2.7 2006/09/20 13:44:14 hdl Exp $
 # $Log: Biblio.pm,v $
+# Revision 1.178.2.7  2006/09/20 13:44:14  hdl
+# Bug Fixing : Cataloguing was broken for UNIMARC.
+# Please test.
+#
 # Revision 1.178.2.6  2006/09/18 15:10:23  toins
 # add a missing function : find_biblioitemnumber.
 #

Index: cataloguing/addbiblio.pl
===================================================================
RCS file: /cvsroot/koha/koha/cataloguing/addbiblio.pl,v
retrieving revision 1.14.2.2
retrieving revision 1.14.2.3
diff -u -b -r1.14.2.2 -r1.14.2.3
--- cataloguing/addbiblio.pl    5 Sep 2006 21:31:55 -0000       1.14.2.2
+++ cataloguing/addbiblio.pl    20 Sep 2006 13:44:14 -0000      1.14.2.3
@@ -1,6 +1,6 @@
 #!/usr/bin/perl 
 
-# $Id: addbiblio.pl,v 1.14.2.2 2006/09/05 21:31:55 hdl Exp $
+# $Id: addbiblio.pl,v 1.14.2.3 2006/09/20 13:44:14 hdl Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -31,7 +31,7 @@
 use C4::Koha; # XXX subfield_is_koha_internal_p
 use HTML::Template;
 use MARC::File::USMARC;
-use MARC::File::XML('BinaryEncoding'=>'utf8','RecordFormat' => 'UNIMARC' );
+use MARC::File::XML('BinaryEncoding'=>'utf8');
 use utf8;
 
 if (C4::Context->preference('marcflavour') eq 'UNIMARC') {

Index: cataloguing/additem.pl
===================================================================
RCS file: /cvsroot/koha/koha/cataloguing/additem.pl,v
retrieving revision 1.7.2.2
retrieving revision 1.7.2.3
diff -u -b -r1.7.2.2 -r1.7.2.3
--- cataloguing/additem.pl      1 Sep 2006 13:13:33 -0000       1.7.2.2
+++ cataloguing/additem.pl      20 Sep 2006 13:44:14 -0000      1.7.2.3
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: additem.pl,v 1.7.2.2 2006/09/01 13:13:33 toins Exp $
+# $Id: additem.pl,v 1.7.2.3 2006/09/20 13:44:14 hdl Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -29,8 +29,8 @@
 use C4::Koha; # XXX subfield_is_koha_internal_p
 use C4::Search;
 use HTML::Template;
-use MARC::File::USMARC;
-use Smart::Comments;
+use MARC::File::XML;
+use Data::Dumper;
 
 sub find_value {
        my ($tagfield,$insubfield,$record) = @_;
@@ -47,6 +47,23 @@
        }
        return($indicator,$result);
 }
+sub find_biblioitemnumber {
+       my ($dbh,$bibnum) = @_;
+       my $result;
+    my $rq=$dbh->prepare("SELECT biblioitemnumber from biblioitems where 
biblionumber=?");
+    $rq->execute($bibnum);
+    my ($result)=$rq->fetchrow;
+       return($result);
+}
+sub get_item_from_barcode {
+    my ($barcode)address@hidden;
+    my $dbh=C4::Context->dbh;
+       my $result;
+    my $rq=$dbh->prepare("SELECT itemnumber from items where items.barcode=?");
+    $rq->execute($barcode);
+    my ($result)=$rq->fetchrow;
+       return($result);
+}
 my $input = new CGI;
 my $dbh = C4::Context->dbh;
 my $error = $input->param('error');
@@ -110,7 +127,7 @@
 } elsif ($op eq "edititem") {
 
#------------------------------------------------------------------------------------------------------------------------------
 # retrieve item if exist => then, it's a modif
-       $itemrecord = get_record($biblionumber);
+       $itemrecord = MARCgetitem($dbh,$biblionumber,$itemnumber);
        $nextop="saveitem";
 
#------------------------------------------------------------------------------------------------------------------------------
 } elsif ($op eq "delitem") {
@@ -154,7 +171,7 @@
 my %indicators;
 $indicators{995}='  ';
 # now, build existiing item list
-my $temp = get_record($biblionumber);
+my $temp = MARCgetbiblio($dbh,$biblionumber);
 my @fields = $temp->fields();
 #my @fields = $record->fields();
 my %witness; #---- stores the list of subfields used at least once, with the 
"meaning" of the code

Index: koha-tmpl/intranet-tmpl/prog/en/cataloguing/addbiblio.tmpl
===================================================================
RCS file: 
/cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/cataloguing/addbiblio.tmpl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- koha-tmpl/intranet-tmpl/prog/en/cataloguing/addbiblio.tmpl  4 Sep 2006 
09:14:51 -0000       1.1.2.1
+++ koha-tmpl/intranet-tmpl/prog/en/cataloguing/addbiblio.tmpl  20 Sep 2006 
13:44:14 -0000      1.1.2.2
@@ -1,4 +1,5 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Cataloging: <!-- TMPL_IF 
NAME="oldbiblionumtagfield" -->Edit MARC Record Number <!-- TMPL_VAR 
name="bibid" --><!-- TMPL_ELSE -->Add MARC Record<!-- /TMPL_IF --><!-- 
TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Cataloging: <!-- TMPL_IF 
NAME="oldbiblionumtagfield" -->Edit MARC Record Number <!-- TMPL_VAR 
name="bibid" --><!-- TMPL_ELSE -->Add MARC Record<!-- /TMPL_IF -->
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 
 <!-- TMPL_INCLUDE NAME="menus.inc" -->
 <!-- TMPL_INCLUDE NAME="menu-catalogue.inc" -->




reply via email to

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