webstaff: Honor "obscure DOB" YAOUS
authorMike Rylander <mrylander@gmail.com>
Tue, 31 Mar 2015 20:46:32 +0000 (16:46 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Wed, 19 Aug 2015 17:39:14 +0000 (13:39 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/src/templates/staff/circ/patron/t_summary.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/app.js

index 55cbb6f..6a3d7f6 100644 (file)
@@ -28,8 +28,9 @@
     </div>
     <div class="row"
       ng-class="{'patron-summary-alert' : !patron().dob()}">
-      <div class="col-md-5">[% l('Date of Birth') %]</div>
-      <div class="col-md-7">{{patron().dob() | date:'shortDate'}}</div>
+      <a class="col-md-5" ng-if="obscure_dob()" ng-click="show_dob(true)">[% l('Date of Birth') %]</a>
+      <div class="col-md-5" ng-if="!obscure_dob()">[% l('Date of Birth') %]</div>
+      <div class="col-md-7" ng-show="now_show_dob()">{{patron().dob() | date:'shortDate'}}</div>
     </div>
     <div class="row">
       <div class="col-md-5">[% l('Last Activity') %]</div>
index aeea4ed..1b80839 100644 (file)
@@ -611,6 +611,17 @@ function($scope,  $q,  $location , $filter,  egCore,  egUser,  patronSvc) {
         return $q.when();
     }
 
+    $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['circ.obscure_dob']; }
+    $scope.now_show_dob = function() { return egCore.env.aous['circ.obscure_dob'] ? $scope.show_dob() : true; }
     $scope.patron = function() { return patronSvc.current }
     $scope.patron_stats = function() { return patronSvc.patron_stats }
     $scope.summary_stat_cats = function() { return patronSvc.summary_stat_cats }