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

(-)a/cataloguing/additem.pl (-14 / +14 lines)
Lines 104-110 sub _increment_barcode { Link Here
104
104
105
105
106
sub generate_subfield_form {
106
sub generate_subfield_form {
107
        my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $today_iso, $biblionumber, $temp, $loop_data, $i, $limitededition) = @_;
107
        my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $today_iso, $biblionumber, $temp, $loop_data, $i, $restrictededition) = @_;
108
  
108
  
109
        my $frameworkcode = &GetFrameworkCode($biblionumber);
109
        my $frameworkcode = &GetFrameworkCode($biblionumber);
110
110
Lines 158-172 sub generate_subfield_form { Link Here
158
        my $attributes_no_value = qq(id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="$subfield_data{maxlength}" );
158
        my $attributes_no_value = qq(id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="$subfield_data{maxlength}" );
159
        my $attributes_no_value_textarea = qq(id="$subfield_data{id}" name="field_value" class="input_marceditor" rows="5" cols="64" );
159
        my $attributes_no_value_textarea = qq(id="$subfield_data{id}" name="field_value" class="input_marceditor" rows="5" cols="64" );
160
160
161
        # Getting list of subfields to keep when limited edition is enabled
161
        # Getting list of subfields to keep when restricted edition is enabled
162
        my $subfieldsToAllowForRestrictedEdition = C4::Context->preference('SubfieldsToAllowForRestrictedEdition');
162
        my $subfieldsToAllowForRestrictedEdition = C4::Context->preference('SubfieldsToAllowForRestrictedEdition');
163
        my @subfieldsToAllow = split(/ /, $subfieldsToAllowForRestrictedEdition);
163
        my @subfieldsToAllow = split(/ /, $subfieldsToAllowForRestrictedEdition);
164
164
165
        # If we're on limited edition, and our field is not in the list of subfields to allow,
165
        # If we're on restricted edition, and our field is not in the list of subfields to allow,
166
        # then it is read-only
166
        # then it is read-only
167
        $attributes_no_value .= 'readonly="readonly" '
167
        $attributes_no_value .= 'readonly="readonly" '
168
            if (
168
            if (
169
                $limitededition
169
                $restrictededition
170
                and !grep { $tag . '$' . $subfieldtag  eq $_ } @subfieldsToAllow
170
                and !grep { $tag . '$' . $subfieldtag  eq $_ } @subfieldsToAllow
171
            );
171
            );
172
172
Lines 242-252 sub generate_subfield_form { Link Here
242
                    -class    => "input_marceditor",
242
                    -class    => "input_marceditor",
243
                );
243
                );
244
244
245
                # If we're on limited edition, and our field is not in the list of subfields to allow,
245
                # If we're on restricted edition, and our field is not in the list of subfields to allow,
246
                # then it is read-only
246
                # then it is read-only
247
                push @scrparam, (-readonly => "readonly"), (-disabled => "disabled")
247
                push @scrparam, (-readonly => "readonly"), (-disabled => "disabled")
248
                    if (
248
                    if (
249
                        $limitededition
249
                        $restrictededition
250
                        and !grep { $tag . '$' . $subfieldtag  eq $_ } @subfieldsToAllow
250
                        and !grep { $tag . '$' . $subfieldtag  eq $_ } @subfieldsToAllow
251
                    );
251
                    );
252
                $subfield_data{marc_value} =CGI::scrolling_list(@scrparam);
252
                $subfield_data{marc_value} =CGI::scrolling_list(@scrparam);
Lines 368-380 my ($template, $loggedinuser, $cookie) Link Here
368
                 });
368
                 });
369
369
370
370
371
# Does the user have a limited item edition permission?
371
# Does the user have a restricted item edition permission?
372
my $uid = $loggedinuser ? GetMember( borrowernumber => $loggedinuser )->{userid} : undef;
372
my $uid = $loggedinuser ? GetMember( borrowernumber => $loggedinuser )->{userid} : undef;
373
my $limitededition = $uid ? haspermission($uid,  {'editcatalogue' => 'limited_item_edition'}) : undef;
373
my $restrictededition = $uid ? haspermission($uid,  {'editcatalogue' => 'edit_items_restricted'}) : undef;
374
# In case user is a superlibrarian, edition is not limited
374
# In case user is a superlibrarian, edition is not restricted
375
$limitededition = 0 if ($limitededition != 0 && $limitededition->{'superlibrarian'} eq 1);
375
$restrictededition = 0 if ($restrictededition != 0 && $restrictededition->{'superlibrarian'} eq 1);
376
# In case user has fast cataloging permission (and we're in fast cataloging), edition is not limited
376
# In case user has fast cataloging permission (and we're in fast cataloging), edition is not restricted
377
$limitededition = 0 if ($limitededition != 0 && $frameworkcode eq 'FA' && haspermission($uid, {'editcatalogue' => 'fast_cataloging'}));
377
$restrictededition = 0 if ($restrictededition != 0 && $frameworkcode eq 'FA' && haspermission($uid, {'editcatalogue' => 'fast_cataloging'}));
378
378
379
my $today_iso = C4::Dates->today('iso');
379
my $today_iso = C4::Dates->today('iso');
380
my $tagslib = &GetMarcStructure(1,$frameworkcode);
380
my $tagslib = &GetMarcStructure(1,$frameworkcode);
Lines 808-814 if($itemrecord){ Link Here
808
            next if subfield_is_koha_internal_p($subfieldtag);
808
            next if subfield_is_koha_internal_p($subfieldtag);
809
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
809
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
810
810
811
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $limitededition);
811
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
812
            push @fields, "$tag$subfieldtag";
