Changeset 686


Ignore:
Timestamp:
Oct 6, 2010, 12:58:13 AM (9 years ago)
Author:
gav
Message:

Tweak asset and equipment register reports to show blank strings in empty cells.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/services/AssetReportService.groovy

    r681 r686  
    2929        // Inner join used to return only attribTypes that are used by AssetExtendedAttributes.
    3030        // So the result is only asset extendedAttributeTypes.
     31//         def attribTypesQ = new HqlBuilder().query {
     32//             select 'distinct attribT.name'
     33//             from 'AssetExtendedAttribute attrib',
     34//                     'join attrib.extendedAttributeType as attribT'
     35//             order 'by attribT.name asc'
     36//         }
     37
     38        // All active ExtendedAttributes.
    3139        def attribTypesQ = new HqlBuilder().query {
    3240            select 'distinct attribT.name'
    33             from 'AssetExtendedAttribute attrib',
    34                     'join attrib.extendedAttributeType as attribT'
     41            from 'ExtendedAttributeType attribT'
     42            where 'attribT.isActive = true'
    3543            order 'by attribT.name asc'
    3644        }
    37         result.attribTypes = Asset.executeQuery(attribTypesQ.query, attribTypesQ.namedParams)
     45        result.attribTypes = ExtendedAttributeType.executeQuery(attribTypesQ.query, attribTypesQ.namedParams)
    3846
    3947        // A result is returned for every asset and for any extended attributes.
     
    6573                // Add all attribType columns.
    6674                result.attribTypes.each { column ->
    67                     rows[assetResult.name][column] = '-'
     75                    rows[assetResult.name][column] = ' '
    6876                }
    6977            }
     
    131139        // Inner join used to return only attribTypes that are used by AssetSubItemExtendedAttributes.
    132140        // So the result is only assetSubItem extendedAttributeTypes.
     141//         def attribTypesQ = new HqlBuilder().query {
     142//             select 'distinct attribT.name'
     143//             from 'AssetSubItemExtendedAttribute attrib',
     144//                     'join attrib.extendedAttributeType as attribT'
     145//             order 'by attribT.name asc'
     146//         }
     147
     148        // All active ExtendedAttributes.
    133149        def attribTypesQ = new HqlBuilder().query {
    134150            select 'distinct attribT.name'
    135             from 'AssetSubItemExtendedAttribute attrib',
    136                     'join attrib.extendedAttributeType as attribT'
     151            from 'ExtendedAttributeType attribT'
     152            where 'attribT.isActive = true'
    137153            order 'by attribT.name asc'
    138154        }
    139         result.attribTypes = Asset.executeQuery(attribTypesQ.query, attribTypesQ.namedParams)
     155        result.attribTypes = ExtendedAttributeType.executeQuery(attribTypesQ.query, attribTypesQ.namedParams)
    140156
    141157        // A useful list of assets without subItems to be given to the user.
     
    205221                // Add all attribType columns.
    206222                result.attribTypes.each { column ->
    207                     rows[rowKey][column] = '-'
     223                    rows[rowKey][column] = ' '
    208224                }
    209225            }
Note: See TracChangeset for help on using the changeset viewer.