[Koha-patches] [PATCH] change the date calc, to set the date_due to date_due+loanlength.

Joshua Ferraro jmf at liblime.com
Fri Mar 6 13:19:26 CET 2009


This patch is assuming that all libraries work the same way. For many
US libraries now+loanlength is the correct renewal procedure. I'd
suggest wrapping this in a syspref.


On Fri, Mar 6, 2009 at 5:38 AM,  <henridamien.laurent at biblibre.com> wrote:
> From: Nahuel Angelinetti <nahuel.angelinetti at biblibre.com>
>
> At the moment when you renew a document the date_due calculated is now+loanlength, but it's a bad thing, It should be
> date_due+loanlength.
> This patch do change Circulation.pm to use the date_due as renew base and add the loanlength to get the new date_due after
> renewal.
>
> Signed-off-by: Henri-Damien LAURENT <henridamien.laurent at biblibre.com>
> ---
>  C4/Circulation.pm |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/C4/Circulation.pm b/C4/Circulation.pm
> index 5c136b2..ff3af6a 100644
> --- a/C4/Circulation.pm
> +++ b/C4/Circulation.pm
> @@ -1976,6 +1976,22 @@ sub AddRenewal {
>     my $issuedata = $sth->fetchrow_hashref;
>     $sth->finish;
>
> +    # If the due date wasn't specified, calculate it by adding the
> +    # book's loan length to due's date.
> +    unless (@_ and $datedue = shift and $datedue->output('iso')) {
> +
> +        my $borrower = C4::Members::GetMemberDetails( $borrowernumber, 0 ) or return undef;
> +        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?
> +        );
> +
> +        #FIXME -- use circControl?
> +        $datedue =  CalcDateDue(C4::Dates->new($issuedata->{date_due}, 'iso'),$loanlength,$branch);    # this branch is the transactional branch.
> +        # The question of whether to use item's homebranch calendar is open.
> +    }
> +
>     # Update the issues record to have the new due date, and a new count
>     # of how many times it has been renewed.
>     my $renews = $issuedata->{'renewals'} + 1;
> --
> 1.5.6.3
>
> _______________________________________________
> Koha-patches mailing list
> Koha-patches at lists.koha.org
> http://lists.koha.org/mailman/listinfo/koha-patches
>



-- 
Joshua Ferraro                       SUPPORT FOR OPEN-SOURCE SOFTWARE
CEO                         migration, training, maintenance, support
LibLime                                Featuring Koha Open-Source ILS
jmf at liblime.com |Full Demos at http://liblime.com/koha |1(888)KohaILS



More information about the Koha-patches mailing list