/**
  * Tests loading list of Contacts for this company.
  */
 public function testGetContacts()
 {
     global $AppUI;
     $contacts = CCompany::getContacts($AppUI, 1);
     /**
      * getContacts returns both an associative array as well as a indexed array
      * so we need to check both to make sure functionality depending on either does
      * not break.
      */
     $this->assertEquals(2, count($contacts));
     $this->assertEquals(1, $contacts[1]['contact_id']);
     $this->assertEquals('Admin', $contacts[1]['contact_first_name']);
     $this->assertEquals('Person', $contacts[1]['contact_last_name']);
     $this->assertEquals('', $contacts[1]['contact_display_name']);
     $this->assertEquals('', $contacts[1]['contact_order_by']);
     $this->assertEquals('President', $contacts[1]['contact_title']);
     $this->assertEquals('1983-07-22', $contacts[1]['contact_birthday']);
     $this->assertEquals('President', $contacts[1]['contact_job']);
     $this->assertEquals(1, $contacts[1]['contact_company']);
     $this->assertEquals(0, $contacts[1]['contact_department']);
     $this->assertEquals('person', $contacts[1]['contact_type']);
     $this->assertEquals('*****@*****.**', $contacts[1]['contact_email']);
     $this->assertEquals('703-555-1111', $contacts[1]['contact_phone']);
     $this->assertEquals('c1 address 1', $contacts[1]['contact_address1']);
     $this->assertEquals('c1 address 2', $contacts[1]['contact_address2']);
     $this->assertEquals('c1 city', $contacts[1]['contact_city']);
     $this->assertEquals('CA', $contacts[1]['contact_state']);
     $this->assertEquals('90210', $contacts[1]['contact_zip']);
     $this->assertEquals('US', $contacts[1]['contact_country']);
     $this->assertEquals('c1s notes.', $contacts[1]['contact_notes']);
     $this->assertEquals(0, $contacts[1]['contact_project']);
     $this->assertEquals('obj/contact', $contacts[1]['contact_icon']);
     $this->assertEquals(0, $contacts[1]['contact_owner']);
     $this->assertEquals(0, $contacts[1]['contact_private']);
     $this->assertEquals('', $contacts[1]['contact_updatekey']);
     $this->assertEquals('2009-01-01 11:11:11', $contacts[1]['contact_lastupdate']);
     $this->assertEquals('2008-12-12 11:11:11', $contacts[1]['contact_updateasked']);
     $this->assertEquals('', $contacts[1]['dept_name']);
     $this->assertEquals(1, $contacts[1]['0']);
     $this->assertEquals('Admin', $contacts[1]['1']);
     $this->assertEquals('Person', $contacts[1]['2']);
     $this->assertEquals('', $contacts[1]['3']);
     $this->assertEquals('', $contacts[1]['4']);
     $this->assertEquals('President', $contacts[1]['5']);
     $this->assertEquals('1983-07-22', $contacts[1]['6']);
     $this->assertEquals('President', $contacts[1]['7']);
     $this->assertEquals(1, $contacts[1]['8']);
     $this->assertEquals(0, $contacts[1]['9']);
     $this->assertEquals('person', $contacts[1]['10']);
     $this->assertEquals('*****@*****.**', $contacts[1]['11']);
     $this->assertEquals('703-555-1111', $contacts[1]['12']);
     $this->assertEquals('c1 address 1', $contacts[1]['13']);
     $this->assertEquals('c1 address 2', $contacts[1]['14']);
     $this->assertEquals('c1 city', $contacts[1]['15']);
     $this->assertEquals('CA', $contacts[1]['16']);
     $this->assertEquals('90210', $contacts[1]['17']);
     $this->assertEquals('US', $contacts[1]['18']);
     $this->assertEquals('c1s notes.', $contacts[1]['19']);
     $this->assertEquals(0, $contacts[1]['20']);
     $this->assertEquals('obj/contact', $contacts[1]['21']);
     $this->assertEquals(0, $contacts[1]['22']);
     $this->assertEquals(0, $contacts[1]['23']);
     $this->assertEquals('', $contacts[1]['24']);
     $this->assertEquals('2009-01-01 11:11:11', $contacts[1]['25']);
     $this->assertEquals('2008-12-12 11:11:11', $contacts[1]['26']);
     $this->assertEquals('', $contacts[1]['27']);
     $this->assertEquals(2, $contacts[2]['contact_id']);
     $this->assertEquals('Contact', $contacts[2]['contact_first_name']);
     $this->assertEquals('Number 1', $contacts[2]['contact_last_name']);
     $this->assertEquals('', $contacts[2]['contact_display_name']);
     $this->assertEquals('', $contacts[2]['contact_order_by']);
     $this->assertEquals('Vice President', $contacts[2]['contact_title']);
     $this->assertEquals('1973-07-22', $contacts[2]['contact_birthday']);
     $this->assertEquals('Vice President', $contacts[2]['contact_job']);
     $this->assertEquals(1, $contacts[2]['contact_company']);
     $this->assertEquals(0, $contacts[2]['contact_department']);
     $this->assertEquals('person', $contacts[2]['contact_type']);
     $this->assertEquals('*****@*****.**', $contacts[2]['contact_email']);
     $this->assertEquals('703-555-2222', $contacts[2]['contact_phone']);
     $this->assertEquals('c2 address 1', $contacts[2]['contact_address1']);
     $this->assertEquals('c2 address 2', $contacts[2]['contact_address2']);
     $this->assertEquals('c2 city', $contacts[2]['contact_city']);
     $this->assertEquals('CA', $contacts[2]['contact_state']);
     $this->assertEquals('90211', $contacts[2]['contact_zip']);
     $this->assertEquals('US', $contacts[2]['contact_country']);
     $this->assertEquals('c2s notes.', $contacts[2]['contact_notes']);
     $this->assertEquals(0, $contacts[2]['contact_project']);
     $this->assertEquals('obj/contact', $contacts[2]['contact_icon']);
     $this->assertEquals(0, $contacts[2]['contact_owner']);
     $this->assertEquals(0, $contacts[2]['contact_private']);
     $this->assertEquals('', $contacts[2]['contact_updatekey']);
     $this->assertEquals('2008-01-01 11:11:11', $contacts[2]['contact_lastupdate']);
     $this->assertEquals('2007-12-12 11:11:11', $contacts[2]['contact_updateasked']);
     $this->assertEquals('', $contacts[2]['dept_name']);
     $this->assertEquals(2, $contacts[2]['0']);
     $this->assertEquals('Contact', $contacts[2]['1']);
     $this->assertEquals('Number 1', $contacts[2]['2']);
     $this->assertEquals('', $contacts[2]['3']);
     $this->assertEquals('', $contacts[2]['4']);
     $this->assertEquals('Vice President', $contacts[2]['5']);
     $this->assertEquals('1973-07-22', $contacts[2]['6']);
     $this->assertEquals('Vice President', $contacts[2]['7']);
     $this->assertEquals(1, $contacts[2]['8']);
     $this->assertEquals(0, $contacts[2]['9']);
     $this->assertEquals('person', $contacts[2]['10']);
     $this->assertEquals('*****@*****.**', $contacts[2]['11']);
     $this->assertEquals('703-555-2222', $contacts[2]['12']);
     $this->assertEquals('c2 address 1', $contacts[2]['13']);
     $this->assertEquals('c2 address 2', $contacts[2]['14']);
     $this->assertEquals('c2 city', $contacts[2]['15']);
     $this->assertEquals('CA', $contacts[2]['16']);
     $this->assertEquals('90211', $contacts[2]['17']);
     $this->assertEquals('US', $contacts[2]['18']);
     $this->assertEquals('c2s notes.', $contacts[2]['19']);
     $this->assertEquals(0, $contacts[2]['20']);
     $this->assertEquals('obj/contact', $contacts[2]['21']);
     $this->assertEquals(0, $contacts[2]['22']);
     $this->assertEquals(0, $contacts[2]['23']);
     $this->assertEquals('', $contacts[2]['24']);
     $this->assertEquals('2008-01-01 11:11:11', $contacts[2]['25']);
     $this->assertEquals('2007-12-12 11:11:11', $contacts[2]['26']);
     $this->assertEquals('', $contacts[2]['27']);
 }
