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

(-)a/C4/Circulation.pm (-1 / +8 lines)
Lines 2761-2767 sub CanBookBeRenewed { Link Here
2761
2761
2762
    my ( $resfound, $resrec, undef ) = C4::Reserves::CheckReserves($itemnumber);
2762
    my ( $resfound, $resrec, undef ) = C4::Reserves::CheckReserves($itemnumber);
2763
2763
2764
    $resfound = 0 if $resrec->{non_priority};
2764
    # If next hold is non priority, then check if any hold with priority (non_priority = 0) exists for the same biblionumber.
2765
    if ( $resfound && $resrec->{non_priority} ) {
2766
        $resfound = Koha::Holds->search(
2767
            { biblionumber => $resrec->{biblionumber}, non_priority => 0 } )
2768
          ->count > 0;
2769
    }
2770
2771
2765
2772
2766
    # This item can fill one or more unfilled reserve, can those unfilled reserves
2773
    # This item can fill one or more unfilled reserve, can those unfilled reserves
2767
    # all be filled by other available items?
2774
    # all be filled by other available items?
(-)a/installer/data/mysql/atomicupdate/bug_22789.perl (+3 lines)
Lines 6-11 if( CheckVersion( $DBversion ) ) { Link Here
6
    # or perform some test and warn
6
    # or perform some test and warn
7
    if( !column_exists( 'reserves', 'non_priority' ) ) {
7
    if( !column_exists( 'reserves', 'non_priority' ) ) {
8
        $dbh->do("ALTER TABLE reserves ADD COLUMN `non_priority` tinyint(1) NOT NULL DEFAULT 0 AFTER `item_level_hold` -- Is this a non priority hold");
8
        $dbh->do("ALTER TABLE reserves ADD COLUMN `non_priority` tinyint(1) NOT NULL DEFAULT 0 AFTER `item_level_hold` -- Is this a non priority hold");
9
    }
10
11
    if( !column_exists( 'old_reserves', 'non_priority' ) ) {
9
        $dbh->do("ALTER TABLE old_reserves ADD COLUMN `non_priority` tinyint(1) NOT NULL DEFAULT 0 AFTER `item_level_hold` -- Is this a non priority hold");
12
        $dbh->do("ALTER TABLE old_reserves ADD COLUMN `non_priority` tinyint(1) NOT NULL DEFAULT 0 AFTER `item_level_hold` -- Is this a non priority hold");
10
    }
13
    }
11
14
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc (-21 / +36 lines)
Lines 140-177 Link Here
140
            </td>
140
            </td>
141
141
142
            <td>
142
            <td>
143
                <ul>
143
                [% IF ( hold.found ) %]
144
                [% IF ( hold.found ) %]
144
                    <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]">
145
                    <li>
145
                        [% IF ( hold.barcodenumber ) %]
146
                        <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]">
146
                            [% hold.barcodenumber | html %]
147
                            [% IF ( hold.barcodenumber ) %]
147
                            <input type="hidden" name="itemnumber" value="[% hold.itemnumber | html %]" />
148
                                [% hold.barcodenumber | html %]
148
                        [% ELSE %]
149
                                <input type="hidden" name="itemnumber" value="[% hold.itemnumber | html %]" />
149
                            No barcode
150
                            [% ELSE %]
150
                        [% END %]
151
                                No barcode
151
                    </a>
152
                            [% END %]
153
                        </a>
154
                    </li>
152
                [% ELSE %]
155
                [% ELSE %]
153
                    [% IF ( hold.item_level_hold ) %]
156
                    [% IF ( hold.item_level_hold ) %]
154
                        <i>
157
                        <li>
155
                            Only item
158
                            <i>
156
                            <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]">
159
                                Only item
157
                                [% IF ( hold.barcodenumber ) %]
160
                                <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]">
158
                                    [% hold.barcodenumber | html %]
161
                                    [% IF ( hold.barcodenumber ) %]
159
                                    <input type="hidden" name="itemnumber" value="[% hold.itemnumber | html %]" />
162
                                        [% hold.barcodenumber | html %]
160
                                [% ELSE %]
163
                                        <input type="hidden" name="itemnumber" value="[% hold.itemnumber | html %]" />
161
                                    No barcode
164
                                    [% ELSE %]
162
                                [% END %]
165
                                        No barcode
163
                            </a>
166
                                    [% END %]
164
                        </i>
167
                                </a>
168
                            </i>
