Bug 7611: Change negative notforloan as well

This makes the changes apply to both positive and negative notforloan values

The extra line generated before is removed

Some spans are added and cleaned up and labels moved to CSS to allow for easier altering where needed

Itemtypes marked notforloan remain as reference, the label can be changed via css

To test:
 1 - Have a record with items in various statuses, ideally
   - 3 available, with 2 in one branch, 1 in another
   - 3 with itemtype not for loan, 2 in one branch, 1 in another
   - 3 in a positive not for loan status, 2 and 1 as above
   - 3 in a negative not for loan status, 2 and 1 as above
   - 1 in a different positive loan status, but with the same opac description as the negative above
 2 - Search the opac to include this record, take a screenshot
 3 - Apply patch
 4 - Restart all and refresh
 5 - Compare to screen shot
 6 - Differences include:
   - Positive statuses are now on separate line with opac description showing
   - Unavailable (not for loan items) now include callnumber and branch in display
   - Positive and negative notforloan with same description are combined where branches match
   - Inspect the elements, note new spans around 'Items available for
loan/reference'
 7 - Add to OPACUserCSS:
  .ItemSummary .ItemBranch{
    display:none;
  }
  .unavailable .ItemSummary .CallNumber,.unavailable .ItemSummary .LabelCallNumber{
    display:none;
  }
 8 - Note the branches are hidden, and callnumbe rhidden for unavailable
items

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
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-08-29 12:06:24 +00:00 committed by Martin Renvoize
parent d8159b61f5
commit 86f203ebe5
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F
3 changed files with 53 additions and 29 deletions

View file

