Company Name as a standard field


#1

I would like “Company Name” to be a standard field for every customer, but not compulsory to be filled in. We have both clients that use us in a personal capacity as well as companies where a person is just a contact, such as the account manager, byt my invoice goes to the company. Adding this as a custom field is a little troublesome and isn’t included in search results. I’d like to also have this field included in search results, which is to say, I want the customer record to come up regardless if I search for his/her name or the company he/she works for.


Custom field problem
Custom field problem
#2

Last Update: 2018-03-06


#3

In response to KiGi over at Custom field problem topic,

This is exactly what I ended up doing, however I haven’t implemented your step 5 yet. Your step 7 also got me to ask the right questions to add it to the setup, thanks!

Started looking into modifying the invoices view so we can have company name show up and searchable.
Yeah, not sure myself on how to upload. Have been meaning to sit and figure it out.

This change needs to find it’s way into master branch.


#4

Sorry, Kovah, I don’t know how to redirect, but here is the link of the part of the code that works for me regarding the Company Name as a standard field: Custom field problem which DementedZA refers to.

Will have a look into searchable later.


Custom field problem
#5

I found the file where the search is done. It is
application\modules\clients\controllers*Ajax.php*

I entered the following

$clients = $this->mdl_clients
->where(‘client_active’, 1)
->having(‘client_name LIKE ‘’ . $moreClientsQuery . $escapedQuery . ‘%’’)
->or_having(‘client_company_name LIKE ‘’ . $moreClientsQuery . $escapedQuery . ‘%’’)
->or_having(‘client_surname LIKE ‘’ . $moreClientsQuery . $escapedQuery . ‘%’’)
->or_having(‘client_fullname LIKE ‘’ . $moreClientsQuery . $escapedQuery . ‘%’’)
->order_by(‘client_company_name’,‘client_name’)
->get()
->result();

It works as far as when I enter the company name in “create invoice” the correct client first and surname will appear, but not the company name.

Unfortunately I don’t know enough php (or programming in general) to get this for each to below the code above to get either the client or the company name to work.

Has anybody an idea?


#6

Just when I sent this I had an idea and it works! - at least in the “create invoice” search:

Here is the code for the application\helpers*client_helper.php*

function format_client($client) { if ($client->client_company_name != ""){ return $client->client_company_name; } elseif ($client->client_surname != "") { return $client->client_name . " " . $client->client_surname; }
return $client->client_name;

}

As you were on the same way as I, DementedZA, could you please follow the other steps I posted and let me know if it works?

We might have to test it in other searches, but then we only need someone who can tell us how to upload and REVIEW the code…

Maybe Kovah?


#7

I think that to help generate new options (functionalities) it would be nice to have a UI of functionalities to add in a way that would be much easier to provide customizations such as budget and invoices without manipulating source code and programmers to correct and optimize from then on.


#8

Will not be implemented in InvoicePlane 1. It does not make sense to add new fields that change the way the app handles clients at the moment.