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 168-173 sub GetBranchesLoop { # since this is what most pages want anyway Link Here
168
    return \@loop;
169
    return \@loop;
169
}
170
}
170
171
172
=head2 GetBranchesPartLoop
173
174
       &GetBranchesPartLoop($branches;$branch)
175
176
=cut
177
178
sub GetBranchesPartLoop {
179
    my $branches   = shift;
180
    my $branch = shift;
181
    my @loop;
182
    while ( my ($branchcode, $branchname) = each %$branches) {
183
        push @loop, {
184
            value      => $branchcode,
185
            branchcode => $branchcode,
186
            selected   => ($branchcode eq $branch) ? 1 : 0,
187
            branchname => $branchname,
188
        };
189
    }
190
    return \@loop;
191
}
192
171
=head2 GetBranchName
193
=head2 GetBranchName
172
194
173
=cut
195
=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 578-584 sub CanItemBeReserved{ Link Here
578
        }
579
        }
579
    }
580
    }
580
581
581
        }
582
}
583
#
584
=head2 SetFirstReturnedItem
585
586
  &SetFirstReturnedItem( $branchcode, $itemnumber, $borrowernumber, $biblionumber );
587
588
=cut
589
590
sub SetFirstReturnedItem {
591
    my ( $branchcode, $itemnumber, $borrowernumber, $biblionumber ) = @_;
592
    my $dbh = C4::Context->dbh;
593
    my $query = "UPDATE reserves SET branchcode = ?, itemnumber = ? WHERE borrowernumber = ? AND biblionumber = ?";
594
    my $sth_upd = $dbh->prepare($query);
595
    $sth_upd->execute($branchcode,$itemnumber,$borrowernumber,$biblionumber);
596
}
597
582
#--------------------------------------------------------------------------------
598
#--------------------------------------------------------------------------------
583
=head2 GetReserveCount
599
=head2 GetReserveCount
584
600
(-)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 429-432 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
429
('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'),
429
('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'),
430
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
430
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
431
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
431
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
432
('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')
432
('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'),
433
('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 8044-8049 if (CheckVersion($DBversion) ) { Link Here
8044
    SetVersion($DBversion);
8044
    SetVersion($DBversion);
8045
}
8045
}
8046
8046
8047
$DBversion = "3.13.00.XXX";
8048
if (CheckVersion($DBversion) ) {
8049
    $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')");
8050
    print "Upgrade to $DBversion done (Add system preference PickupHoldOnlyFromItemBranches)\n";
8051
    SetVersion($DBversion);
8052
}
8053
8047
=head1 FUNCTIONS
8054
=head1 FUNCTIONS
8048
8055
8049
=head2 TableExists($table)
8056
=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 311-317 var holdForPatron = function () { Link Here
311
                <a href="#" class="highlight_toggle" id="highlight_toggle_on">Highlight</a>
311
                <a href="#" class="highlight_toggle" id="highlight_toggle_on">Highlight</a>
312
                |
312
                |
313
		<span class="addto"></span>
313
		<span class="addto"></span>
314
                [% IF ( CAN_user_reserveforothers && DisplayMultiPlaceHold ) %]
314
                [% IF ( CAN_user_reserveforothers && DisplayMultiPlaceHold && !PickupHoldOnlyFromItemBranches ) %]
315
                [% IF ( holdfor ) %]
315
                [% IF ( holdfor ) %]
316
                    <div id="placeholdc" class="btn-group">
316
                    <div id="placeholdc" class="btn-group">
317
                        <button class="btn btn-mini placehold"><i class="icon-hold"></i> Place hold</button>
317
                        <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 378-389 Link Here
378
                                                <select name="branch" id="branch_[% bibitemloo.biblionumber %]">
378
                                                <select name="branch" id="branch_[% bibitemloo.biblionumber %]">
379
                                                    [% FOREACH branchloo IN bibitemloo.branchloop %]
379
                                                    [% FOREACH branchloo IN bibitemloo.branchloop %]
380
                                                        [% IF ( branchloo.selected ) %]
380
                                                        [% IF ( branchloo.selected ) %]
381
                                                            <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
381
                                                            <option value="[% branchloo.branchcode %]" selected="selected">
382
                                                        [% ELSE %]
382
                                                        [% ELSE %]
383
                                                            <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
383
                                                            <option value="[% branchloo.branchcode %]">
384
                                                        [% END %]
385
                                                        [% IF branchloo.branchcode=='any' %]Whatever location[% ELSE %]
386
                                                            [% branchloo.branchname %]
384
                                                        [% END %]
387
                                                        [% END %]
388
                                                        </option>
385
                                                    [% END %]
389
                                                    [% END %]
386
                                                </select>
390
                                                </select>
391
                                                [% IF ( PickupHoldOnlyFromItemBranches ) %]<span style="margin-left:10px">(Next available copy at the selected place)</span>[% END %]
387
                                            [% END %]
392
                                            [% END %]
388
                                        </li>
393
                                        </li>
389
                                    [% END %]
394
                                    [% END %]
Lines 422-428 Link Here
422
427
423
                        [% IF ( bibitemloo.holdable ) %]
428
                        [% IF ( bibitemloo.holdable ) %]
424
                            <!-- HOLD ABLE -->
429
                            <!-- HOLD ABLE -->
425
                            [% IF ( OPACItemHolds ) %]
430
                            [% IF ( OPACItemHolds and !PickupHoldOnlyFromItemBranches ) %]
426
                            <!-- ITEM HOLDS -->
431
                            <!-- ITEM HOLDS -->
427
432
428
                                <li class="radio">
433
                                <li class="radio">
Lines 463-469 Link Here
463
                            [% END %]
468
                            [% END %]
464
                </ul>
469
                </ul>
465
                        [% END %]
470
                        [% END %]
466
                  [% IF ( OPACItemHolds ) %]
471
                  [% IF ( OPACItemHolds and !PickupHoldOnlyFromItemBranches ) %]
467
                  [% IF ( bibitemloo.holdable ) %]
472
                  [% IF ( bibitemloo.holdable ) %]
468
473
469
                        <table class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]">
