X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=cataloguing%2Fadditem.pl;h=faa9a0ad061b7a99810548a66bc6b973cf51263c;hb=6728e9928e231c8194afe06263c4665aac278d6e;hp=c5dd7d9efc6017f21f784b676752cc1696fe9abb;hpb=3b1b6b8315dcc0d4aba9dbd5d75ca868e8bc9bdc;p=koha.git diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index c5dd7d9efc..faa9a0ad06 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -150,7 +150,7 @@ sub generate_subfield_form { foreach my $thisbranch (@$branches) { push @authorised_values, $thisbranch->{value}; $authorised_lib{$thisbranch->{value}} = $thisbranch->{branchname}; - $value = $thisbranch->{value} if $thisbranch->{selected}; + $value = $thisbranch->{value} if $thisbranch->{selected} && !$value; } } elsif ( $subfieldlib->{authorised_value} eq "itemtypes" ) { @@ -262,7 +262,6 @@ sub generate_subfield_form { my $input = new CGI; -my $dbh = C4::Context->dbh; my $error = $input->param('error'); my $biblionumber = $input->param('biblionumber'); my $itemnumber = $input->param('itemnumber'); @@ -494,13 +493,14 @@ if ($op eq "additem") { # now, build existiing item list my $temp = GetMarcBiblio( $biblionumber ); -my @fields = $temp->fields(); #my @fields = $record->fields(); my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code my @big_array; #---- finds where items.itemnumber is stored my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField("items.itemnumber", $frameworkcode); my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField("items.homebranch", $frameworkcode); +C4::Biblio::EmbedItemsInMarcBiblio($temp, $biblionumber); +my @fields = $temp->fields(); foreach my $field (@fields) { next if ( $field->tag() < 10 ); @@ -570,10 +570,10 @@ my $onlymine = C4::Context->preference('IndependantBranches') && C4::Context->userenv && C4::Context->userenv->{flags}!=1 && C4::Context->userenv->{branch}; -my $branches = GetBranchesLoop(undef,$onlymine); # build once ahead of time, instead of multiple times later. +my $branches = GetBranchesLoop(C4::Context->userenv->{branch},$onlymine); # build once ahead of time, instead of multiple times later. # We generate form, from actuel record -my @fields; +@fields = (); if($itemrecord){ foreach my $field ($itemrecord->fields()){ my $tag = $field->{_tag};