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 |
} |