474
                        <table class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]">
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt (-10 / +4 lines)
Lines 390-405 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
390
                <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>
390
                <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>
391
                    [% RESERVE.author %]
391
                    [% RESERVE.author %]
392
                </td>
392
                </td>
393
                <td class="reservedate"><span title="[% RESERVE.reservedate %]">[% RESERVE.reservedate | $KohaDates %]</span></td>
393
                <td class="reservedate"><span title="[% RESERVE.reservedate %]">[% RESERVE.reservedate | $KohaDates %]]</span></td>
394
                [% IF OpacHoldNotes %]<td class="reservenotes">[% RESERVE.reservenotes %]</td>[% END %]
394
                [% IF OpacShowHoldNotes %]<td class="reservenotes">[% RESERVE.reservenotes %]</td>[% END %]
395
                <td class="expirationdate">
395
        <td class="expirationdate">[% IF ( RESERVE.expirationdate ) %][% RESERVE.expirationdate | $KohaDates %][% ELSE %]Never expires[% END %]</td>
396
                    [% IF ( RESERVE.expirationdate ) %]
396
                <td class="branch">[% IF ( RESERVE.branch ) %][% RESERVE.branch %][% ELSE %]Location of next available copy[% END %]</td>
397
                        <span title="[% RESERVE.expirationdate %]">[% RESERVE.expirationdate | $KohaDates %]</span>
398
                    [% ELSE %]
399
                        Never expires
400
                    [% END %]
401
                </td>
402
                <td class="branch">[% RESERVE.branch %]</td>
403
				[% IF ( showpriority ) %]
397
				[% IF ( showpriority ) %]
404
                             <td class="priority">[% RESERVE.priority %] </td>
398
                             <td class="priority">[% RESERVE.priority %] </td>
405
				[% END %]
399
				[% 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 504-509 foreach my $biblioNum (@biblionumbers) { Link Here
504
507
505
        if (IsAvailableForItemLevelRequest($itemNum) and $policy_holdallowed and CanItemBeReserved($borrowernumber,$itemNum) and ($itemLoopIter->{already_reserved} ne 1)) {
508
        if (IsAvailableForItemLevelRequest($itemNum) and $policy_holdallowed and CanItemBeReserved($borrowernumber,$itemNum) and ($itemLoopIter->{already_reserved} ne 1)) {
506
            $itemLoopIter->{available} = 1;
509
            $itemLoopIter->{available} = 1;
510
            $pickplaces{$itemInfo->{homebranch}}=$itemLoopIter->{homeBranchName};
507
            $numCopiesAvailable++;
511
            $numCopiesAvailable++;
508
        }
512
        }
509
513
Lines 536-541 foreach my $biblioNum (@biblionumbers) { Link Here
536
540
537
    if( $biblioLoopIter{holdable} ){ $anyholdable++; }
541
    if( $biblioLoopIter{holdable} ){ $anyholdable++; }
538
542
543
    if ( C4::Context->preference('PickupHoldOnlyFromItemBranches') ){
544
        my $branch;
545
        ($pickplaces{'any'}='' and $branch eq 'any') if scalar( keys %pickplaces ) > 1;
546
        $biblioLoopIter{branchloop} = GetBranchesPartLoop (\%pickplaces, $branch);
547
        $template->param(PickupHoldOnlyFromItemBranches => 1);
548
    }
539
    push @$biblioLoop, \%biblioLoopIter;
549
    push @$biblioLoop, \%biblioLoopIter;
540
}
550
}
541
551
(-)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 307-312 foreach my $biblionumber (@biblionumbers) { Link Here
307
            $item->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $item->{itype} }{imageurl} );
