Location: PHPKode > projects > Katyshop > katyshop_ro_0.3.2.1/classes/logic/UserCompany.php
<?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/>.
 *
 */

require_once(dirname(__FILE__) . "/UserPerson.php");

class UserCompany extends UserPerson
{
	// database stored properties
	var $id = 0;
	var $company_name = "";
	var $reg_comert = "";
	var $cui = "";
	var $bank = "";
	var $iban = "";
	var $comp_phone = "";
	var $comp_fax = "";
	var $comp_email = "";

	function UserCompany()
	{
		parent::UserPerson();
	}

	function getInstanceProps($myClass = "")
	{
		if(empty($myClass))
			$myClass = __CLASS__;
		return parent::getInstanceProps($myClass);
	}

	function validateRegister($confirmPassword)
	{
		if(!parent::validateRegister($confirmPassword))
			return false;
		$errors = array();

		if(strlen($this->company_name) < 3 || strlen($this->company_name) > 255)
			$errors[] = "Numele companiei trebuie sa aiba intre 2 si 255 caractere";

		Application::appendErrors($errors);
		return (count($errors) == 0);
	}

	function validateUpdate($oldPassword, $newPassword, $confirmPassword)
	{
		if(!parent::validateUpdate($oldPassword, $newPassword, $confirmPassword))
			return false;
		$errors = array();

		if(strlen($this->company_name) < 3 || strlen($this->company_name) > 255)
			$errors[] = "Numele companiei trebuie sa aiba intre 3 si 255 caractere";

		Application::appendErrors($errors);
		return (count($errors) == 0);
	}

	function toStr($humanReadable = false, $brief = false)
	{
		if($humanReadable)
		{
			$s = parent::toStr($humanReadable, $brief);
			if($brief)
			{
				$s .= "
Numele companiei: {$this->company_name}
Numar de inregistrare la registrul comertului: {$this->reg_comert}
Banca: {$this->bank}
IBAN: {$this->iban}";
			}
			else
			{
				$s .= "
Cont de tip companie cu detaliile:
Numele companiei: {$this->company_name}
Numar de inregistrare la registrul comertului: {$this->reg_comert}
CUI: {$this->cui}
Banca: {$this->bank}
IBAN: {$this->iban}
Telefonul companiei: {$this->comp_phone}
Fax companie: {$this->comp_fax}
Email companie: {$this->comp_email}
";
			}
			return $s;
		}
		else
		{
			return parent::toStr();
		}
	}

}









?>
Return current item: Katyshop