| 
      
            Lines 67-74
          my $sample_supplier1 = {
      
      
        Link Here
      
     | 
  
        
          | 67 | 
              gstreg        => 1,  | 
          67 | 
              gstreg        => 1,  | 
        
        
          | 68 | 
              listincgst    => 1,  | 
          68 | 
              listincgst    => 1,  | 
        
        
          | 69 | 
              invoiceincgst => 1,  | 
          69 | 
              invoiceincgst => 1,  | 
        
          
            
              | 70 | 
                  tax_rate       => '1.0000',  | 
              70 | 
                  tax_rate      => '1.0000',  | 
            
            
              | 71 | 
                  discount      => '1.0000',  | 
              71 | 
                  discount      => 1.0000,  | 
            
        
          | 72 | 
              notes         => 'notes1',  | 
          72 | 
              notes         => 'notes1',  | 
        
        
          | 73 | 
              deliverytime  => undef  | 
          73 | 
              deliverytime  => undef  | 
        
        
          | 74 | 
          };  | 
          74 | 
          };  | 
        
  
    | 
      
            Lines 87-94
          my $sample_supplier2 = {
      
      
        Link Here
      
     | 
  
        
          | 87 | 
              gstreg        => 1,  | 
          87 | 
              gstreg        => 1,  | 
        
        
          | 88 | 
              listincgst    => 1,  | 
          88 | 
              listincgst    => 1,  | 
        
        
          | 89 | 
              invoiceincgst => 1,  | 
          89 | 
              invoiceincgst => 1,  | 
        
          
            
              | 90 | 
                  tax_rate       => '2.0000',  | 
              90 | 
                  tax_rate      => '2.0000',  | 
            
            
              | 91 | 
                  discount      => '2.0000',  | 
              91 | 
                  discount      => 2.0000,  | 
            
        
          | 92 | 
              notes         => 'notes2',  | 
          92 | 
              notes         => 'notes2',  | 
        
        
          | 93 | 
              deliverytime  => 2  | 
          93 | 
              deliverytime  => 2  | 
        
        
          | 94 | 
          };  | 
          94 | 
          };  | 
        
  
    | 
      
            Lines 118-124
          for my $bookseller ( @bookseller2 ) {
      
      
        Link Here
      
     | 
  
        
          | 118 | 
          }  | 
          118 | 
          }  | 
        
        
          | 119 | 
           | 
          119 | 
           | 
        
        
          | 120 | 
          $sample_supplier2->{id} = $id_supplier2; | 
          120 | 
          $sample_supplier2->{id} = $id_supplier2; | 
        
          
            
              | 121 | 
              is_deeply( $bookseller2[0], $sample_supplier2,  | 
              121 | 
              is_deeply( cast_precision($bookseller2[0]), $sample_supplier2,  | 
            
        
          | 122 | 
              "Koha::Acquisition::Booksellers->search returns the right informations about supplier $sample_supplier2->{name}" ); | 
          122 | 
              "Koha::Acquisition::Booksellers->search returns the right informations about supplier $sample_supplier2->{name}" ); | 
        
        
          | 123 | 
           | 
          123 | 
           | 
        
        
          | 124 | 
          $supplier1 = Koha::Acquisition::Bookseller->new($sample_supplier1)->store;  | 
          124 | 
          $supplier1 = Koha::Acquisition::Bookseller->new($sample_supplier1)->store;  | 
        
  
    | 
      
            Lines 126-131
          $id_supplier1 = $supplier1->id;
      
      
        Link Here
      
     | 
  
        
          | 126 | 
          my @booksellers = Koha::Acquisition::Booksellers->search();  | 
          126 | 
          my @booksellers = Koha::Acquisition::Booksellers->search();  | 
        
        
          | 127 | 
          for my $bookseller ( @booksellers ) { | 
          127 | 
          for my $bookseller ( @booksellers ) { | 
        
        
          | 128 | 
              $bookseller = field_filter( $bookseller->unblessed );  | 
          128 | 
              $bookseller = field_filter( $bookseller->unblessed );  | 
        
            
               | 
               | 
              129 | 
                  $bookseller = cast_precision($bookseller);  | 
            
        
          | 129 | 
          }  | 
          130 | 
          }  | 
        
        
          | 130 | 
           | 
          131 | 
           | 
        
        
          | 131 | 
          $sample_supplier1->{id} = $id_supplier1; | 
          132 | 
          $sample_supplier1->{id} = $id_supplier1; | 
        
  
    | 
      
            Lines 150-156
          is( $bookseller1fromid, undef,
      
      
        Link Here
      
     | 
  
        
          | 150 | 
              "find returns undef if no id given" );  | 
          151 | 
              "find returns undef if no id given" );  | 
        
        
          | 151 | 
          $bookseller1fromid = Koha::Acquisition::Booksellers->find( $id_supplier1 );  | 
          152 | 
          $bookseller1fromid = Koha::Acquisition::Booksellers->find( $id_supplier1 );  | 
        
        
          | 152 | 
          $bookseller1fromid = field_filter($bookseller1fromid->unblessed);  | 
          153 | 
          $bookseller1fromid = field_filter($bookseller1fromid->unblessed);  | 
        
          
            
              | 153 | 
              is_deeply( $bookseller1fromid, $sample_supplier1,  | 
              154 | 
              is_deeply( cast_precision($bookseller1fromid), $sample_supplier1,  | 
            
        
          | 154 | 
              "Get Supplier1 (find a bookseller by id)" );  | 
          155 | 
              "Get Supplier1 (find a bookseller by id)" );  | 
        
        
          | 155 | 
           | 
          156 | 
           | 
        
        
          | 156 | 
          $bookseller1fromid = Koha::Acquisition::Booksellers->find( $id_supplier1 );  | 
          157 | 
          $bookseller1fromid = Koha::Acquisition::Booksellers->find( $id_supplier1 );  | 
        
  
    | 
      
            Lines 229-236
          $sample_supplier2 = {
      
      
        Link Here
      
     | 
  
        
          | 229 | 
              gstreg        => 1,  | 
          230 | 
              gstreg        => 1,  | 
        
        
          | 230 | 
              listincgst    => 1,  | 
          231 | 
              listincgst    => 1,  | 
        
        
          | 231 | 
              invoiceincgst => 1,  | 
          232 | 
              invoiceincgst => 1,  | 
        
          
            
              | 232 | 
                  tax_rate       => '2.0000 ',  | 
              233 | 
                  tax_rate      => '2.0000',  | 
            
            
              | 233 | 
                  discount      => '2.0000',  | 
              234 | 
                  discount      => 2.0000,  | 
            
        
          | 234 | 
              notes         => 'notes2 modified',  | 
          235 | 
              notes         => 'notes2 modified',  | 
        
        
          | 235 | 
              deliverytime  => 2,  | 
          236 | 
              deliverytime  => 2,  | 
        
        
          | 236 | 
          };  | 
          237 | 
          };  | 
        
  
    | 
      
            Lines 259-266
          my $sample_supplier3 = {
      
      
        Link Here
      
     | 
  
        
          | 259 | 
              gstreg        => 1,  | 
          260 | 
              gstreg        => 1,  | 
        
        
          | 260 | 
              listincgst    => 1,  | 
          261 | 
              listincgst    => 1,  | 
        
        
          | 261 | 
              invoiceincgst => 1,  | 
          262 | 
              invoiceincgst => 1,  | 
        
          
            
              | 262 | 
                  tax_rate       => '3.0000',  | 
              263 | 
                  tax_rate      => '3.0000',  | 
            
            
              | 263 | 
                  discount      => '3.0000',  | 
              264 | 
                  discount      => 3.0000,  | 
            
        
          | 264 | 
              notes         => 'notes3',  | 
          265 | 
              notes         => 'notes3',  | 
        
        
          | 265 | 
              deliverytime  => 3  | 
          266 | 
              deliverytime  => 3  | 
        
        
          | 266 | 
          };  | 
          267 | 
          };  | 
        
  
    | 
      
            Lines 279-286
          my $sample_supplier4 = {
      
      
        Link Here
      
     | 
  
        
          | 279 | 
              gstreg        => 1,  | 
          280 | 
              gstreg        => 1,  | 
        
        
          | 280 | 
              listincgst    => 1,  | 
          281 | 
              listincgst    => 1,  | 
        
        
          | 281 | 
              invoiceincgst => 1,  | 
          282 | 
              invoiceincgst => 1,  | 
        
          
            
              | 282 | 
                  tax_rate       => '3.0000',  | 
              283 | 
                  tax_rate      => '3.0000',  | 
            
            
              | 283 | 
                  discount      => '3.0000',  | 
              284 | 
                  discount      => 3.0000,  | 
            
        
          | 284 | 
              notes         => 'notes3',  | 
          285 | 
              notes         => 'notes3',  | 
        
        
          | 285 | 
          };  | 
          286 | 
          };  | 
        
        
          | 286 | 
          my $supplier3 = Koha::Acquisition::Bookseller->new($sample_supplier3)->store;  | 
          287 | 
          my $supplier3 = Koha::Acquisition::Bookseller->new($sample_supplier3)->store;  | 
        
  
    | 
      
            Lines 358-364
          my $order1 = Koha::Acquisition::Order->new(
      
      
        Link Here
      
     | 
  
        
          | 358 | 
                  entrydate        => '2013-01-01',  | 
          359 | 
                  entrydate        => '2013-01-01',  | 
        
        
          | 359 | 
                  currency         => $curcode,  | 
          360 | 
                  currency         => $curcode,  | 
        
        
          | 360 | 
                  notes            => "This is a note1",  | 
          361 | 
                  notes            => "This is a note1",  | 
        
          
            
              | 361 | 
                      tax_rate          => 0.0500,  | 
              362 | 
                      tax_rate         => 0.0500,  | 
            
        
          | 362 | 
                  orderstatus      => 1,  | 
          363 | 
                  orderstatus      => 1,  | 
        
        
          | 363 | 
                  subscriptionid   => $id_subscription1,  | 
          364 | 
                  subscriptionid   => $id_subscription1,  | 
        
        
          | 364 | 
                  quantityreceived => 2,  | 
          365 | 
                  quantityreceived => 2,  | 
        
  
    | 
      
            Lines 378-384
          my $order2 = Koha::Acquisition::Order->new(
      
      
        Link Here
      
     | 
  
        
          | 378 | 
                  entrydate      => '2013-01-01',  | 
          379 | 
                  entrydate      => '2013-01-01',  | 
        
        
          | 379 | 
                  currency       => $curcode,  | 
          380 | 
                  currency       => $curcode,  | 
        
        
          | 380 | 
                  notes          => "This is a note2",  | 
          381 | 
                  notes          => "This is a note2",  | 
        
          
            
              | 381 | 
                      tax_rate        => 0.0500,  | 
              382 | 
                      tax_rate       => 0.0500,  | 
            
        
          | 382 | 
                  orderstatus    => 1,  | 
          383 | 
                  orderstatus    => 1,  | 
        
        
          | 383 | 
                  subscriptionid => $id_subscription2,  | 
          384 | 
                  subscriptionid => $id_subscription2,  | 
        
        
          | 384 | 
                  rrp            => 10,  | 
          385 | 
                  rrp            => 10,  | 
        
  
    | 
      
            Lines 396-402
          my $order3 = Koha::Acquisition::Order->new(
      
      
        Link Here
      
     | 
  
        
          | 396 | 
                  entrydate      => '2013-02-02',  | 
          397 | 
                  entrydate      => '2013-02-02',  | 
        
        
          | 397 | 
                  currency       => $curcode,  | 
          398 | 
                  currency       => $curcode,  | 
        
        
          | 398 | 
                  notes          => "This is a note3",  | 
          399 | 
                  notes          => "This is a note3",  | 
        
          
            
              | 399 | 
                      tax_rate        => 0.0500,  | 
              400 | 
                      tax_rate       => 0.0500,  | 
            
        
          | 400 | 
                  orderstatus    => 2,  | 
          401 | 
                  orderstatus    => 2,  | 
        
        
          | 401 | 
                  subscriptionid => $id_subscription3,  | 
          402 | 
                  subscriptionid => $id_subscription3,  | 
        
        
          | 402 | 
                  rrp            => 11,  | 
          403 | 
                  rrp            => 11,  | 
        
  
    | 
      
            Lines 414-420
          my $order4 = Koha::Acquisition::Order->new(
      
      
        Link Here
      
     | 
  
        
          | 414 | 
                  entrydate        => '2013-02-02',  | 
          415 | 
                  entrydate        => '2013-02-02',  | 
        
        
          | 415 | 
                  currency         => $curcode,  | 
          416 | 
                  currency         => $curcode,  | 
        
        
          | 416 | 
                  notes            => "This is a note3",  | 
          417 | 
                  notes            => "This is a note3",  | 
        
          
            
              | 417 | 
                      tax_rate          => 0.0500,  | 
              418 | 
                      tax_rate         => 0.0500,  | 
            
        
          | 418 | 
                  orderstatus      => 2,  | 
          419 | 
                  orderstatus      => 2,  | 
        
        
          | 419 | 
                  subscriptionid   => $id_subscription3,  | 
          420 | 
                  subscriptionid   => $id_subscription3,  | 
        
        
          | 420 | 
                  rrp              => 11,  | 
          421 | 
                  rrp              => 11,  | 
        
  
    | 
      
            Lines 780-782
          sub field_filter {
      
      
        Link Here
      
     | 
  
        
          | 780 | 
              }  | 
          781 | 
              }  | 
        
        
          | 781 | 
              return $struct;  | 
          782 | 
              return $struct;  | 
        
        
          | 782 | 
          }  | 
          783 | 
          }  | 
        
          
            
              | 783 | 
              -   | 
              784 | 
               | 
            
            
               | 
               | 
              785 | 
              # ensure numbers are actually tested as numbers to prevent  | 
            
            
              | 786 | 
              # precision changes causing test failures (D8->D9 Upgrades)  | 
            
            
              | 787 | 
              sub cast_precision { | 
            
            
              | 788 | 
                  my ($struct) = @_;  | 
            
            
              | 789 | 
                  my @cast = ('discount'); | 
            
            
              | 790 | 
                  for my $cast (@cast) { | 
            
            
              | 791 | 
                      $struct->{$cast} = $struct->{$cast}+0; | 
            
            
              | 792 | 
                  }  | 
            
            
              | 793 | 
                  return $struct;  | 
            
            
              | 794 | 
              }  |