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 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 873-879
if($itemrecord){
Link Here
|
873 |
|
871 |
|
874 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
872 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
875 |
|
873 |
|
876 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
874 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
877 |
push @fields, "$tag$subfieldtag"; |
875 |
push @fields, "$tag$subfieldtag"; |
878 |
push (@loop_data, $subfield_data); |
876 |
push (@loop_data, $subfield_data); |
879 |
$i++; |
877 |
$i++; |
Lines 897-903
foreach my $tag ( keys %{$tagslib}){
Link Here
|
897 |
my @values = (undef); |
895 |
my @values = (undef); |
898 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag))); |
896 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag))); |
899 |
for my $value (@values){ |
897 |
for my $value (@values){ |
900 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
898 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
901 |
push (@loop_data, $subfield_data); |
899 |
push (@loop_data, $subfield_data); |
902 |
$i++; |
900 |
$i++; |
903 |
} |
901 |
} |