Ignore:
Timestamp:
03/27/15 15:17:51 (9 years ago)
Author:
nanardon
Message:

add Services object (step to Itil)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/objects.pm

    r1300 r1303  
    103103    $info->{exported}   = { inline => 1, formtype => 'CHECKBOX', hide => 1, monitored => 1 }; 
    104104    $info->{unexported} = { inline => 1, formtype => 'CHECKBOX', }; 
     105    $info->{services}   = { inline => 1, ro => 1, }; 
    105106 
    106107    $info 
     
    250251    if ($field eq 'unexported') { 
    251252        return $self->get_field('exported') ? undef : 1; 
     253    } 
     254    if ($field eq 'services') { 
     255        my @services; 
     256        my $sth = $self->db->prepare_cached( 
     257            q{ select name from service join service_attributes 
     258               on okey = ikey 
     259               where service_attributes.attr = 'dependOn' and value = ? 
     260               }); 
     261        $sth->execute($self->type . '.' . $self->id); 
     262        while(my $res = $sth->fetchrow_hashref) { 
     263            push(@services, $res->{name}); 
     264        } 
     265        return \@services;  
    252266    } 
    253267    my $attr = $self->attribute($field) or return; 
Note: See TracChangeset for help on using the changeset viewer.