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

(-)a/etc/zebradb/authorities/etc/bib1.att (+1 lines)
Lines 13-18 att 9042 Heading-use-subject-added-entry Link Here
13
att 9043    Kind-of-record
13
att 9043    Kind-of-record
14
att 9046    Record-status
14
att 9046    Record-status
15
att 9050    Subject-heading-thesaurus
15
att 9050    Subject-heading-thesaurus
16
att 9051    Previous-heading-see-from
16
17
17
# Personal Name
18
# Personal Name
18
att 1       Personal-name
19
att 1       Personal-name
(-)a/etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml (+16 lines)
Lines 45-50 authority-zebra-indexdefs.xsl` Link Here
45
  <kohaidx:index_control_field tag="008" offset="16" length="1">
45
  <kohaidx:index_control_field tag="008" offset="16" length="1">
46
    <kohaidx:target_index>Heading-use-series-added-entry:w</kohaidx:target_index>
46
    <kohaidx:target_index>Heading-use-series-added-entry:w</kohaidx:target_index>
47
  </kohaidx:index_control_field>
47
  </kohaidx:index_control_field>
48
49
  <!-- 010 LC Number -->
50
  <kohaidx:index_subfields tag="010" subfields="az">
51
    <kohaidx:target_index>LC-card-number:w</kohaidx:target_index>
52
    <kohaidx:target_index>LC-card-number:p</kohaidx:target_index>
53
  </kohaidx:index_subfields>
54
55
  <!-- 040 cataloging agencies -->
56
  <kohaidx:index_subfields tag="040" subfields="acd">
57
    <kohaidx:target_index>Record-source:w</kohaidx:target_index>
58
    <kohaidx:target_index>Record-source:p</kohaidx:target_index>
59
  </kohaidx:index_subfields>
60
48
  
61
  
49
  <!-- Personal name headings -->
62
  <!-- Personal name headings -->
50
  <kohaidx:index_subfields tag="100" subfields="abcdefghjklmnopqrstvxyz">
63
  <kohaidx:index_subfields tag="100" subfields="abcdefghjklmnopqrstvxyz">
Lines 346-351 authority-zebra-indexdefs.xsl` Link Here
346
    <kohaidx:target_index>See-from:p</kohaidx:target_index>
359
    <kohaidx:target_index>See-from:p</kohaidx:target_index>
347
    <kohaidx:target_index>See-from:s</kohaidx:target_index>
360
    <kohaidx:target_index>See-from:s</kohaidx:target_index>
348
  </kohaidx:index_heading>
361
  </kohaidx:index_heading>
362
  <kohaidx:index_heading_conditional tag="450" test="substring(marc:subfield[@code='w']/text(), 2, 1)" subfields="abvxyz" subdivisions="vxyz">
363
    <kohaidx:target_index>Previous-heading-see-from:p</kohaidx:target_index>
364
  </kohaidx:index_heading_conditional>
349
  <kohaidx:index_match_heading tag="450" subfields="abvxyz" subdivisions="vxyz">
365
  <kohaidx:index_match_heading tag="450" subfields="abvxyz" subdivisions="vxyz">
350
    <kohaidx:target_index>Match:w</kohaidx:target_index>
366
    <kohaidx:target_index>Match:w</kohaidx:target_index>
351
    <kohaidx:target_index>Match:p</kohaidx:target_index>
367
    <kohaidx:target_index>Match:p</kohaidx:target_index>
(-)a/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl (+44 lines)
Lines 13-18 definition file (probably something like {biblio,authority}-koha-indexdefs.xml) Link Here
13
  <xslo:template match="text()" mode="index_subfields"/>
13
  <xslo:template match="text()" mode="index_subfields"/>
14
  <xslo:template match="text()" mode="index_data_field"/>
14
  <xslo:template match="text()" mode="index_data_field"/>
15
  <xslo:template match="text()" mode="index_heading"/>
15
  <xslo:template match="text()" mode="index_heading"/>
16
  <xslo:template match="text()" mode="index_heading_conditional"/>
16
  <xslo:template match="text()" mode="index_match_heading"/>
17
  <xslo:template match="text()" mode="index_match_heading"/>
17
  <xslo:template match="text()" mode="index_subject_thesaurus"/>
18
  <xslo:template match="text()" mode="index_subject_thesaurus"/>
18
  <xslo:template match="/">
19
  <xslo:template match="/">
Lines 35-40 definition file (probably something like {biblio,authority}-koha-indexdefs.xml) Link Here
35
      <xslo:apply-templates mode="index_subfields"/>
36
      <xslo:apply-templates mode="index_subfields"/>
36
      <xslo:apply-templates mode="index_data_field"/>
37
      <xslo:apply-templates mode="index_data_field"/>
37
      <xslo:apply-templates mode="index_heading"/>
