From 92daa8b59738a70e4ec13280b1693e5b3fdba5df Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Mon, 1 Aug 2011 02:10:15 -0400 Subject: [PATCH] Fix overzealous template application The idea was that we'd track templates if they were applied prior to copies actually being specified in the unified interface, and then apply them "for real" once copies were entered. But these remembered templates kept applying themselves whenever changes were made in the volume/copy creator portion of the interface (possibly overriding tweaks made by staff). So now we delete the list of tracked templates once they're applied to actual copies. Signed-off-by: Jason Etheridge Signed-off-by: Mike Rylander --- Open-ILS/xul/staff_client/server/cat/copy_editor.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Open-ILS/xul/staff_client/server/cat/copy_editor.js b/Open-ILS/xul/staff_client/server/cat/copy_editor.js index 749c6891d5..25ee3eff47 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_editor.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_editor.js @@ -188,6 +188,11 @@ function my_init() { for (var i = 0; i < g.applied_templates.length; i++) { g._apply_template( g.applied_templates[i], false); } + if (g.copies.length > 0) { + // Stop tracking these templates once they're applied + // to actual copies + g.applied_templates = []; + } g.summarize( g.copies ); g.render(); g.check_for_unmet_required_fields(); @@ -285,7 +290,12 @@ g.apply_template = function(apply_volume_editor_template_changes) { try { var name = g.template_menu.value; if (g.templates[ name ] != 'undefined') { - g.applied_templates.push( name ); + if (g.copies == 0) { + // We're only tracking these applied templates temporarily, + // specifically when they're used prior to copies being + // created in the unified interface. + g.applied_templates.push( name ); + } g._apply_template(name,apply_volume_editor_template_changes); g.summarize( g.copies ); g.render(); -- 2.11.0