| 
      
            Lines 38-44
          use Time::HiRes qw(gettimeofday);
      
      
        Link Here
      
     | 
  
        
          | 38 | 
          use C4::Context;  | 
          38 | 
          use C4::Context;  | 
        
        
          | 39 | 
          use C4::Biblio qw( AddBiblio ); # We shouldn't use it  | 
          39 | 
          use C4::Biblio qw( AddBiblio ); # We shouldn't use it  | 
        
        
          | 40 | 
           | 
          40 | 
           | 
        
          
            
              | 41 | 
              use Test::More tests => 20;  | 
              41 | 
              use Koha::CirculationRules;  | 
            
            
               | 
               | 
              42 | 
               | 
            
            
              | 43 | 
              use Test::More tests => 22;  | 
            
        
          | 42 | 
          use MARC::Record;  | 
          44 | 
          use MARC::Record;  | 
        
        
          | 43 | 
          use MARC::Field;  | 
          45 | 
          use MARC::Field;  | 
        
        
          | 44 | 
           | 
          46 | 
           | 
        
  
    | 
      
            Lines 75-87
          our $sample_data = {
      
      
        Link Here
      
     | 
  
        
          | 75 | 
                  issuelength   => '5',  | 
          77 | 
                  issuelength   => '5',  | 
        
        
          | 76 | 
                  lengthunit    => 'days',  | 
          78 | 
                  lengthunit    => 'days',  | 
        
        
          | 77 | 
                  renewalperiod => '5',  | 
          79 | 
                  renewalperiod => '5',  | 
        
            
               | 
               | 
              80 | 
                      reservesallowed => '5',  | 
            
            
              | 81 | 
                      onshelfholds  => '1',  | 
            
            
              | 82 | 
                      opacitemholds => 'Y',  | 
            
        
          | 78 | 
                },  | 
          83 | 
                },  | 
        
        
          | 79 | 
          };  | 
          84 | 
          };  | 
        
        
          | 80 | 
          our ( $borrowernumber, $start, $prev_time, $cleanup_needed );  | 
          85 | 
          our ( $borrowernumber, $start, $prev_time, $cleanup_needed );  | 
        
        
          | 81 | 
           | 
          86 | 
           | 
        
        
          | 82 | 
          SKIP: { | 
          87 | 
          SKIP: { | 
        
        
          | 83 | 
              eval { require Selenium::Remote::Driver; }; | 
          88 | 
              eval { require Selenium::Remote::Driver; }; | 
        
          
            
              | 84 | 
                  skip "Selenium::Remote::Driver is needed for selenium tests.", 20 if $@;  | 
              89 | 
                  skip "Selenium::Remote::Driver is needed for selenium tests.", 22 if $@;  | 
            
        
          | 85 | 
           | 
          90 | 
           | 
        
        
          | 86 | 
              $cleanup_needed = 1;  | 
          91 | 
              $cleanup_needed = 1;  | 
        
        
          | 87 | 
           | 
          92 | 
           | 
        
  
    | 
      
            Lines 147-153
          SKIP: {
      
      
        Link Here
      
     | 
  
        
          | 147 | 
              $dbh->do(q|INSERT INTO itemtypes (itemtype, description, rentalcharge, notforloan) VALUES (?, ?, ?, ?)|, undef, $itemtype->{itemtype}, $itemtype->{description}, $itemtype->{rentalcharge}, $itemtype->{notforloan}); | 
          152 | 
              $dbh->do(q|INSERT INTO itemtypes (itemtype, description, rentalcharge, notforloan) VALUES (?, ?, ?, ?)|, undef, $itemtype->{itemtype}, $itemtype->{description}, $itemtype->{rentalcharge}, $itemtype->{notforloan}); | 
        
        
          | 148 | 
           | 
          153 | 
           | 
        
        
          | 149 | 
              my $issuing_rules = $sample_data->{issuingrule}; | 
          154 | 
              my $issuing_rules = $sample_data->{issuingrule}; | 
        
          
            
              | 150 | 
                  $dbh->do(q|INSERT INTO issuingrules (categorycode, itemtype, branchcode, maxissueqty, issuelength, lengthunit, renewalperiod) VALUES (?, ?, ?, ?, ?, ?, ?)|, undef, $issuing_rules->{categorycode}, $issuing_rules->{itemtype}, $issuing_rules->{branchcode}, $issuing_rules->{maxissueqty}, $issuing_rules->{issuelength}, $issuing_rules->{lengthunit}, $issuing_rules->{renewalperiod}); | 
              155 | 
                  $dbh->do(  | 
            
            
               | 
               | 
              156 | 
                      q|INSERT INTO issuingrules (categorycode, itemtype, branchcode, issuelength, lengthunit, renewalperiod, reservesallowed, onshelfholds, opacitemholds) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)|,  | 
            
            
              | 157 | 
                      undef,  | 
            
            
              | 158 | 
                      $issuing_rules->{categorycode}, | 
            
            
              | 159 | 
                      $issuing_rules->{itemtype}, | 
            
            
              | 160 | 
                      $issuing_rules->{branchcode}, | 
            
            
              | 161 | 
                      $issuing_rules->{issuelength}, | 
            
            
              | 162 | 
                      $issuing_rules->{lengthunit}, | 
            
            
              | 163 | 
                      $issuing_rules->{renewalperiod}, | 
            
            
              | 164 | 
                      $issuing_rules->{reservesallowed}, | 
            
            
              | 165 | 
                      $issuing_rules->{onshelfholds}, | 
            
            
              | 166 | 
                      $issuing_rules->{opacitemholds}, | 
            
            
              | 167 | 
                  );  | 
            
            
              | 168 | 
                  Koha::CirculationRules->set_rules(  | 
            
            
              | 169 | 
                      { | 
            
            
              | 170 | 
                          categorycode => $issuing_rules->{categorycode}, | 
            
            
              | 171 | 
                          itemtype     => $issuing_rules->{itemtype}, | 
            
            
              | 172 | 
                          branchcode   => $issuing_rules->{branchcode}, | 
            
            
              | 173 | 
                          rules        => { | 
            
            
              | 174 | 
                              maxissueqty => $issuing_rules->{maxissueqty} | 
            
            
              | 175 | 
                          }  | 
            
            
              | 176 | 
                      }  | 
            
            
              | 177 | 
                  );  | 
            
        
          | 151 | 
           | 
          178 | 
           | 
        
        
          | 152 | 
              for my $biblionumber ( @biblionumbers ) { | 
          179 | 
              for my $biblionumber ( @biblionumbers ) { | 
        
        
          | 153 | 
                  $driver->get($base_url."/cataloguing/additem.pl?biblionumber=$biblionumber");  | 
          180 | 
                  $driver->get($base_url."/cataloguing/additem.pl?biblionumber=$biblionumber");  | 
        
  
    | 
      
            Lines 211-216
          SKIP: {
      
      
        Link Here
      
     | 
  
        
          | 211 | 
           | 
          238 | 
           | 
        
        
          | 212 | 
              time_diff("checkin"); | 
          239 | 
              time_diff("checkin"); | 
        
        
          | 213 | 
           | 
          240 | 
           | 
        
            
               | 
               | 
              241 | 
                  #Place holds  | 
            
            
              | 242 | 
                  $driver->get($base_url."/reserve/request.pl?borrowernumber=$borrowernumber&biblionumber=".$biblionumbers[0]);  | 
            
            
              | 243 | 
                  $driver->find_element('//form[@id="hold-request-form"]//input[@type="submit"]')->click; # Biblio level | 
            
            
              | 244 | 
                  my $patron = Koha::Patrons->find($borrowernumber);  | 
            
            
              | 245 | 
                  is( $patron->holds->count, 1, );  | 
            
            
              | 246 | 
               | 
            
            
              | 247 | 
                  $driver->get($base_url."/reserve/request.pl?borrowernumber=$borrowernumber&biblionumber=".$biblionumbers[1]);  | 
            
            
              | 248 | 
                  $driver->find_element('//form[@id="hold-request-form"]//input[@type="radio"]')->click; # Item level, there is only 1 item per bib so we are safe | 
            
            
              | 249 | 
                  $driver->find_element('//form[@id="hold-request-form"]//input[@type="submit"]')->click; | 
            
            
              | 250 | 
                  is( $patron->holds->count, 2, );  | 
            
            
              | 251 | 
               | 
            
            
              | 252 | 
                  time_diff("holds"); | 
            
            
              | 253 | 
               | 
            
        
          | 214 | 
              close $fh;  | 
          254 | 
              close $fh;  | 
        
        
          | 215 | 
              $driver->quit();  | 
          255 | 
              $driver->quit();  | 
        
        
          | 216 | 
          };  | 
          256 | 
          };  | 
        
            
              | 217 | 
              -   | 
               | 
               |