Exemplo n.º 1
0
 /**
  * Tests loading list of Departments for this company.
  */
 public function testGetDepartments()
 {
     global $AppUI;
     $departments = CCompany::getDepartments($AppUI, 1);
     $this->assertEquals(1, count($departments));
     $this->assertEquals(1, $departments[0]['dept_id']);
     $this->assertEquals(0, $departments[0]['dept_parent']);
     $this->assertEquals(1, $departments[0]['dept_company']);
     $this->assertEquals('Department 1', $departments[0]['dept_name']);
     $this->assertEquals('', $departments[0]['dept_phone']);
     $this->assertEquals('', $departments[0]['dept_fax']);
     $this->assertEquals('', $departments[0]['dept_address1']);
     $this->assertEquals('', $departments[0]['dept_address2']);
     $this->assertEquals('', $departments[0]['dept_city']);
     $this->assertEquals('', $departments[0]['dept_state']);
     $this->assertEquals('', $departments[0]['dept_zip']);
     $this->assertEquals('', $departments[0]['dept_url']);
     $this->assertEquals('', $departments[0]['dept_desc']);
     $this->assertEquals(0, $departments[0]['dept_owner']);
     $this->assertEquals('', $departments[0]['dept_country']);
     $this->assertEquals('', $departments[0]['dept_email']);
     $this->assertEquals(0, $departments[0]['dept_type']);
     $this->assertEquals(0, $departments[0]['dept_users']);
 }
Exemplo n.º 2
0
<?php

/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
##
##	Companies: View Departments sub-table
##
global $AppUI, $company_id, $canEdit;
$depts = CCompany::getDepartments($AppUI, $company_id);
// function renamed to avoid naming clash
function showchilddept_comp(&$a, $level = 0)
{
    global $AppUI;
    $s = '
	<td>
		<a href="./index.php?m=departments&amp;a=addedit&amp;dept_id=' . $a["dept_id"] . '" title="' . $AppUI->_('edit') . '">
			' . w2PshowImage('icons/stock_edit-16.png', 16, 16, '') . '
	</td>
	<td>';
    for ($y = 0; $y < $level; $y++) {
        if ($y + 1 == $level) {
            $s .= '<img src="' . w2PfindImage('corner-dots.gif') . '" width="16" height="12" border="0" alt="">';
        } else {
            $s .= '<img src="' . w2PfindImage('shim.gif') . '" width="16" height="12" border="0" alt="">';
        }
    }
    $s .= '<a href="./index.php?m=departments&a=view&dept_id=' . $a['dept_id'] . '">' . $a['dept_name'] . '</a>';
    $s .= '</td>';
    $s .= '<td align="center">' . ($a['dept_users'] ? $a['dept_users'] : '') . '</td>';