| 
      
            Lines 17-25
          package C4::AuthoritiesMarc;
      
      
        Link Here
      
     | 
  
        
          | 17 | 
          # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  | 
          17 | 
          # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  | 
        
        
          | 18 | 
           | 
          18 | 
           | 
        
        
          | 19 | 
          use strict;  | 
          19 | 
          use strict;  | 
        
          
            
              | 20 | 
              #use warnings; FIXME - Bug 2505  | 
              20 | 
              use warnings;  | 
            
        
          | 21 | 
          use C4::Context;  | 
          21 | 
          use C4::Context;  | 
        
            
              | 22 | 
              use C4::Koha;  | 
               | 
               | 
            
        
          | 23 | 
          use MARC::Record;  | 
          22 | 
          use MARC::Record;  | 
        
        
          | 24 | 
          use C4::Biblio;  | 
          23 | 
          use C4::Biblio;  | 
        
        
          | 25 | 
          use C4::Search;  | 
          24 | 
          use C4::Search;  | 
        
  
    | 
      
            Lines 41-47
          BEGIN {
      
      
        Link Here
      
     | 
  
        
          | 41 | 
          	    &GetAuthType  | 
          40 | 
          	    &GetAuthType  | 
        
        
          | 42 | 
          	    &GetAuthTypeCode  | 
          41 | 
          	    &GetAuthTypeCode  | 
        
        
          | 43 | 
              	&GetAuthMARCFromKohaField   | 
          42 | 
              	&GetAuthMARCFromKohaField   | 
        
            
              | 44 | 
                  	&AUTHhtml2marc  | 
               | 
               | 
            
        
          | 45 | 
           | 
          43 | 
           | 
        
        
          | 46 | 
              	&AddAuthority  | 
          44 | 
              	&AddAuthority  | 
        
        
          | 47 | 
              	&ModAuthority  | 
          45 | 
              	&ModAuthority  | 
        
  
    | 
      
            Lines 251-257
          sub SearchAuthorities {
      
      
        Link Here
      
     | 
  
        
          | 251 | 
                      }#if value  | 
          249 | 
                      }#if value  | 
        
        
          | 252 | 
                  }  | 
          250 | 
                  }  | 
        
        
          | 253 | 
                  ##Add how many queries generated  | 
          251 | 
                  ##Add how many queries generated  | 
        
          
            
              | 254 | 
                      if ($query=~/\S+/){ | 
              252 | 
                      if (defined $query && $query=~/\S+/){ | 
            
        
          | 255 | 
                    $query= $and x $attr_cnt . $query . $q2;  | 
          253 | 
                    $query= $and x $attr_cnt . $query . $q2;  | 
        
        
          | 256 | 
                  } else { | 
          254 | 
                  } else { | 
        
        
          | 257 | 
                    $query= $q2;  | 
          255 | 
                    $query= $q2;  | 
        
  
    | 
      
            Lines 854-906
          sub GetAuthType {
      
      
        Link Here
      
     | 
  
        
          | 854 | 
          }  | 
          852 | 
          }  | 
        
        
          | 855 | 
           | 
          853 | 
           | 
        
        
          | 856 | 
           | 
          854 | 
           | 
        
            
              | 857 | 
              sub AUTHhtml2marc { | 
               | 
               | 
            
            
              | 858 | 
                  my ($rtags,$rsubfields,$rvalues,%indicators) = @_;  | 
            
            
              | 859 | 
                  my $dbh=C4::Context->dbh;  | 
            
            
              | 860 | 
                  my $prevtag = -1;  | 
            
            
              | 861 | 
                  my $record = MARC::Record->new();  | 
            
            
              | 862 | 
              #---- TODO : the leader is missing  | 
            
            
              | 863 | 
               | 
            
            
              | 864 | 
              #     my %subfieldlist=();  | 
            
            
              | 865 | 
                  my $prevvalue; # if tag <10  | 
            
            
              | 866 | 
                  my $field; # if tag >=10  | 
            
            
              | 867 | 
                  for (my $i=0; $i< @$rtags; $i++) { | 
            
            
              | 868 | 
                      # rebuild MARC::Record  | 
            
            
              | 869 | 
                      if (@$rtags[$i] ne $prevtag) { | 
            
            
              | 870 | 
                          if ($prevtag < 10) { | 
            
            
              | 871 | 
                              if ($prevvalue) { | 
            
            
              | 872 | 
                                  $record->add_fields((sprintf "%03s",$prevtag),$prevvalue);  | 
            
            
              | 873 | 
                              }  | 
            
            
              | 874 | 
                          } else { | 
            
            
              | 875 | 
                              if ($field) { | 
            
            
              | 876 | 
                                  $record->add_fields($field);  | 
            
            
              | 877 | 
                              }  | 
            
            
              | 878 | 
                          }  | 
            
            
              | 879 | 
                          $indicators{@$rtags[$i]}.='  '; | 
            
            
              | 880 | 
                          if (@$rtags[$i] <10) { | 
            
            
              | 881 | 
                              $prevvalue= @$rvalues[$i];  | 
            
            
              | 882 | 
                              undef $field;  | 
            
            
              | 883 | 
                          } else { | 
            
            
              | 884 | 
                              undef $prevvalue;  | 
            
            
              | 885 | 
                              $field = MARC::Field->new( (sprintf "%03s",@$rtags[$i]), substr($indicators{@$rtags[$i]},0,1),substr($indicators{@$rtags[$i]},1,1), @$rsubfields[$i] => @$rvalues[$i]); | 
            
            
              | 886 | 
                          }  | 
            
            
              | 887 | 
                          $prevtag = @$rtags[$i];  | 
            
            
              | 888 | 
                      } else { | 
            
            
              | 889 | 
                          if (@$rtags[$i] <10) { | 
            
            
              | 890 | 
                              $prevvalue=@$rvalues[$i];  | 
            
            
              | 891 | 
                          } else { | 
            
            
              | 892 | 
                              if (length(@$rvalues[$i])>0) { | 
            
            
              | 893 | 
                                  $field->add_subfields(@$rsubfields[$i] => @$rvalues[$i]);  | 
            
            
              | 894 | 
                              }  | 
            
            
              | 895 | 
                          }  | 
            
            
              | 896 | 
                          $prevtag= @$rtags[$i];  | 
            
            
              | 897 | 
                      }  | 
            
            
              | 898 | 
                  }  | 
            
            
              | 899 | 
                  # the last has not been included inside the loop... do it now !  | 
            
            
              | 900 | 
                  $record->add_fields($field) if $field;  | 
            
            
              | 901 | 
                  return $record;  | 
            
            
              | 902 | 
              }  | 
            
            
              | 903 | 
               | 
            
        
          | 904 | 
          =head2 FindDuplicateAuthority  | 
          855 | 
          =head2 FindDuplicateAuthority  | 
        
        
          | 905 | 
           | 
          856 | 
           | 
        
        
          | 906 | 
            $record= &FindDuplicateAuthority( $record, $authtypecode)  | 
          857 | 
            $record= &FindDuplicateAuthority( $record, $authtypecode)  | 
        
  
    | 
      
            Lines 1015-1028
          sub BuildSummary{
      
      
        Link Here
      
     | 
  
        
          | 1015 | 
              $resultstring =~ s/\n/<br>/g;  | 
          966 | 
              $resultstring =~ s/\n/<br>/g;  | 
        
        
          | 1016 | 
          	$summary      =  $resultstring;  | 
          967 | 
          	$summary      =  $resultstring;  | 
        
        
          | 1017 | 
            } else { | 
          968 | 
            } else { | 
        
          
            
              | 1018 | 
                  my $heading;   | 
              969 | 
                  my $heading = '';  | 
            
            
              | 1019 | 
                  my $altheading;  | 
              970 | 
                  my $altheading = '';  | 
            
            
              | 1020 | 
                  my $seealso;  | 
              971 | 
                  my $seealso = '';  | 
            
            
              | 1021 | 
                  my $broaderterms;  | 
              972 | 
                  my $broaderterms = '';  | 
            
            
              | 1022 | 
                  my $narrowerterms;  | 
              973 | 
                  my $narrowerterms = '';  | 
            
            
              | 1023 | 
                  my $see;  | 
              974 | 
                  my $see = '';  | 
            
            
              | 1024 | 
                  my $seeheading;  | 
              975 | 
                  my $seeheading = '';  | 
            
            
              | 1025 | 
                      my $notes;  | 
              976 | 
                  my $notes = '';  | 
            
        
          | 1026 | 
              my @fields = $record->fields();  | 
          977 | 
              my @fields = $record->fields();  | 
        
        
          | 1027 | 
              if (C4::Context->preference('marcflavour') eq 'UNIMARC') { | 
          978 | 
              if (C4::Context->preference('marcflavour') eq 'UNIMARC') { | 
        
        
          | 1028 | 
              # construct UNIMARC summary, that is quite different from MARC21 one  | 
          979 | 
              # construct UNIMARC summary, that is quite different from MARC21 one  | 
        
  
    | 
      
            Lines 1471-1477
          sub get_auth_type_location {
      
      
        Link Here
      
     | 
  
        
          | 1471 | 
              my $auth_type_code = @_ ? shift : '';  | 
          1422 | 
              my $auth_type_code = @_ ? shift : '';  | 
        
        
          | 1472 | 
           | 
          1423 | 
           | 
        
        
          | 1473 | 
              my ($tag, $subfield) = GetAuthMARCFromKohaField('auth_header.authtypecode', $auth_type_code); | 
          1424 | 
              my ($tag, $subfield) = GetAuthMARCFromKohaField('auth_header.authtypecode', $auth_type_code); | 
        
          
            
              | 1474 | 
                  if (defined $tag and defined $subfield and $tag != 0 and $subfield != 0) { | 
              1425 | 
                  if (defined $tag and defined $subfield and $tag != 0 and $subfield ne '' and $subfield ne ' ') { | 
            
        
          | 1475 | 
                  return ($tag, $subfield);  | 
          1426 | 
                  return ($tag, $subfield);  | 
        
        
          | 1476 | 
              } else { | 
          1427 | 
              } else { | 
        
        
          | 1477 | 
                  if (C4::Context->preference('marcflavour') eq "MARC21")  { | 
          1428 | 
                  if (C4::Context->preference('marcflavour') eq "MARC21")  { |