#------------------------------------------------------------
# Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
package RPS::Publisher::Command::CA::AccountEdit;

use strict;
use warnings;
use Data::Dumper;

use lib '/app/tools/rps/lib';
use RPS::Publisher::CA::AccountForm;
use RPS::Publisher::Command::CA::Show;
use RPS::Publisher::Command::CA::Search;
use RPS::DB::Item::CAMechanicalRun;

use base 'RPS::Publisher::Command::BaseAccountEdit';

sub area { return 'ca_publisher'; }

sub _template { return "/app/tools/rps/templates/ca_publisher/account.xsl"; }
sub _accountForm { return "RPS::Publisher::CA::AccountForm"; }
sub _showCommand { return "RPS::Publisher::Command::CA::Show"; }
sub _searchCommand { return "RPS::Publisher::Command::CA::Search"; }

sub _openRunCount
{
    my ($self, $publisherID) = @_;
    # If there are any "open" (completed, running, waiting to run, waiting to commit) runs
    # that include this publisher, we don't want to allow any changes.
    #
    my $openRuns = 0;

    $openRuns = RPS::DB::Item::CAMechanicalRun->GetOpenRunCountForPublisher($publisherID);
    
    return $openRuns;
}

1;
