Bugzilla – Attachment 174003 Details for
Bug 34355
Automated MARC record ordering process
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34355: (QA follow-up) Add a delete flag to the cronjob
Bug-34355-QA-follow-up-Add-a-delete-flag-to-the-cr.patch (text/plain), 2.36 KB, created by
Nick Clemens (kidclamp)
on 2024-11-05 16:38:22 UTC
(
hide
)
Description:
Bug 34355: (QA follow-up) Add a delete flag to the cronjob
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-11-05 16:38:22 UTC
Size:
2.36 KB
patch
obsolete
>From 8219ff21e18496b1d9ed362100001ec72e204c93 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Mon, 21 Oct 2024 12:51:34 +0000 >Subject: [PATCH] Bug 34355: (QA follow-up) Add a delete flag to the cronjob > >This patch adds a 'delete' flag to the cronjob to select whether a file should be deleted or archived once processed > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > misc/cronjobs/marc_ordering_process.pl | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > >diff --git a/misc/cronjobs/marc_ordering_process.pl b/misc/cronjobs/marc_ordering_process.pl >index 113c4d8876f..afe41c8c7d3 100755 >--- a/misc/cronjobs/marc_ordering_process.pl >+++ b/misc/cronjobs/marc_ordering_process.pl >@@ -47,6 +47,10 @@ Print report to standard out. > > Without this parameter no changes will be made > >+=item B<-d|--delete> >+ >+Delete the file once it has been processed >+ > =back > > =cut >@@ -64,11 +68,12 @@ use C4::Log qw( cronlogaction ); > > my $command_line_options = join( " ", @ARGV ); > >-my ( $help, $verbose, $confirm ); >+my ( $help, $verbose, $confirm, $delete ); > GetOptions( > 'h|help' => \$help, > 'v|verbose' => \$verbose, > 'c|confirm' => \$confirm, >+ 'd|delete' => \$delete, > ) || pod2usage(1); > > pod2usage(0) if $help; >@@ -116,11 +121,19 @@ foreach my $acct (@accounts) { > } > if ($confirm) { > say sprintf "Creating order lines from file %s", $filename if $verbose; >+ > my $result = Koha::MarcOrder->create_order_lines_from_file($args); > if ( $result->{success} ) { > $files_processed++; > say sprintf "Successfully processed file: %s", $filename if $verbose; >- unlink $full_path; >+ if ($delete) { >+ say sprintf "Deleting processed file: %s", $filename if $verbose; >+ unlink $full_path; >+ } else { >+ mkdir "$working_dir/archive" unless -d "$working_dir/archive"; >+ say sprintf "Moving file to archive: %s", $filename if $verbose; >+ move( $full_path, "$working_dir/archive/$filename" ); >+ } > } else { > say sprintf "Error processing file: %s", $filename if $verbose; > say sprintf "Error message: %s", $result->{error} if $verbose; >-- >2.39.5
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 34355
:
154705
|
154706
|
154707
|
154708
|
154709
|
154710
|
157092
|
157093
|
157094
|
157095
|
157096
|
157097
|
157098
|
157099
|
157100
|
160858
|
160859
|
160860
|
160861
|
160862
|
160863
|
160864
|
160865
|
160866
|
160867
|
160868
|
160869
|
160870
|
160871
|
160872
|
160873
|
160874
|
160875
|
169896
|
169897
|
169898
|
169899
|
169900
|
169901
|
169902
|
169903
|
169904
|
170395
|
170401
|
170402
|
170403
|
170404
|
170405
|
170406
|
170407
|
170408
|
170409
|
173054
|
173055
|
173056
|
173057
|
173058
|
173059
|
173060
|
173061
|
173062
|
173063
|
173064
|
173065
|
173066
|
173709
|
173805
|
173806
|
173809
|
173824
|
173825
|
173993
|
173994
|
173995
|
173996
|
173997
|
173998
|
173999
|
174000
|
174001
|
174002
|
174003
|
174004
|
174005
|
174006
|
174007
|
174008
|
174009
|
174010
|
174362
|
174363
|
174364
|
174365
|
174366
|
174367
|
174368
|
174369
|
174370
|
174371
|
174372
|
174373
|
174374
|
174375
|
174376
|
174377
|
174378
|
174379
|
174380
|
174382
|
174383