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

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

Return to bug 23463