View | Details | Raw Unified | Return to bug 20256
Collapse All | Expand All

(-)a/cataloguing/additem.pl (-4 / +6 lines)
Lines 107-114 sub _increment_barcode { Link Here
107
107
108
108
109
sub generate_subfield_form {
109
sub generate_subfield_form {
110
        my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $biblionumber, $temp, $loop_data, $i, $restrictededition, $item) = @_;
110
        my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $biblionumber, $temp, $loop_data, $i, $restrictededition, $item, $patron) = @_;
111
  
111
112
        my $frameworkcode = &GetFrameworkCode($biblionumber);
112
        my $frameworkcode = &GetFrameworkCode($biblionumber);
113
113
114
        my %subfield_data;
114
        my %subfield_data;
Lines 187-193 sub generate_subfield_form { Link Here
187
                }
187
                }
188
            }
188
            }
189
            elsif ( $subfieldlib->{authorised_value} eq "branches" ) {
189
            elsif ( $subfieldlib->{authorised_value} eq "branches" ) {
190
                my @allowed = $patron->libraries_where_can_edit_items;
190
                foreach my $thisbranch (@$branches) {
191
                foreach my $thisbranch (@$branches) {
192
                    next unless any { /^$thisbranch->{branchcode}$/ } @allowed;
191
                    push @authorised_values, $thisbranch->{branchcode};
193
                    push @authorised_values, $thisbranch->{branchcode};
192
                    $authorised_lib{$thisbranch->{branchcode}} = $thisbranch->{branchname};
194
                    $authorised_lib{$thisbranch->{branchcode}} = $thisbranch->{branchname};
193
                    $value = $thisbranch->{branchcode} if $thisbranch->{selected} && !$value;
195
                    $value = $thisbranch->{branchcode} if $thisbranch->{selected} && !$value;
Lines 951-957 if($itemrecord){ Link Here
951
953
952
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
954
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
953
955
954
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition, $item);
956
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition, $item, $patron);
955
            push @fields, "$tag$subfieldtag";
957
            push @fields, "$tag$subfieldtag";
956
            push (@loop_data, $subfield_data);
958
            push (@loop_data, $subfield_data);
957
            $i++;
959
            $i++;
Lines 975-981 foreach my $tag ( keys %{$tagslib}){ Link Here
975
        my @values = (undef);
977
        my @values = (undef);
976
        @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
978
        @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
977
        for my $value (@values){
979
        for my $value (@values){
978
            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition, $item);
980
            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition, $item, $patron);
979
            push (@loop_data, $subfield_data);
981
            push (@loop_data, $subfield_data);
980
            $i++;
982
            $i++;
981
        }
983
        }
(-)a/tools/batchMod.pl (-2 / +4 lines)
Lines 34-40 use C4::ClassSource; Link Here
34
use C4::Debug;
34
use C4::Debug;
35
use C4::Members;
35
use C4::Members;
36
use MARC::File::XML;
36
use MARC::File::XML;
37
use List::MoreUtils qw/uniq/;
37
use List::MoreUtils qw( uniq any );
38
38
39
use Koha::Database;
39
use Koha::Database;
40
use Koha::Exceptions::Exception;
40
use Koha::Exceptions::Exception;
Lines 412-417 my $allowAllSubfields = ( Link Here
412
) ? 1 : 0;
412
) ? 1 : 0;
413
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForBatchmod);
413
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForBatchmod);
414
414
415
my @allowed_to_edit_branches = $patron->libraries_where_can_edit_items;
416
415
foreach my $tag (sort keys %{$tagslib}) {
417
foreach my $tag (sort keys %{$tagslib}) {
416
    # loop through each subfield
418
    # loop through each subfield
417
    foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
419
    foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
Lines 456-461 foreach my $tag (sort keys %{$tagslib}) { Link Here
456
458
457
    if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) {
459
    if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) {
458
        foreach my $library (@$libraries) {
460
        foreach my $library (@$libraries) {
461
            next unless any { /^$library->{branchcode}$/ } @allowed_to_edit_branches;
459
            push @authorised_values, $library->{branchcode};
462
            push @authorised_values, $library->{branchcode};
460
            $authorised_lib{$library->{branchcode}} = $library->{branchname};
463
            $authorised_lib{$library->{branchcode}} = $library->{branchname};
461
        }
464
        }
462
- 

Return to bug 20256