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

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

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

use lib '/app/tools/rps/lib';
use RPS::Command;
use base 'RPS::Command';

sub cmd { return 'account'; }

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

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

    my $publisherID = $self->getParam('PublisherID');
    my $payorID     = $self->getParam('PayorID');
    my $form;

    if ( $publisherID && $payorID ) {
        $form = $self->_accountForm()->new( publisherID => $publisherID, payorID => $payorID );
    } else {
        my $command = $self->_searchCommand()->new();
        return RSApache::Response::Redirect->new( $command->getRedirect() );
    }

    $self->{xml}{Form} = $form;

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

    return $response;
}

1;
