From 64b85f4e9f3d1d406313cc76b4270f73929762b8 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 8 Mar 2017 12:47:55 -0500 Subject: [PATCH] LP1373690 egPcrud auto(), promises, authoritative repair 1. Fix the broken egPcrud.apply() function, which was named 'auto' internally, by syncronizing on egPcrud.auto(). I chose .auto() over apply, since Prototype.apply() is already a JS function -- best not clobber it. 2. Propagate failed request promise rejections for CUD/auto calls all the way back to the caller, so rejected promises can be properly handled in the UI. 3. Finish implementing the paritally implemented 'authoritative' egPcrud request option, which forces retrieve/search queries to run inside a transaction. Signed-off-by: Bill Erickson --- .../templates/staff/admin/acq/t_edi_attr_set.tt2 | 49 ++++++++++++++++++++++ Open-ILS/web/js/ui/default/staff/services/pcrud.js | 14 ++++--- 2 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 Open-ILS/src/templates/staff/admin/acq/t_edi_attr_set.tt2 diff --git a/Open-ILS/src/templates/staff/admin/acq/t_edi_attr_set.tt2 b/Open-ILS/src/templates/staff/admin/acq/t_edi_attr_set.tt2 new file mode 100644 index 0000000000..8e533ad8b6 --- /dev/null +++ b/Open-ILS/src/templates/staff/admin/acq/t_edi_attr_set.tt2 @@ -0,0 +1,49 @@ +
+
+ [% l('EDI Attribute Sets') %] +
+
+ +
+
+
+
+ + +
+ + +
+
+
+ +
+
+ +
+
+
+ + + + {{attr.key()}} +
+
{{attr.label()}}
+
+
+ + diff --git a/Open-ILS/web/js/ui/default/staff/services/pcrud.js b/Open-ILS/web/js/ui/default/staff/services/pcrud.js index 1f78b17ce2..4fa405a949 100644 --- a/Open-ILS/web/js/ui/default/staff/services/pcrud.js +++ b/Open-ILS/web/js/ui/default/staff/services/pcrud.js @@ -46,7 +46,7 @@ angular.module('egCoreMod') // create service-level pass through functions // for one-off PCRUDContext actions. angular.forEach(['connect', 'retrieve', 'retrieveAll', - 'search', 'create', 'update', 'remove', 'apply'], + 'search', 'create', 'update', 'remove', 'auto'], function(action) { service[action] = function() { var ctx = new PCRUDContext(); @@ -91,7 +91,9 @@ angular.module('egCoreMod') this.session.disconnect(); }; - this.retrieve = function(fm_class, pkey, pcrud_ops) { + this.retrieve = function(fm_class, pkey, pcrud_ops, req_ops) { + req_ops = req_ops || {}; + this.authoritative = req_ops.authoritative; return this._dispatch( 'open-ils.pcrud.retrieve.' + fm_class, [egAuth.token(), pkey, pcrud_ops] @@ -106,6 +108,7 @@ angular.module('egCoreMod') this.search = function (fm_class, search, pcrud_ops, req_ops) { req_ops = req_ops || {}; + this.authoritative = req_ops.authoritative; var return_type = req_ops.idlist ? 'id_list' : 'search'; var method = 'open-ils.pcrud.' + return_type + '.' + fm_class; @@ -119,7 +122,7 @@ angular.module('egCoreMod') this.create = function(list) {return this.CUD('create', list)}; this.update = function(list) {return this.CUD('update', list)}; this.remove = function(list) {return this.CUD('delete', list)}; - this.apply = function(list) {return this.CUD('apply', list)}; + this.auto = function(list) {return this.CUD('auto', list)}; this.xactClose = function() { return this._send_request( @@ -179,7 +182,7 @@ angular.module('egCoreMod') }, // main body error handler - function() {}, + function() {deferred.reject()}, // main body notify() handler function(data) {deferred.notify(data)} @@ -287,7 +290,8 @@ angular.module('egCoreMod') self.cud_last = data; self.cud_deferred.notify(data); self._CUD_next_request(); - } + }, + self.cud_deferred.reject ); }; -- 2.11.0