<?php
/**
* Product: Katyshop
* @version 0.3.2.1
* @author Catalin Hulea - hide@address.com
* @copyright Copyright (C) 2007 Catalin Hulea
* @license GNU General Public License version 3
* You can find a copy of GNU GPL v3 at this path: /docs/LICENSE
* @link https://sourceforge.net/projects/katyshop
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Manufacturer extends LogicObject
{
var $id = 0;
var $title = "";
var $description = "";
var $picture = "";
function Manufacturer()
{
parent::LogicObject();
}
function validate()
{
$errors = array();
if(!Tools::validateInt($this->id, true))
$errors[] = "Proprietatea ID a obiectului de tip Manufacturer trebuie sa fie pozitiv intreg";
if(strlen($this->title) < 3 || strlen($this->title) > 255)
$errors[] = "Titlul producatorului trebuie sa aiba intre 3 si 255 caractere";
if(strlen($this->description) > 500)
$errors[] = "Descrierea producatorului nu poate avea mai mult de 500 caractere";
if(count($errors) == 0)
{
$db = Application::getDb();
if($this->id > 0 && !$db->tbManufacturer->idExists($this->id))
$errors[] = "Nu am putut gasi producatorul pentru a-l edita";
$temp = $db->tbManufacturer->getManufacturerByTitle($this->title);
if($temp->id > 0 && $temp->id != $this->id)
$errors[] = "Deja exista un alt producator cu acest titlu";
}
Application::appendErrors($errors);
return (count($errors) == 0);
}
}
?>