Patron reg button hide sanity checks user/berick/patron-create-load-js-errors
authorBill Erickson <berickxx@gmail.com>
Wed, 16 Jan 2019 18:57:10 +0000 (13:57 -0500)
committerBill Erickson <berickxx@gmail.com>
Wed, 16 Jan 2019 18:57:13 +0000 (13:57 -0500)
Avoid referencing $scope.patron until the object exists when loading the
patron create interface in the staff client.  This avoids unnecessary
(and potentially misleading) JS errors on page load.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js

index 4e2e9a2..95345d7 100644 (file)
@@ -2023,9 +2023,11 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore ,
 
     // Returns true if the Save and Save & Clone buttons should be disabled.
     $scope.edit_passthru.hide_save_actions = function() {
-        return $scope.patron.isnew ?
+        return !$scope.patron || (
+            $scope.patron.isnew ?
             !$scope.perms.CREATE_USER : 
-            !$scope.perms.UPDATE_USER;
+            !$scope.perms.UPDATE_USER
+        );
     }
 
     // Returns true if any input elements are tagged as invalid