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

(-)a/cataloguing/additem.pl (-2 / +4 lines)
Lines 112-118 sub _increment_barcode { Link Here
112
112
113
113
114
sub generate_subfield_form {
114
sub generate_subfield_form {
115
        my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $biblionumber, $temp, $loop_data, $i, $restrictededition) = @_;
115
        my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $biblionumber, $temp, $loop_data, $i, $restrictededition, $patron) = @_;
116
  
116
  
117
        my $frameworkcode = &GetFrameworkCode($biblionumber);
117
        my $frameworkcode = &GetFrameworkCode($biblionumber);
118
118
Lines 175-181 sub generate_subfield_form { Link Here
175
            my %authorised_lib;
175
            my %authorised_lib;
176
            # builds list, depending on authorised value...
176
            # builds list, depending on authorised value...
177
            if ( $subfieldlib->{authorised_value} eq "branches" ) {
177
            if ( $subfieldlib->{authorised_value} eq "branches" ) {
178
                my @allowed = $patron->libraries_where_can_edit_items;
178
                foreach my $thisbranch (@$branches) {
179
                foreach my $thisbranch (@$branches) {
180
                    next unless any { /^$thisbranch->{branchcode}$/ } @allowed;
179
                    push @authorised_values, $thisbranch->{branchcode};
181
                    push @authorised_values, $thisbranch->{branchcode};
180
                    $authorised_lib{$thisbranch->{branchcode}} = $thisbranch->{branchname};
182
                    $authorised_lib{$thisbranch->{branchcode}} = $thisbranch->{branchname};
181
                    $value = $thisbranch->{branchcode} if $thisbranch->{selected} && !$value;
183
                    $value = $thisbranch->{branchcode} if $thisbranch->{selected} && !$value;
Lines 914-920 if($itemrecord){ Link Here
914
916
915
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
917
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
916
918
917
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
919
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition, $patron);
918
            push @fields, "$tag$subfieldtag";
920
            push @fields, "$tag$subfieldtag";
919
            push (@loop_data, $subfield_data);
921
            push (@loop_data, $subfield_data);
920
            $i++;
922
            $i++;
(-)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 335-340 my $allowAllSubfields = ( Link Here
335
) ? 1 : 0;
335
) ? 1 : 0;
336
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForBatchmod);
336
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForBatchmod);
337
337
338
my @allowed_to_edit_branches = $patron->libraries_where_can_edit_items;
339
338
foreach my $tag (sort keys %{$tagslib}) {
340
foreach my $tag (sort keys %{$tagslib}) {
339
    # loop through each subfield
341
    # loop through each subfield
340
    foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
342
    foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
Lines 379-384 foreach my $tag (sort keys %{$tagslib}) { Link Here
379
381
380
    if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) {
382
    if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) {
381
        foreach my $library (@$libraries) {
383
        foreach my $library (@$libraries) {
384
            next unless any { /^$library->{branchcode}$/ } @allowed_to_edit_branches;
382
            push @authorised_values, $library->{branchcode};
385
            push @authorised_values, $library->{branchcode};
383
            $authorised_lib{$library->{branchcode}} = $library->{branchname};
386
            $authorised_lib{$library->{branchcode}} = $library->{branchname};
384
        }
387
        }
385
- 

Return to bug 20256