koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha/C4 Biblio.pm [dev_week]


From: Joshua Ferraro
Subject: [Koha-cvs] koha/C4 Biblio.pm [dev_week]
Date: Sun, 24 Sep 2006 21:48:15 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         dev_week
Changes by:     Joshua Ferraro <kados>  06/09/24 21:48:15

Modified files:
        C4             : Biblio.pm 

Log message:
        Adding POD

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Biblio.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.115.2.51.2.25&r2=1.115.2.51.2.26

Patches:
Index: Biblio.pm
===================================================================
RCS file: /sources/koha/koha/C4/Biblio.pm,v
retrieving revision 1.115.2.51.2.25
retrieving revision 1.115.2.51.2.26
diff -u -b -r1.115.2.51.2.25 -r1.115.2.51.2.26
--- Biblio.pm   24 Sep 2006 21:02:26 -0000      1.115.2.51.2.25
+++ Biblio.pm   24 Sep 2006 21:48:15 -0000      1.115.2.51.2.26
@@ -41,14 +41,17 @@
 
   &ModBiblioframework
 
-  &newbiblio &newbiblioitem &newitems
-  &modnote &newsubject &newsubtitle
+  &checkitems &countitems
+  &itemcalculator &calculatelc
 
-  &checkitems
-  &countitems
   &skip
+  &char_decode &DisplayISBN  
+  &zebraop
+
+  &newbiblio &newbiblioitem &newitems
+  &newsubject &newsubtitle
+  &modsubtitle &modsubject &modaddauthor &moditem &modnote 
 
-  &modsubtitle &modsubject &modaddauthor &moditem
   &getbiblio &getstacks
   &getbiblioitembybiblionumber
   &getbiblioitem &getitemsbybiblioitem
@@ -60,8 +63,6 @@
   &MARCgettagslib
   &MARCmoditemonefield
  
-  &zebraop
-
   &MARCaddbiblio &MARCadditem 
   &MARCmodsubfield &MARCaddsubfield
   &MARCmodbiblio &MARCmoditem
@@ -70,12 +71,7 @@
   &MARCgetbiblio &MARCgetitem &XMLgetbiblio
   &MARCaddword &MARCdelword 
   &MARCdelsubfield
- 
   &MARCgetbiblio2
-
-  &char_decode
-  &DisplayISBN
-  &itemcalculator &calculatelc
 );
 
 =head1 NAME
@@ -84,7 +80,46 @@
 
 =head1 DESCRIPTION
 
-There are three types of routines
+Biblio.pm contains functions for managing storage and editing of bibliographic 
data within Koha. Most of the functions in this module are used for cataloging 
records: adding, editing, or removing biblios, biblioitems, or items. Koha's 
stores bibliographic information in three places:
+
+=over 4 
+1. in the biblio,biblioitems,items, etc tables, which are limited to a 
one-to-one mapping to underlying MARC data
+2. as raw MARC in the Zebra index and storage engine
+3. as raw MARC the biblioitems.marc
+=back
+
+In the 2.4 version of Koha, the authoritative record-level information is in 
biblioitems.marc and the authoritative items information is in the items table.
+
+Because the data isn't completely normalized there's a chance for information 
to get out of sync. The design choice to go with a un-normalized schema was 
driven by performance and stability concerns:
+
+=over 4
+
+1. Compared with MySQL, Zebra is slow to update an index for small data 
changes -- especially for proc-intensive operations like circulation
+
+2. Zebra's index has been known to crash and a backup of the data is necessary 
to rebuild it in such cases
+
+=back
+
+Because of this design choice, the process of managing storage and editing is 
a bit convoluted. Historically, Biblio.pm's grown to an unmanagable size and as 
a result we have several types of functions currently:
+
+=over 4
+
+1. Add*/Mod*/Del*/ - high-level external functions suitable for being called 
from external scripts to manage the collection
+
+2. _koha_* - low-level internal functions for managing the koha tables
+
+3. MARC* functions for interacting with the MARC data in both biblioitems.marc 
Zebra (biblioitems.marc is authoritative)
+
+4. Zebra functions used to update the Zebra index
+
+5. internal helper functions such as char_decode, checkitems, etc. Some of 
these probably belong in Koha.pm
+
+6. other functions that don't belong in Biblio.pm that will be cleaned out in 
time. (like MARCfind_marc_from_kohafield which belongs in Search.pm)
+
+In time, as we solidify the new API these older functions will be weeded out.
+
+=back
+
 
 =head1 EXPORTED FUNCTIONS
 
@@ -254,7 +289,7 @@
         $item->{'dateaccessioned'}=$date;
         &MARCitemchange($dbh,$record,"items.dateaccessioned",$date);
     }
