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

(-)a/Koha/Cash/Register.pm (-11 / +6 lines)
Lines 46-54 Return the library linked to this cash register Link Here
46
46
47
sub library {
47
sub library {
48
    my ($self) = @_;
48
    my ($self) = @_;
49
    my $rs = $self->_result->branch;
49
    return Koha::Library->_new_from_dbic($self->_result->branch);
50
    return unless $rs;
51
    return Koha::Library->_new_from_dbic($rs);
52
}
50
}
53
51
54
=head3 cashups
52
=head3 cashups
Lines 67-73 sub cashups { Link Here
67
    my $rs =
65
    my $rs =
68
      $self->_result->search_related( 'cash_register_actions',
66
      $self->_result->search_related( 'cash_register_actions',
69
        $merged_conditions, $attrs );
67
        $merged_conditions, $attrs );
70
    return unless $rs;
68
71
    return Koha::Cash::Register::Actions->_new_from_dbic($rs);
69
    return Koha::Cash::Register::Actions->_new_from_dbic($rs);
72
}
70
}
73
71
Lines 86-92 sub last_cashup { Link Here
86
        { order_by => { '-desc' => [ 'timestamp', 'id' ] }, rows => 1 }
84
        { order_by => { '-desc' => [ 'timestamp', 'id' ] }, rows => 1 }
87
    )->single;
85
    )->single;
88
86
89
    return unless $rs;
90
    return Koha::Cash::Register::Action->_new_from_dbic($rs);
87
    return Koha::Cash::Register::Action->_new_from_dbic($rs);
91
}
88
}
92
89
Lines 98-107 Return a set of accountlines linked to this cash register Link Here
98
95
99
sub accountlines {
96
sub accountlines {
100
    my ($self) = @_;
97
    my ($self) = @_;
101
98
    return Koha::Account::Lines->_new_from_dbic($self->_result->accountlines);
102
    my $rs = $self->_result->accountlines;
103
    return unless $rs;
104
    return Koha::Account::Lines->_new_from_dbic($rs);
105
}
99
}
106
100
107
=head3 outstanding_accountlines
101
=head3 outstanding_accountlines
Lines 136-142 sub outstanding_accountlines { Link Here
136
    my $rs =
130
    my $rs =
137
      $self->_result->search_related( 'accountlines', $merged_conditions,
131
      $self->_result->search_related( 'accountlines', $merged_conditions,
138
        $attrs );
132
        $attrs );
139
    return unless $rs;
133
140
    return Koha::Account::Lines->_new_from_dbic($rs);
134
    return Koha::Account::Lines->_new_from_dbic($rs);
141
}
135
}
142
136
Lines 148-153 Local store method to prevent direct manipulation of the 'branch_default' field Link Here
148
142
149
sub store {
143
sub store {
150
    my ($self) = @_;
144
    my ($self) = @_;
145
151
    $self->_result->result_source->schema->txn_do(
146
    $self->_result->result_source->schema->txn_do(
152
        sub {
147
        sub {
153
            if ( $self->_result->is_column_changed('branch_default') ) {
148
            if ( $self->_result->is_column_changed('branch_default') ) {
Lines 163-168 sub store { Link Here
163
            }
158
            }
164
        }
159
        }
165
    );
160
    );
161
166
    return $self;
162
    return $self;
167
}
163
}
168
164
169
- 

Return to bug 24815