38
      <xslo:apply-templates mode="index_heading"/>
39
      <xslo:apply-templates mode="index_heading_conditional"/>
38
      <xslo:apply-templates mode="index_match_heading"/>
40
      <xslo:apply-templates mode="index_match_heading"/>
39
      <xslo:apply-templates mode="index_subject_thesaurus"/>
41
      <xslo:apply-templates mode="index_subject_thesaurus"/>
40
    </z:record>
42
    </z:record>
Lines 69-74 definition file (probably something like {biblio,authority}-koha-indexdefs.xml) Link Here
69
      <xslo:value-of select="substring(., 17, 1)"/>
71
      <xslo:value-of select="substring(., 17, 1)"/>
70
    </z:index>
72
    </z:index>
71
  </xslo:template>
73
  </xslo:template>
74
  <xslo:template mode="index_subfields" match="marc:datafield[@tag='010']">
75
    <xslo:for-each select="marc:subfield">
76
      <xslo:if test="contains('az', @code)">
77
        <z:index name="LC-card-number:w LC-card-number:p">
78
          <xslo:value-of select="."/>
79
        </z:index>
80
      </xslo:if>
81
    </xslo:for-each>
82
  </xslo:template>
83
  <xslo:template mode="index_subfields" match="marc:datafield[@tag='040']">
84
    <xslo:for-each select="marc:subfield">
85
      <xslo:if test="contains('acd', @code)">
86
        <z:index name="Record-source:w Record-source:p">
87
          <xslo:value-of select="."/>
88
        </z:index>
89
      </xslo:if>
90
    </xslo:for-each>
91
  </xslo:template>
72
  <xslo:template mode="index_subfields" match="marc:datafield[@tag='100']">
92
  <xslo:template mode="index_subfields" match="marc:datafield[@tag='100']">
73
    <xslo:for-each select="marc:subfield">
93
    <xslo:for-each select="marc:subfield">
74
      <xslo:if test="contains('abcdefghjklmnopqrstvxyz', @code)">
94
      <xslo:if test="contains('abcdefghjklmnopqrstvxyz', @code)">
Lines 1102-1107 definition file (probably something like {biblio,authority}-koha-indexdefs.xml) Link Here
1102
      <xslo:value-of select="normalize-space($raw_heading)"/>
1122
      <xslo:value-of select="normalize-space($raw_heading)"/>
1103
    </z:index>
1123
    </z:index>
1104
  </xslo:template>
1124
  </xslo:template>
1125
  <xslo:template mode="index_heading_conditional" match="marc:datafield[@tag='450']">
1126
    <xslo:if test="substring(marc:subfield[@code='w']/text(), 2, 1)">
1127
      <z:index name="Previous-heading-see-from:p">
1128
        <xslo:variable name="raw_heading">
1129
          <xslo:for-each select="marc:subfield">
1130
            <xslo:if test="contains('abvxyz', @code)" name="Previous-heading-see-from:p">
1131
              <xslo:if test="position() &gt; 1">
1132
                <xslo:choose>
1133
                  <xslo:when test="contains('vxyz', @code)">
1134
                    <xslo:text>--</xslo:text>
1135
                  </xslo:when>
1136
                  <xslo:otherwise>
1137
                    <xslo:value-of select="substring(' ', 1, 1)"/>
1138
                  </xslo:otherwise>
1139
                </xslo:choose>
1140
              </xslo:if>
1141
              <xslo:value-of select="."/>
1142
            </xslo:if>
1143
          </xslo:for-each>
1144
        </xslo:variable>
1145
        <xslo:value-of select="normalize-space($raw_heading)"/>
1146
      </z:index>
1147
    </xslo:if>
1148
  </xslo:template>
1105
  <xslo:template mode="index_match_heading" match="marc:datafield[@tag='100']">
1149
  <xslo:template mode="index_match_heading" match="marc:datafield[@tag='100']">
1106
    <z:index name="Match:w Match:p Match-heading:p Match-heading:s">
1150
    <z:index name="Match:w Match:p Match-heading:p Match-heading:s">
1107
      <xslo:variable name="raw_heading">
1151
      <xslo:variable name="raw_heading">
(-)a/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl (+17 lines)
Lines 16-21 Link Here
16
    <xsl:key name="index_subfields_tag" match="kohaidx:index_subfields" use="@tag"/>
16
    <xsl:key name="index_subfields_tag" match="kohaidx:index_subfields" use="@tag"/>
17
    <xsl:key name="index_heading_tag"   match="kohaidx:index_heading"   use="@tag"/>
17
    <xsl:key name="index_heading_tag"   match="kohaidx:index_heading"   use="@tag"/>
18
    <xsl:key name="index_data_field_tag"   match="kohaidx:index_data_field"   use="@tag"/>
