# should generate an override of an old-style event
my %COPY_ALERT_OVERRIDES = (
"CLAIMSRETURNED\tCHECKOUT" => 'CIRC_CLAIMS_RETURNED',
+ "LOST\tCHECKOUT" => 'OPEN_CIRCULATION_EXISTS',
+ "LONGOVERDUE\tCHECKOUT" => 'OPEN_CIRCULATION_EXISTS',
);
sub initialize {}
sub add_overrides_from_system_copy_alerts {
my $self = shift;
+ my $e = $self->editor;
foreach my $condition (keys %{$self->overrides_per_copy_alerts()}) {
if (exists $COPY_ALERT_OVERRIDES{$condition}) {
$self->override(1);
push @{$self->override_args->{events}}, $COPY_ALERT_OVERRIDES{$condition};
+ # special handling for long-overdue and lost checkouts
+ if ($COPY_ALERT_OVERRIDES{$condition} eq 'OPEN_CIRCULATION_EXISTS') {
+ my $state = (split /\t/, $condition, -1)[0];
+ my $setting;
+ if ($state eq 'LOST') {
+ $setting = 'circ.copy_alerts.forgive_fines_on_lost_checkin';
+ } elsif ($state eq 'LONGOVERDUE') {
+ $setting = 'circ.copy_alerts.forgive_fines_on_long_overdue_checkin';
+ } else {
+ next;
+ }
+ my $forgive = $U->ou_ancestor_setting_value(
+ $self->circ_lib, $setting, $e
+ );
+ if ($U->is_true($forgive)) {
+ $self->void_overdues(1);
+ }
+ $self->do_checkin();
+ }
}
}
}
--- /dev/null
+BEGIN;
+
+--- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO config.org_unit_setting_type
+ (name, grp, label, description, datatype)
+ VALUES
+ ('circ.copy_alerts.forgive_fines_on_lost_checkin',
+ 'circ',
+ oils_i18n_gettext('circ.copy_alerts.forgive_fines_on_lost_checkin',
+ 'Forgive fines when checking out a lost item and copy alert is suppressed?',
+ 'coust', 'label'),
+ oils_i18n_gettext('circ.copy_alerts.forgive_fines_on_lost_checkin',
+ 'Controls whether fines are automatically forgiven when checking out an '||
+ 'item that has been marked as lost, and the corresponding copy alert has been '||
+ 'suppressed.',
+ 'coust', 'description'),
+ 'bool');
+
+INSERT INTO config.org_unit_setting_type
+ (name, grp, label, description, datatype)
+ VALUES
+ ('circ.copy_alerts.forgive_fines_on_long_overdue_checkin',
+ 'circ',
+ oils_i18n_gettext('circ.copy_alerts.forgive_fines_on_long_overdue_checkin',
+ 'Forgive fines when checking out a long-overdue item and copy alert is suppressed?',
+ 'coust', 'label'),
+ oils_i18n_gettext('circ.copy_alerts.forgive_fines_on_lost_checkin',
+ 'Controls whether fines are automatically forgiven when checking out an '||
+ 'item that has been marked as lost, and the corresponding copy alert has been '||
+ 'suppressed.',
+ 'coust', 'description'),
+ 'bool');
+
+COMMIT;