Bugzilla – Attachment 161774 Details for
Bug 34077
writeoff_debts without --confirm doesn't show which accountline records it would have been written off
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34077: Tidy the script
Bug-34077-Tidy-the-script.patch (text/plain), 4.12 KB, created by
Martin Renvoize (ashimema)
on 2024-02-06 12:22:32 UTC
(
hide
)
Description:
Bug 34077: Tidy the script
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-02-06 12:22:32 UTC
Size:
4.12 KB
patch
obsolete
>From 8a037612b134feaff41a014210e2dd81b8373eb2 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 6 Feb 2024 12:18:46 +0000 >Subject: [PATCH] Bug 34077: Tidy the script > >Minimal changes were needed to bring the script up to date with current >perltidy requirements. I opted to do a full tidy rather than just tidy >the blocks changed. >--- > misc/cronjobs/writeoff_debts.pl | 37 ++++++++++++++------------------- > 1 file changed, 16 insertions(+), 21 deletions(-) > >diff --git a/misc/cronjobs/writeoff_debts.pl b/misc/cronjobs/writeoff_debts.pl >index 84543a8f6fd..96f077ab97d 100755 >--- a/misc/cronjobs/writeoff_debts.pl >+++ b/misc/cronjobs/writeoff_debts.pl >@@ -4,7 +4,7 @@ use Modern::Perl; > use feature 'say'; > > use Getopt::Long qw( GetOptions ); >-use Pod::Usage qw( pod2usage ); >+use Pod::Usage qw( pod2usage ); > > use Koha::Account::Lines; > use Koha::DateUtils qw( dt_from_string ); >@@ -27,12 +27,12 @@ GetOptions( > pod2usage(1) if ( $help || !$file && !@type && !$before && !$after && !@category_code ); > > my $where = { 'amountoutstanding' => { '>' => 0 } }; >-my $attr = {}; >+my $attr = {}; > > if ($file) { > my @accounts_from_file; > open( my $fh, '<:encoding(UTF-8)', $file ) >- or die "Could not open file '$file' $!"; >+ or die "Could not open file '$file' $!"; > while ( my $line = <$fh> ) { > chomp($line); > push @accounts_from_file, $line; >@@ -46,7 +46,7 @@ if (@type) { > } > > my $dtf; >-if ($before||$after) { >+if ( $before || $after ) { > $dtf = Koha::Database->new->schema->storage->datetime_parser; > } > >@@ -67,22 +67,22 @@ if (@category_code) { > > my $lines = Koha::Account::Lines->search( $where, $attr ); > >-if ( $verbose ) { >- print "Attempting to write off " . $lines->count . " debts" if $confirm; >+if ($verbose) { >+ print "Attempting to write off " . $lines->count . " debts" if $confirm; > print "With --confirm we would write off " . $lines->count . " debts" if !$confirm; >- print " of type " . join(',',@type) if @type; >- print " for patron categories " . join(', ', @category_code) if @category_code; >- print " added before " . $before if $before; >- print " added after " . $after if $after; >- print " from the passed list" if $file; >+ print " of type " . join( ',', @type ) if @type; >+ print " for patron categories " . join( ', ', @category_code ) if @category_code; >+ print " added before " . $before if $before; >+ print " added after " . $after if $after; >+ print " from the passed list" if $file; > print "\n"; > } > > while ( my $line = $lines->next ) { > say "Skipping " . $line->accountlines_id . "; Not a debt" and next >- if $line->is_credit && $verbose > 1; >+ if $line->is_credit && $verbose > 1; > say "Skipping " . $line->accountlines_id . "; Is a PAYOUT" and next >- if $line->debit_type_code eq 'PAYOUT' && $verbose > 1; >+ if $line->debit_type_code eq 'PAYOUT' && $verbose > 1; > > if ($confirm) { > $line->_result->result_source->schema->txn_do( >@@ -112,11 +112,7 @@ while ( my $line = $lines->next ) { > )->store(); > > # Link writeoff to charge >- $writeoff->apply( >- { >- debits => [$line] >- } >- ); >+ $writeoff->apply( { debits => [$line] } ); > $writeoff->status('APPLIED')->store(); > > # Update status of original debit >@@ -128,8 +124,7 @@ while ( my $line = $lines->next ) { > if ($verbose) { > if ($confirm) { > say "Accountline " . $line->accountlines_id . " written off"; >- } >- else { >+ } else { > say "Accountline " . $line->accountlines_id . " will be written off"; > } > } >@@ -201,7 +196,7 @@ This flag set the script to output logging for the actions it will perform. > =item B<-c|--confirm> > > This flag must be provided in order for the script to actually >-writeoff debts. >+writeoff debts. > > =back > >-- >2.43.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34077
:
157230
|
159598
|
159987
|
161772
|
161773
|
161774
|
162234
|
162235
|
167403
|
167404