Lines 33-38
use C4::ClassSource;
Link Here
|
33 |
use C4::Dates; |
33 |
use C4::Dates; |
34 |
use List::MoreUtils qw/any/; |
34 |
use List::MoreUtils qw/any/; |
35 |
use C4::Search; |
35 |
use C4::Search; |
|
|
36 |
use C4::Members; |
36 |
|
37 |
|
37 |
use MARC::File::XML; |
38 |
use MARC::File::XML; |
38 |
use URI::Escape; |
39 |
use URI::Escape; |
Lines 100-108
sub _increment_barcode {
Link Here
|
100 |
|
101 |
|
101 |
|
102 |
|
102 |
sub generate_subfield_form { |
103 |
sub generate_subfield_form { |
103 |
my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $today_iso, $biblionumber, $temp, $loop_data, $i) = @_; |
104 |
my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $today_iso, $biblionumber, $temp, $loop_data, $i, $limitededition) = @_; |
104 |
|
105 |
|
105 |
my $frameworkcode = &GetFrameworkCode($biblionumber); |
106 |
my $frameworkcode = &GetFrameworkCode($biblionumber); |
|
|
107 |
my ($barcodefield, $barcodesubfield) = GetMarcFromKohaField("items.barcode", $frameworkcode); |
108 |
my ($notesfield, $notessubfield) = GetMarcFromKohaField("items.itemnotes", $frameworkcode); |
109 |
my ($notforloanfield, $notforloansubfield) = GetMarcFromKohaField("items.notforloan", $frameworkcode); |
110 |
|
106 |
my %subfield_data; |
111 |
my %subfield_data; |
107 |
my $dbh = C4::Context->dbh; |
112 |
my $dbh = C4::Context->dbh; |
108 |
my $authorised_values_sth = $dbh->prepare("SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY lib"); |
113 |
my $authorised_values_sth = $dbh->prepare("SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY lib"); |
Lines 152-157
sub generate_subfield_form {
Link Here
|
152 |
$value = $input->param('barcode'); |
157 |
$value = $input->param('barcode'); |
153 |
} |
158 |
} |
154 |
my $attributes_no_value = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="$subfield_data{maxlength}" ); |
159 |
my $attributes_no_value = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="$subfield_data{maxlength}" ); |
|
|
160 |
$attributes_no_value .= 'readonly="readonly" ' |
161 |
if ( |
162 |
$limitededition |
163 |
and $subfieldtag ne $barcodesubfield |
164 |
and $subfieldtag ne $notessubfield |
165 |
and $subfieldtag ne $notforloansubfield |
166 |
); |
167 |
|
155 |
my $attributes = qq($attributes_no_value value="$value" ); |
168 |
my $attributes = qq($attributes_no_value value="$value" ); |
156 |
|
169 |
|
157 |
if ( $subfieldlib->{authorised_value} ) { |
170 |
if ( $subfieldlib->{authorised_value} ) { |
Lines 212-218
sub generate_subfield_form {
Link Here
|
212 |
$subfield_data{marc_value} = qq(<input type="hidden" $attributes /> $authorised_lib{$value}); |
225 |
$subfield_data{marc_value} = qq(<input type="hidden" $attributes /> $authorised_lib{$value}); |
213 |
} |
226 |
} |
214 |
else { |
227 |
else { |
215 |
$subfield_data{marc_value} =CGI::scrolling_list( # FIXME: factor out scrolling_list |
228 |
my @scrparam = ( |
216 |
-name => "field_value", |
229 |
-name => "field_value", |
217 |
-values => \@authorised_values, |
230 |
-values => \@authorised_values, |
218 |
-default => $value, |
231 |
-default => $value, |
Lines 224-229
sub generate_subfield_form {
Link Here
|
224 |
-id => "tag_".$tag."_subfield_".$subfieldtag."_".$index_subfield, |
237 |
-id => "tag_".$tag."_subfield_".$subfieldtag."_".$index_subfield, |
225 |
-class => "input_marceditor", |
238 |
-class => "input_marceditor", |
226 |
); |
239 |
); |
|
|
240 |
|
241 |
push @scrparam, (-readonly => "readonly"), (-disabled => "disabled") |
242 |
if ( |
243 |
$limitededition |
244 |
and $subfieldtag ne $barcodesubfield |
245 |
and $subfieldtag ne $notessubfield |
246 |
and $subfieldtag ne $notforloansubfield |
247 |
); |
248 |
$subfield_data{marc_value} =CGI::scrolling_list(@scrparam); |
227 |
} |
249 |
} |
228 |
|
250 |
|
229 |
} |
251 |
} |
Lines 308-313
my ($template, $loggedinuser, $cookie)
Link Here
|
308 |
}); |
330 |
}); |
309 |
|
331 |
|
310 |
|
332 |
|
|
|
333 |
# Does the user have a limited item edition permission? |
334 |
my $uid = GetMember( borrowernumber => $loggedinuser )->{userid} if ($loggedinuser) ; |
335 |
my $limitededition = haspermission($uid, {'editcatalogue' => 'limited_item_edition'}) if ($uid); |
336 |
# In case user is a superlibrarian, edition is not limited |
337 |
$limitededition = 0 if ($limitededition != 0 && $limitededition->{'superlibrarian'} eq 1); |
338 |
|
311 |
my $today_iso = C4::Dates->today('iso'); |
339 |
my $today_iso = C4::Dates->today('iso'); |
312 |
my $tagslib = &GetMarcStructure(1,$frameworkcode); |
340 |
my $tagslib = &GetMarcStructure(1,$frameworkcode); |
313 |
my $record = GetMarcBiblio($biblionumber); |
341 |
my $record = GetMarcBiblio($biblionumber); |
Lines 682-689
if($itemrecord){
Link Here
|
682 |
next if subfield_is_koha_internal_p($subfieldtag); |
710 |
next if subfield_is_koha_internal_p($subfieldtag); |
683 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
711 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
684 |
|
712 |
|
685 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i); |
713 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $limitededition); |
686 |
|
|
|
687 |
push @fields, "$tag$subfieldtag"; |
714 |
push @fields, "$tag$subfieldtag"; |
688 |
push (@loop_data, $subfield_data); |
715 |
push (@loop_data, $subfield_data); |
689 |
$i++; |
716 |
$i++; |
Lines 702-708
foreach my $tag ( keys %{$tagslib}){
Link Here
|
702 |
my @values = (undef); |
729 |
my @values = (undef); |
703 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)->subfield($subtag))); |
730 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)->subfield($subtag))); |
704 |
for my $value (@values){ |
731 |
for my $value (@values){ |
705 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i); |
732 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $limitededition); |
706 |
push (@loop_data, $subfield_data); |
733 |
push (@loop_data, $subfield_data); |
707 |
$i++; |
734 |
$i++; |
708 |
} |
735 |
} |