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

(-)a/Koha/Cash/Register.pm (-1 / +1 lines)
Lines 126-132 sub outstanding_accountlines { Link Here
126
126
127
    my $local_conditions =
127
    my $local_conditions =
128
      $since->count
128
      $since->count
129
      ? { 'timestamp' => { '>=' => $since->get_column('timestamp')->as_query } }
129
      ? { 'timestamp' => { '>' => $since->get_column('timestamp')->as_query } }
130
      : {};
130
      : {};
131
    my $merged_conditions =
131
    my $merged_conditions =
132
      $conditions
132
      $conditions
(-)a/t/db_dependent/Koha/Cash/Register.t (-2 / +9 lines)
Lines 202-208 subtest 'cashup' => sub { Link Here
202
202
203
    subtest 'outstanding_accountlines' => sub {
203
    subtest 'outstanding_accountlines' => sub {
204
        plan tests => 4;
204
        plan tests => 4;
205
205
        
206
        # add_cashup should not happen simultaneously with any other action 
207
        # that results in an accountline attached to the same cash register.
208
        # In testing, we need to sleep for a second after each action that 
209
        # adds to the database. (We cannot use Time::Fake as timestamps are 
210
        # being added at the DB level, not in perl.
206
        my $accountline1 = $builder->build_object(
211
        my $accountline1 = $builder->build_object(
207
            {
212
            {
208
                class => 'Koha::Account::Lines',
213
                class => 'Koha::Account::Lines',
Lines 215-226 subtest 'cashup' => sub { Link Here
215
                value => { register_id => $register->id },
220
                value => { register_id => $register->id },
216
            }
221
            }
217
        );
222
        );
223
        sleep 1;
218
224
219
        my $accountlines = $register->outstanding_accountlines;
225
        my $accountlines = $register->outstanding_accountlines;
220
        is( $accountlines->count, 2, 'No cashup, all accountlines returned' );
226
        is( $accountlines->count, 2, 'No cashup, all accountlines returned' );
221
227
222
        my $cashup3 =
228
        my $cashup3 =
223
          $register->add_cashup( { manager_id => $patron->id, amount => '2.50' } );
229
          $register->add_cashup( { manager_id => $patron->id, amount => '2.50' } );
230
        sleep 1;
224
231
225
        $accountlines = $register->outstanding_accountlines;
232
        $accountlines = $register->outstanding_accountlines;
226
        is( $accountlines->count, 0, 'Cashup added, no accountlines returned' );
233
        is( $accountlines->count, 0, 'Cashup added, no accountlines returned' );
Lines 231-236 subtest 'cashup' => sub { Link Here
231
                value => { register_id => $register->id },
238
                value => { register_id => $register->id },
232
            }
239
            }
233
        );
240
        );
241
        sleep 1;
234
242
235
        $accountlines = $register->outstanding_accountlines;
243
        $accountlines = $register->outstanding_accountlines;
236
        is( $accountlines->count, 1,
244
        is( $accountlines->count, 1,
237
- 

Return to bug 24817