18
    <xsl:key name="index_data_field_tag"   match="kohaidx:index_data_field"   use="@tag"/>
19
    <xsl:key name="index_heading_conditional_tag" match="kohaidx:index_heading_conditional" use="@tag"/>
19
    <xsl:key name="index_match_heading_tag" match="kohaidx:index_match_heading" use="@tag"/>
20
    <xsl:key name="index_match_heading_tag" match="kohaidx:index_match_heading" use="@tag"/>
20
21
21
    <xsl:template match="kohaidx:index_defs">
22
    <xsl:template match="kohaidx:index_defs">
Lines 33-38 definition file (probably something like {biblio,authority}-koha-indexdefs.xml) Link Here
33
            <xslo:template match="text()" mode="index_subfields"/>
34
            <xslo:template match="text()" mode="index_subfields"/>
34
            <xslo:template match="text()" mode="index_data_field"/>
35
            <xslo:template match="text()" mode="index_data_field"/>
35
            <xslo:template match="text()" mode="index_heading"/>
36
            <xslo:template match="text()" mode="index_heading"/>
37
            <xslo:template match="text()" mode="index_heading_conditional"/>
36
            <xslo:template match="text()" mode="index_match_heading"/>
38
            <xslo:template match="text()" mode="index_match_heading"/>
37
            <xslo:template match="text()" mode="index_subject_thesaurus"/>
39
            <xslo:template match="text()" mode="index_subject_thesaurus"/>
38
            <xslo:template match="/">
40
            <xslo:template match="/">
Lines 54-59 definition file (probably something like {biblio,authority}-koha-indexdefs.xml) Link Here
54
                    <xslo:apply-templates mode="index_subfields"/>
56
                    <xslo:apply-templates mode="index_subfields"/>
55
                    <xslo:apply-templates mode="index_data_field"/>
57
                    <xslo:apply-templates mode="index_data_field"/>
56
                    <xslo:apply-templates mode="index_heading"/>
58
                    <xslo:apply-templates mode="index_heading"/>
59
                    <xslo:apply-templates mode="index_heading_conditional"/>
57
                    <xslo:apply-templates mode="index_match_heading"/>
60
                    <xslo:apply-templates mode="index_match_heading"/>
58
                    <xslo:apply-templates mode="index_subject_thesaurus"/>
61
                    <xslo:apply-templates mode="index_subject_thesaurus"/>
59
                </z:record>
62
                </z:record>
Lines 64-69 definition file (probably something like {biblio,authority}-koha-indexdefs.xml) Link Here
64
            <xsl:call-template name="handle-index-subfields"/>
67
            <xsl:call-template name="handle-index-subfields"/>
65
            <xsl:call-template name="handle-index-data-field"/>
68
            <xsl:call-template name="handle-index-data-field"/>
66
            <xsl:call-template name="handle-index-heading"/>
69
            <xsl:call-template name="handle-index-heading"/>
70
            <xsl:call-template name="handle-index-heading-conditional"/>
67
            <xsl:call-template name="handle-index-match-heading"/>
71
            <xsl:call-template name="handle-index-match-heading"/>
68
            <xsl:apply-templates/>
72
            <xsl:apply-templates/>
69
            <xslo:template match="*">
73
            <xslo:template match="*">
Lines 279-284 definition file (probably something like {biblio,authority}-koha-indexdefs.xml) Link Here
279
        </xsl:for-each>
283
        </xsl:for-each>
280
    </xsl:template>
284
    </xsl:template>
281
285
286
    <xsl:template name="handle-index-heading-conditional">
287
        <xsl:for-each select="//kohaidx:index_heading_conditional[generate-id() = generate-id(key('index_heading_conditional_tag', @tag)[1])]">
288
            <xslo:template mode="index_heading_conditional">
289
                <xslo:if>
290
                    <xsl:attribute name="test"><xsl:value-of select="@test"/></xsl:attribute>
291
                    <xsl:for-each select="key('index_heading_conditional_tag', @tag)">
292
                        <xsl:call-template name="handle-one-index-heading"/>
293
                    </xsl:for-each>
294
                </xslo:if>
295
            </xslo:template>
296
        </xsl:for-each>
297
    </xsl:template>
298
282
    <xsl:template name="handle-one-data-field">
299
    <xsl:template name="handle-one-data-field">
283
        <xsl:variable name="indexes">
300
        <xsl:variable name="indexes">
284
            <xsl:call-template name="get-target-indexes"/>
301
            <xsl:call-template name="get-target-indexes"/>
