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

use strict;
use warnings;

use lib '/app/tools/rps/lib';
use RPS::Price::Price;

use Common::FormObject;
use base 'Common::FormObject';

sub _init {
    my ( $self, %args ) = @_;

    $self->SUPER::_init(%args);

    $self->{Price} = [];

    my $collection;

    if ( $args{type} ) {
        $collection = RPS::DB::Item::Price->GetByType( $args{type} );
    } else {
        $collection = RPS::DB::Item::Price->GetAll();
    }

    while ( $collection->hasNext() ) {
        my $obj = $collection->next();
        push @{ $self->{Price} }, RPS::Price::Price->new( _dbItem => $obj, loadSubs => 0 );
    }

    return $self;
}

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

    return $self->{Price};
}

###
1;    #
###

