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

(-)a/Koha/Cash/Register.pm (-1 / +8 lines)
Lines 209-214 sub drop_default { Link Here
209
209
210
=head3 add_cashup
210
=head3 add_cashup
211
211
212
    my $action = $cash_register->add_cashup(
213
        {
214
            manager_id => $logged_in_user->id,
215
            amount     => $cash_register->outstanding_accountlines->total
216
        }
217
    );
218
212
Add a new cashup action to the till, returns the added action.
219
Add a new cashup action to the till, returns the added action.
213
220
214
=cut
221
=cut
Lines 219-225 sub add_cashup { Link Here
219
    my $rs = $self->_result->add_to_cash_register_actions(
226
    my $rs = $self->_result->add_to_cash_register_actions(
220
        {
227
        {
221
            code       => 'CASHUP',
228
            code       => 'CASHUP',
222
            manager_id => $params->{staff_id},
229
            manager_id => $params->{manager_id},
223
            amount     => $params->{amount}
230
            amount     => $params->{amount}
224
        }
231
        }
225
    )->discard_changes;
232
    )->discard_changes;
(-)a/pos/register.pl (-2 / +2 lines)
Lines 73-80 else { Link Here
73
    if ( $op eq 'cashup' ) {
73
    if ( $op eq 'cashup' ) {
74
        $cash_register->add_cashup(
74
        $cash_register->add_cashup(
75
            {
75
            {
76
                staff_id => $logged_in_user->id,
76
                manager_id => $logged_in_user->id,
77
                amount   => $cash_register->outstanding_accountlines->total
77
                amount     => $cash_register->outstanding_accountlines->total
78
            }
78
            }
79
        );
79
        );
80
    }
80
    }
(-)a/t/db_dependent/Koha/Account/Line.t (-1 / +1 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 8;
22
use Test::More tests => 11;
23
use Test::Exception;
23
use Test::Exception;
24
24
25
use C4::Circulation qw/AddIssue AddReturn/;
25
use C4::Circulation qw/AddIssue AddReturn/;
(-)a/t/db_dependent/Koha/Cash/Register.t (-4 / +3 lines)
Lines 160-166 subtest 'cashup' => sub { Link Here
160
160
161
        ok(
161
        ok(
162
            $cashup1 = $register->add_cashup(
162
            $cashup1 = $register->add_cashup(
163
                { user_id => $patron->id, amount => '12.00' }
163
                { manager_id => $patron->id, amount => '12.00' }
164
            ),
164
            ),
165
            'call successfull'
165
            'call successfull'
166
        );
166
        );
Lines 184-190 subtest 'cashup' => sub { Link Here
184
        plan tests => 3;
184
        plan tests => 3;
185
185
186
        my $cashup2 =
186
        my $cashup2 =
187
          $register->add_cashup( { user_id => $patron->id, amount => '6.00' } );
187
          $register->add_cashup( { manager_id => $patron->id, amount => '6.00' } );
188
188
189
        my $last_cashup = $register->last_cashup;
189
        my $last_cashup = $register->last_cashup;
190
        is(
190
        is(
Lines 220-226 subtest 'cashup' => sub { Link Here
220
        is( $accountlines->count, 2, 'No cashup, all accountlines returned' );
220
        is( $accountlines->count, 2, 'No cashup, all accountlines returned' );
221
221
222
        my $cashup3 =
222
        my $cashup3 =
223
          $register->add_cashup( { user_id => $patron->id, amount => '2.50' } );
223
          $register->add_cashup( { manager_id => $patron->id, amount => '2.50' } );
224
224
225
        $accountlines = $register->outstanding_accountlines;
225
        $accountlines = $register->outstanding_accountlines;
226
        is( $accountlines->count, 0, 'Cashup added, no accountlines returned' );
226
        is( $accountlines->count, 0, 'Cashup added, no accountlines returned' );
227
- 

Return to bug 23355