LP1207396 TPAC org_selector supports org filter
authorBill Erickson <berick@esilibrary.com>
Tue, 6 Aug 2013 13:31:11 +0000 (09:31 -0400)
committerDan Wells <dbw2@calvin.edu>
Fri, 23 Aug 2013 23:16:28 +0000 (19:16 -0400)
When building and org unit selector via the build_org_selector MARCO,
the caller can now pass in a "valid_org_list" array which contains org
unit IDs.  When such a list is provided, any org units in the selector
which are not in the list are marke as disabled.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/templates/opac/parts/org_selector.tt2

index 262fe40..4625023 100644 (file)
@@ -2,7 +2,7 @@
 # Org Unit Selector Widget :
 #   INCLUDE build_org_selector id='selector-id' name='selector-name' 
 #       value=org_id show_loc_groups=1/0 can_have_vols_only=1/0
-#       can_have_users_only=1/0
+#       can_have_users_only=1/0 valid_org_list=[1,2,3]
 #
 # NOTE: DO NOT USE PROCESS
 # Use of PROCESS results in internal variables, such as value or org_unit, to "leak" out
@@ -97,6 +97,14 @@ BLOCK build_org_selector;
                 selected = 'selected="selected"';
             END; 
 
+            # caller provided a list of valid org units.
+            # all orgs not in the list are marked invalid.
+            IF valid_org_list AND 
+                    !valid_org_list.grep('^' _ org_unit.id _ '$').size;
+                disabled = 'disabled="disabled"';
+                selected = '';
+            END;
+
             pad_depth = 0;
 
             # copy loc groups appear as children of the owning org unit