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

(-)a/C4/XSLT.pm (-8 / +10 lines)
Lines 190-196 sub XSLTParse4Display { Link Here
190
                              UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
190
                              UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
191
                              singleBranchMode OPACItemLocation DisplayIconsXSLT
191
                              singleBranchMode OPACItemLocation DisplayIconsXSLT
192
                              AlternateHoldingsField AlternateHoldingsSeparator
192
                              AlternateHoldingsField AlternateHoldingsSeparator
193
                              TrackClicks / )
193
                              TrackClicks OPACResultsBranchXSLT / )
194
    {
194
    {
195
        my $sp = C4::Context->preference( $syspref );
195
        my $sp = C4::Context->preference( $syspref );
196
        next unless defined($sp);
196
        next unless defined($sp);
Lines 283-295 sub buildKohaItemsNamespace { Link Here
283
        $location = $item->{location}? xml_escape($shelflocations->{$item->{location}}||$item->{location}):'';
283
        $location = $item->{location}? xml_escape($shelflocations->{$item->{location}}||$item->{location}):'';
284
        $ccode = $item->{ccode}? xml_escape($ccodes->{$item->{ccode}}||$item->{ccode}):'';
284
        $ccode = $item->{ccode}? xml_escape($ccodes->{$item->{ccode}}||$item->{ccode}):'';
285
        my $itemcallnumber = xml_escape($item->{itemcallnumber});
285
        my $itemcallnumber = xml_escape($item->{itemcallnumber});
286
        $xml.= "<item><homebranch>$homebranch</homebranch>".
286
        $xml .=
287
                "<holdingbranch>$holdingbranch</holdingbranch>".
287
            "<item>"
288
                "<location>$location</location>".
288
          . "<homebranch>$homebranch</homebranch>"
289
                "<ccode>$ccode</ccode>".
289
          . "<holdingbranch>$holdingbranch</holdingbranch>"
290
		"<status>$status</status>".
290
          . "<location>$location</location>"
291
		"<itemcallnumber>".$itemcallnumber."</itemcallnumber>"
291
          . "<ccode>$ccode</ccode>"
292
        . "</item>";
292
          . "<status>$status</status>"
293
          . "<itemcallnumber>$itemcallnumber</itemcallnumber>"
294
          . "</item>";
293
295
294
    }
296
    }
295
    $xml = "<items xmlns=\"http://www.koha-community.org/items\">".$xml."</items>";
297
    $xml = "<items xmlns=\"http://www.koha-community.org/items\">".$xml."</items>";
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 424-426 INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES(' Link Here
424
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPAC','0','','If on, and a patron is logged into the OPAC, items from his or her home library will be emphasized and shown first in search results and item details.','YesNo');
424
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPAC','0','','If on, and a patron is logged into the OPAC, items from his or her home library will be emphasized and shown first in search results and item details.','YesNo');
425
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPACWhich','PatronBranch','PatronBranch|OpacURLBranch','Decides which branch''s items to emphasize. If PatronBranch, emphasize the logged in user''s library''s items. If OpacURLBranch, highlight the items of the Apache var BRANCHCODE defined in Koha''s Apache configuration file.','Choice');
425
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPACWhich','PatronBranch','PatronBranch|OpacURLBranch','Decides which branch''s items to emphasize. If PatronBranch, emphasize the logged in user''s library''s items. If OpacURLBranch, highlight the items of the Apache var BRANCHCODE defined in Koha''s Apache configuration file.','Choice');
426
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UniqueItemFields', 'barcode', 'Space-separated list of fields that should be unique (used in acquisition module for item creation). Fields must be valid SQL column names of items table', '', 'Free');
426
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UniqueItemFields', 'barcode', 'Space-separated list of fields that should be unique (used in acquisition module for item creation). Fields must be valid SQL column names of items table', '', 'Free');
427
INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('OPACResultsBranchXSLT', 'homebranch', 'homebranch|holdingbranch', 'Defines whether the OPAC displays the holding or home branch in search results when using XSLT', 'Choice');
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 6834-6839 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6834
    SetVersion($DBversion);
6834
    SetVersion($DBversion);
6835
}
6835
}
6836
6836
6837
    $DBversion = "3.11.00.XXX";
