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 388-390 INSERT INTO systempreferences (variable, value, options, explanation, type) VALU Link Here
388
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to pull list to this many days ago',NULL,'Integer');
388
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to pull list to this many days ago',NULL,'Integer');
389
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('alphabet','A B C D E F G H I J K L M N O P Q R S T U V W X Y Z','Alphabet than can be expanded into browse links, e.g. on Home > Patrons',NULL,'free');
389
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('alphabet','A B C D E F G H I J K L M N O P Q R S T U V W X Y Z','Alphabet than can be expanded into browse links, e.g. on Home > Patrons',NULL,'free');
390
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RefundLostItemFeeOnReturn', '1', 'If enabled, the lost item fee charged to a borrower will be refunded when the lost item is returned.', NULL, 'YesNo');
390
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RefundLostItemFeeOnReturn', '1', 'If enabled, the lost item fee charged to a borrower will be refunded when the lost item is returned.', NULL, 'YesNo');
391
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 6113-6118 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
6113
    print "Upgrade to $DBversion done (Bug 8782: Add field subscription.closed)\n";
6113
    print "Upgrade to $DBversion done (Bug 8782: Add field subscription.closed)\n";
6114
    SetVersion($DBversion);
6114
    SetVersion($DBversion);
6115
}
6115
}
6116
$DBversion = "XXX";
6117
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6118
    $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')"
6119
    print "Upgrade to $DBversion done (Bug 9206: Only allow place holds in records that the patron don't have in his possession)\n";
6120
    SetVersion($DBversion);
6121
}
6122
6123
6116
6124
6117
=head1 FUNCTIONS
6125
=head1 FUNCTIONS
6118
6126
(-)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