(-)a/installer/data/mysql/atomicupdate/importauthorities.pl (+26 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
use strict;
4
use warnings;
5
use C4::Context;
6
my $dbh = C4::Context->dbh;
7
8
$dbh->do(
9
q|CREATE TABLE `import_auths` (
10
    import_record_id int(11) NOT NULL,
11
    matched_authid int(11) default NULL,
12
    control_number varchar(25) default NULL,
13
    authorized_heading varchar(128) default NULL,
14
    original_source varchar(25) default NULL,
15
    CONSTRAINT import_auths_ibfk_1 FOREIGN KEY (import_record_id)
16
    REFERENCES import_records (import_record_id) ON DELETE CASCADE ON UPDATE CASCADE,
17
    KEY matched_authid (matched_authid)
18
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;|
19
);
20
$dbh->do("ALTER TABLE import_batches
21
            CHANGE COLUMN num_biblios num_records int(11) NOT NULL default 0,
22
            ADD COLUMN record_type enum('biblio', 'auth', 'holdings') NOT NULL default 'biblio'");
23
$dbh->do("UPDATE import_batches SET record_type='auth' WHERE import_batch_id IN
24
            (SELECT import_batch_id FROM import_records WHERE record_type='auth')");
25
26
print "Upgrade done (Added support for staging authorities)\n";
(-)a/installer/data/mysql/kohastructure.sql (-2 / +18 lines)
Lines 853-859 CREATE TABLE `import_batches` ( -- information about batches of marc records tha Link Here
853
  `matcher_id` int(11) default NULL, -- the id of the match rule used (matchpoints.matcher_id)
853
  `matcher_id` int(11) default NULL, -- the id of the match rule used (matchpoints.matcher_id)
854
  `template_id` int(11) default NULL,
854
  `template_id` int(11) default NULL,
855
  `branchcode` varchar(10) default NULL,
855
  `branchcode` varchar(10) default NULL,
856
  `num_biblios` int(11) NOT NULL default 0, -- number of bib records in the file
856
  `num_records` int(11) NOT NULL default 0, -- number of records in the file
857
  `num_items` int(11) NOT NULL default 0, -- number of items in the file
857
  `num_items` int(11) NOT NULL default 0, -- number of items in the file
858
  `upload_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, -- date and time the file was uploaded
858
  `upload_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, -- date and time the file was uploaded
859
  `overlay_action` enum('replace', 'create_new', 'use_template', 'ignore') NOT NULL default 'create_new', -- how to handle duplicate records
859
  `overlay_action` enum('replace', 'create_new', 'use_template', 'ignore') NOT NULL default 'create_new', -- how to handle duplicate records
Lines 861-866 CREATE TABLE `import_batches` ( -- information about batches of marc records tha Link Here
861
  `item_action` enum('always_add', 'add_only_for_matches', 'add_only_for_new', 'ignore') NOT NULL default 'always_add', -- what to do with item records
861
  `item_action` enum('always_add', 'add_only_for_matches', 'add_only_for_new', 'ignore') NOT NULL default 'always_add', -- what to do with item records
862
  `import_status` enum('staging', 'staged', 'importing', 'imported', 'reverting', 'reverted', 'cleaned') NOT NULL default 'staging', -- the status of the imported file
862
  `import_status` enum('staging', 'staged', 'importing', 'imported', 'reverting', 'reverted', 'cleaned') NOT NULL default 'staging', -- the status of the imported file
863
  `batch_type` enum('batch', 'z3950', 'webservice') NOT NULL default 'batch', -- where this batch has come from
863
  `batch_type` enum('batch', 'z3950', 'webservice') NOT NULL default 'batch', -- where this batch has come from
864
  `record_type` enum('biblio', 'auth', 'holdings') NOT NULL default 'biblio', -- type of record in the batch
864
  `file_name` varchar(100), -- the name of the file uploaded
865
  `file_name` varchar(100), -- the name of the file uploaded
865
  `comments` mediumtext, -- any comments added when the file was uploaded
866
  `comments` mediumtext, -- any comments added when the file was uploaded
866
  PRIMARY KEY (`import_batch_id`),
867
  PRIMARY KEY (`import_batch_id`),
Lines 909-914 CREATE TABLE `import_record_matches` ( -- matches found when importing a batch o Link Here
909
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
910
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
910
911
911
--
912
--
913
-- Table structure for table `import_auths`
914
--
915
916
DROP TABLE IF EXISTS `import_auths`;
917
CREATE TABLE `import_auths` (
918
  `import_record_id` int(11) NOT NULL,
919
  `matched_authid` int(11) default NULL,
920
  `control_number` varchar(25) default NULL,
921
  `authorized_heading` varchar(128) default NULL,
922
  `original_source` varchar(25) default NULL,
923
  CONSTRAINT `import_auths_ibfk_1` FOREIGN KEY (`import_record_id`)
924
             REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
925
  KEY `matched_authid` (`matched_authid`),
926
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
927
928
--
912
-- Table structure for table `import_biblios`
929
-- Table structure for table `import_biblios`
913
--
930
--
914
931
915
- 

Return to bug 2060