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

(-)a/C4/XSLT.pm (-3 / +4 lines)
Lines 188-194 sub XSLTParse4Display { Link Here
188
                              UseAuthoritiesForTracings TraceSubjectSubdivisions
188
                              UseAuthoritiesForTracings TraceSubjectSubdivisions
189
                              Display856uAsImage OPACDisplay856uAsImage 
189
                              Display856uAsImage OPACDisplay856uAsImage 
190
                              UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
190
                              UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
191
                              singleBranchMode
191
                              singleBranchMode OPACResultsBranchXSLT
192
                              AlternateHoldingsField AlternateHoldingsSeparator / )
192
                              AlternateHoldingsField AlternateHoldingsSeparator / )
193
    {
193
    {
194
        my $sp = C4::Context->preference( $syspref );
194
        my $sp = C4::Context->preference( $syspref );
Lines 272-279 sub buildKohaItemsNamespace { Link Here
272
            $status = "available";
272
            $status = "available";
273
        }
273
        }
274
        my $homebranch = $item->{homebranch}? xml_escape($branches->{$item->{homebranch}}->{'branchname'}):'';
274
        my $homebranch = $item->{homebranch}? xml_escape($branches->{$item->{homebranch}}->{'branchname'}):'';
275
	    my $itemcallnumber = xml_escape($item->{itemcallnumber});
275
        my $holdingbranch = $item->{holdingbranch}? xml_escape($branches->{$item->{holdingbranch}}->{'branchname'}):'';
276
        $xml.= "<item><homebranch>$homebranch</homebranch>".
276
        my $itemcallnumber = xml_escape($item->{itemcallnumber});
277
        $xml.= "<item><homebranch>$homebranch</homebranch><holdingbranch>$holdingbranch</holdingbranch>".
277
		"<status>$status</status>".
278
		"<status>$status</status>".
278
		"<itemcallnumber>".$itemcallnumber."</itemcallnumber>"
279
		"<itemcallnumber>".$itemcallnumber."</itemcallnumber>"
279
        . "</item>";
280
        . "</item>";
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 408-410 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' Link Here
408
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('NotesBlacklist','','List of notes fields that should not appear in the title notes/description separator of details',NULL,'free');
408
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('NotesBlacklist','','List of notes fields that should not appear in the title notes/description separator of details',NULL,'free');
409
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserCSS', '', NULL, 'Add CSS to be included in the SCO module in an embedded <style> tag.', 'free');
409
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserCSS', '', NULL, 'Add CSS to be included in the SCO module in an embedded <style> tag.', 'free');
410
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserJS', '', NULL, 'Define custom javascript for inclusion in the SCO module', 'free');
410
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserJS', '', NULL, 'Define custom javascript for inclusion in the SCO module', 'free');
411
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 6347-6352 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6347
    SetVersion($DBversion);
6347
    SetVersion($DBversion);
6348
}
6348
}
6349
6349
6350
$DBversion = "3.11.00.XXX";
6351
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6352
    $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')");
6353
    print "Upgrade to $DBversion done (Add syspref OPACResultsBranchXSLT)\n";
6354
    SetVersion($DBversion);
6355
}
6356
6350
=head1 FUNCTIONS
6357
=head1 FUNCTIONS
6351
6358
6352
=head2 TableExists($table)
6359
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+7 lines)
Lines 73-78 OPAC: Link Here
73
                  no: "don't show"
73
                  no: "don't show"
74
            - icons for itemtype and authorized values.
74
            - icons for itemtype and authorized values.
75
        -
75
        -
76
            - On search result pages displayed with XSLT stylesheets on the OPAC, show the item's
77
            - pref: OPACResultsBranchXSLT
78
              choices:
79
                  holdingbranch: "holding branch"
80
                  homebranch: "home branch"
81
            - icons for itemtype and authorized values.
82
        -
76
            - pref: COinSinOPACResults
83
            - pref: COinSinOPACResults
77
              choices:
84
              choices:
78
                  yes: Include
85
                  yes: Include
(-)a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl (-29 / +58 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 1027-1051 Link Here
1027
                       <xsl:variable name="available_items"
1029
                       <xsl:variable name="available_items"
1028
                           select="key('item-by-status', 'available')"/>
1030
                           select="key('item-by-status', 'available')"/>
1029
               <xsl:choose>
1031
               <xsl:choose>
1030
               <xsl:when test="$singleBranchMode=1">
1032
                   <xsl:when test="$singleBranchMode=1">
1031
               <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
1033
                       <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]">
