Line 0
Link Here
|
0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
3 |
use Modern::Perl; |
4 |
|
5 |
use Koha::Database; |
6 |
use t::lib::TestBuilder; |
7 |
|
8 |
my $builder = t::lib::TestBuilder->new; |
9 |
my $manager = $builder->build_object( { class => 'Koha::Patrons' } ); |
10 |
my $register = Koha::Cash::Registers->find({ name => 'MR' }); |
11 |
for ( 1..10 ) { |
12 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
13 |
my $account = $patron->account; |
14 |
for ( 1..10 ) { |
15 |
my $debit_type = $builder->build_object( |
16 |
{ |
17 |
class => 'Koha::Account::DebitTypes' |
18 |
} |
19 |
); |
20 |
my $debit = $account->add_debit( |
21 |
{ |
22 |
amount => 1 + int(rand(100 - 1)), |
23 |
type => $debit_type->code, |
24 |
interface => 'cron' |
25 |
} |
26 |
); |
27 |
$debit->date( \'NOW() - INTERVAL FLOOR(1 + RAND() * 60) MINUTE' )->store; |
28 |
my $payment = $account->pay( |
29 |
{ |
30 |
cash_register => $register->id, |
31 |
amount => $debit->amount, |
32 |
credit_type => 'PAYMENT', |
33 |
lines => [$debit] |
34 |
} |
35 |
); |
36 |
} |
37 |
} |
38 |
|
39 |
my $cashup = $register->add_cashup( |
40 |
{ |
41 |
manager_id => $manager->id, |
42 |
amount => 0 + int(rand(1000 - 1)) |
43 |
} |
44 |
); |
45 |
|
46 |
print "Cashups added\n" |