Lines 2968-2981
sub GetRenewCount {
Link Here
|
2968 |
|
2968 |
|
2969 |
=head2 GetSoonestRenewDate |
2969 |
=head2 GetSoonestRenewDate |
2970 |
|
2970 |
|
2971 |
$NoRenewalBeforeThisDate = &GetSoonestRenewDate($borrowernumber, $itemnumber); |
2971 |
$NoRenewalBeforeThisDate = &GetSoonestRenewDate( { patron => $patron, item => $item } ); |
2972 |
|
2972 |
|
2973 |
Find out the soonest possible renew date of a borrowed item. |
2973 |
Find out the soonest possible renew date of a borrowed item. |
2974 |
|
2974 |
|
2975 |
C<$borrowernumber> is the borrower number of the patron who currently |
2975 |
C<$patron> is the patron who currently has the item on loan. |
2976 |
has the item on loan. |
|
|
2977 |
|
2976 |
|
2978 |
C<$itemnumber> is the number of the item to renew. |
2977 |
C<$item> is the item to renew. |
|
|
2978 |
|
2979 |
C<$issue> is the issue to renew. |
2979 |
|
2980 |
|
2980 |
C<$GetSoonestRenewDate> returns the DateTime of the soonest possible |
2981 |
C<$GetSoonestRenewDate> returns the DateTime of the soonest possible |
2981 |
renew date, based on the value "No renewal before" of the applicable |
2982 |
renew date, based on the value "No renewal before" of the applicable |
Lines 2986-3005
cannot be found.
Link Here
|
2986 |
=cut |
2987 |
=cut |
2987 |
|
2988 |
|
2988 |
sub GetSoonestRenewDate { |
2989 |
sub GetSoonestRenewDate { |
2989 |
my ( $borrowernumber, $itemnumber ) = @_; |
2990 |
my ( $params ) = @_; |
2990 |
|
|
|
2991 |
my $dbh = C4::Context->dbh; |
2992 |
|
2993 |
my $item = GetItem($itemnumber) or return; |
2994 |
my $itemissue = GetItemIssue($itemnumber) or return; |
2995 |
|
2991 |
|
2996 |
$borrowernumber ||= $itemissue->{borrowernumber}; |
2992 |
my $patron = $params->{patron} or return; |
2997 |
my $borrower = C4::Members::GetMember( borrowernumber => $borrowernumber ) |
2993 |
my $item = $params->{item} or return; |
2998 |
or return; |
2994 |
my $issue = $params->{issue} or return; |
2999 |
|
2995 |
|
3000 |
my $branchcode = _GetCircControlBranch( $item, $borrower ); |
2996 |
my $branchcode = _GetCircControlBranch( $item, $patron ); |
3001 |
my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule( |
2997 |
my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule( |
3002 |
{ categorycode => $borrower->{categorycode}, |
2998 |
{ categorycode => $patron->{categorycode}, |
3003 |
itemtype => $item->{itype}, |
2999 |
itemtype => $item->{itype}, |
3004 |
branchcode => $branchcode |
3000 |
branchcode => $branchcode |
3005 |
} |
3001 |
} |
Lines 3012-3018
sub GetSoonestRenewDate {
Link Here
|
3012 |
and $issuing_rule->norenewalbefore ne "" ) |
3008 |
and $issuing_rule->norenewalbefore ne "" ) |
3013 |
{ |
3009 |
{ |
3014 |
my $soonestrenewal = |
3010 |
my $soonestrenewal = |
3015 |
$itemissue->{date_due}->clone() |
3011 |
$issue->{date_due}->clone() |
3016 |
->subtract( |
3012 |
->subtract( |
3017 |
$issuing_rule->lengthunit => $issuing_rule->norenewalbefore ); |
3013 |
$issuing_rule->lengthunit => $issuing_rule->norenewalbefore ); |
3018 |
|
3014 |
|