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

(-)a/C4/Items.pm (+3 lines)
Lines 1008-1013 sub GetItemsInfo { Link Here
1008
           holding.opac_info as holding_branch_opac_info,
1008
           holding.opac_info as holding_branch_opac_info,
1009
           home.opac_info as home_branch_opac_info
1009
           home.opac_info as home_branch_opac_info
1010
    ";
1010
    ";
1011
    $query .= ",IF(tmp_holdsqueue.itemnumber,1,0) AS pending_hold" if !C4::Context->preference('AllowItemsOnHoldCheckout');
1011
    $query .= "
1012
    $query .= "
1012
     FROM items
1013
     FROM items
1013
     LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode
1014
     LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode
Lines 1020-1025 sub GetItemsInfo { Link Here
1020
     LEFT JOIN serial USING (serialid)
1021
     LEFT JOIN serial USING (serialid)
1021
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
1022
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
1022
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
1023
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
1024
    $query .= "
1025
    LEFT JOIN tmp_holdsqueue USING (itemnumber)" if !C4::Context->preference('AllowItemsOnHoldCheckout');
1023
    $query .= q|
1026
    $query .= q|
1024
    LEFT JOIN localization ON itemtypes.itemtype = localization.code
1027
    LEFT JOIN localization ON itemtypes.itemtype = localization.code
1025
        AND localization.entity = 'itemtypes'
1028
        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 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