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 932-938 if($itemrecord){ Link Here
932
934
933
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
935
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
934
936
935
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
937
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition, $patron);
936
            push @fields, "$tag$subfieldtag";
938
            push @fields, "$tag$subfieldtag";
937
            push (@loop_data, $subfield_data);
939
            push (@loop_data, $subfield_data);
938
            $i++;
940
            $i++;
Lines 956-962 foreach my $tag ( keys %{$tagslib}){ Link Here
956
        my @values = (undef);
958
        my @values = (undef);
957
        @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
959
        @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
958
        for my $value (@values){
960
        for my $value (@values){
959
            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
961
            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition, $patron);
960
            push (@loop_data, $subfield_data);
962
            push (@loop_data, $subfield_data);
961
            $i++;
963
            $i++;
962
        }
964
        }
(-)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 411-416 my $allowAllSubfields = ( Link Here
411
) ? 1 : 0;
411
) ? 1 : 0;
412
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForBatchmod);
412
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForBatchmod);
413
413
414
my @allowed_to_edit_branches = $patron->libraries_where_can_edit_items;
415
414
foreach my $tag (sort keys %{$tagslib}) {
416
foreach my $tag (sort keys %{$tagslib}) {
415
    # loop through each subfield
417
    # loop through each subfield
416
    foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
418
    foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
Lines 455-460 foreach my $tag (sort keys %{$tagslib}) { Link Here
455
457
456
    if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) {
458
    if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) {
457
        foreach my $library (@$libraries) {
459
        foreach my $library (@$libraries) {
460
            next unless any { /^$library->{branchcode}$/ } @allowed_to_edit_branches;
458
            push @authorised_values, $library->{branchcode};
461
            push @authorised_values, $library->{branchcode};
459
            $authorised_lib{$library->{branchcode}} = $library->{branchname};
462
            $authorised_lib{$library->{branchcode}} = $library->{branchname};
460
        }
463
        }
461
- 

Return to bug 20256