From 08df7a82653baa16b5205ec747558ff1b6e78041 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 7 Nov 2023 11:41:00 +0000 Subject: [PATCH] Bug 31041: DO NOT PUSH - Testing Only This patch adds a script to allow easy population of a cashup using KTD. To use it 1) Start up a KTD 2) Enable UseCashRegisters system preference 3) Add a cash register with the name 'TEST' 4) Run this script from the command line 5) Navigate to the register you created to look at the cashups 6) Click on the summary link and print at the bottom of the modal and confirm that the modal prints as expected accross multiple pages without duplications or data lose. 7) Back on the register page, select to view the past months 'Older transactions'. This will lengthen the page significantly 8) Click on the summary link again and print.. Confirm that again the correct number of pages is printed and contain the correct content. This tests both scenarios.. where the background page spans multiple pages and where the modal content requires a scroll. --- populate_cashups.pl | 46 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 populate_cashups.pl diff --git a/populate_cashups.pl b/populate_cashups.pl new file mode 100755 index 00000000000..68085537229 --- /dev/null +++ b/populate_cashups.pl @@ -0,0 +1,46 @@ +#!/usr/bin/perl + +use Modern::Perl; + +use Koha::Database; +use t::lib::TestBuilder; + +my $builder = t::lib::TestBuilder->new; +my $manager = $builder->build_object( { class => 'Koha::Patrons' } ); +my $register = Koha::Cash::Registers->find({ name => 'TEST' }); +for ( 1..10 ) { + my $patron = $builder->build_object({ class => 'Koha::Patrons' }); + my $account = $patron->account; + for ( 1..10 ) { + my $debit_type = $builder->build_object( + { + class => 'Koha::Account::DebitTypes' + } + ); + my $debit = $account->add_debit( + { + amount => 1 + int(rand(100 - 1)), + type => $debit_type->code, + interface => 'cron' + } + ); + $debit->date( \'NOW() - INTERVAL FLOOR(1 + RAND() * 60) MINUTE' )->store; + my $payment = $account->pay( + { + cash_register => $register->id, + amount => $debit->amount, + credit_type => 'PAYMENT', + lines => [$debit] + } + ); + } +} + +my $cashup = $register->add_cashup( + { + manager_id => $manager->id, + amount => 0 + int(rand(1000 - 1)) + } +); + +print "Cashups added\n" -- 2.41.0