From 357aabae410bbe25160947acd52693841d690e92 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 12 May 2016 15:58:49 -0400 Subject: [PATCH] LP#1581196: webstaff: fix dirty form detection in patron editor This patch fixes a problem wherein the patron editor form would think that it had been modified by the user immediately after initialization. To test ------- [1] Load the patron editor, then refresh the page. Note that you are warned that there is unsaved input. [2] As above, but hit the save button. Note that after saving, you still get a warning that there is unsaved input. [3] Apply the page, then repeat tests 1 and 2. This time, you shouldn't get inappropriate unsaved data warnings. Signed-off-by: Galen Charlton Signed-off-by: Bill Erickson --- Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 | 2 -- Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 index c7427a056e..d6345b0578 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 @@ -262,7 +262,6 @@ within the "form" by name for validation.
@@ -435,7 +434,6 @@ within the "form" by name for validation. [% draw_field_label('au', 'expire_date') %]
diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js index b0b3486669..0e6629ec03 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js @@ -1608,6 +1608,12 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore , egUnloadPrompt.attach($scope); } + // also monitor when form is changed *by the user*, as using + // an ng-change handler doesn't work with eg-date-input + $scope.$watch('reg_form.$pristine', function(newVal, oldVal) { + if (!newVal) egUnloadPrompt.attach($scope); + }); + // username regex (if present) must be removed any time // the username matches the barcode to avoid firing the // invalid field handlers. -- 2.43.2