View | Details | Raw Unified | Return to bug 11336
Collapse All | Expand All

(-)a/C4/Reserves.pm (-5 / +5 lines)
Lines 1003-1008 sub CancelReserve { Link Here
1003
1003
1004
    my $reserve_id = $params->{'reserve_id'};
1004
    my $reserve_id = $params->{'reserve_id'};
1005
    $reserve_id = GetReserveId( $params ) unless ( $reserve_id );
1005
    $reserve_id = GetReserveId( $params ) unless ( $reserve_id );
1006
    my $reserve = GetReserve( $reserve_id );
1006
1007
1007
    return unless ( $reserve_id );
1008
    return unless ( $reserve_id );
1008
1009
Lines 1034-1040 sub CancelReserve { Link Here
1034
    $sth->execute( $reserve_id );
1035
    $sth->execute( $reserve_id );
1035
1036
1036
    # now fix the priority on the others....
1037
    # now fix the priority on the others....
1037
    _FixPriority( $reserve_id );
1038
    _FixPriority( undef, undef, undef, $reserve->{biblionumber} );
1038
}
1039
}
1039
1040
1040
=head2 ModReserve
1041
=head2 ModReserve
Lines 1625-1640 in new priority rank Link Here
1625
=cut 
1626
=cut 
1626
1627
1627
sub _FixPriority {
1628
sub _FixPriority {
1628
    my ( $reserve_id, $rank, $ignoreSetLowestRank ) = @_;
1629
    my ( $reserve_id, $rank, $ignoreSetLowestRank, $biblionumber ) = @_;
1629
    my $dbh = C4::Context->dbh;
1630
    my $dbh = C4::Context->dbh;
1630
1631
1631
    my $res = GetReserve( $reserve_id );
1632
    my $res = GetReserve( $reserve_id );
1633
    $biblionumber ||= $res->{biblionumber};
1632
1634
1633
    if ( $rank eq "del" ) {
1635
    if ( $rank eq "del" ) {
1634
         CancelReserve({ reserve_id => $reserve_id });
1636
         CancelReserve({ reserve_id => $reserve_id });
1635
    }
1637
    }
1636
    elsif ( $rank eq "W" || $rank eq "0" ) {
1638
    elsif ( $rank eq "W" || $rank eq "0" ) {
1637
1638
        # make sure priority for waiting or in-transit items is 0
1639
        # make sure priority for waiting or in-transit items is 0
1639
        my $query = "
1640
        my $query = "
1640
            UPDATE reserves
1641
            UPDATE reserves
Lines 1656-1662 sub _FixPriority { Link Here
1656
        ORDER BY priority ASC
1657
        ORDER BY priority ASC
1657
    ";
1658
    ";
1658
    my $sth = $dbh->prepare($query);
1659
    my $sth = $dbh->prepare($query);
1659
    $sth->execute( $res->{'biblionumber'} );
1660
    $sth->execute( $biblionumber );
1660
    while ( my $line = $sth->fetchrow_hashref ) {
1661
    while ( my $line = $sth->fetchrow_hashref ) {
1661
        push( @priority,     $line );
1662
        push( @priority,     $line );
1662
    }
1663
    }
1663
- 

Return to bug 11336