LP#1732275: Patron Itemsout Notices - Add YAOUS for pre-due notices
authorCesar Velez <cesar.velez@equinoxinitiative.org>
Fri, 8 Dec 2017 18:50:38 +0000 (13:50 -0500)
committerKathy Lussier <klussier@masslnc.org>
Thu, 1 Mar 2018 00:49:25 +0000 (19:49 -0500)
Adding library permission 'webstaff.circ.itemsout_notice_count_excludes_courtesies'
so that pre-due/courtesy events aren't included in the notices count.

Signed-off-by: Cesar Velez <cesar.velez@equinoxinitiative.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>

Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm

index 84b328e..e62982e 100644 (file)
@@ -3665,6 +3665,8 @@ sub get_itemsout_notices{
     # where hook = 'checkout.due' AND state = 'complete' and target = <circId>;
     #
 
+    my $ctx_loc = $e->requestor->ws_ou;
+    my $exclude_courtesy_notices = $U->ou_ancestor_setting_value($ctx_loc, 'webstaff.circ.itemsout_notice_count_excludes_courtesies');
     my $query = {
            select => { atev => ["complete_time"] },
            from => {
@@ -3675,6 +3677,10 @@ sub get_itemsout_notices{
            where => {"+ath" => { key => "checkout.due" },"+atevdef" => { active => 't' },"+atev" => { target => $circId, state => 'complete' }}
     };
 
+    if ($exclude_courtesy_notices){
+        $query->{"where"}->{"+atevdef"}->{validator} = { "<>" => "CircIsOpen"};
+    }
+
     my %resblob = ( numNotices => 0, lastDt => undef );
 
     my $res = $e->json_query($query);