Lines 22-48
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 List::MoreUtils qw/any/; |
|
|
39 |
use C4::Search; |
40 |
use Storable qw(thaw freeze); |
41 |
use URI::Escape; |
42 |
use C4::Members; |
43 |
|
44 |
use MARC::File::XML; |
45 |
use URI::Escape; |
46 |
|
48 |
|
47 |
our $dbh = C4::Context->dbh; |
49 |
our $dbh = C4::Context->dbh; |
48 |
|
50 |
|
Lines 91-96
sub set_item_default_location {
Link Here
|
91 |
} |
93 |
} |
92 |
} |
94 |
} |
93 |
|
95 |
|
|
|
96 |
sub add_item_to_volume { |
97 |
my ( $biblionumber, $itemnumber, $volume, $volume_description ) = @_; |
98 |
|
99 |
return unless $volume; |
100 |
|
101 |
my $volume_id; |
102 |
if ( $volume eq 'create' ) { |
103 |
my $volume = Koha::Biblio::Volume->new( |
104 |
{ |
105 |
biblionumber => $biblionumber, |
106 |
description => $volume_description, |
107 |
} |
108 |
)->store(); |
109 |
|
110 |
$volume_id = $volume->id; |
111 |
} |
112 |
else { |
113 |
$volume_id = $volume; |
114 |
} |
115 |
|
116 |
my $volume_item = Koha::Biblio::Volume::Item->new( |
117 |
{ |
118 |
itemnumber => $itemnumber, |
119 |
volume_id => $volume_id, |
120 |
} |
121 |
)->store(); |
122 |
} |
123 |
|
94 |
# NOTE: This code is subject to change in the future with the implemenation of ajax based autobarcode code |
124 |
# NOTE: This code is subject to change in the future with the implemenation of ajax based autobarcode code |
95 |
# NOTE: 'incremental' is the ONLY autoBarcode option available to those not using javascript |
125 |
# NOTE: 'incremental' is the ONLY autoBarcode option available to those not using javascript |
96 |
sub _increment_barcode { |
126 |
sub _increment_barcode { |
Lines 394-399
my $fa_barcode = $input->param('barcode');
Link Here
|
394 |
my $fa_branch = $input->param('branch'); |
424 |
my $fa_branch = $input->param('branch'); |
395 |
my $fa_stickyduedate = $input->param('stickyduedate'); |
425 |
my $fa_stickyduedate = $input->param('stickyduedate'); |
396 |
my $fa_duedatespec = $input->param('duedatespec'); |
426 |
my $fa_duedatespec = $input->param('duedatespec'); |
|
|
427 |
my $volume = $input->param('volume'); |
428 |
my $volume_description = $input->param('volume_description'); |
397 |
|
429 |
|
398 |
my $frameworkcode = &GetFrameworkCode($biblionumber); |
430 |
my $frameworkcode = &GetFrameworkCode($biblionumber); |
399 |
|
431 |
|
Lines 503-508
if ($op eq "additem") {
Link Here
|
503 |
unless ($exist_itemnumber) { |
535 |
unless ($exist_itemnumber) { |
504 |
my ( $oldbiblionumber, $oldbibnum, $oldbibitemnum ) = AddItemFromMarc( $record, $biblionumber ); |
536 |
my ( $oldbiblionumber, $oldbibnum, $oldbibitemnum ) = AddItemFromMarc( $record, $biblionumber ); |
505 |
set_item_default_location($oldbibitemnum); |
537 |
set_item_default_location($oldbibitemnum); |
|
|
538 |
add_item_to_volume( $oldbiblionumber, $oldbibitemnum, $volume, $volume_description ); |
506 |
|
539 |
|
507 |
# Pushing the last created item cookie back |
540 |
# Pushing the last created item cookie back |
508 |
if ($prefillitem && defined $record) { |
541 |
if ($prefillitem && defined $record) { |
Lines 602-607
if ($op eq "additem") {
Link Here
|
602 |
if (!$exist_itemnumber) { |
635 |
if (!$exist_itemnumber) { |
603 |
my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = AddItemFromMarc($record,$biblionumber); |
636 |
my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = AddItemFromMarc($record,$biblionumber); |
604 |
set_item_default_location($oldbibitemnum); |
637 |
set_item_default_location($oldbibitemnum); |
|
|
638 |
add_item_to_volume( $oldbiblionumber, $oldbibitemnum, $volume, $volume_description ); |
605 |
|
639 |
|
606 |
# We count the item only if it was really added |
640 |
# We count the item only if it was really added |
607 |
# That way, all items are added, even if there was some already existing barcodes |
641 |
# That way, all items are added, even if there was some already existing barcodes |
Lines 938-943
my $item = Koha::Items->find($itemnumber); # We certainly want to fetch it earli
Link Here
|
938 |
|
972 |
|
939 |
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit. |
973 |
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit. |
940 |
$template->param( |
974 |
$template->param( |
|
|
975 |
volumes => scalar Koha::Biblio::Volumes->search({ biblionumber => $biblionumber }), |
941 |
biblionumber => $biblionumber, |
976 |
biblionumber => $biblionumber, |
942 |
title => $oldrecord->{title}, |
977 |
title => $oldrecord->{title}, |
943 |
author => $oldrecord->{author}, |
978 |
author => $oldrecord->{author}, |