LP#1402797 Respect ui.staff.require_initials.patron_standing_penalty OU setting
authorMike Rylander <mrylander@gmail.com>
Tue, 27 Jan 2015 23:40:18 +0000 (18:40 -0500)
committerBill Erickson <berickxx@gmail.com>
Wed, 25 Feb 2015 16:16:06 +0000 (11:16 -0500)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/templates/staff/circ/share/t_new_message_dialog.tt2
Open-ILS/web/js/ui/default/staff/circ/services/circ.js

index a3dab2b..c6a8960 100644 (file)
@@ -42,8 +42,8 @@
     <div class="modal-footer">
       <div class="row">
         <div class="col-md-2">
-          <input type="text" class="form-control" 
-            ng-model="args.initials" placeholder="[% l('Initials') %]" required/>
+          <input type="text" class="form-control" ng-hide="!require_initials" 
+            ng-model="args.initials" placeholder="[% l('Initials') %]" ng-required="require_initials"/>
         </div>
         <div class="col-md-10 pull-right">
           <input type="submit" class="btn btn-primary" value="[% l('OK') %]"/>
index cd60333..40552ab 100644 (file)
@@ -12,8 +12,17 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
     var service = {
         // auto-override these events after the first override
         auto_override_checkout_events : {},
+        require_initials : false
     };
 
+    egCore.startup.go().finally(function() {
+        egCore.org.settings([
+            'ui.staff.require_initials.patron_standing_penalty'
+        ]).then(function(set) {
+            service.require_initials = Boolean(set['ui.staff.require_initials.patron_standing_penalty']);
+        });
+    });
+
     service.reset = function() {
         service.auto_override_checkout_events = {};
     }
@@ -1444,6 +1453,7 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
             function($scope , $modalInstance , staffPenalties) {
                 $scope.focusNote = true;
                 $scope.penalties = staffPenalties;
+                $scope.require_initials = service.require_initials;
                 $scope.args = {penalty : 21}; // default to Note
                 $scope.setPenalty = function(id) {
                     args.penalty = id;
@@ -1460,7 +1470,8 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
                 var pen = new egCore.idl.ausp();
                 pen.usr(user_id);
                 pen.org_unit(egCore.auth.user().ws_ou());
-                pen.note(args.note + ' [' + args.initials + ']');
+                pen.note(args.note);
+                if (args.initials) pen.note(args.note + ' [' + args.initials + ']');
                 if (args.custom_penalty) {
                     pen.standing_penalty(args.custom_penalty);
                 } else {
@@ -1482,6 +1493,7 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
             function($scope , $modalInstance , staffPenalties) {
                 $scope.focusNote = true;
                 $scope.penalties = staffPenalties;
+                $scope.require_initials = service.require_initials;
                 $scope.args = {
                     penalty : usr_penalty.standing_penalty().id(),
                     note : usr_penalty.note()
@@ -1497,6 +1509,7 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
         }).result.then(
             function(args) {
                 usr_penalty.note(args.note);
+                if (args.initials) usr_penalty.note(args.note + ' [' + args.initials + ']');
                 usr_penalty.standing_penalty(args.penalty);
                 return egCore.pcrud.update(usr_penalty);
             }