Support » Plugin: NetTantra Caldera Forms - Mautic Integration » Create a Company other than the Contact

  • Resolved Aerendir

    (@aerendir)


    My Caldera Forms form collects data related to a person, but also related to his/her company.

    I need to create both the contact and the company on Mautic using this processor.

    I’m able to implement the feature but I need guidance on how to proceed (which is the development flow? Do I need to check the code in any way before committing? Any info that I need to know before proceeding?).

    I think this can be done with a really simple code.

    In Mautic all fields related to companies are like “company*” (ex.: companyaddress1, companyemail, etc.).

    This means that we can check if the current mapped field starts with “company”: if it starts with “company” we can add the field to a second array “companyData”.

    So, the steps to create both companies and contacts are those:

    1. Cycle over each field;
    2. If starts with “company”, add to $companyData array; if it doesn’t start with “company”, add to $contactData array;
    3. If not empty $contactData, prepare and submit the request to Mautic’s endpoint contacts;
    4. If not empty $companyData, prepare and submit the request to Mautic’s endpoint companies.

    What do you think about this?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter Aerendir

    (@aerendir)

    I have added the feature: how can I push it?

    The only problem (but is on Mautic side) is that to create company it is required a user with full system access.

    This is something I don’t like as I created a role with access to only contacts and assigned it to a user dedicated to Caldera Forms: with this limitation I’m forced to use a user with full system access and this is a risk for security: I hope Mautic will solve the problem ASAP. Check this to follow the discussion: https://github.com/mautic/mautic/issues/7817

    Plugin Author Dev

    (@devadattas)

    @aerendir Steps to have your changes committed to Mautic repository:

    1. Fork the Mautic repository
    2. Make your changes and commit it to the repository
    3. Create Pull Request (PR) in the original Mautic repository
    4. Once the repository owners accept the PR the changes will go into the core

    Please note that the acceptance of the PR is at the discretion of the owners of the Mautic repository.

    Also, this forum is specific to the Caldera Forms integration with Mautic. If you have change suggestions in the plugin we would be happy to integrate after appropriate review.

    Thread Starter Aerendir

    (@aerendir)

    Maybe I was not clear with my explanation: I’d like to contribute to your plugin, not the Mautic repository. I know how to contribute on GitHub, but I never contributed to any WordPress plugin, so I don’t know how to do.

    I simply checked out the SVN source code, implemented in trunk the ability to create also the company through the API (and associate contact and company) and now I’m trying to commit the changes but I need a certificate: I don’t have it and don’t know to what it refers to…

    Maybe you can guide me about how to contribute to the “NetTantra Caldera Forms – Mautic Integration” plugin.

    Plugin Author Dev

    (@devadattas)

    @aerendir Could you share a screencast of the functionality you have explained/coded here. I can show it to the other collaborators and reach a consensus to get the feature in. Post that we can get you committer access to the plugin and you can push to the Plugin code using SVN.

    Thread Starter Aerendir

    (@aerendir)

    Is this good to show you what the feature I added does?

    https://recordit.co/J96MBltARR

    Plugin Author Dev

    (@devadattas)

    Thanks, @aerendir for the screencast. This should be good for understanding purposes

    Please give me some time to take it to the other contributors and come back to you.

    Plugin Author Dev

    (@devadattas)

    @aerendir Just an additional query, does this handle existing company names as well or only creates new companies?

    Thread Starter Aerendir

    (@aerendir)

    To test what you ask I did a simple thing: I added a second field to the form companyvat.

    So, The first time I use “Test Name” as companyname and “IT1234567890” as companyvat: the company is created and the VAT is the one passed.

    The second time, I use again “Test Name” as companyname but change companyvat to “IT0987654321”: the company is correctly updated.

    But I noticed that if I don’t pass a value for email a new contact is created each time with the name of the company passed.

    I need to test it using always the same email, trying to only edit the companyvat field.

    Currently I don’t know if this is a wrong implementation on my side or, instead, a wrong implementation on Mautic side.

    Below there are some tests to check the behaviors.

    TESTS

    TEST ONLY COMPANY
    Don’t pass a contact
    – Pass the name of “company”: is it created?
    – Pass the name of “company2” and its VAT: is it created? Is The VAT correct?
    – Pass the name of “company2” and its VAT2: is the VAT changed? Another company is not created

    TEST ONLY CONTACT
    Don’t pass a company
    – Pass the email of “contact”: is it created?
    – Pass the email of “contact2” and a name: is it created? Is the name correct?
    – Pass the email of “contact2” and another name: is the name changed? Another contact is not created

    TEST COMPANY AND COMPANY TOGETHER
    Pass both a company and a contact
    – Pass the email of “contact” and the name of “company”: are the two linked now? Another contact is not created; another company is not created
    – Pass the email of “contact” and change the name to “name3”: the company is still linked, the name is updated, another contact is not created
    – Pass the email of “contact2” and the “company2” with a different VAT: the contact and the company are now linked, the VAT number is updated.

    I think those tests should cover all possible scenarios, don’t them?

    Plugin Author Dev

    (@devadattas)

    @aerendir Thanks for the detailed coverage report. I think that this should suffice. I am still waiting to hear from others. I am all good with this feature being added. I am pretty sure the others would also agree. Once, I have approval I would add you as a committer to this plugin. Post first commit you shall be added as a contributor to this plugin.

    Plugin Author Dev

    (@devadattas)

    @aerendir You have been added as a committer to the nettantra-caldera-forms-mautic-integration Plugin. You can now push to this plugin. You can also add yourself as a contributor by adding your WordPress username here as “Contributors: ” in https://plugins.trac.wordpress.org/browser/nettantra-caldera-forms-mautic-integration/trunk/readme.txt

    Also, please change the version to 1.0.2 and add your changelog into https://plugins.trac.wordpress.org/browser/nettantra-caldera-forms-mautic-integration/trunk/readme.txt

    Once done please tag the new version so that it shows up in WordPress.

    Thread Starter Aerendir

    (@aerendir)

    Ok, perfect… Give me some time to test the behaviors…

    Plugin Author Dev

    (@devadattas)

    @aerendir The rest of the committers were asking if this change been updated yet.

    Plugin Author Dev

    (@devadattas)

    @aerendir Do let us know whenever you are ready to update the plugin we will add committer access back again for you.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Create a Company other than the Contact’ is closed to new replies.