#------------------------------------------------------------
# Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
package Support::Service::Command::Show;
use strict;
use warnings;

use lib '/app/tools/support/lib';
use base 'Support::Command::Submit';

use lib '/app/tools/common/lib';
use RSApache::Response::XSLT;

use lib '/app/tools/support/lib';
use Support::Service::DistributionService;

sub cmd  { return 'service_detail'; }
sub area { return 'cm'; }

use constant kTemplate => "/app/tools/support/templates/cm/service_detail.xsl";

sub execute {
    my ($self) = @_;

    my $response = $self->SUPER::execute();
    return $response if $response;

    my $form = new Support::Service::DistributionService( serviceID => $self->getParam('ServiceID') );

    # If we are submitting then clear out the client restricted value and let the form set it.
    if ( $self->isSubmit ) {
        $form->ClientRestricted(0);
    }

    $self->saveOnSubmit($form);

    $self->{xml}{Form} = $form;
    $response = RSApache::Response::XSLT->new( $self->{xml}, kTemplate );
    return $response;
}

1;
