LP1331174_Long_Overdue_processing_needs_org_unit_settings user/blake/LP1331174_Long_Overdue_processing_needs_org_unit_settings
authorblake <blake@mobiusconsortium.org>
Tue, 12 Feb 2019 21:57:17 +0000 (15:57 -0600)
committerblake <blake@mobiusconsortium.org>
Tue, 12 Feb 2019 21:57:17 +0000 (15:57 -0600)
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>
Open-ILS/examples/action_trigger_filters_lod_to_lost.json.example [new file with mode: 0644]
Open-ILS/examples/crontab.example
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/Makefile.am
Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm
Open-ILS/src/perlmods/lib/OpenILS/Const.pm
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.long-overdue-asses-fines-library-setting.sql
docs/RELEASE_NOTES_NEXT/Circulation/lod_new_lib_settings.txt
docs/admin/actiontriggers_process.adoc
docs/circulation/circulating_items.adoc

diff --git a/Open-ILS/examples/action_trigger_filters_lod_to_lost.json.example b/Open-ILS/examples/action_trigger_filters_lod_to_lost.json.example
new file mode 100644 (file)
index 0000000..74c3ab8
--- /dev/null
@@ -0,0 +1,12 @@
+{
+"checkout.due" :
+    { "context_org" : "circ_lib",
+      "filter"      :
+            { "checkin_time"  : null,
+              "-or"           :
+                    [ { "stop_fines"  : ["MAXFINES","LONGOVERDUE"] },
+                      { "stop_fines"  : null }
+                    ]
+            }
+    }
+}
index 35144cd..548a7ef 100644 (file)
@@ -80,6 +80,7 @@ EG_BIN_DIR = /openils/bin
 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
index de89389..6b77daa 100644 (file)
@@ -4546,7 +4546,7 @@ SELECT  usr,
 
         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
@@ -4588,7 +4588,7 @@ SELECT  usr,
 
         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
index 33d3112..b294b4c 100644 (file)
@@ -34,6 +34,7 @@ autojsbinscripts = @srcdir@/extras/autogen.sh
 # 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 \
index 0256eb3..83cbb78 100644 (file)
@@ -837,7 +837,8 @@ sub set_item_long_overdue {
         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
     );
 }
 
@@ -861,8 +862,13 @@ sub set_item_lost_or_lod {
 
     $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
index 059b42a..10fbc50 100644 (file)
@@ -100,6 +100,7 @@ econst OILS_SETTING_BLOCK_HOLD_FOR_EXPIRED_PATRON       => 'circ.holds.expired_p
 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';
 
 
 
index 736dff7..08839ac 100644 (file)
@@ -16210,6 +16210,23 @@ INSERT INTO config.org_unit_setting_type
         '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
@@ -17017,6 +17034,16 @@ INSERT INTO action_trigger.environment (
     '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
index b386395..696aa83 100644 (file)
@@ -33,10 +33,30 @@ INSERT INTO config.org_unit_setting_type ( name, grp, label, description, dataty
          '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'
@@ -45,5 +65,4 @@ INSERT INTO config.org_unit_setting_type ( name, grp, label, description, dataty
 
 
 
-
 COMMIT;
index 1631283..a15258a 100644 (file)
@@ -1,3 +1,35 @@
+*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
index 8a6fc86..09afcb6 100644 (file)
@@ -61,3 +61,9 @@ pending events with that same granularity.
 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
+----
+
index 521d489..eef44a3 100644 (file)
@@ -389,6 +389,37 @@ configured period of time
 ** 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 
@@ -423,10 +454,12 @@ lost copy on the patron record when it is paid
 
 * *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: