[open-ils-commits] r8500 - branches/rel_1_2_1/Open-ILS/xul/staff_client/server/cat

svn at svn.open-ils.org svn at svn.open-ils.org
Sat Jan 26 02:09:23 EST 2008


Author: phasefx
Date: 2008-01-26 01:42:30 -0500 (Sat, 26 Jan 2008)
New Revision: 8500

Modified:
   branches/rel_1_2_1/Open-ILS/xul/staff_client/server/cat/copy_editor.js
Log:
dedup shelving locations in item attr editor

Modified: branches/rel_1_2_1/Open-ILS/xul/staff_client/server/cat/copy_editor.js
===================================================================
--- branches/rel_1_2_1/Open-ILS/xul/staff_client/server/cat/copy_editor.js	2008-01-25 17:50:59 UTC (rev 8499)
+++ branches/rel_1_2_1/Open-ILS/xul/staff_client/server/cat/copy_editor.js	2008-01-26 06:42:30 UTC (rev 8500)
@@ -609,7 +609,24 @@
                 }
             }
         }
-
+        /* Quick Bug fix for duplicate shelving locations.. this whole section has been rewritten in higher branches */
+        var temp_acpl_list_dedup =  {};
+        for (var i = 0; i < temp_acpl_list.length; i++) {
+            temp_acpl_list_dedup[ temp_acpl_list[i].id() ] = temp_acpl_list[i];
+        }
+        temp_acpl_list = [];
+        for (var i in temp_acpl_list_dedup) {
+            temp_acpl_list.push( temp_acpl_list_dedup[i] );
+        }
+        temp_acpl_list = temp_acpl_list.sort(
+            function(a,b) {
+                if (a.owning_lib() < b.owning_lib()) return -1;
+                if (a.owning_lib() > b.owning_lib()) return 1;
+                if (a.name() < b.name()) return -1;
+                if (a.name() > b.name()) return 1;
+                return 0;
+            }
+        );
         return temp_acpl_list;
 	
 	} catch(E) {
@@ -742,7 +759,7 @@
 		"Shelving Location",
 		{ 
 			render: 'typeof fm.location() == "object" ? fm.location().name() : g.data.lookup("acpl",fm.location()).name()', 
-			input: 'c = function(v){ g.apply("location",v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( util.functional.map_list( g.get_acpl_list(), function(obj) { return [ g.data.hash.aou[ obj.owning_lib() ].shortname() + " : " + obj.name(), obj.id() ]; }).sort()); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
+			input: 'c = function(v){ g.apply("location",v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( util.functional.map_list( g.get_acpl_list(), function(obj) { return [ g.data.hash.aou[ obj.owning_lib() ].shortname() + " : " + obj.name(), obj.id() ]; })); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
 
 		}
 	],



More information about the open-ils-commits mailing list