[Koha-patches] [PATCH] Bug 2770 follwup : make AddRenewal obey circControl system preference

LAURENT Henri-Damien henridamien.laurent at biblibre.com
Fri Jun 19 08:53:18 CEST 2009


Hi Ryan
Thanks for that patch.
A question though.
Ryan Higgins a écrit :
> Also prevents infinite-length renewals by returning undef
> if passed an invalid date instead of renewing with no due date.
> ---
>  C4/Circulation.pm |   37 +++++++++++++++++++------------------
>  1 files changed, 19 insertions(+), 18 deletions(-)
>
> diff --git a/C4/Circulation.pm b/C4/Circulation.pm
> index 07e0b39..a2c0865 100644
> --- a/C4/Circulation.pm
> +++ b/C4/Circulation.pm
> @@ -2075,7 +2075,7 @@ has the item.
>  
>  C<$itemnumber> is the number of the item to renew.
>  
> -C<$branch> is the library branch.  Defaults to the homebranch of the ITEM.
> +C<$branch> is the library whose policies should control the renewal.  Defaults to the circControl syspref.
>  
>  C<$datedue> can be a C4::Dates object used to set the due date.
>  
> @@ -2088,17 +2088,13 @@ from the book's item type.
>  =cut
>  
>  sub AddRenewal {
> -	my $borrowernumber = shift or return undef;
> -	my     $itemnumber = shift or return undef;
> +    my $borrowernumber  = shift or return undef;
> +    my $itemnumber      = shift or return undef;
> +    my $branch          = shift;
> +    my $datedue         = shift;
> +    my $lastreneweddate = shift || C4::Dates->new()->output('iso');
>      my $item   = GetItem($itemnumber) or return undef;
>      my $biblio = GetBiblioFromItemNumber($itemnumber) or return undef;
> +        my $circControlBranch = (C4::Context->preference('CircControl') eq 'ItemHomeBranch' ) ?
> +                                $item->{homebranch} : ( C4::Context->preference('CircControl') eq 'PatronLibrary') ?
> +                                $borrower->{branchcode} : $item->{holdingbranch} ; # defaults to pickuplibrary.
>   

Am I wrong to think and suppose there that we already have this 
CircControlBranch in issues table and that when getting issues.* we can 
get it ?

Friendly.

>          my $loanlength = GetLoanLength(
> -            $borrower->{'categorycode'},
> -             (C4::Context->preference('item-level_itypes')) ? $biblio->{'itype'} : $biblio->{'itemtype'} ,
> -			$item->{homebranch}     # item's homebranch determines loanlength OR do we want the branch specified by the AddRenewal argument?
> +                    $borrower->{'categorycode'},
> +                    (C4::Context->preference('item-level_itypes')) ? $biblio->{'itype'} : $biblio->{'itemtype'} ,
> +			        $circControlBranch
>          );
>   




More information about the Koha-patches mailing list