public function preDisplay() { parent::preDisplay(); if ($this->_isDCForm) { //XXX TODO 20110329 Frank Steegmans: Hack to make quick create fields populate when used through the DC menu // NOTE HOWEVER that sqs_objects form fields are not properly populated because of some other hacks // resulting in none of the fields properly populating when selecting an account if (!empty($this->bean->phone_office)) { $_REQUEST['phone_work'] = $this->bean->phone_office; } if (!empty($this->bean->billing_address_street)) { $_REQUEST['primary_address_street'] = $this->bean->billing_address_street; } if (!empty($this->bean->billing_address_city)) { $_REQUEST['primary_address_city'] = $this->bean->billing_address_city; } if (!empty($this->bean->billing_address_state)) { $_REQUEST['primary_address_state'] = $this->bean->billing_address_state; } if (!empty($this->bean->billing_address_country)) { $_REQUEST['primary_address_country'] = $this->bean->billing_address_country; } if (!empty($this->bean->billing_address_postalcode)) { $_REQUEST['primary_address_postalcode'] = $this->bean->billing_address_postalcode; } } }
public function testpreDisplay() { //check without setting any values, it should execute without any issues. $view = new ViewQuickcreate(); $view->preDisplay(); $this->assertEquals(0, count($_REQUEST)); //check with values preset but without a valid bean id, it sould not change Request parameters $_REQUEST['source_module'] = 'Users'; $_REQUEST['module'] = 'Users'; $_REQUEST['record'] = ''; $request = $_REQUEST; $view->preDisplay(); $this->assertSame($request, $_REQUEST); //check with values preset, it sould set some addiiotnal Request parameters $_REQUEST['record'] = 1; $view->preDisplay(); $this->assertNotSame($request, $_REQUEST); }