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

(-)a/C4/Items.pm (+3 lines)
Lines 1005-1010 sub GetItemsInfo { Link Here
1005
           holding.opac_info as holding_branch_opac_info,
1005
           holding.opac_info as holding_branch_opac_info,
1006
           home.opac_info as home_branch_opac_info
1006
           home.opac_info as home_branch_opac_info
1007
    ";
1007
    ";
1008
    $query .= ",IF(tmp_holdsqueue.itemnumber,1,0) AS pending_hold" if !C4::Context->preference('AllowItemsOnHoldCheckout');
1008
    $query .= "
1009
    $query .= "
1009
     FROM items
1010
     FROM items
1010
     LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode
1011
     LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode
Lines 1017-1022 sub GetItemsInfo { Link Here
1017
     LEFT JOIN serial USING (serialid)
1018
     LEFT JOIN serial USING (serialid)
1018
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
1019
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
1019
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
1020
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
1021
    $query .= "
1022
    LEFT JOIN tmp_holdsqueue USING (itemnumber)" if !C4::Context->preference('AllowItemsOnHoldCheckout');
1020
    $query .= q|
1023
    $query .= q|
1021
    LEFT JOIN localization ON itemtypes.itemtype = localization.code
1024
    LEFT JOIN localization ON itemtypes.itemtype = localization.code
1022
        AND localization.entity = 'itemtypes'
1025
        AND localization.entity = 'itemtypes'
(-)a/C4/XSLT.pm (-1 / +5 lines)
Lines 27-32 use C4::Context; Link Here
27
use C4::Items;
27
use C4::Items;
28
use C4::Koha;
28
use C4::Koha;
29
use C4::Biblio;
29
use C4::Biblio;
30
use C4::HoldsQueue;
30
use C4::Circulation;
31
use C4::Circulation;
31
use C4::Reserves;
32
use C4::Reserves;
32
use Koha::AuthorisedValues;
33
use Koha::AuthorisedValues;
Lines 293-299 sub buildKohaItemsNamespace { Link Here
293
        my $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} );
294
        my $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} );
294
295
295
        if ( ( $item->{itype} && $itemtypes->{ $item->{itype} }->{notforloan} ) || $item->{notforloan} || $item->{onloan} || $item->{withdrawn} || $item->{itemlost} || $item->{damaged} ||
296
        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") ){ 
297
             (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} || (defined $reservestatus && $reservestatus eq "Waiting") || $item->{pending_hold} ){
297
            if ( $item->{notforloan} < 0) {
298
            if ( $item->{notforloan} < 0) {
298
                $status = "On order";
299
                $status = "On order";
299
            } 
300
            } 
Lines 318-323 sub buildKohaItemsNamespace { Link Here
318
            if (defined $reservestatus && $reservestatus eq "Waiting") {
319
            if (defined $reservestatus && $reservestatus eq "Waiting") {
319
                $status = 'Waiting';
320
                $status = 'Waiting';
320
            }
321
            }
322
            if ($item->{pending_hold}) {
323
                $status = 'Pending hold';
324
            }
321
        } else {
325
        } else {
322
            $status = "available";
326
            $status = "available";
323
        }
327
        }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +1 lines)
Lines 188-194 Circulation: Link Here
188
              choices:
188
              choices:
189
                  yes: Allow
189
                  yes: Allow
190
                  no: "Don't allow"
190
                  no: "Don't allow"
191
            - checkouts of items reserved to someone else. If allowed do not generate RESERVE_WAITING and RESERVED warning. This allows self checkouts for those items.
191
            - 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".
192
        -
192
        -
193
            - pref: AllowItemsOnHoldCheckoutSCO
193
            - pref: AllowItemsOnHoldCheckoutSCO
194
              choices:
194
              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 restrictedopac = item.restrictedopac %][% END %]
98
    [% IF NOT item.isa('Koha::Item') %][% SET restrictedopac = item.restrictedopac %][% END %]
94
    <span class="item-status available">Available [% IF restrictedopac %]<span class="restricted">([% restrictedopac | html %])</span>[% END %]</span>
99
    <span class="item-status available">Available [% IF restrictedopac %]<span class="restricted">([% restrictedopac | html %])</span>[% END %]</span>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl (+6 lines)
Lines 1297-1302 Link Here
1297
                       <xsl:value-of select="count(key('item-by-status', 'On order'))"/>
1297
                       <xsl:value-of select="count(key('item-by-status', 'On order'))"/>
1298
                       <xsl:text>). </xsl:text>                   </span>
1298
                       <xsl:text>). </xsl:text>                   </span>
1299
                   </xsl:if>
1299
                   </xsl:if>
1300
                    <xsl:if test="count(key('item-by-status', 'Pending hold'))>0">
1301
                   <span class="unavailable">
1302
                       <xsl:text>Pending hold (</xsl:text>
1303
                       <xsl:value-of select="count(key('item-by-status', 'Pending hold'))"/>
1304
                       <xsl:text>). </xsl:text>                   </span>
1305
                   </xsl:if>
1300
                    <xsl:if test="count(key('item-by-status', 'In transit'))>0">
1306
                    <xsl:if test="count(key('item-by-status', 'In transit'))>0">
1301
                   <span class="unavailable">
1307
                   <span class="unavailable">
1302
                       <xsl:text>In transit (</xsl:text>
1308
                       <xsl:text>In transit (</xsl:text>
(-)a/t/db_dependent/Items.t (-2 / +14 lines)
Lines 250-256 subtest 'GetHiddenItemnumbers tests' => sub { Link Here
250
250
251
subtest 'GetItemsInfo tests' => sub {
251
subtest 'GetItemsInfo tests' => sub {
252
252
253
    plan tests => 4;
253
    plan tests => 6;
254
254
255
    $schema->storage->txn_begin;
255
    $schema->storage->txn_begin;
256
256
Lines 294-299 subtest 'GetItemsInfo tests' => sub { Link Here
294
    is( exists( $results[0]->{ onsite_checkout } ), 1,
294
    is( exists( $results[0]->{ onsite_checkout } ), 1,
295
        'GetItemsInfo returns a onsite_checkout key' );
295
        'GetItemsInfo returns a onsite_checkout key' );
296
296
297
    t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 0 );
298
    #place item into holds queue
299
    my $dbh = C4::Context->dbh;
300
    $dbh->do(q{INSERT INTO tmp_holdsqueue (biblionumber, itemnumber, surname, borrowernumber ) VALUES (?, ?, "Zorro", 42)}, undef, $item_bibnum, $itemnumber);
301
    @results = GetItemsInfo( $biblionumber );
302
    is( $results[0]->{ pending_hold }, "1",
303
        'Hold marked as pending/unavailable if not AllowItemsOnHoldCheckout' );
304
    t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 1 );
305
    @results = GetItemsInfo( $biblionumber );
306
    is( $results[0]->{ pending_hold }, undef,
307
        'Hold not marked as pending/unavailable if AllowItemsOnHoldCheckout' );
308
309
297
    $schema->storage->txn_rollback;
310
    $schema->storage->txn_rollback;
298
};
311
};
299
312
300
- 

Return to bug 15505