812
            push @fields, "$tag$subfieldtag";
813
            push (@loop_data, $subfield_data);
813
            push (@loop_data, $subfield_data);
814
            $i++;
814
            $i++;
Lines 832-838 foreach my $tag ( keys %{$tagslib}){ Link Here
832
        my @values = (undef);
832
        my @values = (undef);
833
        @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
833
        @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
834
        for my $value (@values){
834
        for my $value (@values){
835
            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $limitededition);
835
            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
836
            push (@loop_data, $subfield_data);
836
            push (@loop_data, $subfield_data);
837
            $i++;
837
            $i++;
838
        }
838
        }
(-)a/tools/batchMod.pl (-7 / +6 lines)
Lines 70-80 my ($template, $loggedinuser, $cookie) Link Here
70
                 flagsrequired => $template_flag,
70
                 flagsrequired => $template_flag,
71
                 });
71
                 });
72
72
73
# Does the user have a limited item edition permission?
73
# Does the user have a restricted item edition permission?
74
my $uid = $loggedinuser ? GetMember( borrowernumber => $loggedinuser )->{userid} : undef;
74
my $uid = $loggedinuser ? GetMember( borrowernumber => $loggedinuser )->{userid} : undef;
75
my $limitededition = $uid ? haspermission($uid,  {'tools' => 'items_limited_batchmod'}) : undef;
75
my $restrictededition = $uid ? haspermission($uid,  {'tools' => 'items_batchmod_restricted'}) : undef;
76
# In case user is a superlibrarian, edition is not limited
76
# In case user is a superlibrarian, edition is not restricted
77
$limitededition = 0 if ($limitededition != 0 && $limitededition->{'superlibrarian'} eq 1);
77
$restrictededition = 0 if ($restrictededition != 0 && $restrictededition->{'superlibrarian'} eq 1);
78
78
79
my $today_iso = C4::Dates->today('iso');
79
my $today_iso = C4::Dates->today('iso');
80
$template->param(today_iso => $today_iso);
80
$template->param(today_iso => $today_iso);
Lines 299-305 unshift (@$branches, $nochange_branch); Link Here
299
299
300
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
300
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
301
301
302
# Getting list of subfields to keep when limited batchmod edit is enabled
302
# Getting list of subfields to keep when restricted batchmod edit is enabled
303
my $subfieldsToAllowForBatchmod = C4::Context->preference('SubfieldsToAllowForRestrictedBatchmod');
303
my $subfieldsToAllowForBatchmod = C4::Context->preference('SubfieldsToAllowForRestrictedBatchmod');
304
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForBatchmod);
304
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForBatchmod);
305
305
Lines 307-313 foreach my $tag (sort keys %{$tagslib}) { Link Here
307
    # loop through each subfield
307
    # loop through each subfield
308
    foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
308
    foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
309
     	next if subfield_is_koha_internal_p($subfield);
309
     	next if subfield_is_koha_internal_p($subfield);
310
        next if ($limitededition && !grep { $tag . '$' . $subfield eq $_ } @subfieldsToAllow );
310
        next if ($restrictededition && !grep { $tag . '$' . $subfield eq $_ } @subfieldsToAllow );
311
    	next if ($tagslib->{$tag}->{$subfield}->{'tab'} ne "10");
311
    	next if ($tagslib->{$tag}->{$subfield}->{'tab'} ne "10");
312
        # barcode and stocknumber are not meant to be batch-modified
312
        # barcode and stocknumber are not meant to be batch-modified
313
    	next if $tagslib->{$tag}->{$subfield}->{'kohafield'} eq 'items.barcode';
313
    	next if $tagslib->{$tag}->{$subfield}->{'kohafield'} eq 'items.barcode';
314
- 

Return to bug 7673