Lines 263-268
sub AddItem {
Link Here
|
263 |
# create MARC tag representing item and add to bib |
263 |
# create MARC tag representing item and add to bib |
264 |
my $new_item_marc = _marc_from_item_hash($item, $frameworkcode, $unlinked_item_subfields); |
264 |
my $new_item_marc = _marc_from_item_hash($item, $frameworkcode, $unlinked_item_subfields); |
265 |
_add_item_field_to_biblio($new_item_marc, $item->{'biblionumber'}, $frameworkcode ); |
265 |
_add_item_field_to_biblio($new_item_marc, $item->{'biblionumber'}, $frameworkcode ); |
|
|
266 |
#_add_item_field_to_biblio($new_item_marc, $item->{'biblionumber'}, $frameworkcode ); |
266 |
|
267 |
|
267 |
logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); |
268 |
logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); |
268 |
|
269 |
|
Lines 368-374
sub AddItemBatchFromMarc {
Link Here
|
368 |
} |
369 |
} |
369 |
|
370 |
|
370 |
# update the MARC biblio |
371 |
# update the MARC biblio |
371 |
$biblionumber = ModBiblioMarc( $record, $biblionumber, $frameworkcode ); |
372 |
# $biblionumber = ModBiblioMarc( $record, $biblionumber, $frameworkcode ); |
372 |
|
373 |
|
373 |
return (\@itemnumbers, \@errors); |
374 |
return (\@itemnumbers, \@errors); |
374 |
} |
375 |
} |
Lines 513-519
sub ModItem {
Link Here
|
513 |
my $new_item_marc = _marc_from_item_hash($whole_item, $frameworkcode, $unlinked_item_subfields) |
514 |
my $new_item_marc = _marc_from_item_hash($whole_item, $frameworkcode, $unlinked_item_subfields) |
514 |
or die "FAILED _marc_from_item_hash($whole_item, $frameworkcode)"; |
515 |
or die "FAILED _marc_from_item_hash($whole_item, $frameworkcode)"; |
515 |
|
516 |
|
516 |
_replace_item_field_in_biblio($new_item_marc, $biblionumber, $itemnumber, $frameworkcode); |
517 |
#_replace_item_field_in_biblio($new_item_marc, $biblionumber, $itemnumber, $frameworkcode); |
517 |
($new_item_marc eq '0') and die "$new_item_marc is '0', not hashref"; # logaction line would crash anyway |
518 |
($new_item_marc eq '0') and die "$new_item_marc is '0', not hashref"; # logaction line would crash anyway |
518 |
logaction("CATALOGUING", "MODIFY", $itemnumber, $new_item_marc->as_formatted) if C4::Context->preference("CataloguingLog"); |
519 |
logaction("CATALOGUING", "MODIFY", $itemnumber, $new_item_marc->as_formatted) if C4::Context->preference("CataloguingLog"); |
519 |
} |
520 |
} |
Lines 576-598
sub DelItem {
Link Here
|
576 |
|
577 |
|
577 |
# get the MARC record |
578 |
# get the MARC record |
578 |
my $record = GetMarcBiblio($biblionumber); |
579 |
my $record = GetMarcBiblio($biblionumber); |
579 |
my $frameworkcode = GetFrameworkCode($biblionumber); |
580 |
ModZebra( $biblionumber, "specialUpdate", "biblioserver", undef, undef ); |
580 |
|
581 |
|
581 |
# backup the record |
582 |
# backup the record |
582 |
my $copy2deleted = $dbh->prepare("UPDATE deleteditems SET marc=? WHERE itemnumber=?"); |
583 |
my $copy2deleted = $dbh->prepare("UPDATE deleteditems SET marc=? WHERE itemnumber=?"); |
583 |
$copy2deleted->execute( $record->as_usmarc(), $itemnumber ); |
584 |
$copy2deleted->execute( $record->as_usmarc(), $itemnumber ); |
584 |
|
585 |
|
585 |
#search item field code |
586 |
#search item field code |
586 |
my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField("items.itemnumber",$frameworkcode); |
|
|
587 |
my @fields = $record->field($itemtag); |
588 |
|
589 |
# delete the item specified |
590 |
foreach my $field (@fields) { |
591 |
if ( $field->subfield($itemsubfield) eq $itemnumber ) { |
592 |
$record->delete_field($field); |
593 |
} |
594 |
} |
595 |
&ModBiblioMarc( $record, $biblionumber, $frameworkcode ); |
596 |
logaction("CATALOGUING", "DELETE", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); |
587 |
logaction("CATALOGUING", "DELETE", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); |
597 |
} |
588 |
} |
598 |
|
589 |
|
Lines 2066-2081
sub MoveItemFromBiblio {
Link Here
|
2066 |
} |
2057 |
} |
2067 |
|
2058 |
|
2068 |
# Saving the modification |
2059 |
# Saving the modification |
2069 |
ModBiblioMarc($record, $frombiblio, $frameworkcode); |
2060 |
#ModBiblioMarc($record, $frombiblio, $frameworkcode); |
2070 |
|
2061 |
|
2071 |
# Getting the record we want to move the item to |
2062 |
# Getting the record we want to move the item to |
2072 |
$record = GetMarcBiblio($tobiblio); |
2063 |
#$record = GetMarcBiblio($tobiblio); |
2073 |
|
2064 |
|
2074 |
# Inserting the previously saved item |
2065 |
# Inserting the previously saved item |
2075 |
$record->insert_fields_ordered($item); |
2066 |
#$record->insert_fields_ordered($item); |
2076 |
|
2067 |
|
2077 |
# Saving the modification |
2068 |
# Saving the modification |
2078 |
ModBiblioMarc($record, $tobiblio, $frameworkcode); |
2069 |
#ModBiblioMarc($record, $tobiblio, $frameworkcode); |
2079 |
|
2070 |
|
2080 |
} else { |
2071 |
} else { |
2081 |
return undef; |
2072 |
return undef; |
Lines 2159-2164
sub _koha_modify_item {
Link Here
|
2159 |
$error.="ERROR in _koha_modify_item $query".$dbh->errstr; |
2150 |
$error.="ERROR in _koha_modify_item $query".$dbh->errstr; |
2160 |
warn $error; |
2151 |
warn $error; |
2161 |
} |
2152 |
} |
|
|
2153 |
ModZebra( $item->{biblionumber}, "specialUpdate", "biblioserver", undef, undef ); |
2162 |
return ($item->{'itemnumber'},$error); |
2154 |
return ($item->{'itemnumber'},$error); |
2163 |
} |
2155 |
} |
2164 |
|
2156 |
|
Lines 2302-2308
sub _replace_item_field_in_biblio {
Link Here
|
2302 |
} |
2294 |
} |
2303 |
|
2295 |
|
2304 |
# save the record |
2296 |
# save the record |
2305 |
ModBiblioMarc($completeRecord, $biblionumber, $frameworkcode); |
2297 |
#ModBiblioMarc($completeRecord, $biblionumber, $frameworkcode); |
2306 |
} |
2298 |
} |
2307 |
|
2299 |
|
2308 |
=head2 _repack_item_errors |
2300 |
=head2 _repack_item_errors |