[Koha-patches] [PATCH] Fixed the functionality of the patron category holds fee field.

Galen Charlton galen.charlton at liblime.com
Thu May 14 14:17:45 CEST 2009


Hi David,

This patch doesn't apply against HEAD.

Regards,

Galen

On Wed, May 13, 2009 at 3:45 PM, David Birmingham <dbirmingham at ptfs.com> wrote:
> The AddReserve function was calling the GetReserveFee function in Reserves.pm
> before the hold had been inserted into the reserves table.  However,
> a check in GetReserveFee would always reset the holds fee to $0.00
> if it didn't find the record in the reserves table.  This was always
> the case.
>
> There are also a few deletions of superfluous my statements that were
> sending warnings to the error log.
> ---
>  C4/Reserves.pm |   41 +++++++++++++++++++----------------------
>  1 files changed, 19 insertions(+), 22 deletions(-)
>
> diff --git a/C4/Reserves.pm b/C4/Reserves.pm
> index 8a1109a..376a51a 100644
> --- a/C4/Reserves.pm
> +++ b/C4/Reserves.pm
> @@ -140,8 +140,6 @@ sub AddReserve {
>         $checkitem, $found
>     ) = @_;
>
> -    my $fee =
> -      GetReserveFee( $borrowernumber, $biblionumber, $constraint, $bibitems );
>     my $dbh     = C4::Context->dbh;
>     my $const   = lc substr( $constraint, 0, 1 );
>     my @datearr = localtime(time);
> @@ -154,22 +152,7 @@ sub AddReserve {
>         $waitingdate = $resdate;
>     }
>
> -    #eval {
>     # updates take place here
> -    if ( $fee > 0 ) {
> -        my $nextacctno = &getnextacctno($borrowernumber);
> -        my $query      = qq/
> -        INSERT INTO accountlines
> -            (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding)
> -        VALUES
> -            (?,?,now(),?,?,'Res',?)
> -    /;
> -        my $usth = $dbh->prepare($query);
> -        $usth->execute( $borrowernumber, $nextacctno, $fee,
> -            "Reserve Charge - $title", $fee );
> -    }
> -
> -    #if ($const eq 'a'){
>     my $query = qq/
>         INSERT INTO reserves
>             (borrowernumber,biblionumber,reservedate,branchcode,constrainttype,
> @@ -186,8 +169,22 @@ sub AddReserve {
>         $found,          $waitingdate
>     );
>
> -    #}
> -
> +    # Assign holds fee if applicable
> +    my $fee =
> +      GetReserveFee( $borrowernumber, $biblionumber, $constraint, $bibitems );
> +    if ( $fee > 0 ) {
> +        my $nextacctno = &getnextacctno($borrowernumber);
> +        my $query      = qq/
> +        INSERT INTO accountlines
> +            (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding)
> +        VALUES
> +            (?,?,now(),?,?,'Res',?)
> +    /;
> +        my $usth = $dbh->prepare($query);
> +        $usth->execute( $borrowernumber, $nextacctno, $fee,
> +            "Reserve Charge - $title", $fee );
> +    }
> +
>     UpdateStats(
>       $branch,
>       my $type = 'reserve',
> @@ -1601,7 +1598,7 @@ sub AlterPriority {
>         );
>         $sth->finish;
>
> -        my $sth = $dbh->prepare(
> +        $sth = $dbh->prepare(
>             "UPDATE reserves SET priority = ?
>              WHERE biblionumber = ?
>              AND borrowernumber = ?
> @@ -1671,7 +1668,7 @@ sub TogglePriorityLock {
>         $newLockPriority = 1;
>     }
>
> -    my $sth = $dbh->prepare(
> +    $sth = $dbh->prepare(
>         "UPDATE reserves SET lockPriority = ?, lowestPriority = ?
>          WHERE biblionumber = ?
>          AND borrowernumber = ?
> @@ -1718,7 +1715,7 @@ sub ToggleLowestPriority {
>         $newLowestPriority = 1;
>     }
>
> -    my $sth = $dbh->prepare(
> +    $sth = $dbh->prepare(
>         "UPDATE reserves SET lowestPriority = ?, lockPriority = ?
>          WHERE biblionumber = ?
>          AND borrowernumber = ?
> --
> 1.5.6.5
>
> _______________________________________________
> Koha-patches mailing list
> Koha-patches at lists.koha.org
> http://lists.koha.org/mailman/listinfo/koha-patches
>



-- 
Galen Charlton
VP, Research & Development, LibLime
galen.charlton at liblime.com
p: 1-888-564-2457 x709
skype: gmcharlt



More information about the Koha-patches mailing list