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 25-30 Link Here
25
use Modern::Perl;
25
use Modern::Perl;
26
use CGI qw ( -utf8 );
26
use CGI qw ( -utf8 );
27
use List::MoreUtils qw( uniq );
27
use List::MoreUtils qw( uniq );
28
use Try::Tiny;
29
28
use C4::Output;
30
use C4::Output;
29
use C4::Reserves qw( ModReserve ModReserveCancelAll );
31
use C4::Reserves qw( ModReserve ModReserveCancelAll );
30
use C4::Auth qw( get_template_and_user );
32
use C4::Auth qw( get_template_and_user );
Lines 83-89 else { Link Here
83
            $params->{reservedate} = $reservedates[$i] ? dt_from_string($reservedates[$i]) : undef;
85
            $params->{reservedate} = $reservedates[$i] ? dt_from_string($reservedates[$i]) : undef;
84
        }
86
        }
85
87
86
        ModReserve($params);
88
        try {
89
            ModReserve($params);
90
        } catch {
91
            if ($_->isa('Koha::Exceptions::ObjectNotFound')){
92
                warn $_;
93
            } else {
94
                $_->rethrow;
95
            }
96
        }
87
    }
97
    }
88
}
98
}
89
99
(-)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 221-226 AlterPriority( 'bottom', $hold->reserve_id, undef, 2, 1, 6 ); Link Here
221
$hold = Koha::Holds->find( $reserveid );
223
$hold = Koha::Holds->find( $reserveid );
222
is( $hold->priority, '6', "Test AlterPriority(), move to bottom" );
224
is( $hold->priority, '6', "Test AlterPriority(), move to bottom" );
223
225
226
227
$hold->delete;
228
throws_ok
229
    { C4::Reserves::ModReserve({ reserve_id => $hold->reserve_id }) }
230
    'Koha::Exceptions::ObjectNotFound',
231
    'No hold with id ' . $hold->reserve_id;
232
224
# Regression test for bug 2394
233
# Regression test for bug 2394
225
#
234
#
226
# If IndependentBranches is ON and canreservefromotherbranches is OFF,
235
# If IndependentBranches is ON and canreservefromotherbranches is OFF,
227
- 

Return to bug 29969