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

(-)a/C4/Branch.pm (+22 lines)
Lines 33-38 BEGIN { Link Here
33
		&GetBranch
33
		&GetBranch
34
		&GetBranches
34
		&GetBranches
35
		&GetBranchesLoop
35
		&GetBranchesLoop
36
                &GetBranchesPartLoop
36
		&GetBranchDetail
37
		&GetBranchDetail
37
		&get_branchinfos_of
38
		&get_branchinfos_of
38
		&ModBranch
39
		&ModBranch
Lines 175-180 sub GetBranchesLoop { # since this is what most pages want anyway Link Here
175
    return \@loop;
176
    return \@loop;
176
}
177
}
177
178
179
=head2 GetBranchesPartLoop
180
181
       &GetBranchesPartLoop($branches;$branch)
182
183
=cut
184
185
sub GetBranchesPartLoop {
186
    my $branches   = shift;
187
    my $branch = shift;
188
    my @loop;
189
    while ( my ($branchcode, $branchname) = each %$branches) {
190
        push @loop, {
191
            value      => $branchcode,
192
            branchcode => $branchcode,
193
            selected   => ($branchcode eq $branch) ? 1 : 0,
194
            branchname => $branchname,
195
        };
196
    }
197
    return \@loop;
198
}
199
178
=head2 GetBranchName
200
=head2 GetBranchName
179
201
180
=cut
202
=cut
(-)a/C4/Reserves.pm (-1 / +17 lines)
Lines 118-123 BEGIN { Link Here
118
        &CheckReserves
118
        &CheckReserves
119
        &CanBookBeReserved
119
        &CanBookBeReserved
120
	&CanItemBeReserved
120
	&CanItemBeReserved
121
        &SetFirstReturnedItem
121
        &CancelReserve
122
        &CancelReserve
122
        &CancelExpiredReserves
123
        &CancelExpiredReserves
123
124
Lines 560-566 sub CanItemBeReserved{ Link Here
560
        }
561
        }
561
    }
562
    }
562
563
563
        }
564
}
565
#
566
=head2 SetFirstReturnedItem
567
568
  &SetFirstReturnedItem( $branchcode, $itemnumber, $borrowernumber, $biblionumber );
569
570
=cut
571
572
sub SetFirstReturnedItem {
573
    my ( $branchcode, $itemnumber, $borrowernumber, $biblionumber ) = @_;
574
    my $dbh = C4::Context->dbh;
575
    my $query = "UPDATE reserves SET branchcode = ?, itemnumber = ? WHERE borrowernumber = ? AND biblionumber = ?";
576
    my $sth_upd = $dbh->prepare($query);
577
    $sth_upd->execute($branchcode,$itemnumber,$borrowernumber,$biblionumber);
578
}
579
564
#--------------------------------------------------------------------------------
580
#--------------------------------------------------------------------------------
565
=head2 GetReserveCount
581
=head2 GetReserveCount
566
582
(-)a/catalogue/search.pl (+2 lines)
Lines 154-159 use String::Random; Link Here
154
use C4::Branch; # GetBranches
154
use C4::Branch; # GetBranches
155
155
156
my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
156
my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
157
my $PickupHoldOnlyFromItemBranches = C4::Context->preference("PickupHoldOnlyFromItemBranches");
157
# create a new CGI object
158
# create a new CGI object
158
# FIXME: no_undef_params needs to be tested
159
# FIXME: no_undef_params needs to be tested
159
use CGI qw('-no_undef_params');
160
use CGI qw('-no_undef_params');
Lines 578-583 for (my $i=0;$i<@servers;$i++) { Link Here
578
            $template->param(limit_desc => $limit_desc);
579
            $template->param(limit_desc => $limit_desc);
579
            $template->param(offset     => $offset);
580
            $template->param(offset     => $offset);
580
            $template->param(DisplayMultiPlaceHold => $DisplayMultiPlaceHold);
581
            $template->param(DisplayMultiPlaceHold => $DisplayMultiPlaceHold);
582
            $template->param(PickupHoldOnlyFromItemBranches => $PickupHoldOnlyFromItemBranches);
581
            if ($query_desc || $limit_desc) {
583
            if ($query_desc || $limit_desc) {
582
                $template->param(searchdesc => 1);
584
                $template->param(searchdesc => 1);
583
            }
585
            }
(-)a/circ/returns.pl (-1 / +6 lines)
Lines 58-64 if (!C4::Context->userenv){ Link Here
58
        exit;
58
        exit;
59
    }
59
    }
60
} 
60
} 
61
62
#getting the template
61
#getting the template
63
my ( $template, $librarian, $cookie ) = get_template_and_user(
62
my ( $template, $librarian, $cookie ) = get_template_and_user(
64
    {
63
    {
Lines 140-145 if ( $query->param('resbarcode') ) { Link Here
140
    # fix up item type for display
139
    # fix up item type for display
141
    $iteminfo->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $iteminfo->{'itype'} : $iteminfo->{'itemtype'};
140
    $iteminfo->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $iteminfo->{'itype'} : $iteminfo->{'itemtype'};
142
    my $diffBranchSend = ($userenv_branch ne $diffBranchReturned) ? $diffBranchReturned : undef;
141
    my $diffBranchSend = ($userenv_branch ne $diffBranchReturned) ? $diffBranchReturned : undef;
142
    SetFirstReturnedItem($iteminfo->{'homebranch'}, $item, $borrowernumber, $iteminfo->{'biblionumber'}) if $query->param('nextavailable');
143
# diffBranchSend tells ModReserveAffect whether document is expected in this library or not,
143
# diffBranchSend tells ModReserveAffect whether document is expected in this library or not,
144
# i.e., whether to apply waiting status
144
# i.e., whether to apply waiting status
145
    ModReserveAffect( $item, $borrowernumber, $diffBranchSend);
145
    ModReserveAffect( $item, $borrowernumber, $diffBranchSend);
Lines 365-370 if ( $messages->{'WrongTransfer'} and not $messages->{'WasTransfered'}) { Link Here
365
#
365
#
366
if ( $messages->{'ResFound'}) {
366
if ( $messages->{'ResFound'}) {
367
    my $reserve    = $messages->{'ResFound'};
367
    my $reserve    = $messages->{'ResFound'};
368
    # If PickupHoldOnlyFromItemBranches syspref activated and next available copy had been asked
369
    unless ( $reserve->{'branchcode'} ){
370
         $reserve->{'branchcode'} = GetItem($itemnumber)->{'homebranch'};
371
         $template->param( nextavailable => 1 );
372
    }
368
    my $branchname = $branches->{ $reserve->{'branchcode'} }->{'branchname'};
373
    my $branchname = $branches->{ $reserve->{'branchcode'} }->{'branchname'};
369
    my ($borr) = GetMemberDetails( $reserve->{'borrowernumber'}, 0 );
374
    my ($borr) = GetMemberDetails( $reserve->{'borrowernumber'}, 0 );
370
375
(-)a/installer/data/mysql/sysprefs.sql (-1 / +2 lines)
Lines 425-428 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
425
('yuipath','local','local|http://yui.yahooapis.com/2.5.1/build','Insert the path to YUI libraries, choose local if you use koha offline','Choice'),
425
('yuipath','local','local|http://yui.yahooapis.com/2.5.1/build','Insert the path to YUI libraries, choose local if you use koha offline','Choice'),
426
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
426
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
427
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
427
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
428
('HoldOnlyWhenAllItemsOnLoan','0', 'Placing hold on a document is possible only when all items that can be reserved according to the issuing rules are on loan', NULL, 'YesNo')
428
('HoldOnlyWhenAllItemsOnLoan','0', 'Placing hold on a document is possible only when all items that can be reserved according to the issuing rules are on loan', NULL, 'YesNo'),
429
('PickupHoldOnlyFromItemBranches','0', 'Pickup location can be choosen only among the branches of the items that can be reserved', NULL, 'YesNo')
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 7919-7924 if (CheckVersion($DBversion) ) { Link Here
7919
    SetVersion($DBversion);
7919
    SetVersion($DBversion);
7920
}
7920
}
7921
7921
7922
$DBversion = "3.13.00.XXX";
7923
if (CheckVersion($DBversion) ) {
7924
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('PickupHoldOnlyFromItemBranches','0', 'Pickup location can be choosen only among the branches of the items that can be reserved', NULL, 'YesNo')");
7925
    print "Upgrade to $DBversion done (Add system preference PickupHoldOnlyFromItemBranches)\n";
7926
    SetVersion($DBversion);
7927
}
7928
7922
=head1 FUNCTIONS
7929
=head1 FUNCTIONS
7923
7930
7924
=head2 TableExists($table)
7931
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+8 lines)
Lines 440-445 Circulation: Link Here
440
                  no: "Don't allow"
440
                  no: "Don't allow"
441
            - a user to choose the library to pick up a hold from.
441
            - a user to choose the library to pick up a hold from.
442
        -
442
        -
443
            - Pickup location can be choosen
444
            - pref: PickupHoldOnlyFromItemBranches
445
              default: 0
446
              choices:
447
                  yes: "only among the branches of the items that can be reserved"
448
                  no: "unrestrictedly"
449
            - ( works with OPACAllowUserToChooseBranch on )
450
        -
443
            - pref: ReservesNeedReturns
451
            - pref: ReservesNeedReturns
444
              choices:
452
              choices:
445
                  yes: "Don't automatically"
453
                  yes: "Don't automatically"
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt (-1 / +1 lines)
Lines 308-314 var holdForPatron = function () { Link Here
308
                <a href="#" class="highlight_toggle" id="highlight_toggle_on">Highlight</a>
308
                <a href="#" class="highlight_toggle" id="highlight_toggle_on">Highlight</a>
309
                |
309
                |
310
		<span class="addto"></span>
310
		<span class="addto"></span>
311
                [% IF ( CAN_user_reserveforothers && DisplayMultiPlaceHold ) %]
311
                [% IF ( CAN_user_reserveforothers && DisplayMultiPlaceHold && !PickupHoldOnlyFromItemBranches ) %]
312
                [% IF ( holdfor ) %]
312
                [% IF ( holdfor ) %]
313
                    <div id="placeholdc" class="btn-group">
313
                    <div id="placeholdc" class="btn-group">
314
                        <button class="btn btn-mini placehold"><i class="icon-hold"></i> Place hold</button>
314
                        <button class="btn btn-mini placehold"><i class="icon-hold"></i> Place hold</button>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (+4 lines)
Lines 107-112 $(document).ready(function () { Link Here
107
            <input type="hidden" name="WT-itemNumber" value="[% WrongTransferItem %]" />
107
            <input type="hidden" name="WT-itemNumber" value="[% WrongTransferItem %]" />
108
            <input type="hidden" name="WT-waitingAt" value="[% TransferWaitingAt %]" />
108
            <input type="hidden" name="WT-waitingAt" value="[% TransferWaitingAt %]" />
109
            <input type="hidden" name="WT-From" value="[% wtransfertFrom %]" />
109
            <input type="hidden" name="WT-From" value="[% wtransfertFrom %]" />
110
            [% IF ( nextavailable ) %]<input type="hidden" name="nextavailable" value="1" />[% END %]
110
        <input type="submit" class="approve" value="Confirm" />
111
        <input type="submit" class="approve" value="Confirm" />
111
            <input type="submit" value="Print slip and confirm" class="print" onclick="Dopop('hold-transfer-slip.pl?transfer=1&amp;borrowernumber=[% borrowernumber %]&amp;biblionumber=[% itembiblionumber %]&amp;op=slip'); this.form.submit();" />
112
            <input type="submit" value="Print slip and confirm" class="print" onclick="Dopop('hold-transfer-slip.pl?transfer=1&amp;borrowernumber=[% borrowernumber %]&amp;biblionumber=[% itembiblionumber %]&amp;op=slip'); this.form.submit();" />
112
    </form>
113
    </form>
Lines 156-161 $(document).ready(function () { Link Here
156
                <input type="hidden" name="diffBranch" value="[% destbranch %]" />
157
                <input type="hidden" name="diffBranch" value="[% destbranch %]" />
157
                <input type="hidden" name="exemptfine" value="[% exemptfine %]" />
158
                <input type="hidden" name="exemptfine" value="[% exemptfine %]" />
158
                <input type="hidden" name="dropboxmode" value="[% dropboxmode %]" />
159
                <input type="hidden" name="dropboxmode" value="[% dropboxmode %]" />
160
                [% IF ( nextavailable ) %]<input type="hidden" name="nextavailable" value="1" />[% END %]
159
                </form>
161
                </form>
160
	</div>
162
	</div>
161
    [% END %]
163
    [% END %]
Lines 196-201 $(document).ready(function () { Link Here
196
            <input type="hidden" name="exemptfine" value="[% exemptfine %]" />
198
            <input type="hidden" name="exemptfine" value="[% exemptfine %]" />
197
            <input type="hidden" name="dropboxmode" value="[% dropboxmode %]" />
199
            <input type="hidden" name="dropboxmode" value="[% dropboxmode %]" />
198
            <input type="hidden" name="barcode" value="0" />
200
            <input type="hidden" name="barcode" value="0" />
201
            [% IF ( nextavailable ) %]<input type="hidden" name="nextavailable" value="1" />[% END %]
199
        </form>
202
        </form>
200
		</div>
203
		</div>
201
    [% END %]
204
    [% END %]
Lines 310-315 $(document).ready(function () { Link Here
310
            <input type="hidden" name="diffBranch" value="[% destbranch %]" />
313
            <input type="hidden" name="diffBranch" value="[% destbranch %]" />
311
            <input type="hidden" name="exemptfine" value="[% exemptfine %]" />
314
            <input type="hidden" name="exemptfine" value="[% exemptfine %]" />
312
            <input type="hidden" name="dropboxmode" value="[% dropboxmode %]" />
315
            <input type="hidden" name="dropboxmode" value="[% dropboxmode %]" />
316
            [% IF ( nextavailable ) %]<input type="hidden" name="nextavailable" value="1" />[% END %]
313
        </form>
317
        </form>
314
	</div>
318
	</div>
315
    [% END %]
319
    [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-8 / +14 lines)
Lines 92-97 function checkMultiHold() { Link Here
92
}
92
}
93
93
94
 $(document).ready(function() {
94
 $(document).ready(function() {
95
    [% IF ( PickupHoldOnlyFromItemBranches and !none_available) %]
96
        $("#hold-request-form fieldset.action").nextAll().hide();
97
        $("#requestany").attr('disabled','disabled');
98
    [% END %]
95
    $("input.needsoverride").click(function() { // This must be before the radio button/checkbox switch logic
99
    $("input.needsoverride").click(function() { // This must be before the radio button/checkbox switch logic
96
        var itemnumber = this.value;
100
        var itemnumber = this.value;
97
        var msg = '';
101
        var msg = '';
Lines 323-335 function checkMultiHold() { Link Here
323
        <li>
327
        <li>
324
            <label for="pickup">Pickup at:</label>
328
            <label for="pickup">Pickup at:</label>
325
            <select name="pickup" size="1" id="pickup">
329
            <select name="pickup" size="1" id="pickup">
326
            [%- FOREACH branchloo IN branchloop %]
330
            [% FOREACH branchloo IN branchloop %]
327
              [% IF ( branchloo.selected ) -%]
331
              [% IF ( branchloo.selected ) %]
328
                <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
332
                <option value="[% branchloo.branchcode %]" selected="selected">
329
              [%- ELSE -%]
333
              [% ELSE %]
330
                <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
334
                <option value="[% branchloo.branchcode %]">
331
              [%- END -%]
335
              [% END %]
332
            [%- END %]
336
              [% IF ( branchloo.branchcode=='any' ) %]Next available from whatever location[% ELSE %][% branchloo.branchname %][% END %]
337
                </option>
338
            [% END %]
333
            </select>
339
            </select>
334
        </li>
340
        </li>
335
341
Lines 678-684 function checkMultiHold() { Link Here
678
        [% ELSE %]
684
        [% ELSE %]
679
            <option value="[% branchloo.branchcode %]">
685
            <option value="[% branchloo.branchcode %]">
680
        [% END %]
686
        [% END %]
681
              [% branchloo.branchname %]
687
        [% IF ( branchloo.branchcode=='any' ) %]Next available from whatever location[% ELSE %][% branchloo.branchname %][% END %]
682
            </option>
688
            </option>
683
      [% END %]
689
      [% END %]
684
          </select>
690
          </select>
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt (-4 / +9 lines)
Lines 377-388 Link Here
377
                                                <select name="branch" id="branch_[% bibitemloo.biblionumber %]">
377
                                                <select name="branch" id="branch_[% bibitemloo.biblionumber %]">
378
                                                    [% FOREACH branchloo IN bibitemloo.branchloop %]
378
                                                    [% FOREACH branchloo IN bibitemloo.branchloop %]
379
                                                        [% IF ( branchloo.selected ) %]
379
                                                        [% IF ( branchloo.selected ) %]
380
                                                            <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
380
                                                            <option value="[% branchloo.branchcode %]" selected="selected">
381
                                                        [% ELSE %]
381
                                                        [% ELSE %]
382
                                                            <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
382
                                                            <option value="[% branchloo.branchcode %]">
383
                                                        [% END %]
384
                                                        [% IF branchloo.branchcode=='any' %]Whatever location[% ELSE %]
385
                                                            [% branchloo.branchname %]
383
                                                        [% END %]
386
                                                        [% END %]
387
                                                        </option>
384
                                                    [% END %]
388
                                                    [% END %]
385
                                                </select>
389
                                                </select>
390
                                                [% IF ( PickupHoldOnlyFromItemBranches ) %]<span style="margin-left:10px">(Next available copy at the selected place)</span>[% END %]
386
                                            [% END %]
391
                                            [% END %]
387
                                        </li>
392
                                        </li>
388
                                    [% END %]
393
                                    [% END %]
Lines 421-427 Link Here
421
426
422
                        [% IF ( bibitemloo.holdable ) %]
427
                        [% IF ( bibitemloo.holdable ) %]
423
                            <!-- HOLD ABLE -->
428
                            <!-- HOLD ABLE -->
424
                            [% IF ( OPACItemHolds ) %]
429
                            [% IF ( OPACItemHolds and !PickupHoldOnlyFromItemBranches ) %]
425
                            <!-- ITEM HOLDS -->
430
                            <!-- ITEM HOLDS -->
426
431
427
                                <li class="radio">
432
                                <li class="radio">
Lines 462-468 Link Here
462
                            [% END %]
467
                            [% END %]
463
                </ul>
468
                </ul>
464
                        [% END %]
469
                        [% END %]
465
                  [% IF ( OPACItemHolds ) %]
470
                  [% IF ( OPACItemHolds and !PickupHoldOnlyFromItemBranches ) %]
466
                  [% IF ( bibitemloo.holdable ) %]
471
                  [% IF ( bibitemloo.holdable ) %]
467
472
468
                        <table class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]">
473
                        <table class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]">
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt (-10 / +4 lines)
Lines 382-397 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
382
                <td class="title"><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]">[% RESERVE.reserves_title %][% FOREACH subtitl IN RESERVE.subtitle %] [% subtitl.subfield %][% END %]</a>
382
                <td class="title"><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]">[% RESERVE.reserves_title %][% FOREACH subtitl IN RESERVE.subtitle %] [% subtitl.subfield %][% END %]</a>
383
                    [% RESERVE.author %]
383
                    [% RESERVE.author %]
384
                </td>
384
                </td>
385
                <td class="reservedate"><span title="[% RESERVE.reservedate %]">[% RESERVE.reservedate | $KohaDates %]</span></td>
385
                <td class="reservedate"><span title="[% RESERVE.reservedate %]">[% RESERVE.reservedate | $KohaDates %]]</span></td>
386
                [% IF OpacHoldNotes %]<td class="reservenotes">[% RESERVE.reservenotes %]</td>[% END %]
386
                [% IF OpacShowHoldNotes %]<td class="reservenotes">[% RESERVE.reservenotes %]</td>[% END %]
387
                <td class="expirationdate">
387
        <td class="expirationdate">[% IF ( RESERVE.expirationdate ) %][% RESERVE.expirationdate | $KohaDates %][% ELSE %]Never expires[% END %]</td>
388
                    [% IF ( RESERVE.expirationdate ) %]
388
                <td class="branch">[% IF ( RESERVE.branch ) %][% RESERVE.branch %][% ELSE %]Location of next available copy[% END %]</td>
389
                        <span title="[% RESERVE.expirationdate %]">[% RESERVE.expirationdate | $KohaDates %]</span>
390
                    [% ELSE %]
391
                        Never expires
392
                    [% END %]
393
                </td>
394
                <td class="branch">[% RESERVE.branch %]</td>
395
				[% IF ( showpriority ) %]
389
				[% IF ( showpriority ) %]
396
                             <td class="priority">[% RESERVE.priority %] </td>
390
                             <td class="priority">[% RESERVE.priority %] </td>
397
				[% END %]
391
				[% END %]
(-)a/opac/opac-reserve.pl (+10 lines)
Lines 206-211 if ( $query->param('place_reserve') ) { Link Here
206
        my $itemNum   = shift(@selectedItems);
206
        my $itemNum   = shift(@selectedItems);
207
        my $branch    = shift(@selectedItems);    # i.e., branch code, not name
207
        my $branch    = shift(@selectedItems);    # i.e., branch code, not name
208
208
209
        # if no hold pickup location had been selected (syspref PickupHoldAtItemLocation on), $branch must be undef (to be recorded as NULL in branchcode field)
210
        undef($branch) if $branch eq 'any';
209
        my $canreserve = 0;
211
        my $canreserve = 0;
210
212
211
        my $singleBranchMode = C4::Context->preference("singleBranchMode");
213
        my $singleBranchMode = C4::Context->preference("singleBranchMode");
Lines 400-405 foreach my $biblioNum (@biblionumbers) { Link Here
400
402
401
    $biblioLoopIter{itemLoop} = [];
403
    $biblioLoopIter{itemLoop} = [];
402
    my $numCopiesAvailable = 0;
404
    my $numCopiesAvailable = 0;
405
    my  %pickplaces;
403
    foreach my $itemInfo (@{$biblioData->{itemInfos}}) {
406
    foreach my $itemInfo (@{$biblioData->{itemInfos}}) {
404
        my $itemNum = $itemInfo->{itemnumber};
407
        my $itemNum = $itemInfo->{itemnumber};
405
        my $itemLoopIter = {};
408
        my $itemLoopIter = {};
Lines 502-507 foreach my $biblioNum (@biblionumbers) { Link Here
502
505
503
        if (IsAvailableForItemLevelRequest($itemNum) and $policy_holdallowed and CanItemBeReserved($borrowernumber,$itemNum) and ($itemLoopIter->{already_reserved} ne 1)) {
506
        if (IsAvailableForItemLevelRequest($itemNum) and $policy_holdallowed and CanItemBeReserved($borrowernumber,$itemNum) and ($itemLoopIter->{already_reserved} ne 1)) {
504
            $itemLoopIter->{available} = 1;
507
            $itemLoopIter->{available} = 1;
508
            $pickplaces{$itemInfo->{homebranch}}=$itemLoopIter->{homeBranchName};
505
            $numCopiesAvailable++;
509
            $numCopiesAvailable++;
506
        }
510
        }
507
511
Lines 541-546 foreach my $biblioNum (@biblionumbers) { Link Here
541
545
542
    if( $biblioLoopIter{holdable} ){ $anyholdable++; }
546
    if( $biblioLoopIter{holdable} ){ $anyholdable++; }
543
547
548
    if ( C4::Context->preference('PickupHoldOnlyFromItemBranches') ){
549
        my $branch;
550
        ($pickplaces{'any'}='' and $branch eq 'any') if scalar( keys %pickplaces ) > 1;
551
        $biblioLoopIter{branchloop} = GetBranchesPartLoop (\%pickplaces, $branch);
552
        $template->param(PickupHoldOnlyFromItemBranches => 1);
553
    }
544
    push @$biblioLoop, \%biblioLoopIter;
554
    push @$biblioLoop, \%biblioLoopIter;
545
}
555
}
546
556
(-)a/reserve/modrequest.pl (+1 lines)
Lines 46-51 my @rank = $query->param('rank-request'); Link Here
46
my @biblionumber = $query->param('biblionumber');
46
my @biblionumber = $query->param('biblionumber');
47
my @borrower = $query->param('borrowernumber');
47
my @borrower = $query->param('borrowernumber');
48
my @branch = $query->param('pickup');
48
my @branch = $query->param('pickup');
49
map { undef($_) if $_ eq 'any' } @branch;
49
my @itemnumber = $query->param('itemnumber');
50
my @itemnumber = $query->param('itemnumber');
50
my @suspend_until=$query->param('suspend_until');
51
my @suspend_until=$query->param('suspend_until');
51
my $multi_hold = $query->param('multi_hold');
52
my $multi_hold = $query->param('multi_hold');
(-)a/reserve/placerequest.pl (+1 lines)
Lines 47-52 my $biblionumber=$input->param('biblionumber'); Link Here
47
my $borrowernumber=$input->param('borrowernumber');
47
my $borrowernumber=$input->param('borrowernumber');
48
my $notes=$input->param('notes');
48
my $notes=$input->param('notes');
49
my $branch=$input->param('pickup');
49
my $branch=$input->param('pickup');
50
undef($branch) if $branch eq 'any';
50
my $startdate=$input->param('reserve_date') || '';
51
my $startdate=$input->param('reserve_date') || '';
51
my @rank=$input->param('rank-request');
52
my @rank=$input->param('rank-request');
52
my $type=$input->param('type');
53
my $type=$input->param('type');
(-)a/reserve/request.pl (-3 / +25 lines)
Lines 181-186 if ($multihold) { Link Here
181
my $itemdata_enumchron = 0;
181
my $itemdata_enumchron = 0;
182
my @biblioloop = ();
182
my @biblioloop = ();
183
my $not_all_holdable_onloan;
183
my $not_all_holdable_onloan;
184
my %pickplaces;
185
my @itembrlist;
186
my $itembranchesloop;
184
foreach my $biblionumber (@biblionumbers) {
187
foreach my $biblionumber (@biblionumbers) {
185
188
186
    my %biblioloopiter = ();
189
    my %biblioloopiter = ();
Lines 306-311 foreach my $biblionumber (@biblionumbers) { Link Here
306
            $item->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $item->{itype} }{imageurl} );
309
            $item->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $item->{itype} }{imageurl} );
307
            $item->{homebranchname} = $branches->{ $item->{homebranch} }{branchname};
310
            $item->{homebranchname} = $branches->{ $item->{homebranch} }{branchname};
308
311
312
            if( !$item->{notforloan} and !$item->{lost} and !$item->{withdrawn} and !$item->{damaged} ) {
313
                push @itembrlist, {'itemnumber' => $itemnumber,'brcode' => $item->{homebranch},'brname' => $item->{homebranchname}};
314
            }
309
            # if the holdingbranch is different than the homebranch, we show the
315
            # if the holdingbranch is different than the homebranch, we show the
310
            # holdingbranch of the document too
316
            # holdingbranch of the document too
311
            if ( $item->{homebranch} ne $item->{holdingbranch} ) {
317
            if ( $item->{homebranch} ne $item->{holdingbranch} ) {
Lines 415-420 foreach my $biblionumber (@biblionumbers) { Link Here
415
              )
421
              )
416
            {
422
            {
417
                $item->{available} = 1;
423
                $item->{available} = 1;
424
                $pickplaces{$item->{'homebranch'}}=$item->{'homebranchname'};
418
                $num_available++ unless $not_all_holdable_onloan;
425
                $num_available++ unless $not_all_holdable_onloan;
419
            }
426
            }
420
            elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
427
            elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
Lines 454-459 foreach my $biblionumber (@biblionumbers) { Link Here
454
        push @bibitemloop, $biblioitem;
461
        push @bibitemloop, $biblioitem;
455
    }
462
    }
456
463
464
    if ( C4::Context->preference('PickupHoldOnlyFromItemBranches') ){
465
        $template->param( PickupHoldOnlyFromItemBranches => 1 );
466
        $pickplaces{'any'}='' if scalar(keys %pickplaces) > 1;
467
        %pickplaces = {} if $not_all_holdable_onloan;
468
        $itembranchesloop = GetBranchesPartLoop(\%pickplaces);
469
    }
457
    # existingreserves building
470
    # existingreserves building
458
    my @reserveloop;
471
    my @reserveloop;
459
    ( $count, $reserves ) = GetReservesFromBiblionumber($biblionumber,1);
472
    ( $count, $reserves ) = GetReservesFromBiblionumber($biblionumber,1);
Lines 530-535 foreach my $biblionumber (@biblionumbers) { Link Here
530
543
531
        if ( C4::Context->preference('IndependentBranches') && $flags->{'superlibrarian'} != 1 ) {
544
        if ( C4::Context->preference('IndependentBranches') && $flags->{'superlibrarian'} != 1 ) {
532
              $reserve{'branchloop'} = [ GetBranchDetail($res->{'branchcode'}) ];
545
              $reserve{'branchloop'} = [ GetBranchDetail($res->{'branchcode'}) ];
546
        } elsif (C4::Context->preference('PickupHoldOnlyFromItemBranches') ) {
547
            $res->{'branchcode'}||='any';
548
            my %brlist;
549
            foreach  ( @itembrlist ) {
550
                my $canreserve = CanItemBeReserved( $reserve{'borrowernumber'},$_->{'itemnumber'} );
551
                if ( !defined($canreserve) or $canreserve > 0 ){ # this to get the itembranch on location list even if the item is not any more on loan (return=undef)
552
                    $brlist{$_->{'brcode'}} = $_->{'brname'};
553
                }
554
            }
555
            $brlist{'any'} = '' if scalar(keys %brlist) > 1;
556
            $reserve{'branchloop'}=GetBranchesPartLoop(\%brlist,$res->{'branchcode'});
533
        } else {
557
        } else {
534
              $reserve{'branchloop'} = GetBranchesLoop($res->{'branchcode'});
558
              $reserve{'branchloop'} = GetBranchesLoop($res->{'branchcode'});
535
        }
559
        }
Lines 541-551 foreach my $biblionumber (@biblionumbers) { Link Here
541
    my $time = time();
565
    my $time = time();
542
566
543
    $template->param(
567
    $template->param(
544
                     branchloop  => GetBranchesLoop($userbranch),
568
                     branchloop  => $itembranchesloop ? $itembranchesloop : GetBranchesLoop($userbranch),
545
                     time        => $time,
569
                     time        => $time,
546
                     fixedRank   => $fixedRank,
570
                     fixedRank   => $fixedRank,
547
                    );
571
                    );
548
549
    # display infos
572
    # display infos
550
    $template->param(
573
    $template->param(
551
                     optionloop        => \@optionloop,
574
                     optionloop        => \@optionloop,
552
- 

Return to bug 11482