1032
                   <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1034
                           <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1033
                               <xsl:text> (</xsl:text>
1035
                           <xsl:text> (</xsl:text>
1034
                               <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
1036
                           <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/>
1035
                               <xsl:text>)</xsl:text>
1037
                           <xsl:text>)</xsl:text>
1036
                               <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1038
                           <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1039
                       </xsl:for-each>
1040
                   </xsl:when>
1041
                   <xsl:otherwise>
1042
                        <xsl:choose>
1043
                            <xsl:when test="$OPACResultsBranchXSLT='homebranch'">
1044
                               <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]">
1045
                                   <xsl:value-of select="items:homebranch"/>
1046
                                   <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1047
                                   <xsl:text> (</xsl:text>
1048
                                   <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/>
1049
                                   <xsl:text>)</xsl:text>
1050
                                   <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1037
                               </xsl:for-each>
1051
                               </xsl:for-each>
1038
               </xsl:when>
1052
                            </xsl:when>
1039
               <xsl:otherwise>
1053
                            <xsl:when test="$OPACResultsBranchXSLT='holdingbranch'">
1040
                   <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
1054
                               <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch))[1])]">
1041
                               <xsl:value-of select="items:homebranch"/>
1055
                                   <xsl:value-of select="items:holdingbranch"/>
1042
                   <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1056
                                   <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1043
                               <xsl:text> (</xsl:text>
1057
                                   <xsl:text> (</xsl:text>
1044
                               <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
1058
                                   <xsl:value-of select="count(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch)))"/>
1045
                               <xsl:text>)</xsl:text>
1059
                                   <xsl:text>)</xsl:text>
1046
                               <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1060
                                   <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1047
                               </xsl:for-each>
1061
                               </xsl:for-each>
1048
               </xsl:otherwise>
1062
                            </xsl:when>
1063
                        </xsl:choose>
1064
                   </xsl:otherwise>
1049
               </xsl:choose>
1065
               </xsl:choose>
1050
           </span>
1066
           </span>
1051
1067
Lines 1062-1077 Link Here
1062
                   <xsl:when test="count(key('item-by-status', 'reference'))>0">
1078
                   <xsl:when test="count(key('item-by-status', 'reference'))>0">
1063
                   <span class="available">
1079
                   <span class="available">
1064
                       <b><xsl:text>Copies available for reference: </xsl:text></b>
1080
                       <b><xsl:text>Copies available for reference: </xsl:text></b>
1065
                       <xsl:variable name="reference_items"
1081
                       <xsl:variable name="reference_items" select="key('item-by-status', 'reference')"/>
1066
                           select="key('item-by-status', 'reference')"/>
1082
1067
                       <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
1083
                      <xsl:choose>
1068
                           <xsl:value-of select="items:homebranch"/>
1084
                          <xsl:when test="$OPACResultsBranchXSLT='homebranch'">
1069
						   <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1085
                              <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]">
1070
                           <xsl:text> (</xsl:text>
1086
                                  <xsl:value-of select="items:homebranch"/>
1071
                           <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
1087
                                  <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1072
                           <xsl:text>)</xsl:text>
1088
                                  <xsl:text> (</xsl:text>
1073
                   <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1089
                                  <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/>
1074
                       </xsl:for-each>
1090
                                  <xsl:text>)</xsl:text>
1091
                                  <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1092
                              </xsl:for-each>
1093
                          </xsl:when>
1094
                          <xsl:when test="$OPACResultsBranchXSLT='holdingbranch'">
1095
                              <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch))[1])]">
1096
                                  <xsl:value-of select="items:holdingbranch"/>
1097
                                  <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
1098
                                  <xsl:text> (</xsl:text>
1099
                                  <xsl:value-of select="count(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch)))"/>
1100
                                  <xsl:text>)</xsl:text>
1101
                                  <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
1102
                              </xsl:for-each>
1103
                          </xsl:when>
1104
                      </xsl:choose>
1075
                   </span>
1105
                   </span>
1076
                   </xsl:when>
1106
                   </xsl:when>
1077
                   </xsl:choose>
1107
                   </xsl:choose>
1078
- 

Return to bug 7441