Introduced a third library setting "circ.longoverdue.to_lost" which will allow the code to execute
beyond the error "COPY_MARKED_LONG_OVERDUE".
Introduced a sample action_trigger.event_definition '12 Month Long-Overdue Mark Lost' disabled
by default. This action trigger definition will target Long-Overdue items when executed with
the provided action_trigger_filters_lod_to_lost.json.example.
Includes a sample file action_trigger_filters_lod_to_lost.json.example
Reference to action_trigger_filters_lod_to_lost.json.example is included in Makefile
Extensive documentation added
Signed-off-by: blake <blake@mobiusconsortium.org>
--- /dev/null
+{
+"checkout.due" :
+ { "context_org" : "circ_lib",
+ "filter" :
+ { "checkin_time" : null,
+ "-or" :
+ [ { "stop_fines" : ["MAXFINES","LONGOVERDUE"] },
+ { "stop_fines" : null }
+ ]
+ }
+ }
+}
15 3 * * 0 . ~/.bashrc && $EG_BIN_DIR/action_trigger_runner.pl --osrf-config $SRF_CORE --process-hooks --granularity weekly
20 3 1 * * . ~/.bashrc && $EG_BIN_DIR/action_trigger_runner.pl --osrf-config $SRF_CORE --process-hooks --granularity monthly
25 3 1 1 * . ~/.bashrc && $EG_BIN_DIR/action_trigger_runner.pl --osrf-config $SRF_CORE --process-hooks --granularity yearly
+5 4 * * * . ~/.bashrc && $EG_BIN_DIR/action_trigger_runner.pl --osrf-config $SRF_CORE --process-hooks --granularity long_overdue_to_lost --custom-filters /openils/conf/action_trigger_filters_lod_to_lost.json.example
# Purge old A/T events
15 1 * * * . ~/.bashrc && $EG_BIN_DIR/purge_at_events.srfsh
SUM( CASE WHEN (xact_finish IS NULL AND stop_fines = 'LOST') THEN 1 ELSE 0 END) AS lost,
SUM( CASE WHEN stop_fines = 'CLAIMSRETURNED' THEN 1 ELSE 0 END) AS claims_returned,
- SUM( CASE WHEN (xact_finish IS NULL AND stop_fines = 'LONGOVERDUE' AND ID IN(SELECT xact FROM money.billing WHERE xact=acirc.id)) THEN 1 ELSE 0 END) AS long_overdue
+ SUM( CASE WHEN (xact_finish IS NULL AND stop_fines = 'LONGOVERDUE' AND ID IN(SELECT xact FROM money.billing WHERE xact=acirc.id)) THEN 1 ELSE 0 END) AS long_overdue
FROM action.circulation acirc
WHERE checkin_time IS NULL
GROUP BY 1
STRING_AGG( CASE WHEN (xact_finish IS NULL AND stop_fines = 'LOST') THEN id::TEXT ELSE '0' END,',') AS lost,
STRING_AGG( CASE WHEN stop_fines = 'CLAIMSRETURNED' THEN id::TEXT ELSE '0' END,',') AS claims_returned,
- STRING_AGG( CASE WHEN (xact_finish IS NULL AND stop_fines = 'LONGOVERDUE' AND ID IN(SELECT xact FROM money.billing WHERE xact=acirc.id)) THEN id::TEXT ELSE '0' END,',') AS long_overdue
+ STRING_AGG( CASE WHEN (xact_finish IS NULL AND stop_fines = 'LONGOVERDUE' AND ID IN(SELECT xact FROM money.billing WHERE xact=acirc.id)) THEN id::TEXT ELSE '0' END,',') AS long_overdue
FROM action.circulation acirc
WHERE checkin_time IS NULL
GROUP BY 1
# Decide which entities to build
sysconf_DATA = $(examples)/action_trigger_filters.json.example \
+ $(examples)/action_trigger_filters_lod_to_lost.json.example \
$(examples)/opensrf.xml.example \
$(examples)/opensrf_core.xml.example \
$(examples)/fm_IDL.xml \
event => 'COPY_MARKED_LONG_OVERDUE',
stop_fines => OILS_STOP_FINES_LONGOVERDUE,
at_hook => 'longoverdue',
- ous_assess_billing => OILS_SETTING_LONG_OVERDUE_ASSESS_BILLING
+ ous_assess_billing => OILS_SETTING_LONG_OVERDUE_ASSESS_BILLING,
+ ous_lod_to_lost => OILS_SETTING_LONG_OVERDUE_TO_LOST
);
}
$e->allowed($args{perm}, $circ->circ_lib) or return $e->die_event;
+ # ---------------------------------------------------------------------
+ # fetch OILS_SETTING_LONG_OVERDUE_TO_LOST setting to see if we proceed to billing or not
+ my $ous_lod_to_lost = $U->ou_ancestor_setting_value(
+ $owning_lib, $args{ous_assess_billing}, $e);
+
return $e->die_event(OpenILS::Event->new($args{event}))
- if ($copy->status == $args{status} || $copy->status == $args{alt_status});
+ if ($copy->status == $args{status} || ($copy->status == $args{alt_status} && !$ous_lod_to_lost) );
# ---------------------------------------------------------------------
# fetch the related org settings
econst OILS_SETTING_GENERATE_OVERDUE_ON_LOST_RETURN => 'circ.lost.generate_overdue_on_checkin';
econst OILS_SETTING_MAX_DUPLICATE_HOLDS => 'circ.holds.max_duplicate_holds';
econst OILS_SETTING_LONG_OVERDUE_ASSESS_BILLING => 'circ.longoverdue.assess_billing';
+econst OILS_SETTING_LONG_OVERDUE_TO_LOST => 'circ.longoverdue.to_lost';
'description'
)
+), (
+ 'circ.longoverdue.to_lost',
+ 'finance', 'bool',
+ oils_i18n_gettext(
+ 'circ.longoverdue.to_lost',
+ 'Allow Long-Overdue to become Lost',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'circ.longoverdue.to_lost',
+ 'This setting will allow items marked as Long-Overdue to become Lost. ' ||
+ 'This will allow staff and action trigger(s) to mark the item lost even ' ||
+ $$if it's already Long-Overdue. The default is false.$$,
+ 'coust',
+ 'description'
+ )
);
-- mark long-overdue reactor
'circ_lib'
);
+-- sample long-overdue to lost trigger
+INSERT INTO action_trigger.event_definition
+ (active, owner, name, hook, validator, reactor, delay, delay_field, granularity)
+VALUES (
+ FALSE, 1, '12 Month Long-Overdue Mark Lost',
+ 'checkout.due', 'CircIsOverdue',
+ 'MarkItemLost', '12 months', 'due_date','long_overdue_to_lost'
+);
+
+
INSERT INTO config.org_unit_setting_type
(name, grp, label, description, datatype)
VALUES
'label'
),
oils_i18n_gettext(
- 'circ.longoverdue.continue_overdue_billing',
- 'When an item is marked long overdue, overdues are halted. ' ||
- 'A setting of true here will allow the overdues to continue ' ||
- 'until another condition is met.',
+ 'circ.longoverdue.continue_overdue_billing',
+ 'When an item is marked long overdue, overdues are halted. ' ||
+ 'A setting of true here will allow the overdues to continue ' ||
+ 'until another condition is met.',
+ 'coust',
+ 'description'
+ ), 'bool'
+ )
+ ;
+
+ INSERT INTO config.org_unit_setting_type ( name, grp, label, description, datatype ) VALUES (
+ 'circ.longoverdue.to_lost',
+ 'finance',
+ oils_i18n_gettext(
+ 'circ.longoverdue.to_lost',
+ 'Allow Long-Overdue to become Lost',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'circ.longoverdue.to_lost',
+ 'This setting will allow items marked as Long-Overdue to become Lost. ' ||
+ 'This will allow staff and action trigger(s) to mark the item lost even ' ||
+ $$if it's already Long-Overdue. The default is false.$$,
'coust',
'description'
), 'bool'
-
COMMIT;
+*Long-Overdue to Lost*
+
+* Some libraries prefer to have items become Long-Overdue before they become Lost. Usually
+for some or all of these reasons:
+
+** Allows the patron to receive a "warning" notice (if action trigger is setup).
+** Allows the system to apply penalties to the patron (preventing holds for example)
+** Can be configured to NOT bill the patron during this step, but instead bill the patron at
+the Lost step.
+
+* If you would like the system to allow items to transition from Long-Overdue to Lost:
+
+** Contact your system administrator and double check that the server is configured to
+use the special action_trigger_filters_lod_to_lost.json.example. This is not
+"instead of" but should be configured "in addition to" the standard
+action_trigger_filters.json.example.
+
+** You will need to consider these three library settings:
+
+*** "Allow Long-Overdue to become Lost" - This setting needs to be set to "True"
+
+*** "Assess Billing When Marked Long-Overdue" - This setting is generally set to
+"False" in favor of billing the patron at the Lost stage. If "True" - the system
+will bill the patron the same way it would when marked Lost. A setting of "True"
+will cause the system to bill the patron based upon your settings:
+"Long-Overdue Materials Processing Fee" and "Void Overdue Fines When Items are Marked Long-Overdue"
+
+*** "Continue Overdue Billing When Marked Long-Overdue" - This setting is generally
+set to "True" which will allow the system to continue to generate fines as if it were Overdue.
+
+
*New Library Setting*
**Finances: Assess Billing When Marked Long-Overdue - When an item is marked long overdue a bill for the item will be assesed unless this setting is false. The default is true. If false, void overdue setting will be ignored and processing fee will be ignored
**Finances: Continue Overdue Billing When Marked Long-Overdue - When an item is marked long overdue, overdues are halted. A setting of true here will allow the overdues to continue until another condition is met.
+**Finances: Allow Long-Overdue to become Lost - This setting will allow items that have been previously marked Long-Overdue by an action trigger or otherwise to become Lost.
\ No newline at end of file
perl action_trigger_runner.pl --run-pending --granularity=Hourly --process-hooks
----
+* Run the specific Long-Overdue to Lost triggers with the custom action_trigger_filters.
++
+----
+perl action_trigger_runner.pl --process-hooks --granularity long_overdue_to_lost --custom-filters /openils/conf/action_trigger_filters_lod_to_lost.json.example
+----
+
** 6 Month Long Overdue Notice—will send patron notification that an item has
been marked long overdue on their account
+*Long-Overdue to Lost*
+
+* Some libraries prefer to have items become Long-Overdue before they become Lost. Usually
+for some or all of these reasons:
+
+** Allows the patron to receive a "warning" notice (if action trigger is setup).
+** Allows the system to apply penalties to the patorn (preventing holds for example)
+** Can be configured to NOT bill the patron during this step, but instead bill the patron at
+the Lost step.
+
+* If you would like the system to allow items to transition from Long-Overdue to Lost:
+
+** Contact your system administrator and double check that the server is configured to
+use the special action_trigger_filters_lod_to_lost.json.example. This is not
+"instead of" but should be configured "in addition to" the standard
+action_trigger_filters.json.example.
+
+** You will need to consider these three library settings:
+
+*** "Allow Long-Overdue to become Lost" - This setting needs to be set to "True"
+
+*** "Assess Billing When Marked Long-Overdue" - This setting is generally set to
+"False" in favor of billing the patron at the Lost stage. If "True" - the system
+will bill the patron the same way it would when marked Lost. A setting of "True"
+will cause the system to bill the patron based upon your settings:
+"Long-Overdue Materials Processing Fee" and "Void Overdue Fines When Items are Marked Long-Overdue"
+
+*** "Continue Overdue Billing When Marked Long-Overdue" - This setting is generally
+set to "True" which will allow the system to continue to generate fines as if it were Overdue.
+
+
*Library Settings*
The following Library Settings enable you to set preferences related to long
* *Finances: Void Overdue Fines When Items are Marked Long-Overdue*
-* *Finances: Assess Billing When Marked Long-Overdue* -Optionally skip billing price of item
+* *Finances: Assess Billing When Marked Long-Overdue* - Optionally skip billing price of item
* *Finances: Continue Overdue Billing When Marked Long-Overdue*
+* *Finances: Allow Long-Overdue to become Lost*
+
*Permissions to use this Feature*
The following permissions are related to this feature: