Browse Source

start of reworking call number handling and other Biblio changes

Most of this commit by Joshua Ferraro.
updatedatabase changes by Galen Charlton.

Major changes:

This commit includes a lot of fairly major changes
to Koha's Biblio handling, largest is the addition
and deletion of several columns in the biblioitems,
items tables, as well as cleanup of deletedbiblioitems,
deleteditems tables. Some of the changes are simple
cleanup, but most have to do with improvements to
storage of call numbers in Koha.

Also, I had to clean up the _koha_* routines quite a
lot to make them work -- there was lots of data just
being lost because columns weren't being updated.

I'm still not completely convinced that the items
table is being treated as authoritative for items
data, investigating further.

DB Changes (updated in kohastructure.sql and in
updatedatabases):

ADDED:
biblioitems.cn_source   ( auth value, CN_SOURCE, stores the source of the
                          call number: DDC, LCC, NLM, etc.)
biblioitems.cn_class    ( plugin, marc21_callnumber.pl, helps fill in
                          the rest of the biblio-level fields)
biblioitems.cn_item
biblioitems.cn_suffix
biblioitems.cn_sort     ( for zebra sorting, stored as a decimal number)
biblioitems.totalissues ( for counting the total times issued )

items.cn_source         ( auth value, CN_SOURCE, stores DDC, LCC, NLM, etc.)
items.itemcallnumber    ( plugin, marc21_itemcallnumber.pl, helps fill in
                          the itemcallnumber based on the record data )
items.cn_sort           ( for zebra sorting, stored as a decimal number)
items.ccode             ( auth value, CCODE, stores the Collection Code
                          of the item, can be used as call number prefix
                          by some libraries )
items.uri
items.materials
items.damaged

DELETED:
items.itype
items.cutterextra
biblioitems.classification
biblioitems.subclass
biblioitems.dewey
biblioitems.lcsort
biblioitems.lccn
biblioitems.ccode

DB version now 3.00.00.009.

Minor changes:

* Drop revision history from C4/Biblio.pm
* GetMarcAuthors now returns additional authors (7XX), not
  main authors (1XX)
* Debug warnings in C4/Search.pm commented out

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
3.0.x
Galen Charlton 17 years ago
committed by Joshua Ferraro
parent
commit
af466ca41a
  1. 1077
      C4/Biblio.pm
  2. 4
      C4/Search.pm
  3. 22
      cataloguing/additem.pl
  4. 39
      installer/data/en/mandatory/marc21_framework_DEFAULT.sql
  5. 91
      installer/kohastructure.sql
  6. 8
      koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl
  7. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl
  8. 2
      kohaversion.pl
  9. 138
      updater/updatedatabase

1077
C4/Biblio.pm

File diff suppressed because it is too large

4
C4/Search.pm