6838
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6839
    $dbh->do("INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('OPACResultsBranchXSLT', 'homebranch', 'homebranch|holdingbranch', 'Defines whether the OPAC displays the holding or home branch in search results when using XSLT', 'Choice')");
6840
    print "Upgrade to $DBversion done (Add syspref OPACResultsBranchXSLT)\n";
6841
    SetVersion($DBversion);
6842
}
6843
6837
=head1 FUNCTIONS
6844
=head1 FUNCTIONS
6838
6845
6839
=head2 TableExists($table)
6846
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+7 lines)
Lines 83-88 OPAC: Link Here
83
                  no: "Don't show"
83
                  no: "Don't show"
84
            - the format, audience, and material type icons in XSLT MARC21 results and detail pages in the OPAC.
84
            - the format, audience, and material type icons in XSLT MARC21 results and detail pages in the OPAC.
85
        -
85
        -
86
            - On search result pages displayed with XSLT stylesheets on the OPAC, show the item's
87
            - pref: OPACResultsBranchXSLT
88
              choices:
89
                  holdingbranch: "holding branch"
90
                  homebranch: "home branch"
91
            - icons for itemtype and authorized values.
92
        -
86
            - pref: COinSinOPACResults
93
            - pref: COinSinOPACResults
87
              choices:
94
              choices:
88
                  yes: Include
95
                  yes: Include
(-)a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl (-40 / +64 lines)
Lines 9-15 Link Here
9
    <xsl:import href="MARC21slimUtils.xsl"/>
9
    <xsl:import href="MARC21slimUtils.xsl"/>
10
    <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
10
    <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
11
    <xsl:key name="item-by-status" match="items:item" use="items:status"/>
11
    <xsl:key name="item-by-status" match="items:item" use="items:status"/>
12
    <xsl:key name="item-by-status-and-branch" match="items:item" use="concat(items:status, ' ', items:homebranch)"/>
12
    <xsl:key name="item-by-status-and-branch-holding" match="items:item" use="concat(items:status, ' ', items:holdingbranch)"/>
13
    <xsl:key name="item-by-status-and-branch-home"    match="items:item" use="concat(items:status, ' ', items:homebranch)"/>
13
14
14
    <xsl:template match="/">
15
    <xsl:template match="/">
15
            <xsl:apply-templates/>
16
            <xsl:apply-templates/>
Lines 19-24 Link Here
19
        <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
20
        <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
20
        <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>
21
        <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>
21
22
23
    <xsl:variable name="OPACResultsBranchXSLT" select="marc:sysprefs/marc:syspref[@name='OPACResultsBranchXSLT']"/>
22
    <xsl:variable name="hidelostitems" select="marc:sysprefs/marc:syspref[@name='hidelostitems']"/>
24
    <xsl:variable name="hidelostitems" select="marc:sysprefs/marc:syspref[@name='hidelostitems']"/>
23
    <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
25
    <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
24
    <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/>
26
    <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/>
Lines 1051-1103 Link Here
1051
                       <xsl:variable name="available_items"
1053
                       <xsl:variable name="available_items"
1052
                           select="key('item-by-status', 'available')"/>
1054
                           select="key('item-by-status', 'available')"/>
1053
               <xsl:choose>
1055
               <xsl:choose>
1054
               <xsl:when test="$singleBranchMode=1">
1056
                   <xsl:when test="$singleBranchMode=1">
1055
               <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
1057
                       <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]">
1056
                   <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1058
                           <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1057
                               <xsl:text> (</xsl:text>
1059
                           <xsl:text> (</xsl:text>
1058
                               <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
1060
                           <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/>
1059
                               <xsl:text>)</xsl:text>
1061
                           <xsl:text>)</xsl:text>
1060
                               <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1062
                           <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1063
                       </xsl:for-each>
1064
                   </xsl:when>
1065
                   <xsl:otherwise>
1066
                        <xsl:choose>
1067
                            <xsl:when test="$OPACResultsBranchXSLT='homebranch'">
1068
                                <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
1069
                                    <xsl:value-of select="items:homebranch"/>
1070
                                    <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1071
                                    <xsl:text> (</xsl:text>
1072
                                    <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
1073
                                    <xsl:text>)</xsl:text>
