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

(-)a/cataloguing/additem.pl (-3 / +5 lines)
Lines 107-113 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) = @_;
110
        my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $biblionumber, $temp, $loop_data, $i, $restrictededition, $patron) = @_;
111
  
111
  
112
        my $frameworkcode = &GetFrameworkCode($biblionumber);
112
        my $frameworkcode = &GetFrameworkCode($biblionumber);
113
113
Lines 171-177 sub generate_subfield_form { Link Here
171
            my %authorised_lib;
171
            my %authorised_lib;
172
            # builds list, depending on authorised value...
172
            # builds list, depending on authorised value...
173
            if ( $subfieldlib->{authorised_value} eq "branches" ) {
173
            if ( $subfieldlib->{authorised_value} eq "branches" ) {
174
                my @allowed = $patron->libraries_where_can_edit_items;
174
                foreach my $thisbranch (@$branches) {
175
                foreach my $thisbranch (@$branches) {
176
                    next unless any { /^$thisbranch->{branchcode}$/ } @allowed;
175
                    push @authorised_values, $thisbranch->{branchcode};
177
                    push @authorised_values, $thisbranch->{branchcode};
176
                    $authorised_lib{$thisbranch->{branchcode}} = $thisbranch->{branchname};
178
                    $authorised_lib{$thisbranch->{branchcode}} = $thisbranch->{branchname};
177
                    $value = $thisbranch->{branchcode} if $thisbranch->{selected} && !$value;
179
                    $value = $thisbranch->{branchcode} if $thisbranch->{selected} && !$value;
Lines 927-933 if($itemrecord){ Link Here
927
929
928
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
930
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
929
931
930
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
932
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition, $patron);
931
            push @fields, "$tag$subfieldtag";
933
            push @fields, "$tag$subfieldtag";
932
            push (@loop_data, $subfield_data);
934
            push (@loop_data, $subfield_data);
933
            $i++;
935
            $i++;
Lines 951-957 foreach my $tag ( keys %{$tagslib}){ Link Here
951
        my @values = (undef);
953
        my @values = (undef);
952
        @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
954
        @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
953
        for my $value (@values){
955
        for my $value (@values){
954
            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
956
            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition, $patron);
955
            push (@loop_data, $subfield_data);
957
            push (@loop_data, $subfield_data);
956
            $i++;
958
            $i++;
957
        }
959
        }
(-)a/tools/batchMod.pl (-2 / +4 lines)
Lines 32-38 use C4::ClassSource; Link Here
32
use C4::Debug;
32
use C4::Debug;
33
use C4::Members;
33
use C4::Members;
34
use MARC::File::XML;
34
use MARC::File::XML;
35
use List::MoreUtils qw/uniq/;
35
use List::MoreUtils qw( uniq any );
36
36
37
use Koha::AuthorisedValues;
37
use Koha::AuthorisedValues;
38
use Koha::Biblios;
38
use Koha::Biblios;
Lines 376-381 my $allowAllSubfields = ( Link Here
376
) ? 1 : 0;
376
) ? 1 : 0;
377
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForBatchmod);
377
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForBatchmod);
378
378
379
my @allowed_to_edit_branches = $patron->libraries_where_can_edit_items;
380
379
foreach my $tag (sort keys %{$tagslib}) {
381
foreach my $tag (sort keys %{$tagslib}) {
380
    # loop through each subfield
382
    # loop through each subfield
381
    foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
383
    foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
Lines 420-425 foreach my $tag (sort keys %{$tagslib}) { Link Here
420
422
421
    if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) {
423
    if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) {
422
        foreach my $library (@$libraries) {
424
        foreach my $library (@$libraries) {
425
            next unless any { /^$library->{branchcode}$/ } @allowed_to_edit_branches;
423
            push @authorised_values, $library->{branchcode};
426
            push @authorised_values, $library->{branchcode};
424
            $authorised_lib{$library->{branchcode}} = $library->{branchname};
427
            $authorised_lib{$library->{branchcode}} = $library->{branchname};
425
        }
428
        }
426
- 

Return to bug 20256