View | Details | Raw Unified | Return to bug 7430
Collapse All | Expand All

(-)a/C4/AuthoritiesMarc.pm (-28 / +4 lines)
Lines 26-31 use C4::AuthoritiesMarc::MARC21; Link Here
26
use C4::AuthoritiesMarc::UNIMARC;
26
use C4::AuthoritiesMarc::UNIMARC;
27
use C4::Charset;
27
use C4::Charset;
28
use C4::Log;
28
use C4::Log;
29
use Koha::Utils;
30
use Koha::Search;
29
31
30
use vars qw($VERSION @ISA @EXPORT);
32
use vars qw($VERSION @ISA @EXPORT);
31
33
Lines 37-43 BEGIN { Link Here
37
	@ISA = qw(Exporter);
39
	@ISA = qw(Exporter);
38
	@EXPORT = qw(
40
	@EXPORT = qw(
39
	    &GetTagsLabels
41
	    &GetTagsLabels
40
	    &GetAuthType
41
	    &GetAuthTypeCode
42
	    &GetAuthTypeCode
42
    	&GetAuthMARCFromKohaField 
43
    	&GetAuthMARCFromKohaField 
43
44
Lines 749-755 sub AddAuthority { Link Here
749
    $sth->finish;
750
    $sth->finish;
750
    logaction( "AUTHORITIES", "ADD", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog");
751
    logaction( "AUTHORITIES", "ADD", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog");
751
  }
752
  }
752
  ModZebra($authid,'specialUpdate',"authorityserver",$oldRecord,$record);
753
  AddToIndexQueue($authid,'specialUpdate',"authorityserver",$oldRecord,$record);
753
  return ($authid);
754
  return ($authid);
754
}
755
}
755
756
Lines 767-773 sub DelAuthority { Link Here
767
    my $dbh=C4::Context->dbh;
768
    my $dbh=C4::Context->dbh;
768
769
769
    logaction( "AUTHORITIES", "DELETE", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog");
770
    logaction( "AUTHORITIES", "DELETE", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog");
770
    ModZebra($authid,"recordDelete","authorityserver",GetAuthority($authid),undef);
771
    AddToIndexQueue($authid,"recordDelete","authorityserver",GetAuthority($authid),undef);
771
    my $sth = $dbh->prepare("DELETE FROM auth_header WHERE authid=?");
772
    my $sth = $dbh->prepare("DELETE FROM auth_header WHERE authid=?");
772
    $sth->execute($authid);
773
    $sth->execute($authid);
773
}
774
}
Lines 859-889 sub GetAuthority { Link Here
859
    return ($record);
860
    return ($record);
860
}
861
}
861
862
862
=head2 GetAuthType 
863
864
  $result = &GetAuthType($authtypecode)
865
866
If the authority type specified by C<$authtypecode> exists,
867
returns a hashref of the type's fields.  If the type
868
does not exist, returns undef.
869
870
=cut
871
872
sub GetAuthType {
873
    my ($authtypecode) = @_;
874
    my $dbh=C4::Context->dbh;
875
    my $sth;
876
    if (defined $authtypecode){ # NOTE - in MARC21 framework, '' is a valid authority 
877
                                # type (FIXME but why?)
878
        $sth=$dbh->prepare("select * from auth_types where authtypecode=?");
879
        $sth->execute($authtypecode);
880
        if (my $res = $sth->fetchrow_hashref) {
881
            return $res; 
882
        }
883
    }
884
    return;
885
}
886
887
863
888
=head2 FindDuplicateAuthority
864
=head2 FindDuplicateAuthority
889
865
(-)a/C4/Biblio.pm (-415 / +8 lines)
Lines 36-41 use C4::ClassSource; Link Here
36
use C4::Charset;
36
use C4::Charset;
37
use C4::Linker;
37
use C4::Linker;
38
use C4::OAI::Sets;
38
use C4::OAI::Sets;
39
use Koha::Search;
40
use Koha::Utils;
39
41
40
use vars qw($VERSION @ISA @EXPORT);
42
use vars qw($VERSION @ISA @EXPORT);
41
43
Lines 88-94 BEGIN { Link Here
88
90
89
      &GetAuthorisedValueDesc
91
      &GetAuthorisedValueDesc
90
      &GetMarcStructure
92
      &GetMarcStructure
91
      &GetMarcFromKohaField
92
      &GetFrameworkCode
93
      &GetFrameworkCode
93
      &TransformKohaToMarc
94
      &TransformKohaToMarc
94
      &PrepHostMarcField
95
      &PrepHostMarcField
Lines 132-138 BEGIN { Link Here
132
      &TransformHtmlToMarc2
133
      &TransformHtmlToMarc2
133
      &TransformHtmlToMarc
134
      &TransformHtmlToMarc
134
      &TransformHtmlToXml
135
      &TransformHtmlToXml
135
      &GetNoZebraIndexes
136
      prepare_host_field
136
      prepare_host_field
137
    );
137
    );
138
}
138
}
Lines 450-456 sub DelBiblio { Link Here
450
        # the previous version of the record
450
        # the previous version of the record
451
        $oldRecord = GetMarcBiblio($biblionumber);
451
        $oldRecord = GetMarcBiblio($biblionumber);
452
    }
452
    }
453
    ModZebra( $biblionumber, "recordDelete", "biblioserver", $oldRecord, undef );
453
    AddToIndexQueue( $biblionumber, "recordDelete", "biblioserver", $oldRecord, undef );
454
454
455
    # delete biblioitems and items from Koha tables and save in deletedbiblioitems,deleteditems
455
    # delete biblioitems and items from Koha tables and save in deletedbiblioitems,deleteditems
456
    $sth = $dbh->prepare("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=?");
456
    $sth = $dbh->prepare("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=?");
Lines 1159-1183 sub GetUsedMarcStructure($) { Link Here
1159
    return $sth->fetchall_arrayref( {} );
1159
    return $sth->fetchall_arrayref( {} );
1160
}
1160
}
1161
1161
1162
=head2 GetMarcFromKohaField
1163
1164
  ($MARCfield,$MARCsubfield)=GetMarcFromKohaField($kohafield,$frameworkcode);
1165
1166
Returns the MARC fields & subfields mapped to the koha field 
1167
for the given frameworkcode
1168
1169
=cut
1170
1171
sub GetMarcFromKohaField {
1172
    my ( $kohafield, $frameworkcode ) = @_;
1173
    return (0, undef) unless $kohafield and defined $frameworkcode;
1174
    my $relations = C4::Context->marcfromkohafield;
1175
    if ( my $mf = $relations->{$frameworkcode}->{$kohafield} ) {
1176
        return @$mf;
1177
    }
1178
    return (0, undef);
1179
}
1180
1181
=head2 GetMarcBiblio
1162
=head2 GetMarcBiblio
1182
1163
1183
  my $record = GetMarcBiblio($biblionumber, [$embeditems]);
1164
  my $record = GetMarcBiblio($biblionumber, [$embeditems]);
Lines 2649-2790 sub TransformMarcToKohaOneField { Link Here
2649
}
2630
}
2650
2631
2651
2632
2652
#"
2653
2654
#
2655
# true ModZebra commented until indexdata fixes zebraDB crashes (it seems they occur on multiple updates
2656
# at the same time
2657
# replaced by a zebraqueue table, that is filled with ModZebra to run.
2658
# the table is emptied by misc/cronjobs/zebraqueue_start.pl script
2659
# =head2 ModZebrafiles
2660
#
2661
# &ModZebrafiles( $dbh, $biblionumber, $record, $folder, $server );
2662
#
2663
# =cut
2664
#
2665
# sub ModZebrafiles {
2666
#
2667
#     my ( $dbh, $biblionumber, $record, $folder, $server ) = @_;
2668
#
2669
#     my $op;
2670
#     my $zebradir =
2671
#       C4::Context->zebraconfig($server)->{directory} . "/" . $folder . "/";
2672
#     unless ( opendir( DIR, "$zebradir" ) ) {
2673
#         warn "$zebradir not found";
2674
#         return;
2675
#     }
2676
#     closedir DIR;
2677
#     my $filename = $zebradir . $biblionumber;
2678
#
2679
#     if ($record) {
2680
#         open( OUTPUT, ">", $filename . ".xml" );
2681
#         print OUTPUT $record;
2682
#         close OUTPUT;
2683
#     }
2684
# }
2685
2686
=head2 ModZebra
2633
=head2 ModZebra
2687
2634
2688
  ModZebra( $biblionumber, $op, $server, $oldRecord, $newRecord );
