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 746-752 sub AddAuthority { Link Here
746
    $sth->finish;
747
    $sth->finish;
747
    logaction( "AUTHORITIES", "ADD", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog");
748
    logaction( "AUTHORITIES", "ADD", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog");
748
  }
749
  }
749
  ModZebra($authid,'specialUpdate',"authorityserver",$oldRecord,$record);
750
  AddToIndexQueue($authid,'specialUpdate',"authorityserver",$oldRecord,$record);
750
  return ($authid);
751
  return ($authid);
751
}
752
}
752
753
Lines 764-770 sub DelAuthority { Link Here
764
    my $dbh=C4::Context->dbh;
765
    my $dbh=C4::Context->dbh;
765
766
766
    logaction( "AUTHORITIES", "DELETE", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog");
767
    logaction( "AUTHORITIES", "DELETE", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog");
767
    ModZebra($authid,"recordDelete","authorityserver",GetAuthority($authid),undef);
768
    AddToIndexQueue($authid,"recordDelete","authorityserver",GetAuthority($authid),undef);
768
    my $sth = $dbh->prepare("DELETE FROM auth_header WHERE authid=?");
769
    my $sth = $dbh->prepare("DELETE FROM auth_header WHERE authid=?");
769
    $sth->execute($authid);
770
    $sth->execute($authid);
770
}
771
}
Lines 856-886 sub GetAuthority { Link Here
856
    return ($record);
857
    return ($record);
857
}
858
}
858
859
859
=head2 GetAuthType 
860
861
  $result = &GetAuthType($authtypecode)
862
863
If the authority type specified by C<$authtypecode> exists,
864
returns a hashref of the type's fields.  If the type
865
does not exist, returns undef.
866
867
=cut
868
869
sub GetAuthType {
870
    my ($authtypecode) = @_;
871
    my $dbh=C4::Context->dbh;
872
    my $sth;
873
    if (defined $authtypecode){ # NOTE - in MARC21 framework, '' is a valid authority 
874
                                # type (FIXME but why?)
875
        $sth=$dbh->prepare("select * from auth_types where authtypecode=?");
876
        $sth->execute($authtypecode);
877
        if (my $res = $sth->fetchrow_hashref) {
878
            return $res; 
879
        }
880
    }
881
    return;
882
}
883
884
860
885
=head2 FindDuplicateAuthority
861
=head2 FindDuplicateAuthority
886
862
(-)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
    );
135
    );
136
}
136
}
137
137
Lines 441-447 sub DelBiblio { Link Here
441
        # the previous version of the record
441
        # the previous version of the record
442
        $oldRecord = GetMarcBiblio($biblionumber);
442
        $oldRecord = GetMarcBiblio($biblionumber);
443
    }
443
    }
444
    ModZebra( $biblionumber, "recordDelete", "biblioserver", $oldRecord, undef );
444
    AddToIndexQueue( $biblionumber, "recordDelete", "biblioserver", $oldRecord, undef );
445
445
446
    # delete biblioitems and items from Koha tables and save in deletedbiblioitems,deleteditems
446
    # delete biblioitems and items from Koha tables and save in deletedbiblioitems,deleteditems
447
    $sth = $dbh->prepare("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=?");
447
    $sth = $dbh->prepare("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=?");
Lines 1147-1171 sub GetUsedMarcStructure($) { Link Here
1147
    return $sth->fetchall_arrayref( {} );
1147
    return $sth->fetchall_arrayref( {} );
1148
}
1148
}
1149
1149
1150
=head2 GetMarcFromKohaField
1151
1152
  ($MARCfield,$MARCsubfield)=GetMarcFromKohaField($kohafield,$frameworkcode);
1153
1154
Returns the MARC fields & subfields mapped to the koha field 
1155
for the given frameworkcode
1156
1157
=cut
1158
1159
sub GetMarcFromKohaField {
1160
    my ( $kohafield, $frameworkcode ) = @_;
1161
    return (0, undef) unless $kohafield and defined $frameworkcode;
1162
    my $relations = C4::Context->marcfromkohafield;
1163
    if ( my $mf = $relations->{$frameworkcode}->{$kohafield} ) {
1164
        return @$mf;
1165
    }
1166
    return (0, undef);
1167
}
1168
1169
=head2 GetMarcBiblio
1150
=head2 GetMarcBiblio
1170
1151
1171
  my $record = GetMarcBiblio($biblionumber, [$embeditems]);
1152
  my $record = GetMarcBiblio($biblionumber, [$embeditems]);
Lines 2592-2733 sub TransformMarcToKohaOneField { Link Here
2592
}
2573
}
2593
2574
2594
2575
2595
#"
2596
2597
#
2598
# true ModZebra commented until indexdata fixes zebraDB crashes (it seems they occur on multiple updates
2599
# at the same time
2600
# replaced by a zebraqueue table, that is filled with ModZebra to run.
2601
# the table is emptied by misc/cronjobs/zebraqueue_start.pl script
2602
# =head2 ModZebrafiles
2603
#
2604
# &ModZebrafiles( $dbh, $biblionumber, $record, $folder, $server );
2605
#
2606
# =cut
2607
#
2608
# sub ModZebrafiles {
2609
#
2610
#     my ( $dbh, $biblionumber, $record, $folder, $server ) = @_;
2611
#
2612
#     my $op;
2613
#     my $zebradir =
2614
#       C4::Context->zebraconfig($server)->{directory} . "/" . $folder . "/";
2615
#     unless ( opendir( DIR, "$zebradir" ) ) {
2616
#         warn "$zebradir not found";
2617
#         return;
2618
#     }
2619
#     closedir DIR;
2620
#     my $filename = $zebradir . $biblionumber;
2621
#
2622
#     if ($record) {
2623
#         open( OUTPUT, ">", $filename . ".xml" );
2624
#         print OUTPUT $record;
2625
#         close OUTPUT;
2626
#     }
2627
# }
2628
2629
=head2 ModZebra
2576
=head2 ModZebra
2630
2577
2631
  ModZebra( $biblionumber, $op, $server, $oldRecord, $newRecord );