@ -1075,7 +1075,7 @@ sub NZgetRecords {
sub NZanalyse {
my ($string,$server) = @_;
# $server contains biblioserver or authorities, depending on what we search on.
warn "querying : $string on $server";
#warn "querying : $string on $server";
$server='biblioserver' unless $server;
# if we have a ", replace the content to discard temporarily any and/or/not inside
my $commacontent;
@ -1156,7 +1156,7 @@ sub NZanalyse {
my $dbh = C4::Context->dbh;
$operator='LIKE' if $operator eq '=' and $right=~ /%/;
my $sth = $dbh->prepare("SELECT biblionumbers FROM nozebra WHERE server=? AND indexname=? AND value $operator ?");
warn "$left / $operator / $right\n";
# warn "$left / $operator / $right\n";
# split each word, query the DB and build the biblionumbers result
foreach (split / /,$right) {
my $biblionumbers;

22
cataloguing/additem.pl

@ -128,7 +128,7 @@ if ($op eq "additem") {
if ($onloan){
$nextop="additem";
} else {
&DelItem($biblionumber,$itemnumber);
&DelItem($dbh,$biblionumber,$itemnumber);
print $input->redirect("additem.pl?biblionumber=$biblionumber&frameworkcode=$frameworkcode");
#$nextop="additem";
}
@ -165,8 +165,6 @@ my ($template, $loggedinuser, $cookie)
debug => 1,
});
my %indicators;
$indicators{995}=' ';
# now, build existiing item list
my $temp = GetMarcBiblio( $biblionumber );
my @fields = $temp->fields();
@ -183,12 +181,17 @@ foreach my $field (@fields) {
my %this_row;
# loop through each subfield
for my $i (0..$#subf) {
next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} ne 10 && ($field->tag() ne $itemtagfield && $subf[$i][0] ne $itemtagsubfield));
next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} ne 10
&& ($field->tag() ne $itemtagfield
&& $subf[$i][0] ne $itemtagsubfield));
$witness{$subf[$i][0]} = $tagslib->{$field->tag()}->{$subf[$i][0]}->{lib} if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} eq 10);
$this_row{$subf[$i][0]} =$subf[$i][1] if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} eq 10);
if (($field->tag eq $branchtagfield) && ($subf[$i][$0] eq $branchtagsubfield) && C4::Context->preference("IndependantBranches")) {
if (($field->tag eq $branchtagfield) && ($subf[$i][$0] eq $branchtagsubfield) && C4::Context->preference("IndependantBranches")) {
#verifying rights
my $userenv = C4::Context->userenv;
my $userenv = C4::Context->userenv();
unless (($userenv->{'flags'} == 1) or (($userenv->{'branch'} eq $subf[$i][1]))){
$this_row{'nomod'}=1;
}
@ -199,7 +202,7 @@ foreach my $field (@fields) {
push(@big_array, \%this_row);
}
}
#fill big_row with missing datas
#fill big_row with missing data
foreach my $subfield_code (keys(%witness)) {
for (my $i=0;$i<=$#big_array;$i++) {
$big_array[$i]{$subfield_code}="&nbsp;" unless ($big_array[$i]{$subfield_code});
@ -209,6 +212,7 @@ my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField("items.holdingbran
@big_array = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} @big_array;
# now, construct template !
# First, the existing items for display
my @item_value_loop;
my @header_value_loop;
for (my $i=0;$i<=$#big_array; $i++) {
@ -230,10 +234,10 @@ foreach my $subfield_code (sort keys(%witness)) {
push(@header_value_loop, \%header_value);
}
# next item form
# now, build the item form for entering a new item
my @loop_data =();
my $i=0;
my $authorised_values_sth = $dbh->prepare("select authorised_value,lib from authorised_values where category=? order by lib");
my $authorised_values_sth = $dbh->prepare("SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY lib");
foreach my $tag (sort keys %{$tagslib}) {
my $previous_tag = '';

39
installer/data/en/mandatory/marc21_framework_DEFAULT.sql

@ -96,6 +96,20 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`
-- ('942', 'l', 'Classification subclass (DDC after decimal or LCC number after letters', 'Classification subclass', 0, 0, 'biblioitems.subclass', 9, '', '', '', NULL, 0, '', '', '', NULL);
-- rel_2_2 primary biblioitems Field/Subfields
-- INSERT INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `authorised_value`, `frameworkcode`) VALUES
-- ('942', 'ADDED ENTRY ELEMENTS (KOHA)', 'ADDED ENTRY ELEMENTS (KOHA)', 0, 0, '', '');
-- INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES
-- ('942', 'a', 'Institution code [OBSOLETE]', 'Institution code [OBSOLETE]', 0, 0, '', 9, '', '', '', NULL, -5, '', '', '', NULL),
-- ('942', 'c', 'Item type', 'Item type', 0, 1, 'biblioitems.itemtype', 9, 'itemtypes', '', '', NULL, 0, '', '', '', NULL),
-- ('942', 'j', 'Location (call number prefix code)', 'Location (call number prefix code)', 0, 0, 'biblioitems.classification', 9, '', '', '', NULL, 0, '', '', '', NULL),
-- ('942', 'k', 'Classification base (DDC to decimal or LCC letter class padded after single letter classes with trailing 0', 'Classification base', 0, 0, 'biblioitems.dewey', 9, '', '', '', NULL, 0, '', '', '', NULL),
-- ('942', 'l', 'Classification subclass (DDC after decimal or LCC number after letters', 'Classification subclass', 0, 0, 'biblioitems.subclass', 9, '', '', '', NULL, 0, '', '', '', NULL);
-- Current primary biblioitems Field/Subfields
@ -103,16 +117,16 @@ INSERT INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeat
('942', 'ADDED ENTRY ELEMENTS (KOHA)', 'ADDED ENTRY ELEMENTS (KOHA)', 0, 0, '', '');
INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES
('942', '0', 'Koha issues (borrowed), all copies', 'Koha issues (borrowed), all copies', 0, 0, 'biblioitems.totalissues', 9, '', '', '', NULL, -5, '', '', '', NULL),
('942', '2', 'Source of classification or shelving scheme', 'Source of classification or shelving scheme', 0, 0, 'biblioitems.cn_source', 9, '', '', 'marc21_classcodes.pl', NULL, 0, '', '', '', NULL),
('942', '6', 'Koha normalized classification for sorting', 'Koha normalized classification for sorting', 0, 0, 'biblioitems.cn_sort', -1, '', '', '', 0, 7, '', '', '', NULL),
('942', 'a', 'Institution code [OBSOLETE]', 'Institution code [OBSOLETE]', 0, 0, '', 9, '', '', '', NULL, -5, '', '', '', NULL),
('942', 'c', 'Item type', 'Item type', 0, 1, 'biblioitems.itemtype', 9, 'itemtypes', '', '', NULL, 0, '', '', '', NULL),
('942', 'e', 'Edition', 'Edition', 0, 0, 'biblioitems.cn_edition', 9, 'CN_EDITION', '', '', NULL, 0, '', '', '', NULL),
('942', 'h', 'Classification part', 'Classification part', 0, 0, 'biblioitems.cn_class', 9, '', '', 'marc21_callnumber.pl', NULL, 0, '', '', '', NULL),
('942', 'i', 'Item part', 'Item part', 1, 0, 'biblioitems.cn_item', 9, '', '', '', NULL, 9, '', '', '', NULL),
('942', 'k', 'Call number prefix', 'Call number prefix', 0, 0, '', 9, '', '', '', NULL, 0, '', '', '', NULL),
('942', 'm', 'Call number suffix', 'Call number suffix', 0, 0, 'biblioitems.cn_suffix', 9, '', '', '', 0, 0, '', '', '', NULL);
('942', '0', 'Koha issues (borrowed), all copies', 'Koha issues (borrowed), all copies', 0, 0, 'biblioitems.totalissues', 9, '', '', '', NULL, -5, '', '', '', NULL),
('942', '2', 'Source of classification or shelving scheme', 'Source of classification or shelving scheme', 0, 0, 'biblioitems.cn_source', 9, 'CN_SOURCE', '', '', NULL, 0, '', '', '', NULL),
('942', '6', 'Koha normalized classification for sorting', 'Koha normalized classification for sorting', 0, 0, 'biblioitems.cn_sort', -1, '', '', '', 0, 7, '', '', '', NULL),
('942', 'a', 'Institution code [OBSOLETE]', 'Institution code [OBSOLETE]', 0, 0, '', 9, '', '', '', NULL, -5, '', '', '', NULL),
('942', 'c', 'Item type', 'Item type', 0, 1, 'biblioitems.itemtype', 9, 'itemtypes', '', '', NULL, 0, '', '', '', NULL),
('942', 'e', 'Edition', 'Edition', 0, 0, 'biblioitems.cn_edition', 9, 'CN_EDITION', '', '', NULL, 0, '', '', '', NULL),
('942', 'h', 'Classification part', 'Classification part', 0, 0, 'biblioitems.cn_class', 9, '', '', '', NULL, 0, '', '', '', NULL),
('942', 'i', 'Item part', 'Item part', 1, 0, 'biblioitems.cn_item', 9, '', '', '', NULL, 9, '', '', '', NULL),
('942', 'k', 'Call number prefix', 'Call number prefix', 0, 0, '', 9, '', '', '', NULL, 0, '', '', '', NULL),
('942', 'm', 'Call number suffix', 'Call number suffix', 0, 0, 'biblioitems.cn_suffix', 9, '', '', '', 0, 0, '', '', '', NULL);
-- ******************************************************
@ -419,7 +433,6 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`
-- *******************************************************
@ -808,7 +821,6 @@ INSERT INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeat
('ufi', 'FISCAL INFORMATION, FI (RLIN)', 'FISCAL INFORMATION, FI (RLIN)', 1, 0, '', '');
INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES
('000', '@', 'fixed length control field', 'fixed length control field', 0, 1, '', 0, '', '', 'marc21_leader.pl', 0, 0, '', '', '', NULL),
('001', '@', 'control field', 'control field', 0, 0, '', 0, '', '', '', 0, 0, '', '', '', NULL),
@ -4461,6 +4473,3 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`
('ufi', 'g', 'FI', 'FI', 0, 0, '', 9, '', '', '', 0, 5, '', '', '', NULL),
('ufi', 'h', 'FI', 'FI', 0, 0, '', 9, '', '', '', 0, 5, '', '', '', NULL),
('ufi', 'n', 'FI', 'FI', 0, 0, '', 9, '', '', '', 0, 5, '', '', '', NULL);

91
installer/kohastructure.sql

@ -382,16 +382,13 @@ CREATE TABLE `biblioitems` (
`biblionumber` int(11) NOT NULL default 0,
`volume` mediumtext,
`number` mediumtext,
`classification` varchar(25) default NULL,
`itemtype` varchar(10) default NULL,
`isbn` varchar(14) default NULL,
`issn` varchar(9) default NULL,
`dewey` varchar(30) default '',
`subclass` varchar(3) default NULL,
`publicationyear` text,
`publishercode` varchar(255) default NULL,
`volumedate` date default NULL,
`volumeddesc` text,
`volumedesc` text,
`collectiontitle` mediumtext default NULL,
`collectionissn` text default NULL,
`collectionvolume` mediumtext default NULL,
@ -406,8 +403,12 @@ CREATE TABLE `biblioitems` (
`lccn` varchar(25) default NULL,
`marc` longblob,
`url` varchar(255) default NULL,
`lcsort` varchar(25) default NULL,
`ccode` varchar(4) default NULL,
`cn_source` varchar(10) default NULL,
`cn_class` varchar(30) default NULL,
`cn_item` varchar(10) default NULL,
`cn_suffix` varchar(10) default NULL,
`cn_sort` varchar(30) default NULL,
`totalissues` int(10),
`marcxml` longtext NOT NULL,
PRIMARY KEY (`biblioitemnumber`),
KEY `bibinoidx` (`biblioitemnumber`),
@ -625,7 +626,7 @@ CREATE TABLE `currency` (
DROP TABLE IF EXISTS `deletedbiblio`;
CREATE TABLE `deletedbiblio` (
`biblionumber` int(11) NOT NULL default 0,
`frameworkcode` varchar(4) NOT NULL,
`frameworkcode` varchar(4) NOT NULL default '',
`author` mediumtext,
`title` mediumtext,
`unititle` mediumtext,
@ -634,7 +635,7 @@ CREATE TABLE `deletedbiblio` (
`seriestitle` mediumtext,
`copyrightdate` smallint(6) default NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`marc` blob,
`datecreated` DATE NOT NULL,
`abstract` mediumtext,
PRIMARY KEY (`biblionumber`),
KEY `blbnoidx` (`biblionumber`)
@ -650,36 +651,39 @@ CREATE TABLE `deletedbiblioitems` (
`biblionumber` int(11) NOT NULL default 0,
`volume` mediumtext,
`number` mediumtext,
`classification` varchar(25) default NULL,
`itemtype` varchar(10) default NULL,
`isbn` varchar(14) default NULL,
`issn` varchar(9) default NULL,
`dewey` double(8,6) default NULL,
`subclass` varchar(3) default NULL,
`publicationyear` smallint(6) default NULL,
`publicationyear` text,
`publishercode` varchar(255) default NULL,
`volumedate` date default NULL,
`volumeddesc` varchar(255) default NULL,
`volumedesc` text,
`collectiontitle` mediumtext default NULL,
`collectionissn` text default NULL,
`collectionvolume` mediumtext default NULL,
`editionstatement` text default NULL,
`editionresponsibility` text default NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`illus` varchar(255) default NULL,
`pages` varchar(255) default NULL,
`notes` mediumtext,
`size` varchar(255) default NULL,
`place` varchar(255) default NULL,
`lccn` varchar(25) default NULL,
`marc` mediumtext,
`marc` longblob,
`url` varchar(255) default NULL,
`place` varchar(255) default NULL,
`lcsort` varchar(25) default NULL,
`ccode` varchar(4) default NULL,
`cn_source` varchar(10) default NULL,
`cn_class` varchar(30) default NULL,
`cn_item` varchar(10) default NULL,
`cn_suffix` varchar(10) default NULL,
`cn_sort` varchar(30) default NULL,
`totalissues` int(10),
`marcxml` longtext NOT NULL,
`collectiontitle` mediumtext,
`collectionissn` mediumtext,
`collectionvolume` mediumtext,
`editionstatement` text,
`editionresponsibility` text,
PRIMARY KEY (`biblioitemnumber`),
KEY `bibinoidx` (`biblioitemnumber`),
KEY `bibnoidx` (`biblionumber`)
KEY `bibnoidx` (`biblionumber`),
KEY `isbn` (`isbn`),
KEY `publishercode` (`publishercode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
@ -751,12 +755,12 @@ CREATE TABLE `deleteditems` (
`itemnumber` int(11) NOT NULL default 0,
`biblionumber` int(11) NOT NULL default 0,
`biblioitemnumber` int(11) NOT NULL default 0,
`barcode` varchar(9) NOT NULL default '',
`barcode` varchar(20) default NULL,
`dateaccessioned` date default NULL,
`booksellerid` varchar(10) default NULL,
`homebranch` varchar(4) default NULL,
`price` decimal(28,6) default NULL,
`replacementprice` decimal(28,6) default NULL,
`price` decimal(8,2) default NULL,
`replacementprice` decimal(8,2) default NULL,
`replacementpricedate` date default NULL,
`datelastborrowed` date default NULL,
`datelastseen` date default NULL,
@ -765,27 +769,29 @@ CREATE TABLE `deleteditems` (
`damaged` tinyint(1) default NULL,
`itemlost` tinyint(1) default NULL,
`wthdrawn` tinyint(1) default NULL,
`bulk` varchar(30) default NULL,
`itemcallnumber` varchar(30) default NULL,
`issues` smallint(6) default NULL,
`renewals` smallint(6) default NULL,
`reserves` smallint(6) default NULL,
`restricted` tinyint(1) default NULL,
`itemnotes` mediumtext,
`holdingbranch` varchar(4) default NULL,
`interim` tinyint(1) default NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`marc` blob,
`holdingbranch` varchar(10) default NULL,
`paidfor` mediumtext,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`location` varchar(80) default NULL,
`itemcallnumber` varchar(30) default NULL,
`onloan` date default NULL,
`cutterextra` varchar(45) default NULL,
`itype` varchar(10) default NULL,
`cn_source` varchar(10) default NULL,
`cn_sort` varchar(30) default NULL,
`ccode` varchar(10) default NULL,
`materials` varchar(10) default NULL,
`uri` varchar(255) default NULL,
`marc` longblob,
PRIMARY KEY (`itemnumber`),
UNIQUE KEY `barcode` (`barcode`),
KEY `itembarcodeidx` (`barcode`),
KEY `itembinoidx` (`biblioitemnumber`),
KEY `itembibnoidx` (`biblionumber`)
UNIQUE KEY `delitembarcodeidx` (`barcode`),
KEY `delitembinoidx` (`biblioitemnumber`),
KEY `delitembibnoidx` (`biblionumber`),
KEY `delhomebranch` (`homebranch`),
KEY `delholdingbranch` (`holdingbranch`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
@ -881,10 +887,13 @@ CREATE TABLE `items` (
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`location` varchar(80) default NULL,
`onloan` date default NULL,
`cutterextra` varchar(45) default NULL,
`itype` varchar(10) default NULL,
`cn_source` varchar(10) default NULL,
`cn_sort` varchar(30) default NULL,
`ccode` varchar(10) default NULL,
`materials` varchar(10) default NULL,
`uri` varchar(255) default NULL,
PRIMARY KEY (`itemnumber`),
KEY `itembarcodeidx` (`barcode`),
UNIQUE KEY `itembarcodeidx` (`barcode`),
KEY `itembinoidx` (`biblioitemnumber`),
KEY `itembibnoidx` (`biblionumber`),
KEY `homebranch` (`homebranch`),

8
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl

@ -2,9 +2,9 @@
<title>Koha &rsaquo; Catalogue &rsaquo; Details for <!-- TMPL_VAR NAME="title" --></title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!-- Core + Skin CSS -->
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.3.1/build/button/assets/skins/sam/button.css">
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.3.1/build/button/assets/skins/sam/button.css"/>
<!-- OPTIONAL: Menu Stylesheet (required for creating buttons of type "menu" and "split") -->
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.3.1/build/menu/assets/skins/sam/menu.css">
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.3.1/build/menu/assets/skins/sam/menu.css"/>
<!-- Dependencies -->
<script type="text/javascript" src="http://yui.yahooapis.com/2.3.1/build/yahoo-dom-event/yahoo-dom-event.js"></script>
@ -122,7 +122,7 @@ function yuiToolbar(){
<ul>
<!-- TMPL_IF name="MARCAUTHORS" -->
<li><strong>Authors:</strong><ul>
<li><strong>Additional Authors:</strong><ul>
<!-- TMPL_LOOP NAME="MARCAUTHORS" -->
<li><a href="/cgi-bin/koha/catalogue/search.pl?q=Koha-Auth-Number:<!-- TMPL_VAR NAME="link" -->">
<!-- TMPL_VAR NAME="value" -->
@ -154,7 +154,7 @@ function yuiToolbar(){
<div class="yui-u"><!-- TMPL_IF NAME="AmazonContent" -->
<a href="http://www.amazon.com/gp/reader/<!-- TMPL_VAR NAME="isbn" -->/ref=sib_dp_pt/002-7879865-0184864#reader-link"><img border="0" src="http://images.amazon.com/images/P/<!-- TMPL_VAR NAME="isbn" -->.01._PIdp-schmooS,TopRight,7,-26_SCMZZZZZZZ_.jpg" alt="Book Cover Image" /></a>
<!-- TMPL_ELSE -->
<img src="http://g-images.amazon.com/images/G/01/x-site/icons/no-img-sm.gif" alt="" border="0">
<img src="http://g-images.amazon.com/images/G/01/x-site/icons/no-img-sm.gif" alt="" border="0"/>
<!-- /TMPL_IF --></div>
<div class="yui-u">

2
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl

@ -447,7 +447,7 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
<input type="hidden" name="biblionumber" value="<!-- TMPL_VAR name="duplicatebiblionumber" -->" />
<input type="submit" value="Yes: Edit existing items" />
</form>
<form action="/cgi-bin/koha/cataloguing/addbibliopl" method="get">
<form action="/cgi-bin/koha/cataloguing/addbiblio.pl" method="get">
<input type="submit" onclick="confirmnotdup(); return false;" value="No: Save as New Record" />
</form>
</div>

2
kohaversion.pl

@ -8,7 +8,7 @@
# and is automatically called by Auth.pm when needed.
sub kohaversion {
return "3.00.00.008";
return "3.00.00.009";
}
1;

138
updater/updatedatabase

@ -146,6 +146,144 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
$DBversion = "3.00.00.009";
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
# Create backups of call number columns
# in case default migration needs to be customized
#
# UPGRADE NOTE: temp_upg_biblioitems_call_num should be dropped
# after call numbers have been transformed to the new structure
#
# Not bothering to do the same with deletedbiblioitems -- assume
# default is good enough.
$dbh->do("CREATE TABLE `temp_upg_biblioitems_call_num` AS
SELECT `biblioitemnumber`, `biblionumber`,
`classification`, `dewey`, `subclass`,
`lcsort`, `ccode`
FROM `biblioitems`");
# biblioitems changes
$dbh->do("ALTER TABLE `biblioitems` CHANGE COLUMN `volumeddesc` `volumedesc` TEXT");
$dbh->do("ALTER TABLE `biblioitems` ADD `cn_source` VARCHAR(10) DEFAULT NULL AFTER `ccode`");
$dbh->do("ALTER TABLE `biblioitems` ADD `cn_class` VARCHAR(30) DEFAULT NULL AFTER `cn_source`");
$dbh->do("ALTER TABLE `biblioitems` ADD `cn_item` VARCHAR(10) DEFAULT NULL AFTER `cn_class`");
$dbh->do("ALTER TABLE `biblioitems` ADD `cn_suffix` VARCHAR(10) DEFAULT NULL AFTER `cn_item`");
$dbh->do("ALTER TABLE `biblioitems` ADD `cn_sort` VARCHAR(30) DEFAULT NULL AFTER `cn_suffix`");
$dbh->do("ALTER TABLE `biblioitems` ADD `totalissues` INT(10) AFTER `cn_sort`");
# default mapping of call number columns:
# cn_class = concatentation of classification + dewey,
# trimmed to fit -- assumes that most users do not
# populate both classification and dewey in a single record
# cn_item = subclass
# cn_source = left null
# cn_sort = lcsort
#
# After upgrade, cn_sort will have to be set based on whatever
# default call number scheme user sets as a preference. Misc
# script will be added at some point to do that.
#
$dbh->do("UPDATE `biblioitems`
SET cn_class = SUBSTR(TRIM(CONCAT_WS(' ', `classification`, `dewey`)), 1, 30)");
$dbh->do("UPDATE `biblioitems` SET cn_item = subclass");
$dbh->do("UPDATE `biblioitems` SET `cn_sort` = `lcsort`");
# Now drop the old call number columns
$dbh->do("ALTER TABLE `biblioitems` DROP COLUMN `classification`");
$dbh->do("ALTER TABLE `biblioitems` DROP COLUMN `dewey`");
$dbh->do("ALTER TABLE `biblioitems` DROP COLUMN `subclass`");
$dbh->do("ALTER TABLE `biblioitems` DROP COLUMN `lcsort`");
$dbh->do("ALTER TABLE `biblioitems` DROP COLUMN `ccode`");
# deletedbiblio changes
$dbh->do("ALTER TABLE `deletedbiblio` ALTER COLUMN `frameworkcode` SET DEFAULT ''");
$dbh->do("ALTER TABLE `deletedbiblio` DROP COLUMN `marc`");
$dbh->do("ALTER TABLE `deletedbiblio` ADD `datecreated` DATE NOT NULL AFTER `timestamp`");
$dbh->do("UPDATE deletedbiblio SET datecreated = timestamp");
# deletedbiblioitems changes
$dbh->do("ALTER TABLE `deletedbiblioitems` MODIFY `publicationyear` TEXT");
$dbh->do("ALTER TABLE `deletedbiblioitems` CHANGE `volumeddesc` `volumedesc` TEXT");
$dbh->do("ALTER TABLE `deletedbiblioitems` MODIFY `collectiontitle` MEDIUMTEXT DEFAULT NULL AFTER `volumedesc`");
$dbh->do("ALTER TABLE `deletedbiblioitems` MODIFY `collectionissn` TEXT DEFAULT NULL AFTER `collectiontitle`");
$dbh->do("ALTER TABLE `deletedbiblioitems` MODIFY `collectionvolume` MEDIUMTEXT DEFAULT NULL AFTER `collectionissn`");
$dbh->do("ALTER TABLE `deletedbiblioitems` MODIFY `editionstatement` TEXT DEFAULT NULL AFTER `collectionvolume`");
$dbh->do("ALTER TABLE `deletedbiblioitems` MODIFY `editionresponsibility` TEXT DEFAULT NULL AFTER `editionstatement`");
$dbh->do("ALTER TABLE `deletedbiblioitems` MODIFY `place` VARCHAR(255) DEFAULT NULL AFTER `size`");
$dbh->do("ALTER TABLE `deletedbiblioitems` MODIFY `marc` BLOB");
$dbh->do("ALTER TABLE `deletedbiblioitems` ADD `cn_source` VARCHAR(10) DEFAULT NULL AFTER `url`");
$dbh->do("ALTER TABLE `deletedbiblioitems` ADD `cn_class` VARCHAR(30) DEFAULT NULL AFTER `cn_source`");
$dbh->do("ALTER TABLE `deletedbiblioitems` ADD `cn_item` VARCHAR(10) DEFAULT NULL AFTER `cn_class`");
$dbh->do("ALTER TABLE `deletedbiblioitems` ADD `cn_suffix` VARCHAR(10) DEFAULT NULL AFTER `cn_item`");
$dbh->do("ALTER TABLE `deletedbiblioitems` ADD `cn_sort` VARCHAR(30) DEFAULT NULL AFTER `cn_suffix`");
$dbh->do("ALTER TABLE `deletedbiblioitems` ADD `totalissues` INT(10) AFTER `cn_sort`");
$dbh->do("ALTER TABLE `deletedbiblioitems` ADD KEY `isbn` (`isbn`)");
$dbh->do("ALTER TABLE `deletedbiblioitems` ADD KEY `publishercode` (`publishercode`)");
$dbh->do("UPDATE `deletedbiblioitems`
SET cn_class = SUBSTR(TRIM(CONCAT_WS(' ', `classification`, `dewey`)), 1, 30)");
$dbh->do("UPDATE `deletedbiblioitems` SET cn_item = subclass");
$dbh->do("UPDATE `deletedbiblioitems` SET `cn_sort` = `lcsort`");
$dbh->do("ALTER TABLE `deletedbiblioitems` DROP COLUMN `classification`");
$dbh->do("ALTER TABLE `deletedbiblioitems` DROP COLUMN `dewey`");
$dbh->do("ALTER TABLE `deletedbiblioitems` DROP COLUMN `subclass`");
$dbh->do("ALTER TABLE `deletedbiblioitems` DROP COLUMN `lcsort`");
$dbh->do("ALTER TABLE `deletedbiblioitems` DROP COLUMN `ccode`");
# deleteditems changes
$dbh->do("ALTER TABLE `deleteditems` MODIFY `barcode` VARCHAR(20) DEFAULT NULL");
$dbh->do("ALTER TABLE `deleteditems` MODIFY `price` DECIMAL(8,2) DEFAULT NULL");
$dbh->do("ALTER TABLE `deleteditems` MODIFY `replacementprice` DECIMAL(8,2) DEFAULT NULL");
$dbh->do("ALTER TABLE `deleteditems` DROP `bulk`");
$dbh->do("ALTER TABLE `deleteditems` MODIFY `itemcallnumber` VARCHAR(30) DEFAULT NULL AFTER `wthdrawn`");
$dbh->do("ALTER TABLE `deleteditems` MODIFY `holdingbranch` VARCHAR(10) DEFAULT NULL");
$dbh->do("ALTER TABLE `deleteditems` DROP `interim`");
$dbh->do("ALTER TABLE `deleteditems` MODIFY `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP AFTER `paidfor`");
$dbh->do("ALTER TABLE `deleteditems` DROP `cutterextra`");
$dbh->do("ALTER TABLE `deleteditems` ADD `cn_source` VARCHAR(10) DEFAULT NULL AFTER `onloan`");
$dbh->do("ALTER TABLE `deleteditems` ADD `cn_sort` VARCHAR(30) DEFAULT NULL AFTER `cn_source");
$dbh->do("ALTER TABLE `deleteditems` ADD `ccode` VARCHAR(10) DEFAULT NULL AFTER `cn_sort`");
$dbh->do("ALTER TABLE `deleteditems` ADD `materials` VARCHAR(10) DEFAULT NULL AFTER `ccode`");
$dbh->do("ALTER TABLE `deleteditems` ADD `uri` VARCHAR(255) DEFAULT NULL AFTER `materials`");
$dbh->do("ALTER TABLE `deleteditems` MODIFY `marc` LONGBLOB AFTER `uri`");
$dbh->do("ALTER TABLE `deleteditems` DROP KEY `barcode`");
$dbh->do("ALTER TABLE `deleteditems` DROP KEY `itembarcodeidx`");
$dbh->do("ALTER TABLE `deleteditems` DROP KEY `itembinoidx`");
$dbh->do("ALTER TABLE `deleteditems` DROP KEY `itembibnoidx`");
$dbh->do("ALTER TABLE `deleteditems` ADD UNIQUE KEY `delitembarcodeidx` (`barcode`)");
$dbh->do("ALTER TABLE `deleteditems` ADD KEY `delitembinoidx` (`biblioitemnumber`)");
$dbh->do("ALTER TABLE `deleteditems` ADD KEY `delitembibnoidx` (`biblionumber`)");
$dbh->do("ALTER TABLE `deleteditems` ADD KEY `delhomebranch` (`homebranch`)");
$dbh->do("ALTER TABLE `deleteditems` ADD KEY `delholdingbranch` (`holdingbranch`)");
$dbh->do("UPDATE `deleteditems` SET `ccode` = `itype`");
$dbh->do("ALTER TABLE `deleteditems` DROP `itype`");
$dbh->do("UPDATE `deleteditems` SET `cn_sort` = `itemcallnumber`");
# items changes
$dbh->do("ALTER TABLE `items` ADD `cn_source` VARCHAR(10) DEFAULT NULL AFTER `onloan`");
$dbh->do("ALTER TABLE `items` ADD `cn_sort` VARCHAR(30) DEFAULT NULL AFTER `cn_source");
$dbh->do("ALTER TABLE `items` ADD `ccode` VARCHAR(10) DEFAULT NULL AFTER `cn_sort`");
$dbh->do("ALTER TABLE `items` ADD `materials` VARCHAR(10) DEFAULT NULL AFTER `ccode`");
$dbh->do("ALTER TABLE `items` ADD `uri` VARCHAR(255) DEFAULT NULL AFTER `materials`");
$dbh->do("ALTER TABLE `items` DROP KEY `itembarcodeidx`");
$dbh->do("ALTER TABLE `items` ADD UNIQUE KEY `itembarcodeidx` (`barcode`)");
# map items.itype to items.ccode
$dbh->do("UPDATE `items` SET `ccode` = `itype`");
# set cn_sort to itemcallnumber -- as with biblioitems.cn_sort,
# will have to be subsequently updated per user's default
# classification scheme
$dbh->do("UPDATE `items` SET `cn_sort` = `itemcallnumber`");
$dbh->do("ALTER TABLE `items` DROP `cutterextra`");
$dbh->do("ALTER TABLE `items` DROP `itype`");
print "Upgrade to $DBversion done (major changes to biblio, biblioitems, items, and deleted* versions of same\n";
SetVersion ($DBversion);
}
=item DropAllForeignKeys($table)
Drop all foreign keys of the table $table

Loading…
Cancel
Save