Lines 36-42
use List::MoreUtils qw/any/;
Link Here
|
36 |
use C4::Search; |
36 |
use C4::Search; |
37 |
use Storable qw(thaw freeze); |
37 |
use Storable qw(thaw freeze); |
38 |
use URI::Escape; |
38 |
use URI::Escape; |
39 |
|
39 |
use C4::Members; |
40 |
|
40 |
|
41 |
use MARC::File::XML; |
41 |
use MARC::File::XML; |
42 |
use URI::Escape; |
42 |
use URI::Escape; |
Lines 104-112
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) = @_; |
107 |
my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $today_iso, $biblionumber, $temp, $loop_data, $i, $limitededition) = @_; |
108 |
|
108 |
|
109 |
my $frameworkcode = &GetFrameworkCode($biblionumber); |
109 |
my $frameworkcode = &GetFrameworkCode($biblionumber); |
|
|
110 |
|
110 |
my %subfield_data; |
111 |
my %subfield_data; |
111 |
my $dbh = C4::Context->dbh; |
112 |
my $dbh = C4::Context->dbh; |
112 |
|
113 |
|
Lines 156-161
sub generate_subfield_form {
Link Here
|
156 |
} |
157 |
} |
157 |
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}" ); |
158 |
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 |
|
161 |
# Getting list of subfields to keep when limited edition is enabled |
162 |
my $subfieldsToAllowForLimitedEdition = C4::Context->preference('SubfieldsToAllowForLimitedEdition'); |
163 |
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForLimitedEdition); |
164 |
|
165 |
# If we're on limited edition, and our field is not in the list of subfields to allow, |
166 |
# then it is read-only |
167 |
$attributes_no_value .= 'readonly="readonly" ' |
168 |
if ( |
169 |
$limitededition |
170 |
and !grep { $tag . '$' . $subfieldtag eq $_ } @subfieldsToAllow |
171 |
); |
172 |
|
159 |
my $attributes = qq($attributes_no_value value="$value" ); |
173 |
my $attributes = qq($attributes_no_value value="$value" ); |
160 |
|
174 |
|
161 |
if ( $subfieldlib->{authorised_value} ) { |
175 |
if ( $subfieldlib->{authorised_value} ) { |
Lines 216-222
sub generate_subfield_form {
Link Here
|
216 |
$subfield_data{marc_value} = qq(<input type="hidden" $attributes /> $authorised_lib{$value}); |
230 |
$subfield_data{marc_value} = qq(<input type="hidden" $attributes /> $authorised_lib{$value}); |
217 |
} |
231 |
} |
218 |
else { |
232 |
else { |
219 |
$subfield_data{marc_value} =CGI::scrolling_list( # FIXME: factor out scrolling_list |
233 |
my @scrparam = ( |
220 |
-name => "field_value", |
234 |
-name => "field_value", |
221 |
-values => \@authorised_values, |
235 |
-values => \@authorised_values, |
222 |
-default => $value, |
236 |
-default => $value, |
Lines 228-233
sub generate_subfield_form {
Link Here
|
228 |
-id => "tag_".$tag."_subfield_".$subfieldtag."_".$index_subfield, |
242 |
-id => "tag_".$tag."_subfield_".$subfieldtag."_".$index_subfield, |
229 |
-class => "input_marceditor", |
243 |
-class => "input_marceditor", |
230 |
); |
244 |
); |
|
|
245 |
|
246 |
# If we're on limited edition, and our field is not in the list of subfields to allow, |
247 |
# then it is read-only |
248 |
push @scrparam, (-readonly => "readonly"), (-disabled => "disabled") |
249 |
if ( |
250 |
$limitededition |
251 |
and !grep { $tag . '$' . $subfieldtag eq $_ } @subfieldsToAllow |
252 |
); |
253 |
$subfield_data{marc_value} =CGI::scrolling_list(@scrparam); |
231 |
} |
254 |
} |
232 |
|
255 |
|
233 |
} |
256 |
} |
Lines 346-351
my ($template, $loggedinuser, $cookie)
Link Here
|
346 |
}); |
369 |
}); |
347 |
|
370 |
|
348 |
|
371 |
|
|
|
372 |
# Does the user have a limited item edition permission? |
373 |
my $uid = GetMember( borrowernumber => $loggedinuser )->{userid} if ($loggedinuser) ; |
374 |
my $limitededition = haspermission($uid, {'editcatalogue' => 'limited_item_edition'}) if ($uid); |
375 |
# In case user is a superlibrarian, edition is not limited |
376 |
$limitededition = 0 if ($limitededition != 0 && $limitededition->{'superlibrarian'} eq 1); |
377 |
|
349 |
my $today_iso = C4::Dates->today('iso'); |
378 |
my $today_iso = C4::Dates->today('iso'); |
350 |
my $tagslib = &GetMarcStructure(1,$frameworkcode); |
379 |
my $tagslib = &GetMarcStructure(1,$frameworkcode); |
351 |
my $record = GetMarcBiblio($biblionumber); |
380 |
my $record = GetMarcBiblio($biblionumber); |
Lines 778-785
if($itemrecord){
Link Here
|
778 |
next if subfield_is_koha_internal_p($subfieldtag); |
807 |
next if subfield_is_koha_internal_p($subfieldtag); |
779 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
808 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
780 |
|
809 |
|
781 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i); |
810 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $limitededition); |
782 |
|
|
|
783 |
push @fields, "$tag$subfieldtag"; |
811 |
push @fields, "$tag$subfieldtag"; |
784 |
push (@loop_data, $subfield_data); |
812 |
push (@loop_data, $subfield_data); |
785 |
$i++; |
813 |
$i++; |
Lines 803-809
foreach my $tag ( keys %{$tagslib}){
Link Here
|
803 |
my @values = (undef); |
831 |
my @values = (undef); |
804 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag))); |
832 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag))); |
805 |
for my $value (@values){ |
833 |
for my $value (@values){ |
806 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i); |
834 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $limitededition); |
807 |
push (@loop_data, $subfield_data); |
835 |
push (@loop_data, $subfield_data); |
808 |
$i++; |
836 |
$i++; |
809 |
} |
837 |
} |