2578
This method should not be used. The functionality has been moved to
2632
2579
Koha::Search::AddToIndexQueue. It is left here as a temporary wrapper
2633
$biblionumber is the biblionumber we want to index
2580
to simplify the migration of custom scripts.
2634
2635
$op is specialUpdate or delete, and is used to know what we want to do
2636
2637
$server is the server that we want to update
2638
2639
$oldRecord is the MARC::Record containing the previous version of the record.  This is used only when 
2640
NoZebra=1, as NoZebra indexing needs to know the previous version of a record in order to
2641
do an update.
2642
2643
$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.
2644
2581
2645
=cut
2582
=cut
2646
2583
2647
sub ModZebra {
2584
sub ModZebra {
2648
###Accepts a $server variable thus we can use it for biblios authorities or other zebra dbs
2585
    AddToIndexQueue(@_)
2649
    my ( $biblionumber, $op, $server, $oldRecord, $newRecord ) = @_;
2650
    my $dbh = C4::Context->dbh;
2651
2652
    # true ModZebra commented until indexdata fixes zebraDB crashes (it seems they occur on multiple updates
2653
    # at the same time
2654
    # replaced by a zebraqueue table, that is filled with ModZebra to run.
2655
    # the table is emptied by misc/cronjobs/zebraqueue_start.pl script
2656
2657
    if ( C4::Context->preference("NoZebra") ) {
2658
2659
        # lock the nozebra table : we will read index lines, update them in Perl process
2660
        # and write everything in 1 transaction.
2661
        # lock the table to avoid someone else overwriting what we are doing
2662
        $dbh->do('LOCK TABLES nozebra WRITE,biblio WRITE,biblioitems WRITE, systempreferences WRITE, auth_types WRITE, auth_header WRITE, auth_subfield_structure READ');
2663
        my %result;    # the result hash that will be built by deletion / add, and written on mySQL at the end, to improve speed
2664
        if ( $op eq 'specialUpdate' ) {
2665
2666
            # OK, we have to add or update the record
2667
            # 1st delete (virtually, in indexes), if record actually exists
2668
            if ($oldRecord) {
2669
                %result = _DelBiblioNoZebra( $biblionumber, $oldRecord, $server );
2670
            }
2671
2672
            # ... add the record
2673
            %result = _AddBiblioNoZebra( $biblionumber, $newRecord, $server, %result );
2674
        } else {
2675
2676
            # it's a deletion, delete the record...
2677
            # warn "DELETE the record $biblionumber on $server".$record->as_formatted;
2678
            %result = _DelBiblioNoZebra( $biblionumber, $oldRecord, $server );
2679
        }
2680
2681
        # ok, now update the database...
2682
        my $sth = $dbh->prepare("UPDATE nozebra SET biblionumbers=? WHERE server=? AND indexname=? AND value=?");
2683
        foreach my $key ( keys %result ) {
2684
            foreach my $index ( keys %{ $result{$key} } ) {
2685
                $sth->execute( $result{$key}->{$index}, $server, $key, $index );
2686
            }
2687
        }
2688
        $dbh->do('UNLOCK TABLES');
2689
    } else {
2690
2691
        #
2692
        # we use zebra, just fill zebraqueue table
2693
        #
2694
        my $check_sql = "SELECT COUNT(*) FROM zebraqueue 
2695
                         WHERE server = ?
2696
                         AND   biblio_auth_number = ?
2697
                         AND   operation = ?
2698
                         AND   done = 0";
2699
        my $check_sth = $dbh->prepare_cached($check_sql);
2700
        $check_sth->execute( $server, $biblionumber, $op );
2701
        my ($count) = $check_sth->fetchrow_array;
2702
        $check_sth->finish();
2703
        if ( $count == 0 ) {
2704
            my $sth = $dbh->prepare("INSERT INTO zebraqueue  (biblio_auth_number,server,operation) VALUES(?,?,?)");
2705
            $sth->execute( $biblionumber, $server, $op );
2706
            $sth->finish;
2707
        }
2708
    }
2709
}
2710
2711
=head2 GetNoZebraIndexes
2712
2713
  %indexes = GetNoZebraIndexes;
2714
2715
return the data from NoZebraIndexes syspref.
2716
2717
=cut
2718
2719
sub GetNoZebraIndexes {
2720
    my $no_zebra_indexes = C4::Context->preference('NoZebraIndexes');
2721
    my %indexes;
2722
  INDEX: foreach my $line ( split /['"],[\n\r]*/, $no_zebra_indexes ) {
2723
        $line =~ /(.*)=>(.*)/;
2724
        my $index  = $1;    # initial ' or " is removed afterwards
2725
        my $fields = $2;
2726
        $index  =~ s/'|"|\s//g;
2727
        $fields =~ s/'|"|\s//g;
2728
        $indexes{$index} = $fields;
2729
    }
2730
    return %indexes;
2731
}
2586
}
2732
2587
2733
=head2 EmbedItemsInMarcBiblio
2588
=head2 EmbedItemsInMarcBiblio
Lines 2763-3030 sub EmbedItemsInMarcBiblio { Link Here
2763
2618
2764
=head1 INTERNAL FUNCTIONS
2619
=head1 INTERNAL FUNCTIONS
2765
2620
2766
=head2 _DelBiblioNoZebra($biblionumber,$record,$server);
2767
2768
function to delete a biblio in NoZebra indexes
2769
This function does NOT delete anything in database : it reads all the indexes entries
2770
that have to be deleted & delete them in the hash
2771
2772
The SQL part is done either :
2773
 - after the Add if we are modifying a biblio (delete + add again)
2774
 - immediatly after this sub if we are doing a true deletion.
2775
2776
$server can be 'biblioserver' or 'authorityserver' : it indexes biblios or authorities (in the same table, $server being part of the table itself
2777
2778
=cut
2779
2780
sub _DelBiblioNoZebra {
2781
    my ( $biblionumber, $record, $server ) = @_;
2782
2783
    # Get the indexes
2784
    my $dbh = C4::Context->dbh;
2785
2786
    # Get the indexes
2787
    my %index;
2788
    my $title;
2789
    if ( $server eq 'biblioserver' ) {
2790
        %index = GetNoZebraIndexes;
2791
2792
        # get title of the record (to store the 10 first letters with the index)
2793
        my ( $titletag, $titlesubfield ) = GetMarcFromKohaField( 'biblio.title', '' );    # FIXME: should be GetFrameworkCode($biblionumber) ??
2794
        $title = lc( $record->subfield( $titletag, $titlesubfield ) );
2795
    } else {
2796
2797
        # for authorities, the "title" is the $a mainentry
2798
        my ( $auth_type_tag, $auth_type_sf ) = C4::AuthoritiesMarc::get_auth_type_location();
2799
        my $authref = C4::AuthoritiesMarc::GetAuthType( $record->subfield( $auth_type_tag, $auth_type_sf ) );
2800
        warn "ERROR : authtype undefined for " . $record->as_formatted unless $authref;
2801
        $title = $record->subfield( $authref->{auth_tag_to_report}, 'a' );
2802
        $index{'mainmainentry'} = $authref->{'auth_tag_to_report'} . 'a';
2803
        $index{'mainentry'}     = $authref->{'auth_tag_to_report'} . '*';
2804
        $index{'auth_type'}     = "${auth_type_tag}${auth_type_sf}";
2805
    }
2806
2807
    my %result;
2808
2809
    # remove blancks comma (that could cause problem when decoding the string for CQL retrieval) and regexp specific values
2810
    $title =~ s/ |,|;|\[|\]|\(|\)|\*|-|'|=//g;
2811
2812
    # limit to 10 char, should be enough, and limit the DB size
2813
    $title = substr( $title, 0, 10 );
2814
2815
    #parse each field
2816
    my $sth2 = $dbh->prepare('SELECT biblionumbers FROM nozebra WHERE server=? AND indexname=? AND value=?');
2817
    foreach my $field ( $record->fields() ) {
2818
2819
        #parse each subfield
2820
        next if $field->tag < 10;
2821
        foreach my $subfield ( $field->subfields() ) {
2822
            my $tag          = $field->tag();
2823
            my $subfieldcode = $subfield->[0];
2824
            my $indexed      = 0;
2825
2826
            # check each index to see if the subfield is stored somewhere
2827
            # otherwise, store it in __RAW__ index
2828
            foreach my $key ( keys %index ) {
2829
2830
                #                 warn "examining $key index : ".$index{$key}." for $tag $subfieldcode";
2831
                if ( $index{$key} =~ /$tag\*/ or $index{$key} =~ /$tag$subfieldcode/ ) {
2832
                    $indexed = 1;
2833
                    my $line = lc $subfield->[1];
2834
2835
                    # remove meaningless value in the field...
2836
                    $line =~ s/-|\.|\?|,|;|!|'|\(|\)|\[|\]|{|}|"|<|>|&|\+|\*|\/|=|:/ /g;
2837
2838
                    # ... and split in words
2839
                    foreach ( split / /, $line ) {
2840
                        next unless $_;    # skip  empty values (multiple spaces)
2841
                                           # if the entry is already here, do nothing, the biblionumber has already be removed
2842
                        unless ( defined( $result{$key}->{$_} ) && ( $result{$key}->{$_} =~ /$biblionumber,$title\-(\d);/ ) ) {
2843
2844
                            # get the index value if it exist in the nozebra table and remove the entry, otherwise, do nothing
2845
                            $sth2->execute( $server, $key, $_ );
2846
                            my $existing_biblionumbers = $sth2->fetchrow;
2847
2848
                            # it exists
2849
                            if ($existing_biblionumbers) {
2850
2851
                                #                                 warn " existing for $key $_: $existing_biblionumbers";
2852
                                $result{$key}->{$_} = $existing_biblionumbers;
2853
                                $result{$key}->{$_} =~ s/$biblionumber,$title\-(\d);//;
2854
                            }
2855
                        }
2856
                    }
2857
                }
2858
            }
2859
2860
            # the subfield is not indexed, store it in __RAW__ index anyway
2861
            unless ($indexed) {
2862
                my $line = lc $subfield->[1];
2863
                $line =~ s/-|\.|\?|,|;|!|'|\(|\)|\[|\]|{|}|"|<|>|&|\+|\*|\/|=|:/ /g;
2864
2865
                # ... and split in words
2866
                foreach ( split / /, $line ) {
2867
                    next unless $_;    # skip  empty values (multiple spaces)
2868
                                       # if the entry is already here, do nothing, the biblionumber has already be removed
2869
                    unless ( $result{'__RAW__'}->{$_} =~ /$biblionumber,$title\-(\d);/ ) {
2870
2871
                        # get the index value if it exist in the nozebra table and remove the entry, otherwise, do nothing
2872
                        $sth2->execute( $server, '__RAW__', $_ );
2873
                        my $existing_biblionumbers = $sth2->fetchrow;
2874
2875
                        # it exists
2876
                        if ($existing_biblionumbers) {
2877
                            $result{'__RAW__'}->{$_} = $existing_biblionumbers;
2878
                            $result{'__RAW__'}->{$_} =~ s/$biblionumber,$title\-(\d);//;
2879
                        }
2880
                    }
2881
                }
2882
            }
2883
        }
2884
    }
2885
    return %result;
2886
}
2887
2888
=head2 _AddBiblioNoZebra
2889
2890
  _AddBiblioNoZebra($biblionumber, $record, $server, %result);
2891
2892
function to add a biblio in NoZebra indexes
2893
2894
=cut
2895
2896
sub _AddBiblioNoZebra {
2897
    my ( $biblionumber, $record, $server, %result ) = @_;
2898
    my $dbh = C4::Context->dbh;
2899
2900
    # Get the indexes
2901
    my %index;
2902
    my $title;
2903
    if ( $server eq 'biblioserver' ) {
2904
        %index = GetNoZebraIndexes;
2905
2906
        # get title of the record (to store the 10 first letters with the index)
2907
        my ( $titletag, $titlesubfield ) = GetMarcFromKohaField( 'biblio.title', '' );    # FIXME: should be GetFrameworkCode($biblionumber) ??
2908
        $title = lc( $record->subfield( $titletag, $titlesubfield ) );
2909
    } else {
2910
2911
        # warn "server : $server";
2912
        # for authorities, the "title" is the $a mainentry
2913
        my ( $auth_type_tag, $auth_type_sf ) = C4::AuthoritiesMarc::get_auth_type_location();
2914
        my $authref = C4::AuthoritiesMarc::GetAuthType( $record->subfield( $auth_type_tag, $auth_type_sf ) );
2915
        warn "ERROR : authtype undefined for " . $record->as_formatted unless $authref;
2916
        $title = $record->subfield( $authref->{auth_tag_to_report}, 'a' );
2917
        $index{'mainmainentry'} = $authref->{auth_tag_to_report} . 'a';
2918
        $index{'mainentry'}     = $authref->{auth_tag_to_report} . '*';
2919
        $index{'auth_type'}     = "${auth_type_tag}${auth_type_sf}";
2920
    }
2921
2922
    # remove blancks comma (that could cause problem when decoding the string for CQL retrieval) and regexp specific values
2923
    $title =~ s/ |\.|,|;|\[|\]|\(|\)|\*|-|'|:|=|\r|\n//g;
2924
2925
    # limit to 10 char, should be enough, and limit the DB size
2926
    $title = substr( $title, 0, 10 );
2927
2928
    #parse each field
2929
    my $sth2 = $dbh->prepare('SELECT biblionumbers FROM nozebra WHERE server=? AND indexname=? AND value=?');
2930
    foreach my $field ( $record->fields() ) {
2931
2932
        #parse each subfield
2933
        ###FIXME: impossible to index a 001-009 value with NoZebra
2934
        next if $field->tag < 10;
2935
        foreach my $subfield ( $field->subfields() ) {
2936
            my $tag          = $field->tag();
2937
            my $subfieldcode = $subfield->[0];
2938
            my $indexed      = 0;
2939
2940
            #             warn "INDEXING :".$subfield->[1];
2941
            # check each index to see if the subfield is stored somewhere
2942
            # otherwise, store it in __RAW__ index
2943
            foreach my $key ( keys %index ) {
2944
2945
                #                 warn "examining $key index : ".$index{$key}." for $tag $subfieldcode";
2946
                if ( $index{$key} =~ /$tag\*/ or $index{$key} =~ /$tag$subfieldcode/ ) {
2947
                    $indexed = 1;
2948
                    my $line = lc $subfield->[1];
2949
2950
                    # remove meaningless value in the field...
2951
                    $line =~ s/-|\.|\?|,|;|!|'|\(|\)|\[|\]|{|}|"|<|>|&|\+|\*|\/|=|:|\r|\n/ /g;
2952
2953
                    # ... and split in words
2954
                    foreach ( split / /, $line ) {
2955
                        next unless $_;    # skip  empty values (multiple spaces)
2956
                                           # if the entry is already here, improve weight
2957
2958
                        #                         warn "managing $_";
2959
                        if ( exists $result{$key}->{$_} && $result{$key}->{"$_"} =~ /$biblionumber,\Q$title\E\-(\d+);/ ) {
2960
                            my $weight = $1 + 1;
2961
                            $result{$key}->{"$_"} =~ s/$biblionumber,\Q$title\E\-(\d+);//g;
2962
                            $result{$key}->{"$_"} .= "$biblionumber,$title-$weight;";
2963
                        } else {
2964
2965
                            # get the value if it exist in the nozebra table, otherwise, create it
2966
                            $sth2->execute( $server, $key, $_ );
2967
                            my $existing_biblionumbers = $sth2->fetchrow;
2968
2969
                            # it exists
2970
                            if ($existing_biblionumbers) {
2971
                                $result{$key}->{"$_"} = $existing_biblionumbers;
2972
                                my $weight = defined $1 ? $1 + 1 : 1;
2973
                                $result{$key}->{"$_"} =~ s/$biblionumber,\Q$title\E\-(\d+);//g;
2974
                                $result{$key}->{"$_"} .= "$biblionumber,$title-$weight;";
2975
2976
                                # create a new ligne for this entry
2977
                            } else {
2978
2979
                                #                             warn "INSERT : $server / $key / $_";
2980
                                $dbh->do( 'INSERT INTO nozebra SET server=' . $dbh->quote($server) . ', indexname=' . $dbh->quote($key) . ',value=' . $dbh->quote($_) );
2981
                                $result{$key}->{"$_"} .= "$biblionumber,$title-1;";
2982
                            }
2983
                        }
2984
                    }
2985
                }
2986
            }
2987
2988
            # the subfield is not indexed, store it in __RAW__ index anyway
2989
            unless ($indexed) {
2990
                my $line = lc $subfield->[1];
2991
                $line =~ s/-|\.|\?|,|;|!|'|\(|\)|\[|\]|{|}|"|<|>|&|\+|\*|\/|=|:|\r|\n/ /g;
2992
2993
                # ... and split in words
2994
                foreach ( split / /, $line ) {
2995
                    next unless $_;    # skip  empty values (multiple spaces)
2996
                                       # if the entry is already here, improve weight
2997
                    my $tmpstr = $result{'__RAW__'}->{"$_"} || "";
2998
                    if ( $tmpstr =~ /$biblionumber,\Q$title\E\-(\d+);/ ) {
2999
                        my $weight = $1 + 1;
3000
                        $result{'__RAW__'}->{"$_"} =~ s/$biblionumber,\Q$title\E\-(\d+);//;
3001
                        $result{'__RAW__'}->{"$_"} .= "$biblionumber,$title-$weight;";
3002
                    } else {
3003
3004
                        # get the value if it exist in the nozebra table, otherwise, create it
3005
                        $sth2->execute( $server, '__RAW__', $_ );
3006
                        my $existing_biblionumbers = $sth2->fetchrow;
3007
3008
                        # it exists
3009
                        if ($existing_biblionumbers) {
3010
                            $result{'__RAW__'}->{"$_"} = $existing_biblionumbers;
3011
                            my $weight = ( $1 ? $1 : 0 ) + 1;
3012
                            $result{'__RAW__'}->{"$_"} =~ s/$biblionumber,\Q$title\E\-(\d+);//;
3013
                            $result{'__RAW__'}->{"$_"} .= "$biblionumber,$title-$weight;";
3014
3015
                            # create a new ligne for this entry
3016
                        } else {
3017
                            $dbh->do( 'INSERT INTO nozebra SET server=' . $dbh->quote($server) . ',  indexname="__RAW__",value=' . $dbh->quote($_) );
3018
                            $result{'__RAW__'}->{"$_"} .= "$biblionumber,$title-1;";
3019
                        }
3020
                    }
3021
                }
3022
            }
3023
        }
3024
    }
3025
    return %result;
3026
}
3027
3028
=head2 _koha_marc_update_bib_ids
2621
=head2 _koha_marc_update_bib_ids
3029
2622
3030
2623
Lines 3505-3511 sub ModBiblioMarc { Link Here
3505
    $sth = $dbh->prepare("UPDATE biblioitems SET marc=?,marcxml=? WHERE biblionumber=?");
3098
    $sth = $dbh->prepare("UPDATE biblioitems SET marc=?,marcxml=? WHERE biblionumber=?");
3506
    $sth->execute( $record->as_usmarc(), $record->as_xml_record($encoding), $biblionumber );
3099
    $sth->execute( $record->as_usmarc(), $record->as_xml_record($encoding), $biblionumber );
3507
    $sth->finish;
3100
    $sth->finish;
3508
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", $oldRecord, $record );
3101
    AddToIndexQueue( $biblionumber, "specialUpdate", "biblioserver", $oldRecord, $record );
3509
    return $biblionumber;
3102
    return $biblionumber;
3510
}
3103
}
3511
3104
(-)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 518-524 sub ModItem { Link Here
518
520
519
    # request that bib be reindexed so that searching on current
521
    # request that bib be reindexed so that searching on current
520
    # item status is possible
522
    # item status is possible
521
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", undef, undef );
523
    AddToIndexQueue( $biblionumber, "specialUpdate", "biblioserver", undef, undef );
522
524
523
    logaction("CATALOGUING", "MODIFY", $itemnumber, Dumper($item)) if C4::Context->preference("CataloguingLog");
525
    logaction("CATALOGUING", "MODIFY", $itemnumber, Dumper($item)) if C4::Context->preference("CataloguingLog");
524
}
526
}
Lines 581-587 sub DelItem { Link Here
581
583
582
    # get the MARC record
584
    # get the MARC record
583
    my $record = GetMarcBiblio($biblionumber);
585
    my $record = GetMarcBiblio($biblionumber);
584
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", undef, undef );
586
    AddToIndexQueue( $biblionumber, "specialUpdate", "biblioserver", undef, undef );
585
587
586
    # backup the record
588
    # backup the record
587
    my $copy2deleted = $dbh->prepare("UPDATE deleteditems SET marc=? WHERE itemnumber=?");
589
    my $copy2deleted = $dbh->prepare("UPDATE deleteditems SET marc=? WHERE itemnumber=?");
Lines 2167-2174 sub MoveItemFromBiblio { Link Here
2167
    $sth = $dbh->prepare("UPDATE items SET biblioitemnumber = ?, biblionumber = ? WHERE itemnumber = ? AND biblionumber = ?");
2169
    $sth = $dbh->prepare("UPDATE items SET biblioitemnumber = ?, biblionumber = ? WHERE itemnumber = ? AND biblionumber = ?");
2168
    my $return = $sth->execute($tobiblioitem, $tobiblio, $itemnumber, $frombiblio);
2170
    my $return = $sth->execute($tobiblioitem, $tobiblio, $itemnumber, $frombiblio);
2169
    if ($return == 1) {
2171
    if ($return == 1) {
2170
        ModZebra( $tobiblio, "specialUpdate", "biblioserver", undef, undef );
2172
        AddToIndexQueue( $tobiblio, "specialUpdate", "biblioserver", undef, undef );
2171
        ModZebra( $frombiblio, "specialUpdate", "biblioserver", undef, undef );
2173
        AddToIndexQueue( $frombiblio, "specialUpdate", "biblioserver", undef, undef );
2172
	    # Checking if the item we want to move is in an order 
2174
	    # Checking if the item we want to move is in an order 
2173
        require C4::Acquisition;
2175
        require C4::Acquisition;
2174
        my $order = C4::Acquisition::GetOrderFromItemnumber($itemnumber);
2176
        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 808-1015 sub _build_weighted_query { Link Here
808
    return $weighted_query;
810
    return $weighted_query;
809
}
811
}
810
812
811
=head2 getIndexes
812
813
Return an array with available indexes.
814
815
=cut
816
817
sub getIndexes{
818
    my @indexes = (
819
                    # biblio indexes
820
                    'ab',
821
                    'Abstract',
822
                    'acqdate',
823
                    'allrecords',
824
                    'an',
825
                    'Any',
826
                    'at',
827
                    'au',
828
                    'aub',
829
                    'aud',
830
                    'audience',
831
                    'auo',
832
                    'aut',
833
                    'Author',
834
                    'Author-in-order ',
835
                    'Author-personal-bibliography',
836
                    'Authority-Number',
837
                    'authtype',
838
                    'bc',
839
		    'Bib-level',
840
                    'biblionumber',
841
                    'bio',
842
                    'biography',
843
                    'callnum',
844
                    'cfn',
845
                    'Chronological-subdivision',
846
                    'cn-bib-source',
847
                    'cn-bib-sort',
848
                    'cn-class',
849
                    'cn-item',
850
                    'cn-prefix',
851
                    'cn-suffix',
852
                    'cpn',
853
                    'Code-institution',
854
                    'Conference-name',
855
                    'Conference-name-heading',
856
                    'Conference-name-see',
857
                    'Conference-name-seealso',
858
                    'Content-type',
859
                    'Control-number',
860
                    'copydate',
861
                    'Corporate-name',
862
                    'Corporate-name-heading',
863
                    'Corporate-name-see',
864
                    'Corporate-name-seealso',
865
                    'ctype',
866
                    'date-entered-on-file',
867
                    'Date-of-acquisition',
868
                    'Date-of-publication',
869
                    'Dewey-classification',
870
                    'EAN',
871
                    'extent',
872
                    'fic',
873
                    'fiction',
874
                    'Form-subdivision',
875
                    'format',
876
                    'Geographic-subdivision',
877
                    'he',
878
                    'Heading',
879
                    'Heading-use-main-or-added-entry',
880
                    'Heading-use-series-added-entry ',
881
                    'Heading-use-subject-added-entry',
882
                    'Host-item',
883
                    'id-other',
884
                    'Illustration-code',
885
                    'ISBN',
886
                    'isbn',
887
                    'ISSN',
888
                    'issn',
889
                    'itemtype',
890
                    'kw',
891
                    'Koha-Auth-Number',
892
                    'l-format',
893
                    'language',
894
                    'lc-card',
895
                    'LC-card-number',
896
                    'lcn',
897
                    'llength',
898
                    'ln',
899
                    'Local-classification',
900
                    'Local-number',
901
                    'Match-heading',
902
                    'Match-heading-see-from',
903
                    'Material-type',
904
                    'mc-itemtype',
905
                    'mc-rtype',
906
                    'mus',
907
                    'name',
908
                    'Music-number',
909
                    'Name-geographic',
910
                    'Name-geographic-heading',
911
                    'Name-geographic-see',
912
                    'Name-geographic-seealso',
913
                    'nb',
914
                    'Note',
915
                    'notes',
916
                    'ns',
917
                    'nt',
918
                    'pb',
919
                    'Personal-name',
920
                    'Personal-name-heading',
921
                    'Personal-name-see',
922
                    'Personal-name-seealso',
923
                    'pl',
924
                    'Place-publication',
925
                    'pn',
926
                    'popularity',
927
                    'pubdate',
928
                    'Publisher',
929
                    'Record-control-number',
930
                    'rcn',
931
                    'Record-type',
932
                    'rtype',
933
                    'se',
934
                    'See',
935
                    'See-also',
936
                    'sn',
937
                    'Stock-number',
938
                    'su',
939
                    'Subject',
940
                    'Subject-heading-thesaurus',
941
                    'Subject-name-personal',
942
                    'Subject-subdivision',
943
                    'Summary',
944
                    'Suppress',
945
                    'su-geo',
946
                    'su-na',
947
                    'su-to',
948
                    'su-ut',
949
                    'ut',
950
                    'UPC',
951
                    'Term-genre-form',
952
                    'Term-genre-form-heading',
953
                    'Term-genre-form-see',
954
                    'Term-genre-form-seealso',
955
                    'ti',
956
                    'Title',
957
                    'Title-cover',
958
                    'Title-series',
959
                    'Title-host',
960
                    'Title-uniform',
961
                    'Title-uniform-heading',
962
                    'Title-uniform-see',
963
                    'Title-uniform-seealso',
964
                    'totalissues',
965
                    'yr',
966
967
                    # items indexes
968
                    'acqsource',
969
                    'barcode',
970
                    'bc',
971
                    'branch',
972
                    'ccode',
973
                    'classification-source',
974
                    'cn-sort',
975
                    'coded-location-qualifier',
976
                    'copynumber',
977
                    'damaged',
978
                    'datelastborrowed',
979
                    'datelastseen',
980
                    'holdingbranch',
981
                    'homebranch',
982
                    'issues',
983
                    'item',
984
                    'itemnumber',
985
                    'itype',
986
                    'Local-classification',
987
                    'location',
988
                    'lost',
989
                    'materials-specified',
990
                    'mc-ccode',
991
                    'mc-itype',
992
                    'mc-loc',
993
                    'notforloan',
994
                    'onloan',
995
                    'price',
996
                    'renewals',
997
                    'replacementprice',
998
                    'replacementpricedate',
999
                    'reserves',
1000
                    'restricted',
1001
                    'stack',
1002
                    'stocknumber',
1003
                    'inv',
1004
                    'uri',
1005
                    'withdrawn',
1006
1007
                    # subject related
1008
                  );
1009
1010
    return \@indexes;
1011
}
1012
1013
=head2 buildQuery
813
=head2 buildQuery
1014
814
1015
( $error, $query,
815
( $error, $query,
Lines 1067-1073 sub buildQuery { Link Here
1067
    my $stopwords_removed;    # flag to determine if stopwords have been removed
867
    my $stopwords_removed;    # flag to determine if stopwords have been removed
1068
868
1069
    my $cclq       = 0;
869
    my $cclq       = 0;
1070
    my $cclindexes = getIndexes();
870
    my $cclindexes = GetIndexes();
1071
    if ( $query !~ /\s*ccl=/ ) {
871
    if ( $query !~ /\s*ccl=/ ) {
1072
        while ( !$cclq && $query =~ /(?:^|\W)([\w-]+)(,[\w-]+)*[:=]/g ) {
872
        while ( !$cclq && $query =~ /(?:^|\W)([\w-]+)(,[\w-]+)*[:=]/g ) {
1073
            my $dx = lc($1);
873
            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 (+113 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
69
@ISA    = qw(Exporter);
70
@EXPORT = qw(
71
    &AddToIndexQueue
72
    &GetIndexes
73
);
74
75
our $search_engine;
76
77
sub AddToIndexQueue {
78
    if (!(C4::Context->preference('SearchEngine')=~/IndexOff/i)){ # solr allows disabling indexing
79
        return $search_engine->add_to_index_queue( @_ );
80
    }
81
    return undef;
82
}
83
84
=head2 GetIndexes
85
86
  @indexes = GetIndexes;
87
88
Return a list of indexes provided by the active search engine
89
90
=cut
91
92
sub GetIndexes {
93
    return $search_engine->get_indexes( @_ );
94
}
95
96
=head2 EXPORT
97
98
AddToIndexQueue
99
GetIndexes
100
101
=head1 SEE ALSO
102
103
Koha::Search::Engine::Zebra
104
105
=head1 AUTHOR
106
107
Jared Camins-Esakov, C & P Bibliography Services, E<lt>jcamins@cpbibliography.comE<gt>
108
109
=cut
110
111
1;
112
113
__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 (+257 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
# we use zebra, just fill zebraqueue table
38
#
39
    my $check_sql = "SELECT COUNT(*) FROM zebraqueue
40
        WHERE server = ?
41
        AND   biblio_auth_number = ?
42
        AND   operation = ?
43
        AND   done = 0";
44
    my $check_sth = $dbh->prepare_cached($check_sql);
45
    $check_sth->execute( $server, $indexnumber, $op );
46
    my ($count) = $check_sth->fetchrow_array;
47
    $check_sth->finish();
48
    if ( $count == 0 ) {
49
        my $sth = $dbh->prepare("INSERT INTO zebraqueue  (biblio_auth_number,server,operation) VALUES(?,?,?)");
50
        $sth->execute( $indexnumber, $server, $op );
51
        $sth->finish;
52
    }
53
}
54
55
sub get_indexes {
56
    my @indexes = (
57
                    # biblio indexes
58
                    'ab',
59
                    'Abstract',
60
                    'acqdate',
61
                    'allrecords',
62
                    'an',
63
                    'Any',
64
                    'at',
65
                    'au',
66
                    'aub',
67
                    'aud',
68
                    'audience',
69
                    'auo',
70
                    'aut',
71
                    'Author',
72
                    'Author-in-order ',
73
                    'Author-personal-bibliography',
74
                    'Authority-Number',
75
                    'authtype',
76
                    'bc',
77
		    'Bib-level',
78
                    'biblionumber',
79
                    'bio',
80
                    'biography',
81
                    'callnum',
82
                    'cfn',
83
                    'Chronological-subdivision',
84
                    'cn-bib-source',
85
                    'cn-bib-sort',
86
                    'cn-class',
87
                    'cn-item',
88
                    'cn-prefix',
89
                    'cn-suffix',
90
                    'cpn',
91
                    'Code-institution',
92
                    'Conference-name',
93
                    'Conference-name-heading',
94
                    'Conference-name-see',
95
                    'Conference-name-seealso',
96
                    'Content-type',
97
                    'Control-number',
98
                    'copydate',
99
                    'Corporate-name',
100
                    'Corporate-name-heading',
101
                    'Corporate-name-see',
102
                    'Corporate-name-seealso',
103
                    'ctype',
104
                    'date-entered-on-file',
105
                    'Date-of-acquisition',
106
                    'Date-of-publication',
107
                    'Dewey-classification',
108
                    'EAN',
109
                    'extent',
110
                    'fic',
111
                    'fiction',
112
                    'Form-subdivision',
113
                    'format',
114
                    'Geographic-subdivision',
115
                    'he',
116
                    'Heading',
117
                    'Heading-use-main-or-added-entry',
118
                    'Heading-use-series-added-entry ',
119
                    'Heading-use-subject-added-entry',
120
                    'Host-item',
121
                    'id-other',
122
                    'Illustration-code',
123
                    'ISBN',
124
                    'isbn',
125
                    'ISSN',
126
                    'issn',
127
                    'itemtype',
128
                    'kw',
129
                    'Koha-Auth-Number',
130
                    'l-format',
131
                    'language',
132
                    'lc-card',
133
                    'LC-card-number',
134
                    'lcn',
135
                    'llength',
136
                    'ln',
137
                    'Local-classification',
138
                    'Local-number',
139
                    'Match-heading',
140
                    'Match-heading-see-from',
141
                    'Material-type',
142
                    'mc-itemtype',
143
                    'mc-rtype',
144
                    'mus',
145
                    'name',
146
                    'Music-number',
147
                    'Name-geographic',
148
                    'Name-geographic-heading',
149
                    'Name-geographic-see',
150
                    'Name-geographic-seealso',
151
                    'nb',
152
                    'Note',
153
                    'notes',
154
                    'ns',
155
                    'nt',
156
                    'pb',
157
                    'Personal-name',
158
                    'Personal-name-heading',
159
                    'Personal-name-see',
160
                    'Personal-name-seealso',
161
                    'pl',
162
                    'Place-publication',
163
                    'pn',
164
                    'popularity',
165
                    'pubdate',
166
                    'Publisher',
167
                    'Record-control-number',
168
                    'rcn',
169
                    'Record-type',
170
                    'rtype',
171
                    'se',
172
                    'See',
173
                    'See-also',
174
                    'sn',
175
                    'Stock-number',
176
                    'su',
177
                    'Subject',
178
                    'Subject-heading-thesaurus',
179
                    'Subject-name-personal',
180
                    'Subject-subdivision',
181
                    'Summary',
182
                    'Suppress',
183
                    'su-geo',
184
                    'su-na',
185
                    'su-to',
186
                    'su-ut',
187
                    'ut',
188
                    'UPC',
189
                    'Term-genre-form',
190
                    'Term-genre-form-heading',
191
                    'Term-genre-form-see',
192
                    'Term-genre-form-seealso',
193
                    'ti',
194
                    'Title',
195
                    'Title-cover',
196
                    'Title-series',
197
                    'Title-host',
198
                    'Title-uniform',
199
                    'Title-uniform-heading',
200
                    'Title-uniform-see',
201
                    'Title-uniform-seealso',
202
                    'totalissues',
203
                    'yr',
204
205
                    # items indexes
206
                    'acqsource',
207
                    'barcode',
208
                    'bc',
209
                    'branch',
210
                    'ccode',
211
                    'classification-source',
212
                    'cn-sort',
213
                    'coded-location-qualifier',
214
                    'copynumber',
215
                    'damaged',
216
                    'datelastborrowed',
217
                    'datelastseen',
218
                    'holdingbranch',
219
                    'homebranch',
220
                    'issues',
221
                    'item',
222
                    'itemnumber',
223
                    'itype',
224
                    'Local-classification',
225
                    'location',
226
                    'lost',
227
                    'materials-specified',
228
                    'mc-ccode',
229
                    'mc-itype',
230
                    'mc-loc',
231
                    'notforloan',
232
                    'onloan',
233
                    'price',
234
                    'renewals',
235
                    'replacementprice',
236
                    'replacementpricedate',
237
                    'reserves',
238
                    'restricted',
239
                    'stack',
240
                    'stocknumber',
241
                    'inv',
242
                    'uri',
243
                    'withdrawn',
244
245
                    # subject related
246
                  );
247
    return \@indexes;
248
}
249
250
1;
251
__END__
252
253
=head1 NAME
254
255
Koha::Search::Engine::Zebra - interface to Zebra as the search engine for Koha
256
257
=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
47
=head1 FUNCTIONS
48
49
=cut
50
51
require Exporter;
52
@ISA = qw( Exporter );
53
@EXPORT = qw(
54
    &GetMarcFromKohaField
55
    &GetAuthType
56
);
57
58
59
60
=head2 GetMarcFromKohaField
61
62
  ($MARCfield,$MARCsubfield)=GetMarcFromKohaField($kohafield,$frameworkcode);
63
64
Returns the MARC fields & subfields mapped to the koha field
65
for the given frameworkcode
66
67
=cut
68
69
sub GetMarcFromKohaField {
70
    my ( $kohafield, $frameworkcode ) = @_;
71
    return 0, 0 unless $kohafield and defined $frameworkcode;
72
    my $relations = C4::Context->marcfromkohafield;
73
    return ( $relations->{$frameworkcode}->{$kohafield}->[0], $relations->{$frameworkcode}->{$kohafield}->[1] );
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){ # NOTE - in MARC21 framework, '' is a valid authority
91
                                # type (FIXME but why?)
92
        $sth=$dbh->prepare("select * from auth_types where authtypecode=?");
93
        $sth->execute($authtypecode);
94
        if (my $res = $sth->fetchrow_hashref) {
95
            return $res;
96
        }
97
    }
98
    return;
99
}
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 45-50 use C4::Dates; Link Here
45
use C4::Suggestions;    # GetSuggestion
45
use C4::Suggestions;    # GetSuggestion
46
use C4::Branch;         # GetBranches
46
use C4::Branch;         # GetBranches
47
use C4::Members;
47
use C4::Members;
48
use Koha::Utils;
48
49
49
my $input = new CGI;
50
my $input = new CGI;
50
my ($template, $loggedinuser, $cookie) = get_template_and_user({
51
my ($template, $loggedinuser, $cookie) = get_template_and_user({
(-)a/acqui/neworderempty.pl (+1 lines)
Lines 88-93 use C4::Koha; Link Here
88
use C4::Branch;			# GetBranches
88
use C4::Branch;			# GetBranches
89
use C4::Members;
89
use C4::Members;
90
use C4::Search qw/FindDuplicate/;
90
use C4::Search qw/FindDuplicate/;
91
use Koha::Utils;
91
92
92
#needed for z3950 import:
93
#needed for z3950 import:
93
use C4::ImportBatch qw/GetImportRecordMarc SetImportRecordStatus/;
94
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; FIXME - Bug 2505
21
#use warnings; FIXME - Bug 2505
22
use Koha::Utils;
22
23
23
=head1
24
=head1
24
25
(-)a/circ/branchoverdues.pl (+1 lines)
Lines 28-33 use C4::Biblio; Link Here
28
use C4::Koha;
28
use C4::Koha;
29
use C4::Debug;
29
use C4::Debug;
30
use C4::Branch;
30
use C4::Branch;
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 24-29 use warnings; Link Here
24
use CGI;
24
use CGI;
25
use C4::Auth qw/check_api_auth/;
25
use C4::Auth qw/check_api_auth/;
26
use C4::Biblio;
26
use C4::Biblio;
27
use Koha::Utils;
27
use XML::Simple;
28
use XML::Simple;
28
29
29
my $query = new CGI;
30
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 (+20 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
#
3
# This Koha test module is a stub!
4
# Add more tests here!!!
5
6
use strict;
7
use warnings;
8
9
use Test::More tests => 1;
10
11
BEGIN {
12
        use_ok('Koha::Search');
13
}
14
15
my @indexes = GetIndexes();
16
# We should probably check that GetIndexes returns 'Subject' or some other
17
# similarly crucial index
18
19
# We should probably check that AddRecordToIndexingQueue works somehow or
20
# 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