webstaff: implement Edit MARC Order Record
authorGalen Charlton <gmc@equinoxinitiative.org>
Thu, 9 Feb 2017 15:48:20 +0000 (10:48 -0500)
committerKathy Lussier <klussier@masslnc.org>
Sat, 18 Feb 2017 18:31:32 +0000 (13:31 -0500)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/templates/staff/acq/index.tt2
Open-ILS/src/templates/staff/acq/t_edit_marc_order_record.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/acq/common/li_table.js
Open-ILS/web/js/ui/default/staff/acq/app.js

index b3a17d1..060c4b3 100644 (file)
 <!--<script src="[% ctx.media_prefix %]/js/ui/default/staff/reporter/services/template.js"></script>-->
 <!--[% INCLUDE 'staff/reporter/share/report_strings.tt2' %]-->
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/acq/app.js"></script>
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/marcrecord.js"></script>
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/services/record.js"></script>
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/services/tagtable.js"></script>
+[% INCLUDE 'staff/cat/share/marcedit_strings.tt2' %]
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/services/marcedit.js"></script>
 <link rel="stylesheet" href="[% ctx.base_path %]/staff/css/acq.css" />
 [% END %]
 
diff --git a/Open-ILS/src/templates/staff/acq/t_edit_marc_order_record.tt2 b/Open-ILS/src/templates/staff/acq/t_edit_marc_order_record.tt2
new file mode 100644 (file)
index 0000000..1deeb5b
--- /dev/null
@@ -0,0 +1,16 @@
+<div>
+  <div class="modal-header">
+    <button type="button" class="close"
+      ng-click="cancel()" aria-hidden="true">&times;</button>
+    <h4 class="modal-title">[% l('Edit MARC Order Record') %]</h4>
+  </div>
+  <div class="modal-body">
+    <eg-marc-edit-record dirty-flag="dirty_flag" marc-xml="args.marc_xml"
+                         in-place-mode="true" record-type="bre" save-label="[% l('Modify') %]" />
+  </div>
+  <div class="modal-footer">
+    <input type="submit" ng-click="ok(args)"
+        class="btn btn-primary" value="[% l('Use Edits') %]"/>
+    <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
+  </div>
+</div>
index 8957853..44e7b97 100644 (file)
@@ -3506,15 +3506,19 @@ function AcqLiTable() {
 
     this.editOrderMarc = function(li) {
 
+        var self = this;
+        if(window.IAMBROWSER) {
+            xulG.edit_marc_order_record(li, function(li) { self.drawInfo(li.id()) });
+            return;
+        }
+
         /*  To run in Firefox directly, must set signed.applets.codebase_principal_support
             to true in about:config */
-
         if(openils.XUL.isXUL()) {
             win = window.open('/xul/' + openils.XUL.buildId() + '/server/cat/marcedit.xul','','chrome');
         } else {
             win = window.open('/xul/server/cat/marcedit.xul','','chrome'); 
         }
-        var self = this;
         win.xulG = {
             record : {marc : li.marc(), "rtype": "bre"},
             save : {
index 6f302e8..c9ce2f0 100644 (file)
@@ -1,5 +1,5 @@
 angular.module('egAcquisitions',
-    ['ngRoute', 'ui.bootstrap', 'egCoreMod','egUiMod'])
+    ['ngRoute', 'ui.bootstrap', 'egCoreMod','egUiMod','egMarcMod'])
 
 .config(['$routeProvider','$locationProvider','$compileProvider', 
  function($routeProvider , $locationProvider , $compileProvider) {
@@ -31,8 +31,8 @@ angular.module('egAcquisitions',
 }])
 
 .controller('EmbedAcqCtl', 
-       ['$scope','$routeParams','$location','$window','$timeout','egCore',
-function($scope , $routeParams , $location , $window , $timeout , egCore) {
+       ['$scope','$routeParams','$location','$window','$timeout','egCore','$uibModal',
+function($scope , $routeParams , $location , $window , $timeout , egCore , $uibModal) {
 
     var relay_url = function(url) {
         if (url.match(/\/eg\/acq/)) {
@@ -67,10 +67,39 @@ function($scope , $routeParams , $location , $window , $timeout , egCore) {
         });
     }
 
+    var edit_marc_order_record = function(li, callback) {
+        var args = {
+            'marc_xml' : li.marc()
+        };
+        $uibModal.open({
+            templateUrl: './acq/t_edit_marc_order_record',
+            size: 'lg',
+            controller:
+                ['$scope', '$uibModalInstance', function($scope, $uibModalInstance) {
+                $scope.focusMe = true;
+                $scope.args = args;
+                $scope.dirty_flag = false;
+                $scope.ok = function(args) { $uibModalInstance.close(args) }
+                $scope.cancel = function () { $uibModalInstance.dismiss() }
+            }]
+        }).result.then(function (args) {
+            li.marc(args.marc_xml);
+            egCore.net.request(
+                'open-ils.acq',
+                'open-ils.acq.lineitem.update',
+                egCore.auth.token(),
+                li
+            ).then(function() {
+                callback(li);
+            });
+        });
+    }
+
     $scope.funcs = {
         ses : egCore.auth.token(),
         relay_url : relay_url,
-        volume_item_creator : volume_item_creator
+        volume_item_creator : volume_item_creator,
+        edit_marc_order_record : edit_marc_order_record
     }
 
     var acq_path = '/eg/acq/' +