Lines 2990-3003
sub GetRenewCount {
Link Here
|
2990 |
|
2990 |
|
2991 |
=head2 GetSoonestRenewDate |
2991 |
=head2 GetSoonestRenewDate |
2992 |
|
2992 |
|
2993 |
$NoRenewalBeforeThisDate = &GetSoonestRenewDate($borrowernumber, $itemnumber); |
2993 |
$NoRenewalBeforeThisDate = &GetSoonestRenewDate( { patron => $patron, item => $item } ); |
2994 |
|
2994 |
|
2995 |
Find out the soonest possible renew date of a borrowed item. |
2995 |
Find out the soonest possible renew date of a borrowed item. |
2996 |
|
2996 |
|
2997 |
C<$borrowernumber> is the borrower number of the patron who currently |
2997 |
C<$patron> is the patron who currently has the item on loan. |
2998 |
has the item on loan. |
|
|
2999 |
|
2998 |
|
3000 |
C<$itemnumber> is the number of the item to renew. |
2999 |
C<$item> is the item to renew. |
|
|
3000 |
|
3001 |
C<$issue> is the issue to renew. |
3001 |
|
3002 |
|
3002 |
C<$GetSoonestRenewDate> returns the DateTime of the soonest possible |
3003 |
C<$GetSoonestRenewDate> returns the DateTime of the soonest possible |
3003 |
renew date, based on the value "No renewal before" of the applicable |
3004 |
renew date, based on the value "No renewal before" of the applicable |
Lines 3008-3027
cannot be found.
Link Here
|
3008 |
=cut |
3009 |
=cut |
3009 |
|
3010 |
|
3010 |
sub GetSoonestRenewDate { |
3011 |
sub GetSoonestRenewDate { |
3011 |
my ( $borrowernumber, $itemnumber ) = @_; |
3012 |
my ( $params ) = @_; |
3012 |
|
|
|
3013 |
my $dbh = C4::Context->dbh; |
3014 |
|
3015 |
my $item = GetItem($itemnumber) or return; |
3016 |
my $itemissue = GetItemIssue($itemnumber) or return; |
3017 |
|
3013 |
|
3018 |
$borrowernumber ||= $itemissue->{borrowernumber}; |
3014 |
my $patron = $params->{patron} or return; |
3019 |
my $borrower = C4::Members::GetMember( borrowernumber => $borrowernumber ) |
3015 |
my $item = $params->{item} or return; |
3020 |
or return; |
3016 |
my $issue = $params->{issue} or return; |
3021 |
|
3017 |
|
3022 |
my $branchcode = _GetCircControlBranch( $item, $borrower ); |
3018 |
my $branchcode = _GetCircControlBranch( $item, $patron ); |
3023 |
my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule( |
3019 |
my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule( |
3024 |
{ categorycode => $borrower->{categorycode}, |
3020 |
{ categorycode => $patron->{categorycode}, |
3025 |
itemtype => $item->{itype}, |
3021 |
itemtype => $item->{itype}, |
3026 |
branchcode => $branchcode |
3022 |
branchcode => $branchcode |
3027 |
} |
3023 |
} |
Lines 3034-3040
sub GetSoonestRenewDate {
Link Here
|
3034 |
and $issuing_rule->norenewalbefore ne "" ) |
3030 |
and $issuing_rule->norenewalbefore ne "" ) |
3035 |
{ |
3031 |
{ |
3036 |
my $soonestrenewal = |
3032 |
my $soonestrenewal = |
3037 |
$itemissue->{date_due}->clone() |
3033 |
$issue->{date_due}->clone() |
3038 |
->subtract( |
3034 |
->subtract( |
3039 |
$issuing_rule->lengthunit => $issuing_rule->norenewalbefore ); |
3035 |
$issuing_rule->lengthunit => $issuing_rule->norenewalbefore ); |
3040 |
|
3036 |
|