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

(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl (-1 / +131 lines)
Lines 3-23 Link Here
3
<!DOCTYPE stylesheet>
3
<!DOCTYPE stylesheet>
4
<xsl:stylesheet version="1.0"
4
<xsl:stylesheet version="1.0"
5
  xmlns:marc="http://www.loc.gov/MARC21/slim"
5
  xmlns:marc="http://www.loc.gov/MARC21/slim"
6
  xmlns:items="http://www.koha-community.org/items"
6
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
8
  xmlns:exsl="http://exslt.org/common"
7
  xmlns:str="http://exslt.org/strings"
9
  xmlns:str="http://exslt.org/strings"
8
  exclude-result-prefixes="marc str">
10
  exclude-result-prefixes="marc items str" extension-element-prefixes="exsl">
9
    <xsl:import href="MARC21slimUtils.xsl"/>
11
    <xsl:import href="MARC21slimUtils.xsl"/>
10
    <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
12
    <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
11
13
14
    <xsl:key name="item-by-status" match="items:item" use="items:status"/>
15
12
    <xsl:template match="/">
16
    <xsl:template match="/">
13
            <xsl:apply-templates/>
17
            <xsl:apply-templates/>
14
    </xsl:template>
18
    </xsl:template>
15
    <xsl:template match="marc:record">
19
    <xsl:template match="marc:record">
16
20
21
        <xsl:variable name="itemcount" select="count(items:items/items:item)"/>
22
17
        <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
23
        <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
18
        <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>
24
        <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>
19
        <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/>
25
        <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/>
20
26
27
        <xsl:variable name="ResultsMaxItems" select="number(marc:sysprefs/marc:syspref[@name='maxItemsInSearchResults']+0)"/>
28
        <xsl:variable name="ResultsLibrary" select="marc:sysprefs/marc:syspref[@name='StaffSearchResultsDisplayBranch']"/>
21
        <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
29
        <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
22
        <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='Display856uAsImage']"/>
30
        <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='Display856uAsImage']"/>
23
        <xsl:variable name="AlternateHoldingsField" select="substring(marc:sysprefs/marc:syspref[@name='AlternateHoldingsField'], 1, 3)"/>
31
        <xsl:variable name="AlternateHoldingsField" select="substring(marc:sysprefs/marc:syspref[@name='AlternateHoldingsField'], 1, 3)"/>
Lines 973-978 Link Here
973
	</span>
981
	</span>
974
    </xsl:if>
982
    </xsl:if>
975
983
984
    <!-- Availability line -->
985
    <div class="results_summary availability">
986
987
        <xsl:variable name="item_status_list">
988
            <status english="Checked out">Checked out</status>
989
            <status english="Withdrawn">Withdrawn</status>
990
            <status english="Lost">Lost</status>
991
            <status english="Damaged">Damaged</status>
992
            <status english="Pending hold">Pending hold</status>
993
            <status english="In transit">In transit</status>
994
            <status english="Hold waiting">On hold</status>
995
            <status english="Recall waiting">Waiting recall</status>
996
            <status english="Not for loan">Not for loan</status>
997
        </xsl:variable>
998
999
        <span class="label">Availability: </span>
1000
1001
        <xsl:choose>
1002
            <!-- When there are no items, try alternate holdings -->
1003
            <xsl:when test="$itemcount=0">
1004
                <xsl:choose>
1005
                    <xsl:when test="string-length($AlternateHoldingsField)=3 and marc:datafield[@tag=$AlternateHoldingsField]">
1006
                    <xsl:variable name="AlternateHoldingsCount" select="count(marc:datafield[@tag=$AlternateHoldingsField])"/>
1007
                    <xsl:for-each select="marc:datafield[@tag=$AlternateHoldingsField][1]">
1008
                        <xsl:call-template name="subfieldSelect">
1009
                            <xsl:with-param name="codes"><xsl:value-of select="$AlternateHoldingsSubfields"/></xsl:with-param>
1010
                            <xsl:with-param name="delimeter"><xsl:value-of select="$AlternateHoldingsSeparator"/></xsl:with-param>
1011
                        </xsl:call-template>
