add prefix/suffix to label for summary display
authorMike Rylander <mrylander@gmail.com>
Tue, 1 Mar 2011 21:02:43 +0000 (16:02 -0500)
committerMike Rylander <mrylander@gmail.com>
Tue, 1 Mar 2011 21:02:43 +0000 (16:02 -0500)
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/biblio.pm

index 5b609be..689ae92 100644 (file)
@@ -380,19 +380,28 @@ sub record_copy_status_count {
        my $descendants = "actor.org_unit_descendants(?,?)";
 
        my $cn_table = asset::call_number->table;
+       my $cnp_table = asset::call_number_prefix->table;
+       my $cns_table = asset::call_number_prefix->table;
        my $cp_table = asset::copy->table;
        my $cl_table = asset::copy_location->table;
        my $cs_table = config::copy_status->table;
 
        my $sql = <<"   SQL";
 
-               SELECT  cp.circ_lib, cn.label, cp.status, count(cp.id)
+               SELECT  cp.circ_lib,
+                               cnp.label || CASE WHEN cnp.label <> '' THEN ' ' ELSE '' END || cn.label || CASE WHEN cns.label <> '' THEN ' ' ELSE '' END || cns.label,
+                               cp.status,
+                               count(cp.id)
                  FROM  $cp_table cp,
                        $cn_table cn,
+                       $cns_table cns,
+                       $cnp_table cnp,
                        $cl_table cl,
                        $cs_table cs,
                        $descendants d
                  WHERE cn.record = ?
+                       AND cnp.id = cn.prefix
+                       AND cns.id = cn.suffix
                        AND cp.call_number = cn.id
                        AND cp.location = cl.id
                        AND cp.circ_lib = d.id
@@ -440,6 +449,8 @@ sub record_copy_status_location_count {
        my $descendants = "actor.org_unit_descendants(?,?)";
 
        my $cn_table = asset::call_number->table;
+       my $cnp_table = asset::call_number_prefix->table;
+       my $cns_table = asset::call_number_prefix->table;
        my $cp_table = asset::copy->table;
        my $cl_table = asset::copy_location->table;
        my $cs_table = config::copy_status->table;
@@ -450,16 +461,20 @@ sub record_copy_status_location_count {
        my $sql = <<"   SQL";
 
                SELECT  cp.circ_lib,
-                               cn.label, 
+                               cnp.label || CASE WHEN cnp.label <> '' THEN ' ' ELSE '' END || cn.label || CASE WHEN cns.label <> '' THEN ' ' ELSE '' END || cns.label,
                                oils_i18n_xlate('asset.copy_location', 'acpl', 'name', 'id', cl.id::TEXT, ?),
                                cp.status,
                                count(cp.id)
                  FROM  $cp_table cp,
                        $cn_table cn,
+                       $cns_table cns,
+                       $cnp_table cnp,
                        $cl_table cl,
                        $cs_table cs,
                        $descendants d
                  WHERE cn.record = ?
+                       AND cnp.id = cn.prefix
+                       AND cns.id = cn.suffix
                        AND cp.call_number = cn.id
                        AND cp.location = cl.id
                        AND cp.circ_lib = d.id