Lines 22-49
Link Here
|
22 |
use Modern::Perl; |
22 |
use Modern::Perl; |
23 |
|
23 |
|
24 |
use CGI qw ( -utf8 ); |
24 |
use CGI qw ( -utf8 ); |
|
|
25 |
use List::MoreUtils qw/any/; |
26 |
use MARC::File::XML; |
27 |
use Storable qw(thaw freeze); |
28 |
use URI::Escape; |
29 |
|
25 |
use C4::Auth; |
30 |
use C4::Auth; |
26 |
use C4::Output; |
|
|
27 |
use C4::Biblio; |
31 |
use C4::Biblio; |
28 |
use C4::Items; |
|
|
29 |
use C4::Context; |
30 |
use C4::Circulation; |
32 |
use C4::Circulation; |
31 |
use C4::Koha; |
|
|
32 |
use C4::ClassSource; |
33 |
use C4::ClassSource; |
|
|
34 |
use C4::Context; |
35 |
use C4::Items; |
36 |
use C4::Koha; |
37 |
use C4::Members; |
38 |
use C4::Output; |
39 |
use C4::Search; |
40 |
|
41 |
use Koha::Biblio::Volume::Items; |
42 |
use Koha::Biblio::Volumes; |
33 |
use Koha::DateUtils; |
43 |
use Koha::DateUtils; |
34 |
use Koha::Items; |
|
|
35 |
use Koha::ItemTypes; |
44 |
use Koha::ItemTypes; |
|
|
45 |
use Koha::Items; |
36 |
use Koha::Libraries; |
46 |
use Koha::Libraries; |
37 |
use Koha::Patrons; |
47 |
use Koha::Patrons; |
38 |
use Koha::SearchEngine::Indexer; |
48 |
use Koha::SearchEngine::Indexer; |
39 |
use List::MoreUtils qw/any/; |
|
|
40 |
use C4::Search; |
41 |
use Storable qw(thaw freeze); |
42 |
use URI::Escape; |
43 |
use C4::Members; |
44 |
|
45 |
use MARC::File::XML; |
46 |
use URI::Escape; |
47 |
|
49 |
|
48 |
our $dbh = C4::Context->dbh; |
50 |
our $dbh = C4::Context->dbh; |
49 |
|
51 |
|
Lines 87-92
sub set_item_default_location {
Link Here
|
87 |
$item->store; |
89 |
$item->store; |
88 |
} |
90 |
} |
89 |
|
91 |
|
|
|
92 |
sub add_item_to_volume { |
93 |
my ( $biblionumber, $itemnumber, $volume, $volume_description ) = @_; |
94 |
|
95 |
return unless $volume; |
96 |
|
97 |
my $volume_id; |
98 |
if ( $volume eq 'create' ) { |
99 |
my $volume = Koha::Biblio::Volume->new( |
100 |
{ |
101 |
biblionumber => $biblionumber, |
102 |
description => $volume_description, |
103 |
} |
104 |
)->store(); |
105 |
|
106 |
$volume_id = $volume->id; |
107 |
} |
108 |
else { |
109 |
$volume_id = $volume; |
110 |
} |
111 |
|
112 |
my $volume_item = Koha::Biblio::Volume::Item->new( |
113 |
{ |
114 |
itemnumber => $itemnumber, |
115 |
volume_id => $volume_id, |
116 |
} |
117 |
)->store(); |
118 |
} |
119 |
|
90 |
# NOTE: This code is subject to change in the future with the implemenation of ajax based autobarcode code |
120 |
# NOTE: This code is subject to change in the future with the implemenation of ajax based autobarcode code |
91 |
# NOTE: 'incremental' is the ONLY autoBarcode option available to those not using javascript |
121 |
# NOTE: 'incremental' is the ONLY autoBarcode option available to those not using javascript |
92 |
sub _increment_barcode { |
122 |
sub _increment_barcode { |
Lines 419-424
my $fa_barcode = $input->param('barcode');
Link Here
|
419 |
my $fa_branch = $input->param('branch'); |
449 |
my $fa_branch = $input->param('branch'); |
420 |
my $fa_stickyduedate = $input->param('stickyduedate'); |
450 |
my $fa_stickyduedate = $input->param('stickyduedate'); |
421 |
my $fa_duedatespec = $input->param('duedatespec'); |
451 |
my $fa_duedatespec = $input->param('duedatespec'); |
|
|
452 |
my $volume = $input->param('volume'); |
453 |
my $volume_description = $input->param('volume_description'); |
422 |
|
454 |
|
423 |
my $frameworkcode = &GetFrameworkCode($biblionumber); |
455 |
my $frameworkcode = &GetFrameworkCode($biblionumber); |
424 |
|
456 |
|
Lines 527-532
if ($op eq "additem") {
Link Here
|
527 |
unless ($exist_itemnumber) { |
559 |
unless ($exist_itemnumber) { |
528 |
my ( $oldbiblionumber, $oldbibnum, $oldbibitemnum ) = AddItemFromMarc( $record, $biblionumber ); |
560 |
my ( $oldbiblionumber, $oldbibnum, $oldbibitemnum ) = AddItemFromMarc( $record, $biblionumber ); |
529 |
set_item_default_location($oldbibitemnum); |
561 |
set_item_default_location($oldbibitemnum); |
|
|
562 |
add_item_to_volume( $oldbiblionumber, $oldbibitemnum, $volume, $volume_description ); |
530 |
|
563 |
|
531 |
# Pushing the last created item cookie back |
564 |
# Pushing the last created item cookie back |
532 |
if ($prefillitem && defined $record) { |
565 |
if ($prefillitem && defined $record) { |
Lines 627-632
if ($op eq "additem") {
Link Here
|
627 |
my ( $oldbiblionumber, $oldbibnum, $oldbibitemnum ) = |
660 |
my ( $oldbiblionumber, $oldbibnum, $oldbibitemnum ) = |
628 |
AddItemFromMarc( $record, $biblionumber, { skip_record_index => 1 } ); |
661 |
AddItemFromMarc( $record, $biblionumber, { skip_record_index => 1 } ); |
629 |
set_item_default_location($oldbibitemnum); |
662 |
set_item_default_location($oldbibitemnum); |
|
|
663 |
add_item_to_volume( $oldbiblionumber, $oldbibitemnum, $volume, $volume_description ); |
630 |
|
664 |
|
631 |
# We count the item only if it was really added |
665 |
# We count the item only if it was really added |
632 |
# That way, all items are added, even if there was some already existing barcodes |
666 |
# That way, all items are added, even if there was some already existing barcodes |
Lines 997-1002
foreach my $tag ( keys %{$tagslib}){
Link Here
|
997 |
|
1031 |
|
998 |
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit. |
1032 |
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit. |
999 |
$template->param( |
1033 |
$template->param( |
|
|
1034 |
volumes => scalar Koha::Biblio::Volumes->search({ biblionumber => $biblionumber }), |
1000 |
biblionumber => $biblionumber, |
1035 |
biblionumber => $biblionumber, |
1001 |
title => $oldrecord->{title}, |
1036 |
title => $oldrecord->{title}, |
1002 |
author => $oldrecord->{author}, |
1037 |
author => $oldrecord->{author}, |