From: Galen Charlton Date: Tue, 9 May 2017 20:34:48 +0000 (-0400) Subject: webstaff: implement saving pattern as a template X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b3d2fdd0ad5e0210ee9aae42b552ddf2572be2a3;p=working%2FEvergreen.git webstaff: implement saving pattern as a template Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 b/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 index 976dd0a3ad..4d369cc1ab 100644 --- a/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 +++ b/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 @@ -442,9 +442,11 @@
-
- - +
+ + + +
diff --git a/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js b/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js index 5cefee2d65..1ec9c0519b 100644 --- a/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js +++ b/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js @@ -501,10 +501,30 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider) { } else { $scope.pattern = new PredictionPattern(); } + + // possible sharing + $scope.share = { + pattern_name : null, + depth : 0 + }; + $scope.handle_save = function() { $scope.patternCode = JSON.stringify($scope.pattern.compile()); - if (angular.isFunction($scope.onSave)) { - $scope.onSave($scope.patternCode); + if ($scope.share.pattern_name !== null) { + var spt = new egCore.idl.spt(); + spt.name($scope.share.pattern_name); + spt.pattern_code($scope.patternCode); + spt.share_depth($scope.share.depth); + spt.owning_lib(egCore.auth.user().ws_ou()); + egCore.pcrud.create(spt).then(function() { + if (angular.isFunction($scope.onSave)) { + $scope.onSave($scope.patternCode); + } + }); + } else { + if (angular.isFunction($scope.onSave)) { + $scope.onSave($scope.patternCode); + } } }