310
            $item->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $item->{itype} }{imageurl} );
308
            $item->{homebranchname} = $branches->{ $item->{homebranch} }{branchname};
311
            $item->{homebranchname} = $branches->{ $item->{homebranch} }{branchname};
309
312
313
            if( !$item->{notforloan} and !$item->{lost} and !$item->{withdrawn} and !$item->{damaged} ) {
314
                push @itembrlist, {'itemnumber' => $itemnumber,'brcode' => $item->{homebranch},'brname' => $item->{homebranchname}};
315
            }
310
            # if the holdingbranch is different than the homebranch, we show the
316
            # if the holdingbranch is different than the homebranch, we show the
311
            # holdingbranch of the document too
317
            # holdingbranch of the document too
312
            if ( $item->{homebranch} ne $item->{holdingbranch} ) {
318
            if ( $item->{homebranch} ne $item->{holdingbranch} ) {
Lines 416-421 foreach my $biblionumber (@biblionumbers) { Link Here
416
              )
422
              )
417
            {
423
            {
418
                $item->{available} = 1;
424
                $item->{available} = 1;
425
                $pickplaces{$item->{'homebranch'}}=$item->{'homebranchname'};
419
                $num_available++ unless $not_all_holdable_onloan;
426
                $num_available++ unless $not_all_holdable_onloan;
420
            }
427
            }
421
            elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
428
            elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
Lines 448-453 foreach my $biblionumber (@biblionumbers) { Link Here
448
        push @bibitemloop, $biblioitem;
455
        push @bibitemloop, $biblioitem;
449
    }
456
    }
450
457
458
    if ( C4::Context->preference('PickupHoldOnlyFromItemBranches') ){
459
        $template->param( PickupHoldOnlyFromItemBranches => 1 );
460
        $pickplaces{'any'}='' if scalar(keys %pickplaces) > 1;
461
        %pickplaces = {} if $not_all_holdable_onloan;
462
        $itembranchesloop = GetBranchesPartLoop(\%pickplaces);
463
    }
451
    # existingreserves building
464
    # existingreserves building
452
    my @reserveloop;
465
    my @reserveloop;
453
    $reserves = GetReservesFromBiblionumber({ biblionumber => $biblionumber, all_dates => 1 });
466
    $reserves = GetReservesFromBiblionumber({ biblionumber => $biblionumber, all_dates => 1 });
Lines 524-529 foreach my $biblionumber (@biblionumbers) { Link Here
524
537
525
        if ( C4::Context->preference('IndependentBranches') && $flags->{'superlibrarian'} != 1 ) {
538
        if ( C4::Context->preference('IndependentBranches') && $flags->{'superlibrarian'} != 1 ) {
526
              $reserve{'branchloop'} = [ GetBranchDetail($res->{'branchcode'}) ];
539
              $reserve{'branchloop'} = [ GetBranchDetail($res->{'branchcode'}) ];
540
        } elsif (C4::Context->preference('PickupHoldOnlyFromItemBranches') ) {
541
            $res->{'branchcode'}||='any';
542
            my %brlist;
543
            foreach  ( @itembrlist ) {
544
                my $canreserve = CanItemBeReserved( $reserve{'borrowernumber'},$_->{'itemnumber'} );
545
                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)
546
                    $brlist{$_->{'brcode'}} = $_->{'brname'};
547
                }
548
            }
549
            $brlist{'any'} = '' if scalar(keys %brlist) > 1;
550
            $reserve{'branchloop'}=GetBranchesPartLoop(\%brlist,$res->{'branchcode'});
527
        } else {
551
        } else {
528
              $reserve{'branchloop'} = GetBranchesLoop($res->{'branchcode'});
552
              $reserve{'branchloop'} = GetBranchesLoop($res->{'branchcode'});
529
        }
553
        }
Lines 535-545 foreach my $biblionumber (@biblionumbers) { Link Here
535
    my $time = time();
559
    my $time = time();
536
560
537
    $template->param(
561
    $template->param(
538
                     branchloop  => GetBranchesLoop($userbranch),
562
                     branchloop  => $itembranchesloop ? $itembranchesloop : GetBranchesLoop($userbranch),
539
                     time        => $time,
563
                     time        => $time,
540
                     fixedRank   => $fixedRank,
564
                     fixedRank   => $fixedRank,
541
                    );
565
                    );
542
543
    # display infos
566
    # display infos
544
    $template->param(
567
    $template->param(
545
                     optionloop        => \@optionloop,
568
                     optionloop        => \@optionloop,
546
- 

Return to bug 11482