<?php
/**
 * InterchangeObservation business
 *
 * @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]
 * Sandro Roberto Weisheimer [sandrow@solis.coop.br]
 *
 * @since
 * Class created on 20/02/2009
 *
 * \b Organization: \n
 * SOLIS - Cooperativa de Solucoes Livres \n
 * The Gnuteca3 Development Team
 *
 * \b CopyLeft: \n
 * CopyLeft (L) 2009 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 BusinessGnuteca3BusInterchangeObservation extends GnutecaBusiness
{
    public $interchangeObservationId;
    public $interchangeId;
    public $date;
    public $observation;
    public $operator;

    public $interchangeObservationIdS;
    public $interchangeIdS;
    public $dateS;
    public $observationS;
    public $operatorS;


    public function __construct()
    {
    	$table = 'gtcInterchangeObservation';
    	$pkeys = 'interchangeObservationId';
    	$cols  = 'interchangeId,
    	          date,
    	          observation,
    	          operator';
        parent::__construct($table, $pkeys, $cols);
    }


    public function insertInterchangeObservation()
    {
    	if ($this->removeData)
    	{
    		if ($this->interchangeObservationId)
    		{
    			$this->deleteInterchangeObservation($this->interchangeObservationId);
    		}
    		return TRUE;
    	}
    	if ($this->interchangeObservationId)
    	{
    		return $this->autoUpdate();
    	}
        return $this->autoInsert();
    }


    public function updateInterchangeObservation()
    {
        return $this->autoUpdate();
    }


    public function getInterchangeObservation($interchangeObservationId)
    {
        $this->clear();
        return $this->autoGet($interchangeObservationId);
    }


    public function deleteInterchangeObservation($interchangeObservationId)
    {
        return $this->autoDelete($interchangeObservationId);
    }


    public function searchInterchangeObservation($toObject = FALSE)
    {
        $filters = array(
            'interchangeObservationId' => 'equals',
            'interchangeId'            => 'equals',
            'observation'           => 'equals',
            'operator'              => 'equals',
        );
        $this->clear();
        return $this->autoSearch($filters, $toObject);
    }


    public function listInterchangeObservation()
    {
        return $this->autoList();
    }


    public function setData($data)
    {
        $this->date         = NULL;
        $this->operator     = NULL;
        $this->observation  = NULL;
        parent::setData($data);
    }
}
?>
