package Support::Reports::Command::LabelWithoutContracts;
use strict;
use warnings;

use lib '/app/tools/support/lib';
use Support::Reports::LabelWithoutContracts;

use base 'Support::Command::Submit';

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

sub cmd  { return 'label_without_contracts'; }
sub area { return 'reports'; }

use constant kTemplate => "/app/tools/support/templates/reports/label_without_contracts.xsl";

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

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

    my $client = $self->getParam('client');
    my $page   = $self->getParam('page');
    my $limit  = $self->getParam('limit') || 25;

    my $report = new Support::Reports::LabelWithoutContracts(
        clientID => $client,
        limit    => $limit,
        page     => $page
    );

    $report->run();

    $self->{xml}{Collection} = $report;

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

1;
