# get restricted status and description if applicable
if ( my $code = C4::Koha::GetAuthValCode( 'items.restricted', $data->{frameworkcode} ) ) {
- $data->{restricted} = C4::Koha::GetKohaAuthorisedValueLib( $code, $data->{restricted} );
$data->{restrictedopac} = C4::Koha::GetKohaAuthorisedValueLib( $code, $data->{restricted}, 1 );
+ $data->{restricted} = C4::Koha::GetKohaAuthorisedValueLib( $code, $data->{restricted} );
}
# my stack procedures
if ($onloan){
$error = "book_on_loan"
}
- elsif ( !(C4::Context->userenv->{flags} & 1) and
- C4::Context->preference("IndependantBranches") and
- (C4::Context->userenv->{branch} ne
- $item->{C4::Context->preference("HomeOrHoldingBranch")||'homebranch'}) )
+ elsif ( !( C4::Context->userenv->{flags} & 1 )
+ and C4::Context->preference("IndependantBranches")
+ and ( C4::Context->userenv->{branch} ne $item->{'homebranch'} ) )
{
$error = "not_same_branch";
}
my $query = "UPDATE items SET ";
my @bind;
for my $key ( keys %$item ) {
+ next if ( $key eq 'itemnumber' );
$query.="$key=?,";
push @bind, $item->{$key};
}
&& $defaultvalues
&& $defaultvalues->{'callnumber'} ) {
if( $itemrecord and $defaultvalues and not $itemrecord->field($subfield) ){
+ # if the item record exists, only use default value if the item has no callnumber
+ $defaultvalue = $defaultvalues->{callnumber};
+ } elsif ( !$itemrecord and $defaultvalues ) {
+ # if the item record *doesn't* exists, always use the default value
$defaultvalue = $defaultvalues->{callnumber};
}
}
&& $defaultvalues->{'location'} ) {
if ( $itemrecord and $defaultvalues and not $itemrecord->field($subfield) ) {
+ # if the item record exists, only use default value if the item has no locationr
+ $defaultvalue = $defaultvalues->{location};
+ } elsif ( !$itemrecord and $defaultvalues ) {
+ # if the item record *doesn't* exists, always use the default value
$defaultvalue = $defaultvalues->{location};
}
}
$authorised_lib{$branchcode} = $branchname;
}
}
+
$defaultvalue = C4::Context->userenv->{branch};
+ if ( $defaultvalues and $defaultvalues->{branchcode} ) {
+ $defaultvalue = $defaultvalues->{branchcode};
+ }
#----- itemtypes
} elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
$authorised_lib{$class_source} = $class_sources->{$class_source}->{'description'};
}
+ $defaultvalue = $default_source;
+
#---- "true" authorised value
} else {
$authorised_values_sth->execute(