Bug 24279: Disable editing lost status in items editor if item is a return claim
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
6fa926be88
commit
330c51c272
2 changed files with 18 additions and 13 deletions
|
@ -107,7 +107,7 @@ sub _increment_barcode {
|
||||||
|
|
||||||
|
|
||||||
sub generate_subfield_form {
|
sub generate_subfield_form {
|
||||||
my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $biblionumber, $temp, $loop_data, $i, $restrictededition) = @_;
|
my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $biblionumber, $temp, $loop_data, $i, $restrictededition, $item) = @_;
|
||||||
|
|
||||||
my $frameworkcode = &GetFrameworkCode($biblionumber);
|
my $frameworkcode = &GetFrameworkCode($biblionumber);
|
||||||
|
|
||||||
|
@ -171,13 +171,18 @@ sub generate_subfield_form {
|
||||||
my %authorised_lib;
|
my %authorised_lib;
|
||||||
# builds list, depending on authorised value...
|
# builds list, depending on authorised value...
|
||||||
if ( $subfieldlib->{authorised_value} eq "LOST" ) {
|
if ( $subfieldlib->{authorised_value} eq "LOST" ) {
|
||||||
$subfield_data{IS_LOST_AV} = 1;
|
my $ClaimReturnedLostValue = C4::Context->preference('ClaimReturnedLostValue');
|
||||||
push @authorised_values, qq{};
|
my $item_is_return_claim = $ClaimReturnedLostValue && $item && $item->itemlost && $ClaimReturnedLostValue eq $item->itemlost;
|
||||||
my $av = GetAuthorisedValues( $subfieldlib->{authorised_value} );
|
$subfield_data{IS_RETURN_CLAIM} = $item_is_return_claim;
|
||||||
for my $r ( @$av ) {
|
|
||||||
push @authorised_values, $r->{authorised_value};
|
$subfield_data{IS_LOST_AV} = 1;
|
||||||
$authorised_lib{$r->{authorised_value}} = $r->{lib};
|
|
||||||
}
|
push @authorised_values, qq{};
|
||||||
|
my $av = GetAuthorisedValues( $subfieldlib->{authorised_value} );
|
||||||
|
for my $r ( @$av ) {
|
||||||
|
push @authorised_values, $r->{authorised_value};
|
||||||
|
$authorised_lib{$r->{authorised_value}} = $r->{lib};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elsif ( $subfieldlib->{authorised_value} eq "branches" ) {
|
elsif ( $subfieldlib->{authorised_value} eq "branches" ) {
|
||||||
foreach my $thisbranch (@$branches) {
|
foreach my $thisbranch (@$branches) {
|
||||||
|
@ -918,6 +923,8 @@ for my $library ( @$libraries ) {
|
||||||
$library->{selected} = 1 if $library->{branchcode} eq $branch
|
$library->{selected} = 1 if $library->{branchcode} eq $branch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $item = Koha::Items->find($itemnumber);
|
||||||
|
|
||||||
# We generate form, from actuel record
|
# We generate form, from actuel record
|
||||||
@fields = ();
|
@fields = ();
|
||||||
if($itemrecord){
|
if($itemrecord){
|
||||||
|
@ -931,7 +938,7 @@ if($itemrecord){
|
||||||
|
|
||||||
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
|
next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
|
||||||
|
|
||||||
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
|
my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition, $item);
|
||||||
push @fields, "$tag$subfieldtag";
|
push @fields, "$tag$subfieldtag";
|
||||||
push (@loop_data, $subfield_data);
|
push (@loop_data, $subfield_data);
|
||||||
$i++;
|
$i++;
|
||||||
|
@ -955,7 +962,7 @@ foreach my $tag ( keys %{$tagslib}){
|
||||||
my @values = (undef);
|
my @values = (undef);
|
||||||
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
|
@values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag)));
|
||||||
for my $value (@values){
|
for my $value (@values){
|
||||||
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
|
my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $libraries, $biblionumber, $temp, \@loop_data, $i, $restrictededition, $item);
|
||||||
push (@loop_data, $subfield_data);
|
push (@loop_data, $subfield_data);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
@ -963,8 +970,6 @@ foreach my $tag ( keys %{$tagslib}){
|
||||||
}
|
}
|
||||||
@loop_data = sort {$a->{subfield} cmp $b->{subfield} } @loop_data;
|
@loop_data = sort {$a->{subfield} cmp $b->{subfield} } @loop_data;
|
||||||
|
|
||||||
my $item = Koha::Items->find($itemnumber); # We certainly want to fetch it earlier
|
|
||||||
|
|
||||||
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit.
|
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit.
|
||||||
$template->param(
|
$template->param(
|
||||||
biblionumber => $biblionumber,
|
biblionumber => $biblionumber,
|
||||||
|
|
|
@ -157,7 +157,7 @@
|
||||||
[% IF ( mv.type == 'hidden' ) %]
|
[% IF ( mv.type == 'hidden' ) %]
|
||||||
<input type="hidden" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]">
|
<input type="hidden" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]">
|
||||||
[% ELSIF ( mv.type == 'select' ) %]
|
[% ELSIF ( mv.type == 'select' ) %]
|
||||||
[% IF ( mv.readonly ) %]
|
[% IF ( mv.readonly || ite.IS_RETURN_CLAIM ) %]
|
||||||
<select name="field_value" id="[%- mv.id | html -%]" size="1" class="input_marceditor" readonly="readonly" disabled="disabled">
|
<select name="field_value" id="[%- mv.id | html -%]" size="1" class="input_marceditor" readonly="readonly" disabled="disabled">
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
<select name="field_value" id="[%- mv.id | html -%]" size="1" class="input_marceditor">
|
<select name="field_value" id="[%- mv.id | html -%]" size="1" class="input_marceditor">
|
||||||
|
|
Loading…
Reference in a new issue