Lines 29-37
use C4::Items;
Link Here
|
29 |
use C4::Context; |
29 |
use C4::Context; |
30 |
use C4::Circulation; |
30 |
use C4::Circulation; |
31 |
use C4::Koha; # XXX subfield_is_koha_internal_p |
31 |
use C4::Koha; # XXX subfield_is_koha_internal_p |
32 |
use C4::Branch; # XXX subfield_is_koha_internal_p |
|
|
33 |
use C4::ClassSource; |
32 |
use C4::ClassSource; |
34 |
use Koha::DateUtils; |
33 |
use Koha::DateUtils; |
|
|
34 |
use Koha::Libraries; |
35 |
use List::MoreUtils qw/any/; |
35 |
use List::MoreUtils qw/any/; |
36 |
use C4::Search; |
36 |
use C4::Search; |
37 |
use Storable qw(thaw freeze); |
37 |
use Storable qw(thaw freeze); |
Lines 170-178
sub generate_subfield_form {
Link Here
|
170 |
# builds list, depending on authorised value... |
170 |
# builds list, depending on authorised value... |
171 |
if ( $subfieldlib->{authorised_value} eq "branches" ) { |
171 |
if ( $subfieldlib->{authorised_value} eq "branches" ) { |
172 |
foreach my $thisbranch (@$branches) { |
172 |
foreach my $thisbranch (@$branches) { |
173 |
push @authorised_values, $thisbranch->{value}; |
173 |
push @authorised_values, $thisbranch->{branchcode}; |
174 |
$authorised_lib{$thisbranch->{value}} = $thisbranch->{branchname}; |
174 |
$authorised_lib{$thisbranch->{branchcode}} = $thisbranch->{branchname}; |
175 |
$value = $thisbranch->{value} if $thisbranch->{selected} && !$value; |
175 |
$value = $thisbranch->{branchcode} if $thisbranch->{selected} && !$value; |
176 |
} |
176 |
} |
177 |
} |
177 |
} |
178 |
elsif ( $subfieldlib->{authorised_value} eq "itemtypes" ) { |
178 |
elsif ( $subfieldlib->{authorised_value} eq "itemtypes" ) { |
Lines 852-864
my $i=0;
Link Here
|
852 |
|
852 |
|
853 |
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber'); |
853 |
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber'); |
854 |
|
854 |
|
855 |
my $onlymine = |
|
|
856 |
C4::Context->preference('IndependentBranches') |
857 |
&& C4::Context->userenv |
858 |
&& !C4::Context->IsSuperLibrarian() |
859 |
&& C4::Context->userenv->{branch}; |
860 |
my $branch = $input->param('branch') || C4::Context->userenv->{branch}; |
855 |
my $branch = $input->param('branch') || C4::Context->userenv->{branch}; |
861 |
my $branches = GetBranchesLoop($branch,$onlymine); # build once ahead of time, instead of multiple times later. |
856 |
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later. |
|
|
857 |
for my $library ( @$libraries ) { |
858 |
$library->{selected} = 1 if $library->{branchcode} eq $branch |
859 |
} |
862 |
|
860 |
|
863 |
# We generate form, from actuel record |
861 |
# We generate form, from actuel record |
864 |
@fields = (); |
862 |
@fields = (); |
Lines 874-880
if($itemrecord){
Link Here
|
874 |
next if subfield_is_koha_internal_p($subfieldtag); |
872 |
next if subfield_is_koha_internal_p($subfieldtag); |
875 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
873 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
876 |
|
874 |
|
877 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
875 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
878 |
push @fields, "$tag$subfieldtag"; |
876 |
push @fields, "$tag$subfieldtag"; |
879 |
push (@loop_data, $subfield_data); |
877 |
push (@loop_data, $subfield_data); |
880 |
$i++; |
878 |
$i++; |
Lines 898-904
foreach my $tag ( keys %{$tagslib}){
Link Here
|
898 |
my @values = (undef); |
896 |
my @values = (undef); |
899 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag))); |
897 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag))); |
900 |
for my $value (@values){ |
898 |
for my $value (@values){ |
901 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
899 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
902 |
push (@loop_data, $subfield_data); |
900 |
push (@loop_data, $subfield_data); |
903 |
$i++; |
901 |
$i++; |
904 |
} |
902 |
} |