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

(-)a/Koha/Template/Plugin/Registers.pm (-4 / +4 lines)
Lines 84-97 Returns a list of all cash registers available that adhere to the passed filters Link Here
84
sub all {
84
sub all {
85
    my ( $self, $params ) = @_;
85
    my ( $self, $params ) = @_;
86
86
87
    my $filters = $params->{filters};
87
    my $filters = $params->{filters} // {};
88
    my $where;
88
    my $where;
89
    $where->{branch} = C4::Context->userenv->{'branch'}
89
    $where->{branch} =
90
      C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef
90
      if $filters->{current_branch};
91
      if $filters->{current_branch};
91
    my $registers = Koha::Cash::Registers->search($where)->unblessed();
92
    my $registers = Koha::Cash::Registers->search($where)->unblessed();
92
    for my $register ( @{$registers} ) {
93
    for my $register ( @{$registers} ) {
93
        $register->{selected} = ( defined( $self->session_register_id )
94
        $register->{selected} = ( defined( $self->session_register_id )
94
              && $register->{id} == $self->session_register_id ) ? 1 : 0;
95
              && $register->{id} eq $self->session_register_id ) ? 1 : 0;
95
    }
96
    }
96
97
97
    return $registers;
98
    return $registers;
98
- 

Return to bug 24786