From fd816b593636f7cd94da025f3685a7f88c167f08 Mon Sep 17 00:00:00 2001
From: Galen Charlton <gmc@equinoxinitiative.org>
Date: Fri, 23 Mar 2018 14:48:02 -0400
Subject: [PATCH] LP#1758360: handle DOB display logic in egPatronSummary
 correctly

This patch ensures that the patron DOB will be displayed or
obscured correctly by the standalone egPatronSummary directive
in the same way that the patron app does.

To test
-------
[1] In the web staff client, do a patron search, select two patrons,
    then click the Merge Patrons button.
[2] Note that the patron DOB is not displayed in the modal.
[3] Apply the patch and repeat step #1.
[4] This time, the patron DOB will be displayed (if the
    circ.obscure_dob library setting is not enabled) or the
    the field label will be clickable (and clicking it will
    cause the DOB to be displayed).

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
---
 .../web/js/ui/default/staff/circ/services/patrons.js   | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/patrons.js b/Open-ILS/web/js/ui/default/staff/circ/services/patrons.js
index 17a7c7ec4b..5ab2faef7f 100644
--- a/Open-ILS/web/js/ui/default/staff/circ/services/patrons.js
+++ b/Open-ILS/web/js/ui/default/staff/circ/services/patrons.js
@@ -78,6 +78,24 @@ function($uibModal , $q , egCore) {
                     return user_stats;
                 }
 
+                // show/obscure DOB logic copied from the circ patron app
+                $scope._show_dob = {};
+                $scope.show_dob = function (val) {
+                    if ($scope.patron()) {
+                        if (typeof val != 'undefined') $scope._show_dob[$scope.patron().id()] = val;
+                        return $scope._show_dob[$scope.patron().id()];
+                    }
+                    return !egCore.env.aous['circ.obscure_dob'];
+                }
+
+                $scope.obscure_dob = function() {
+                    return egCore.env.aous && egCore.env.aous['circ.obscure_dob'];
+                }
+                $scope.now_show_dob = function() {
+                    return egCore.env.aous && egCore.env.aous['circ.obscure_dob'] ?
+                        $scope.show_dob() : true;
+                }
+
                 // needed because this directive shares a template with
                 // the patron summary in circ app, but the circ app
                 // displays the patron name elsewhere. 
-- 
2.11.0