webstaff: go ahead and start new sub with one distribution
authorGalen Charlton <gmc@equinoxinitiative.org>
Fri, 2 Jun 2017 20:26:42 +0000 (16:26 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 2 Jun 2017 20:26:42 +0000 (16:26 -0400)
Similarly, ensure that each new distribution has a stream

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/web/js/ui/default/staff/serials/directives/subscription_manager.js

index 22fc1ba..c1a6772 100644 (file)
@@ -58,6 +58,7 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider ,
         new_ssub._isnew = true;
         new_ssub.record_entry = $scope.bibId;
         $scope.subscriptions.push(new_ssub);
+        $scope.add_distribution(new_ssub); // since we know we want at least one distribution
     }
     $scope.add_distribution = function(ssub) {
         var new_sdist = egCore.idl.toTypedHash(new egCore.idl.sdist());
@@ -67,6 +68,7 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider ,
             ssub.distributions = [];
         }
         ssub.distributions.push(new_sdist);
+        $scope.add_stream(new_sdist); // since we know we want at least one stream
     }
     $scope.add_stream = function(sdist) {
         var new_sstr = egCore.idl.toTypedHash(new egCore.idl.sstr());