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

(-)a/C4/Circulation.pm (+21 lines)
Lines 3423-3428 sub TransferSlip { Link Here
3423
    );
3423
    );
3424
}
3424
}
3425
3425
3426
=head2 CheckIfIssuedToPatron
3427
3428
  CheckIfIssuedToPatron($borrowernumber, $biblionumber)
3429
3430
  Return 1 if any record item is issued to patron, otherwise return 0
3431
3432
=cut
3433
3434
sub CheckIfIssuedToPatron {
3435
        my ($borrowernumber, $biblionumber) = @_;
3436
        my $isissued = 0;
3437
3438
        my $items = GetItemsByBiblioitemnumber($biblionumber);
3439
3440
        foreach my $item (@{$items}) {
3441
                $isissued = 1 if ($item->{borrowernumber} && $item->{borrowernumber} eq $borrowernumber);
3442
        }
3443
3444
        return $isissued;
3445
}
3446
3426
3447
3427
1;
3448
1;
3428
3449
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 395-397 INSERT INTO systempreferences (`variable`, `value`, `options`, `explanation`, `t Link Here
395
('PatronSelfRegistrationExpireTemporaryAccountsDelay', '0', NULL, 'If PatronSelfRegistrationDefaultCategory is enabled, this system preference controls how long a patron can have a temporary status before the account is deleted automatically. It is an integer value representing a number of days to wait before deleting a temporary patron account. Setting it to 0 disables the deleting of temporary accounts.', 'Integer'),
395
('PatronSelfRegistrationExpireTemporaryAccountsDelay', '0', NULL, 'If PatronSelfRegistrationDefaultCategory is enabled, this system preference controls how long a patron can have a temporary status before the account is deleted automatically. It is an integer value representing a number of days to wait before deleting a temporary patron account. Setting it to 0 disables the deleting of temporary accounts.', 'Integer'),
396
('PatronSelfRegistrationBorrowerMandatoryField',  'surname|firstname', NULL ,  'Choose the mandatory fields for a patron''s account, when registering via the OPAC.',  'free'),
396
('PatronSelfRegistrationBorrowerMandatoryField',  'surname|firstname', NULL ,  'Choose the mandatory fields for a patron''s account, when registering via the OPAC.',  'free'),
397
('PatronSelfRegistrationBorrowerUnwantedField',  '', NULL ,  'Name the fields you don''t want to display when registering a new patron via the OPAC.',  'free');
397
('PatronSelfRegistrationBorrowerUnwantedField',  '', NULL ,  'Name the fields you don''t want to display when registering a new patron via the OPAC.',  'free');
398
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 6112-6117 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
6112
    print "Upgrade to $DBversion done (Bug 8782: Add field subscription.closed)\n";
6112
    print "Upgrade to $DBversion done (Bug 8782: Add field subscription.closed)\n";
6113
    SetVersion($DBversion);
6113
    SetVersion($DBversion);
6114
}
6114
}
6115
$DBversion = "XXX";
6116
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6117
    $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')"
6118
    print "Upgrade to $DBversion done (Bug 9206: Only allow place holds in records that the patron don't have in his possession)\n";
6119
    SetVersion($DBversion);
6120
}
6121
6122
6115
6123
6116
$DBversion = "3.11.00.005";
6124
$DBversion = "3.11.00.005";
6117
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6125
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 435-440 Circulation: Link Here
435
            - pref: decreaseLoanHighHoldsValue
435
            - pref: decreaseLoanHighHoldsValue
436
              class: integer
436
              class: integer
437
            - holds.
437
            - holds.
438
        -
439
            - pref: AllowHoldsOnPatronsPossessions
440
              choices:
441
                  yes: Allow
442
                  no: "Don't allow"
443
            - patrons to place holds on records that he already have any item of it in his possession.
438
    Fines Policy:
444
    Fines Policy:
439
        -
445
        -
440
            - Calculate fines based on days overdue
446
            - 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 292-299 Link Here
292
                          [% UNLESS ( bibitemloo.bib_available ) %]
292
                          [% UNLESS ( bibitemloo.bib_available ) %]
293
                            <div class="bibmessage">No available items.</div>
293
                            <div class="bibmessage">No available items.</div>
294
                          [% ELSE %]
294
                          [% ELSE %]
295
                            <div class="bibmessage">This title cannot be requested.</div>
295
				[% IF ( bibitemloo.already_patron_possession ) %]
296
                          [% END %]
296
                                        <div class="bibmessage">This title cannot be requested because it's already in your possession.</div>
297
                                [% ELSE %]
298
                                        <div class="bibmessage">This title cannot be requested.</div>
299
                                [% END %]
300
                    [% END %]
297
                        [% END %]
301
                        [% END %]
298
302
299
303
(-)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