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

(-)a/C4/Reserves.pm (-1 / +1 lines)
Lines 797-803 sub CheckReserves { Link Here
797
                    next if (($branchitemrule->{'holdallowed'} == 1) && ($branch ne $patron->branchcode));
797
                    next if (($branchitemrule->{'holdallowed'} == 1) && ($branch ne $patron->branchcode));
798
                    my $hold_fulfillment_policy = $branchitemrule->{hold_fulfillment_policy};
798
                    my $hold_fulfillment_policy = $branchitemrule->{hold_fulfillment_policy};
799
                    next if ( ($branchitemrule->{hold_fulfillment_policy} ne 'any') && ($res->{branchcode} ne $item->$hold_fulfillment_policy) );
799
                    next if ( ($branchitemrule->{hold_fulfillment_policy} ne 'any') && ($res->{branchcode} ne $item->$hold_fulfillment_policy) );
800
                    next unless $item->can_be_transferred( { to => scalar Koha::Libraries->find( $res->{branchcode} ) } );
800
                    next unless $item->can_be_transferred( { to => Koha::Libraries->find( $res->{branchcode} ) } );
801
                    $priority = $res->{'priority'};
801
                    $priority = $res->{'priority'};
802
                    $highest  = $res;
802
                    $highest  = $res;
803
                    last if $local_hold_match;
803
                    last if $local_hold_match;
(-)a/C4/SIP/ILS/Transaction/Hold.pm (-1 / +1 lines)
Lines 60-66 sub do_hold { Link Here
60
        $self->ok(0);
60
        $self->ok(0);
61
        return $self;
61
        return $self;
62
    }
62
    }