1012
                    </xsl:for-each>
1013
                    (<xsl:value-of select="$AlternateHoldingsCount"/>)
1014
                    </xsl:when>
1015
                    <xsl:otherwise><span class="noitems">No items available.</span> </xsl:otherwise>
1016
                </xsl:choose>
1017
            </xsl:when>
1018
1019
            <xsl:otherwise>
1020
                <xsl:variable name="sumAv" select="count(key('item-by-status', 'available'))"/>
1021
                <xsl:variable name="sumRef" select="count(key('item-by-status', 'reference'))"/>
1022
1023
                <!-- Availability part 1: ITEMS FOR LOAN -->
1024
                <xsl:if test="$sumAv>0"><span class="available reallyavailable">
1025
                    <span class="AvailabilityLabel"><strong><xsl:text>Items available for loan: </xsl:text></strong></span>
1026
                    <xsl:variable name="available_items" select="key('item-by-status', 'available')"/>
1027
                    <!-- group by branch, see also pref StaffSearchResultsDisplayBranch -->
1028
                    <xsl:for-each select="$available_items[not(items:resultbranch=preceding-sibling::*[items:status='available']/items:resultbranch)]">
1029
                        <xsl:sort select="items:resultbranch"/>
1030
                        <xsl:variable name="currentbranch" select="items:resultbranch"/>
1031
                        <span class="ItemSummary">
1032
                        <xsl:call-template name="listCallNumbers">
1033
                            <xsl:with-param name="items" select="$available_items[items:resultbranch=$currentbranch]"/>
1034
                            <xsl:with-param name="max" select="$ResultsMaxItems"/>
1035
                            <xsl:with-param name="status_text" select="$currentbranch"/>
1036
                            <xsl:with-param name="class_block" select="'available'"/>
1037
                            <xsl:with-param name="class_status" select="'ItemBranch'"/>
1038
                        </xsl:call-template>
1039
                        </span>
1040
                    </xsl:for-each>
1041
                </span></xsl:if>
1042
1043
                <!-- Availability part 2: ITEMS FOR REFERENCE (see also pref Reference_NFL_Statuses) -->
1044
                <xsl:if test="$sumRef>0"><span class="available reference">
1045
                    <span class="AvailabilityLabel"><strong><xsl:text>Items available for reference: </xsl:text></strong></span>
1046
                    <xsl:variable name="reference_items" select="key('item-by-status', 'reference')"/>
1047
                    <!-- group by branch, then by substatus -->
1048
                    <xsl:for-each select="$reference_items[not(items:resultbranch=preceding-sibling::*[items:status='reference']/items:resultbranch)]">
1049
                        <xsl:sort select="items:resultbranch"/>
1050
                        <xsl:variable name="currentbranch" select="items:resultbranch"/>
1051
                        <xsl:for-each select="$reference_items[not(items:substatus=preceding-sibling::*[items:status='reference']/items:substatus)]">
1052
                            <xsl:sort select="items:substatus"/>
1053
                            <xsl:variable name="current_substatus" select="items:substatus"/>
1054
                            <span class="ItemSummary">
1055
                            <xsl:call-template name="listCallNumbers">
1056
                                <xsl:with-param name="items" select="$reference_items[items:resultbranch=$currentbranch and items:substatus=$current_substatus]"/>
1057
                                <xsl:with-param name="max" select="$ResultsMaxItems"/>
1058
                                <xsl:with-param name="status_text">
1059
                                    <xsl:value-of select="concat($currentbranch,': ')"/>
1060
                                    <xsl:value-of select="exsl:node-set($item_status_list)/status[@english=$current_substatus]|$current_substatus"/>
1061
                                    <!-- Note that value-of here picks string value of first node only from the union; keep in mind too that current_substatus may contain an authorised value -->
1062
                                </xsl:with-param>
1063
                                <xsl:with-param name="class_block" select="concat('notforloandesc_',$current_substatus)"/>
1064
                                <xsl:with-param name="class_status" select="'ItemBranch'"/>
1065
                            </xsl:call-template>
1066
                            </span>
1067
                        </xsl:for-each>
1068
                    </xsl:for-each>
