View | Details | Raw Unified | Return to bug 23463
Collapse All | Expand All

(-)a/C4/Items.pm (-65 lines)
Lines 31-37 BEGIN { Link Here
31
        AddItemBatchFromMarc
31
        AddItemBatchFromMarc
32
        ModItemFromMarc
32
        ModItemFromMarc
33
        Item2Marc
33
        Item2Marc
34
        ModItem
35
        ModDateLastSeen
34
        ModDateLastSeen
36
        ModItemTransfer
35
        ModItemTransfer
37
        DelItem
36
        DelItem
Lines 375-443 sub ModItemFromMarc { Link Here
375
    return $item_object->get_from_storage->unblessed;
374
    return $item_object->get_from_storage->unblessed;
376
}
375
}
377
376
378
=head2 ModItem
379
380
ModItem(
381
    { column => $newvalue },
382
    $biblionumber,
383
    $itemnumber,
384
    {
385
        [ unlinked_item_subfields => $unlinked_item_subfields, ]
386
        [ log_action => 1, ]
387
    }
388
);
389
390
Change one or more columns in an item record.
391
392
The first argument is a hashref mapping from item column
393
names to the new values.  The second and third arguments
394
are the biblionumber and itemnumber, respectively.
395
The fourth, optional parameter (additional_params) may contain the keys
396
unlinked_item_subfields and log_action.
397
398
C<$unlinked_item_subfields> contains an arrayref containing
399
subfields present in the original MARC
400
representation of the item (e.g., from the item editor) that are
401
not mapped to C<items> columns directly but should instead
402
be stored in C<items.more_subfields_xml> and included in 
403
the biblio items tag for display and indexing.
404
405
If one of the changed columns is used to calculate
406
the derived value of a column such as C<items.cn_sort>, 
407
this routine will perform the necessary calculation
408
and set the value.
409
410
If log_action is set to false, the action will not be logged.
411
If log_action is true or undefined, the action will be logged.
412
413
=cut
414
415
sub ModItem {
416
    my ( $item, $biblionumber, $itemnumber, $additional_params ) = @_;
417
    my $log_action = $additional_params->{log_action} // 1;
418
419
    _set_derived_columns_for_mod($item);
420
    _do_column_fixes_for_mod($item);
421
    # FIXME add checks
422
    # duplicate barcode
423
    # attempt to change itemnumber
424
    # attempt to change biblionumber (if we want
425
    # an API to relink an item to a different bib,
426
    # it should be a separate function)
427
428
    # update items table
429
    _koha_modify_item($item);
430
431
    # request that bib be reindexed so that searching on current
432
    # item status is possible
433
    ModZebra( $biblionumber, "specialUpdate", "biblioserver" );
434
435
    _after_item_action_hooks({ action => 'modify', item_id => $itemnumber });
436
437
    logaction( "CATALOGUING", "MODIFY", $itemnumber, "item " . Dumper($item) )
438
      if $log_action && C4::Context->preference("CataloguingLog");
439
}
440
441
=head2 ModItemTransfer
377
=head2 ModItemTransfer
442
378
443
  ModItemTransfer($itenumber, $frombranch, $tobranch);
379
  ModItemTransfer($itenumber, $frombranch, $tobranch);
444
- 

Return to bug 23463