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 87-93 BEGIN { Link Here
87
89
88
      &GetAuthorisedValueDesc
90
      &GetAuthorisedValueDesc
89
      &GetMarcStructure
91
      &GetMarcStructure
90
      &GetMarcFromKohaField
91
      &GetFrameworkCode
92
      &GetFrameworkCode
92
      &TransformKohaToMarc
93
      &TransformKohaToMarc
93
      &PrepHostMarcField
94
      &PrepHostMarcField
Lines 131-137 BEGIN { Link Here
131
      &TransformHtmlToMarc2
132
      &TransformHtmlToMarc2
132
      &TransformHtmlToMarc
133
      &TransformHtmlToMarc
133
      &TransformHtmlToXml
134
      &TransformHtmlToXml
134
      &GetNoZebraIndexes
135
      prepare_host_field
135
      prepare_host_field
136
    );
136
    );
137
}
137
}
Lines 449-455 sub DelBiblio { Link Here
449
        # the previous version of the record
449
        # the previous version of the record
450
        $oldRecord = GetMarcBiblio($biblionumber);
450
        $oldRecord = GetMarcBiblio($biblionumber);
451
    }
451
    }
452
    ModZebra( $biblionumber, "recordDelete", "biblioserver", $oldRecord, undef );
452
    AddToIndexQueue( $biblionumber, "recordDelete", "biblioserver", $oldRecord, undef );
453
453
454
    # delete biblioitems and items from Koha tables and save in deletedbiblioitems,deleteditems
454
    # delete biblioitems and items from Koha tables and save in deletedbiblioitems,deleteditems
455
    $sth = $dbh->prepare("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=?");
455
    $sth = $dbh->prepare("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=?");
Lines 1158-1182 sub GetUsedMarcStructure($) { Link Here
1158
    return $sth->fetchall_arrayref( {} );
1158
    return $sth->fetchall_arrayref( {} );
1159
}
1159
}
1160
1160
1161
=head2 GetMarcFromKohaField
1162
1163
  ($MARCfield,$MARCsubfield)=GetMarcFromKohaField($kohafield,$frameworkcode);
1164
1165
Returns the MARC fields & subfields mapped to the koha field 
1166
for the given frameworkcode
1167
1168
=cut
1169
1170
sub GetMarcFromKohaField {
1171
    my ( $kohafield, $frameworkcode ) = @_;
1172
    return (0, undef) unless $kohafield and defined $frameworkcode;
1173
    my $relations = C4::Context->marcfromkohafield;
1174
    if ( my $mf = $relations->{$frameworkcode}->{$kohafield} ) {
1175
        return @$mf;
1176
    }
1177
    return (0, undef);
1178
}
1179
1180
=head2 GetMarcBiblio
1161
=head2 GetMarcBiblio
1181
1162
1182
  my $record = GetMarcBiblio($biblionumber, [$embeditems]);
1163
  my $record = GetMarcBiblio($biblionumber, [$embeditems]);
Lines 2603-2744 sub TransformMarcToKohaOneField { Link Here
2603
}
2584
}
2604
2585
2605
2586
2606
#"
2607
2608
#
2609
# true ModZebra commented until indexdata fixes zebraDB crashes (it seems they occur on multiple updates
2610
# at the same time
2611
# replaced by a zebraqueue table, that is filled with ModZebra to run.
2612
# the table is emptied by misc/cronjobs/zebraqueue_start.pl script
2613
# =head2 ModZebrafiles
2614
#
2615
# &ModZebrafiles( $dbh, $biblionumber, $record, $folder, $server );
2616
#
2617
# =cut
2618
#
2619
# sub ModZebrafiles {
2620
#
2621
#     my ( $dbh, $biblionumber, $record, $folder, $server ) = @_;
2622
#
2623
#     my $op;
2624
#     my $zebradir =
2625
#       C4::Context->zebraconfig($server)->{directory} . "/" . $folder . "/";
2626
#     unless ( opendir( DIR, "$zebradir" ) ) {
2627
#         warn "$zebradir not found";
2628
#         return;
2629
#     }
2630
#     closedir DIR;
2631
#     my $filename = $zebradir . $biblionumber;
2632
#
2633
#     if ($record) {
2634
#         open( OUTPUT, ">", $filename . ".xml" );
2635
#         print OUTPUT $record;
2636
#         close OUTPUT;
2637
#     }
2638
# }
2639
2640
=head2 ModZebra
2587
=head2 ModZebra
2641
2588
2642
  ModZebra( $biblionumber, $op, $server, $oldRecord, $newRecord );