63
    unless ( $item->can_be_transferred( { to => scalar Koha::Libraries->find( $branch ) } ) ) {
63
    unless ( $item->can_be_transferred( { to => Koha::Libraries->find( $branch ) } ) ) {
64
        $self->screen_msg('Item cannot be transferred.');
64
        $self->screen_msg('Item cannot be transferred.');
65
        $self->ok(0);
65
        $self->ok(0);
66
        return $self;
66
        return $self;
(-)a/Koha/Club.pm (-2 / +2 lines)
Lines 48-54 sub club_template { Link Here
48
48
49
    return unless $self->club_template_id();
49
    return unless $self->club_template_id();
50
50
51
    return scalar Koha::Club::Templates->find( $self->club_template_id() );
51
    return Koha::Club::Templates->find( $self->club_template_id() );
52
}
52
}
53
53
54
=head3 club_fields
54
=head3 club_fields
Lines 84-90 sub branch { Link Here
84
84
85
    return unless $self->branchcode();
85
    return unless $self->branchcode();
86
86
87
    return scalar Koha::Libraries->find( $self->branchcode() );
87
    return Koha::Libraries->find( $self->branchcode() );
88
}
88
}
89
89
90
=head3 type
90
=head3 type
(-)a/Koha/Club/Enrollment.pm (-2 / +2 lines)
Lines 59-65 sub cancel { Link Here
59
59
60
sub club {
60
sub club {
61
    my ( $self ) = @_;
61
    my ( $self ) = @_;
62
    return scalar Koha::Clubs->find( $self->club_id() );
62
    return Koha::Clubs->find( $self->club_id() );
63
}
63
}
64
64
65
=head3 patron
65
=head3 patron
Lines 68-74 sub club { Link Here
68
68
69
sub patron {
69
sub patron {
70
    my ( $self ) = @_;
70
    my ( $self ) = @_;
71
    return scalar Koha::Patrons->find( $self->borrowernumber() );
71
    return Koha::Patrons->find( $self->borrowernumber() );
72
}
72
}
73
73
74
=head3 type
74
=head3 type
(-)a/Koha/Club/Field.pm (-1 / +1 lines)
Lines 46-52 Represents the value set at creation time for a Koha::Club::Template::Field Link Here
46
sub club_template_field {
46
sub club_template_field {
47
    my ( $self ) = @_;
47
    my ( $self ) = @_;
48
48
49
    return scalar Koha::Club::Template::Fields->find( $self->club_template_field_id );
49
    return Koha::Club::Template::Fields->find( $self->club_template_field_id );
50
}
50
}
51
51
52
=head3 type
52
=head3 type
(-)a/Koha/Objects.pm (-9 / +9 lines)
Lines 85-99 my $object = Koha::Objects->find( $idpart1, $idpart2, $attrs ); # composite PK Link Here
85
sub find {
85
sub find {
86
    my ( $self, @pars ) = @_;
86
    my ( $self, @pars ) = @_;
87
87
88
    croak 'Cannot use "->find" in list context' if wantarray;
88
    my $object;
89
89
90
    return if !@pars || none { defined($_) } @pars;
90
    @pars = grep { defined } @pars;
91
91
    if (@pars) {
92
    my $result = $self->_resultset()->find( @pars );
92
        my $result = $self->_resultset()->find(@pars);
93
93
        if ($result) {
94
    return unless $result;
94
            $object = $self->object_class()->_new_from_dbic($result);
95
95
        }
96
    my $object = $self->object_class()->_new_from_dbic( $result );
96
    }
97
97
98
    return $object;
98
    return $object;
99
}
99
}
(-)a/Koha/Subscription.pm (-2 / +2 lines)
Lines 51-57 Returns the biblio linked to this subscription as a Koha::Biblio object Link Here
51
sub biblio {
51
sub biblio {
52
    my ($self) = @_;
52
    my ($self) = @_;
53
53
54
    return scalar Koha::Biblios->find($self->biblionumber);
54
    return Koha::Biblios->find($self->biblionumber);
55
}
55
}
56
56
57
=head3 vendor
57
=head3 vendor
Lines 62-68 Returns the vendor/supplier linked to this subscription as a Koha::Acquisition:: Link Here
62
62
63
sub vendor {
63
sub vendor {
64
    my ($self) = @_;
64
    my ($self) = @_;
65
    return scalar Koha::Acquisition::Booksellers->find($self->aqbooksellerid);
65
    return Koha::Acquisition::Booksellers->find($self->aqbooksellerid);
66
}
66
}
67
67
68
=head3 subscribers
68
=head3 subscribers
(-)a/acqui/booksellers.pl (-1 / +1 lines)
Lines 82-88 my $allbaskets= $query->param('allbaskets')||0; Link Here
82
my @suppliers;
82
my @suppliers;
83
83
84
if ($booksellerid) {
84
if ($booksellerid) {
85
    push @suppliers, scalar Koha::Acquisition::Booksellers->find( $booksellerid );
85
    push @suppliers, Koha::Acquisition::Booksellers->find( $booksellerid );
86
} else {
86
} else {
87
    @suppliers = Koha::Acquisition::Booksellers->search(
87
    @suppliers = Koha::Acquisition::Booksellers->search(
88
                        { name => { -like => "%$supplier%" } },
88
                        { name => { -like => "%$supplier%" } },
(-)a/acqui/uncertainprice.pl (-1 / +1 lines)
Lines 72-78 my $op = $input->param('op'); Link Here
72
my $owner = $input->param('owner') || 0 ; # flag to see only "my" orders, or everyone orders
72
my $owner = $input->param('owner') || 0 ; # flag to see only "my" orders, or everyone orders
73
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
73
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
74
74
75
$template->param( basket => scalar Koha::Acquisition::Baskets->find($basketno) );
75
$template->param( basket => Koha::Acquisition::Baskets->find($basketno) );
76
76
77
#show all orders that have uncertain price for the bookseller
77
#show all orders that have uncertain price for the bookseller
78
my $pendingorders = SearchOrders({
78
my $pendingorders = SearchOrders({
(-)a/cataloguing/moveitem.pl (-1 / +1 lines)
Lines 79-85 if ( $barcode && $biblionumber ) { Link Here
79
        if ($moveresult) {
79
        if ($moveresult) {
80
            $template->param(
80
            $template->param(
81
                success => 1,
81
                success => 1,
82
                from_biblio => scalar Koha::Biblios->find($frombiblionumber),
82
                from_biblio => Koha::Biblios->find($frombiblionumber),
83
            );
83
            );
84
        }
84
        }
85
        else {
85
        else {
(-)a/circ/overdue.pl (-1 / +1 lines)
Lines 308-314 if ($noreport) { Link Here
308
        }
308
        }
309
309
310
        push @overduedata, {
310
        push @overduedata, {
311
            patron                 => scalar Koha::Patrons->find( $data->{borrowernumber} ),
311
            patron                 => Koha::Patrons->find( $data->{borrowernumber} ),
312
            duedate                => $data->{date_due},
312
            duedate                => $data->{date_due},
313
            borrowernumber         => $data->{borrowernumber},
313
            borrowernumber         => $data->{borrowernumber},
314
            cardnumber             => $data->{cardnumber},
314
            cardnumber             => $data->{cardnumber},
(-)a/members/memberentry.pl (-1 / +1 lines)
Lines 791-797 $template->param( csrf_token => Link Here
791
791
792
# HouseboundModule data
792
# HouseboundModule data
793
$template->param(
793
$template->param(
794
    housebound_role  => scalar Koha::Patron::HouseboundRoles->find($borrowernumber),
794
    housebound_role  => Koha::Patron::HouseboundRoles->find($borrowernumber),
795
);
795
);
796
796
797
if(defined($data{'flags'})){
797
if(defined($data{'flags'})){
(-)a/members/pay.pl (-2 / +2 lines)
Lines 112-118 elsif ( $input->param('confirm_writeoff') ) { Link Here
112
        Koha::Account->new( { patron_id => $borrowernumber } )->pay(
112
        Koha::Account->new( { patron_id => $borrowernumber } )->pay(
113
            {
113
            {
114
                amount     => $amount,
114
                amount     => $amount,
115
                lines      => [ scalar Koha::Account::Lines->find($accountlines_id) ],
115
                lines      => [ Koha::Account::Lines->find($accountlines_id) ],
116
                type       => 'writeoff',
116
                type       => 'writeoff',
117
                note       => $payment_note,
117
                note       => $payment_note,
118
                interface  => C4::Context->interface,
118
                interface  => C4::Context->interface,
Lines 217-223 sub writeoff_all { Link Here
217
            Koha::Account->new( { patron_id => $borrowernumber } )->pay(
217
            Koha::Account->new( { patron_id => $borrowernumber } )->pay(
218
                {
218
                {
219
                    amount => $amount,
219
                    amount => $amount,
220
                    lines  => [ scalar Koha::Account::Lines->find($accountlines_id) ],
220
                    lines  => [ Koha::Account::Lines->find($accountlines_id) ],
221
                    type   => 'writeoff',
221
                    type   => 'writeoff',
222
                    note   => $payment_note,
222
                    note   => $payment_note,
223
                    interface  => C4::Context->interface,
223
                    interface  => C4::Context->interface,
(-)a/t/db_dependent/Koha/Objects.t (-4 / +10 lines)
Lines 46-58 my $borrowernumber_exists = grep { /^borrowernumber$/ } @columns; Link Here
46
is( $borrowernumber_exists, 1, 'Koha::Objects->columns should return the table columns' );
46
is( $borrowernumber_exists, 1, 'Koha::Objects->columns should return the table columns' );
47
47
48
subtest 'find' => sub {
48
subtest 'find' => sub {
49
    plan tests => 4;
49
    plan tests => 6;
50
    my $patron = $builder->build({source => 'Borrower'});
50
    my $patron = $builder->build({source => 'Borrower'});
51
    my $patron_object = Koha::Patrons->find( $patron->{borrowernumber} );
51
    my $patron_object = Koha::Patrons->find( $patron->{borrowernumber} );
52
    is( $patron_object->borrowernumber, $patron->{borrowernumber}, '->find should return the correct object' );
52
    is( $patron_object->borrowernumber, $patron->{borrowernumber}, '->find should return the correct object' );
53
53
54
    eval { my @patrons = Koha::Patrons->find( $patron->{borrowernumber} ); };
54
    my @patrons = Koha::Patrons->find( $patron->{borrowernumber} );
55
    like( $@, qr|^Cannot use "->find" in list context|, "->find should not be called in list context to avoid side-effects" );
55
    is(scalar @patrons, 1, '->find in list context returns a value');
56
    is($patrons[0]->borrowernumber, $patron->{borrowernumber}, '->find in list context returns the same value as in scalar context');
57
58
    my $patrons = {
59
        foo => Koha::Patrons->find('foo'),
60
        bar => 'baz',
61
    };
62
    is ($patrons->{foo}, undef, '->find in list context returns undef when no record is found');
56
63
57
    # Test sending undef to find; should not generate a warning
64
    # Test sending undef to find; should not generate a warning
58
    warning_is { $patron = Koha::Patrons->find( undef ); }
65
    warning_is { $patron = Koha::Patrons->find( undef ); }
59
- 

Return to bug 19809