|
Lines 48-53
my $verbose;
Link Here
|
| 48 |
my $output_dir; |
48 |
my $output_dir; |
| 49 |
my $log; |
49 |
my $log; |
| 50 |
my $maxdays; |
50 |
my $maxdays; |
|
|
51 |
my $verify_issue; |
| 51 |
|
52 |
|
| 52 |
my $command_line_options = join(" ",@ARGV); |
53 |
my $command_line_options = join(" ",@ARGV); |
| 53 |
|
54 |
|
|
Lines 57-62
GetOptions(
Link Here
|
| 57 |
'l|log' => \$log, |
58 |
'l|log' => \$log, |
| 58 |
'o|out:s' => \$output_dir, |
59 |
'o|out:s' => \$output_dir, |
| 59 |
'm|maxdays:i' => \$maxdays, |
60 |
'm|maxdays:i' => \$maxdays, |
|
|
61 |
'i|verifyissue' => \$verify_issue, |
| 60 |
); |
62 |
); |
| 61 |
my $usage = << 'ENDUSAGE'; |
63 |
my $usage = << 'ENDUSAGE'; |
| 62 |
|
64 |
|
|
Lines 71-76
This script has the following parameters :
Link Here
|
| 71 |
-o --out: ouput directory for logs (defaults to env or /tmp if !exist) |
73 |
-o --out: ouput directory for logs (defaults to env or /tmp if !exist) |
| 72 |
-v --verbose |
74 |
-v --verbose |
| 73 |
-m --maxdays: how many days back of overdues to process |
75 |
-m --maxdays: how many days back of overdues to process |
|
|
76 |
-i --verifyissue: verify the issue before updating the fine in case the |
| 77 |
item is returned while the fines job is running |
| 74 |
|
78 |
|
| 75 |
ENDUSAGE |
79 |
ENDUSAGE |
| 76 |
|
80 |
|
|
Lines 130-135
for my $overdue ( @{$overdues} ) {
Link Here
|
| 130 |
"ERROR in Getoverdues : issues.borrowernumber IS NULL. Repair 'issues' table now! Skipping record.\n"; |
134 |
"ERROR in Getoverdues : issues.borrowernumber IS NULL. Repair 'issues' table now! Skipping record.\n"; |
| 131 |
next; |
135 |
next; |
| 132 |
} |
136 |
} |
|
|
137 |
|
| 138 |
# if the issue changed before the script got to it, then pass on it. |
| 139 |
my $issue = Koha::Checkouts->find({ issue_id => $overdue->{issue_id} }); |
| 140 |
next if ( ! $issue or $issue->date_due ne $overdue->{date_due} ); |
| 141 |
|
| 142 |
my $datedue = dt_from_string( $overdue->{date_due} ); |
| 143 |
next unless $issue->is_overdue( $datedue ); |
| 144 |
|
| 133 |
my $patron = Koha::Patrons->find( $overdue->{borrowernumber} ); |
145 |
my $patron = Koha::Patrons->find( $overdue->{borrowernumber} ); |
| 134 |
my $branchcode = |
146 |
my $branchcode = |
| 135 |
( $control eq 'ItemHomeLibrary' ) ? $overdue->{$branch_type} |
147 |
( $control eq 'ItemHomeLibrary' ) ? $overdue->{$branch_type} |
|
Lines 141-150
for my $overdue ( @{$overdues} ) {
Link Here
|
| 141 |
$is_holiday{$branchcode} = set_holiday( $branchcode, $today ); |
153 |
$is_holiday{$branchcode} = set_holiday( $branchcode, $today ); |
| 142 |
} |
154 |
} |
| 143 |
|
155 |
|
| 144 |
my $datedue = dt_from_string( $overdue->{date_due} ); |
|
|
| 145 |
if ( DateTime->compare( $datedue, $today ) == 1 ) { |
| 146 |
next; # not overdue |
| 147 |
} |
| 148 |
++$counted; |
156 |
++$counted; |
| 149 |
|
157 |
|
| 150 |
my ( $amount, $unitcounttotal, $unitcount ) = |
158 |
my ( $amount, $unitcounttotal, $unitcount ) = |
|
Lines 160-165
for my $overdue ( @{$overdues} ) {
Link Here
|
| 160 |
&& ( $amount && $amount > 0 ) |
168 |
&& ( $amount && $amount > 0 ) |
| 161 |
) |
169 |
) |
| 162 |
{ |
170 |
{ |
|
|
171 |
if ( $verify_issue ) { |
| 172 |
# if the issue changed before the script got to it, then pass on it. |
| 173 |
my $issue = Koha::Checkouts->find({ issue_id => $overdue->{issue_id} }); |
| 174 |
next if ( ! $issue or $issue->date_due ne $overdue->{date_due} ); |
| 175 |
} |
| 163 |
UpdateFine( |
176 |
UpdateFine( |
| 164 |
{ |
177 |
{ |
| 165 |
issue_id => $overdue->{issue_id}, |
178 |
issue_id => $overdue->{issue_id}, |
| 166 |
- |
|
|