|
Lines 39-44
use C4::Barcodes::ValueBuilder;
Link Here
|
| 39 |
use Koha::DateUtils qw( dt_from_string ); |
39 |
use Koha::DateUtils qw( dt_from_string ); |
| 40 |
use Koha::Items; |
40 |
use Koha::Items; |
| 41 |
use Koha::ItemTypes; |
41 |
use Koha::ItemTypes; |
|
|
42 |
use Koha::Items; |
| 42 |
use Koha::Libraries; |
43 |
use Koha::Libraries; |
| 43 |
use Koha::Patrons; |
44 |
use Koha::Patrons; |
| 44 |
use Koha::SearchEngine::Indexer; |
45 |
use Koha::SearchEngine::Indexer; |
|
Lines 57-62
use List::MoreUtils qw( any uniq );
Link Here
|
| 57 |
|
58 |
|
| 58 |
our $dbh = C4::Context->dbh; |
59 |
our $dbh = C4::Context->dbh; |
| 59 |
|
60 |
|
|
|
61 |
sub add_item_to_item_group { |
| 62 |
my ( $biblionumber, $itemnumber, $item_group, $item_group_description ) = @_; |
| 63 |
|
| 64 |
return unless $item_group; |
| 65 |
|
| 66 |
my $item_group_id; |
| 67 |
if ( $item_group eq 'create' ) { |
| 68 |
my $item_group = Koha::Biblio::ItemGroup->new( |
| 69 |
{ |
| 70 |
biblionumber => $biblionumber, |
| 71 |
description => $item_group_description, |
| 72 |
} |
| 73 |
)->store(); |
| 74 |
|
| 75 |
$item_group_id = $item_group->id; |
| 76 |
} |
| 77 |
else { |
| 78 |
$item_group_id = $item_group; |
| 79 |
} |
| 80 |
|
| 81 |
my $item_group_item = Koha::Biblio::ItemGroup::Item->new( |
| 82 |
{ |
| 83 |
itemnumber => $itemnumber, |
| 84 |
item_group_id => $item_group_id, |
| 85 |
} |
| 86 |
)->store(); |
| 87 |
} |
| 88 |
|
| 60 |
sub get_item_from_cookie { |
89 |
sub get_item_from_cookie { |
| 61 |
my ( $input ) = @_; |
90 |
my ( $input ) = @_; |
| 62 |
|
91 |
|
|
Lines 102-107
my $fa_barcode = $input->param('barcode');
Link Here
|
| 102 |
my $fa_branch = $input->param('branch'); |
131 |
my $fa_branch = $input->param('branch'); |
| 103 |
my $fa_stickyduedate = $input->param('stickyduedate'); |
132 |
my $fa_stickyduedate = $input->param('stickyduedate'); |
| 104 |
my $fa_duedatespec = $input->param('duedatespec'); |
133 |
my $fa_duedatespec = $input->param('duedatespec'); |
|
|
134 |
my $volume = $input->param('volume'); |
| 135 |
my $volume_description = $input->param('volume_description'); |
| 105 |
|
136 |
|
| 106 |
our $frameworkcode = &GetFrameworkCode($biblionumber); |
137 |
our $frameworkcode = &GetFrameworkCode($biblionumber); |
| 107 |
|
138 |
|
|
Lines 206-211
if ($op eq "additem") {
Link Here
|
| 206 |
} |
237 |
} |
| 207 |
else { |
238 |
else { |
| 208 |
$item->store->discard_changes; |
239 |
$item->store->discard_changes; |
|
|
240 |
add_item_to_item_group( $item->biblionumber, $item->biblioitemnumber, $volume, $volume_description ); |
| 209 |
|
241 |
|
| 210 |
# This is a bit tricky : if there is a cookie for the last created item and |
242 |
# This is a bit tricky : if there is a cookie for the last created item and |
| 211 |
# we just added an item, the cookie value is not correct yet (it will be updated |
243 |
# we just added an item, the cookie value is not correct yet (it will be updated |
|
Lines 316-321
if ($op eq "additem") {
Link Here
|
| 316 |
{ skip_record_index => 1 } ); |
348 |
{ skip_record_index => 1 } ); |
| 317 |
$current_item->discard_changes; # Cannot chain discard_changes |
349 |
$current_item->discard_changes; # Cannot chain discard_changes |
| 318 |
$current_item = $current_item->unblessed; |
350 |
$current_item = $current_item->unblessed; |
|
|
351 |
add_item_to_item_group( $item->biblionumber, $item->biblioitemnumber, $volume, $volume_description ); |
| 319 |
|
352 |
|
| 320 |
# We count the item only if it was really added |
353 |
# We count the item only if it was really added |
| 321 |
# That way, all items are added, even if there was some already existing barcodes |
354 |
# That way, all items are added, even if there was some already existing barcodes |
|
Lines 606-615
if( my $default_location = C4::Context->preference('NewItemsDefaultLocation') )
Link Here
|
| 606 |
$location_field->{marc_value}->{value} ||= $default_location; |
639 |
$location_field->{marc_value}->{value} ||= $default_location; |
| 607 |
} |
640 |
} |
| 608 |
|
641 |
|
|
|
642 |
my @ig = Koha::Biblio::ItemGroups->search({ biblio_id => $biblionumber })->as_list(); |
| 609 |
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit. |
643 |
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit. |
| 610 |
$template->param( |
644 |
$template->param( |
| 611 |
biblio => $biblio, |
645 |
biblio => $biblio, |
| 612 |
items => \@items, |
646 |
items => \@items, |
|
|
647 |
item_groups => \@ig, |
| 613 |
item_header_loop => \@header_value_loop, |
648 |
item_header_loop => \@header_value_loop, |
| 614 |
subfields => $subfields, |
649 |
subfields => $subfields, |
| 615 |
itemnumber => $itemnumber, |
650 |
itemnumber => $itemnumber, |