From 49a75f4d4f5765ccf3213a51f5bee47019e3d60f Mon Sep 17 00:00:00 2001 From: Michael Hafen Date: Fri, 12 Sep 2008 13:16:58 -0600 Subject: [PATCH] Use biblioitems.itemtype as a default for items.itype This correct the html select default in additem.pl, and enforces use of biblioitems.itemtype as the default in Items::AddItem. The code in Items is to catch items added through MARC record staging. Thanks to Joe Atzberger for suggestion. [RM note: this patch means that an item's item-level item type, once that item is added or updated via additem.pl, now cannot be blank or NULL unless the biblio-level item type is blank.] Signed-off-by: Galen Charlton Signed-off-by: Henri-Damien LAURENT --- cataloguing/additem.pl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index d797c7ec01..2cb20dde34 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -334,7 +334,16 @@ foreach my $tag (sort keys %{$tagslib}) { push @authorised_values, $itemtype; $authorised_lib{$itemtype} = $description; } - $value = $itemtype unless ($value); + + unless ( $value ) { + my $default_itemtype; + my $itype_sth = $dbh->prepare("SELECT itemtype FROM biblioitems WHERE biblionumber = ?"); + $itype_sth->execute( $biblionumber ); + ( $default_itemtype ) = $itype_sth->fetchrow_array; + $value = $default_itemtype; + } + + #---- class_sources } elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "cn_source" ) { push @authorised_values, "" unless ( $tagslib->{$tag}->{$subfield}->{mandatory} ); -- 2.39.5