home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / dotproject / modules / companies / companies.class.php < prev    next >
Encoding:
PHP Script  |  2004-01-29  |  1.8 KB  |  66 lines

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