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 86-91
sub set_item_default_location {
Link Here
|
86 |
$item->store; |
88 |
$item->store; |
87 |
} |
89 |
} |
88 |
|
90 |
|
|
|
91 |
sub add_item_to_volume { |
92 |
my ( $biblionumber, $itemnumber, $volume, $volume_description ) = @_; |
93 |
|
94 |
return unless $volume; |
95 |
|
96 |
my $volume_id; |
97 |
if ( $volume eq 'create' ) { |
98 |
my $volume = Koha::Biblio::Volume->new( |
99 |
{ |
100 |
biblionumber => $biblionumber, |
101 |
description => $volume_description, |
102 |
} |
103 |
)->store(); |
104 |
|
105 |
$volume_id = $volume->id; |
106 |
} |
107 |
else { |
108 |
$volume_id = $volume; |
109 |
} |
110 |
|
111 |
my $volume_item = Koha::Biblio::Volume::Item->new( |
112 |
{ |
113 |
itemnumber => $itemnumber, |
114 |
volume_id => $volume_id, |
115 |
} |
116 |
)->store(); |
117 |
} |
118 |
|
89 |
# NOTE: This code is subject to change in the future with the implemenation of ajax based autobarcode code |
119 |
# NOTE: This code is subject to change in the future with the implemenation of ajax based autobarcode code |
90 |
# NOTE: 'incremental' is the ONLY autoBarcode option available to those not using javascript |
120 |
# NOTE: 'incremental' is the ONLY autoBarcode option available to those not using javascript |
91 |
sub _increment_barcode { |
121 |
sub _increment_barcode { |
Lines 390-395
my $fa_barcode = $input->param('barcode');
Link Here
|
390 |
my $fa_branch = $input->param('branch'); |
420 |
my $fa_branch = $input->param('branch'); |
391 |
my $fa_stickyduedate = $input->param('stickyduedate'); |
421 |
my $fa_stickyduedate = $input->param('stickyduedate'); |
392 |
my $fa_duedatespec = $input->param('duedatespec'); |
422 |
my $fa_duedatespec = $input->param('duedatespec'); |
|
|
423 |
my $volume = $input->param('volume'); |
424 |
my $volume_description = $input->param('volume_description'); |
393 |
|
425 |
|
394 |
my $frameworkcode = &GetFrameworkCode($biblionumber); |
426 |
my $frameworkcode = &GetFrameworkCode($biblionumber); |
395 |
|
427 |
|
Lines 499-504
if ($op eq "additem") {
Link Here
|
499 |
unless ($exist_itemnumber) { |
531 |
unless ($exist_itemnumber) { |
500 |
my ( $oldbiblionumber, $oldbibnum, $oldbibitemnum ) = AddItemFromMarc( $record, $biblionumber ); |
532 |
my ( $oldbiblionumber, $oldbibnum, $oldbibitemnum ) = AddItemFromMarc( $record, $biblionumber ); |
501 |
set_item_default_location($oldbibitemnum); |
533 |
set_item_default_location($oldbibitemnum); |
|
|
534 |
add_item_to_volume( $oldbiblionumber, $oldbibitemnum, $volume, $volume_description ); |
502 |
|
535 |
|
503 |
# Pushing the last created item cookie back |
536 |
# Pushing the last created item cookie back |
504 |
if ($prefillitem && defined $record) { |
537 |
if ($prefillitem && defined $record) { |
Lines 598-603
if ($op eq "additem") {
Link Here
|
598 |
if (!$exist_itemnumber) { |
631 |
if (!$exist_itemnumber) { |
599 |
my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = AddItemFromMarc($record,$biblionumber); |
632 |
my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = AddItemFromMarc($record,$biblionumber); |
600 |
set_item_default_location($oldbibitemnum); |
633 |
set_item_default_location($oldbibitemnum); |
|
|
634 |
add_item_to_volume( $oldbiblionumber, $oldbibitemnum, $volume, $volume_description ); |
601 |
|
635 |
|
602 |
# We count the item only if it was really added |
636 |
# We count the item only if it was really added |
603 |
# That way, all items are added, even if there was some already existing barcodes |
637 |
# That way, all items are added, even if there was some already existing barcodes |
Lines 953-958
my $item = Koha::Items->find($itemnumber); # We certainly want to fetch it earli
Link Here
|
953 |
|
987 |
|
954 |
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit. |
988 |
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit. |
955 |
$template->param( |
989 |
$template->param( |
|
|
990 |
volumes => scalar Koha::Biblio::Volumes->search({ biblionumber => $biblionumber }), |
956 |
biblionumber => $biblionumber, |
991 |
biblionumber => $biblionumber, |
957 |
title => $oldrecord->{title}, |
992 |
title => $oldrecord->{title}, |
958 |
author => $oldrecord->{author}, |
993 |
author => $oldrecord->{author}, |