From: Cesar Velez Date: Thu, 21 Sep 2017 19:58:49 +0000 (-0400) Subject: LP#1717025 - make Specific Due Dates Until Logout in Patron Checkout X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5e479ec7f42f570ba7db2f7668d6c3ac82b8975c;p=evergreen%2Fequinox.git LP#1717025 - make Specific Due Dates Until Logout in Patron Checkout Made a few (opinionated) changes, that try to follow some JS best practices. Changed Bool flags like date_options.sticky_date to has_sticky_date, which avoids confusion with the checkoutArgs property of the same name, and provides a clue about it's type and function. Also added semicolons to any JS statements and function expressions that were missing them. Signed-off by: Cesar Velez Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 index a2db38ea44..773d91104d 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 @@ -48,20 +48,20 @@
  • - + - [% l('Specific Due Date') %]
  • - + - [% l('Use Specific Due Date Until Logout') %] diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js index 7c42a27413..52f794416c 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js @@ -47,11 +47,11 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc , $scope.date_options = { due_date : egCore.hatch.getSessionItem('eg.circ.checkout.due_date'), - sticky_date : egCore.hatch.getSessionItem('eg.circ.checkout.until_logout'), - until_logout : egCore.hatch.getSessionItem('eg.circ.checkout.until_logout') - } + has_sticky_date : egCore.hatch.getSessionItem('eg.circ.checkout.is_until_logout'), + is_until_logout : egCore.hatch.getSessionItem('eg.circ.checkout.is_until_logout') + }; - if ($scope.date_options.until_logout) { // If until_logout is set there should also be a date set. + if ($scope.date_options.is_until_logout) { // If until_logout is set there should also be a date set. $scope.checkoutArgs.due_date = new Date($scope.date_options.due_date); $scope.checkoutArgs.sticky_date = true; } @@ -62,32 +62,32 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc , } else { $scope.date_options[opt] = true; } - } + }; // The interactions between these options are complicated enough that $watch'ing them all is the only safe way to keep things sane. - $scope.$watch('date_options.sticky_date', function(newval) { + $scope.$watch('date_options.has_sticky_date', function(newval) { if ( newval ) { // was false, is true // $scope.date_options.due_date = checkoutArgs.due_date; } else { - $scope.date_options.until_logout = false; + $scope.date_options.is_until_logout = false; } $scope.checkoutArgs.sticky_date = newval; }); - $scope.$watch('date_options.until_logout', function(newval) { + $scope.$watch('date_options.is_until_logout', function(newval) { if ( newval ) { // was false, is true - $scope.date_options.sticky_date = true; + $scope.date_options.has_sticky_date = true; $scope.date_options.due_date = $scope.checkoutArgs.due_date; - egCore.hatch.setSessionItem('eg.circ.checkout.until_logout', true); + egCore.hatch.setSessionItem('eg.circ.checkout.is_until_logout', true); egCore.hatch.setSessionItem('eg.circ.checkout.due_date', $scope.checkoutArgs.due_date); } else { - egCore.hatch.removeSessionItem('eg.circ.checkout.until_logout'); + egCore.hatch.removeSessionItem('eg.circ.checkout.is_until_logout'); egCore.hatch.removeSessionItem('eg.circ.checkout.due_date'); } }); $scope.$watch('checkoutArgs.due_date', function(newval) { - if ( $scope.date_options.until_logout ) { + if ( $scope.date_options.is_until_logout ) { egCore.hatch.setSessionItem('eg.circ.checkout.due_date', newval); } });