| Lines 126-140
          sub create_order_lines_from_file {
      
      
        Link Here | 
        
          | 126 |             } | 126 |             } | 
        
          | 127 |         ); | 127 |         ); | 
        
          | 128 |  | 128 |  | 
          
            
              | 129 |         while( my $import_record = $import_records->next ){ | 129 |         while ( my $import_record = $import_records->next ) { | 
            
              | 130 |             my $result = add_biblio_from_import_record({ | 130 |             my $result = add_biblio_from_import_record( | 
            
              | 131 |                 import_batch_id => $import_batch_id, | 131 |                 { | 
            
              | 132 |                 import_record   => $import_record, | 132 |                     import_batch_id => $import_batch_id, | 
            
              | 133 |                 matcher_id      => $params->{matcher_id}, | 133 |                     import_record   => $import_record, | 
            
              | 134 |                 overlay_action  => $params->{overlay_action}, | 134 |                     matcher_id      => $params->{matcher_id}, | 
            
              | 135 |                 agent           => $agent, | 135 |                     overlay_action  => $params->{overlay_action}, | 
            
              | 136 |             }); | 136 |                     agent           => $agent, | 
            
              | 137 |             warn "Duplicates found in $result->{duplicates_in_batch}, record was skipped." if $result->{duplicates_in_batch}; | 137 |                 } | 
            
              |  |  | 138 |             ); | 
            
              | 139 |             warn "Duplicates found in $result->{duplicates_in_batch}, record was skipped." | 
            
              | 140 |                 if $result->{duplicates_in_batch}; | 
        
          | 138 |             next if $result->{skip}; | 141 |             next if $result->{skip}; | 
        
          | 139 |  | 142 |  | 
        
          | 140 |             my $order_line_details = add_items_from_import_record( | 143 |             my $order_line_details = add_items_from_import_record( | 
  
    | Lines 595-600
          sub add_items_from_import_record {
      
      
        Link Here | 
        
          | 595 | } | 598 | } | 
        
          | 596 |  | 599 |  | 
        
          | 597 |  | 600 |  | 
            
              |  |  | 601 | =head3 match_file_to_account | 
            
              | 602 |  | 
            
              | 603 |     my $file_match = Koha::MarcOrder->match_file_to_account({ | 
            
              | 604 |         filename => $filename, | 
            
              | 605 |         filepath => $filepath, | 
            
              | 606 |         profile  => $profile | 
            
              | 607 |     }); | 
            
              | 608 |  | 
            
              | 609 |     Used by the cronjob to detect whether a file matches the account and should be processed | 
            
              | 610 |  | 
            
              | 611 | =cut | 
            
              | 612 |  | 
            
              | 613 | sub match_file_to_account { | 
            
              | 614 |     my ( $self, $args ) = @_; | 
            
              | 615 |  | 
            
              | 616 |     my $match    = 0; | 
            
              | 617 |     my $filename = $args->{filename}; | 
            
              | 618 |     my $filepath = $args->{filepath}; | 
            
              | 619 |     my $profile  = $args->{profile}; | 
            
              | 620 |     my $format   = index( $filename, '.mrc' ) != -1 ? 'ISO2709' : 'MARCXML'; | 
            
              | 621 |  | 
            
              | 622 |     my ( $errors, $marcrecords ); | 
            
              | 623 |     if ( $format eq 'MARCXML' ) { | 
            
              | 624 |         ( $errors, $marcrecords ) = C4::ImportBatch::RecordsFromMARCXMLFile( $filepath, $profile->encoding ); | 
            
              | 625 |     } elsif ( $format eq 'ISO2709' ) { | 
            
              | 626 |         ( $errors, $marcrecords ) = C4::ImportBatch::RecordsFromISO2709File( | 
            
              | 627 |             $filepath, $profile->record_type, | 
            
              | 628 |             $profile->encoding | 
            
              | 629 |         ); | 
            
              | 630 |     } | 
            
              | 631 |  | 
            
              | 632 |     my $match_record = @{$marcrecords}[0]; | 
            
              | 633 |     my ( $field, $subfield ) = split /\$/, $profile->match_field; | 
            
              | 634 |  | 
            
              | 635 |     my $field_value = $match_record->subfield( $field, $subfield ) || ''; | 
            
              | 636 |     my $match_value = $profile->match_value                        || ''; | 
            
              | 637 |  | 
            
              | 638 |     if ( $field_value eq $match_value ) { | 
            
              | 639 |         $match = 1; | 
            
              | 640 |     } | 
            
              | 641 |  | 
            
              | 642 |     return $match; | 
            
              | 643 | } | 
            
              | 644 |  | 
        
          | 598 | =head3 import_batches_list | 645 | =head3 import_batches_list | 
        
          | 599 |  | 646 |  | 
        
          | 600 | Fetches import batches matching the batch to be added to the basket and returns these to the template | 647 | Fetches import batches matching the batch to be added to the basket and returns these to the template |