I added also a change to the name of the new Opportunity to distinguish it from the name of the Quote, I found this confusing. you can drop it if you don’t need it, or change it to suit your taste.
Do you think we should add this to SuiteCRM for everybody? Or maybe there are situations where this wouldn’t be considered a feature? Can you think of one? I am just wondering.
I think it should be added as a feature for everybody.
I don’t see a scenario where I would not want to add the person on the quote to the opportunity. I’d say that it’s a clear indication of involvement if the quote is addressed to them.
If adding the contact is optional then it should definitely be added for everybody. Otherwise I would try to modify it to make this an option on each single quote/opportunity.
The reality is that there can be several situations under which there is no known contact of an account. For example think of a quote requested via a web form. If you ask for too much information you will end up without any requests for quotation!
I don’t see any if statement in the code. For me it should be fine with your modification.
However it obliges to have a contact associated when there is one. And, possibly, there are situations when this is not the wanted behaviour so one should then remove it manually.
To make this really nice I would go the extra mile and:
. add a global config variable (company wide) (YES/NO/ASK) to decide whether it should be added automatically (YES/NO) or let the user decide (ASK)
. add a pop up form, in case there is one contact and the variable is set to ASK to prompt the user whether the association should be made or not. The pop up should display also the contact information)
. additionally, but I don’t see an advantage, there could be a similar variable at user level that overrides the company wide variable
. lastly there should be some more code to take care of “automated” processing such as workflows (logic hooks?) or other situations when the association takes place without user interaction (Maybe just set one more global variable (YES/NO) so that the flow should check if it is a workflow or other automated script and, accordingly decide how to behave.
It seems complicated but it should be simple in terms of coding (specially if you leave the variable just in config or config_override without adding it to the interface.
I think I should be able to write the additional code with a few exceptions:
. check if it is an automated script such as workflow or logic hook or other
. set the default config/override variable
I don’t have an “if”, I believe the “add” function simply fails when we don’t pass a valid Contact Id as an argument. I tested this, and it worked, and there wasn’t any message that I could find in the logs. Not very elegant code, I admit, but seems to work…
I don’t have time to “go the extra mile” right now, but if you or anyone else wants to do it, that would be great.
If we do put in the code, just like it is right now, I guess people could easily disable it (comment it out) if they wanted to. It’s easier to remove code than to add