From eb52fe26c3fdb5925d326dda2242912899b23609 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 27 Nov 2007 10:28:09 -0600 Subject: [PATCH] bug 1616: update bib MARC and zebraqueue on item update Fixed so that when using updateitem.pl to change an item's lost, damaged, or withdrawn status, the bib's MARC XML is updated and an entry is added to zebraqueue. As part of the fix, C4::Biblio::ModItemInMarconefield now works correctly. Signed-off-by: Joshua Ferraro --- C4/Biblio.pm | 5 +++-- catalogue/updateitem.pl | 18 +++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 816925b672..6444c3c56b 100755 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -472,7 +472,8 @@ sub ModItemInMarconefield { $tag->update( $tagsubfield => $newvalue ); $record->delete_field($tag); $record->insert_fields_ordered($tag); - &ModItemInMarc( $record, $biblionumber, $itemnumber, 0 ); + my $frameworkcode = GetFrameworkCode( $biblionumber ); + &ModItemInMarc( $record, $biblionumber, $itemnumber, $frameworkcode ); } } } @@ -481,7 +482,7 @@ sub ModItemInMarconefield { =over -&ModItemInMarc( $record, $biblionumber, $itemnumber ) +&ModItemInMarc( $record, $biblionumber, $itemnumber, $frameworkcode ) =back diff --git a/catalogue/updateitem.pl b/catalogue/updateitem.pl index 5add7277c5..b414c30291 100755 --- a/catalogue/updateitem.pl +++ b/catalogue/updateitem.pl @@ -38,14 +38,18 @@ my $damaged=$cgi->param('damaged'); my $confirm=$cgi->param('confirm'); my $dbh = C4::Context->dbh; # get the rest of this item's information -my $item_data_sth = $dbh->prepare("SELECT * FROM items WHERE itemnumber=?"); -$item_data_sth->execute($itemnumber); -my $item_data_hashref = $item_data_sth->fetchrow_hashref(); +my $item_data_hashref = GetItem($itemnumber, undef); -# superimpose the new on the old -$item_data_hashref->{'itemlost'} = $itemlost if $itemlost; -$item_data_hashref->{'wthdrawn'} = $wthdrawn if $wthdrawn; -$item_data_hashref->{'damaged'} = $damaged if $damaged; +# modify bib MARC +if ($itemlost ne $item_data_hashref->{'itemlost'}) { + ModItemInMarconefield($biblionumber, $itemnumber, 'items.itemlost', $itemlost); +} +if ($wthdrawn ne $item_data_hashref->{'wthdrawn'}) { + ModItemInMarconefield($biblionumber, $itemnumber, 'items.wthdrawn', $wthdrawn); +} +if ($damaged ne $item_data_hashref->{'damaged'}) { + ModItemInMarconefield($biblionumber, $itemnumber, 'items.damaged', $damaged); +} # check reservations my ($status, $reserve) = CheckReserves($itemnumber, $item_data_hashref->{'barcode'}); -- 2.39.5