|
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 |
|
115 |
|
|
Lines 154-159
sub generate_subfield_form {
Link Here
|
| 154 |
$value = $input->param('barcode'); |
158 |
$value = $input->param('barcode'); |
| 155 |
} |
159 |
} |
| 156 |
my $attributes_no_value = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="$subfield_data{maxlength}" ); |
160 |
my $attributes_no_value = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="$subfield_data{maxlength}" ); |
|
|
161 |
$attributes_no_value .= 'readonly="readonly" ' |
| 162 |
if ( |
| 163 |
$limitededition |
| 164 |
and $subfieldtag ne $barcodesubfield |
| 165 |
and $subfieldtag ne $notessubfield |
| 166 |
and $subfieldtag ne $notforloansubfield |
| 167 |
); |
| 168 |
|
| 157 |
my $attributes = qq($attributes_no_value value="$value" ); |
169 |
my $attributes = qq($attributes_no_value value="$value" ); |
| 158 |
|
170 |
|
| 159 |
if ( $subfieldlib->{authorised_value} ) { |
171 |
if ( $subfieldlib->{authorised_value} ) { |
|
Lines 214-220
sub generate_subfield_form {
Link Here
|
| 214 |
$subfield_data{marc_value} = qq(<input type="hidden" $attributes /> $authorised_lib{$value}); |
226 |
$subfield_data{marc_value} = qq(<input type="hidden" $attributes /> $authorised_lib{$value}); |
| 215 |
} |
227 |
} |
| 216 |
else { |
228 |
else { |
| 217 |
$subfield_data{marc_value} =CGI::scrolling_list( # FIXME: factor out scrolling_list |
229 |
my @scrparam = ( |
| 218 |
-name => "field_value", |
230 |
-name => "field_value", |
| 219 |
-values => \@authorised_values, |
231 |
-values => \@authorised_values, |
| 220 |
-default => $value, |
232 |
-default => $value, |
|
Lines 226-231
sub generate_subfield_form {
Link Here
|
| 226 |
-id => "tag_".$tag."_subfield_".$subfieldtag."_".$index_subfield, |
238 |
-id => "tag_".$tag."_subfield_".$subfieldtag."_".$index_subfield, |
| 227 |
-class => "input_marceditor", |
239 |
-class => "input_marceditor", |
| 228 |
); |
240 |
); |
|
|
241 |
|
| 242 |
push @scrparam, (-readonly => "readonly"), (-disabled => "disabled") |
| 243 |
if ( |
| 244 |
$limitededition |
| 245 |
and $subfieldtag ne $barcodesubfield |
| 246 |
and $subfieldtag ne $notessubfield |
| 247 |
and $subfieldtag ne $notforloansubfield |
| 248 |
); |
| 249 |
$subfield_data{marc_value} =CGI::scrolling_list(@scrparam); |
| 229 |
} |
250 |
} |
| 230 |
|
251 |
|
| 231 |
} |
252 |
} |
|
Lines 343-348
my ($template, $loggedinuser, $cookie)
Link Here
|
| 343 |
}); |
364 |
}); |
| 344 |
|
365 |
|
| 345 |
|
366 |
|
|
|
367 |
# Does the user have a limited item edition permission? |
| 368 |
my $uid = GetMember( borrowernumber => $loggedinuser )->{userid} if ($loggedinuser) ; |
| 369 |
my $limitededition = haspermission($uid, {'editcatalogue' => 'limited_item_edition'}) if ($uid); |
| 370 |
# In case user is a superlibrarian, edition is not limited |
| 371 |
$limitededition = 0 if ($limitededition != 0 && $limitededition->{'superlibrarian'} eq 1); |
| 372 |
|
| 346 |
my $today_iso = C4::Dates->today('iso'); |
373 |
my $today_iso = C4::Dates->today('iso'); |
| 347 |
my $tagslib = &GetMarcStructure(1,$frameworkcode); |
374 |
my $tagslib = &GetMarcStructure(1,$frameworkcode); |
| 348 |
my $record = GetMarcBiblio($biblionumber); |
375 |
my $record = GetMarcBiblio($biblionumber); |
|
Lines 770-777
if($itemrecord){
Link Here
|
| 770 |
next if subfield_is_koha_internal_p($subfieldtag); |
797 |
next if subfield_is_koha_internal_p($subfieldtag); |
| 771 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
798 |
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); |
| 772 |
|
799 |
|
| 773 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i); |
800 |
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $limitededition); |
| 774 |
|
|
|
| 775 |
push @fields, "$tag$subfieldtag"; |
801 |
push @fields, "$tag$subfieldtag"; |
| 776 |
push (@loop_data, $subfield_data); |
802 |
push (@loop_data, $subfield_data); |
| 777 |
$i++; |
803 |
$i++; |
|
Lines 795-801
foreach my $tag ( keys %{$tagslib}){
Link Here
|
| 795 |
my @values = (undef); |
821 |
my @values = (undef); |
| 796 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)->subfield($subtag))); |
822 |
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)->subfield($subtag))); |
| 797 |
for my $value (@values){ |
823 |
for my $value (@values){ |
| 798 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i); |
824 |
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $limitededition); |
| 799 |
push (@loop_data, $subfield_data); |
825 |
push (@loop_data, $subfield_data); |
| 800 |
$i++; |
826 |
$i++; |
| 801 |
} |
827 |
} |