| 
      
            Lines 1246-1318
          sub GetItemsInfo {
      
      
        Link Here
      
     | 
  
        
          | 1246 | 
                  $data->{'datedue'}        = $datedue; | 
          1246 | 
                  $data->{'datedue'}        = $datedue; | 
        
        
          | 1247 | 
           | 
          1247 | 
           | 
        
        
          | 1248 | 
                  # get notforloan complete status if applicable  | 
          1248 | 
                  # get notforloan complete status if applicable  | 
        
          
            
              | 1249 | 
                      my $sthnflstatus = $dbh->prepare(  | 
              1249 | 
                      if ( my $code = C4::Koha::GetAuthValCode( 'items.notforloan', $data->{frameworkcode} ) ) { | 
            
            
              | 1250 | 
                          'SELECT authorised_value  | 
              1250 | 
                          $data->{notforloanvalue} = C4::Koha::GetAuthorisedValueByCode( $code, $data->{itemnotforloan} ); | 
            
            
              | 1251 | 
                          FROM   marc_subfield_structure  | 
               | 
               | 
            
            
              | 1252 | 
                          WHERE  kohafield="items.notforloan"  | 
            
            
              | 1253 | 
                      '  | 
            
            
              | 1254 | 
                      );  | 
            
            
              | 1255 | 
               | 
            
            
              | 1256 | 
                      $sthnflstatus->execute;  | 
            
            
              | 1257 | 
                      my ($authorised_valuecode) = $sthnflstatus->fetchrow;  | 
            
            
              | 1258 | 
                      if ($authorised_valuecode) { | 
            
            
              | 1259 | 
                          $sthnflstatus = $dbh->prepare(  | 
            
            
              | 1260 | 
                              "SELECT lib FROM authorised_values  | 
            
            
              | 1261 | 
                               WHERE  category=?  | 
            
            
              | 1262 | 
                               AND authorised_value=?"  | 
            
            
              | 1263 | 
                          );  | 
            
            
              | 1264 | 
                          $sthnflstatus->execute( $authorised_valuecode,  | 
            
            
              | 1265 | 
                              $data->{itemnotforloan} ); | 
            
            
              | 1266 | 
                          my ($lib) = $sthnflstatus->fetchrow;  | 
            
            
              | 1267 | 
                          $data->{notforloanvalue} = $lib; | 
            
        
          | 1268 | 
                  }  | 
          1251 | 
                  }  | 
        
        
          | 1269 | 
           | 
          1252 | 
           | 
        
        
          | 1270 | 
                  # get restricted status and description if applicable  | 
          1253 | 
                  # get restricted status and description if applicable  | 
        
          
            
              | 1271 | 
                      my $restrictedstatus = $dbh->prepare(  | 
              1254 | 
                      if ( my $code = C4::Koha::GetAuthValCode( 'items.restricted', $data->{frameworkcode} ) ) { | 
            
            
              | 1272 | 
                          'SELECT authorised_value  | 
              1255 | 
                          $data->{restricted}     = C4::Koha::GetKohaAuthorisedValueLib( $code, $data->{restricted} ); | 
            
            
              | 1273 | 
                          FROM   marc_subfield_structure  | 
              1256 | 
                          $data->{restrictedopac} = C4::Koha::GetKohaAuthorisedValueLib( $code, $data->{restricted}, 'opac' ); | 
            
            
              | 1274 | 
                          WHERE  kohafield="items.restricted"  | 
               | 
               | 
            
            
              | 1275 | 
                      '  | 
            
            
              | 1276 | 
                      );  | 
            
            
              | 1277 | 
               | 
            
            
              | 1278 | 
                      $restrictedstatus->execute;  | 
            
            
              | 1279 | 
                      ($authorised_valuecode) = $restrictedstatus->fetchrow;  | 
            
            
              | 1280 | 
                      if ($authorised_valuecode) { | 
            
            
              | 1281 | 
                          $restrictedstatus = $dbh->prepare(  | 
            
            
              | 1282 | 
                              "SELECT lib,lib_opac FROM authorised_values  | 
            
            
              | 1283 | 
                               WHERE  category=?  | 
            
            
              | 1284 | 
                               AND authorised_value=?"  | 
            
            
              | 1285 | 
                          );  | 
            
            
              | 1286 | 
                          $restrictedstatus->execute( $authorised_valuecode,  | 
            
            
              | 1287 | 
                              $data->{restricted} ); | 
            
            
              | 1288 | 
               | 
            
            
              | 1289 | 
                          if ( my $rstdata = $restrictedstatus->fetchrow_hashref ) { | 
            
            
              | 1290 | 
                              $data->{restricted} = $rstdata->{'lib'}; | 
            
            
              | 1291 | 
                              $data->{restrictedopac} = $rstdata->{'lib_opac'}; | 
            
            
              | 1292 | 
                          }  | 
            
        
          | 1293 | 
                  }  | 
          1257 | 
                  }  | 
        
        
          | 1294 | 
           | 
          1258 | 
           | 
        
        
          | 1295 | 
                  # my stack procedures  | 
          1259 | 
                  # my stack procedures  | 
        
          
            
              | 1296 | 
                      my $stackstatus = $dbh->prepare(  | 
              1260 | 
                      if ( my $code = C4::Koha::GetAuthValCode( 'items.stack', $data->{frameworkcode} ) ) { | 
            
            
              | 1297 | 
                          'SELECT authorised_value  | 
              1261 | 
                          $data->{stack}          = C4::Koha::GetKohaAuthorisedValueLib( $code, $data->{stack} ); | 
            
            
              | 1298 | 
                           FROM   marc_subfield_structure  | 
               | 
               | 
            
            
              | 1299 | 
                           WHERE  kohafield="items.stack"  | 
            
            
              | 1300 | 
                      '  | 
            
            
              | 1301 | 
                      );  | 
            
            
              | 1302 | 
                      $stackstatus->execute;  | 
            
            
              | 1303 | 
               | 
            
            
              | 1304 | 
                      ($authorised_valuecode) = $stackstatus->fetchrow;  | 
            
            
              | 1305 | 
                      if ($authorised_valuecode) { | 
            
            
              | 1306 | 
                          $stackstatus = $dbh->prepare(  | 
            
            
              | 1307 | 
                              "SELECT lib  | 
            
            
              | 1308 | 
                               FROM   authorised_values  | 
            
            
              | 1309 | 
                               WHERE  category=?  | 
            
            
              | 1310 | 
                               AND    authorised_value=?  | 
            
            
              | 1311 | 
                          "  | 
            
            
              | 1312 | 
                          );  | 
            
            
              | 1313 | 
                          $stackstatus->execute( $authorised_valuecode, $data->{stack} ); | 
            
            
              | 1314 | 
                          my ($lib) = $stackstatus->fetchrow;  | 
            
            
              | 1315 | 
                          $data->{stack} = $lib; | 
            
        
          | 1316 | 
                  }  | 
          1262 | 
                  }  | 
        
        
          | 1317 | 
                  # Find the last 3 people who borrowed this item.  | 
          1263 | 
                  # Find the last 3 people who borrowed this item.  | 
        
        
          | 1318 | 
                  my $sth2 = $dbh->prepare("SELECT * FROM old_issues,borrowers | 
          1264 | 
                  my $sth2 = $dbh->prepare("SELECT * FROM old_issues,borrowers | 
        
            
              | 1319 | 
              -   | 
               | 
               |