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

(-)a/cataloguing/additem.pl (-4 / +6 lines)
Lines 105-112 sub _increment_barcode { Link Here
105
105
106
106
107
sub generate_subfield_form {
107
sub generate_subfield_form {
108
        my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $biblionumber, $temp, $loop_data, $i, $restrictededition, $item) = @_;
108
        my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $biblionumber, $temp, $loop_data, $i, $restrictededition, $item, $patron) = @_;
109
  
109
110
        my $frameworkcode = &GetFrameworkCode($biblionumber);
110
        my $frameworkcode = &GetFrameworkCode($biblionumber);
111
111
112
        my %subfield_data;
112
        my %subfield_data;
Lines 192-198 sub generate_subfield_form { Link Here
192
                }
192
                }
193
            }
193
            }
194
            elsif ( $subfieldlib->{authorised_value} eq "branches" ) {
194
            elsif ( $subfieldlib->{authorised_value} eq "branches" ) {
195
                my @allowed = $patron->libraries_where_can_edit_items;
195
                foreach my $thisbranch (@$branches) {
196
                foreach my $thisbranch (@$branches) {
197
                    next unless any { /^$thisbranch->{branchcode}$/ } @allowed;
196
                    push @authorised_values, $thisbranch->{branchcode};
198
                    push @authorised_values, $thisbranch->{branchcode};
197
                    $authorised_lib{$thisbranch->{branchcode}} = $thisbranch->{branchname};
199
                    $authorised_lib{$thisbranch->{branchcode}} = $thisbranch->{branchname};
198
                    $value = $thisbranch->{branchcode} if $thisbranch->{selected} && !$value;
200
                    $value = $thisbranch->{branchcode} if $thisbranch->{selected} && !$value;
Lines 974-980 if($itemrecord){ Link Here
974
976
975
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
977
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
976
978
977
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition, $item);
979
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition, $item, $patron);
978
            push @fields, "$tag$subfieldtag";
980
            push @fields, "$tag$subfieldtag";
979
            push (@loop_data, $subfield_data);
981
            push (@loop_data, $subfield_data);
980
            $i++;
982
            $i++;
Lines 998-1004 foreach my $tag ( keys %{$tagslib}){ Link Here
998
        my @values = (undef);
1000
        my @values = (undef);
999
        @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
1001
        @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
1000
        for my $value (@values){
1002
        for my $value (@values){
1001
            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition, $item);
1003
            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition, $item, $patron);
1002
            push (@loop_data, $subfield_data);
1004
            push (@loop_data, $subfield_data);
1003
            $i++;
1005
            $i++;
1004
        }
1006
        }
(-)a/tools/batchMod.pl (-2 / +4 lines)
Lines 39-45 use C4::Koha; Link Here
39
use C4::BackgroundJob;
39
use C4::BackgroundJob;
40
use C4::ClassSource qw( GetClassSources GetClassSource );
40
use C4::ClassSource qw( GetClassSources GetClassSource );
41
use MARC::File::XML;
41
use MARC::File::XML;
42
use List::MoreUtils qw( uniq );
42
use List::MoreUtils qw( uniq any );
43
43
44
use Koha::Database;
44
use Koha::Database;
45
use Koha::Exceptions::Exception;
45
use Koha::Exceptions::Exception;
Lines 419-424 my $allowAllSubfields = ( Link Here
419
) ? 1 : 0;
419
) ? 1 : 0;
420
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForBatchmod);
420
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForBatchmod);
421
421
422
my @allowed_to_edit_branches = $patron->libraries_where_can_edit_items;
423
422
foreach my $tag (sort keys %{$tagslib}) {
424
foreach my $tag (sort keys %{$tagslib}) {
423
    # loop through each subfield
425
    # loop through each subfield
424
    foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
426
    foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
Lines 462-467 foreach my $tag (sort keys %{$tagslib}) { Link Here
462
464
463
    if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) {
465
    if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) {
464
        foreach my $library (@$libraries) {
466
        foreach my $library (@$libraries) {
467
            next unless any { /^$library->{branchcode}$/ } @allowed_to_edit_branches;
465
            push @authorised_values, $library->{branchcode};
468
            push @authorised_values, $library->{branchcode};
466
            $authorised_lib{$library->{branchcode}} = $library->{branchname};
469
            $authorised_lib{$library->{branchcode}} = $library->{branchname};
467
        }
470
        }
468
- 

Return to bug 20256