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

(-)a/Koha/Hold.pm (-2 / +3 lines)
Lines 347-355 Returns the related Koha::Patron object for this hold Link Here
347
sub patron {
347
sub patron {
348
    my ($self) = @_;
348
    my ($self) = @_;
349
349
350
    $self->{_patron} ||= Koha::Patrons->find( $self->borrowernumber() );
350
    my $patron_rs = $self->_result->patron;
351
    return unless $patron_rs;
351
352
352
    return $self->{_patron};
353
    return Koha::Patron->_new_from_dbic($patron_rs);
353
}
354
}
354
355
355
=head3 item
356
=head3 item
(-)a/Koha/Schema/Result/Reserve.pm (+7 lines)
Lines 408-413 __PACKAGE__->belongs_to( Link Here
408
  },
408
  },
409
);
409
);
410
410
411
__PACKAGE__->belongs_to(
412
  "patron",
413
  "Koha::Schema::Result::Borrower",
414
  { "foreign.borrowernumber" => "self.borrowernumber" },
415
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
416
);
417
411
__PACKAGE__->add_columns(
418
__PACKAGE__->add_columns(
412
    '+item_level_hold' => { is_boolean => 1 },
419
    '+item_level_hold' => { is_boolean => 1 },
413
    '+lowestPriority'  => { is_boolean => 1 },
420
    '+lowestPriority'  => { is_boolean => 1 },
(-)a/t/db_dependent/Koha/Hold.t (-1 / +50 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright 2020 Koha Development team
4
#
5
# This file is part of Koha
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use Test::More tests => 1;
23
24
use t::lib::TestBuilder;
25
26
my $schema  = Koha::Database->new->schema;
27
my $builder = t::lib::TestBuilder->new;
28
29
subtest 'patron() tests' => sub {
30
31
    plan tests => 2;
32
33
    $schema->storage->txn_begin;
34
35
    my $patron = $builder->build_object({ class => 'Koha::Patrons' });
36
    my $hold   = $builder->build_object(
37
        {
38
            class => 'Koha::Holds',
39
            value => {
40
                borrowernumber => $patron->borrowernumber
41
            }
42
        }
43
    );
44
45
    my $hold_patron = $hold->patron;
46
    is( ref($hold_patron), 'Koha::Patron', 'Right type' );
47
    is( $hold_patron->id, $patron->id, 'Right object' );
48
49
    $schema->storage->txn_rollback;
50
};

Return to bug 26988