|
Lines 21-97
package C4::Items;
Link Here
|
| 21 |
use strict; |
21 |
use strict; |
| 22 |
#use warnings; FIXME - Bug 2505 |
22 |
#use warnings; FIXME - Bug 2505 |
| 23 |
|
23 |
|
| 24 |
use Carp; |
|
|
| 25 |
use C4::Context; |
| 26 |
use C4::Koha; |
| 27 |
use C4::Biblio; |
| 28 |
use Koha::DateUtils; |
| 29 |
use MARC::Record; |
| 30 |
use C4::ClassSource; |
| 31 |
use C4::Log; |
| 32 |
use List::MoreUtils qw/any/; |
| 33 |
use YAML qw/Load/; |
| 34 |
use DateTime::Format::MySQL; |
| 35 |
use Data::Dumper; # used as part of logging item record changes, not just for |
| 36 |
# debugging; so please don't remove this |
| 37 |
|
| 38 |
use Koha::AuthorisedValues; |
| 39 |
use Koha::DateUtils qw/dt_from_string/; |
| 40 |
use Koha::Database; |
| 41 |
|
| 42 |
use Koha::Biblioitems; |
| 43 |
use Koha::Items; |
| 44 |
use Koha::ItemTypes; |
| 45 |
use Koha::SearchEngine; |
| 46 |
use Koha::SearchEngine::Search; |
| 47 |
use Koha::Libraries; |
| 48 |
|
| 49 |
use vars qw(@ISA @EXPORT); |
24 |
use vars qw(@ISA @EXPORT); |
| 50 |
|
|
|
| 51 |
BEGIN { |
25 |
BEGIN { |
|
|
26 |
require Exporter; |
| 27 |
@ISA = qw(Exporter); |
| 52 |
|
28 |
|
| 53 |
require Exporter; |
|
|
| 54 |
@ISA = qw( Exporter ); |
| 55 |
|
| 56 |
# function exports |
| 57 |
@EXPORT = qw( |
29 |
@EXPORT = qw( |
| 58 |
GetItem |
30 |
GetItem |
| 59 |
AddItemFromMarc |
31 |
AddItemFromMarc |
| 60 |
AddItem |
32 |
AddItem |
| 61 |
AddItemBatchFromMarc |
33 |
AddItemBatchFromMarc |
| 62 |
ModItemFromMarc |
34 |
ModItemFromMarc |
| 63 |
Item2Marc |
35 |
Item2Marc |
| 64 |
ModItem |
36 |
ModItem |
| 65 |
ModDateLastSeen |
37 |
ModDateLastSeen |
| 66 |
ModItemTransfer |
38 |
ModItemTransfer |
| 67 |
DelItem |
39 |
DelItem |
| 68 |
|
|
|
| 69 |
CheckItemPreSave |
40 |
CheckItemPreSave |
| 70 |
|
|
|
| 71 |
GetItemsForInventory |
41 |
GetItemsForInventory |
| 72 |
GetItemsInfo |
42 |
GetItemsInfo |
| 73 |
GetItemsLocationInfo |
43 |
GetItemsLocationInfo |
| 74 |
GetHostItemsInfo |
44 |
GetHostItemsInfo |
| 75 |
get_hostitemnumbers_of |
45 |
get_hostitemnumbers_of |
| 76 |
GetHiddenItemnumbers |
46 |
GetHiddenItemnumbers |
| 77 |
ItemSafeToDelete |
47 |
ItemSafeToDelete |
| 78 |
DelItemCheck |
48 |
DelItemCheck |
| 79 |
MoveItemFromBiblio |
49 |
MoveItemFromBiblio |
| 80 |
GetLatestAcquisitions |
50 |
GetLatestAcquisitions |
| 81 |
|
|
|
| 82 |
CartToShelf |
51 |
CartToShelf |
| 83 |
ShelfToCart |
52 |
ShelfToCart |
| 84 |
|
53 |
GetAnalyticsCount |
| 85 |
GetAnalyticsCount |
|
|
| 86 |
|
| 87 |
SearchItemsByField |
54 |
SearchItemsByField |
| 88 |
SearchItems |
55 |
SearchItems |
| 89 |
|
|
|
| 90 |
PrepareItemrecordDisplay |
56 |
PrepareItemrecordDisplay |
| 91 |
|
|
|
| 92 |
); |
57 |
); |
| 93 |
} |
58 |
} |
| 94 |
|
59 |
|
|
|
60 |
use Carp; |
| 61 |
use C4::Context; |
| 62 |
use C4::Koha; |
| 63 |
use C4::Biblio; |
| 64 |
use Koha::DateUtils; |
| 65 |
use MARC::Record; |
| 66 |
use C4::ClassSource; |
| 67 |
use C4::Log; |
| 68 |
use List::MoreUtils qw(any); |
| 69 |
use YAML qw(Load); |
| 70 |
use DateTime::Format::MySQL; |
| 71 |
use Data::Dumper; # used as part of logging item record changes, not just for |
| 72 |
# debugging; so please don't remove this |
| 73 |
|
| 74 |
use Koha::AuthorisedValues; |
| 75 |
use Koha::DateUtils qw(dt_from_string); |
| 76 |
use Koha::Database; |
| 77 |
|
| 78 |
use Koha::Biblioitems; |
| 79 |
use Koha::Items; |
| 80 |
use Koha::ItemTypes; |
| 81 |
use Koha::SearchEngine; |
| 82 |
use Koha::SearchEngine::Search; |
| 83 |
use Koha::Libraries; |
| 84 |
|
| 95 |
=head1 NAME |
85 |
=head1 NAME |
| 96 |
|
86 |
|
| 97 |
C4::Items - item management functions |
87 |
C4::Items - item management functions |
|
Lines 233-242
sub AddItemFromMarc {
Link Here
|
| 233 |
# parse item hash from MARC |
223 |
# parse item hash from MARC |
| 234 |
my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber ); |
224 |
my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber ); |
| 235 |
my ($itemtag,$itemsubfield)=C4::Biblio::GetMarcFromKohaField("items.itemnumber",$frameworkcode); |
225 |
my ($itemtag,$itemsubfield)=C4::Biblio::GetMarcFromKohaField("items.itemnumber",$frameworkcode); |
| 236 |
|
226 |
|
| 237 |
my $localitemmarc=MARC::Record->new; |
227 |
my $localitemmarc=MARC::Record->new; |
| 238 |
$localitemmarc->append_fields($source_item_marc->field($itemtag)); |
228 |
$localitemmarc->append_fields($source_item_marc->field($itemtag)); |
| 239 |
my $item = &TransformMarcToKoha( $localitemmarc, $frameworkcode ,'items'); |
229 |
my $item = TransformMarcToKoha( $localitemmarc, $frameworkcode ,'items'); |
| 240 |
my $unlinked_item_subfields = _get_unlinked_item_subfields($localitemmarc, $frameworkcode); |
230 |
my $unlinked_item_subfields = _get_unlinked_item_subfields($localitemmarc, $frameworkcode); |
| 241 |
return AddItem($item, $biblionumber, $dbh, $frameworkcode, $unlinked_item_subfields); |
231 |
return AddItem($item, $biblionumber, $dbh, $frameworkcode, $unlinked_item_subfields); |
| 242 |
} |
232 |
} |
|
Lines 498-504
sub ModItemFromMarc {
Link Here
|
| 498 |
|
488 |
|
| 499 |
my $localitemmarc = MARC::Record->new; |
489 |
my $localitemmarc = MARC::Record->new; |
| 500 |
$localitemmarc->append_fields( $item_marc->field($itemtag) ); |
490 |
$localitemmarc->append_fields( $item_marc->field($itemtag) ); |
| 501 |
my $item = &TransformMarcToKoha( $localitemmarc, $frameworkcode, 'items' ); |
491 |
my $item = TransformMarcToKoha( $localitemmarc, $frameworkcode, 'items' ); |
| 502 |
my $default_values = _build_default_values_for_mod_marc(); |
492 |
my $default_values = _build_default_values_for_mod_marc(); |
| 503 |
foreach my $item_field ( keys %$default_values ) { |
493 |
foreach my $item_field ( keys %$default_values ) { |
| 504 |
$item->{$item_field} = $default_values->{$item_field} |
494 |
$item->{$item_field} = $default_values->{$item_field} |
|
Lines 2452-2458
sub PrepareItemrecordDisplay {
Link Here
|
| 2452 |
# Note: $tagslib obtained from GetMarcStructure() in 'unsafe' mode is |
2442 |
# Note: $tagslib obtained from GetMarcStructure() in 'unsafe' mode is |
| 2453 |
# a shared data structure. No plugin (including custom ones) should change |
2443 |
# a shared data structure. No plugin (including custom ones) should change |
| 2454 |
# its contents. See also GetMarcStructure. |
2444 |
# its contents. See also GetMarcStructure. |
| 2455 |
my $tagslib = &GetMarcStructure( 1, $frameworkcode, { unsafe => 1 } ); |
2445 |
my $tagslib = GetMarcStructure( 1, $frameworkcode, { unsafe => 1 } ); |
| 2456 |
|
2446 |
|
| 2457 |
# return nothing if we don't have found an existing framework. |
2447 |
# return nothing if we don't have found an existing framework. |
| 2458 |
return q{} unless $tagslib; |
2448 |
return q{} unless $tagslib; |
| 2459 |
- |
|
|