Lines 35-41
use List::MoreUtils qw/any/;
Link Here
|
35 |
use C4::Search; |
35 |
use C4::Search; |
36 |
use Storable qw(thaw freeze); |
36 |
use Storable qw(thaw freeze); |
37 |
use URI::Escape; |
37 |
use URI::Escape; |
38 |
|
38 |
use C4::Members; |
39 |
|
39 |
|
40 |
use MARC::File::XML; |
40 |
use MARC::File::XML; |
41 |
use URI::Escape; |
41 |
use URI::Escape; |
Lines 103-111
sub _increment_barcode {
Link Here
|
103 |
|
103 |
|
104 |
|
104 |
|
105 |
sub generate_subfield_form { |
105 |
sub generate_subfield_form { |
106 |
my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $today_iso, $biblionumber, $temp, $loop_data, $i) = @_; |
106 |
my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $today_iso, $biblionumber, $temp, $loop_data, $i, $limitededition) = @_; |
107 |
|
107 |
|
108 |
my $frameworkcode = &GetFrameworkCode($biblionumber); |
108 |
my $frameworkcode = &GetFrameworkCode($biblionumber); |
|
|
109 |
my ($barcodefield, $barcodesubfield) = GetMarcFromKohaField("items.barcode", $frameworkcode); |
110 |
my ($notesfield, $notessubfield) = GetMarcFromKohaField("items.itemnotes", $frameworkcode); |
111 |
my ($notforloanfield, $notforloansubfield) = GetMarcFromKohaField("items.notforloan", $frameworkcode); |
112 |
|
109 |
my %subfield_data; |
113 |
my %subfield_data; |
110 |
my $dbh = C4::Context->dbh; |
114 |
my $dbh = C4::Context->dbh; |
111 |
my $authorised_values_sth = $dbh->prepare("SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY lib"); |
115 |
my $authorised_values_sth = $dbh->prepare("SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY lib"); |
Lines 155-160
sub generate_subfield_form {
Link Here
|
155 |
$value = $input->param('barcode'); |
159 |
$value = $input->param('barcode'); |
156 |
} |
160 |
} |
157 |
my $attributes_no_value = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="$subfield_data{maxlength}" ); |
161 |
my $attributes_no_value = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="$subfield_data{maxlength}" ); |
|
|
162 |
$attributes_no_value .= 'readonly="readonly" ' |
163 |
if ( |
164 |
$limitededition |
165 |
and $subfieldtag ne $barcodesubfield |
166 |
and $subfieldtag ne $notessubfield |
167 |
and $subfieldtag ne $notforloansubfield |
168 |
); |
169 |
|
158 |
my $attributes = qq($attributes_no_value value="$value" ); |
170 |
my $attributes = qq($attributes_no_value value="$value" ); |
159 |
|
171 |
|
160 |
if ( $subfieldlib->{authorised_value} ) { |
172 |
if ( $subfieldlib->{authorised_value} ) { |
Lines 215-221
sub generate_subfield_form {
Link Here
|
215 |
$subfield_data{marc_value} = qq(<input type="hidden" $attributes /> $authorised_lib{$value}); |
227 |
$subfield_data{marc_value} = qq(<input type="hidden" $attributes /> $authorised_lib{$value}); |
216 |
} |
228 |
} |
217 |
else { |
229 |
else { |
218 |
$subfield_data{marc_value} =CGI::scrolling_list( # FIXME: factor out scrolling_list |
230 |
my @scrparam = ( |
219 |
-name => "field_value", |
231 |
-name => "field_value", |
220 |
-values => \@authorised_values, |
232 |
-values => \@authorised_values, |
221 |
-default => $value, |
233 |
-default => $value, |
Lines 227-232
sub generate_subfield_form {
Link Here
|
227 |
-id => "tag_".$tag."_subfield_".$subfieldtag."_".$index_subfield, |
239 |
-id => "tag_".$tag."_subfield_".$subfieldtag."_".$index_subfield, |
228 |
-class => "input_marceditor", |
240 |
-class => "input_marceditor", |
229 |
); |
241 |
); |
|
|
242 |
|
243 |
push @scrparam, (-readonly => "readonly"), (-disabled => "disabled") |
244 |
if ( |
245 |
$limitededition |
246 |
and $subfieldtag ne $barcodesubfield |
247 |
and $subfieldtag ne $notessubfield |
248 |
and $subfieldtag ne $notforloansubfield |
249 |
); |
250 |
$subfield_data{marc_value} =CGI::scrolling_list(@scrparam); |
230 |
} |
251 |
} |
231 |
|
252 |
|
232 |
} |
253 |
} |
Lines 338-343
my ($template, $loggedinuser, $cookie)
Link Here
|
338 |
}); |
359 |
}); |
339 |
|
360 |
|
340 |
|
361 |
|
|
|
362 |
# Does the user have a limited item edition permission? |
363 |
my $uid = GetMember( borrowernumber => $loggedinuser )->{userid} if ($loggedinuser) ; |
364 |
my $limitededition = haspermission($uid, {'editcatalogue' => 'limited_item_edition'}) if ($uid); |
365 |
# In case user is a superlibrarian, edition is not limited |
366 |
$limitededition = 0 if ($limitededition != 0 && $limitededition->{'superlibrarian'} eq 1); |
367 |
|
341 |
my $today_iso = C4::Dates->today('iso'); |
368 |
my $today_iso = C4::Dates->today('iso'); |
342 |
my $tagslib = &GetMarcStructure(1,$frameworkcode); |
369 |
my $tagslib = &GetMarcStructure(1,$frameworkcode); |
343 |
my $record = GetMarcBiblio($biblionumber); |
370 |
my $record = GetMarcBiblio($biblionumber); |
Lines 762-769
if($itemrecord){
Link Here
|
762 |
next if subfield_is_koha_internal_p($subfieldtag); |
789 |
next if subfield_is_koha_internal_p($subfieldtag); |
763 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
790 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
764 |
|
791 |
|
765 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i); |
792 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $limitededition); |
766 |
|
|
|
767 |
push @fields, "$tag$subfieldtag"; |
793 |
push @fields, "$tag$subfieldtag"; |
768 |
push (@loop_data, $subfield_data); |
794 |
push (@loop_data, $subfield_data); |
769 |
$i++; |
795 |
$i++; |
Lines 787-793
foreach my $tag ( keys %{$tagslib}){
Link Here
|
787 |
my @values = (undef); |
813 |
my @values = (undef); |
788 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)->subfield($subtag))); |
814 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)->subfield($subtag))); |
789 |
for my $value (@values){ |
815 |
for my $value (@values){ |
790 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i); |
816 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $limitededition); |
791 |
push (@loop_data, $subfield_data); |
817 |
push (@loop_data, $subfield_data); |
792 |
$i++; |
818 |
$i++; |
793 |
} |
819 |
} |