|
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(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="$subfield_data{maxlength}" ); |
158 |
my $attributes_no_value = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="$subfield_data{maxlength}" ); |
| 159 |
my $attributes_no_value_textarea = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" rows="5" cols="64" ); |
159 |
my $attributes_no_value_textarea = qq(tabindex="1" 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 243-253
sub generate_subfield_form {
Link Here
|
| 243 |
-class => "input_marceditor", |
243 |
-class => "input_marceditor", |
| 244 |
); |
244 |
); |
| 245 |
|
245 |
|
| 246 |
# If we're on limited edition, and our field is not in the list of subfields to allow, |
246 |
# If we're on restricted edition, and our field is not in the list of subfields to allow, |
| 247 |
# then it is read-only |
247 |
# then it is read-only |
| 248 |
push @scrparam, (-readonly => "readonly"), (-disabled => "disabled") |
248 |
push @scrparam, (-readonly => "readonly"), (-disabled => "disabled") |
| 249 |
if ( |
249 |
if ( |
| 250 |
$limitededition |
250 |
$restrictededition |
| 251 |
and !grep { $tag . '$' . $subfieldtag eq $_ } @subfieldsToAllow |
251 |
and !grep { $tag . '$' . $subfieldtag eq $_ } @subfieldsToAllow |
| 252 |
); |
252 |
); |
| 253 |
$subfield_data{marc_value} =CGI::scrolling_list(@scrparam); |
253 |
$subfield_data{marc_value} =CGI::scrolling_list(@scrparam); |
|
Lines 369-381
my ($template, $loggedinuser, $cookie)
Link Here
|
| 369 |
}); |
369 |
}); |
| 370 |
|
370 |
|
| 371 |
|
371 |
|
| 372 |
# Does the user have a limited item edition permission? |
372 |
# Does the user have a restricted item edition permission? |
| 373 |
my $uid = $loggedinuser ? GetMember( borrowernumber => $loggedinuser )->{userid} : undef; |
373 |
my $uid = $loggedinuser ? GetMember( borrowernumber => $loggedinuser )->{userid} : undef; |
| 374 |
my $limitededition = $uid ? haspermission($uid, {'editcatalogue' => 'limited_item_edition'}) : undef; |
374 |
my $restrictededition = $uid ? haspermission($uid, {'editcatalogue' => 'edit_items_restricted'}) : undef; |
| 375 |
# In case user is a superlibrarian, edition is not limited |
375 |
# In case user is a superlibrarian, edition is not restricted |
| 376 |
$limitededition = 0 if ($limitededition != 0 && $limitededition->{'superlibrarian'} eq 1); |
376 |
$restrictededition = 0 if ($restrictededition != 0 && $restrictededition->{'superlibrarian'} eq 1); |
| 377 |
# In case user has fast cataloging permission (and we're in fast cataloging), edition is not limited |
377 |
# In case user has fast cataloging permission (and we're in fast cataloging), edition is not restricted |
| 378 |
$limitededition = 0 if ($limitededition != 0 && $frameworkcode eq 'FA' && haspermission($uid, {'editcatalogue' => 'fast_cataloging'})); |
378 |
$restrictededition = 0 if ($restrictededition != 0 && $frameworkcode eq 'FA' && haspermission($uid, {'editcatalogue' => 'fast_cataloging'})); |
| 379 |
|
379 |
|
| 380 |
my $today_iso = C4::Dates->today('iso'); |
380 |
my $today_iso = C4::Dates->today('iso'); |
| 381 |
my $tagslib = &GetMarcStructure(1,$frameworkcode); |
381 |
my $tagslib = &GetMarcStructure(1,$frameworkcode); |
|
Lines 809-815
if($itemrecord){
Link Here
|
| 809 |
next if subfield_is_koha_internal_p($subfieldtag); |
809 |
next if subfield_is_koha_internal_p($subfieldtag); |
| 810 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
810 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
| 811 |
|
811 |
|
| 812 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $limitededition); |
812 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
| 813 |
push @fields, "$tag$subfieldtag"; |
813 |
push @fields, "$tag$subfieldtag"; |
| 814 |
push (@loop_data, $subfield_data); |
814 |
push (@loop_data, $subfield_data); |
| 815 |
$i++; |
815 |
$i++; |
|
Lines 833-839
foreach my $tag ( keys %{$tagslib}){
Link Here
|
| 833 |
my @values = (undef); |
833 |
my @values = (undef); |
| 834 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag))); |
834 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag))); |
| 835 |
for my $value (@values){ |
835 |
for my $value (@values){ |
| 836 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $limitededition); |
836 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $restrictededition); |
| 837 |
push (@loop_data, $subfield_data); |
837 |
push (@loop_data, $subfield_data); |
| 838 |
$i++; |
838 |
$i++; |
| 839 |
} |
839 |
} |