2589
This method should not be used. The functionality has been moved to
2643
2590
Koha::Search::AddToIndexQueue. It is left here as a temporary wrapper
2644
$biblionumber is the biblionumber we want to index
2591
to simplify the migration of custom scripts.
2645
2646
$op is specialUpdate or delete, and is used to know what we want to do
2647
2648
$server is the server that we want to update
2649
2650
$oldRecord is the MARC::Record containing the previous version of the record.  This is used only when 
2651
NoZebra=1, as NoZebra indexing needs to know the previous version of a record in order to
2652
do an update.
2653
2654
$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.
2655
2592
2656
=cut
2593
=cut
2657
2594
2658
sub ModZebra {
2595
sub ModZebra {
2659
###Accepts a $server variable thus we can use it for biblios authorities or other zebra dbs
2596
    AddToIndexQueue(@_)
2660
    my ( $biblionumber, $op, $server, $oldRecord, $newRecord ) = @_;
2661
    my $dbh = C4::Context->dbh;
2662
2663
    # true ModZebra commented until indexdata fixes zebraDB crashes (it seems they occur on multiple updates
2664
    # at the same time
2665
    # replaced by a zebraqueue table, that is filled with ModZebra to run.
2666
    # the table is emptied by misc/cronjobs/zebraqueue_start.pl script
2667
2668
    if ( C4::Context->preference("NoZebra") ) {
2669
2670
        # lock the nozebra table : we will read index lines, update them in Perl process
2671
        # and write everything in 1 transaction.
2672
        # lock the table to avoid someone else overwriting what we are doing
2673
        $dbh->do('LOCK TABLES nozebra WRITE,biblio WRITE,biblioitems WRITE, systempreferences WRITE, auth_types WRITE, auth_header WRITE, auth_subfield_structure READ');
2674
        my %result;    # the result hash that will be built by deletion / add, and written on mySQL at the end, to improve speed
2675
        if ( $op eq 'specialUpdate' ) {
2676
2677
            # OK, we have to add or update the record
2678
            # 1st delete (virtually, in indexes), if record actually exists
2679
            if ($oldRecord) {
2680
                %result = _DelBiblioNoZebra( $biblionumber, $oldRecord, $server );
2681
            }
2682
2683
            # ... add the record
2684
            %result = _AddBiblioNoZebra( $biblionumber, $newRecord, $server, %result );
2685
        } else {
2686
2687
            # it's a deletion, delete the record...
2688
            # warn "DELETE the record $biblionumber on $server".$record->as_formatted;
2689
            %result = _DelBiblioNoZebra( $biblionumber, $oldRecord, $server );
2690
        }
2691
2692
        # ok, now update the database...
2693
        my $sth = $dbh->prepare("UPDATE nozebra SET biblionumbers=? WHERE server=? AND indexname=? AND value=?");
2694
        foreach my $key ( keys %result ) {
2695
            foreach my $index ( keys %{ $result{$key} } ) {
2696
                $sth->execute( $result{$key}->{$index}, $server, $key, $index );
2697
            }
2698
        }
2699
        $dbh->do('UNLOCK TABLES');
2700
    } else {
2701
2702
        #
2703
        # we use zebra, just fill zebraqueue table
2704
        #
2705
        my $check_sql = "SELECT COUNT(*) FROM zebraqueue 
2706
                         WHERE server = ?
2707
                         AND   biblio_auth_number = ?
2708
                         AND   operation = ?
2709
                         AND   done = 0";
2710
        my $check_sth = $dbh->prepare_cached($check_sql);
2711
        $check_sth->execute( $server, $biblionumber, $op );
2712
        my ($count) = $check_sth->fetchrow_array;
2713
        $check_sth->finish();
2714
        if ( $count == 0 ) {
2715
            my $sth = $dbh->prepare("INSERT INTO zebraqueue  (biblio_auth_number,server,operation) VALUES(?,?,?)");
2716
            $sth->execute( $biblionumber, $server, $op );
2717
            $sth->finish;
2718
        }
2719
    }
2720
}
2721
2722
=head2 GetNoZebraIndexes
2723
2724
  %indexes = GetNoZebraIndexes;
2725
2726
return the data from NoZebraIndexes syspref.
2727
2728
=cut
2729
2730
sub GetNoZebraIndexes {
2731
    my $no_zebra_indexes = C4::Context->preference('NoZebraIndexes');
2732
    my %indexes;
2733
  INDEX: foreach my $line ( split /['"],[\n\r]*/, $no_zebra_indexes ) {
2734
        $line =~ /(.*)=>(.*)/;
2735
        my $index  = $1;    # initial ' or " is removed afterwards
2736
        my $fields = $2;
2737
        $index  =~ s/'|"|\s//g;
2738
        $fields =~ s/'|"|\s//g;
2739
        $indexes{$index} = $fields;
2740
    }
2741
    return %indexes;
2742
}
2597
}
2743
2598
2744
=head2 EmbedItemsInMarcBiblio
2599
=head2 EmbedItemsInMarcBiblio
Lines 2774-3041 sub EmbedItemsInMarcBiblio { Link Here
2774
2629
2775
=head1 INTERNAL FUNCTIONS
2630
=head1 INTERNAL FUNCTIONS
2776
2631
2777
=head2 _DelBiblioNoZebra($biblionumber,$record,$server);
2778
2779
function to delete a biblio in NoZebra indexes
2780
This function does NOT delete anything in database : it reads all the indexes entries
2781
that have to be deleted & delete them in the hash
2782
2783
The SQL part is done either :
2784
 - after the Add if we are modifying a biblio (delete + add again)
2785
 - immediatly after this sub if we are doing a true deletion.
2786
2787
$server can be 'biblioserver' or 'authorityserver' : it indexes biblios or authorities (in the same table, $server being part of the table itself
2788
2789
=cut
2790
2791
sub _DelBiblioNoZebra {
2792
    my ( $biblionumber, $record, $server ) = @_;
2793
2794
    # Get the indexes
2795
    my $dbh = C4::Context->dbh;
2796
2797
    # Get the indexes
2798
    my %index;
2799
    my $title;
2800
    if ( $server eq 'biblioserver' ) {
2801
        %index = GetNoZebraIndexes;
2802
2803
        # get title of the record (to store the 10 first letters with the index)
2804
        my ( $titletag, $titlesubfield ) = GetMarcFromKohaField( 'biblio.title', '' );    # FIXME: should be GetFrameworkCode($biblionumber) ??
2805
        $title = lc( $record->subfield( $titletag, $titlesubfield ) );
2806
    } else {
2807
2808
        # for authorities, the "title" is the $a mainentry
2809
        my ( $auth_type_tag, $auth_type_sf ) = C4::AuthoritiesMarc::get_auth_type_location();
2810
        my $authref = C4::AuthoritiesMarc::GetAuthType( $record->subfield( $auth_type_tag, $auth_type_sf ) );
2811
        warn "ERROR : authtype undefined for " . $record->as_formatted unless $authref;
2812
        $title = $record->subfield( $authref->{auth_tag_to_report}, 'a' );
2813
        $index{'mainmainentry'} = $authref->{'auth_tag_to_report'} . 'a';
2814
        $index{'mainentry'}     = $authref->{'auth_tag_to_report'} . '*';
2815
        $index{'auth_type'}     = "${auth_type_tag}${auth_type_sf}";
2816
    }
2817
2818
    my %result;
2819
2820
    # remove blancks comma (that could cause problem when decoding the string for CQL retrieval) and regexp specific values
2821
    $title =~ s/ |,|;|\[|\]|\(|\)|\*|-|'|=//g;
2822
2823
    # limit to 10 char, should be enough, and limit the DB size
2824
    $title = substr( $title, 0, 10 );
2825
2826
    #parse each field
2827
    my $sth2 = $dbh->prepare('SELECT biblionumbers FROM nozebra WHERE server=? AND indexname=? AND value=?');
2828
    foreach my $field ( $record->fields() ) {
2829
2830
        #parse each subfield
2831
        next if $field->tag < 10;
2832
        foreach my $subfield ( $field->subfields() ) {
2833
            my $tag          = $field->tag();
2834
            my $subfieldcode = $subfield->[0];
2835
            my $indexed      = 0;
2836
2837
            # check each index to see if the subfield is stored somewhere
2838
            # otherwise, store it in __RAW__ index
2839
            foreach my $key ( keys %index ) {
2840
2841
                #                 warn "examining $key index : ".$index{$key}." for $tag $subfieldcode";
2842
                if ( $index{$key} =~ /$tag\*/ or $index{$key} =~ /$tag$subfieldcode/ ) {
2843
                    $indexed = 1;
2844
                    my $line = lc $subfield->[1];
2845
2846
                    # remove meaningless value in the field...
2847
                    $line =~ s/-|\.|\?|,|;|!|'|\(|\)|\[|\]|{|}|"|<|>|&|\+|\*|\/|=|:/ /g;
2848
2849
                    # ... and split in words
2850
                    foreach ( split / /, $line ) {
2851
                        next unless $_;    # skip  empty values (multiple spaces)
2852
                                           # if the entry is already here, do nothing, the biblionumber has already be removed
2853
                        unless ( defined( $result{$key}->{$_} ) && ( $result{$key}->{$_} =~ /$biblionumber,$title\-(\d);/ ) ) {
2854
2855
                            # get the index value if it exist in the nozebra table and remove the entry, otherwise, do nothing
2856
                            $sth2->execute( $server, $key, $_ );
2857
                            my $existing_biblionumbers = $sth2->fetchrow;
2858
2859
                            # it exists
2860
                            if ($existing_biblionumbers) {
2861
2862
                                #                                 warn " existing for $key $_: $existing_biblionumbers";
2863
                                $result{$key}->{$_} = $existing_biblionumbers;
2864
                                $result{$key}->{$_} =~ s/$biblionumber,$title\-(\d);//;
2865
                            }
2866
                        }
2867
                    }
2868
                }
2869
            }
2870
2871
            # the subfield is not indexed, store it in __RAW__ index anyway
2872
            unless ($indexed) {
2873
                my $line = lc $subfield->[1];
2874
                $line =~ s/-|\.|\?|,|;|!|'|\(|\)|\[|\]|{|}|"|<|>|&|\+|\*|\/|=|:/ /g;
2875
2876
                # ... and split in words
2877
                foreach ( split / /, $line ) {
2878
                    next unless $_;    # skip  empty values (multiple spaces)
2879
                                       # if the entry is already here, do nothing, the biblionumber has already be removed
2880
                    unless ( $result{'__RAW__'}->{$_} =~ /$biblionumber,$title\-(\d);/ ) {
2881
2882
                        # get the index value if it exist in the nozebra table and remove the entry, otherwise, do nothing
2883
                        $sth2->execute( $server, '__RAW__', $_ );
2884
                        my $existing_biblionumbers = $sth2->fetchrow;
2885
2886
                        # it exists
2887
                        if ($existing_biblionumbers) {
2888
                            $result{'__RAW__'}->{$_} = $existing_biblionumbers;
2889
                            $result{'__RAW__'}->{$_} =~ s/$biblionumber,$title\-(\d);//;
2890
                        }
2891
                    }
2892
                }
2893
            }
2894
        }
2895
    }
2896
    return %result;
2897
}
2898
2899
=head2 _AddBiblioNoZebra
2900
2901
  _AddBiblioNoZebra($biblionumber, $record, $server, %result);
2902
2903
function to add a biblio in NoZebra indexes
2904
2905
=cut
2906
2907
sub _AddBiblioNoZebra {
2908
    my ( $biblionumber, $record, $server, %result ) = @_;
2909
    my $dbh = C4::Context->dbh;
2910
2911
    # Get the indexes
2912
    my %index;
2913
    my $title;
2914
    if ( $server eq 'biblioserver' ) {
2915
        %index = GetNoZebraIndexes;
2916
2917
        # get title of the record (to store the 10 first letters with the index)
2918
        my ( $titletag, $titlesubfield ) = GetMarcFromKohaField( 'biblio.title', '' );    # FIXME: should be GetFrameworkCode($biblionumber) ??
2919
        $title = lc( $record->subfield( $titletag, $titlesubfield ) );
2920
    } else {
2921
2922
        # warn "server : $server";
2923
        # for authorities, the "title" is the $a mainentry
2924
        my ( $auth_type_tag, $auth_type_sf ) = C4::AuthoritiesMarc::get_auth_type_location();
2925
        my $authref = C4::AuthoritiesMarc::GetAuthType( $record->subfield( $auth_type_tag, $auth_type_sf ) );
2926
        warn "ERROR : authtype undefined for " . $record->as_formatted unless $authref;
2927
        $title = $record->subfield( $authref->{auth_tag_to_report}, 'a' );
2928
        $index{'mainmainentry'} = $authref->{auth_tag_to_report} . 'a';
2929
        $index{'mainentry'}     = $authref->{auth_tag_to_report} . '*';
2930
        $index{'auth_type'}     = "${auth_type_tag}${auth_type_sf}";
2931
    }
2932
2933
    # remove blancks comma (that could cause problem when decoding the string for CQL retrieval) and regexp specific values
2934
    $title =~ s/ |\.|,|;|\[|\]|\(|\)|\*|-|'|:|=|\r|\n//g;
2935
2936
    # limit to 10 char, should be enough, and limit the DB size
2937
    $title = substr( $title, 0, 10 );
2938
2939
    #parse each field
2940
    my $sth2 = $dbh->prepare('SELECT biblionumbers FROM nozebra WHERE server=? AND indexname=? AND value=?');
2941
    foreach my $field ( $record->fields() ) {
2942
2943
        #parse each subfield
2944
        ###FIXME: impossible to index a 001-009 value with NoZebra
2945
        next if $field->tag < 10;
2946
        foreach my $subfield ( $field->subfields() ) {
2947
            my $tag          = $field->tag();
2948
            my $subfieldcode = $subfield->[0];
2949
            my $indexed      = 0;
2950
2951
            #             warn "INDEXING :".$subfield->[1];
2952
            # check each index to see if the subfield is stored somewhere
2953
            # otherwise, store it in __RAW__ index
2954
            foreach my $key ( keys %index ) {
2955
2956
                #                 warn "examining $key index : ".$index{$key}." for $tag $subfieldcode";
2957
                if ( $index{$key} =~ /$tag\*/ or $index{$key} =~ /$tag$subfieldcode/ ) {
2958
                    $indexed = 1;
2959
                    my $line = lc $subfield->[1];
2960
2961
                    # remove meaningless value in the field...
2962
                    $line =~ s/-|\.|\?|,|;|!|'|\(|\)|\[|\]|{|}|"|<|>|&|\+|\*|\/|=|:|\r|\n/ /g;
2963
2964
                    # ... and split in words
2965
                    foreach ( split / /, $line ) {
2966
                        next unless $_;    # skip  empty values (multiple spaces)
2967
                                           # if the entry is already here, improve weight
2968
2969
                        #                         warn "managing $_";
2970
                        if ( exists $result{$key}->{$_} && $result{$key}->{"$_"} =~ /$biblionumber,\Q$title\E\-(\d+);/ ) {
2971
                            my $weight = $1 + 1;
2972
                            $result{$key}->{"$_"} =~ s/$biblionumber,\Q$title\E\-(\d+);//g;
2973
                            $result{$key}->{"$_"} .= "$biblionumber,$title-$weight;";
2974
                        } else {
2975
2976
                            # get the value if it exist in the nozebra table, otherwise, create it
2977
                            $sth2->execute( $server, $key, $_ );
2978
                            my $existing_biblionumbers = $sth2->fetchrow;
2979
2980
                            # it exists
2981
                            if ($existing_biblionumbers) {
2982
                                $result{$key}->{"$_"} = $existing_biblionumbers;
2983
                                my $weight = defined $1 ? $1 + 1 : 1;
2984
                                $result{$key}->{"$_"} =~ s/$biblionumber,\Q$title\E\-(\d+);//g;
2985
                                $result{$key}->{"$_"} .= "$biblionumber,$title-$weight;";
2986
2987
                                # create a new ligne for this entry
2988
                            } else {
2989
2990
                                #                             warn "INSERT : $server / $key / $_";
2991
                                $dbh->do( 'INSERT INTO nozebra SET server=' . $dbh->quote($server) . ', indexname=' . $dbh->quote($key) . ',value=' . $dbh->quote($_) );
2992
                                $result{$key}->{"$_"} .= "$biblionumber,$title-1;";
2993
                            }
2994
                        }
2995
                    }
2996
                }
2997
            }
2998
2999
            # the subfield is not indexed, store it in __RAW__ index anyway
3000
            unless ($indexed) {
3001
                my $line = lc $subfield->[1];
3002
                $line =~ s/-|\.|\?|,|;|!|'|\(|\)|\[|\]|{|}|"|<|>|&|\+|\*|\/|=|:|\r|\n/ /g;
3003
3004
                # ... and split in words
3005
                foreach ( split / /, $line ) {
3006
                    next unless $_;    # skip  empty values (multiple spaces)
3007
                                       # if the entry is already here, improve weight
3008
                    my $tmpstr = $result{'__RAW__'}->{"$_"} || "";
3009
                    if ( $tmpstr =~ /$biblionumber,\Q$title\E\-(\d+);/ ) {
3010
                        my $weight = $1 + 1;
3011
                        $result{'__RAW__'}->{"$_"} =~ s/$biblionumber,\Q$title\E\-(\d+);//;
3012
                        $result{'__RAW__'}->{"$_"} .= "$biblionumber,$title-$weight;";
3013
                    } else {
3014
3015
                        # get the value if it exist in the nozebra table, otherwise, create it
3016
                        $sth2->execute( $server, '__RAW__', $_ );
3017
                        my $existing_biblionumbers = $sth2->fetchrow;
3018
3019
                        # it exists
3020
                        if ($existing_biblionumbers) {
3021
                            $result{'__RAW__'}->{"$_"} = $existing_biblionumbers;
3022
                            my $weight = ( $1 ? $1 : 0 ) + 1;
3023
                            $result{'__RAW__'}->{"$_"} =~ s/$biblionumber,\Q$title\E\-(\d+);//;
3024
                            $result{'__RAW__'}->{"$_"} .= "$biblionumber,$title-$weight;";
3025
3026
                            # create a new ligne for this entry
3027
                        } else {
3028
                            $dbh->do( 'INSERT INTO nozebra SET server=' . $dbh->quote($server) . ',  indexname="__RAW__",value=' . $dbh->quote($_) );
3029
                            $result{'__RAW__'}->{"$_"} .= "$biblionumber,$title-1;";
3030
                        }
3031
                    }
3032
                }
3033
            }
3034
        }
3035
    }
3036
    return %result;
3037
}
3038
3039
=head2 _koha_marc_update_bib_ids
2632
=head2 _koha_marc_update_bib_ids
3040
2633
3041
2634
Lines 3519-3525 sub ModBiblioMarc { Link Here
3519
    $sth = $dbh->prepare("UPDATE biblioitems SET marc=?,marcxml=? WHERE biblionumber=?");
3112
    $sth = $dbh->prepare("UPDATE biblioitems SET marc=?,marcxml=? WHERE biblionumber=?");
3520
    $sth->execute( $record->as_usmarc(), $record->as_xml_record($encoding), $biblionumber );
3113
    $sth->execute( $record->as_usmarc(), $record->as_xml_record($encoding), $biblionumber );
3521
    $sth->finish;
3114
    $sth->finish;
3522
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", $oldRecord, $record );
3115
    AddToIndexQueue( $biblionumber, "specialUpdate", "biblioserver", $oldRecord, $record );
3523
    return $biblionumber;
3116
    return $biblionumber;
3524
}
3117
}
3525
3118
(-)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 30-35 use MARC::Record; Link Here
30
use C4::ClassSource;
30
use C4::ClassSource;
31
use C4::Log;
31
use C4::Log;
32
use List::MoreUtils qw/any/;
32
use List::MoreUtils qw/any/;
33
use Koha::Utils;
34
use Koha::Search;
33
use Data::Dumper; # used as part of logging item record changes, not just for
35
use Data::Dumper; # used as part of logging item record changes, not just for
34
                  # debugging; so please don't remove this
36
                  # debugging; so please don't remove this
35
37
Lines 268-274 sub AddItem { Link Here
268
	my ( $itemnumber, $error ) = _koha_new_item( $item, $item->{barcode} );
270
	my ( $itemnumber, $error ) = _koha_new_item( $item, $item->{barcode} );
269
    $item->{'itemnumber'} = $itemnumber;
271
    $item->{'itemnumber'} = $itemnumber;
270
272
271
    ModZebra( $item->{biblionumber}, "specialUpdate", "biblioserver", undef, undef );
273
    AddToIndexQueue( $item->{biblionumber}, "specialUpdate", "biblioserver", undef, undef );
272
   
274
   
273
    logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog");
275
    logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog");
274
    
276
    
Lines 521-527 sub ModItem { Link Here
521
523
522
    # request that bib be reindexed so that searching on current
524
    # request that bib be reindexed so that searching on current
523
    # item status is possible
525
    # item status is possible
524
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", undef, undef );
526
    AddToIndexQueue( $biblionumber, "specialUpdate", "biblioserver", undef, undef );
525
527
526
    logaction("CATALOGUING", "MODIFY", $itemnumber, Dumper($item)) if C4::Context->preference("CataloguingLog");
528
    logaction("CATALOGUING", "MODIFY", $itemnumber, Dumper($item)) if C4::Context->preference("CataloguingLog");
527
}
529
}
Lines 584-590 sub DelItem { Link Here
584
586
585
    # get the MARC record
587
    # get the MARC record
586
    my $record = GetMarcBiblio($biblionumber);
588
    my $record = GetMarcBiblio($biblionumber);
587
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", undef, undef );
589
    AddToIndexQueue( $biblionumber, "specialUpdate", "biblioserver", undef, undef );
588
590
589
    # backup the record
591
    # backup the record
590
    my $copy2deleted = $dbh->prepare("UPDATE deleteditems SET marc=? WHERE itemnumber=?");
592
    my $copy2deleted = $dbh->prepare("UPDATE deleteditems SET marc=? WHERE itemnumber=?");
Lines 2172-2179 sub MoveItemFromBiblio { Link Here
2172
    $sth = $dbh->prepare("UPDATE items SET biblioitemnumber = ?, biblionumber = ? WHERE itemnumber = ? AND biblionumber = ?");
2174
    $sth = $dbh->prepare("UPDATE items SET biblioitemnumber = ?, biblionumber = ? WHERE itemnumber = ? AND biblionumber = ?");
2173
    my $return = $sth->execute($tobiblioitem, $tobiblio, $itemnumber, $frombiblio);
2175
    my $return = $sth->execute($tobiblioitem, $tobiblio, $itemnumber, $frombiblio);
2174
    if ($return == 1) {
2176
    if ($return == 1) {
2175
        ModZebra( $tobiblio, "specialUpdate", "biblioserver", undef, undef );
2177
        AddToIndexQueue( $tobiblio, "specialUpdate", "biblioserver", undef, undef );
2176
        ModZebra( $frombiblio, "specialUpdate", "biblioserver", undef, undef );
2178
        AddToIndexQueue( $frombiblio, "specialUpdate", "biblioserver", undef, undef );
2177
	    # Checking if the item we want to move is in an order 
2179
	    # Checking if the item we want to move is in an order 
2178
        require C4::Acquisition;
2180
        require C4::Acquisition;
2179
        my $order = C4::Acquisition::GetOrderFromItemnumber($itemnumber);
2181
        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 28-33 use C4::Koha; Link Here
28
use C4::Debug;
28
use C4::Debug;
29
use C4::Branch;
29
use C4::Branch;
30
use Data::Dumper;
30
use Data::Dumper;
31
use Koha::Utils;
31
32
32
=head1 branchoverdues.pl
33
=head1 branchoverdues.pl
33
34
(-)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