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; |
31 |
use C4::Koha; |
32 |
use C4::Branch; |
|
|
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 858-870
my $i=0;
Link Here
|
858 |
|
858 |
|
859 |
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber'); |
859 |
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber'); |
860 |
|
860 |
|
861 |
my $onlymine = |
|
|
862 |
C4::Context->preference('IndependentBranches') |
863 |
&& C4::Context->userenv |
864 |
&& !C4::Context->IsSuperLibrarian() |
865 |
&& C4::Context->userenv->{branch}; |
866 |
my $branch = $input->param('branch') || C4::Context->userenv->{branch}; |
861 |
my $branch = $input->param('branch') || C4::Context->userenv->{branch}; |
867 |
my $branches = GetBranchesLoop($branch,$onlymine); # build once ahead of time, instead of multiple times later. |
862 |
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later. |
|
|
863 |
for my $library ( @$libraries ) { |
864 |
$library->{selected} = 1 if $library->{branchcode} eq $branch |
865 |
} |
868 |
|
866 |
|
869 |
# We generate form, from actuel record |
867 |
# We generate form, from actuel record |
870 |
@fields = (); |
868 |
@fields = (); |
Lines 879-885
if($itemrecord){
Link Here
|
879 |
|
877 |
|
880 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
878 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
881 |
|
879 |
|
882 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
880 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
883 |
push @fields, "$tag$subfieldtag"; |
881 |
push @fields, "$tag$subfieldtag"; |
884 |
push (@loop_data, $subfield_data); |
882 |
push (@loop_data, $subfield_data); |
885 |
$i++; |
883 |
$i++; |
Lines 903-909
foreach my $tag ( keys %{$tagslib}){
Link Here
|
903 |
my @values = (undef); |
901 |
my @values = (undef); |
904 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag))); |
902 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag))); |
905 |
for my $value (@values){ |
903 |
for my $value (@values){ |
906 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
904 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
907 |
push (@loop_data, $subfield_data); |
905 |
push (@loop_data, $subfield_data); |
908 |
$i++; |
906 |
$i++; |
909 |
} |
907 |
} |