How can I get the user's other phone number in phone.js

Hi,

I need to change the callto-URL displayed for phone numbers in the views in Sugar 7.5.2.1

I found out how to do this by editing \clients\base\fields\phone\list.hbs, and it works well for the phone number of the contacts in the list.

But I also need to add the logged in user's phone number, because the URL needs this argument.

For this, I have edited \clients\base\fields\phone\phone.js and added this line:
this.userPhone = app.user.get("phone_other");

Unfortunatley, I does not give back a value, the variable stays empty.

I thested with "this.userPhone = app.user.get("user_name");" - this works well, I get the user name of the user logged in.

How can I change the api call to get the user's other phone number?

Thanks for your help!

Holger
Parents Reply
  • Add the following file into custom/clients/base/api/CustomCurrentUserApi.php


    require_once 'clients/base/api/CurrentUserApi.php';

    class CustomCurrentUserApi extends CurrentUserApi
    {

        /**
         * Retrieves the current user info
         *
         * @param $api
         * @param $args
         * @return array
         */
        public function retrieveCurrentUser($api, $args)
        {
            $current_user = $this->getUserBean();

            $userArray = parent::retrieveCurrentUser($api, $args);
            $userArray['current_user']['phone_other'] = $current_user->phone_other;


            return $userArray;
        }

    }
Children
No Data