@ -320,7 +320,6 @@ sub buildKohaItemsNamespace {
for my $item (@items) { for my $item (@items) {
my $status; my $status;
my $substatus = ''; my $substatus = '';
<<<<<<< HEAD
if ($item->has_pending_hold) { if ($item->has_pending_hold) {
$status = 'Pending hold'; $status = 'Pending hold';
@ -343,13 +342,12 @@ sub buildKohaItemsNamespace {
elsif ($item->onloan) { elsif ($item->onloan) {
$status = "Checked out"; $status = "Checked out";
} }
elsif ( $item->notforloan > 0 ) { elsif ( $item->notforloan ) {
$status = "reallynotforloan"; $status = "reallynotforloan";
$substatus = $descs{$item->{notforloan}} || ''; $substatus = $descs{$item->{notforloan}} || '';
$substatus = $substatus->{opac_description} if $substatus; $substatus = $substatus->{opac_description} if $substatus;
} }
elsif ( $item->notforloan && $item->notforloan > 0 elsif ( exists $itemtypes->{ $item->effective_itemtype }
|| exists $itemtypes->{ $item->effective_itemtype }
&& $itemtypes->{ $item->effective_itemtype }->{notforloan} == 1 ) && $itemtypes->{ $item->effective_itemtype }->{notforloan} == 1 )
{ {
$status = "reference"; $status = "reference";

View file

@ -2445,6 +2445,14 @@ button {
color: #990033; color: #990033;
} }
.ItemSummary .LabelCallNumber::before {
content: "[";
}
.ItemSummary .CallNumber::after {
content: "]";
}
.waiting, .waiting,
.intransit, .intransit,
.notforloan, .notforloan,

View file

@ -1233,8 +1233,8 @@
</xsl:choose> </xsl:choose>
</xsl:when> </xsl:when>
<xsl:when test="count(key('item-by-status', 'available'))>0"> <xsl:when test="count(key('item-by-status', 'available'))>0">
<span class="available"> <span class="available reallyavailable">
<b><xsl:text>Items available for loan: </xsl:text></b> <span class="AvailabilityLabel"><strong><xsl:text>Items available for loan: </xsl:text></strong></span>
<xsl:variable name="available_items" <xsl:variable name="available_items"
select="key('item-by-status', 'available')"/> select="key('item-by-status', 'available')"/>
<xsl:choose> <xsl:choose>
@ -1243,7 +1243,8 @@
<span class="ItemSummary"> <span class="ItemSummary">
<xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">
<span class="CallNumberAndLabel"> <span class="CallNumberAndLabel">
[<span class="LabelCallNumber">Call number: </span><span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/></span>] <span class="LabelCallNumber">Call number: </span>
<span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/></span>
</span> </span>
</xsl:if> </xsl:if>
<xsl:text> (</xsl:text> <xsl:text> (</xsl:text>
@ -1261,10 +1262,11 @@
<xsl:when test="$OPACResultsLibrary='homebranch'"> <xsl:when test="$OPACResultsLibrary='homebranch'">
<xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]"> <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]">
<span class="ItemSummary"> <span class="ItemSummary">
<xsl:value-of select="items:homebranch"/> <span class="ItemBranch"><xsl:value-of select="items:homebranch"/> </span>
<xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'">
<span class="CallNumberAndLabel"> <span class="CallNumberAndLabel">
[<span class="LabelCallNumber">Call number: </span><span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/></span>] <span class="LabelCallNumber">Call number: </span>
<span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/></span>
</span> </span>
</xsl:if> </xsl:if>
<xsl:text> (</xsl:text> <xsl:text> (</xsl:text>
@ -1280,10 +1282,11 @@
<xsl:otherwise> <xsl:otherwise>
<xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch))[1])]"> <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch))[1])]">
<span class="ItemSummary"> <span class="ItemSummary">
<xsl:value-of select="items:holdingbranch"/> <span class="ItemBranch"><xsl:value-of select="items:holdingbranch"/> </span>
<xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'">
<span class="CallNumberAndLabel"> <span class="CallNumberAndLabel">
[<span class="LabelCallNumber">Call number: </span><span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/></span>] <span class="LabelCallNumber">Call number: </span>
<span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/></span>
</span> </span>
</xsl:if> </xsl:if>
<xsl:text> (</xsl:text> <xsl:text> (</xsl:text>
@ -1306,17 +1309,18 @@
<xsl:choose> <xsl:choose>
<xsl:when test="count(key('item-by-status', 'reference'))>0"> <xsl:when test="count(key('item-by-status', 'reference'))>0">
<span class="available"> <span class="available reference">
<b><xsl:text>Items available for reference: </xsl:text></b> <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: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])]"> <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"> <span class="ItemSummary">
<xsl:if test="$singleBranchMode=0"> <xsl:if test="$singleBranchMode=0">
<xsl:value-of select="items:homebranch"/> <span class="ItemBranch"><xsl:value-of select="items:homebranch"/> </span>
</xsl:if> </xsl:if>
<xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">
<span class="CallNumberAndLabel"> <span class="CallNumberAndLabel">
[<span class="LabelCallNumber">Call number: </span><span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/></span>] <span class="LabelCallNumber">Call number: </span>
<span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/></span>
</span> </span>
</xsl:if> </xsl:if>
<xsl:text> (</xsl:text> <xsl:text> (</xsl:text>
@ -1329,12 +1333,6 @@
</xsl:when> </xsl:when>
</xsl:choose> </xsl:choose>
<xsl:choose> <xsl:when test="count(key('item-by-status', 'available'))>0">
<xsl:choose><xsl:when test="count(key('item-by-status', 'reference'))>0">
<br/>
</xsl:when></xsl:choose>
</xsl:when> </xsl:choose>
<xsl:if test="count(key('item-by-status', 'available'))=0"> <xsl:if test="count(key('item-by-status', 'available'))=0">
<span class="available"><xsl:value-of select="items:homebranch"/><xsl:text>: </xsl:text></span> <span class="available"><xsl:value-of select="items:homebranch"/><xsl:text>: </xsl:text></span>
</xsl:if> </xsl:if>
@ -1345,12 +1343,22 @@
<br /> <br />
<xsl:variable name="reference_items" select="key('item-by-status', 'reallynotforloan')"/> <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:for-each select="$reference_items[generate-id() = generate-id(key('item-by-substatus-and-branch', concat(items:substatus, ' ', items:homebranch))[1])]">
<xsl:value-of select="items:substatus"/> <span class="ItemSummary">
<xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<span class="LabelCallNumber">Call number: </span><xsl:value-of select="items:itemcallnumber"/>]</xsl:if> <xsl:if test="$singleBranchMode=0">
<xsl:text> (</xsl:text> <span class="ItemBranch"><xsl:value-of select="items:homebranch"/><xsl:text> </xsl:text></span>
<xsl:value-of select="count(key('item-by-substatus-and-branch', concat(items:substatus, ' ', items:homebranch)))"/> </xsl:if>
<xsl:text>)</xsl:text> <span class='notforloandesc'><xsl:value-of select="items:substatus"/></span>
<xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">
<span class="CallNumberAndLabel">
<span class="LabelCallNumber">Call number: </span>
<span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/></span>
</span>
</xsl:if>
<xsl:text> (</xsl:text>
<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>
</xsl:for-each> </xsl:for-each>
</span> </span>
</xsl:when> </xsl:when>
@ -1419,7 +1427,12 @@
<xsl:when test="$OPACItemLocation='location'"><b><xsl:value-of select="concat(items:location,' ')"/></b></xsl:when> <xsl:when test="$OPACItemLocation='location'"><b><xsl:value-of select="concat(items:location,' ')"/></b></xsl:when>
<xsl:when test="$OPACItemLocation='ccode'"><b><xsl:value-of select="concat(items:ccode,' ')"/></b></xsl:when> <xsl:when test="$OPACItemLocation='ccode'"><b><xsl:value-of select="concat(items:ccode,' ')"/></b></xsl:when>
</xsl:choose> </xsl:choose>
<xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"><span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/></span></xsl:if> <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">
<span class="CallNumberAndLabel">
<span class="LabelCallNumber">Call number: </span>
<span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/></span>
</span>
</xsl:if>
<xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each> </xsl:for-each>
</span> </span>
@ -1432,7 +1445,12 @@
<xsl:when test="$OPACItemLocation='location'"><b><xsl:value-of select="concat(items:location,' ')"/></b></xsl:when> <xsl:when test="$OPACItemLocation='location'"><b><xsl:value-of select="concat(items:location,' ')"/></b></xsl:when>
<xsl:when test="$OPACItemLocation='ccode'"><b><xsl:value-of select="concat(items:ccode,' ')"/></b></xsl:when> <xsl:when test="$OPACItemLocation='ccode'"><b><xsl:value-of select="concat(items:ccode,' ')"/></b></xsl:when>
</xsl:choose> </xsl:choose>
<xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"><span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/></span></xsl:if> <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">
<span class="CallNumberAndLabel">
<span class="LabelCallNumber">Call number: </span>
<span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/></span>
</span>
</xsl:if>
<xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each> </xsl:for-each>
</span> </span>