1074
                                    <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1061
                               </xsl:for-each>
1075
                               </xsl:for-each>
1062
               </xsl:when>
1076
                            </xsl:when>
1063
               <xsl:otherwise>
1077
                            <xsl:when test="$OPACResultsBranchXSLT='holdingbranch'">
1064
                   <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
1078
                               <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch))[1])]">
1065
                               <xsl:value-of select="items:homebranch"/>
1079
                                   <xsl:value-of select="items:holdingbranch"/>
1066
                   <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1080
                                   <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1067
                               <xsl:text> (</xsl:text>
1081
                                   <xsl:text> (</xsl:text>
1068
                               <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
1082
                                   <xsl:value-of select="count(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch)))"/>
1069
                               <xsl:text>)</xsl:text>
1083
                                   <xsl:text>)</xsl:text>
1070
                               <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1084
                                   <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1071
                               </xsl:for-each>
1085
                               </xsl:for-each>
1072
               </xsl:otherwise>
1086
                            </xsl:when>
1087
                        </xsl:choose>
1088
                   </xsl:otherwise>
1073
               </xsl:choose>
1089
               </xsl:choose>
1074
1090
1075
           </span>
1091
           </span>
1076
                   </xsl:when>
1092
                   </xsl:when>
1077
				   </xsl:choose>
1093
				   </xsl:choose>
1078
1094
1079
            <xsl:choose>
1095
                   <xsl:choose>
1080
                <xsl:when test="count(key('item-by-status', 'reference'))>0">
1096
                       <xsl:when test="count(key('item-by-status', 'reference'))>0">
1081
                    <span class="available">
1097
                           <span class="available">
1082
                        <b><xsl:text>Copies available for reference: </xsl:text></b>
1098
                               <b><xsl:text>Copies available for reference: </xsl:text></b>
1083
                        <xsl:variable name="reference_items" select="key('item-by-status', 'reference')"/>
1099
                               <xsl:variable name="reference_items" select="key('item-by-status', 'reference')"/>
1084
                        <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
1085
                                <xsl:value-of select="items:homebranch"/>
1086
                                <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1087
                                <xsl:text> (</xsl:text>
1088
                                <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
1089
                                <xsl:text> )</xsl:text>
1090
                                <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1091
                        </xsl:for-each>
1092
                    </span>
1093
                </xsl:when>
1094
            </xsl:choose>
1095
1100
1096
                   <xsl:choose> <xsl:when test="count(key('item-by-status', 'available'))>0">
1101
                              <xsl:choose>
1097
                       <xsl:choose><xsl:when test="count(key('item-by-status', 'reference'))>0">
1102
                                  <xsl:when test="$OPACResultsBranchXSLT='homebranch'">
1098
                            <br/>
1103
                                      <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]">
1099
                       </xsl:when></xsl:choose>
1104
                                          <xsl:value-of select="items:homebranch"/>
1100
                   </xsl:when> </xsl:choose>
1105
                                          <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1106
                                          <xsl:text> (</xsl:text>
1107
                                          <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/>
1108
                                          <xsl:text>)</xsl:text>
1109
                                          <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1110
                                      </xsl:for-each>
1111
                                  </xsl:when>
1112
                                  <xsl:when test="$OPACResultsBranchXSLT='holdingbranch'">
1113
                                      <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch))[1])]">
1114
                                          <xsl:value-of select="items:holdingbranch"/>
1115
                                          <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1116
                                          <xsl:text> (</xsl:text>
1117
                                          <xsl:value-of select="count(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch)))"/>
1118
                                          <xsl:text>)</xsl:text>
1119
                                          <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1120
                                      </xsl:for-each>
1121
                                  </xsl:when>
1122
                              </xsl:choose>
1123
                           </span>
1124
                       </xsl:when>
1125
                   </xsl:choose>
1101
1126
1102
                   <xsl:if test="count(key('item-by-status', 'Checked out'))>0">
1127
                   <xsl:if test="count(key('item-by-status', 'Checked out'))>0">
1103
                   <span class="unavailable">
1128
                   <span class="unavailable">
1104
- 

Return to bug 7441