Company Name as a standard field

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.

Last Update: 2018-03-06

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.

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.

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?

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?

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.

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.

But clients want to be invoiced using their company details.
Makes complete sense.
It’s quite unprofessional, having to tell your client; “Sorry I can only invoice you personally but not your company”.

I advised my client to put the company name in the client name field and the contact in the surname field. Actually, i relabeled the fields on the form…passively guiding my client to put the data where i want it so i can output it the way he wants it.

I pretty much disabled the translation method on our IP instance but we are producing invoices like we want

1 Like