TPAC my-list call number includes child orgs
authorBill Erickson <berick@esilibrary.com>
Wed, 6 Mar 2013 21:02:37 +0000 (16:02 -0500)
committerBen Shum <bshum@biblio.org>
Mon, 11 Mar 2013 21:42:54 +0000 (17:42 -0400)
For my-list call number display, if the most relevant call number is a
child of any of the context org units (physical/pref/search), it is
considered relevant for purposes of call number display.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/templates/opac/myopac/lists.tt2
Open-ILS/src/templates/opac/parts/anon_list.tt2

index b43ad42..0b2977d 100644 (file)
                             copy = attrs.holdings.0;
                             IF copy;
                                 # only show a relevant call number
-                                org = ctx.get_aou_by_shortname(copy.owner);
-                                IF  org.id == ctx.search_ou OR 
-                                    org.id == ctx.pref_ou OR
-                                    org.id == ctx.user.home_ou OR
-                                    org.id == ctx.physical_loc;
-                                        l('[_1] ([_2])', copy.label, org.name) | html;
+                                copy_org = ctx.get_aou_by_shortname(copy.owner);
+                                FOR ctx_org IN [ctx.pref_ou, ctx.search_ou, ctx.home_ou, ctx.physical_loc];
+                                    NEXT UNLESS ctx_org;
+                                    ctx_org = ctx.get_aou(ctx_org);
+                                    IF ctx.org_within_scope(ctx_org, copy_org, ctx_org.ou_type.depth);
+                                        l('[_1] ([_2])', copy.label, copy_org.name) | html;
+                                        LAST;
+                                    END;
                                 END;
                             END;
                         %]
index cd39bbc..252f4ae 100644 (file)
                         [% 
                             copy = attrs.holdings.0;
                             IF copy;
-                                # only show a relevant call number
-                                org = ctx.get_aou_by_shortname(copy.owner);
-                                IF  org.id == ctx.search_ou OR 
-                                    org.id == ctx.pref_ou OR
-                                    org.id == ctx.user.home_ou OR
-                                    org.id == ctx.physical_loc;
-                                        l('[_1] ([_2])', copy.label, org.name) | html;
+                                copy_org = ctx.get_aou_by_shortname(copy.owner);
+                                FOR ctx_org IN [ctx.pref_ou, ctx.search_ou, ctx.home_ou, ctx.physical_loc];
+                                    NEXT UNLESS ctx_org;
+                                    ctx_org = ctx.get_aou(ctx_org);
+                                    IF ctx.org_within_scope(ctx_org, copy_org, ctx_org.ou_type.depth);
+                                        l('[_1] ([_2])', copy.label, copy_org.name) | html;
+                                        LAST;
+                                    END;
                                 END;
                             END;
                         %]