X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FItems.pm;h=04cb4174f1fbf07ccd4169b226f086f135eaee7c;hb=70237c49ef1aced89dfaf56ad5c9a847c0dc9d83;hp=0756832232702be5d7c04aa2c60a465d1e978a5e;hpb=2177562ecf64a76bb069009358a843bb80e78a41;p=koha_gimpoz diff --git a/C4/Items.pm b/C4/Items.pm index 0756832232..04cb4174f1 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -458,8 +458,7 @@ sub ModItemFromMarc { =head2 ModItem - ModItem({ column => $newvalue }, $biblionumber, - $itemnumber[, $original_item_marc]); + ModItem({ column => $newvalue }, $biblionumber, $itemnumber); Change one or more columns in an item record and update the MARC representation of the item. @@ -1229,7 +1228,7 @@ sub GetItemsInfo { $serial = 1; } if ( $datedue eq '' ) { - my ( $restype, $reserves ) = + my ( $restype, $reserves, undef ) = C4::Reserves::CheckReserves( $data->{'itemnumber'} ); # Previous conditional check with if ($restype) is not needed because a true # result for one item will result in subsequent items defaulting to this true @@ -1630,41 +1629,45 @@ sub GetHiddenItemnumbers { my @resultitems; my $yaml = C4::Context->preference('OpacHiddenItems'); + $yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt my $hidingrules; eval { - $hidingrules = YAML::Load($yaml); + $hidingrules = YAML::Load($yaml); }; if ($@) { - warn "Unable to parse OpacHiddenItems syspref : $@"; - return (); - } else { + warn "Unable to parse OpacHiddenItems syspref : $@"; + return (); + } my $dbh = C4::Context->dbh; - # For each item - foreach my $item (@items) { + # For each item + foreach my $item (@items) { - # We check each rule - foreach my $field (keys %$hidingrules) { - my $query = "SELECT $field from items where itemnumber = ?"; - my $sth = $dbh->prepare($query); - $sth->execute($item->{'itemnumber'}); - my ($result) = $sth->fetchrow; + # We check each rule + foreach my $field (keys %$hidingrules) { + my $val; + if (exists $item->{$field}) { + $val = $item->{$field}; + } + else { + my $query = "SELECT $field from items where itemnumber = ?"; + $val = $dbh->selectrow_array($query, undef, $item->{'itemnumber'}); + } + $val = '' unless defined $val; - # If the results matches the values in the yaml file - if (any { $result eq $_ } @{$hidingrules->{$field}}) { + # If the results matches the values in the yaml file + if (any { $val eq $_ } @{$hidingrules->{$field}}) { - # We add the itemnumber to the list - push @resultitems, $item->{'itemnumber'}; + # We add the itemnumber to the list + push @resultitems, $item->{'itemnumber'}; - # If at least one rule matched for an item, no need to test the others - last; - } - } - } - return @resultitems; + # If at least one rule matched for an item, no need to test the others + last; + } + } } - - } + return @resultitems; +} =head3 get_item_authorised_values @@ -2211,7 +2214,7 @@ sub DelItemCheck { if ($onloan){ $error = "book_on_loan" } - elsif ( C4::Context->userenv->{flags} & 1 and + elsif ( !(C4::Context->userenv->{flags} & 1) and C4::Context->preference("IndependantBranches") and (C4::Context->userenv->{branch} ne $item->{C4::Context->preference("HomeOrHoldingBranch")||'homebranch'}) )