Lines 47-52
Print report to standard out.
Link Here
|
47 |
|
47 |
|
48 |
Without this parameter no changes will be made |
48 |
Without this parameter no changes will be made |
49 |
|
49 |
|
|
|
50 |
=item B<-d|--delete> |
51 |
|
52 |
Delete the file once it has been processed |
53 |
|
50 |
=back |
54 |
=back |
51 |
|
55 |
|
52 |
=cut |
56 |
=cut |
Lines 64-74
use C4::Log qw( cronlogaction );
Link Here
|
64 |
|
68 |
|
65 |
my $command_line_options = join( " ", @ARGV ); |
69 |
my $command_line_options = join( " ", @ARGV ); |
66 |
|
70 |
|
67 |
my ( $help, $verbose, $confirm ); |
71 |
my ( $help, $verbose, $confirm, $delete ); |
68 |
GetOptions( |
72 |
GetOptions( |
69 |
'h|help' => \$help, |
73 |
'h|help' => \$help, |
70 |
'v|verbose' => \$verbose, |
74 |
'v|verbose' => \$verbose, |
71 |
'c|confirm' => \$confirm, |
75 |
'c|confirm' => \$confirm, |
|
|
76 |
'd|delete' => \$delete, |
72 |
) || pod2usage(1); |
77 |
) || pod2usage(1); |
73 |
|
78 |
|
74 |
pod2usage(0) if $help; |
79 |
pod2usage(0) if $help; |
Lines 116-126
foreach my $acct (@accounts) {
Link Here
|
116 |
} |
121 |
} |
117 |
if ($confirm) { |
122 |
if ($confirm) { |
118 |
say sprintf "Creating order lines from file %s", $filename if $verbose; |
123 |
say sprintf "Creating order lines from file %s", $filename if $verbose; |
|
|
124 |
|
119 |
my $result = Koha::MarcOrder->create_order_lines_from_file($args); |
125 |
my $result = Koha::MarcOrder->create_order_lines_from_file($args); |
120 |
if ( $result->{success} ) { |
126 |
if ( $result->{success} ) { |
121 |
$files_processed++; |
127 |
$files_processed++; |
122 |
say sprintf "Successfully processed file: %s", $filename if $verbose; |
128 |
say sprintf "Successfully processed file: %s", $filename if $verbose; |
123 |
unlink $full_path; |
129 |
if ($delete) { |
|
|
130 |
say sprintf "Deleting processed file: %s", $filename if $verbose; |
131 |
unlink $full_path; |
132 |
} else { |
133 |
mkdir "$working_dir/archive" unless -d "$working_dir/archive"; |
134 |
say sprintf "Moving file to archive: %s", $filename if $verbose; |
135 |
move( $full_path, "$working_dir/archive/$filename" ); |
136 |
} |
124 |
} else { |
137 |
} else { |
125 |
say sprintf "Error processing file: %s", $filename if $verbose; |
138 |
say sprintf "Error processing file: %s", $filename if $verbose; |
126 |
say sprintf "Error message: %s", $result->{error} if $verbose; |
139 |
say sprintf "Error message: %s", $result->{error} if $verbose; |
127 |
- |
|
|