|
Link Here
|
|
|
1 |
package Core::Community::Circulation; |
| 2 |
|
| 3 |
use strict; |
| 4 |
use warnings; |
| 5 |
|
| 6 |
use Carp; |
| 7 |
use Data::Dumper; |
| 8 |
use C4::Circulation; |
| 9 |
|
| 10 |
use Core::Exceptions; |
| 11 |
use parent qw( Core::Circulation Core::Prefs ); |
| 12 |
|
| 13 |
=head |
| 14 |
legacy support for C4::Circulation::AddReturn |
| 15 |
=cut |
| 16 |
sub Checkin { |
| 17 |
my ($self, $exemptFine, $dropBox, $returnDate, $dropBoxDate) = @_; |
| 18 |
my ($doreturn, $messages, $iteminformation, $borrower) = |
| 19 |
C4::Circulation::AddReturn( $self->{item}->barcode, $self->{library}->branchcode, $exemptFine, $dropBox, $returnDate ); |
| 20 |
unless ($doreturn) { |
| 21 |
$self->{error} = Core::Exception::Circulation::CheckinError->new(); |
| 22 |
} |
| 23 |
$self->{messages} = $messages; # override with messages from AddReturn |
| 24 |
$self->{patron} = Koha::Patrons->find($borrower->{borrowernumber}); |
| 25 |
return $self; |
| 26 |
} |
| 27 |
|
| 28 |
=head |
| 29 |
legacy support for C4::Circulation::AddIssue |
| 30 |
=cut |
| 31 |
sub Checkout { |
| 32 |
my ($self, $dateDue, $cancelReserve, $issueDate, $sipMode, $params) = @_; |
| 33 |
my $issue = C4::Circulation::AddIssue( $self->{patron}->unblessed, $self->{item}->barcode, $dateDue, $cancelReserve, $issueDate, $sipMode, $params ); |
| 34 |
$self->{checkout} = $issue; |
| 35 |
unless ($issue) { |
| 36 |
$self->{error} = Core::Exception::Circulation::CheckoutError->new(); |
| 37 |
} |
| 38 |
return $self; |
| 39 |
} |
| 40 |
|
| 41 |
=head |
| 42 |
legacy support for C4::Circulation::AddRenewal |
| 43 |
=cut |
| 44 |
|
| 45 |
sub Renew { |
| 46 |
my ($self, $dateDue, $lastRenewedDate) = @_; |
| 47 |
my $newDateDue = C4::Circulation::AddRenewal( $self->{patron}->borrowernumber, $self->{item}->itemnumber, $self->{library}->branchcode, $dateDue, $lastRenewedDate); |
| 48 |
unless ($newDateDue) { |
| 49 |
$self->{error} = Core::Exception::Circulation::RenewError->new(); |
| 50 |
} |
| 51 |
return $self, $newDateDue; |
| 52 |
} |
| 53 |
|
| 54 |
1; |