169
                        </li>
165
                    [% ELSE %]
170
                    [% ELSE %]
166
                        [% IF hold.itemtype %]
171
                        [% IF hold.itemtype %]
167
                            <i>Next available [% ItemTypes.GetDescription( hold.itemtype ) | html %] item</i>
172
                            <li>
173
                                <i>Next available [% ItemTypes.GetDescription( hold.itemtype ) | html %] item</i>
174
                            </li>
168
                        [% ELSE %]
175
                        [% ELSE %]
169
                            <i>Next available</i>
176
                            <li>
177
                                <i>Next available</i>
178
                            </li>
170
                        [% END %]
179
                        [% END %]
171
180
172
                        <input type="hidden" name="itemnumber" value="" />
181
                        <input type="hidden" name="itemnumber" value="" />
173
                    [% END %]
182
                    [% END %]
174
                [% END %]
183
                [% END %]
184
                [% IF hold.non_priority %]
185
                    <li>
186
                        <i>Non priority hold</i>
187
                    </li>
188
                [% END %]
189
                </ul>
175
            </td>
190
            </td>
176
191
177
            [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
192
            [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-1 / +2 lines)
Lines 477-485 Link Here
477
                                [% END %]
477
                                [% END %]
478
                            [% END # /UNLESS multi_hold %]
478
                            [% END # /UNLESS multi_hold %]
479
479
480
                            <li>
480
                            <li id="non_priority_list_item">
481
                                <label for="non_priority">Non priority hold:</label>
481
                                <label for="non_priority">Non priority hold:</label>
482
                                <input name="non_priority" id="non_priority" type="checkbox" />
482
                                <input name="non_priority" id="non_priority" type="checkbox" />
483
                                <div class="hint">A non priority hold doesn't prevent a current checkout from renewing</div>
483
                            </li>
484
                            </li>
484
                        </ol>
485
                        </ol>
485
486
(-)a/reserve/request.pl (+1 lines)
Lines 705-710 foreach my $biblionumber (@biblionumbers) { Link Here
705
        $reserve{'reserve_id'}     = $res->reserve_id();
705
        $reserve{'reserve_id'}     = $res->reserve_id();
706
        $reserve{itemtype}         = $res->itemtype();
706
        $reserve{itemtype}         = $res->itemtype();
707
        $reserve{branchcode}       = $res->branchcode();
707
        $reserve{branchcode}       = $res->branchcode();
708
        $reserve{non_priority}     = $res->non_priority();
708
        $reserve{object}           = $res;
709
        $reserve{object}           = $res;
709
710
710
        push( @reserveloop, \%reserve );
711
        push( @reserveloop, \%reserve );
(-)a/t/db_dependent/Holds.t (-2 / +25 lines)
Lines 1256-1262 subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { Link Here
1256
1256
1257
subtest 'non priority holds' => sub {
1257
subtest 'non priority holds' => sub {
1258
1258
1259
    plan tests => 4;
1259
    plan tests => 6;
1260
1260
1261
    $schema->storage->txn_begin;
1261
    $schema->storage->txn_begin;
1262
1262
Lines 1323-1328 subtest 'non priority holds' => sub { Link Here
1323
    ok( $ok, 'Can renew' );
1323
    ok( $ok, 'Can renew' );
1324
    is( $err, undef, 'Item is on non priority hold' );
1324
    is( $err, undef, 'Item is on non priority hold' );
1325
1325
1326
    my $patron3 = $builder->build_object(
1327
        {
1328
            class => 'Koha::Patrons',
1329
            value => { branchcode => $item->homebranch }
1330
        }
1331
    );
1332
1333
    # Add second hold with non_priority = 0
1334
    AddReserve(
1335
        {
1336
            branchcode     => $item->homebranch,
1337
            borrowernumber => $patron3->borrowernumber,
1338
            biblionumber   => $item->biblionumber,
1339
            priority       => 2,
1340
            itemnumber     => $item->itemnumber,
1341
        }
1342
    );
1343
1344
    ( $ok, $err ) =
1345
      CanBookBeRenewed( $patron1->borrowernumber, $item->itemnumber );
1346
1347
    ok( !$ok, 'Cannot renew' );
1348
    is( $err, 'on_reserve', 'Item is on hold' );
1349
1326
    $schema->storage->txn_rollback;
1350
    $schema->storage->txn_rollback;
1327
1351
1328
};
1352
};
1329
- 

Return to bug 22789