From 1f7f00b626a1adc2303d573bf551026a66c9452f Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Tue, 3 Nov 2009 14:35:49 +0100 Subject: [PATCH] Adding stocknumber field to items table --- .../Obligatoire/framework_DEFAULT.sql | 2 +- installer/data/mysql/kohastructure.sql | 4 +++ installer/data/mysql/updatedatabase.pl | 25 +++++++++++++++++++ kohaversion.pl | 2 +- tools/batchMod.pl | 2 +- 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/fr-FR/marcflavour/unimarc_complet/Obligatoire/framework_DEFAULT.sql b/installer/data/mysql/fr-FR/marcflavour/unimarc_complet/Obligatoire/framework_DEFAULT.sql index 7aeed88333..c5070cc609 100644 --- a/installer/data/mysql/fr-FR/marcflavour/unimarc_complet/Obligatoire/framework_DEFAULT.sql +++ b/installer/data/mysql/fr-FR/marcflavour/unimarc_complet/Obligatoire/framework_DEFAULT.sql @@ -2022,7 +2022,7 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('995', 'g', 'code à barres, préfixe', '', 0, 0, '', -1, '', '', '', NULL, 0, '', NULL, NULL, ''), ('995', 'h', 'code à barres, incrémentation', '', 0, 0, '', -1, '', '', '', NULL, 0, '', NULL, NULL, ''), ('995', 'i', 'code à barres, suffixe', '', 0, 0, '', -1, '', '', '', NULL, 0, '', NULL, NULL, ''), -('995', 'j', 'x', '', 0, 0, '', -1, '', '', '', NULL, 0, '', NULL, NULL, ''), +('995', 'j', 'Numéro Inventaire', '', 0, 0, 'items.stocknumber', -1, '', '', '', NULL, 0, '', NULL, NULL, ''), ('995', 'k', 'cote', 'cote', 0, 1, 'items.itemcallnumber', 10, '', '', '', NULL, 0, '', NULL, NULL, ''), ('995', 'l', 'volumaison', '', 0, 1, '', -1, '', '', '', NULL, 0, '', NULL, NULL, ''), ('995', 'm', 'date de prêt ou de dépôt', '', 0, 0, '', 10, '', '', '', NULL, 1, '', NULL, NULL, ''), diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 2abb197736..ba40e631eb 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -722,9 +722,11 @@ CREATE TABLE `deleteditems` ( `more_subfields_xml` longtext default NULL, `enumchron` varchar(80) default NULL, `copynumber` varchar(32) default NULL, + `stocknumber` varchar(32) default NULL, `marc` longblob, PRIMARY KEY (`itemnumber`), KEY `delitembarcodeidx` (`barcode`), + KEY `delitemstocknumberidx` (`stocknumber`), KEY `delitembinoidx` (`biblioitemnumber`), KEY `delitembibnoidx` (`biblionumber`), KEY `delhomebranch` (`homebranch`), @@ -978,8 +980,10 @@ CREATE TABLE `items` ( `more_subfields_xml` longtext default NULL, `enumchron` varchar(80) default NULL, `copynumber` varchar(32) default NULL, + `stocknumber` varchar(32) default NULL, PRIMARY KEY (`itemnumber`), UNIQUE KEY `itembarcodeidx` (`barcode`), + UNIQUE KEY `itemstocknumberidx` (`stocknumber`), KEY `itembinoidx` (`biblioitemnumber`), KEY `itembibnoidx` (`biblionumber`), KEY `homebranch` (`homebranch`), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 54100eb39f..33fda1f3d9 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -3167,6 +3167,31 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.01.00.125"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do(qq{ + ALTER TABLE items ADD stocknumber VARCHAR(32) DEFAULT NULL COMMENT "stores the inventory number"; + }); + $dbh->do(qq{ + ALTER TABLE items ADD UNIQUE INDEX itemsstocknumberidx (stocknumber); + }); + $dbh->do(qq{ + ALTER TABLE deleteditems ADD stocknumber VARCHAR(32) DEFAULT NULL COMMENT "stores the inventory number of deleted items"; + }); + $dbh->do(qq{ + ALTER TABLE deleteditems ADD UNIQUE INDEX deleteditemsstocknumberidx (stocknumber); + }); + if (C4::Context->preference('marcflavour') eq 'UNIMARC'){ + $dbh->do(qq{ + INSERT IGNORE INTO marc_subfield_structure (frameworkcode,tagfield, tagsubfield, tab, repeatable, mandatory,kohafield) + SELECT DISTINCT (frameworkcode),995,"j",10,0,0,"items.stocknumber" from biblio_framework ; + }); + } + + print "Upgrade to $DBversion done (stocknumber field added)\n"; + SetVersion ($DBversion); +} + =item DropAllForeignKeys($table) diff --git a/kohaversion.pl b/kohaversion.pl index a27131ccb4..de92273ea4 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -10,7 +10,7 @@ use strict; sub kohaversion { - our $VERSION = '3.01.00.124'; + our $VERSION = '3.01.00.125'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install diff --git a/tools/batchMod.pl b/tools/batchMod.pl index ae13892194..69598d2670 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -204,7 +204,7 @@ foreach my $tag (sort keys %{$tagslib}) { my $attributes_no_value; my $not_editable = 0; # Disable barcode and stock numbers batch editing - my @not_editable_koha_fields = ( 'items.barcode', 'items.stknumber' ); + my @not_editable_koha_fields = ( 'items.barcode', 'items.stocknumber' ); foreach (@not_editable_koha_fields) { my ($bctag, $bcsubfield) = GetMarcFromKohaField($_, $frameworkcode); if (($bctag eq $subfield_data{tag}) && ($bcsubfield eq $subfield_data{subfield})) { -- 2.39.5