Adding stocknumber field to items table
This commit is contained in:
parent
1bff217bbe
commit
1f7f00b626
5 changed files with 32 additions and 3 deletions
|
@ -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, ''),
|
||||
|
|
|
@ -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`),
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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})) {
|
||||
|
|
Loading…
Reference in a new issue