Bug 7611: (follow-up) Fix display of undefined statuses and add a class
authorNick Clemens <nick@bywatersolutions.com>
Tue, 5 Nov 2019 16:32:45 +0000 (16:32 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 17 Feb 2020 11:21:32 +0000 (11:21 +0000)
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

C4/XSLT.pm
koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl

index e0bfde7..1cc5ebe 100644 (file)
@@ -344,8 +344,7 @@ sub buildKohaItemsNamespace {
         }
         elsif ( $item->notforloan ) {
                 $status = "reallynotforloan";
-                $substatus = $descs{$item->{notforloan}} || '';
-                $substatus = $substatus->{opac_description} if $substatus;
+                $substatus = exists $descs{$item->{notforloan}} ? $descs{$item->{notforloan}}->{opac_description} : "Not for loan_$item->{notforloan}";
         }
         elsif ( exists $itemtypes->{ $item->effective_itemtype }
             && $itemtypes->{ $item->effective_itemtype }->{notforloan} == 1 )
index c403a46..edff548 100644 (file)
                               <br />
                              <xsl:variable name="reference_items" select="key('item-by-status', 'reallynotforloan')"/>
                              <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-substatus-and-branch', concat(items:substatus, ' ', items:homebranch))[1])]">
-                                <span class="ItemSummary">
+                                <span>
+                                    <xsl:attribute name="class">
+                                        ItemSummary
+                                        <xsl:value-of select="translate(items:substatus,' ','_')"/>
+                                    </xsl:attribute>
                                     <xsl:if test="$singleBranchMode=0">
                                            <span class="ItemBranch"><xsl:value-of select="items:homebranch"/><xsl:text> </xsl:text></span>
                                     </xsl:if>