[open-ils-commits] r13252 - trunk/Open-ILS/web/js/ui/default/conify/global/config (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed May 27 17:05:48 EDT 2009
Author: erickson
Date: 2009-05-27 17:05:44 -0400 (Wed, 27 May 2009)
New Revision: 13252
Modified:
trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js
Log:
plugged in rest of group mods creation/deletion. just need whole group deletion now
Modified: trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js 2009-05-27 20:16:35 UTC (rev 13251)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js 2009-05-27 21:05:44 UTC (rev 13252)
@@ -50,6 +50,8 @@
if(group) {
entries = new openils.PermaCrud().search('ccmcmtm', {circ_mod_test : group.id()});
table.setAttribute('group', group.id());
+ circModGroupCache[group.id()] = group;
+ circModEntryCache[group.id()] = entries;
}
function addMod(code, name) {
@@ -113,6 +115,26 @@
} else {
+
+ var existing = circModEntryCache[group.id()];
+ dojo.forEach(mods, function(mod) {
+
+ // new circ mod for this group
+ if(!existing.filter(function(i){ return (i.circ_mod() == mod)})[0]) {
+ var entry = new fieldmapper.ccmcmtm();
+ entry.isnew(true);
+ entry.circ_mod(mod);
+ entries.push(entry);
+ entry.circ_mod_test(group.id());
+ }
+ });
+
+ dojo.forEach(existing, function(eMod) {
+ if(!mods.filter(function(i){ return (i == eMod.circ_mod()) })[0]) {
+ eMod.isdeleted(true);
+ entries.push(eMod);
+ }
+ });
}
group.items_out(count);
@@ -134,8 +156,39 @@
} else {
+ pcrud.update(group, {
+ oncomplete : function(r) {
+ openils.Util.readResponse(r);
+ var newOnes = entries.filter(function(e) { return e.isnew() });
+ var delOnes = entries.filter(function(e) { return e.isdeleted() });
+ if(!delOnes.length && !newOnes.length) {
+ progressDialog.hide();
+ return;
+ }
+ if(newOnes.length) {
+ pcrud.create(newOnes, {
+ oncomplete : function() {
+ if(delOnes.length) {
+ pcrud.delete(delOnes, {
+ oncomplete : function() {
+ progressDialog.hide();
+ }
+ });
+ } else {
+ progressDialog.hide();
+ }
+ }
+ });
+ } else {
+ pcrud.delete(delOnes, {
+ oncomplete : function() {
+ progressDialog.hide();
+ }
+ });
+ }
+ }
+ });
}
-
}
}
More information about the open-ils-commits
mailing list