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

(-)a/C4/Items.pm (+3 lines)
Lines 963-968 sub GetItemsInfo { Link Here
963
           holding.opac_info as holding_branch_opac_info,
963
           holding.opac_info as holding_branch_opac_info,
964
           home.opac_info as home_branch_opac_info
964
           home.opac_info as home_branch_opac_info
965
    ";
965
    ";
966
    $query .= ",IF(tmp_holdsqueue.itemnumber,1,0) AS pending_hold" if !C4::Context->preference('AllowItemsOnHoldCheckout');
966
    $query .= "
967
    $query .= "
967
     FROM items
968
     FROM items
968
     LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode
969
     LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode
Lines 975-980 sub GetItemsInfo { Link Here
975
     LEFT JOIN serial USING (serialid)
976
     LEFT JOIN serial USING (serialid)
976
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
977
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
977
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
978
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
979
    $query .= "
980
    LEFT JOIN tmp_holdsqueue USING (itemnumber)" if !C4::Context->preference('AllowItemsOnHoldCheckout');
978
    $query .= q|
981
    $query .= q|
979
    LEFT JOIN localization ON itemtypes.itemtype = localization.code
982
    LEFT JOIN localization ON itemtypes.itemtype = localization.code
980
        AND localization.entity = 'itemtypes'
983
        AND localization.entity = 'itemtypes'
(-)a/C4/XSLT.pm (-1 / +4 lines)
Lines 293-299 sub buildKohaItemsNamespace { Link Here
293
        my $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} );
293
        my $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} );
294
294
295
        if ( ( $item->{itype} && $itemtypes->{ $item->{itype} }->{notforloan} ) || $item->{notforloan} || $item->{onloan} || $item->{withdrawn} || $item->{itemlost} || $item->{damaged} ||
295
        if ( ( $item->{itype} && $itemtypes->{ $item->{itype} }->{notforloan} ) || $item->{notforloan} || $item->{onloan} || $item->{withdrawn} || $item->{itemlost} || $item->{damaged} ||
296
             (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} || (defined $reservestatus && $reservestatus eq "Waiting") ){ 
296
             (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} || (defined $reservestatus && $reservestatus eq "Waiting") || $item->{pending_hold} ){
297
            if ( $item->{notforloan} < 0) {
297
            if ( $item->{notforloan} < 0) {
298
                $status = "On order";
298
                $status = "On order";
299
            } 
299
            } 
Lines 318-323 sub buildKohaItemsNamespace { Link Here
318
            if (defined $reservestatus && $reservestatus eq "Waiting") {
318
            if (defined $reservestatus && $reservestatus eq "Waiting") {
319
                $status = 'Waiting';
319
                $status = 'Waiting';
320
            }
320
            }
321
            if ($item->{pending_hold}) {
322
                $status = 'Pending hold';
323
            }
321
        } else {
324
        } else {
322
            $status = "available";
325
            $status = "available";
323
        }
326
        }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +1 lines)
Lines 196-202 Circulation: Link Here
196
              choices:
196
              choices:
197
                  yes: Allow
197
                  yes: Allow
198
                  no: "Don't allow"
198
                  no: "Don't allow"
199
            - checkouts of items reserved to someone else. If allowed do not generate RESERVE_WAITING and RESERVED warning. This allows self checkouts for those items.
199
            - 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".
200
        -
200
        -
201
            - pref: AllowItemsOnHoldCheckoutSCO
201
            - pref: AllowItemsOnHoldCheckoutSCO
202
              choices:
202
              choices:
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc (+5 lines)
Lines 89-94 Link Here
89
    <span class="item-status onorder">On order</span>
89
    <span class="item-status onorder">On order</span>
90
[% END %]
90
[% END %]
91
91
92
[% IF item.pending_hold %]
93
    [% SET itemavailable = 0 %]
94
    <span class="item-status pendinghold">Pending hold</span>
95
[% END %]
96
92
[% IF ( itemavailable ) %]
97
[% IF ( itemavailable ) %]
93
    [% IF NOT item.isa('Koha::Item') %][% SET restrictedvalueopac = item.restrictedvalueopac %][% END %]
98
    [% IF NOT item.isa('Koha::Item') %][% SET restrictedvalueopac = item.restrictedvalueopac %][% END %]
94
    <span class="item-status available">Available [% IF restrictedvalueopac %]<span class="restricted">([% restrictedvalueopac | html %])</span>[% END %]</span>
99
    <span class="item-status available">Available [% IF restrictedvalueopac %]<span class="restricted">([% restrictedvalueopac | html %])</span>[% END %]</span>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl (+6 lines)
Lines 1299-1304 Link Here
1299
                       <xsl:value-of select="count(key('item-by-status', 'On order'))"/>
1299
                       <xsl:value-of select="count(key('item-by-status', 'On order'))"/>
1300
                       <xsl:text>). </xsl:text>                   </span>
1300
                       <xsl:text>). </xsl:text>                   </span>
1301
                   </xsl:if>
1301
                   </xsl:if>
1302
                    <xsl:if test="count(key('item-by-status', 'Pending hold'))>0">
1303
                   <span class="unavailable">
1304
                       <xsl:text>Pending hold (</xsl:text>
1305
                       <xsl:value-of select="count(key('item-by-status', 'Pending hold'))"/>
1306
                       <xsl:text>). </xsl:text>                   </span>
1307
                   </xsl:if>
1302
                    <xsl:if test="count(key('item-by-status', 'In transit'))>0">
1308
                    <xsl:if test="count(key('item-by-status', 'In transit'))>0">
1303
                   <span class="unavailable">
1309
                   <span class="unavailable">
1304
                       <xsl:text>In transit (</xsl:text>
1310
                       <xsl:text>In transit (</xsl:text>
(-)a/t/db_dependent/Items.t (-2 / +14 lines)
Lines 251-257 subtest 'GetHiddenItemnumbers tests' => sub { Link Here
251
251
252
subtest 'GetItemsInfo tests' => sub {
252
subtest 'GetItemsInfo tests' => sub {
253
253
254
    plan tests => 7;
254
    plan tests => 9;
255
255
256
    $schema->storage->txn_begin;
256
    $schema->storage->txn_begin;
257
257
Lines 313-318 subtest 'GetItemsInfo tests' => sub { Link Here
313
    is( $results[0]->{ restrictedvalueopac }, "Restricted Access OPAC",
313
    is( $results[0]->{ restrictedvalueopac }, "Restricted Access OPAC",
314
        'GetItemsInfo returns a restricted value description (OPAC)' );
314
        'GetItemsInfo returns a restricted value description (OPAC)' );
315
315
316
    t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 0 );
317
    #place item into holds queue
318
    my $dbh = C4::Context->dbh;
319
    $dbh->do(q{INSERT INTO tmp_holdsqueue (biblionumber, itemnumber, surname, borrowernumber ) VALUES (?, ?, "Zorro", 42)}, undef, $item_bibnum, $itemnumber);
320
    @results = GetItemsInfo( $biblio->biblionumber );
321
    is( $results[0]->{ pending_hold }, "1",
322
        'Hold marked as pending/unavailable if not AllowItemsOnHoldCheckout' );
323
    t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 1 );
324
    @results = GetItemsInfo( $biblio->biblionumber );
325
    is( $results[0]->{ pending_hold }, undef,
326
        'Hold not marked as pending/unavailable if AllowItemsOnHoldCheckout' );
327
328
316
    $schema->storage->txn_rollback;
329
    $schema->storage->txn_rollback;
317
};
330
};
318
331
319
- 

Return to bug 15505