holding.opac_info as holding_branch_opac_info,
home.opac_info as home_branch_opac_info
";
+ $query .= ",IF(tmp_holdsqueue.itemnumber,1,0) AS pending_hold" if !C4::Context->preference('AllowItemsOnHoldCheckout');
$query .= "
FROM items
LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode
LEFT JOIN serial USING (serialid)
LEFT JOIN itemtypes ON itemtypes.itemtype = "
. (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
+ $query .= "
+ LEFT JOIN tmp_holdsqueue USING (itemnumber)" if !C4::Context->preference('AllowItemsOnHoldCheckout');
$query .= q|
LEFT JOIN localization ON itemtypes.itemtype = localization.code
AND localization.entity = 'itemtypes'
my $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} );
if ( ( $item->{itype} && $itemtypes->{ $item->{itype} }->{notforloan} ) || $item->{notforloan} || $item->{onloan} || $item->{withdrawn} || $item->{itemlost} || $item->{damaged} ||
- (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} || (defined $reservestatus && $reservestatus eq "Waiting") ){
+ (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} || (defined $reservestatus && $reservestatus eq "Waiting") || $item->{pending_hold} ){
if ( $item->{notforloan} < 0) {
$status = "On order";
- }
+ }
if ( $item->{itemnotforloan} && $item->{itemnotforloan} > 0 || $item->{notforloan} && $item->{notforloan} > 0 || $item->{itype} && $itemtypes->{ $item->{itype} }->{notforloan} && $itemtypes->{ $item->{itype} }->{notforloan} == 1 ) {
$status = "reference";
}
if (defined $reservestatus && $reservestatus eq "Waiting") {
$status = 'Waiting';
}
+ if ($item->{pending_hold}) {
+ $status = 'Pending hold';
+ }
} else {
$status = "available";
}
choices:
yes: Allow
no: "Don't allow"
- - checkouts of items reserved to someone else. If allowed do not generate RESERVE_WAITING and RESERVED warning. This allows self checkouts for those items.
+ - checkouts of items reserved to someone else. If allowed do not generate RESERVE_WAITING and RESERVED warning. This allows self checkouts for those items. If using the holds queue items with pending holds will be marked as "unavailable" if this set to "Don't Allow".
-
- pref: AllowItemsOnHoldCheckoutSCO
choices:
<span class="item-status onorder">On order</span>
[% END %]
+[% IF item.pending_hold %]
+ [% SET itemavailable = 0 %]
+ <span class="item-status pendinghold">Pending hold</span>
+[% END %]
+
[% IF ( itemavailable ) %]
[% IF NOT item.isa('Koha::Item') %][% SET restrictedvalueopac = item.restrictedvalueopac %][% END %]
<span class="item-status available">Available [% IF restrictedvalueopac %]<span class="restricted">([% restrictedvalueopac | html %])</span>[% END %]</span>
<xsl:value-of select="count(key('item-by-status', 'On order'))"/>
<xsl:text>). </xsl:text> </span>
</xsl:if>
+ <xsl:if test="count(key('item-by-status', 'Pending hold'))>0">
+ <span class="unavailable">
+ <xsl:text>Pending hold (</xsl:text>
+ <xsl:value-of select="count(key('item-by-status', 'Pending hold'))"/>
+ <xsl:text>). </xsl:text> </span>
+ </xsl:if>
<xsl:if test="count(key('item-by-status', 'In transit'))>0">
<span class="unavailable">
<xsl:text>In transit (</xsl:text>
subtest 'GetItemsInfo tests' => sub {
- plan tests => 7;
+ plan tests => 9;
$schema->storage->txn_begin;
is( $results[0]->{ restrictedvalueopac }, "Restricted Access OPAC",
'GetItemsInfo returns a restricted value description (OPAC)' );
+ t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 0 );
+ #place item into holds queue
+ my $dbh = C4::Context->dbh;
+ $dbh->do(q{INSERT INTO tmp_holdsqueue (biblionumber, itemnumber, surname, borrowernumber ) VALUES (?, ?, "Zorro", 42)}, undef, $item_bibnum, $itemnumber);
+ @results = GetItemsInfo( $biblio->biblionumber );
+ is( $results[0]->{ pending_hold }, "1",
+ 'Hold marked as pending/unavailable if not AllowItemsOnHoldCheckout' );
+ t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 1 );
+ @results = GetItemsInfo( $biblio->biblionumber );
+ is( $results[0]->{ pending_hold }, undef,
+ 'Hold not marked as pending/unavailable if AllowItemsOnHoldCheckout' );
+
+
$schema->storage->txn_rollback;
};