| 
      
            Lines 1-6
          
      
      
        Link Here
      
     | 
  
        
          | 1 | 
          #!/usr/bin/perl  | 
          1 | 
          #!/usr/bin/perl  | 
        
        
          | 2 | 
           | 
          2 | 
           | 
        
        
          | 3 | 
          # Copyright 2012 C & P Bibliography Services  | 
          3 | 
          # Copyright 2012 C & P Bibliography Services  | 
        
            
               | 
               | 
              4 | 
              # Copyright 2017 Koha Development Team  | 
            
        
          | 4 | 
          #  | 
          5 | 
          #  | 
        
        
          | 5 | 
          # This is free software; you can redistribute it and/or modify it under the  | 
          6 | 
          # This is free software; you can redistribute it and/or modify it under the  | 
        
        
          | 6 | 
          # terms of the GNU General Public License as published by the Free Software  | 
          7 | 
          # terms of the GNU General Public License as published by the Free Software  | 
        
  
    | 
      
            Lines 19-25
          
      
      
        Link Here
      
     | 
  
        
          | 19 | 
          use Modern::Perl;  | 
          20 | 
          use Modern::Perl;  | 
        
        
          | 20 | 
           | 
          21 | 
           | 
        
        
          | 21 | 
          use utf8;  | 
          22 | 
          use utf8;  | 
        
          
            
              | 22 | 
              use Test::More tests => 24;  | 
              23 | 
              use Test::More tests => 26;  | 
            
        
          | 23 | 
          use Test::WWW::Mechanize;  | 
          24 | 
          use Test::WWW::Mechanize;  | 
        
        
          | 24 | 
          use XML::Simple;  | 
          25 | 
          use XML::Simple;  | 
        
        
          | 25 | 
          use JSON;  | 
          26 | 
          use JSON;  | 
        
  
    | 
      
            Lines 91-97
          $agent->submit_form_ok(
      
      
        Link Here
      
     | 
  
        
          | 91 | 
                      'item_action'     => 'always_add',  | 
          92 | 
                      'item_action'     => 'always_add',  | 
        
        
          | 92 | 
                      'matcher'         => '',  | 
          93 | 
                      'matcher'         => '',  | 
        
        
          | 93 | 
                      'comments'        => '',  | 
          94 | 
                      'comments'        => '',  | 
        
          
            
              | 94 | 
                          'encoding'        => 'utf8',  | 
              95 | 
                          'encoding'        => 'UTF-8',  | 
            
        
          | 95 | 
                      'parse_items'     => '1',  | 
          96 | 
                      'parse_items'     => '1',  | 
        
        
          | 96 | 
                      'runinbackground' => '1',  | 
          97 | 
                      'runinbackground' => '1',  | 
        
        
          | 97 | 
                      'record_type'     => 'biblio'  | 
          98 | 
                      'record_type'     => 'biblio'  | 
        
  
    | 
      
            Lines 145-151
          $agent->submit_form_ok(
      
      
        Link Here
      
     | 
  
        
          | 145 | 
                      'item_action'     => 'always_add',  | 
          146 | 
                      'item_action'     => 'always_add',  | 
        
        
          | 146 | 
                      'matcher'         => '1',  | 
          147 | 
                      'matcher'         => '1',  | 
        
        
          | 147 | 
                      'comments'        => '',  | 
          148 | 
                      'comments'        => '',  | 
        
          
            
              | 148 | 
                          'encoding'        => 'utf8',  | 
              149 | 
                          'encoding'        => 'UTF-8',  | 
            
        
          | 149 | 
                      'parse_items'     => '1',  | 
          150 | 
                      'parse_items'     => '1',  | 
        
        
          | 150 | 
                      'runinbackground' => '1',  | 
          151 | 
                      'runinbackground' => '1',  | 
        
        
          | 151 | 
                      'completedJobID'  => $jobID,  | 
          152 | 
                      'completedJobID'  => $jobID,  | 
        
  
    | 
      
            Lines 179-185
          like( $jsonresponse->{ aaData }[0]->{ citation }, qr/$bookdescription/, 'found b
      
      
        Link Here
      
     | 
  
        
          | 179 | 
          is( $jsonresponse->{ aaData }[0]->{ status }, 'staged', 'record marked as staged' ); | 
          180 | 
          is( $jsonresponse->{ aaData }[0]->{ status }, 'staged', 'record marked as staged' ); | 
        
        
          | 180 | 
          is( $jsonresponse->{ aaData }[0]->{ overlay_status }, 'no_match', 'record has no matches' ); | 
          181 | 
          is( $jsonresponse->{ aaData }[0]->{ overlay_status }, 'no_match', 'record has no matches' ); | 
        
        
          | 181 | 
           | 
          182 | 
           | 
        
            
              | 182 | 
              my $biblionumber = $jsonresponse->{ aaData }[0]->{ import_record_id }; | 
               | 
               | 
            
        
          | 183 | 
          # Back to the manage staged records page  | 
          183 | 
          # Back to the manage staged records page  | 
        
        
          | 184 | 
          $agent->get($staged_records_uri);  | 
          184 | 
          $agent->get($staged_records_uri);  | 
        
        
          | 185 | 
          $agent->form_number(6);  | 
          185 | 
          $agent->form_number(6);  | 
        
  
    | 
      
            Lines 190-195
          $agent->get("$intranet/cgi-bin/koha/tools/batch_records_ajax.pl?import_batch_id=
      
      
        Link Here
      
     | 
  
        
          | 190 | 
          $jsonresponse = decode_json $agent->content;  | 
          190 | 
          $jsonresponse = decode_json $agent->content;  | 
        
        
          | 191 | 
          is( $jsonresponse->{ aaData }[0]->{ status }, 'imported', 'record marked as imported' ); | 
          191 | 
          is( $jsonresponse->{ aaData }[0]->{ status }, 'imported', 'record marked as imported' ); | 
        
        
          | 192 | 
           | 
          192 | 
           | 
        
            
               | 
               | 
              193 | 
              my $biblionumber = $jsonresponse->{aaData}[0]->{matched}; | 
            
            
              | 194 | 
               | 
            
            
              | 195 | 
              $agent->get_ok(  | 
            
            
              | 196 | 
                  "$intranet/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber",  | 
            
            
              | 197 | 
                  'getting imported bib' );  | 
            
            
              | 198 | 
              $agent->content_contains( 'Details for ' . $bookdescription,  | 
            
            
              | 199 | 
                  'bib is imported' );  | 
            
            
              | 200 | 
               | 
            
        
          | 193 | 
          $agent->get($staged_records_uri);  | 
          201 | 
          $agent->get($staged_records_uri);  | 
        
        
          | 194 | 
          $agent->form_number(5);  | 
          202 | 
          $agent->form_number(5);  | 
        
        
          | 195 | 
          $agent->click_ok( 'mainformsubmit', "revert import" );  | 
          203 | 
          $agent->click_ok( 'mainformsubmit', "revert import" );  | 
        
            
              | 196 | 
              -   | 
               | 
               |