Bug 18296: C4::Items - Remove GetItemInfosOf
At this point this subroutine is only used once, from reserve/request.pl. Since we already have the items, it's easy to populate the different hashes as the rest of the code is expecting it. Test plan: You need to create analytical record relationships ( EasyAnalyticalRecords needs to be set). Link an item to a biblio using the 'Edit > Link to host item' menu from the biblio detail page. From the staff interface place a hold on the biblio. You should see the items from the biblio and the one you just linked Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
This commit is contained in:
parent
023b0890a2
commit
88e50b6a68
21
C4/Items.pm
21
C4/Items.pm
|
|
@ -69,7 +69,6 @@ BEGIN {
|
|||
CheckItemPreSave
|
||||
|
||||
GetItemsForInventory
|
||||
GetItemInfosOf
|
||||
GetItemsByBiblioitemnumber
|
||||
GetItemsInfo
|
||||
GetItemsLocationInfo
|
||||
|
|
@ -923,26 +922,6 @@ sub GetItemsForInventory {
|
|||
return (\@results, $iTotalRecords);
|
||||
}
|
||||
|
||||
=head2 GetItemInfosOf
|
||||
|
||||
GetItemInfosOf(@itemnumbers);
|
||||
|
||||
=cut
|
||||
|
||||
sub GetItemInfosOf {
|
||||
my @itemnumbers = @_;
|
||||
|
||||
my $itemnumber_values = @itemnumbers ? join( ',', @itemnumbers ) : "''";
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $query = "
|
||||
SELECT *
|
||||
FROM items
|
||||
WHERE itemnumber IN ($itemnumber_values)
|
||||
";
|
||||
return $dbh->selectall_hashref($query, 'itemnumber');
|
||||
}
|
||||
|
||||
=head2 GetItemsByBiblioitemnumber
|
||||
|
||||
GetItemsByBiblioitemnumber($biblioitemnumber);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ use C4::Output qw(output_html_with_http_headers);
|
|||
use C4::Context;
|
||||
use C4::Search qw(SimpleSearch);
|
||||
use C4::Biblio qw(TransformMarcToKoha);
|
||||
use C4::Items qw(GetItemInfosOf);
|
||||
use C4::Creators::Lib qw(html_table);
|
||||
use C4::Debug;
|
||||
|
||||
|
|
|
|||
|
|
@ -294,28 +294,30 @@ foreach my $biblionumber (@biblionumbers) {
|
|||
|
||||
my %itemnumbers_of_biblioitem;
|
||||
|
||||
## $items is array of 'item' table numbers
|
||||
my $items = Koha::Items->search({ biblionumber => $biblionumber });
|
||||
my @itemnumbers = $items->get_column('itemnumber');
|
||||
my @hostitems = get_hostitemnumbers_of($biblionumber);
|
||||
my @itemnumbers;
|
||||
if (@hostitems){
|
||||
$template->param('hostitemsflag' => 1);
|
||||
push(@itemnumbers, @hostitems);
|
||||
}
|
||||
|
||||
if (!@itemnumbers) {
|
||||
my $items = Koha::Items->search({ -or => { biblionumber => $biblionumber, itemnumber => { in => \@itemnumbers } } });
|
||||
|
||||
unless ( $items->count ) {
|
||||
# FIXME Then why do we continue?
|
||||
$template->param('noitems' => 1);
|
||||
$biblioloopiter{noitems} = 1;
|
||||
}
|
||||
|
||||
## Hash of item number to 'item' table fields
|
||||
my $iteminfos_of = GetItemInfosOf(@itemnumbers);
|
||||
|
||||
## Here we go backwards again to create hash of biblioitemnumber to itemnumbers,
|
||||
## when by definition all of the itemnumber have the same biblioitemnumber
|
||||
foreach my $itemnumber (@itemnumbers) {
|
||||
my $biblioitemnumber = $iteminfos_of->{$itemnumber}->{biblioitemnumber};
|
||||
my ( $itemnumbers_of_biblioitem, $iteminfos_of);
|
||||
while ( my $item = $items->next ) {
|
||||
$item = $item->unblessed;
|
||||
my $biblioitemnumber = $item->{biblioitemnumber};
|
||||
my $itemnumber = $item->{itemnumber};
|
||||
push( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} }, $itemnumber );
|
||||
$iteminfos_of->{$itemnumber} = $item;
|
||||
}
|
||||
|
||||
## Should be same as biblionumber
|
||||
|
|
|
|||
Loading…
Reference in New Issue