[Koha-bugs] [Bug 24005] Software error: at login

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sat Nov 9 11:06:05 CET 2019


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24005

--- Comment #1 from Andrew Lau <andrewanandal at gmail.com> ---
No Executing opening the discharge.pm at the destination folder, the following
is obtained:



---------------------------------------------------------------------------
  GNU nano 2.9.3                                                               
                                /usr/share/koha/lib/Koha/Patron/Discharge.pm   
                                                                               
            Modified  


    my $cond = {
        'me.needed'    => { '!=', undef },
        'me.validated' => undef,
        ( defined $borrowernumber ? ( 'me.borrower' => $borrowernumber ) : ()
),
        ( defined $branchcode ? ( 'borrower.branchcode' => $branchcode ) : ()
),
    };

    return search_limited( $cond );
}

sub get_validated {
    my ($params)       = @_;
    my $branchcode     = $params->{branchcode};
    my $borrowernumber = $params->{borrowernumber};

    my $cond = {
        'me.validated' => { '!=', undef },
        ( defined $borrowernumber ? ( 'me.borrower' => $borrowernumber ) : ()
),
        ( defined $branchcode ? ( 'borrower.branchcode' => $branchcode ) : ()
),
    };

    return search_limited( $cond );
}

# TODO This module should be based on Koha::Object[s]
sub search_limited {
    my ( $params, $attributes ) = @_;
    my $userenv = C4::Context->userenv;
    my @restricted_branchcodes;
    if ( $userenv and $userenv->{number} ) {
        my $logged_in_user = Koha::Patrons->find( $userenv->{number} );
        @restricted_branchcodes =
$logged_in_user->libraries_where_can_see_patrons;
    }
    $params->{'borrower.branchcode'} = { -in => \@restricted_branchcodes } if
@restricted_branchcodes;
    $attributes->{join} = 'borrower';

    my $rs = Koha::Database->new->schema->resultset('Discharge');
    return $rs->search( $params, { join => 'borrower' } );
}

1;

------------------------------------------------------------------------

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list