<event code='7025' textcode='COPY_STATUS_LONG_OVERDUE'>
<desc xml:lang="en-US">Copy is marked as long-overdue</desc>
</event>
+ <event code='7026' textcode='COPY_STATUS_LOST_AND_PAID'>
+ <desc xml:lang="en-US">Copy is marked as lost and paid</desc>
+ </event>
<!-- ================================================================ -->
my( @lost, @cr, @lo );
for my $c (@$open) {
- push( @lost, $c->id ) if $c->stop_fines eq 'LOST';
+ push( @lost, $c->id ) if ($c->stop_fines eq 'LOST' || $c->stop_fines eq 'LOSTANDPAID');
push( @cr, $c->id ) if $c->stop_fines eq 'CLAIMSRETURNED';
push( @lo, $c->id ) if $c->stop_fines eq 'LONGOVERDUE';
}
$self->copy->circ_lib->id : $self->copy->circ_lib;
my $stat = $U->copy_status($self->copy->status)->id;
- if ($stat == OILS_COPY_STATUS_LOST) {
+ if ($stat == OILS_COPY_STATUS_LOST || $stat == OILS_COPY_STATUS_LOST_AND_PAID) {
# we will now handle lost fines, but the copy will retain its 'lost'
# status if it needs to transit home unless lost_immediately_available
# is true
return OpenILS::Event->new('COPY_STATUS_LOST', payload => $copy )
if( $status == OILS_COPY_STATUS_LOST );
+ return OpenILS::Event->new('COPY_STATUS_LOST_AND_PAID', payload => $copy)
+ if ($status == OILS_COPY_STATUS_LOST_AND_PAID);
+
return OpenILS::Event->new('COPY_STATUS_LONG_OVERDUE', payload => $copy )
if( $status == OILS_COPY_STATUS_LONG_OVERDUE );
use OpenILS::Utils::Penalty;
use Business::Stripe;
$Data::Dumper::Indent = 0;
+use OpenILS::Const qw/:const/;
sub get_processor_settings {
my $e = shift;
# credit
$cred = -$cred;
$credit += $cred;
- my $circ = $e->retrieve_action_circulation($transid);
+ my $circ = $e->retrieve_action_circulation(
+ [
+ $transid,
+ {
+ flesh => 1,
+ flesh_fields => {circ => ['target_copy','billings']}
+ }
+ ]
+ ); # Flesh the copy, so we can monkey with the status if
+ # necessary.
# Whether or not we close the transaction. We definitely
- # close is no circulation transaction is present,
+ # close if no circulation transaction is present,
# otherwise we check if the circulation is in a state that
# allows itself to be closed.
if (!$circ || OpenILS::Application::Circ::CircCommon->can_close_circ($e, $circ)) {
)
}
}
+
+ # If we have a circ, we need to check if there are lost or
+ # long overdue billings and if it looks like one of these
+ # is being paid. If it is then we check org_unit_settings
+ # for the copy owning library and adjust statuses and stop
+ # fines reasons accordingly.
+ if ($circ) {
+ # We need the copy to check settings and to possibly
+ # change its status.
+ my $copy = $circ->target_copy();
+ # Library where we'll check settings.
+ my $check_lib = $copy->circ_lib();
+
+ # Find all lost billings that match the payment amount
+ # being made. As crazy as it sounds, there could be
+ # more than one.
+ my @lost = grep {$_->btype() == 3 && $_->amount() <= $amount} @{$circ->billings()};
+
+ # Find all long overdue billings that match the
+ # payment amount being made. As crazy as it sounds,
+ # there could be more than one.
+ my @loverdue = grep {$_->btype() == 10 && $_->amount() <= $amount} @{$circ->billings()};
+
+ # A little logical simplification. We'll precheck if
+ # we have the conditions that we need to set the stop
+ # fines or copy status and put these each in their own
+ # bool variable. This will save us some complication
+ # in the logic below.
+ my $stop_fines_cond = (($circ->stop_fines() eq OILS_STOP_FINES_LOST && scalar(@lost))
+ || ($circ->stop_fines() eq OILS_STOP_FINES_LONGOVERDUE && scalar(@loverdue)));
+ my $copy_status_cond = (($copy->status() == OILS_COPY_STATUS_LOST && scalar(@lost))
+ || ($copy->status() == OILS_COPY_STATUS_LONG_OVERDUE && scalar(@loverdue)));
+
+ # check the stop fines.
+ if ($stop_fines_cond) {
+ if ($U->is_true($U->ou_ancestor_setting_value($check_lib, 'circ.use_lost_paid_stop_fines', $e))) {
+ $circ->stop_fines_time('now');
+ $circ->stop_fines(OILS_STOP_FINES_LOSTANDPAID);
+ $e->update_action_circulation($circ);
+ }
+ }
+ # check the copy status
+ if ($copy_status_cond) {
+ if ($U->is_true($U->ou_ancestor_setting_value($check_lib, 'circ.use_lost_paid_copy_status', $e))) {
+ $copy->status(OILS_COPY_STATUS_LOST_AND_PAID);
+ $e->update_asset_copy($copy);
+ }
+ }
+ }
}
# Urgh, clean up this mega-function one day.
my $evt;
my $hold;
- if( ($transit->copy_status == OILS_COPY_STATUS_LOST and !$e->allowed('ABORT_TRANSIT_ON_LOST')) or
+ if( (($transit->copy_status == OILS_COPY_STATUS_LOST || $transit->copy_status == OILS_COPY_STATUS_LOST_AND_PAID)
+ and !$e->allowed('ABORT_TRANSIT_ON_LOST')) or
($transit->copy_status == OILS_COPY_STATUS_MISSING and !$e->allowed('ABORT_TRANSIT_ON_MISSING')) ) {
$e->rollback;
return OpenILS::Event->new('TRANSIT_ABORT_NOT_ALLOWED', copy_status => $transit->copy_status);
FROM $circ circ
LEFT JOIN $setting setting
ON (circ.circ_lib = setting.org_unit AND setting.name = 'circ.long_overdue.interval')
- WHERE circ.checkin_time IS NULL AND (stop_fines IS NULL OR stop_fines NOT IN ('LOST','LONGOVERDUE'))
+ WHERE circ.checkin_time IS NULL AND (stop_fines IS NULL OR stop_fines NOT IN ('LOST','LONGOVERDUE','LOSTANDPAID'))
AND AGE(circ.due_date) > CAST( COALESCE( BTRIM( setting.value,'"' ), ? ) AS INTERVAL)
)
SQL
WHERE c.usr = ?
AND c.xact_finish IS NULL
AND (
- c.stop_fines NOT IN ('CLAIMSRETURNED','LOST')
+ c.stop_fines NOT IN ('CLAIMSRETURNED','LOST','LOSTANDPAID')
OR c.stop_fines IS NULL
)
SQL
AND ( (fine_interval >= '1 day' AND due_date >= 'today')
OR (fine_interval < '1 day' AND due_date > 'now' ))
AND (stop_fines IS NULL
- OR stop_fines NOT IN ('LOST','CLAIMSRETURNED','LONGOVERDUE'))
+ OR stop_fines NOT IN ('LOST','CLAIMSRETURNED','LONGOVERDUE','LOSTANDPAID'))
SQL
my $out = actor::user->db_Main->selectcol_arrayref($out_sql, {}, $usr);
AND ( (fine_interval >= '1 day' AND due_date < 'today')
OR (fine_interval < '1 day' AND due_date < 'now' ))
AND (stop_fines IS NULL
- OR stop_fines NOT IN ('LOST','CLAIMSRETURNED','LONGOVERDUE'))
+ OR stop_fines NOT IN ('LOST','CLAIMSRETURNED','LONGOVERDUE','LOSTANDPAID'))
SQL
my $od = actor::user->db_Main->selectcol_arrayref($od_sql, {}, $usr);
my $lo = actor::user->db_Main->selectcol_arrayref($lo_sql, {}, $usr);
+ my $lp_sql = <<" SQL";
+ SELECT id
+ FROM action.circulation
+ WHERE usr = ? AND checkin_time IS NULL AND stop_fines = 'LOSTANDPAID'
+ SQL
+
+ my $lp = actor::user->db_Main->selectcol_arrayref($lo_sql, {}, $usr);
+
$self->method_lookup('open-ils.storage.transaction.rollback')->run($client);
if ($self->api_name =~/count$/o) {
# checkin_time => undef,
# '-or' => [
# { stop_fines => undef },
-# { stop_fines => { 'not in' => ['LOST','LONGOVERDUE','CLAIMSRETURNED'] } }
+# { stop_fines => { 'not in' => ['LOST','LONGOVERDUE','CLAIMSRETURNED','LOSTANDPAID'] } }
# ]
# }
econst OILS_COPY_STATUS_DAMAGED => 14;
econst OILS_COPY_STATUS_ON_RESV_SHELF => 15;
econst OILS_COPY_STATUS_LONG_OVERDUE => 16;
+econst OILS_COPY_STATUS_LOST_AND_PAID => 17;
# ---------------------------------------------------------------------
econst OILS_STOP_FINES_LOST => 'LOST';
econst OILS_STOP_FINES_CLAIMSRETURNED => 'CLAIMSRETURNED';
econst OILS_STOP_FINES_LONGOVERDUE => 'LONGOVERDUE';
+econst OILS_STOP_FINES_LOSTANDPAID => 'LOSTANDPAID';
econst OILS_STOP_FINES_MAX_FINES => 'MAXFINES';
econst OILS_STOP_FINES_CLAIMS_NEVERCHECKEDOUT => 'CLAIMSNEVERCHECKEDOUT';
econst OILS_UNLIMITED_CIRC_DURATION => 'unlimited';
return '08' if $stat == OILS_COPY_STATUS_ON_HOLDS_SHELF;
return '09' if $stat == OILS_COPY_STATUS_RESHELVING;
return '10' if $stat == OILS_COPY_STATUS_IN_TRANSIT;
- return '12' if $stat == OILS_COPY_STATUS_LOST;
+ return '12' if ($stat == OILS_COPY_STATUS_LOST || $stat == OILS_COPY_STATUS_LOST_AND_PAID);
return '13' if $stat == OILS_COPY_STATUS_MISSING;
return '01';
checkin_time => undef,
'-or' => [
{stop_fines => undef},
- {stop_fines => {'not in' => ['LOST','CLAIMSRETURNED','LONGOVERDUE']}}
+ {stop_fines => {'not in' => ['LOST','CLAIMSRETURNED','LONGOVERDUE','LOSTANDPAID']}}
],
}
},
7010 /* COPY_ALERT_MESSAGE */,
7011 /* COPY_STATUS_LOST */,
7025 /* COPY_STATUS_LONG_OVERDUE */,
+ 7026 /* COPY_STATUS_LOST_AND_PAID */,
7012 /* COPY_STATUS_MISSING */,
7013 /* PATRON_EXCEEDS_FINES */
] : [],
7010 /* COPY_ALERT_MESSAGE */,
7011 /* COPY_STATUS_LOST */,
7025 /* COPY_STATUS_LONG_OVERDUE */,
+ 7026 /* COPY_STATUS_LOST_AND_PAID */,
7012 /* COPY_STATUS_MISSING */,
7013 /* PATRON_EXCEEDS_FINES */,
11103 /* TRANSIT_CHECKIN_INTERVAL_BLOCK */
var stop_fines = row.my.circ.stop_fines() || '';
// we have custom syling for these stop-fines reasons
- if (stop_fines.match(/LOST|LONGOVERDUE/))
+ if (stop_fines.match(/LOST|LONGOVERDUE|LOSTANDPAID/))
style_type = stop_fines.toLowerCase();
$(style_type + '_hint').hidden = false;
background-color: maroon;
}
+treechildren::-moz-tree-cell(lostandpaid) {
+ background-color: maroon;
+}
+
treechildren::-moz-tree-cell-text(circulating) {
color: white;
}
color: white;
}
+treechildren::-moz-tree-cell-text(lostandpaid) {
+ color: white;
+}
+
treechildren::-moz-tree-cell-text(longoverdue) {
color: black;
}
color: white;
}
+#lostandpaid_hint {
+ background-color: maroon;
+ color: white;
+}
+
#longoverdue_hint {
background-color: orange;
color: black;