| Lines 959-964
          sub GetItemLocation {
      
      
        Link Here | 
        
          | 959 |     return \%itemlocation; | 959 |     return \%itemlocation; | 
        
          | 960 | } | 960 | } | 
        
          | 961 |  | 961 |  | 
            
              |  |  | 962 | =head GetRealItemLocations | 
            
              | 963 |  | 
            
              | 964 |     my $locations = C4::Items::GetRealItemLocations($itemnumber); | 
            
              | 965 |  | 
            
              | 966 | A convenience function of getting just the Item location and permanent_location | 
            
              | 967 | @PARAM1, Long, the koha-items.itemnumber | 
            
              | 968 | @RETURNS, Reference to Hash, with koha.items.location and permanent_location as hash keys. | 
            
              | 969 |  | 
            
              | 970 | =cut | 
            
              | 971 | sub GetRealItemLocations { | 
            
              | 972 |     my $itemnumber = shift; | 
            
              | 973 |     my $sth = C4::Context->dbh()->prepare('SELECT location, permanent_location FROM items WHERE itemnumber = ?'); | 
            
              | 974 |     $sth->execute($itemnumber); | 
            
              | 975 |     return $sth->fetchrow_hashref(); | 
            
              | 976 | } | 
            
              | 977 |  | 
        
          | 962 | =head2 GetLostItems | 978 | =head2 GetLostItems | 
        
          | 963 |  | 979 |  | 
        
          | 964 |   $items = GetLostItems( $where ); | 980 |   $items = GetLostItems( $where ); | 
  
    | Lines 2049-2055
          sub _do_column_fixes_for_mod {
      
      
        Link Here | 
        
          | 2049 |         $item->{'withdrawn'} = 0; | 2065 |         $item->{'withdrawn'} = 0; | 
        
          | 2050 |     } | 2066 |     } | 
        
          | 2051 |     if (exists $item->{'location'} && !$item->{'permanent_location'}) { | 2067 |     if (exists $item->{'location'} && !$item->{'permanent_location'}) { | 
          
            
              | 2052 |         $item->{'permanent_location'} = $item->{'location'}; | 2068 |         if ($item->{'location'} ne 'CART' && $item->{'location'} ne 'PROC') { | 
            
              |  |  | 2069 |             $item->{'permanent_location'} = $item->{'location'}; | 
            
              | 2070 |         } | 
            
              | 2071 |         else { | 
            
              | 2072 |             #Preserve the old permanent_location in face of adversity! | 
            
              | 2073 |             #Don't let it fall to 'PROC' or 'CART'. Otherwise it will be forever lost! | 
            
              | 2074 |             my $locations = GetRealItemLocations( $item->{itemnumber} ); | 
            
              | 2075 |             $item->{'permanent_location'} = $locations->{'permanent_location'}; | 
            
              | 2076 |         } | 
        
          | 2053 |     } | 2077 |     } | 
        
          | 2054 |     if (exists $item->{'timestamp'}) { | 2078 |     if (exists $item->{'timestamp'}) { | 
        
          | 2055 |         delete $item->{'timestamp'}; | 2079 |         delete $item->{'timestamp'}; | 
            
              | 2056 | -  |  |  |