attempt to sort libraries by system in tpac results
authorChris Sharp <csharp@georgialibraries.org>
Tue, 5 Mar 2013 15:08:19 +0000 (10:08 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Mon, 30 Sep 2013 15:57:43 +0000 (11:57 -0400)
Includes tsbere's reccomendations to change Record.pm because
it overrides th sorting in AppUtils.pm

Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Conflicts:

Open-ILS/src/templates/opac/parts/record/copy_table.tt2

Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
Open-ILS/src/templates/opac/parts/record/copy_table.tt2

index 976940f..8672d84 100644 (file)
@@ -234,7 +234,7 @@ sub mk_copy_query {
         $rec_id, undef, undef, $copy_limit, $copy_offset, $self->ctx->{is_staff}
     );
 
-    if($org != $self->ctx->{aou_tree}->()->id) { 
+        if($org != $self->ctx->{aou_tree}->()->id) {
         # no need to add the org join filter if we're not actually filtering
         $query->{from}->{acp}->{aou} = {
             fkey => 'circ_lib',
@@ -243,26 +243,37 @@ sub mk_copy_query {
                 id => {
                     in => {
                         select => {aou => [{
-                            column => 'id', 
+                            column => 'id',
                             transform => 'actor.org_unit_descendants',
-                            result_field => 'id', 
+                            result_field => 'id',
                             params => [$depth]
                         }]},
                         from => 'aou',
                         where => {id => $org}
-                    }
+                    }          
                 }
-            }
-        };
-    };
-
+            },
+                       join => { 'parent' => { 'class' => 'aou', 'fkey' => 'parent_ou'} }
+        }
+    }
+       else { 
+               $query->{from}->{acp}->{aou} = { join => { 'parent' => { 'class' => 'aou', 'fkey' => 'parent_ou'} } }; 
+       };
+
+       unshift(@{$query->{order_by}}, 
+               { 
+               class => 'parent', field => 'name' 
+               } 
+       ); 
+        
     # Unsure if we want these in the shared function, leaving here for now
     unshift(@{$query->{order_by}},
         { class => "aou", field => 'id',
           transform => 'evergreen.rank_ou', params => [$org, $pref_ou]
         }
     );
-    push(@{$query->{order_by}},
+
+     push(@{$query->{order_by}},
         { class => "acp", field => 'status',
           transform => 'evergreen.rank_cp_status'
         }
index e9f962e..1daf8c6 100644 (file)
@@ -95,11 +95,13 @@ END; # FOREACH bib
             </td>
             [%- ELSE %]<td header='copy_header_library' property="seller">
             [%-
-                org_name = ctx.get_aou(copy_info.circ_lib).name;
-                lib_url = ctx.get_org_setting(copy_info.circ_lib, 'lib.info_url');
-                IF lib_url; '<a href="'; lib_url | url; '">'; END;
-                org_name | html;
-                IF lib_url; '</a>'; END;
+              org_obj = ctx.get_aou(copy_info.circ_lib); 
+               IF org_obj.parent_ou;   
+                       parent_org_name = ctx.get_aou(org_obj.parent_ou).name;
+                       org_name = parent_org_name _ ' - ' _ org_obj.name; 
+               ELSE; 
+                org_name = org_obj.name; END;
+                org_name | html
             -%]
                 <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut">
                 <link property="itemOffered" href="#schemarecord">