[Koha-patches] [PATCH] Reserves Updates Ported From Dev_Week
Michael Hafen
mdhafen at tech.washk12.org
Tue Sep 22 18:28:56 CEST 2009
Comment below.
On Tue, 2009-09-22 at 13:31 +0000, Kyle M Hall wrote:
> This is a much improved re-implementation of the reserves updates from dev_week.
> Less new code has been added, and more existing functions are used instead of adding new ones.
>
> The 'Lock Hold' function has been removed due to it not working as intended.
[snip]
> diff --git a/C4/Reserves.pm b/C4/Reserves.pm
> index 8610036..6265e63 100644
> --- a/C4/Reserves.pm
> +++ b/C4/Reserves.pm
[snip]
> @@ -1165,9 +1191,75 @@ sub IsAvailableForItemLevelRequest {
> }
> }
>
> +=item AlterPriority
> +AlterPriority( $where, $borrowernumber, $biblionumber, $reservedate );
> +
> +This function changes a reserve's priority up, down, to the top, or to the bottom.
> +Input: $where is 'up', 'down', 'top' or 'bottom'. Biblionumber, Date reserve was placed
> +Output: None on success, -1 on failure
> +
> +=cut
> +sub AlterPriority {
> + my ( $where, $borrowernumber, $biblionumber ) = @_;
> +
> + my $newPriority = -1;
> +
> + my $dbh = C4::Context->dbh;
> +
> + ## Find this reserve
> + my $sth = $dbh->prepare('SELECT * FROM reserves WHERE biblionumber = ? AND borrowernumber = ? AND cancellationdate IS NULL');
> + $sth->execute( $biblionumber, $borrowernumber );
> + my $reserve = $sth->fetchrow_hashref();
> + $sth->finish();
> +
> + if ( $where eq 'up' || $where eq 'down' ) {
> +
> + my $priority = $reserve->{'priority'};
> + $priority = $where eq 'up' ? $priority - 1 : $priority + 1;
> + _FixPriority( $biblionumber, $borrowernumber, $priority )
> +
> + } elsif ( $where eq 'top' ) {
> +
> + _FixPriority( $biblionumber, $borrowernumber, '1' )
> +
> + } elsif ( $where eq 'bottom' ) {
> +
> + _FixPriority( $biblionumber, $borrowernumber, '999999' )
> +
> + }
> +
> + return $newPriority;
> +
> +}
This seems to always return -1, which isn't what the POD says.
[snip]
--
Michael Hafen
Systems Analyst and Programmer
Washington County School District
Utah, USA
for Koha checkout
http://development.washk12.org/gitweb/
or
git://development.washk12.org/koha
More information about the Koha-patches
mailing list