|
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 175-183
sub generate_subfield_form {
Link Here
|
| 175 |
# builds list, depending on authorised value... |
175 |
# builds list, depending on authorised value... |
| 176 |
if ( $subfieldlib->{authorised_value} eq "branches" ) { |
176 |
if ( $subfieldlib->{authorised_value} eq "branches" ) { |
| 177 |
foreach my $thisbranch (@$branches) { |
177 |
foreach my $thisbranch (@$branches) { |
| 178 |
push @authorised_values, $thisbranch->{value}; |
178 |
push @authorised_values, $thisbranch->{branchcode}; |
| 179 |
$authorised_lib{$thisbranch->{value}} = $thisbranch->{branchname}; |
179 |
$authorised_lib{$thisbranch->{branchcode}} = $thisbranch->{branchname}; |
| 180 |
$value = $thisbranch->{value} if $thisbranch->{selected} && !$value; |
180 |
$value = $thisbranch->{branchcode} if $thisbranch->{selected} && !$value; |
| 181 |
} |
181 |
} |
| 182 |
} |
182 |
} |
| 183 |
elsif ( $subfieldlib->{authorised_value} eq "itemtypes" ) { |
183 |
elsif ( $subfieldlib->{authorised_value} eq "itemtypes" ) { |
|
Lines 863-875
my $i=0;
Link Here
|
| 863 |
|
863 |
|
| 864 |
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber'); |
864 |
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber'); |
| 865 |
|
865 |
|
| 866 |
my $onlymine = |
|
|
| 867 |
C4::Context->preference('IndependentBranches') |
| 868 |
&& C4::Context->userenv |
| 869 |
&& !C4::Context->IsSuperLibrarian() |
| 870 |
&& C4::Context->userenv->{branch}; |
| 871 |
my $branch = $input->param('branch') || C4::Context->userenv->{branch}; |
866 |
my $branch = $input->param('branch') || C4::Context->userenv->{branch}; |
| 872 |
my $branches = GetBranchesLoop($branch,$onlymine); # build once ahead of time, instead of multiple times later. |
867 |
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later. |
|
|
868 |
for my $library ( @$libraries ) { |
| 869 |
$library->{selected} = 1 if $library->{branchcode} eq $branch |
| 870 |
} |
| 873 |
|
871 |
|
| 874 |
# We generate form, from actuel record |
872 |
# We generate form, from actuel record |
| 875 |
@fields = (); |
873 |
@fields = (); |
|
Lines 884-890
if($itemrecord){
Link Here
|
| 884 |
|
882 |
|
| 885 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
883 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
| 886 |
|
884 |
|
| 887 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
885 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
| 888 |
push @fields, "$tag$subfieldtag"; |
886 |
push @fields, "$tag$subfieldtag"; |
| 889 |
push (@loop_data, $subfield_data); |
887 |
push (@loop_data, $subfield_data); |
| 890 |
$i++; |
888 |
$i++; |
|
Lines 908-914
foreach my $tag ( keys %{$tagslib}){
Link Here
|
| 908 |
my @values = (undef); |
906 |
my @values = (undef); |
| 909 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag))); |
907 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag))); |
| 910 |
for my $value (@values){ |
908 |
for my $value (@values){ |
| 911 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
909 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
| 912 |
push (@loop_data, $subfield_data); |
910 |
push (@loop_data, $subfield_data); |
| 913 |
$i++; |
911 |
$i++; |
| 914 |
} |
912 |
} |