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

(-)a/C4/Circulation.pm (+21 lines)
Lines 3445-3450 sub TransferSlip { Link Here
3445
    );
3445
    );
3446
}
3446
}
3447
3447
3448
=head2 CheckIfIssuedToPatron
3449
3450
  CheckIfIssuedToPatron($borrowernumber, $biblionumber)
3451
3452
  Return 1 if any record item is issued to patron, otherwise return 0
3453
3454
=cut
3455
3456
sub CheckIfIssuedToPatron {
3457
        my ($borrowernumber, $biblionumber) = @_;
3458
        my $isissued = 0;
3459
3460
        my $items = GetItemsByBiblioitemnumber($biblionumber);
3461
3462
        foreach my $item (@{$items}) {
3463
                $isissued = 1 if ($item->{borrowernumber} && $item->{borrowernumber} eq $borrowernumber);
3464
        }
3465
3466
        return $isissued;
3467
}
3468
3448
3469
3449
1;
3470
1;
3450
3471
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 400-402 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' Link Here
400
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSeparateHoldings', '0', 'Separate current branch holdings from other holdings (OPAC)', NULL, 'YesNo');
400
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSeparateHoldings', '0', 'Separate current branch holdings from other holdings (OPAC)', NULL, 'YesNo');
401
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSeparateHoldingsBranch', 'homebranch', 'Branch used to separate holdings (OPAC)', 'homebranch|holdingbranch', 'Choice');
401
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSeparateHoldingsBranch', 'homebranch', 'Branch used to separate holdings (OPAC)', 'homebranch|holdingbranch', 'Choice');
402
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RenewalSendNotice','0', NULL, '', 'YesNo');
402
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RenewalSendNotice','0', NULL, '', 'YesNo');
403
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowHoldsOnPatronsPossessions', '1', 'Allow holds on records that patron have items of it',NULL,'YesNo');
(-)a/installer/data/mysql/updatedatabase.pl (+8 lines)
Lines 6111-6116 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
6111
    print "Upgrade to $DBversion done (Bug 8782: Add field subscription.closed)\n";
6111
    print "Upgrade to $DBversion done (Bug 8782: Add field subscription.closed)\n";
6112
    SetVersion($DBversion);
6112
    SetVersion($DBversion);
6113
}
6113
}
6114
$DBversion = "XXX";
6115
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6116
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowHoldsOnPatronsPossessions', '1', 'Allow holds on records that patron have items of it',NULL,'YesNo')"
6117
    print "Upgrade to $DBversion done (Bug 9206: Only allow place holds in records that the patron don't have in his possession)\n";
6118
    SetVersion($DBversion);
6119
}
6120
6121
6114
6122
6115
$DBversion = "3.11.00.005";
6123
$DBversion = "3.11.00.005";
6116
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6124
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 441-446 Circulation: Link Here
441
            - pref: decreaseLoanHighHoldsValue
441
            - pref: decreaseLoanHighHoldsValue
442
              class: integer
442
              class: integer
443
            - holds.
443
            - holds.
444
        -
445
            - pref: AllowHoldsOnPatronsPossessions
446
              choices:
447
                  yes: Allow
448
                  no: "Don't allow"
449
            - patrons to place holds on records that he already have any item of it in his possession.
444
    Fines Policy:
450
    Fines Policy:
445
        -
451
        -
446
            - Calculate fines based on days overdue
452
            - Calculate fines based on days overdue
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (+3 lines)
Lines 213-218 function checkMultiHold() { Link Here
213
        [% IF ( none_available ) %]
213
        [% IF ( none_available ) %]
214
          <li> <strong>No copies are available</strong> to be placed on hold</li>
214
          <li> <strong>No copies are available</strong> to be placed on hold</li>
215
        [% END %]
215
        [% END %]
216
        [% IF ( alreadypossession ) %]
217
          <li> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% borrowerfirstname %] [% borrowersurname %]</a> <strong>is already in possesion</strong> of one item</li>
218
        [% END %]
216
	  </ul>
219
	  </ul>
217
    [% ELSE %]
220
    [% ELSE %]
218
      <h3>Cannot place hold on some items</h3>
221
      <h3>Cannot place hold on some items</h3>
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt (-2 / +6 lines)
Lines 293-300 Link Here
293
                          [% UNLESS ( bibitemloo.bib_available ) %]
293
                          [% UNLESS ( bibitemloo.bib_available ) %]
294
                            <div class="bibmessage">No available items.</div>
294
                            <div class="bibmessage">No available items.</div>
295
                          [% ELSE %]
295
                          [% ELSE %]
296
                            <div class="bibmessage">This title cannot be requested.</div>
296
				[% IF ( bibitemloo.already_patron_possession ) %]
297
                          [% END %]
297
                                        <div class="bibmessage">This title cannot be requested because it's already in your possession.</div>
298
                                [% ELSE %]
299
                                        <div class="bibmessage">This title cannot be requested.</div>
300
                                [% END %]
301
                    [% END %]
298
                        [% END %]
302
                        [% END %]
299
303
300
304
(-)a/opac/opac-reserve.pl (+5 lines)
Lines 537-542 foreach my $biblioNum (@biblionumbers) { Link Here
537
        $biblioLoopIter{holdable} = undef;
537
        $biblioLoopIter{holdable} = undef;
538
        $anyholdable = undef;
538
        $anyholdable = undef;
539
    }
539
    }
540
    if(not C4::Context->preference('AllowHoldsOnPatronsPossessions') and CheckIfIssuedToPatron($borrowernumber,$biblioNum)) {
541
        $biblioLoopIter{holdable} = undef;
542
        $biblioLoopIter{already_patron_possession} = 1;
543
        $anyholdable = undef;
544
    }
540
545
541
    push @$biblioLoop, \%biblioLoopIter;
546
    push @$biblioLoop, \%biblioLoopIter;
542
}
547
}
(-)a/reserve/request.pl (-2 / +7 lines)
Lines 247-252 foreach my $biblionumber (@biblionumbers) { Link Here
247
 		$warnings = 1;
247
 		$warnings = 1;
248
        $maxreserves = 1;
248
        $maxreserves = 1;
249
    }
249
    }
250
    if (not C4::Context->preference('AllowHoldsOnPatronsPossessions') and CheckIfIssuedToPatron($borrowerinfo->{borrowernumber},$biblionumber)) {
251
        $warnings = 1;
252
        $alreadypossession = 1;
253
    }
254
250
    # get existing reserves .....
255
    # get existing reserves .....
251
    my ( $count, $reserves ) = GetReservesFromBiblionumber($biblionumber,1);
256
    my ( $count, $reserves ) = GetReservesFromBiblionumber($biblionumber,1);
252
    my $totalcount = $count;
257
    my $totalcount = $count;
Lines 268-274 foreach my $biblionumber (@biblionumbers) { Link Here
268
    $template->param( alreadyreserved => $alreadyreserved,
273
    $template->param( alreadyreserved => $alreadyreserved,
269
                      messages => $messages,
274
                      messages => $messages,
270
                      warnings => $warnings,
275
                      warnings => $warnings,
271
					  maxreserves=>$maxreserves
276
                 maxreserves=>$maxreserves,
277
                     alreadypossession => $alreadypossession,
272
					  );
278
					  );
273
279
274
280
275
- 

Return to bug 9206