[Koha-bugs] [Bug 11213] GetItemsInfo() called twice

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Mar 17 03:32:09 CET 2014


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11213

--- Comment #13 from M. Tompsett <mtompset at hotmail.com> ---
Comment on attachment 22800
  --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=22800
bug_11213: Changed XSLTParse4Display() interface

Review of attachment 22800:
 --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=11213&attachment=22800)
-----------------------------------------------------------------

::: C4/Items.pm
@@ -1400,5 @@
> -	my $sth = $dbh->prepare($query);
> -        $sth->execute($biblionumber);
> -
> -        while ( my $data = $sth->fetchrow_hashref ) {
> -             $data->{location_intranet} = GetKohaAuthorisedValueLib('LOC', $data->{location});

I already mentioned this makes your code change not perfectly identical in
results.

::: C4/Search.pm
@@ +1848,3 @@
>                  # hidden based on OpacHiddenItems syspref
>                  my @hi = C4::Items::GetHiddenItemnumbers($item);
>                  if (scalar @hi) {

There's no need to store the @hiddenitems, because you have next, which causes
the current item field to be skipped from getting added to hashes. Okay.

@@ +1869,5 @@
>              my $userenv = C4::Context->userenv;
>              if ( $item->{onloan} && !(C4::Members::GetHideLostItemsPreference($userenv->{'number'}) && $item->{itemlost}) ) {
>                  $onloan_count++;
> +                my $key = $prefix . $item->{onloan} . $item->{barcode};
> +                $onloan_items->{$key} = { %$item };

Ingenious way to simplify the lines of code which copy keys. Though, wouldn't
this result in a LARGER onloan_items hash reference?

@@ +1998,4 @@
>          warn $marcrecord->as_formatted if $DEBUG;
>  	my $interface = $search_context eq 'opac' ? 'OPAC' : '';
>  	if (!$scan && C4::Context->preference($interface . "XSLTResultsDisplay")) {
> +            $oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $interface."XSLTResultsDisplay", [@available_items_loop, @onloan_items_loop, @other_items_loop], 1);

This is where the magic happens, because all the hidden things, whether lost or
OpacHiddenItem'd won't appear in any of these three arrays. Perhaps a handy
debugging comment in the patch somewhere?

::: C4/VirtualShelves/Page.pm
@@ +261,5 @@
>                  ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield, $direction );
>                  for my $this_item (@$items) {
>                      my $biblionumber = $this_item->{'biblionumber'};
> +                    # Getting items infos for location display
> +                    my @items_infos = &GetItemsInfo( $this_item->{'biblionumber'}, "cn_sort" );

Isn't using $biblionumber faster than $this_item->...?

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list