2635
This method should not be used. The functionality has been moved to
2689
2636
Koha::Search::AddToIndexQueue. It is left here as a temporary wrapper
2690
$biblionumber is the biblionumber we want to index
2637
to simplify the migration of custom scripts.
2691
2692
$op is specialUpdate or delete, and is used to know what we want to do
2693
2694
$server is the server that we want to update
2695
2696
$oldRecord is the MARC::Record containing the previous version of the record.  This is used only when 
2697
NoZebra=1, as NoZebra indexing needs to know the previous version of a record in order to
2698
do an update.
2699
2700
$newRecord is the MARC::Record containing the new record. It is usefull only when NoZebra=1, and is used to know what to add to the nozebra database. (the record in mySQL being, if it exist, the previous record, the one just before the modif. We need both : the previous and the new one.
2701
2638
2702
=cut
2639
=cut
2703
2640
2704
sub ModZebra {
2641
sub ModZebra {
2705
###Accepts a $server variable thus we can use it for biblios authorities or other zebra dbs
2642
    AddToIndexQueue(@_)
2706
    my ( $biblionumber, $op, $server, $oldRecord, $newRecord ) = @_;
2707
    my $dbh = C4::Context->dbh;
2708
2709
    # true ModZebra commented until indexdata fixes zebraDB crashes (it seems they occur on multiple updates
2710
    # at the same time
2711
    # replaced by a zebraqueue table, that is filled with ModZebra to run.
2712
    # the table is emptied by misc/cronjobs/zebraqueue_start.pl script
2713
2714
    if ( C4::Context->preference("NoZebra") ) {
2715
2716
        # lock the nozebra table : we will read index lines, update them in Perl process
2717
        # and write everything in 1 transaction.
2718
        # lock the table to avoid someone else overwriting what we are doing
2719
        $dbh->do('LOCK TABLES nozebra WRITE,biblio WRITE,biblioitems WRITE, systempreferences WRITE, auth_types WRITE, auth_header WRITE, auth_subfield_structure READ');
2720
        my %result;    # the result hash that will be built by deletion / add, and written on mySQL at the end, to improve speed
2721
        if ( $op eq 'specialUpdate' ) {
2722
2723
            # OK, we have to add or update the record
2724
            # 1st delete (virtually, in indexes), if record actually exists
2725
            if ($oldRecord) {
2726
                %result = _DelBiblioNoZebra( $biblionumber, $oldRecord, $server );
2727
            }
2728
2729
            # ... add the record
2730
            %result = _AddBiblioNoZebra( $biblionumber, $newRecord, $server, %result );
2731
        } else {
2732
2733
            # it's a deletion, delete the record...
2734
            # warn "DELETE the record $biblionumber on $server".$record->as_formatted;
2735
            %result = _DelBiblioNoZebra( $biblionumber, $oldRecord, $server );
2736
        }
2737
2738
        # ok, now update the database...
2739
        my $sth = $dbh->prepare("UPDATE nozebra SET biblionumbers=? WHERE server=? AND indexname=? AND value=?");
2740
        foreach my $key ( keys %result ) {
2741
            foreach my $index ( keys %{ $result{$key} } ) {
2742
                $sth->execute( $result{$key}->{$index}, $server, $key, $index );
2743
            }
2744
        }
2745
        $dbh->do('UNLOCK TABLES');
2746
    } else {
2747
2748
        #
2749
        # we use zebra, just fill zebraqueue table
2750
        #
2751
        my $check_sql = "SELECT COUNT(*) FROM zebraqueue 
2752
                         WHERE server = ?
2753
                         AND   biblio_auth_number = ?
2754
                         AND   operation = ?
2755
                         AND   done = 0";
2756
        my $check_sth = $dbh->prepare_cached($check_sql);
2757
        $check_sth->execute( $server, $biblionumber, $op );
2758
        my ($count) = $check_sth->fetchrow_array;
2759
        $check_sth->finish();
2760
        if ( $count == 0 ) {
2761
            my $sth = $dbh->prepare("INSERT INTO zebraqueue  (biblio_auth_number,server,operation) VALUES(?,?,?)");
2762
            $sth->execute( $biblionumber, $server, $op );
2763
            $sth->finish;
2764
        }
2765
    }
2766
}
2767
2768
=head2 GetNoZebraIndexes
2769
2770
  %indexes = GetNoZebraIndexes;
2771
2772
return the data from NoZebraIndexes syspref.
2773
2774
=cut
2775
2776
sub GetNoZebraIndexes {
2777
    my $no_zebra_indexes = C4::Context->preference('NoZebraIndexes');
2778
    my %indexes;
2779
  INDEX: foreach my $line ( split /['"],[\n\r]*/, $no_zebra_indexes ) {
2780
        $line =~ /(.*)=>(.*)/;
2781
        my $index  = $1;    # initial ' or " is removed afterwards
2782
        my $fields = $2;
2783
        $index  =~ s/'|"|\s//g;
2784
        $fields =~ s/'|"|\s//g;
2785
        $indexes{$index} = $fields;
2786
    }
2787
    return %indexes;
2788
}
2643
}
2789
2644
2790
=head2 EmbedItemsInMarcBiblio
2645
=head2 EmbedItemsInMarcBiblio
Lines 2820-3087 sub EmbedItemsInMarcBiblio { Link Here
2820
2675
2821
=head1 INTERNAL FUNCTIONS
2676
=head1 INTERNAL FUNCTIONS
2822
2677
2823
=head2 _DelBiblioNoZebra($biblionumber,$record,$server);
2824
2825
function to delete a biblio in NoZebra indexes
2826
This function does NOT delete anything in database : it reads all the indexes entries
2827
that have to be deleted & delete them in the hash
2828
2829
The SQL part is done either :
2830
 - after the Add if we are modifying a biblio (delete + add again)
2831
 - immediatly after this sub if we are doing a true deletion.
2832
2833
$server can be 'biblioserver' or 'authorityserver' : it indexes biblios or authorities (in the same table, $server being part of the table itself
2834
2835
=cut
2836
2837
sub _DelBiblioNoZebra {
2838
    my ( $biblionumber, $record, $server ) = @_;
2839
2840
    # Get the indexes
2841
    my $dbh = C4::Context->dbh;
2842
2843
    # Get the indexes
2844
    my %index;
2845
    my $title;
2846
    if ( $server eq 'biblioserver' ) {
2847
        %index = GetNoZebraIndexes;
2848
2849
        # get title of the record (to store the 10 first letters with the index)
2850
        my ( $titletag, $titlesubfield ) = GetMarcFromKohaField( 'biblio.title', '' );    # FIXME: should be GetFrameworkCode($biblionumber) ??
2851
        $title = lc( $record->subfield( $titletag, $titlesubfield ) );
2852
    } else {
2853
2854
        # for authorities, the "title" is the $a mainentry
2855
        my ( $auth_type_tag, $auth_type_sf ) = C4::AuthoritiesMarc::get_auth_type_location();
2856
        my $authref = C4::AuthoritiesMarc::GetAuthType( $record->subfield( $auth_type_tag, $auth_type_sf ) );
2857
        warn "ERROR : authtype undefined for " . $record->as_formatted unless $authref;
2858
        $title = $record->subfield( $authref->{auth_tag_to_report}, 'a' );
2859
        $index{'mainmainentry'} = $authref->{'auth_tag_to_report'} . 'a';
2860
        $index{'mainentry'}     = $authref->{'auth_tag_to_report'} . '*';
2861
        $index{'auth_type'}     = "${auth_type_tag}${auth_type_sf}";
2862
    }
2863
2864
    my %result;
2865
2866
    # remove blancks comma (that could cause problem when decoding the string for CQL retrieval) and regexp specific values
2867
    $title =~ s/ |,|;|\[|\]|\(|\)|\*|-|'|=//g;
2868
2869
    # limit to 10 char, should be enough, and limit the DB size
2870
    $title = substr( $title, 0, 10 );
2871
2872
    #parse each field
2873
    my $sth2 = $dbh->prepare('SELECT biblionumbers FROM nozebra WHERE server=? AND indexname=? AND value=?');
2874
    foreach my $field ( $record->fields() ) {
2875
2876
        #parse each subfield
2877
        next if $field->tag < 10;
2878
        foreach my $subfield ( $field->subfields() ) {
2879
            my $tag          = $field->tag();
2880
            my $subfieldcode = $subfield->[0];
2881
            my $indexed      = 0;
2882
2883
            # check each index to see if the subfield is stored somewhere
2884
            # otherwise, store it in __RAW__ index
2885
            foreach my $key ( keys %index ) {
2886
2887
                #                 warn "examining $key index : ".$index{$key}." for $tag $subfieldcode";
2888
                if ( $index{$key} =~ /$tag\*/ or $index{$key} =~ /$tag$subfieldcode/ ) {
2889
                    $indexed = 1;
2890
                    my $line = lc $subfield->[1];
2891
2892
                    # remove meaningless value in the field...
2893
                    $line =~ s/-|\.|\?|,|;|!|'|\(|\)|\[|\]|{|}|"|<|>|&|\+|\*|\/|=|:/ /g;
2894
2895
                    # ... and split in words
2896
                    foreach ( split / /, $line ) {
2897
                        next unless $_;    # skip  empty values (multiple spaces)
2898
                                           # if the entry is already here, do nothing, the biblionumber has already be removed
2899
                        unless ( defined( $result{$key}->{$_} ) && ( $result{$key}->{$_} =~ /$biblionumber,$title\-(\d);/ ) ) {
2900
2901
                            # get the index value if it exist in the nozebra table and remove the entry, otherwise, do nothing
2902
                            $sth2->execute( $server, $key, $_ );
2903
                            my $existing_biblionumbers = $sth2->fetchrow;
2904
2905
                            # it exists
2906
                            if ($existing_biblionumbers) {
2907
2908
                                #                                 warn " existing for $key $_: $existing_biblionumbers";
2909
                                $result{$key}->{$_} = $existing_biblionumbers;
2910
                                $result{$key}->{$_} =~ s/$biblionumber,$title\-(\d);//;
2911
                            }
2912
                        }
2913
                    }
2914
                }
2915
            }
2916
2917
            # the subfield is not indexed, store it in __RAW__ index anyway
2918
            unless ($indexed) {
2919
                my $line = lc $subfield->[1];
2920
                $line =~ s/-|\.|\?|,|;|!|'|\(|\)|\[|\]|{|}|"|<|>|&|\+|\*|\/|=|:/ /g;
2921
2922
                # ... and split in words
2923
                foreach ( split / /, $line ) {
2924
                    next unless $_;    # skip  empty values (multiple spaces)
2925
                                       # if the entry is already here, do nothing, the biblionumber has already be removed
2926
                    unless ( $result{'__RAW__'}->{$_} =~ /$biblionumber,$title\-(\d);/ ) {
2927
2928
                        # get the index value if it exist in the nozebra table and remove the entry, otherwise, do nothing
2929
                        $sth2->execute( $server, '__RAW__', $_ );
2930
                        my $existing_biblionumbers = $sth2->fetchrow;
2931
2932
                        # it exists
2933
                        if ($existing_biblionumbers) {
2934
                            $result{'__RAW__'}->{$_} = $existing_biblionumbers;
2935
                            $result{'__RAW__'}->{$_} =~ s/$biblionumber,$title\-(\d);//;
2936
                        }
2937
                    }
2938
                }
2939
            }
2940
        }
2941
    }
2942
    return %result;
2943
}
2944
2945
=head2 _AddBiblioNoZebra
2946
2947
  _AddBiblioNoZebra($biblionumber, $record, $server, %result);
2948
2949
function to add a biblio in NoZebra indexes
2950
2951
=cut
2952
2953
sub _AddBiblioNoZebra {
2954
    my ( $biblionumber, $record, $server, %result ) = @_;
2955
    my $dbh = C4::Context->dbh;
2956
2957
    # Get the indexes
2958
    my %index;
2959
    my $title;
2960
    if ( $server eq 'biblioserver' ) {
2961
        %index = GetNoZebraIndexes;
2962
2963
        # get title of the record (to store the 10 first letters with the index)
2964
        my ( $titletag, $titlesubfield ) = GetMarcFromKohaField( 'biblio.title', '' );    # FIXME: should be GetFrameworkCode($biblionumber) ??
2965
        $title = lc( $record->subfield( $titletag, $titlesubfield ) );
2966
    } else {
2967
2968
        # warn "server : $server";
2969
        # for authorities, the "title" is the $a mainentry
2970
        my ( $auth_type_tag, $auth_type_sf ) = C4::AuthoritiesMarc::get_auth_type_location();
2971
        my $authref = C4::AuthoritiesMarc::GetAuthType( $record->subfield( $auth_type_tag, $auth_type_sf ) );
2972
        warn "ERROR : authtype undefined for " . $record->as_formatted unless $authref;
2973
        $title = $record->subfield( $authref->{auth_tag_to_report}, 'a' );
2974
        $index{'mainmainentry'} = $authref->{auth_tag_to_report} . 'a';
2975
        $index{'mainentry'}     = $authref->{auth_tag_to_report} . '*';
2976
        $index{'auth_type'}     = "${auth_type_tag}${auth_type_sf}";
2977
    }
2978
2979
    # remove blancks comma (that could cause problem when decoding the string for CQL retrieval) and regexp specific values
2980
    $title =~ s/ |\.|,|;|\[|\]|\(|\)|\*|-|'|:|=|\r|\n//g;
2981
2982
    # limit to 10 char, should be enough, and limit the DB size
2983
    $title = substr( $title, 0, 10 );
2984
2985
    #parse each field
2986
    my $sth2 = $dbh->prepare('SELECT biblionumbers FROM nozebra WHERE server=? AND indexname=? AND value=?');
2987
    foreach my $field ( $record->fields() ) {
2988
2989
        #parse each subfield
2990
        ###FIXME: impossible to index a 001-009 value with NoZebra
2991
        next if $field->tag < 10;
2992
        foreach my $subfield ( $field->subfields() ) {
2993
            my $tag          = $field->tag();
2994
            my $subfieldcode = $subfield->[0];
2995
            my $indexed      = 0;
2996
2997
            #             warn "INDEXING :".$subfield->[1];
2998
            # check each index to see if the subfield is stored somewhere
2999
            # otherwise, store it in __RAW__ index
3000
            foreach my $key ( keys %index ) {
3001
3002
                #                 warn "examining $key index : ".$index{$key}." for $tag $subfieldcode";
3003
                if ( $index{$key} =~ /$tag\*/ or $index{$key} =~ /$tag$subfieldcode/ ) {
3004
                    $indexed = 1;
3005
                    my $line = lc $subfield->[1];
3006
3007
                    # remove meaningless value in the field...
3008
                    $line =~ s/-|\.|\?|,|;|!|'|\(|\)|\[|\]|{|}|"|<|>|&|\+|\*|\/|=|:|\r|\n/ /g;
3009
3010
                    # ... and split in words
3011
                    foreach ( split / /, $line ) {
3012
                        next unless $_;    # skip  empty values (multiple spaces)
3013
                                           # if the entry is already here, improve weight
3014
3015
                        #                         warn "managing $_";
3016
                        if ( exists $result{$key}->{$_} && $result{$key}->{"$_"} =~ /$biblionumber,\Q$title\E\-(\d+);/ ) {
3017
                            my $weight = $1 + 1;
3018
                            $result{$key}->{"$_"} =~ s/$biblionumber,\Q$title\E\-(\d+);//g;
3019
                            $result{$key}->{"$_"} .= "$biblionumber,$title-$weight;";
3020
                        } else {
3021
3022
                            # get the value if it exist in the nozebra table, otherwise, create it
3023
                            $sth2->execute( $server, $key, $_ );
3024
                            my $existing_biblionumbers = $sth2->fetchrow;
3025
3026
                            # it exists
3027
                            if ($existing_biblionumbers) {
3028
                                $result{$key}->{"$_"} = $existing_biblionumbers;
3029
                                my $weight = defined $1 ? $1 + 1 : 1;
3030
                                $result{$key}->{"$_"} =~ s/$biblionumber,\Q$title\E\-(\d+);//g;
3031
                                $result{$key}->{"$_"} .= "$biblionumber,$title-$weight;";
3032
3033
                                # create a new ligne for this entry
3034
                            } else {
3035
3036
                                #                             warn "INSERT : $server / $key / $_";
3037
                                $dbh->do( 'INSERT INTO nozebra SET server=' . $dbh->quote($server) . ', indexname=' . $dbh->quote($key) . ',value=' . $dbh->quote($_) );
3038
                                $result{$key}->{"$_"} .= "$biblionumber,$title-1;";
3039
                            }
3040
                        }
3041
                    }
3042
                }
3043
            }
3044
3045
            # the subfield is not indexed, store it in __RAW__ index anyway
3046
            unless ($indexed) {
3047
                my $line = lc $subfield->[1];
3048
                $line =~ s/-|\.|\?|,|;|!|'|\(|\)|\[|\]|{|}|"|<|>|&|\+|\*|\/|=|:|\r|\n/ /g;
3049
3050
                # ... and split in words
3051
                foreach ( split / /, $line ) {
3052
                    next unless $_;    # skip  empty values (multiple spaces)
3053
                                       # if the entry is already here, improve weight
3054
                    my $tmpstr = $result{'__RAW__'}->{"$_"} || "";
3055
                    if ( $tmpstr =~ /$biblionumber,\Q$title\E\-(\d+);/ ) {
3056
                        my $weight = $1 + 1;
3057
                        $result{'__RAW__'}->{"$_"} =~ s/$biblionumber,\Q$title\E\-(\d+);//;
3058
                        $result{'__RAW__'}->{"$_"} .= "$biblionumber,$title-$weight;";
3059
                    } else {
3060
3061
                        # get the value if it exist in the nozebra table, otherwise, create it
3062
                        $sth2->execute( $server, '__RAW__', $_ );
3063
                        my $existing_biblionumbers = $sth2->fetchrow;
3064
3065
                        # it exists
3066
                        if ($existing_biblionumbers) {
3067
                            $result{'__RAW__'}->{"$_"} = $existing_biblionumbers;
3068
                            my $weight = ( $1 ? $1 : 0 ) + 1;
3069
                            $result{'__RAW__'}->{"$_"} =~ s/$biblionumber,\Q$title\E\-(\d+);//;
3070
                            $result{'__RAW__'}->{"$_"} .= "$biblionumber,$title-$weight;";
3071
3072
                            # create a new ligne for this entry
3073
                        } else {
3074
                            $dbh->do( 'INSERT INTO nozebra SET server=' . $dbh->quote($server) . ',  indexname="__RAW__",value=' . $dbh->quote($_) );
3075
                            $result{'__RAW__'}->{"$_"} .= "$biblionumber,$title-1;";
3076
                        }
3077
                    }
3078
                }
3079
            }
3080
        }
3081
    }
3082
    return %result;
3083
}
3084
3085
=head2 _koha_marc_update_bib_ids
2678
=head2 _koha_marc_update_bib_ids
3086
2679
3087
2680
Lines 3565-3571 sub ModBiblioMarc { Link Here
3565
    $sth = $dbh->prepare("UPDATE biblioitems SET marc=?,marcxml=? WHERE biblionumber=?");
3158
    $sth = $dbh->prepare("UPDATE biblioitems SET marc=?,marcxml=? WHERE biblionumber=?");
3566
    $sth->execute( $record->as_usmarc(), $record->as_xml_record($encoding), $biblionumber );
3159
    $sth->execute( $record->as_usmarc(), $record->as_xml_record($encoding), $biblionumber );
3567
    $sth->finish;
3160
    $sth->finish;
3568
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", $oldRecord, $record );
3161
    AddToIndexQueue( $biblionumber, "specialUpdate", "biblioserver", $oldRecord, $record );
3569
    return $biblionumber;
3162
    return $biblionumber;
3570
}
3163
}
3571
3164
(-)a/C4/ImportBatch.pm (+1 lines)
Lines 25-30 use C4::Koha; Link Here
25
use C4::Biblio;
25
use C4::Biblio;
26
use C4::Items;
26
use C4::Items;
27
use C4::Charset;
27
use C4::Charset;
28
use Koha::Utils;
28
29
29
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
30
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
30
31
(-)a/C4/Items.pm (-5 / +7 lines)
Lines 31-36 use C4::ClassSource; Link Here
31
use C4::Log;
31
use C4::Log;
32
use List::MoreUtils qw/any/;
32
use List::MoreUtils qw/any/;
33
use C4::Search;
33
use C4::Search;
34
use Koha::Utils;
35
use Koha::Search;
34
use Data::Dumper; # used as part of logging item record changes, not just for
36
use Data::Dumper; # used as part of logging item record changes, not just for
35
                  # debugging; so please don't remove this
37
                  # debugging; so please don't remove this
36
38
Lines 271-277 sub AddItem { Link Here
271
	my ( $itemnumber, $error ) = _koha_new_item( $item, $item->{barcode} );
273
	my ( $itemnumber, $error ) = _koha_new_item( $item, $item->{barcode} );
272
    $item->{'itemnumber'} = $itemnumber;
274
    $item->{'itemnumber'} = $itemnumber;
273
275
274
    ModZebra( $item->{biblionumber}, "specialUpdate", "biblioserver", undef, undef );
276
    AddToIndexQueue( $item->{biblionumber}, "specialUpdate", "biblioserver", undef, undef );
275
   
277
   
276
    logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog");
278
    logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog");
277
    
279
    
Lines 524-530 sub ModItem { Link Here
524
526
525
    # request that bib be reindexed so that searching on current
527
    # request that bib be reindexed so that searching on current
526
    # item status is possible
528
    # item status is possible
527
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", undef, undef );
529
    AddToIndexQueue( $biblionumber, "specialUpdate", "biblioserver", undef, undef );
528
530
529
    logaction("CATALOGUING", "MODIFY", $itemnumber, Dumper($item)) if C4::Context->preference("CataloguingLog");
531
    logaction("CATALOGUING", "MODIFY", $itemnumber, Dumper($item)) if C4::Context->preference("CataloguingLog");
530
}
532
}
Lines 587-593 sub DelItem { Link Here
587
589
588
    # get the MARC record
590
    # get the MARC record
589
    my $record = GetMarcBiblio($biblionumber);
591
    my $record = GetMarcBiblio($biblionumber);
590
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", undef, undef );
592
    AddToIndexQueue( $biblionumber, "specialUpdate", "biblioserver", undef, undef );
591
593
592
    # backup the record
594
    # backup the record
593
    my $copy2deleted = $dbh->prepare("UPDATE deleteditems SET marc=? WHERE itemnumber=?");
595
    my $copy2deleted = $dbh->prepare("UPDATE deleteditems SET marc=? WHERE itemnumber=?");
Lines 2195-2202 sub MoveItemFromBiblio { Link Here
2195
    $sth = $dbh->prepare("UPDATE items SET biblioitemnumber = ?, biblionumber = ? WHERE itemnumber = ? AND biblionumber = ?");
2197
    $sth = $dbh->prepare("UPDATE items SET biblioitemnumber = ?, biblionumber = ? WHERE itemnumber = ? AND biblionumber = ?");
2196
    my $return = $sth->execute($tobiblioitem, $tobiblio, $itemnumber, $frombiblio);
2198
    my $return = $sth->execute($tobiblioitem, $tobiblio, $itemnumber, $frombiblio);
2197
    if ($return == 1) {
2199
    if ($return == 1) {
2198
        ModZebra( $tobiblio, "specialUpdate", "biblioserver", undef, undef );
2200
        AddToIndexQueue( $tobiblio, "specialUpdate", "biblioserver", undef, undef );
2199
        ModZebra( $frombiblio, "specialUpdate", "biblioserver", undef, undef );
2201
        AddToIndexQueue( $frombiblio, "specialUpdate", "biblioserver", undef, undef );
2200
	    # Checking if the item we want to move is in an order 
2202
	    # Checking if the item we want to move is in an order 
2201
        require C4::Acquisition;
2203
        require C4::Acquisition;
2202
        my $order = C4::Acquisition::GetOrderFromItemnumber($itemnumber);
2204
        my $order = C4::Acquisition::GetOrderFromItemnumber($itemnumber);
(-)a/C4/Labels/Label.pm (+1 lines)
Lines 11-16 use Data::Dumper; Link Here
11
use C4::Context;
11
use C4::Context;
12
use C4::Debug;
12
use C4::Debug;
13
use C4::Biblio;
13
use C4::Biblio;
14
use Koha::Utils;
14
15
15
BEGIN {
16
BEGIN {
16
    use version; our $VERSION = qv('1.0.0_1');
17
    use version; our $VERSION = qv('1.0.0_1');
(-)a/C4/Search.pm (-203 / +3 lines)
Lines 35-40 use C4::Charset; Link Here
35
use YAML;
35
use YAML;
36
use URI::Escape;
36
use URI::Escape;
37
use Business::ISBN;
37
use Business::ISBN;
38
use Koha::Search;
39
use Koha::Utils;
38
40
39
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG);
41
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG);
40
42
Lines 816-1023 sub _build_weighted_query { Link Here
816
    return $weighted_query;
818
    return $weighted_query;
817
}
819
}
818
820
819
=head2 getIndexes
820
821
Return an array with available indexes.
822
823
=cut
824
825
sub getIndexes{
826
    my @indexes = (
827
                    # biblio indexes
828
                    'ab',
829
                    'Abstract',
830
                    'acqdate',
831
                    'allrecords',
832
                    'an',
833
                    'Any',
834
                    'at',
835
                    'au',
836
                    'aub',
837
                    'aud',
838
                    'audience',
839
                    'auo',
840
                    'aut',
841
                    'Author',
842
                    'Author-in-order ',
843
                    'Author-personal-bibliography',
844
                    'Authority-Number',
845
                    'authtype',
846
                    'bc',
847
		    'Bib-level',
848
                    'biblionumber',
849
                    'bio',
850
                    'biography',
851
                    'callnum',
852
                    'cfn',
853
                    'Chronological-subdivision',
854
                    'cn-bib-source',
855
                    'cn-bib-sort',
856
                    'cn-class',
857
                    'cn-item',
858
                    'cn-prefix',
859
                    'cn-suffix',
860
                    'cpn',
861
                    'Code-institution',
862
                    'Conference-name',
863
                    'Conference-name-heading',
864
                    'Conference-name-see',
865
                    'Conference-name-seealso',
866
                    'Content-type',
867
                    'Control-number',
868
                    'copydate',
869
                    'Corporate-name',
870
                    'Corporate-name-heading',
871
                    'Corporate-name-see',
872
                    'Corporate-name-seealso',
873
                    'ctype',
874
                    'date-entered-on-file',
875
                    'Date-of-acquisition',
876
                    'Date-of-publication',
877
                    'Dewey-classification',
878
                    'EAN',
879
                    'extent',
880
                    'fic',
881
                    'fiction',
882
                    'Form-subdivision',
883
                    'format',
884
                    'Geographic-subdivision',
885
                    'he',
886
                    'Heading',
887
                    'Heading-use-main-or-added-entry',
888
                    'Heading-use-series-added-entry ',
889
                    'Heading-use-subject-added-entry',
890
                    'Host-item',
891
                    'id-other',
892
                    'Illustration-code',
893
                    'ISBN',
894
                    'isbn',
895
                    'ISSN',
896
                    'issn',
897
                    'itemtype',
898
                    'kw',
899
                    'Koha-Auth-Number',
900
                    'l-format',
901
                    'language',
902
                    'lc-card',
903
                    'LC-card-number',
904
                    'lcn',
905
                    'llength',
906
                    'ln',
907
                    'Local-classification',
908
                    'Local-number',
909
                    'Match-heading',
910
                    'Match-heading-see-from',
911
                    'Material-type',
912
                    'mc-itemtype',
913
                    'mc-rtype',
914
                    'mus',
915
                    'name',
916
                    'Music-number',
917
                    'Name-geographic',
918
                    'Name-geographic-heading',
919
                    'Name-geographic-see',
920
                    'Name-geographic-seealso',
921
                    'nb',
922
                    'Note',
923
                    'notes',
924
                    'ns',
925
                    'nt',
926
                    'pb',
927
                    'Personal-name',
928
                    'Personal-name-heading',
929
                    'Personal-name-see',
930
                    'Personal-name-seealso',
931
                    'pl',
932
                    'Place-publication',
933
                    'pn',
934
                    'popularity',
935
                    'pubdate',
936
                    'Publisher',
937
                    'Record-control-number',
938
                    'rcn',
939
                    'Record-type',
940
                    'rtype',
941
                    'se',
942
                    'See',
943
                    'See-also',
944
                    'sn',
945
                    'Stock-number',
946
                    'su',
947
                    'Subject',
948
                    'Subject-heading-thesaurus',
949
                    'Subject-name-personal',
950
                    'Subject-subdivision',
951
                    'Summary',
952
                    'Suppress',
953
                    'su-geo',
954
                    'su-na',
955
                    'su-to',
956
                    'su-ut',
957
                    'ut',
958
                    'UPC',
959
                    'Term-genre-form',
960
                    'Term-genre-form-heading',
961
                    'Term-genre-form-see',
962
                    'Term-genre-form-seealso',
963
                    'ti',
964
                    'Title',
965
                    'Title-cover',
966
                    'Title-series',
967
                    'Title-host',
968
                    'Title-uniform',
969
                    'Title-uniform-heading',
970
                    'Title-uniform-see',
971
                    'Title-uniform-seealso',
972
                    'totalissues',
973
                    'yr',
974
975
                    # items indexes
976
                    'acqsource',
977
                    'barcode',
978
                    'bc',
979
                    'branch',
980
                    'ccode',
981
                    'classification-source',
982
                    'cn-sort',
983
                    'coded-location-qualifier',
984
                    'copynumber',
985
                    'damaged',
986
                    'datelastborrowed',
987
                    'datelastseen',
988
                    'holdingbranch',
989
                    'homebranch',
990
                    'issues',
991
                    'item',
992
                    'itemnumber',
993
                    'itype',
994
                    'Local-classification',
995
                    'location',
996
                    'lost',
997
                    'materials-specified',
998
                    'mc-ccode',
999
                    'mc-itype',
1000
                    'mc-loc',
1001
                    'notforloan',
1002
                    'onloan',
1003
                    'price',
1004
                    'renewals',
1005
                    'replacementprice',
1006
                    'replacementpricedate',
1007
                    'reserves',
1008
                    'restricted',
1009
                    'stack',
1010
                    'stocknumber',
1011
                    'inv',
1012
                    'uri',
1013
                    'withdrawn',
1014
1015
                    # subject related
1016
                  );
1017
1018
    return \@indexes;
1019
}
1020
1021
=head2 buildQuery
821
=head2 buildQuery
1022
822
1023
( $error, $query,
823
( $error, $query,
Lines 1075-1081 sub buildQuery { Link Here
1075
    my $stopwords_removed;    # flag to determine if stopwords have been removed
875
    my $stopwords_removed;    # flag to determine if stopwords have been removed
1076
876
1077
    my $cclq       = 0;
877
    my $cclq       = 0;
1078
    my $cclindexes = getIndexes();
878
    my $cclindexes = GetIndexes();
1079
    if ( $query !~ /\s*ccl=/ ) {
879
    if ( $query !~ /\s*ccl=/ ) {
1080
        while ( !$cclq && $query =~ /(?:^|\W)([\w-]+)(,[\w-]+)*[:=]/g ) {
880
        while ( !$cclq && $query =~ /(?:^|\W)([\w-]+)(,[\w-]+)*[:=]/g ) {
1081
            my $dx = lc($1);
881
            my $dx = lc($1);
(-)a/C4/Serials.pm (+1 lines)
Lines 26-31 use POSIX qw(strftime); Link Here
26
use C4::Biblio;
26
use C4::Biblio;
27
use C4::Log;    # logaction
27
use C4::Log;    # logaction
28
use C4::Debug;
28
use C4::Debug;
29
use Koha::Utils;
29
30
30
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
31
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
31
32
(-)a/Koha/Search.pm (+112 lines)
Line 0 Link Here
1
package Koha::Search;
2
3
# Copyright 2011 C & P Bibliography Services
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
=head1 NAME
21
22
Koha::Search - Interface to bibliographic/authority record searching
23
24
=head1 SYNOPSIS
25
26
  use Koha::Search;
27
28
=head1 DESCRIPTION
29
30
Interface to Koha::Search::Engine functionality for bibliographic and authority
31
record searching.
32
33
=head1 FUNCTIONS
34
35
=cut
36
37
use strict;
38
use warnings;
39
require Exporter;
40
use C4::Context;
41
use Koha::Search::Engine;
42
43
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG);
44
45
46
BEGIN {
47
    $VERSION = 3.01;
48
    $DEBUG = ($ENV{DEBUG}) ? 1 : 0;
49
    our $search_engine = Koha::Search::Engine->new();
50
}
51
52
=head1 NAME
53
54
Koha::Search - Functions for searching the Koha catalog.
55
56
=head1 SYNOPSIS
57
58
See opac/opac-search.pl or catalogue/search.pl for example of usage
59
60
=head1 DESCRIPTION
61
62
This module provides searching functions for Koha's bibliographic databases
63
64
=head1 FUNCTIONS
65
66
=cut
67
68
@ISA    = qw(Exporter);
69
@EXPORT = qw(
70
    &AddToIndexQueue
71
    &GetIndexes
72
);
73
74
our $search_engine;
75
76
sub AddToIndexQueue {
77
    if (!(C4::Context->preference('SearchEngine')=~/IndexOff/i)){ # solr allows disabling indexing
78
        return $search_engine->add_to_index_queue( @_ );
79
    }
80
    return undef;
81
}
82
83
=head2 GetIndexes
84
85
  @indexes = GetIndexes;
86
87
Return a list of indexes provided by the active search engine
88
89
=cut
90
91
sub GetIndexes {
92
    return $search_engine->get_indexes( @_ );
93
}
94
95
=head2 EXPORT
96
97
AddToIndexQueue
98
GetIndexes
99
100
=head1 SEE ALSO
101
102
Koha::Search::Engine::Zebra
103
104
=head1 AUTHOR
105
106
Jared Camins-Esakov, C & P Bibliography Services, E<lt>jcamins@cpbibliography.comE<gt>
107
108
=cut
109
110
1;
111
112
__END__
(-)a/Koha/Search/Engine.pm (+114 lines)
Line 0 Link Here
1
package Koha::Search::Engine;
2
3
# Copyright 2011 C & P Bibliography Services
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
=head1 NAME
21
22
Koha::Search::Engine - Base class for Koha search engine interfaces
23
24
=head1 SYNOPSIS
25
26
  use Koha::Search::Engine;
27
28
=head1 DESCRIPTION
29
30
Base class for Koha::Search::Engine::X. Subclasses need to provide the
31
following methods:
32
33
B<add_to_index_queue> - add the specified object to the index queue
34
35
B<get_indexes> - get a list of indexes provided by the search engine
36
37
=head1 FUNCTIONS
38
39
=cut
40
41
use strict;
42
use warnings;
43
use C4::Context;
44
45
BEGIN {
46
    our $VERSION = 3.01;
47
48
    my $engine_module = "Koha::Search::Engine::" . (C4::Context->preference("SearchEngine") || 'Zebra');
49
    eval "require $engine_module";
50
}
51
52
sub new {
53
    my $class = shift;
54
55
    my $self = { };
56
57
    my $engine_module = "Koha::Search::Engine::" . (C4::Context->preference("SearchEngine") || 'Zebra');
58
59
    $self->{'engine'} = $engine_module->new();
60
    bless $self, $class;
61
    return $self;
62
}
63
64
=head2 add_to_index_queue
65
66
  $search_engine->add_to_index_queue( $indexnumber, $op, $server);
67
68
$indexnumber is the id number of the object we want to index
69
70
$op is specialUpdate or delete, and is used to know what we want to do
71
72
$server is the server that we want to update
73
74
=cut
75
76
sub add_to_index_queue {
77
    my $self = shift;
78
79
    return $self->{'engine'}->add_to_index_queue(@_);
80
}
81
82
=head2 get_indexes
83
84
  @indexes = $search_engine->get_indexes;
85
86
Return a list of indexes provided by the active search engine
87
88
=cut
89
90
91
sub get_indexes {
92
    my $self = shift;
93
94
    return $self->{'engine'}->get_indexes(@_);
95
}
96
97
=head2 EXPORT
98
99
None by default.
100
101
=head1 SEE ALSO
102
103
Koha::Search
104
Koha::Search::Engine::Zebra
105
106
=head1 AUTHOR
107
108
Jared Camins-Esakov, C & P Bibliography Services, E<lt>jcamins@cpbibliography.comE<gt>
109
110
=cut
111
112
1;
113
114
__END__
(-)a/Koha/Search/Engine/Zebra.pm (+261 lines)
Line 0 Link Here
1
package Koha::Search::Engine::Zebra;
2
3
# Copyright 2011 C & P Bibliography Services
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use strict;
21
use warnings;
22
23
use base qw(Koha::Search::Engine);
24
25
sub new {
26
    my $class = shift;
27
28
    my $self = {};
29
    bless $self, $class;
30
    return $self;
31
}
32
33
sub add_to_index_queue {
34
    my ( $self, $indexnumber, $op, $server ) = @_;
35
    my $dbh = C4::Context->dbh;
36
37
    #
38
    # we use zebra, just fill zebraqueue table
39
    #
40
    my $check_sql = "SELECT COUNT(*) FROM zebraqueue
41
        WHERE server = ?
42
        AND   biblio_auth_number = ?
43
        AND   operation = ?
44
        AND   done = 0";
45
    my $check_sth = $dbh->prepare_cached($check_sql);
46
    $check_sth->execute( $server, $indexnumber, $op );
47
    my ($count) = $check_sth->fetchrow_array;
48
    $check_sth->finish();
49
    if ( $count == 0 ) {
50
        my $sth = $dbh->prepare(
51
"INSERT INTO zebraqueue  (biblio_auth_number,server,operation) VALUES(?,?,?)"
52
        );
53
        $sth->execute( $indexnumber, $server, $op );
54
        $sth->finish;
55
    }
56
}
57
58
sub get_indexes {
59
    my @indexes = (
60
61
        # biblio indexes
62
        'ab',
63
        'Abstract',
64
        'acqdate',
65
        'allrecords',
66
        'an',
67
        'Any',
68
        'at',
69
        'au',
70
        'aub',
71
        'aud',
72
        'audience',
73
        'auo',
74
        'aut',
75
        'Author',
76
        'Author-in-order ',
77
        'Author-personal-bibliography',
78
        'Authority-Number',
79
        'authtype',
80
        'bc',
81
        'Bib-level',
82
        'biblionumber',
83
        'bio',
84
        'biography',
85
        'callnum',
86
        'cfn',
87
        'Chronological-subdivision',
88
        'cn-bib-source',
89
        'cn-bib-sort',
90
        'cn-class',
91
        'cn-item',
92
        'cn-prefix',
93
        'cn-suffix',
94
        'cpn',
95
        'Code-institution',
96
        'Conference-name',
97
        'Conference-name-heading',
98
        'Conference-name-see',
99
        'Conference-name-seealso',
100
        'Content-type',
101
        'Control-number',
102
        'copydate',
103
        'Corporate-name',
104
        'Corporate-name-heading',
105
        'Corporate-name-see',
106
        'Corporate-name-seealso',
107
        'ctype',
108
        'date-entered-on-file',
109
        'Date-of-acquisition',
110
        'Date-of-publication',
111
        'Dewey-classification',
112
        'EAN',
113
        'extent',
114
        'fic',
115
        'fiction',
116
        'Form-subdivision',
117
        'format',
118
        'Geographic-subdivision',
119
        'he',
120
        'Heading',
121
        'Heading-use-main-or-added-entry',
122
        'Heading-use-series-added-entry ',
123
        'Heading-use-subject-added-entry',
124
        'Host-item',
125
        'id-other',
126
        'Illustration-code',
127
        'ISBN',
128
        'isbn',
129
        'ISSN',
130
        'issn',
131
        'itemtype',
132
        'kw',
133
        'Koha-Auth-Number',
134
        'l-format',
135
        'language',
136
        'lc-card',
137
        'LC-card-number',
138
        'lcn',
139
        'llength',
140
        'ln',
141
        'Local-classification',
142
        'Local-number',
143
        'Match-heading',
144
        'Match-heading-see-from',
145
        'Material-type',
146
        'mc-itemtype',
147
        'mc-rtype',
148
        'mus',
149
        'name',
150
        'Music-number',
151
        'Name-geographic',
152
        'Name-geographic-heading',
153
        'Name-geographic-see',
154
        'Name-geographic-seealso',
155
        'nb',
156
        'Note',
157
        'notes',
158
        'ns',
159
        'nt',
160
        'pb',
161
        'Personal-name',
162
        'Personal-name-heading',
163
        'Personal-name-see',
164
        'Personal-name-seealso',
165
        'pl',
166
        'Place-publication',
167
        'pn',
168
        'popularity',
169
        'pubdate',
170
        'Publisher',
171
        'Record-control-number',
172
        'rcn',
173
        'Record-type',
174
        'rtype',
175
        'se',
176
        'See',
177
        'See-also',
178
        'sn',
179
        'Stock-number',
180
        'su',
181
        'Subject',
182
        'Subject-heading-thesaurus',
183
        'Subject-name-personal',
184
        'Subject-subdivision',
185
        'Summary',
186
        'Suppress',
187
        'su-geo',
188
        'su-na',
189
        'su-to',
190
        'su-ut',
191
        'ut',
192
        'UPC',
193
        'Term-genre-form',
194
        'Term-genre-form-heading',
195
        'Term-genre-form-see',
196
        'Term-genre-form-seealso',
197
        'ti',
198
        'Title',
199
        'Title-cover',
200
        'Title-series',
201
        'Title-host',
202
        'Title-uniform',
203
        'Title-uniform-heading',
204
        'Title-uniform-see',
205
        'Title-uniform-seealso',
206
        'totalissues',
207
        'yr',
208
209
        # items indexes
210
        'acqsource',
211
        'barcode',
212
        'bc',
213
        'branch',
214
        'ccode',
215
        'classification-source',
216
        'cn-sort',
217
        'coded-location-qualifier',
218
        'copynumber',
219
        'damaged',
220
        'datelastborrowed',
221
        'datelastseen',
222
        'holdingbranch',
223
        'homebranch',
224
        'issues',
225
        'item',
226
        'itemnumber',
227
        'itype',
228
        'Local-classification',
229
        'location',
230
        'lost',
231
        'materials-specified',
232
        'mc-ccode',
233
        'mc-itype',
234
        'mc-loc',
235
        'notforloan',
236
        'onloan',
237
        'price',
238
        'renewals',
239
        'replacementprice',
240
        'replacementpricedate',
241
        'reserves',
242
        'restricted',
243
        'stack',
244
        'stocknumber',
245
        'inv',
246
        'uri',
247
        'withdrawn',
248
249
        # subject related
250
    );
251
    return \@indexes;
252
}
253
254
1;
255
__END__
256
257
=head1 NAME
258
259
Koha::Search::Engine::Zebra - interface to Zebra as the search engine for Koha
260
261
=cut
(-)a/Koha/Utils.pm (+119 lines)
Line 0 Link Here
1
package Koha::Utils;
2
3
# Copyright 2011 C & P Bibliography Services
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use strict;
21
use warnings;
22
use C4::Context;
23
24
use vars qw($VERSION @ISA @EXPORT);
25
26
BEGIN {
27
    our $VERSION = 3.01;
28
    our $DEBUG = ( $ENV{DEBUG} ) ? 1 : 0;
29
}
30
31
=head1 NAME
32
33
Koha::Utils - Various utility functions for accessing a Koha instance's
34
configuration
35
36
=head1 SYNOPSIS
37
38
  use Koha::Utils;
39
40
=head1 DESCRIPTION
41
42
Various high-level utility functions for getting information about a Koha
43
instance's configuration options, to complement the low-level functions in
44
Koha::Context.
45
46
=head1 FUNCTIONS
47
48
=cut
49
50
require Exporter;
51
@ISA    = qw( Exporter );
52
@EXPORT = qw(
53
  &GetMarcFromKohaField
54
  &GetAuthType
55
);
56
57
=head2 GetMarcFromKohaField
58
59
  ($MARCfield,$MARCsubfield)=GetMarcFromKohaField($kohafield,$frameworkcode);
60
61
Returns the MARC fields & subfields mapped to the koha field
62
for the given frameworkcode
63
64
=cut
65
66
sub GetMarcFromKohaField {
67
    my ( $kohafield, $frameworkcode ) = @_;
68
    return 0, 0 unless $kohafield and defined $frameworkcode;
69
    my $relations = C4::Context->marcfromkohafield;
70
    return (
71
        $relations->{$frameworkcode}->{$kohafield}->[0],
72
        $relations->{$frameworkcode}->{$kohafield}->[1]
73
    );
74
}
75
76
=head2 GetAuthType
77
78
  $result = &GetAuthType($authtypecode)
79
80
If the authority type specified by C<$authtypecode> exists,
81
returns a hashref of the type's fields.  If the type
82
does not exist, returns undef.
83
84
=cut
85
86
sub GetAuthType {
87
    my ($authtypecode) = @_;
88
    my $dbh = C4::Context->dbh;
89
    my $sth;
90
    if ( defined $authtypecode )
91
    {    # NOTE - in MARC21 framework, '' is a valid authority
92
            # type (FIXME but why?)
93
        $sth = $dbh->prepare("select * from auth_types where authtypecode=?");
94
        $sth->execute($authtypecode);
95
        if ( my $res = $sth->fetchrow_hashref ) {
96
            return $res;
97
        }
98
    }
99
    return;
100
}
101
102
=head2 EXPORT
103
104
GetMarcFromKohaField
105
GetAuthType
106
107
=head1 SEE ALSO
108
109
Koha::Context
110
111
=head1 AUTHOR
112
113
Jared Camins-Esakov, C & P Bibliography Services, E<lt>jcamins@cpbibliography.comE<gt>
114
115
=cut
116
117
1;
118
119
__END__
(-)a/acqui/addorderiso2709.pl (+1 lines)
Lines 44-49 use C4::Bookseller qw/GetBookSellerFromId/; Link Here
44
use C4::Suggestions;    # GetSuggestion
44
use C4::Suggestions;    # GetSuggestion
45
use C4::Branch;         # GetBranches
45
use C4::Branch;         # GetBranches
46
use C4::Members;
46
use C4::Members;
47
use Koha::Utils;
47
48
48
my $input = new CGI;
49
my $input = new CGI;
49
my ($template, $loggedinuser, $cookie) = get_template_and_user({
50
my ($template, $loggedinuser, $cookie) = get_template_and_user({
(-)a/acqui/neworderempty.pl (+1 lines)
Lines 87-92 use C4::Koha; Link Here
87
use C4::Branch;			# GetBranches
87
use C4::Branch;			# GetBranches
88
use C4::Members;
88
use C4::Members;
89
use C4::Search qw/FindDuplicate/;
89
use C4::Search qw/FindDuplicate/;
90
use Koha::Utils;
90
91
91
#needed for z3950 import:
92
#needed for z3950 import:
92
use C4::ImportBatch qw/GetImportRecordMarc SetImportRecordStatus/;
93
use C4::ImportBatch qw/GetImportRecordMarc SetImportRecordStatus/;
(-)a/authorities/authorities.pl (+1 lines)
Lines 30-35 use Date::Calc qw(Today); Link Here
30
use MARC::File::USMARC;
30
use MARC::File::USMARC;
31
use MARC::File::XML;
31
use MARC::File::XML;
32
use C4::Biblio;
32
use C4::Biblio;
33
use Koha::Utils;
33
use vars qw( $tagslib);
34
use vars qw( $tagslib);
34
use vars qw( $authorised_values_sth);
35
use vars qw( $authorised_values_sth);
35
use vars qw( $is_a_modif );
36
use vars qw( $is_a_modif );
(-)a/authorities/blinddetail-biblio-search.pl (+1 lines)
Lines 46-51 use C4::Output; Link Here
46
use CGI;
46
use CGI;
47
use MARC::Record;
47
use MARC::Record;
48
use C4::Koha;
48
use C4::Koha;
49
use Koha::Utils;
49
50
50
my $query = new CGI;
51
my $query = new CGI;
51
52
(-)a/authorities/detail-biblio-search.pl (+1 lines)
Lines 47-52 use C4::Output; Link Here
47
use CGI;
47
use CGI;
48
use MARC::Record;
48
use MARC::Record;
49
use C4::Koha;
49
use C4::Koha;
50
use Koha::Utils;
50
# use C4::Biblio;
51
# use C4::Biblio;
51
# use C4::Catalogue;
52
# use C4::Catalogue;
52
53
(-)a/catalogue/MARCdetail.pl (+1 lines)
Lines 58-63 use C4::Acquisition; Link Here
58
use C4::Members; # to use GetMember
58
use C4::Members; # to use GetMember
59
use C4::Serials;    #uses getsubscriptionsfrombiblionumber GetSubscriptionsFromBiblionumber
59
use C4::Serials;    #uses getsubscriptionsfrombiblionumber GetSubscriptionsFromBiblionumber
60
use C4::Search;		# enabled_staff_search_views
60
use C4::Search;		# enabled_staff_search_views
61
use Koha::Utils;
61
62
62
63
63
my $query        = new CGI;
64
my $query        = new CGI;
(-)a/cataloguing/addbiblio.pl (+1 lines)
Lines 35-40 use C4::Branch; # XXX subfield_is_koha_internal_p Link Here
35
use C4::ClassSource;
35
use C4::ClassSource;
36
use C4::ImportBatch;
36
use C4::ImportBatch;
37
use C4::Charset;
37
use C4::Charset;
38
use Koha::Utils;
38
39
39
use Date::Calc qw(Today);
40
use Date::Calc qw(Today);
40
use MARC::File::USMARC;
41
use MARC::File::USMARC;
(-)a/cataloguing/additem.pl (+1 lines)
Lines 31-36 use C4::Koha; # XXX subfield_is_koha_internal_p Link Here
31
use C4::Branch; # XXX subfield_is_koha_internal_p
31
use C4::Branch; # XXX subfield_is_koha_internal_p
32
use C4::ClassSource;
32
use C4::ClassSource;
33
use C4::Dates;
33
use C4::Dates;
34
use Koha::Utils;
34
use List::MoreUtils qw/any/;
35
use List::MoreUtils qw/any/;
35
use C4::Search;
36
use C4::Search;
36
37
(-)a/cataloguing/value_builder/barcode.pl (+1 lines)
Lines 22-27 use warnings; Link Here
22
no warnings 'redefine'; # otherwise loading up multiple plugins fills the log with subroutine redefine warnings
22
no warnings 'redefine'; # otherwise loading up multiple plugins fills the log with subroutine redefine warnings
23
23
24
use C4::Context;
24
use C4::Context;
25
use Koha::Utils;
25
require C4::Dates;
26
require C4::Dates;
26
27
27
my $DEBUG = 0;
28
my $DEBUG = 0;
(-)a/cataloguing/value_builder/dateaccessioned.pl (+1 lines)
Lines 19-24 Link Here
19
19
20
use strict;
20
use strict;
21
use warnings;
21
use warnings;
22
use Koha::Utils;
22
23
23
=head1
24
=head1
24
25
(-)a/circ/branchoverdues.pl (+1 lines)
Lines 29-34 use C4::Debug; Link Here
29
use C4::Branch;
29
use C4::Branch;
30
use Koha::DateUtils;
30
use Koha::DateUtils;
31
use Data::Dumper;
31
use Data::Dumper;
32
use Koha::Utils;
32
33
33
=head1 branchoverdues.pl
34
=head1 branchoverdues.pl
34
35
(-)a/installer/data/mysql/atomicupdate/bug_7430_add_searchengine_syspref (+8 lines)
Line 0 Link Here
1
#! /usr/bin/perl
2
use strict;
3
use warnings;
4
use C4::Context;
5
my $dbh=C4::Context->dbh;
6
$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SearchEngine','Zebra','Chooses which search engine to use in Koha.','Zebra','Choice');");
7
$dbh->do("DELETE FROM systempreferences WHERE variable = 'NoZebra';");
8
print "Upgrade done (Configured bug 7430, added new SearchEngine syspref, removed NoZebra)\n";
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref (+7 lines)
Lines 1-6 Link Here
1
Searching:
1
Searching:
2
    Features:
2
    Features:
3
        -
3
        -
4
            - pref: SearchEngine
5
            - Use the
6
              choices:
7
                  Zebra: Zebra
8
                  NoZebra: NoZebra
9
            - search engine in Koha.
10
        -
4
            - pref: NoZebra
11
            - pref: NoZebra
5
              choices:
12
              choices:
6
                  yes: "Don't use"
13
                  yes: "Don't use"
(-)a/misc/batchImportMARCWithBiblionumbers.pl (+1 lines)
Lines 14-19 BEGIN { Link Here
14
14
15
use C4::Context;
15
use C4::Context;
16
use C4::Biblio;
16
use C4::Biblio;
17
use Koha::Utils;
17
use MARC::Record;
18
use MARC::Record;
18
use MARC::File::USMARC;
19
use MARC::File::USMARC;
19
use MARC::File::XML;
20
use MARC::File::XML;
(-)a/misc/batchRebuildBiblioTables.pl (+1 lines)
Lines 16-21 BEGIN { Link Here
16
use MARC::Record;
16
use MARC::Record;
17
use C4::Context;
17
use C4::Context;
18
use C4::Biblio;
18
use C4::Biblio;
19
use Koha::Utils;
19
use Time::HiRes qw(gettimeofday);
20
use Time::HiRes qw(gettimeofday);
20
21
21
use Getopt::Long;
22
use Getopt::Long;
(-)a/misc/migration_tools/22_to_30/missing090field.pl (+1 lines)
Lines 15-20 BEGIN { Link Here
15
15
16
use C4::Context;
16
use C4::Context;
17
use C4::Biblio;
17
use C4::Biblio;
18
use Koha::Utils;
18
use MARC::Record;
19
use MARC::Record;
19
use MARC::File::USMARC;
20
use MARC::File::USMARC;
20
21
(-)a/misc/migration_tools/bulkmarcimport.pl (+1 lines)
Lines 17-22 use MARC::File::XML; Link Here
17
use MARC::Record;
17
use MARC::Record;
18
use MARC::Batch;
18
use MARC::Batch;
19
use MARC::Charset;
19
use MARC::Charset;
20
use Koha::Utils;
20
21
21
use C4::Context;
22
use C4::Context;
22
use C4::Biblio;
23
use C4::Biblio;
(-)a/misc/migration_tools/merge_authority.pl (+1 lines)
Lines 15-20 use C4::Context; Link Here
15
use C4::Search;
15
use C4::Search;
16
use C4::Biblio;
16
use C4::Biblio;
17
use C4::AuthoritiesMarc;
17
use C4::AuthoritiesMarc;
18
use Koha::Utils;
18
use Time::HiRes qw(gettimeofday);
19
use Time::HiRes qw(gettimeofday);
19
20
20
use Getopt::Long;
21
use Getopt::Long;
(-)a/misc/migration_tools/rebuild_nozebra.pl (-4 / +6 lines)
Lines 2-9 Link Here
2
2
3
use C4::Context;
3
use C4::Context;
4
use Getopt::Long;
4
use Getopt::Long;
5
use C4::Search;
5
use C4::Biblio;
6
use C4::Biblio;
6
use C4::AuthoritiesMarc;
7
use C4::AuthoritiesMarc;
8
use Koha::Utils;
7
9
8
use strict;
10
use strict;
9
#use warnings; FIXME - Bug 2505
11
#use warnings; FIXME - Bug 2505
Lines 76-82 $dbh->do("update systempreferences set value=1 where variable='NoZebra'"); Link Here
76
78
77
$dbh->do("truncate nozebra");
79
$dbh->do("truncate nozebra");
78
80
79
my %index = GetNoZebraIndexes();
81
my %index = GetIndexes();
80
82
81
if  (!%index || $sysprefs ) {
83
if  (!%index || $sysprefs ) {
82
    if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
84
    if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
Lines 94-100 if (!%index || $sysprefs ) { Link Here
94
        'subject' => '600*,601*,606*,610*',
96
        'subject' => '600*,601*,606*,610*',
95
        'dewey' => '676a',
97
        'dewey' => '676a',
96
        'host-item' => '995a,995c',\" where variable='NoZebraIndexes'");
98
        'host-item' => '995a,995c',\" where variable='NoZebraIndexes'");
97
        %index = GetNoZebraIndexes();
99
        %index = GetIndexes();
98
    } elsif (C4::Context->preference('marcflavour') eq 'MARC21') {
100
    } elsif (C4::Context->preference('marcflavour') eq 'MARC21') {
99
        $dbh->do("UPDATE systempreferences SET value=\"
101
        $dbh->do("UPDATE systempreferences SET value=\"
100
'title' => '130a,210a,222a,240a,243a,245a,245b,246a,246b,247a,247b,250a,250b,440a,830a',
102
'title' => '130a,210a,222a,240a,243a,245a,245b,246a,246b,247a,247b,250a,250b,440a,830a',
Lines 118-124 if (!%index || $sysprefs ) { Link Here
118
'collection' => '9528',
120
'collection' => '9528',
119
\"WHERE variable='NoZebraIndexes'");
121
\"WHERE variable='NoZebraIndexes'");
120
122
121
        %index = GetNoZebraIndexes();
123
        %index = GetIndexes();
122
    }
124
    }
123
}
125
}
124
$|=1;
126
$|=1;
Lines 254-260 while (my ($authid) = $sth->fetchrow) { Link Here
254
    
256
    
255
    my %index;
257
    my %index;
256
    # for authorities, the "title" is the $a mainentry
258
    # for authorities, the "title" is the $a mainentry
257
    my $authref = C4::AuthoritiesMarc::GetAuthType(C4::AuthoritiesMarc::GetAuthTypeCode($authid));
259
    my $authref = GetAuthType(C4::AuthoritiesMarc::GetAuthTypeCode($authid));
258
260
259
    warn "ERROR : authtype undefined for ".$record->as_formatted unless $authref;
261
    warn "ERROR : authtype undefined for ".$record->as_formatted unless $authref;
260
    my $title = $record->subfield($authref->{auth_tag_to_report},'a');
262
    my $title = $record->subfield($authref->{auth_tag_to_report},'a');
(-)a/misc/migration_tools/rebuild_zebra.pl (+1 lines)
Lines 10-15 use File::Path; Link Here
10
use C4::Biblio;
10
use C4::Biblio;
11
use C4::AuthoritiesMarc;
11
use C4::AuthoritiesMarc;
12
use C4::Items;
12
use C4::Items;
13
use Koha::Utils;
13
14
14
# 
15
# 
15
# script that checks zebradir structure & create directories & mandatory files if needed
16
# script that checks zebradir structure & create directories & mandatory files if needed
(-)a/opac/opac-MARCdetail.pl (+1 lines)
Lines 52-57 use MARC::Record; Link Here
52
use C4::Biblio;
52
use C4::Biblio;
53
use C4::Acquisition;
53
use C4::Acquisition;
54
use C4::Koha;
54
use C4::Koha;
55
use Koha::Utils;
55
56
56
my $query = new CGI;
57
my $query = new CGI;
57
58
(-)a/opac/opac-authoritiesdetail.pl (+1 lines)
Lines 46-51 use C4::Output; Link Here
46
use CGI;
46
use CGI;
47
use MARC::Record;
47
use MARC::Record;
48
use C4::Koha;
48
use C4::Koha;
49
use Koha::Utils;
49
50
50
51
51
my $query = new CGI;
52
my $query = new CGI;
(-)a/serials/serials-edit.pl (+1 lines)
Lines 73-78 use C4::Output; Link Here
73
use C4::Context;
73
use C4::Context;
74
use C4::Serials;
74
use C4::Serials;
75
use C4::Search qw/enabled_staff_search_views/;
75
use C4::Search qw/enabled_staff_search_views/;
76
use Koha::Utils;
76
use List::MoreUtils qw/uniq/;
77
use List::MoreUtils qw/uniq/;
77
78
78
my $query           = CGI->new();
79
my $query           = CGI->new();
(-)a/svc/bib (+1 lines)
Lines 26-31 use CGI; Link Here
26
use C4::Auth qw/check_api_auth/;
26
use C4::Auth qw/check_api_auth/;
27
use C4::Biblio;
27
use C4::Biblio;
28
use C4::Items;
28
use C4::Items;
29
use Koha::Utils;
29
use XML::Simple;
30
use XML::Simple;
30
31
31
my $query = new CGI;
32
my $query = new CGI;
(-)a/svc/new_bib (+1 lines)
Lines 26-31 use C4::Auth qw/check_api_auth/; Link Here
26
use C4::Biblio;
26
use C4::Biblio;
27
use XML::Simple;
27
use XML::Simple;
28
use C4::Charset;
28
use C4::Charset;
29
use Koha::Utils;
29
30
30
my $query = new CGI;
31
my $query = new CGI;
31
binmode STDOUT, ':encoding(UTF-8)';
32
binmode STDOUT, ':encoding(UTF-8)';
(-)a/t/Koha_Search.t (+18 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
use strict;
4
use warnings;
5
6
use Test::More tests => 1;
7
8
BEGIN {
9
    use_ok('Koha::Search');
10
}
11
12
my @indexes = GetIndexes();
13
14
# We should probably check that GetIndexes returns 'Subject' or some other
15
# similarly crucial index
16
17
# We should probably check that AddRecordToIndexingQueue works somehow or
18
# other
(-)a/t/db_dependent/lib/KohaTest/AuthoritiesMarc.pm (-1 lines)
Lines 23-29 sub methods : Test( 1 ) { Link Here
23
                      ModAuthority 
23
                      ModAuthority 
24
                      GetAuthorityXML 
24
                      GetAuthorityXML 
25
                      GetAuthority 
25
                      GetAuthority 
26
                      GetAuthType 
27
                      FindDuplicateAuthority 
26
                      FindDuplicateAuthority 
28
                      BuildSummary
27
                      BuildSummary
29
                      BuildUnimarcHierarchies
28
                      BuildUnimarcHierarchies
(-)a/t/db_dependent/lib/KohaTest/Biblio/ModBiblio.pm (+1 lines)
Lines 8-13 use Test::More; Link Here
8
8
9
use C4::Biblio;
9
use C4::Biblio;
10
use C4::Items;
10
use C4::Items;
11
use Koha::Utils;
11
12
12
=head2 STARTUP METHODS
13
=head2 STARTUP METHODS
13
14
(-)a/t/db_dependent/lib/KohaTest/ImportBatch/BatchStageCommitRevert.pm (+1 lines)
Lines 9-14 use Test::More; Link Here
9
use C4::ImportBatch;
9
use C4::ImportBatch;
10
use C4::Matcher;
10
use C4::Matcher;
11
use C4::Biblio;
11
use C4::Biblio;
12
use Koha::Utils;
12
13
13
# define test records for various batches
14
# define test records for various batches
14
sub startup_60_make_test_records : Test( startup ) {
15
sub startup_60_make_test_records : Test( startup ) {
(-)a/tools/batchMod.pl (+1 lines)
Lines 33-38 use C4::BackgroundJob; Link Here
33
use C4::ClassSource;
33
use C4::ClassSource;
34
use C4::Dates;
34
use C4::Dates;
35
use C4::Debug;
35
use C4::Debug;
36
use Koha::Utils;
36
use MARC::File::XML;
37
use MARC::File::XML;
37
38
38
my $input = new CGI;
39
my $input = new CGI;
(-)a/tools/export.pl (-1 / +1 lines)
Lines 25-30 use C4::Biblio; # GetMarcBiblio GetXmlBiblio Link Here
25
use CGI;
25
use CGI;
26
use C4::Koha;    # GetItemTypes
26
use C4::Koha;    # GetItemTypes
27
use C4::Branch;  # GetBranches
27
use C4::Branch;  # GetBranches
28
use Koha::Utils;
28
29
29
my $query = new CGI;
30
my $query = new CGI;
30
my $op=$query->param("op") || '';
31
my $op=$query->param("op") || '';
31
- 

Return to bug 7430