-    my ( $itemnumber, $error ) = &OLDnewitems( $dbh, $item, $item->{barcode} );
+    my ( $itemnumber, $error ) = &_koha_new_items( $dbh, $item, 
$item->{barcode} );
     # add itemnumber to MARC::Record before adding the item.
     $sth =
       $dbh->prepare(
@@ -355,7 +390,7 @@
     &MARCmoditem( $dbh, $record, $bibid, $itemnumber, $delete );
     my $frameworkcode=MARCfind_frameworkcode($dbh,$bibid);
     my $olditem = MARCmarc2koha( $dbh, $record,$frameworkcode );
-    OLDmoditem( $dbh, $olditem );
+    _koha_modify_item( $dbh, $olditem );
 }
 
 =head2 DelBiblio
@@ -1510,56 +1545,6 @@
 
 =head1 INTERNAL FUNCTIONS
 
-=head2 $biblionumber = _koha_add_biblio($dbh,$biblio);
-
-adds a record in biblio table. Datas are in the hash $biblio.
-
-=item $biblionumber = OLDmodbiblio($dbh,$biblio);
-
-modify a record in biblio table. Datas are in the hash $biblio.
-
-=item OLDmodsubtitle($dbh,$bibnum,$subtitle);
-
-modify subtitles in bibliosubtitle table.
-
-=item OLDmodaddauthor($dbh,$bibnum,$author);
-
-adds or modify additional authors
-NOTE :  Strange sub : seems to delete MANY and add only ONE author... maybe 
buggy ?
-
-=item $errors = OLDmodsubject($dbh,$bibnum, $force, @subject);
-
-modify/adds subjects
-
-=item OLDmodnote($dbh,$bibitemnum,$note
-
-modify a note for a biblioitem
-
-=item OLDnewsubject($dbh,$bibnum);
-
-adds a subject
-
-=item OLDnewsubtitle($dbh,$bibnum,$subtitle);
-
-create a new subtitle
-
-=item ($itemnumber,$errors)= OLDnewitems($dbh,$item,$barcode);
-
-create a item. $item is a hash and $barcode the barcode.
-
-=item OLDmoditem($dbh,$item);
-
-modify item
-
-=item OLDdeletebiblioitem($dbh,$biblioitemnumber);
-
-deletes a biblioitem
-NOTE : not standard sub name. Should be OLDdelbiblioitem()
-
-=item OLDdelbiblio($dbh,$biblio);
-
-delete a biblio
-
 =item _koha_add_biblio
 
 =over 4
@@ -1868,7 +1853,7 @@
     $sth->finish;
 }
 
-sub OLDnewitems {
+sub _koha_new_items {
     my ( $dbh, $item, $barcode ) = @_;
 
     #  my $dbh   = C4Connect;
@@ -1960,7 +1945,7 @@
     return ( $itemnumber, $error );
 }
 
-sub OLDmoditem {
+sub _koha_modify_item {
     my ( $dbh, $item ) = @_;
     $item->{'itemnum'} = $item->{'itemnumber'} unless $item->{'itemnum'};
 
@@ -2368,7 +2353,7 @@
     my $itemnumber;
     my $error;
     foreach my $barcode (@barcodes) {
-        ( $itemnumber, $error ) = &OLDnewitems( $dbh, $item, uc($barcode) );
+        ( $itemnumber, $error ) = &_koha_new_items( $dbh, $item, uc($barcode) 
);
         $errors .= $error;
         my $MARCitem = &MARCkoha2marcItem( $dbh, $item->{biblionumber}, 
$itemnumber );
         &MARCadditem( $dbh, $MARCitem, $item->{biblionumber} );
@@ -2379,7 +2364,7 @@
 sub moditem {
     my ($item) = @_;
     my $dbh = C4::Context->dbh;
-    &OLDmoditem( $dbh, $item );
+    &_koha_modify_item( $dbh, $item );
     my $MARCitem =
       &MARCkoha2marcItem( $dbh, $item->{'biblionumber'}, $item->{'itemnum'} );
     my $bibid =
@@ -3016,12 +3001,14 @@
 
 Paul POULAIN address@hidden
 
+Joshua Ferraro address@hidden
+
 =cut
 
-# $Id: Biblio.pm,v 1.115.2.51.2.25 2006/09/24 21:02:26 kados Exp $
+# $Id: Biblio.pm,v 1.115.2.51.2.26 2006/09/24 21:48:15 kados Exp $
 # $Log: Biblio.pm,v $
-# Revision 1.115.2.51.2.25  2006/09/24 21:02:26  kados
-# moveing NEWmoditem to ModItem
+# Revision 1.115.2.51.2.26  2006/09/24 21:48:15  kados
+# Adding POD
 #
 # Revision 1.115.2.51.2.24  2006/09/24 20:37:31  kados
 # missed items




reply via email to

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