1069
                </span></xsl:if>
1070
1071
                <!-- Availability part 3: UNAVAILABLE ITEMS (see also pref Reference_NFL_Statuses); status reallynotforloan or status other -->
1072
                <xsl:if test="number($sumAv+$sumRef) &lt; number($itemcount)"><span class="unavailable">
1073
                    <span class="AvailabilityLabel"><strong><xsl:text>Not available: </xsl:text></strong></span>
1074
                    <xsl:variable name="unavailable_items" select="key('item-by-status', 'reallynotforloan')|key('item-by-status', 'other')"/>
1075
                    <xsl:choose>
1076
                        <!-- First group by branch -->
1077
                        <xsl:for-each select="items:items/items:item[not(items:resultbranch=preceding-sibling::*/items:resultbranch)]">
1078
                            <xsl:sort select="items:resultbranch"/>
1079
                            <xsl:variable name="currentbranch" select="items:resultbranch"/>
1080
                            <span class="ItemSummary unavailable">
1081
                            <!-- Within same branch, group by substatus -->
1082
                            <xsl:for-each select="$unavailable_items[not(items:substatus=preceding-sibling::*[items:status='reallynotforloan' or items:status='other']/items:substatus)]">
1083
                                <xsl:sort select="items:substatus"/>
1084
                                <xsl:variable name="current_substatus" select="items:substatus"/>
1085
                                    <xsl:call-template name="listCallNumbers">
1086
                                        <xsl:with-param name="items" select="$unavailable_items[items:resultbranch=$currentbranch and items:substatus=$current_substatus]"/>
1087
                                        <xsl:with-param name="status_text">
1088
                                            <xsl:value-of select="$currentbranch"/>
1089
                                            <xsl:text>: </xsl:text>
1090
                                            <xsl:value-of select="exsl:node-set($item_status_list)/status[@english=$current_substatus]|$current_substatus"/><!-- See former comment on value-of and union -->
1091
                                        </xsl:with-param>
1092
                                        <xsl:with-param name="class_block" select="concat('unavailable_',items:substatus)"/>
1093
                                        <xsl:with-param name="class_status" select="'ItemBranch'"/>
1094
                                    </xsl:call-template>
1095
                            </xsl:for-each>
1096
                            </span>
1097
                        </xsl:for-each>
1098
                    </xsl:choose>
1099
                </span></xsl:if>
1100
1101
            </xsl:otherwise>
1102
        </xsl:choose>
1103
    </div>
1104
    <!-- End of Availability line -->
1105
976
    <xsl:call-template name="host-item-entries">
1106
    <xsl:call-template name="host-item-entries">
977
        <xsl:with-param name="UseControlNumber" select="$UseControlNumber"/>
1107
        <xsl:with-param name="UseControlNumber" select="$UseControlNumber"/>
978
    </xsl:call-template>
1108
    </xsl:call-template>
(-)a/virtualshelves/shelves.pl (-5 / +10 lines)
Lines 328-339 if ( $op eq 'view' ) { Link Here
328
                my $biblio       = Koha::Biblios->find($biblionumber);
328
                my $biblio       = Koha::Biblios->find($biblionumber);
329
                my $record       = $biblio->metadata->record;
329
                my $record       = $biblio->metadata->record;
330
330
331
                #my $items        = $biblio->items;
332
                my $variables = { anonymous_session => ($loggedinuser) ? 0 : 1 };
333
331
                $this_item->{XSLTBloc} = XSLTParse4Display(
334
                $this_item->{XSLTBloc} = XSLTParse4Display(
332
                    {
335
                    {
333
                        biblionumber => $biblionumber,
336
                        biblionumber   => $biblionumber,
334
                        record       => $record,
337
                        record         => $record,
335
                        xsl_syspref  => 'XSLTListsDisplay',
338
                        xsl_syspref    => 'XSLTListsDisplay',
336
                        fix_amps     => 1,
339
                        fix_amps       => 1,
340
                        xslt_variables => $variables,
341
342
                        #items_rs     => $items->reset,
337
                    }
343
                    }
338
                );
344
                );
339
345
340
- 

Return to bug 32419