From bf0d43acb18062053e25c23049906348f43c6f8a Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Mon, 7 Jan 2008 13:52:56 -0600 Subject: [PATCH] Items.pm - BEGIN block VERSION and vars related to export. Also 2 sanity checks. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Items.pm | 72 +++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index e822ccb696..feb64ba42f 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -19,8 +19,6 @@ package C4::Items; use strict; -require Exporter; - use C4::Context; use C4::Koha; use C4::Biblio; @@ -33,35 +31,38 @@ require C4::Reserves; use vars qw($VERSION @ISA @EXPORT); -my $VERSION = 3.00; - -@ISA = qw( Exporter ); - -# function exports -@EXPORT = qw( - GetItem - AddItemFromMarc - AddItem - AddItemBatchFromMarc - ModItemFromMarc - ModItem - ModDateLastSeen - ModItemTransfer - DelItem - - CheckItemPreSave - - GetItemStatus - GetItemLocation - GetLostItems - GetItemsForInventory - GetItemsCount - GetItemInfosOf - GetItemsByBiblioitemnumber - GetItemsInfo - get_itemnumbers_of - GetItemnumberFromBarcode -); +BEGIN { + $VERSION = 3.01; + + require Exporter; + @ISA = qw( Exporter ); + + # function exports + @EXPORT = qw( + GetItem + AddItemFromMarc + AddItem + AddItemBatchFromMarc + ModItemFromMarc + ModItem + ModDateLastSeen + ModItemTransfer + DelItem + + CheckItemPreSave + + GetItemStatus + GetItemLocation + GetLostItems + GetItemsForInventory + GetItemsCount + GetItemInfosOf + GetItemsByBiblioitemnumber + GetItemsInfo + get_itemnumbers_of + GetItemnumberFromBarcode + ); +} =head1 NAME @@ -379,7 +380,7 @@ sub ModItem { my $dbh = @_ ? shift : C4::Context->dbh; my $frameworkcode = @_ ? shift : GetFrameworkCode( $biblionumber ); - $item->{'itemnumber'} = $itemnumber; + $item->{'itemnumber'} = $itemnumber or return undef; _set_derived_columns_for_mod($item); _do_column_fixes_for_mod($item); # FIXME add checks @@ -393,10 +394,11 @@ sub ModItem { _koha_modify_item($dbh, $item); # update biblio MARC XML - my $whole_item = GetItem($itemnumber); - my $new_item_marc = _marc_from_item_hash($whole_item, $frameworkcode); + my $whole_item = GetItem($itemnumber) or die "FAILED GetItem($itemnumber)"; + my $new_item_marc = _marc_from_item_hash($whole_item, $frameworkcode) or die "FAILED _marc_from_item_hash($whole_item, $frameworkcode)"; _replace_item_field_in_biblio($new_item_marc, $biblionumber, $itemnumber, $frameworkcode); - + (C4::Context->userenv eq '0') and die "userenv is '0', not hashref"; # logaction line would crash anyway + ($new_item_marc eq '0') and die "$new_item_marc is '0', not hashref"; # logaction line would crash anyway logaction(C4::Context->userenv->{'number'},"CATALOGUING","MODIFY",$itemnumber,$new_item_marc->as_formatted) if C4::Context->preference("CataloguingLog"); } -- 2.39.5