From a7219ed9b0ad6504dfd598a3121f9327efa4eeb0 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 19 Apr 2017 15:59:30 -0400 Subject: [PATCH] webstaff: dist/streams grid now handles partial subs If a subscription has no distributions, or if a distribution has no streams, a partially-filled-in row is now displayed in the grid. Signed-off-by: Galen Charlton --- Open-ILS/web/js/ui/default/staff/serials/services/core.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Open-ILS/web/js/ui/default/staff/serials/services/core.js b/Open-ILS/web/js/ui/default/staff/serials/services/core.js index f2ac3ad43c..f53c8e3181 100644 --- a/Open-ILS/web/js/ui/default/staff/serials/services/core.js +++ b/Open-ILS/web/js/ui/default/staff/serials/services/core.js @@ -42,6 +42,7 @@ function(egCore , orderByFilter) { var list = []; angular.forEach(service.subTree, function(ssub) { var ssubHash = egCore.idl.toHash(ssub); + var _ssub = { 'id' : ssubHash.id, 'owning_lib.name' : ssubHash.owning_lib.name, @@ -49,6 +50,12 @@ function(egCore , orderByFilter) { 'end_date' : ssubHash.end_date, 'expected_date_offset' : ssubHash.expected_date_offset }; + // insert and escape if we have no distributions + if (ssubHash.distributions.length == 0) { + list.push(_ssub); + return; + } + angular.forEach(ssubHash.distributions, function(sdist) { var _sdist = {}; angular.forEach([ @@ -70,6 +77,14 @@ function(egCore , orderByFilter) { sdist.bind_call_number ? sdist.bind_call_number.label : null; _sdist['sdist.bind_unit_template.name'] = sdist.bind_unit_template ? sdist.bind_unit_template.name : null; + // if we have no streams, add to the list and escape + if (sdist.streams.length == 0) { + var row = {}; + angular.extend(row, _ssub, _sdist); + list.push(row); + return; + } + angular.forEach(sdist.streams, function(sstr) { var _sstr = { 'sstr.id' : sstr.id, -- 2.11.0