AOS_Quotes customize action_editview

Hi everyone,
I have a custom module “accounts-type” related to the Quotes module (as are Accounts, Leads, Contacts) and I’m trying to have the address auto-fill, as it does for Accounts.

So I tried to extend controller.php like this but it seems it’s not enough. Am I forgetting something?
Thanks so much for any suggestion.

require_once('modules/AOS_Quotes/controller.php');

class CustomAOS_QuotesController extends AOS_QuotesController
{
    public function action_editview()
    {

	   $ac_id =  $_REQUEST['ac_ac_anagrafica_aos_quotes_1ac_ac_anagrafica_ida'];

            $query = "SELECT * FROM ac_ac_anagrafica WHERE id = '" + $ac_id + "'";
            $result = $this->bean->db->query($query, true);
            $row = $this->bean->db->fetchByAssoc($result);
	    $this->bean->ac_ac_anagrafica_aos_quotes_1ac_ac_anagrafica_ida = $row['id'];
            $this->bean->ac_ac_anagrafica_aos_quotes_1_name = $row['name'];
            $this->bean->billing_address_street = $row['billing_address_street'];
            $this->bean->billing_address_city = $row['billing_address_city'];
            $this->bean->billing_address_state = $row['billing_address_state'];
            $this->bean->billing_address_postalcode = $row['billing_address_postalcode'];
            $this->bean->billing_address_country = $row['billing_address_country'];


        
	    parent::action_editview();
	    
    }
}

Finally I found the solution.
I started the wrong way by changing the controller.

First of all I added an extension to vardefs
like this

<?php
$dictionary['AOS_Quotes']['fields']['ac_ac_anagrafica_aos_quotes_1_name']['field_list']=
        array('...............');
$dictionary['AOS_Quotes']['fields']['ac_ac_anagrafica_aos_quotes_1_name']['populate_list']=
        array('...............');

And then I edited detailviewdefs adding to my related field “field_to_name_array”:

'displayParams' => 
            array (
              'field_to_name_array' => 
              array (
				'name' => 'ac_ac_anagrafica_aos_quotes_1_name',
				'id' => 'ac_ac_anagrafica_aos_quotes_1ac_ac_anagrafica_ida',
				'billing_address_street' => 'billing_address_street',
                'billing_address_city' => 'billing_address_city',
                'billing_address_state' => 'billing_address_state',
                'billing_address_postalcode' => 'billing_address_postalcode',
				'billing_address_country' => 'billing_address_country',
				'shipping_address_street' => 'shipping_address_street',
                'shipping_address_city' => 'shipping_address_city',
                'shipping_address_state' => 'shipping_address_state',
                'shipping_address_postalcode' => 'shipping_address_postalcode',
				'shipping_address_country' => 'shipping_address_country',
              ),

I hope it can help others too

Interesting. This is new to me.

Can you please explain what that field_to_name_array is all about?

It’s allowing me to retrieve the value of my custom module fields within the fields of the Quote module (my custom module is “Account” type so the address fields have the same name).

1 Like