Exemple #2
0
<?php

/* $Id: vw_contacts.php 1516 2010-12-05 07:18:58Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/companies/vw_contacts.php $ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
##
##	Companies: View User sub-table
##
global $AppUI, $company;
$contacts = CCompany::getContacts($AppUI, $company->company_id);
?>
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl"><?php 
if (count($contacts) > 0) {
    ?>
	<tr>
		<th><?php 
    echo $AppUI->_('Name');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Job Title');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('e-mail');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Phone');
    ?>
Exemple #3
0
 /**
  * Tests loading list of Contacts for this company.
  */
 public function testGetContacts()
 {
     global $AppUI;
     $contacts = CCompany::getContacts($AppUI, 1);
     /**
      * getContacts returns both an associative array as well as a indexed array
      * so we need to check both to make sure functionality depending on either does
      * not break.
      */
     $this->assertType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $contacts);
     $this->assertEquals(2, count($contacts));
     $this->assertEquals(1, $contacts[1]['contact_id']);
     $this->assertEquals('Admin', $contacts[1]['contact_first_name']);
     $this->assertEquals('Person', $contacts[1]['contact_last_name']);
     $this->assertEquals('', $contacts[1]['contact_order_by']);
     $this->assertEquals('President', $contacts[1]['contact_title']);
     $this->assertEquals('1983-07-22', $contacts[1]['contact_birthday']);
     $this->assertEquals('President', $contacts[1]['contact_job']);
     $this->assertEquals(1, $contacts[1]['contact_company']);
     $this->assertEquals(0, $contacts[1]['contact_department']);
     $this->assertEquals('person', $contacts[1]['contact_type']);
     $this->assertEquals('*****@*****.**', $contacts[1]['contact_email']);
     $this->assertEquals('*****@*****.**', $contacts[1]['contact_email2']);
     $this->assertEquals('1.example.org', $contacts[1]['contact_url']);
     $this->assertEquals('1.999.999.9999', $contacts[1]['contact_phone']);
     $this->assertEquals('1.999.999.9998', $contacts[1]['contact_phone2']);
     $this->assertEquals('1.999.999.9997', $contacts[1]['contact_fax']);
     $this->assertEquals('1.999.999.9996', $contacts[1]['contact_mobile']);
     $this->assertEquals('c1 address 1', $contacts[1]['contact_address1']);
     $this->assertEquals('c1 address 2', $contacts[1]['contact_address2']);
     $this->assertEquals('c1 city', $contacts[1]['contact_city']);
     $this->assertEquals('CA', $contacts[1]['contact_state']);
     $this->assertEquals('90210', $contacts[1]['contact_zip']);
     $this->assertEquals('US', $contacts[1]['contact_country']);
     $this->assertEquals('c1jabber', $contacts[1]['contact_jabber']);
     $this->assertEquals('c1icq', $contacts[1]['contact_icq']);
     $this->assertEquals('c1msn', $contacts[1]['contact_msn']);
     $this->assertEquals('c1yahoo', $contacts[1]['contact_yahoo']);
     $this->assertEquals('c1aol', $contacts[1]['contact_aol']);
     $this->assertEquals('c1s notes.', $contacts[1]['contact_notes']);
     $this->assertEquals(0, $contacts[1]['contact_project']);
     $this->assertEquals('obj/contact', $contacts[1]['contact_icon']);
     $this->assertEquals(0, $contacts[1]['contact_owner']);
     $this->assertEquals(0, $contacts[1]['contact_private']);
     $this->assertEquals('', $contacts[1]['contact_updatekey']);
     $this->assertEquals('2009-01-01 11:11:11', $contacts[1]['contact_lastupdate']);
     $this->assertEquals('2008-12-12 11:11:11', $contacts[1]['contact_updateasked']);
     $this->assertEquals('c1skype', $contacts[1]['contact_skype']);
     $this->assertEquals('c1google', $contacts[1]['contact_google']);
     $this->assertEquals('', $contacts[1]['dept_name']);
     $this->assertEquals(1, $contacts[1]['0']);
     $this->assertEquals('Admin', $contacts[1]['1']);
     $this->assertEquals('Person', $contacts[1]['2']);
     $this->assertEquals('', $contacts[1]['3']);
     $this->assertEquals('President', $contacts[1]['4']);
     $this->assertEquals('1983-07-22', $contacts[1]['5']);
     $this->assertEquals('President', $contacts[1]['6']);
     $this->assertEquals(1, $contacts[1]['7']);
     $this->assertEquals(0, $contacts[1]['8']);
     $this->assertEquals('person', $contacts[1]['9']);
     $this->assertEquals('*****@*****.**', $contacts[1]['10']);
     $this->assertEquals('*****@*****.**', $contacts[1]['11']);
     $this->assertEquals('1.example.org', $contacts[1]['12']);
     $this->assertEquals('1.999.999.9999', $contacts[1]['13']);
     $this->assertEquals('1.999.999.9998', $contacts[1]['14']);
     $this->assertEquals('1.999.999.9997', $contacts[1]['15']);
     $this->assertEquals('1.999.999.9996', $contacts[1]['16']);
     $this->assertEquals('c1 address 1', $contacts[1]['17']);
     $this->assertEquals('c1 address 2', $contacts[1]['18']);
     $this->assertEquals('c1 city', $contacts[1]['19']);
     $this->assertEquals('CA', $contacts[1]['20']);
     $this->assertEquals('90210', $contacts[1]['21']);
     $this->assertEquals('US', $contacts[1]['22']);
     $this->assertEquals('c1jabber', $contacts[1]['23']);
     $this->assertEquals('c1icq', $contacts[1]['24']);
     $this->assertEquals('c1msn', $contacts[1]['25']);
     $this->assertEquals('c1yahoo', $contacts[1]['26']);
     $this->assertEquals('c1aol', $contacts[1]['27']);
     $this->assertEquals('c1s notes.', $contacts[1]['28']);
     $this->assertEquals(0, $contacts[1]['29']);
     $this->assertEquals('obj/contact', $contacts[1]['30']);
     $this->assertEquals(0, $contacts[1]['31']);
     $this->assertEquals(0, $contacts[1]['32']);
     $this->assertEquals('', $contacts[1]['33']);
     $this->assertEquals('2009-01-01 11:11:11', $contacts[1]['34']);
     $this->assertEquals('2008-12-12 11:11:11', $contacts[1]['35']);
     $this->assertEquals('c1skype', $contacts[1]['36']);
     $this->assertEquals('c1google', $contacts[1]['37']);
     $this->assertEquals('', $contacts[1]['38']);
     $this->assertEquals(2, $contacts[2]['contact_id']);
     $this->assertEquals('Contact', $contacts[2]['contact_first_name']);
     $this->assertEquals('Number 1', $contacts[2]['contact_last_name']);
     $this->assertEquals('', $contacts[2]['contact_order_by']);
     $this->assertEquals('Vice President', $contacts[2]['contact_title']);
     $this->assertEquals('1973-07-22', $contacts[2]['contact_birthday']);
     $this->assertEquals('Vice President', $contacts[2]['contact_job']);
     $this->assertEquals(1, $contacts[2]['contact_company']);
     $this->assertEquals(0, $contacts[2]['contact_department']);
     $this->assertEquals('person', $contacts[2]['contact_type']);
     $this->assertEquals('*****@*****.**', $contacts[2]['contact_email']);
     $this->assertEquals('*****@*****.**', $contacts[2]['contact_email2']);
     $this->assertEquals('2.example.org', $contacts[2]['contact_url']);
     $this->assertEquals('1.888.888.8888', $contacts[2]['contact_phone']);
     $this->assertEquals('1.888.888.8887', $contacts[2]['contact_phone2']);
     $this->assertEquals('1.888.888.8886', $contacts[2]['contact_fax']);
     $this->assertEquals('1.888.888.8885', $contacts[2]['contact_mobile']);
     $this->assertEquals('c2 address 1', $contacts[2]['contact_address1']);
     $this->assertEquals('c2 address 2', $contacts[2]['contact_address2']);
     $this->assertEquals('c2 city', $contacts[2]['contact_city']);
     $this->assertEquals('CA', $contacts[2]['contact_state']);
     $this->assertEquals('90211', $contacts[2]['contact_zip']);
     $this->assertEquals('US', $contacts[2]['contact_country']);
     $this->assertEquals('c2jabber', $contacts[2]['contact_jabber']);
     $this->assertEquals('c2icq', $contacts[2]['contact_icq']);
     $this->assertEquals('c2msn', $contacts[2]['contact_msn']);
     $this->assertEquals('c2yahoo', $contacts[2]['contact_yahoo']);
     $this->assertEquals('c2aol', $contacts[2]['contact_aol']);
     $this->assertEquals('c2s notes.', $contacts[2]['contact_notes']);
     $this->assertEquals(0, $contacts[2]['contact_project']);
     $this->assertEquals('obj/contact', $contacts[2]['contact_icon']);
     $this->assertEquals(0, $contacts[2]['contact_owner']);
     $this->assertEquals(0, $contacts[2]['contact_private']);
     $this->assertEquals('', $contacts[2]['contact_updatekey']);
     $this->assertEquals('2008-01-01 11:11:11', $contacts[2]['contact_lastupdate']);
     $this->assertEquals('2007-12-12 11:11:11', $contacts[2]['contact_updateasked']);
     $this->assertEquals('c2skype', $contacts[2]['contact_skype']);
     $this->assertEquals('c2google', $contacts[2]['contact_google']);
     $this->assertEquals('', $contacts[2]['dept_name']);
     $this->assertEquals(2, $contacts[2]['0']);
     $this->assertEquals('Contact', $contacts[2]['1']);
     $this->assertEquals('Number 1', $contacts[2]['2']);
     $this->assertEquals('', $contacts[2]['3']);
     $this->assertEquals('Vice President', $contacts[2]['4']);
     $this->assertEquals('1973-07-22', $contacts[2]['5']);
     $this->assertEquals('Vice President', $contacts[2]['6']);
     $this->assertEquals(1, $contacts[2]['7']);
     $this->assertEquals(0, $contacts[2]['8']);
     $this->assertEquals('person', $contacts[2]['9']);
     $this->assertEquals('*****@*****.**', $contacts[2]['10']);
     $this->assertEquals('*****@*****.**', $contacts[2]['11']);
     $this->assertEquals('2.example.org', $contacts[2]['12']);
     $this->assertEquals('1.888.888.8888', $contacts[2]['13']);
     $this->assertEquals('1.888.888.8887', $contacts[2]['14']);
     $this->assertEquals('1.888.888.8886', $contacts[2]['15']);
     $this->assertEquals('1.888.888.8885', $contacts[2]['16']);
     $this->assertEquals('c2 address 1', $contacts[2]['17']);
     $this->assertEquals('c2 address 2', $contacts[2]['18']);
     $this->assertEquals('c2 city', $contacts[2]['19']);
     $this->assertEquals('CA', $contacts[2]['20']);
     $this->assertEquals('90211', $contacts[2]['21']);
     $this->assertEquals('US', $contacts[2]['22']);
     $this->assertEquals('c2jabber', $contacts[2]['23']);
     $this->assertEquals('c2icq', $contacts[2]['24']);
     $this->assertEquals('c2msn', $contacts[2]['25']);
     $this->assertEquals('c2yahoo', $contacts[2]['26']);
     $this->assertEquals('c2aol', $contacts[2]['27']);
     $this->assertEquals('c2s notes.', $contacts[2]['28']);
     $this->assertEquals(0, $contacts[2]['29']);
     $this->assertEquals('obj/contact', $contacts[2]['30']);
     $this->assertEquals(0, $contacts[2]['31']);
     $this->assertEquals(0, $contacts[2]['32']);
     $this->assertEquals('', $contacts[2]['33']);
     $this->assertEquals('2008-01-01 11:11:11', $contacts[2]['34']);
     $this->assertEquals('2007-12-12 11:11:11', $contacts[2]['35']);
     $this->assertEquals('c2skype', $contacts[2]['36']);
     $this->assertEquals('c2google', $contacts[2]['37']);
     $this->assertEquals('', $contacts[2]['38']);
 }