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

(-)a/C4/XSLT.pm (-8 / +10 lines)
Lines 207-213 sub XSLTParse4Display { Link Here
207
                              UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
207
                              UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
208
                              singleBranchMode OPACItemLocation DisplayIconsXSLT
208
                              singleBranchMode OPACItemLocation DisplayIconsXSLT
209
                              AlternateHoldingsField AlternateHoldingsSeparator
209
                              AlternateHoldingsField AlternateHoldingsSeparator
210
                              TrackClicks / )
210
                              TrackClicks OPACResultsBranchXSLT / )
211
    {
211
    {
212
        my $sp = C4::Context->preference( $syspref );
212
        my $sp = C4::Context->preference( $syspref );
213
        next unless defined($sp);
213
        next unless defined($sp);
Lines 300-312 sub buildKohaItemsNamespace { Link Here
300
        $location = $item->{location}? xml_escape($shelflocations->{$item->{location}}||$item->{location}):'';
300
        $location = $item->{location}? xml_escape($shelflocations->{$item->{location}}||$item->{location}):'';
301
        $ccode = $item->{ccode}? xml_escape($ccodes->{$item->{ccode}}||$item->{ccode}):'';
301
        $ccode = $item->{ccode}? xml_escape($ccodes->{$item->{ccode}}||$item->{ccode}):'';
302
        my $itemcallnumber = xml_escape($item->{itemcallnumber});
302
        my $itemcallnumber = xml_escape($item->{itemcallnumber});
303
        $xml.= "<item><homebranch>$homebranch</homebranch>".
303
        $xml .=
304
                "<holdingbranch>$holdingbranch</holdingbranch>".
304
            "<item>"
305
                "<location>$location</location>".
305
          . "<homebranch>$homebranch</homebranch>"
306
                "<ccode>$ccode</ccode>".
306
          . "<holdingbranch>$holdingbranch</holdingbranch>"
307
		"<status>$status</status>".
307
          . "<location>$location</location>"
308
		"<itemcallnumber>".$itemcallnumber."</itemcallnumber>"
308
          . "<ccode>$ccode</ccode>"
309
        . "</item>";
309
          . "<status>$status</status>"
310
          . "<itemcallnumber>$itemcallnumber</itemcallnumber>"
311
          . "</item>";
310
312
311
    }
313
    }
312
    $xml = "<items xmlns=\"http://www.koha-community.org/items\">".$xml."</items>";
314
    $xml = "<items xmlns=\"http://www.koha-community.org/items\">".$xml."</items>";
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 427-429 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' Link Here
427
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('UseCourseReserves', '0', 'Enable the course reserves feature.', NULL, 'YesNo');
427
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('UseCourseReserves', '0', 'Enable the course reserves feature.', NULL, 'YesNo');
428
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHoldNotes',0,'Show hold notes on OPAC','','YesNo');
428
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHoldNotes',0,'Show hold notes on OPAC','','YesNo');
429
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CalculateFinesOnReturn','1','Switch to control if overdue fines are calculated on return or not', '', 'YesNo');
429
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CalculateFinesOnReturn','1','Switch to control if overdue fines are calculated on return or not', '', 'YesNo');
430
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 7010-7015 CREATE TABLE IF NOT EXISTS borrower_files ( Link Here
7010
    SetVersion($DBversion);
7010
    SetVersion($DBversion);
7011
}
7011
}
7012
7012
7013
$DBversion = "3.13.00.XXX";
7014
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
7015
    $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')");
7016
    print "Upgrade to $DBversion done (Add syspref OPACResultsBranchXSLT)\n";
7017
    SetVersion($DBversion);
7018
}
7019
7013
=head1 FUNCTIONS
7020
=head1 FUNCTIONS
7014
7021
7015
=head2 TableExists($table)
7022
=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