From: Jeff Davis Date: Fri, 8 Jun 2018 19:09:54 +0000 (-0700) Subject: LP#1788680 prevent copy template apply failure on null stat cats X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7001f6bb6aa18c11806f9e0d7d48910b7e49f69f;p=working%2FEvergreen.git LP#1788680 prevent copy template apply failure on null stat cats Under some circumstances, the current code can result in a JS failure: Cannot read property 'filter' of undefined When this happens, the copy template may apply partially or not at all. This change simply makes sure cp.stat_cat_entries() exists before attempting to filter it. Signed-off-by: Jeff Davis Signed-off-by: Dan Wells --- diff --git a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js index 982cefe2cc..2d23a5dafb 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js @@ -1289,11 +1289,13 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , // trim out all deleted ones; the API used to // do the update doesn't actually consult // isdeleted for stat cat entries - cp.stat_cat_entries( - cp.stat_cat_entries().filter(function (e) { - return !Boolean(e.isdeleted()); - }) - ); + if (cp.stat_cat_entries()) { + cp.stat_cat_entries( + cp.stat_cat_entries().filter(function (e) { + return !Boolean(e.isdeleted()); + }) + ); + } cp.ischanged(1); }