View | Details | Raw Unified | Return to bug 13540
Collapse All | Expand All

(-)a/C4/Items.pm (-2 / +25 lines)
Lines 956-961 sub GetItemLocation { Link Here
956
    return \%itemlocation;
956
    return \%itemlocation;
957
}
957
}
958
958
959
=head GetRealItemLocations
960
961
    my $locations = C4::Items::GetRealItemLocations($itemnumber);
962
963
A convenience function of getting just the Item location and permanent_location
964
@PARAM1, Long, the koha-items.itemnumber
965
@RETURNS, Reference to Hash, with koha.items.location and permanent_location as hash keys.
966
967
=cut
968
sub GetRealItemLocations {
969
    my $itemnumber = shift;
970
    my $sth = C4::Context->dbh()->prepare('SELECT location, permanent_location FROM items WHERE itemnumber = ?');
971
    $sth->execute($itemnumber);
972
    return $sth->fetchrow_hashref();
973
}
974
959
=head2 GetLostItems
975
=head2 GetLostItems
960
976
961
  $items = GetLostItems( $where, $orderby );
977
  $items = GetLostItems( $where, $orderby );
Lines 2030-2036 sub _do_column_fixes_for_mod { Link Here
2030
        $item->{'withdrawn'} = 0;
2046
        $item->{'withdrawn'} = 0;
2031
    }
2047
    }
2032
    if (exists $item->{'location'} && !$item->{'permanent_location'}) {
2048
    if (exists $item->{'location'} && !$item->{'permanent_location'}) {
2033
        $item->{'permanent_location'} = $item->{'location'};
2049
        if ($item->{'location'} ne 'CART' && $item->{'location'} ne 'PROC') {
2050
            $item->{'permanent_location'} = $item->{'location'};
2051
        }
2052
        else {
2053
            #Preserve the old permanent_location in face of adversity!
2054
            #Don't let it fall to 'PROC' or 'CART'. Otherwise it will be forever lost!
2055
            my $locations = GetRealItemLocations( $item->{itemnumber} );
2056
            $item->{'permanent_location'} = $locations->{'permanent_location'};
2057
        }
2034
    }
2058
    }
2035
    if (exists $item->{'timestamp'}) {
2059
    if (exists $item->{'timestamp'}) {
2036
        delete $item->{'timestamp'};
2060
        delete $item->{'timestamp'};
2037
- 

Return to bug 13540