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

(-)a/C4/Reserves.pm (-1 / +4 lines)
Lines 1040-1046 sub ModReserve { Link Here
1040
    my $cancellation_reason = $params->{'cancellation_reason'};
1040
    my $cancellation_reason = $params->{'cancellation_reason'};
1041
    my $date = $params->{expirationdate};
1041
    my $date = $params->{expirationdate};
1042
1042
1043
    return if $rank eq "n";
1043
    return if defined $rank && $rank eq "n";
1044
1044
1045
    return unless ( $reserve_id || ( $borrowernumber && ( $biblionumber || $itemnumber ) ) );
1045
    return unless ( $reserve_id || ( $borrowernumber && ( $biblionumber || $itemnumber ) ) );
1046
1046
Lines 1054-1059 sub ModReserve { Link Here
1054
1054
1055
    $hold ||= Koha::Holds->find($reserve_id);
1055
    $hold ||= Koha::Holds->find($reserve_id);
1056
1056
1057
    # FIXME Other calls may fail
1058
    Koha::Exceptions::ObjectNotFound->throw( 'No hold with id ' . $reserve_id ) unless $hold;
1059
1057
    if ( $rank eq "del" ) {
1060
    if ( $rank eq "del" ) {
1058
        $hold->cancel({ cancellation_reason => $cancellation_reason });
1061
        $hold->cancel({ cancellation_reason => $cancellation_reason });
1059
    }
1062
    }
(-)a/reserve/modrequest.pl (-1 / +11 lines)
Lines 26-31 use Modern::Perl; Link Here
26
use CGI qw ( -utf8 );
26
use CGI qw ( -utf8 );
27
use URI;
27
use URI;
28
use List::MoreUtils qw( uniq );
28
use List::MoreUtils qw( uniq );
29
use Try::Tiny;
30
29
use C4::Output;
31
use C4::Output;
30
use C4::Reserves qw( ModReserve ModReserveCancelAll );
32
use C4::Reserves qw( ModReserve ModReserveCancelAll );
31
use C4::Auth qw( get_template_and_user );
33
use C4::Auth qw( get_template_and_user );
Lines 84-90 else { Link Here
84
            $params->{reservedate} = $reservedates[$i] ? dt_from_string($reservedates[$i]) : undef;
86
            $params->{reservedate} = $reservedates[$i] ? dt_from_string($reservedates[$i]) : undef;
85
        }
87
        }
86
88
87
        ModReserve($params);
89
        try {
90
            ModReserve($params);
91
        } catch {
92
            if ($_->isa('Koha::Exceptions::ObjectNotFound')){
93
                warn $_;
94
            } else {
95
                $_->rethrow;
96
            }
97
        }
88
    }
98
    }
89
}
99
}
90
100
(-)a/t/db_dependent/Holds.t (-2 / +10 lines)
Lines 7-13 use t::lib::TestBuilder; Link Here
7
7
8
use C4::Context;
8
use C4::Context;
9
9
10
use Test::More tests => 72;
10
use Test::More tests => 73;
11
use Test::Exception;
12
11
use MARC::Record;
13
use MARC::Record;
12
14
13
use C4::Biblio;
15
use C4::Biblio;
Lines 223-228 AlterPriority( 'bottom', $hold->reserve_id, undef, 2, 1, 6 ); Link Here
223
$hold = Koha::Holds->find( $reserveid );
225
$hold = Koha::Holds->find( $reserveid );
224
is( $hold->priority, '6', "Test AlterPriority(), move to bottom" );
226
is( $hold->priority, '6', "Test AlterPriority(), move to bottom" );
225
227
228
229
$hold->delete;
230
throws_ok
231
    { C4::Reserves::ModReserve({ reserve_id => $hold->reserve_id }) }
232
    'Koha::Exceptions::ObjectNotFound',
233
    'No hold with id ' . $hold->reserve_id;
234
226
# Regression test for bug 2394
235
# Regression test for bug 2394
227
#
236
#
228
# If IndependentBranches is ON and canreservefromotherbranches is OFF,
237
# If IndependentBranches is ON and canreservefromotherbranches is OFF,
229
- 

Return to bug 29969