<?php
/**
 *
 * Library Unit search form
 *
 * @author Moises Heberle [moises@solis.coop.br]
 *
 * @version $Id$
 *
 * \b Maintainers \n
 * Eduardo Bonfandini [eduardo@solis.coop.br]
 * Jamiel Spezia [jamiel@solis.coop.br]
 * Luiz Gregory Filho [luiz@solis.coop.br]
 * Moises Heberle [moises@solis.coop.br]
 *
 * @since
 * Class created on 29/07/2008
 *
 * \b Organization: \n
 * SOLIS - Cooperativa de Solucoes Livres \n
 * The Gnuteca3 Development Team
 *
 * \b CopyLeft: \n
 * CopyLeft (L) 2008 SOLIS - Cooperativa de Solucoes Livres \n
 *
 * \b License: \n
 * Licensed under GPL (for further details read the COPYING file or http://www.gnu.org/copyleft/gpl.html )
 *
 * \b History: \n
 * See history in SVN repository: http://gnuteca.solis.coop.br
 *
 **/
class FrmGeneralPolicySearch extends GnutecaForm
{
    public $businessPrivilegeGroup;
    public $businessLink;

    public function __construct()
    {
        MIOLO::getInstance()->getClass('gnuteca3', 'GnutecaIntegerField');
        $this->businessPrivilegeGroup   = MIOLO::getInstance()->getBusiness(MIOLO::getCurrentModule(), 'BusPrivilegeGroup');
        $this->businessLink     = MIOLO::getInstance()->getBusiness(MIOLO::getCurrentModule(), 'BusBond');
        $this->setAllFunctions('GeneralPolicy', array('privilegeGroupIdS','linkIdS'));
        parent::__construct();
        if ( $this->primeiroAcessoAoForm() && strlen(MIOLO::_REQUEST('event')) == 0 )
        {
            $this->setFocus('privilegeGroupIdS');
        }

    }

    public function createFields()
    {
        $privilegeGroupId = new GnutecaSelection('privilegeGroupIdS', $this->privilegeGroupIds->value, _M('Privilege group',$this->module), $this->businessPrivilegeGroup->listPrivilegeGroup());
        $fields[] = $privilegeGroupId;

        $linkList = new GnutecaSelection('linkIdS', $this->linkIdS->value, _M('Link',$this->module), $this->businessLink->listBond());
        $fields[] = $linkList;

        $fields[] = new GnutecaIntegerField('loanGeneralLimitS', null, _M('Loan limit', $this->module));
        $fields[] = new GnutecaIntegerField('reserveGeneralLimitS', null, _M('Reserve limit', $this->module));
        $fields[] = new GnutecaIntegerField('reserveGeneralLimitIninitialLevelS', null, _M('Reserve limit at initial level', $this->module));
        $this->setFields( $fields );
    }
}
?>
