Bug 7611: (follow-up) separate positive and negative statuses as in the past

This patch preserves someting closer to previous functionality.

Negative not for loan are in the 'unavailable' section in red, positive ones are in the 'reference' section in green. Itemtype level will also be in green in reference

Item specific status will override an itemtype level.

The line break between 'reference' and 'unavailable' existed before and is preserved - negative not for loan and checked out items appear here

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Nick Clemens 2019-11-08 15:49:08 +00:00 committed by Martin Renvoize
parent 2513b4f596
commit 1f1ff392fb
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F
2 changed files with 14 additions and 11 deletions

View file

@ -343,16 +343,14 @@ sub buildKohaItemsNamespace {
$status = "Checked out";
}
elsif ( $item->notforloan ) {
$status = "reallynotforloan";
$substatus = exists $descs{$item->{notforloan}} ? $descs{$item->{notforloan}}->{opac_description} : "Not for loan_$item->{notforloan}";
$status = $item->notforloan < 0 ? "reallynotforloan" : "reference";
$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 )
{
$status = "reference";
}
elsif ( $item->notforloan < 0) {
$status = "On order";
$substatus = "Not for loan";
}
else {
$status = "available";

View file

@ -1312,11 +1312,16 @@
<span class="available reference">
<span class="AvailabilityLabel"><strong><xsl:text>Items available for reference: </xsl:text></strong></span>
<xsl:variable name="reference_items" select="key('item-by-status', 'reference')"/>
<xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]">
<span class="ItemSummary">
<xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-substatus-and-branch', concat(items:substatus, ' ', items:homebranch))[1])]">
<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"/> </span>
<span class="ItemBranch"><xsl:value-of select="items:homebranch"/><xsl:text> </xsl:text></span>
</xsl:if>
<span class='notforloandesc'><xsl:value-of select="items:substatus"/></span>
<xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">
<span class="CallNumberAndLabel">
<span class="LabelCallNumber">Call number: </span>
@ -1324,7 +1329,7 @@
</span>
</xsl:if>
<xsl:text> (</xsl:text>
<xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/>
<xsl:value-of select="count(key('item-by-substatus-and-branch', concat(items:substatus, ' ', items:homebranch)))"/>
<xsl:text>)</xsl:text>
<xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
</span>
@ -1341,8 +1346,8 @@
<xsl:when test="count(key('item-by-status', 'reallynotforloan'))>0">
<span class="unavailable">
<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])]">
<xsl:variable name="unavailable_items" select="key('item-by-status', 'reallynotforloan')"/>
<xsl:for-each select="$unavailable_items[generate-id() = generate-id(key('item-by-substatus-and-branch', concat(items:substatus, ' ', items:homebranch))[1])]">
<span>
<xsl:attribute name="class">
ItemSummary