[ Index ]

Source Code Reference for V1.00

title

Body

[close]

/modules/companies/ -> companies.class.php (source)

   1  <?php /* COMPANIES $Id: companies.class.php,v 1.9.12.3 2007/03/06 00:34:40 merlinyoda Exp $ */
   2  if (!defined('W2P_BASE_DIR')) {
   3      die('You should not access this file directly.');
   4  }
   5  
   6  /**
   7   *    @package web2Project
   8   *    @subpackage modules
   9   *    @version $Revision: 1.9.12.3 $
  10   */
  11  
  12  require_once ($AppUI->getSystemClass('w2p'));
  13  require_once ($AppUI->getModuleClass('departments'));
  14  
  15  /**
  16   *    Companies Class
  17   *    @todo Move the 'address' fields to a generic table
  18   */
  19  class CCompany extends CW2pObject {
  20      /**
  21       @var int Primary Key */
  22      var $company_id = null;
  23      /**
  24       @var string */
  25      var $company_name = null;
  26  
  27      // these next fields should be ported to a generic address book
  28      var $company_phone1 = null;
  29      var $company_phone2 = null;
  30      var $company_fax = null;
  31      var $company_address1 = null;
  32      var $company_address2 = null;
  33      var $company_city = null;
  34      var $company_state = null;
  35      var $company_zip = null;
  36      var $company_country = null;
  37      var $company_email = null;
  38      /**
  39       @var string */
  40      var $company_primary_url = null;
  41      /**
  42       @var int */
  43      var $company_owner = null;
  44      /**
  45       @var string */
  46      var $company_description = null;
  47      /**
  48       @var int */
  49      var $company_type = null;
  50      var $company_custom = null;
  51  
  52  	function CCompany() {
  53          $this->CW2pObject('companies', 'company_id');
  54      }
  55  
  56      // overload check
  57  	function check() {
  58          if ($this->company_id === null) {
  59              return 'company id is NULL';
  60          }
  61          $this->company_id = intval($this->company_id);
  62  
  63          return null; // object is ok
  64      }
  65  
  66      // overload canDelete
  67  	function canDelete(&$msg, $oid = null) {
  68          $tables[] = array('label' => 'Projects', 'name' => 'projects', 'idfield' => 'project_id', 'joinfield' => 'project_company');
  69          $tables[] = array('label' => 'Departments', 'name' => 'departments', 'idfield' => 'dept_id', 'joinfield' => 'dept_company');
  70          $tables[] = array('label' => 'Users', 'name' => 'users', 'idfield' => 'user_id', 'joinfield' => 'user_company');
  71          // call the parent class method to assign the oid
  72          return CW2pObject::canDelete($msg, $oid, $tables);
  73      }
  74  }
  75  ?>


Generated: Wed Jan 7 03:00:01 2009 Cross-referenced by PHPXref 0.7